@g1cloud/bpmn-modeler-next 5.0.0-beta.17 → 5.0.0-beta.18
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/lower.d.ts +8 -0
- package/dist/bpmn-modeler.js +7710 -7694
- package/dist/bpmn-modeler.umd.cjs +58 -58
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(Z,he){typeof exports=="object"&&typeof module<"u"?he(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],he):(Z=typeof globalThis<"u"?globalThis:Z||self,he(Z.BpmnModeler={},Z.Vue))})(this,(function(Z,he){"use strict";var x$=Object.defineProperty;var w$=(Z,he,so)=>he in Z?x$(Z,he,{enumerable:!0,configurable:!0,writable:!0,value:so}):Z[he]=so;var gi=(Z,he,so)=>w$(Z,typeof he!="symbol"?he+"":he,so);const so=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],lc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function tm(e){return so.includes(e)}function nm(e){return lc.includes(e)}const uc=["timer"],pc={timer:"bpmn:TimerEventDefinition"};function im(e){return typeof e=="string"&&uc.includes(e)}function tp(e){if(e.length===1)return uc.find(t=>pc[t]===e[0])}const fc=["ko","en","ja","zh"];function a1(e){return typeof e=="string"&&fc.includes(e)}const rm="http://g1project.net/spec/bpmn/bwl/1.0",np="bwl",ip=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],dc="bwl:ReviewRequest",om={name:"bwl-hints",uri:rm,prefix:np,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]},{name:"ReviewRequest",superClass:["Element"],properties:[{name:"locale",isAttr:!0,type:"String"},{name:"sourceLocale",isAttr:!0,type:"String"},{name:"previous",isBody:!0,type:"String"}]}]},rp="bwl.undoEpisode",am=new WeakSet;function s1(e){am.has(e)||(e.register(rp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),am.add(e))}function sm(e,t){s1(e);const n={run:t};if(e.execute(rp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function op(e){return Array.prototype.concat.apply([],e)}const Wa=Object.prototype.toString,c1=Object.prototype.hasOwnProperty;function co(e){return e===void 0}function un(e){return e!==void 0}function zo(e){return e==null}function $e(e){return Wa.call(e)==="[object Array]"}function gn(e){return Wa.call(e)==="[object Object]"}function He(e){return Wa.call(e)==="[object Number]"}function yn(e){const t=Wa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Kn(e){return Wa.call(e)==="[object String]"}function l1(e){if(!$e(e))throw new Error("must supply array")}function Xn(e,t){return!zo(e)&&c1.call(e,t)}function Tt(e,t){const n=mc(t);let i;return z(e,function(r,o){if(n(r,o))return i=r,!1}),i}function cm(e,t){const n=mc(t);let i=$e(e)?-1:void 0;return z(e,function(r,o){if(n(r,o))return i=o,!1}),i}function nt(e,t){const n=mc(t);let i=[];return z(e,function(r,o){n(r,o)&&i.push(r)}),i}function z(e,t){let n,i;if(co(e))return;const r=$e(e)?h1:d1;for(let o in e)if(Xn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function u1(e,t){if(co(e))return[];l1(e);const n=mc(t);return e.filter(function(i,r){return!n(i,r)})}function Zn(e,t,n){return z(e,function(i,r){n=t(n,i,r)}),n}function lo(e,t){return!!Zn(e,function(n,i,r){return n&&t(i,r)},!0)}function Rr(e,t){return!!Tt(e,t)}function Ln(e,t){let n=[];return z(e,function(i,r){n.push(t(i,r))}),n}function hc(e){return e&&Object.keys(e)||[]}function p1(e){return hc(e).length}function Go(e){return Ln(e,t=>t)}function Vo(e,t,n={}){return t=ap(t),z(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function lm(e,...t){e=ap(e);let n={};return z(t,r=>Vo(r,e,n)),Ln(n,function(r,o){return r[0]})}const f1=lm;function ji(e,t){t=ap(t);let n=[];return z(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)}),Ln(n,i=>i.v)}function Wo(e){return function(t){return lo(e,function(n,i){return t[i]===n})}}function ap(e){return yn(e)?e:t=>t[e]}function mc(e){return yn(e)?e:t=>t===e}function d1(e){return e}function h1(e){return Number(e)}function sp(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 l(){n&&a(!0),c()}function u(...p){o=Date.now(),i=p,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Un(e,t){return e.bind(t)}function U(e,...t){return Object.assign(e,...t)}function m1(e,t,n){let i=e;return z(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];un(a)&&zo(s)&&(s=i[r]=isNaN(+a)?{}:[]),co(a)?co(n)?delete i[r]:i[r]=n:i=s}),e}function Di(e,t){let n={},i=Object(e);return z(t,function(r){r in i&&(n[r]=e[r])}),n}function Hi(e,t){let n={},i=Object(e);return z(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function M(e,t){var n=pe(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function et(e,t){return Rr(t,function(n){return M(e,n)})}function pe(e){return e&&e.businessObject||e}function ut(e){return e&&e.di}const g1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",um="i18n",Uo="i18n:Translation";function uo(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function qo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Uo)})}function In(e){return e.get("xml:lang")}function Cr(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,dc)})}function Ua(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,r,o)=>i!==t&&o.indexOf(i)===r)]}function cp(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function lp(e,t,n){const i=uo(e);if(!i)return{};const r=i.target[i.key]??"",o=qo(e).filter(u=>In(u)),a=u=>u.body??"",s=r?o.filter(u=>a(u)===r).map(In):[],c=r?s.length?s:[n??t.designLocale]:[],l={};for(const u of Ua(t)){if(c.includes(u)){l[u]=r;continue}const p=o.find(f=>In(f)===u&&a(f));p&&(l[u]=a(p))}return l}const gc="bwl.updateTranslation";class up{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:r,locales:o,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=uo(c),u=[];t.undo=u;const p=qo(c).filter(N=>In(N)),f=s??(l?l.target[l.key]??"":""),d=a??r,h=(N=>{if(!N)return[];const T=p.filter(D=>D.body===N).map(In);return T.length?T:[d]})(f),y=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,C=N=>{var T;return((T=p.find(D=>In(D)===N&&D.body))==null?void 0:T.body)??(h.includes(N)?f:"")},x=N=>Cr(c).some(T=>T.locale===N),m=C(y);if(m===i)return[];const v=!!m&&!x(y),w=v?o.filter(N=>N!==y&&C(N)&&!x(N)):[],S=()=>{let N=c.extensionElements;return N||(N=this.moddle.create("bpmn:ExtensionElements",{values:[]}),N.$parent=c,c.extensionElements=N,u.push(()=>delete c.extensionElements)),N.get("values")},k=(N,T)=>{const D=S();let j=D.find(ee=>{var ge;return((ge=ee.$instanceOf)==null?void 0:ge.call(ee,Uo))&&In(ee)===N});if(j){const ee=j.body;j.body=T,u.push(()=>j.body=ee)}else j=this.moddle.create(Uo,{body:T}),j.set("xml:lang",N),j.$parent=c.extensionElements,D.push(j),u.push(()=>D.splice(D.indexOf(j),1))},O=N=>{const T=S(),D=T.indexOf(N);T.splice(D,1),u.push(()=>T.splice(D,0,N))};if(s===void 0){if(y===r&&l){if(f&&!p.some(T=>T.body===f)){const T=a&&a!==r?a:void 0;T&&k(T,f)}const N=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{N?l.target[l.key]=f:delete l.target[l.key]})}k(y,i)}else(p.some(N=>In(N)===y)||!f&&y!==d)&&k(y,i);if(!v)for(const N of Cr(c).filter(T=>T.locale===y))O(N);for(const N of w){const T=S(),D=this.moddle.create(dc,{locale:N,sourceLocale:y,previous:m});D.$parent=c.extensionElements,T.push(D),u.push(()=>T.splice(T.indexOf(D),1))}for(const N of Cr(c).filter(T=>T.sourceLocale===y&&(T.previous??"")===i))O(N);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}gi(up,"$inject",["moddle"]);const pp="bwl.setTranslations",y1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class fp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:r=[],designLocale:o,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!uo(l))return[];const p=()=>{let C=l.extensionElements;return C||(C=this.moddle.create("bpmn:ExtensionElements",{values:[]}),C.$parent=l,l.extensionElements=C,u.push(()=>delete l.extensionElements)),C.get("values")},f=C=>{const x=p(),m=x.indexOf(C);m<0||(x.splice(m,1),u.push(()=>x.splice(m,0,C)))},d=C=>qo(l).find(x=>In(x)===C);if(i===null)for(const C of a){const x=d(C);x&&f(x)}else if(i)for(const C of a){const x=i[C];if(x===void 0)continue;const m=d(C);if(m){if(m.body===x)continue;const S=m.body;m.body=x,u.push(()=>m.body=S);continue}if(C===o&&(s??o)===o)continue;const v=p(),w=this.moddle.create(Uo,{body:x});w.set("xml:lang",C),w.$parent=l.extensionElements,v.push(w),u.push(()=>v.splice(v.indexOf(w),1))}const h=[...i===null?[]:c.requests.filter(C=>!r.includes(C.locale)&&!(i&&i[C.locale]!==void 0&&i[C.locale]!==c.texts[C.locale])&&!(i&&C.sourceLocale&&i[C.sourceLocale]===C.previous))];for(const C of Cr(l)){const x=h.findIndex(m=>y1(C,m));x>=0?h.splice(x,1):f(C)}for(const C of h){const x=p(),m=this.moddle.create(dc,{locale:C.locale,...C.sourceLocale?{sourceLocale:C.sourceLocale}:{},previous:C.previous});m.$parent=l.extensionElements,x.push(m),u.push(()=>x.splice(x.indexOf(m),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}gi(fp,"$inject",["moddle"]);function dp(e){return Cr(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class hp{constructor(t){t.registerHandler(gc,up),t.registerHandler(pp,fp)}}gi(hp,"$inject",["commandStack"]);const mp={__init__:["translationCommands"],translationCommands:["type",hp]},pm=["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","translation.confirm","element.remove"],v1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},b1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(fc.map(e=>[e,{type:"string"}])),additionalProperties:!1},x1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},w1={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},_1={type:"string",enum:[...uc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},E1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...lc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},S1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},R1={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},C1={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id","source","target"],additionalProperties:!1},M1={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},A1={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},P1={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},T1={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},k1={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},O1={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...ip]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Mn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const D1={"participant.add":Mn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Mn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Mn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":Mn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[...lc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Mn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Mn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":Mn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Mn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Mn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Mn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Mn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Mn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Mn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Mn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":Mn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Mn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":Mn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...fc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Mn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},fm={anyOf:pm.map(e=>D1[e])},L1={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라. 문서에 문서 언어 설정이 있으면(describe 의 i18n) 문구는 평문 name/text 가 아니라 names/texts 로 문서 언어 전부를 준다.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:x1,irParticipant:w1,irNode:E1,irFlowCondition:S1,irSequenceFlow:R1,irMessageFlow:C1,irDataStore:M1,irDataAssociation:A1,irTextAnnotation:P1,irAssociation:T1,irGroup:k1,bwlPlacement:O1,eventDefinition:_1,localeTexts:b1,nullableString:v1,symbolicOp:fm}};function gp(){}gp.prototype.get=function(e){return this.$model.properties.get(this,e)},gp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function dm(e,t){this.model=e,this.properties=t}dm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(gp.prototype);z(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}),z(a,Un(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 I1=U(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),hm=U(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 yp(e,t){var n=hm[e];return n?n(t):t}function vp(e){return!!I1[e]}function mm(e){return!!hm[e]}function Bn(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 li(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}li.prototype.build=function(){return Di(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},li.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)},li.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},li.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Bn(r[0],i),a=Bn(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},li.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},li.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},li.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},li.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},li.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},li.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")},li.prototype.hasProperty=function(e){return this.propertiesByName[e]},li.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(z(e.properties,Un(function(o){o=U({},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 Mr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Un(this.registerPackage,this))}Mr.prototype.getPackage=function(e){return this.packageMap[e]},Mr.prototype.getPackages=function(){return this.packages},Mr.prototype.registerPackage=function(e){e=U({},e);var t=this.packageMap;gm(t,e,"prefix"),gm(t,e,"uri"),z(e.types,Un(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Mr.prototype.registerType=function(e,t){e=U({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:U({},e.meta||{})});var n=Bn(e.name,t.prefix),i=n.name,r=Object.create(null);z(e.properties,Un(function(o){var a=Bn(o.name,n.prefix),s=a.name;vp(o.type)||(o.type=Bn(o.type,a.prefix).name),U(o,{ns:a,name:s}),r[s]=o},this)),U(e,{ns:n,name:i,propertiesByName:r}),z(e.extends,Un(function(o){var a=Bn(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},Mr.prototype.mapTypes=function(e,t,n){var i=vp(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=Bn(c,vp(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},Mr.prototype.getEffectiveDescriptor=function(e){var t=Bn(e),n=new li(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},Mr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function gm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function po(e){this.model=e}po.prototype.set=function(e,t,n){if(!Kn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;B1(n)?i?delete e[r]:delete e.$attrs[bp(t)]:i?r in e?e[r]=n:ym(e,i,n):e.$attrs[bp(t)]=n},po.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[bp(t)];var i=n.name;return!e[i]&&n.isMany&&ym(e,n,[]),e[i]},po.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=U({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},po.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},po.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},po.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 B1(e){return typeof e>"u"}function ym(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function bp(e){return e.replace(/^:/,"")}function yi(e,t={}){this.properties=new po(this),this.factory=new dm(this,this.properties),this.registry=new Mr(e,this.properties),this.typeCache=Object.create(null),this.config=t}yi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},yi.prototype.getType=function(e){var t=this.typeCache,n=Kn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},yi.prototype.createAny=function(e,t,n){var i=Bn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){m1(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}),z(n,function(a,s){gn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},yi.prototype.getPackage=function(e){return this.registry.getPackage(e)},yi.prototype.getPackages=function(){return this.registry.getPackages()},yi.prototype.getElementDescriptor=function(e){return e.$descriptor},yi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},yi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},yi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var vm=String.fromCharCode,N1=Object.prototype.hasOwnProperty,$1=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,qa={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(qa).forEach(function(e){qa[e.toUpperCase()]=qa[e]});function F1(e,t,n,i){return i?N1.call(qa,i)?qa[i]:"&"+i+";":vm(t||parseInt(n,16))}function fo(e){return e.length>3&&e.indexOf("&")!==-1?e.replace($1,F1):e}var bm="non-whitespace outside of root node";function Ar(e){return new Error(e)}function j1(e){return"missing namespace for prefix <"+e+">"}function yc(e){return{get:e,enumerable:!0}}function H1(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var xm=Symbol("nameCache");function xp(e){return e+"$uri"}function z1(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[xp(i)]=n;return t}function vc(){return{line:0,column:0}}function G1(e){throw e}function wm(e){if(!this)return new wm(e);var t=e&&e.proxy,n,i,r,o,a=G1,s,c,l,u,p=vc,f=!1,d=!1,g="",h=!1,y=!1,C=null,x=!1,m,v,w,S;function k(D){D instanceof Error||(D=Ar(D)),C=D,a(D,p)}function O(D){s&&(D instanceof Error||(D=Ar(D)),s(D,p))}this.on=function(D,j){if(typeof j!="function")throw Ar("required args <name, cb>");switch(D){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":u=j;break;case"question":l=j;break;case"comment":c=j;break;default:throw Ar("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw Ar("required args <nsMap={}>");var j=Object.create(null),ee;for(ee in D)j[ee]=D[ee];return y=!0,S=j,this};function N(){m=y?[]:null,v=y?z1(S):null,w=[],p=vc,x=!1,C=null,d=!1,g=""}this.parse=function(D){if(typeof D!="string")throw Ar("required args <xml=string>");if(f)throw Ar("parse during stream; call end() first");return N(),T(D),p=vc,x=!1,C},this.write=function(D){if(typeof D!="string")throw Ar("required args <xml=string>");return f||(N(),f=!0),C||(g=T(g+D,!0)||""),this},this.end=function(){return f||N(),f=!1,C||T(g),g="",p=vc,x=!1,C},this.stop=function(){x=!0};function T(D,j=!1){var ee=null,ge=null,Pe,De=0,Ue=!1,ot=!1,Me=0,X=0,ne,q,K,se,de,Te,$,R,_,G="",W=0,te;function Re(Et,mn){var Sn=Et.indexOf(":");if(Sn===-1)return Et;var Gn=v[Et.substring(0,Sn)];return Gn?mn===Gn?Et.substr(Sn+1):Gn+Et.substr(Sn):(O(j1(Et.substring(0,Sn))),null)}function Ke(){if(te!==null)return te;var Et,mn,Sn=y&&v.xmlns,Gn=y&&h?[]:null,Ct=W,Qt=G,wn=Qt.length,Fa,Vn,Ni,ai,nn,Do={},ja=new Set,Rn,dt,wt;e:for(;Ct<wn;Ct++)if(Rn=!1,dt=Qt.charCodeAt(Ct),!(dt===32||dt<14&&dt>8)){for((dt<65||dt>122||dt>90&&dt<97)&&dt!==95&&dt!==58&&(O("illegal first char attribute name"),Rn=!0),wt=Ct+1;wt<wn;wt++)if(dt=Qt.charCodeAt(wt),!(dt>96&&dt<123||dt>64&&dt<91||dt>47&&dt<59||dt===46||dt===45||dt===95)){if(dt===32||dt<14&&dt>8){O("missing attribute value"),Ct=wt;continue e}if(dt===61)break;O("illegal attribute name char"),Rn=!0}if(nn=Qt.substring(Ct,wt),nn==="xmlns:xmlns"&&(O("illegal declaration of xmlns"),Rn=!0),dt=Qt.charCodeAt(wt+1),dt===34)wt=Qt.indexOf('"',Ct=wt+2),wt===-1&&(wt=Qt.indexOf("'",Ct),wt!==-1&&(O("attribute value quote missmatch"),Rn=!0));else if(dt===39)wt=Qt.indexOf("'",Ct=wt+2),wt===-1&&(wt=Qt.indexOf('"',Ct),wt!==-1&&(O("attribute value quote missmatch"),Rn=!0));else for(O("missing attribute value quotes"),Rn=!0,wt=wt+1;wt<wn&&(dt=Qt.charCodeAt(wt+1),!(dt===32||dt<14&&dt>8));wt++);for(wt===-1&&(O("missing closing quotes"),wt=wn,Rn=!0),Rn||(Ni=Qt.substring(Ct,wt)),Ct=wt;wt+1<wn&&(dt=Qt.charCodeAt(wt+1),!(dt===32||dt<14&&dt>8));wt++)Ct===wt&&(O("illegal character after attribute end"),Rn=!0);if(Ct=wt+1,Rn)continue e;if(ja.has(nn)){O("attribute <"+nn+"> already defined");continue}if(ja.add(nn),!y){Do[nn]=Ni;continue}if(h){if(Vn=nn==="xmlns"?"xmlns":nn.charCodeAt(0)===120&&nn.substr(0,6)==="xmlns:"?nn.substr(6):null,Vn!==null){if(Et=fo(Ni),mn=xp(Vn),ai=S[Et],!ai){if(Vn==="xmlns"||mn in v&&v[mn]!==Et)do ai="ns"+De++;while(typeof v[ai]<"u");else ai=Vn;S[Et]=ai}v[Vn]!==ai&&(Fa||(v=H1(v),Fa=!0),v[Vn]=ai,Vn==="xmlns"&&(v[xp(ai)]=Et,Sn=ai),v[mn]=Et),Do[nn]=Ni;continue}Gn.push(nn,Ni);continue}nn=Re(nn,Sn),nn!==null&&(Do[nn]=Ni)}if(h)for(Ct=0,wn=Gn.length;Ct<wn;Ct++)nn=Re(Gn[Ct++],Sn),Ni=Gn[Ct],nn!==null&&(Do[nn]=Ni);return te=Do}function mt(){for(var Et=/(\r\n|\r|\n)/g,mn=0,Sn=0,Gn=0,Ct=X,Qt,wn;Me>=Gn&&(Qt=Et.exec(D),!(!Qt||(Ct=Qt[0].length+Qt.index,Ct>Me)));)mn+=1,Gn=Ct;return Me==-1?(Sn=Ct,wn=D.substring(X)):X===0?wn=D.substring(X,Me):(Sn=Me-Gn,wn=X==-1?D.substring(Me):D.substring(Me,X+1)),{data:wn,line:mn,column:Sn}}for(p=mt,t&&(_=Object.create({},{name:yc(function(){return $}),originalName:yc(function(){return R}),attrs:yc(Ke),ns:yc(function(){return v})}));X!==-1;){if(D.charCodeAt(X)===60?Me=X:Me=D.indexOf("<",X),Me===-1){if(j)return D.substring(X);if(w.length)return k("unexpected end of file");if(!d)return k("missing start tag");X<D.length&&D.substring(X).trim()&&O(bm);return}if(d||(d=!0),X!==Me){if(w.length){if(n&&(n(D.substring(X,Me),fo,p),x))return}else if(D.substring(X,Me).trim()&&(O(bm),x))return}if(se=D.charCodeAt(Me+1),se===33){if(K=D.charCodeAt(Me+2),K===91&&D.substr(Me+3,6)==="CDATA["){if(X=D.indexOf("]]>",Me),X===-1)return j?D.substring(Me):k("unclosed cdata");if(o&&(o(D.substring(Me+9,X),p),x))return;X+=3;continue}if(K===45&&D.charCodeAt(Me+3)===45){if(X=D.indexOf("-->",Me),X===-1)return j?D.substring(Me):k("unclosed comment");if(c&&(c(D.substring(Me+4,X),fo,p),x))return;X+=3;continue}}if(se===63){if(X=D.indexOf("?>",Me),X===-1)return j?D.substring(Me):k("unclosed question");if(l&&(l(D.substring(Me,X+2),p),x))return;X+=2;continue}for(ne=Me+1;;ne++){if(de=D.charCodeAt(ne),isNaN(de))return j?D.substring(Me):(X=-1,k("unclosed tag"));if(de===34)K=D.indexOf('"',ne+1),ne=K!==-1?K:ne;else if(de===39)K=D.indexOf("'",ne+1),ne=K!==-1?K:ne;else if(de===62){X=ne;break}}if(se===33){if(u&&(u(D.substring(Me,X+1),fo,p),x))return;X+=1;continue}if(te={},se===47){if(Ue=!1,ot=!0,!w.length)return k("missing open tag");if(ne=$=w.pop(),K=Me+2+ne.length,D.substring(Me+2,K)!==ne)return k("closing tag mismatch");for(;K<X;K++)if(se=D.charCodeAt(K),!(se===32||se>8&&se<14))return k("close tag")}else{if(D.charCodeAt(X-1)===47?(ne=$=D.substring(Me+1,X-1),Ue=!0,ot=!0):(ne=$=D.substring(Me+1,X),Ue=!0,ot=!1),!(se>96&&se<123||se>64&&se<91||se===95||se===58))return k("illegal first char nodeName");for(K=1,q=ne.length;K<q;K++)if(se=ne.charCodeAt(K),!(se>96&&se<123||se>64&&se<91||se>47&&se<59||se===45||se===95||se==46)){if(se===32||se<14&&se>8){$=ne.substring(0,K),te=null;break}return k("invalid nodeName")}ot||w.push($)}if(y){Pe=v,Ue&&(ot||m.push(Pe),te===null&&(h=ne.indexOf("xmlns",K)!==-1)&&(W=K,G=ne,Ke(),h=!1)),R=$,ge!==v&&(ee=v[xm],ee===void 0&&(ee=v[xm]=Object.create(null)),ge=v);var qt=ee[$];if(qt!==void 0)$=qt;else{if(se=$.indexOf(":"),se!==-1){if(Te=v[$.substring(0,se)],!Te)return k("missing namespace on <"+R+">");$=$.substr(se+1)}else Te=v.xmlns;Te&&($=Te+":"+$),ee[R]=$}}if(Ue&&(W=K,G=ne,i&&(t?i(_,fo,ot,p):i($,Ke,fo,ot,p),x)))return;if(ot){if(r&&(r(t?_:$,fo,Ue,p),x))return;y&&(Ue?v=Pe:v=m.pop())}X+=1}}}function _m(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var wp={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Em="property";function Sm(e){return e.xml&&e.xml.serialize}function V1(e){const t=Sm(e);return t!==Em&&(t||null)}function W1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Rm(e,t){return _m(t)?e.prefix+":"+W1(e.localName):e.name}function U1(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 q1(e,t,n){const i=Bn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Bn(r);var a=n.getPackage(o.prefix);return U1(o,a)}function Pr(e){return new Error(e)}function ar(e){return e.$descriptor}function Y1(e){U(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Pr("expected element");var n=this.elementsById,i=ar(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 Pr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ya(){}Ya.prototype.handleEnd=function(){},Ya.prototype.handleText=function(){},Ya.prototype.handleNode=function(){};function _p(){}_p.prototype=Object.create(Ya.prototype),_p.prototype.handleNode=function(){return this};function Yo(){}Yo.prototype=Object.create(Ya.prototype),Yo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ka(e,t){this.property=e,this.context=t}Ka.prototype=Object.create(Yo.prototype),Ka.prototype.handleNode=function(e){if(this.element)throw Pr("expected no sub nodes");return this.element=this.createReference(e),this},Ka.prototype.handleEnd=function(){this.element.id=this.body},Ka.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Ep(e,t){this.element=t,this.propertyDesc=e}Ep.prototype=Object.create(Yo.prototype),Ep.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=yp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function bc(){}bc.prototype=Object.create(Yo.prototype),bc.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 jn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}jn.prototype=Object.create(bc.prototype),jn.prototype.addReference=function(e){this.context.addReference(e)},jn.prototype.handleText=function(e){var t=this.element,n=ar(t),i=n.bodyProperty;if(!i)throw Pr("unexpected body text <"+e+">");Yo.prototype.handleText.call(this,e)},jn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ar(t),i=n.bodyProperty;i&&e!==void 0&&(e=yp(i.type,e),t.set(i.name,e))},jn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ar(n),r=this.context,o=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){r.addReference({element:o,property:u.ns.name,id:f})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=yp(u.type,c):l==="xmlns"?l=":"+l:(s=Bn(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},jn.prototype.getPropertyForNode=function(e){var t=e.name,n=Bn(t),i=this.type,r=this.model,o=ar(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=V1(s);if(l){const u=e.attributes[l];if(u){const p=q1(u,e.ns,r),f=r.getType(p);return U({},s,{effectiveType:ar(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Rm(n,c),u=r.getType(l);if(s=Tt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return U({},s,{effectiveType:ar(u).name})}else if(s=Tt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Pr("unrecognized element <"+n.name+">")},jn.prototype.toString=function(){return"ElementDescriptor["+ar(this.type).name+"]"},jn.prototype.valueHandler=function(e,t){return new Ep(e,t)},jn.prototype.referenceHandler=function(e){return new Ka(e,this.context)},jn.prototype.handler=function(e){return e==="Element"?new Ko(this.model,e,this.context):new jn(this.model,e,this.context)},jn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,mm(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?(U(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Sp(e,t,n){jn.call(this,e,t,n)}Sp.prototype=Object.create(jn.prototype),Sp.prototype.createElement=function(e){var t=e.name,n=Bn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Rm(n,o)||t;if(!r.hasType(a))throw Pr("unexpected element <"+e.originalName+">");return jn.prototype.createElement.call(this,e)};function Ko(e,t,n){this.model=e,this.context=n}Ko.prototype=Object.create(bc.prototype),Ko.prototype.createElement=function(e){var t=e.name,n=Bn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Ko.prototype.handleChild=function(e){var t=new Ko(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},Ko.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Rp(e){e instanceof yi&&(e={model:e}),U(this,{lax:!1},e)}Rp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof jn?(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 Y1(U({},t,{rootHandler:i})),s=new wm({proxy:!0}),c=K1();i.context=a,c.push(i);function l(w,S,k){var O=S(),N=O.line,T=O.column,D=O.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var j="unparsable content "+(D?D+" ":"")+`detected
|
|
2
|
-
line:
|
|
3
|
-
column: `+
|
|
4
|
-
nested error: `+w.message;if(
|
|
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 fS(e){e=U({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new uS,o=new pS(r,e.format);e.preamble&&o.append(X1);var a=new jt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(dS(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function dS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in wp)n[i]=wp[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 wc(e,t){yi.call(this,e,t)}wc.prototype=Object.create(yi.prototype),wc.prototype.fromXML=function(e,t,n){Kn(t)||(n=t,t="bpmn:Definitions");var i=new Rp(U({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},wc.prototype.toXML=function(e,t){var n=new fS(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var hS="BPMN20",mS="http://www.omg.org/spec/BPMN/20100524/MODEL",gS="bpmn",yS=[],vS=[{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"}]}],bS=[{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"}]}],xS={tagAlias:"lowerCase",typePrefix:"t"},wS={name:hS,uri:mS,prefix:gS,associations:yS,types:vS,enumerations:bS,xml:xS},_S="BPMNDI",ES="http://www.omg.org/spec/BPMN/20100524/DI",SS="bpmndi",RS=[{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"]}],CS=[{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"}]}],MS=[],AS={name:_S,uri:ES,prefix:SS,types:RS,enumerations:CS,associations:MS},PS="DC",TS="http://www.omg.org/spec/DD/20100524/DC",kS="dc",OS=[{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}]}],DS=[],LS={name:PS,uri:TS,prefix:kS,types:OS,associations:DS},IS="DI",BS="http://www.omg.org/spec/DD/20100524/DI",NS="di",$S=[{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"}]}],FS=[],jS={tagAlias:"lowerCase"},HS={name:IS,uri:BS,prefix:NS,types:$S,associations:FS,xml:jS},zS="bpmn.io colors for BPMN",GS="http://bpmn.io/schema/bpmn/biocolor/1.0",VS="bioc",WS=[{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"}]}],US=[],qS=[],YS={name:zS,uri:GS,prefix:VS,types:WS,enumerations:US,associations:qS},KS="BPMN in Color",XS="http://www.omg.org/spec/BPMN/non-normative/color/1.0",ZS="color",QS=[{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"}]}],JS=[],eR=[],tR={name:KS,uri:XS,prefix:ZS,types:QS,enumerations:JS,associations:eR};const nR={bpmn:wS,bpmndi:AS,dc:LS,di:HS,bioc:YS,color:tR};function Tm(e,t){const n=U({},nR,e);return new wc(n,t)}const iR={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"}},_c={[um]:iR,[np]:om};function km(){return Tm(_c)}const Om=km();async function Xo(e){const{rootElement:t,warnings:n}=await Om.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function rR(e){const{xml:t}=await Om.toXML(e,{format:!0});return t}function Ap(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Zo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},oR=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function aR(e){const t=Zo;return oR.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 Qo(e,t){let n=0;for(const i of e)n+=t*aR(i);return n}function Dm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&sR(e),cR(e),lR(e),uR(e)}function sR(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:Qo(r,o),fontBoundingBoxAscent:o*Zo.ascentEm,fontBoundingBoxDescent:o*Zo.descentEm,actualBoundingBoxAscent:o*Zo.ascentEm,actualBoundingBoxDescent:o*Zo.descentEm}}};t.getContext=()=>n}function cR(e){if(e.SVGMatrix)return;class t{constructor(){gi(this,"a",1);gi(this,"b",0);gi(this,"c",0);gi(this,"d",1);gi(this,"e",0);gi(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 lR(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,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},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 uR(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:Qo(n,12),height:14}})}const Ec=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),pR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),fR=1,Sc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),dR=2;function pt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${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"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;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"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Lm=20,Rc=5,Im=3,hR=8,Jo=15,Pp=50,Bm=12,mR=Bm*1.2;function Tp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Qo(o,Bm))),r=n.length*mR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Nm=1;function vn(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 ea(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 vn(e))for(const s of vn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Nm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Lm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function kp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function $m(e,t){const n=ea(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function gR(e,t){let n=0;for(const i of t)i.id!==e.id&&$m(e,i)&&n++;return n}function ui(e,t){let n=0;for(const i of t)i.id!==e.id&&ea(e,i)&&n++;return n}const Fm=15,jm=20;function yR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-jm||t.at>n[1]+jm)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 Op=20;function Cc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Nm)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Lm||n.push([r-Op,o+Op])}return n}function Mc(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of vn(e)){const o=yR(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Cc(r,vn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const vR=10,bR=1,xR=(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 wR(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,l=t.y-e.y;let u=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>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,l)&&f(e.y-s,-l)&&p>u}function Dp(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 _R=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ta=1;function Gi(e,t){const n=e.x+ta,i=e.x+e.width-ta,r=e.y+ta,o=e.y+e.height-ta;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 na(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 Hm(e,t){const n=e.label;if(!n)return null;if(vn(e).some(i=>Gi(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(vn(i).some(r=>Gi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Gi(n,r)))return i.id;return null}function bn(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(wR(e.waypoints[o],e.waypoints[o+1],r,dR)){i.push(r);break}}return i}const Xa=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},ER=(e,t,n,i)=>Gm(e,t,n,i)?0:Math.min(Xa(e,n,i),Xa(t,n,i),Xa(n,e,t),Xa(i,e,t)),zm=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function Za(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,Xa({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(zm(e,s)||zm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,ER(e,t,s[l],s[(l+1)%s.length]));return c}function Gm(e,t,n,i){const r=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.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 Vm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Qa(e,t){let n=0;for(const i of t){if(i.id===e.id||Vm(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++)Gm(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function pi(e,t){let n=0;for(const i of t)i.id===e.id||Vm(e,i)||Qa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Wm(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++)Qa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Ac(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Qa(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 Um(e){const t=Ac(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),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?r++:u==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:SR(e)}}function SR(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(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function qm(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Sc.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 Ym(e){var n;const t=(n=Nt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Nt(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 Km=e=>e?{members:e}:{},fi=e=>e.shapes.filter(t=>!t.container);function RR(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&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function CR(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function Xm(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(vn(i).some(r=>Gi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Gi(n,r)))return i.id;return null}function mo(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}const Zm=3;function Qm(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function Ja(e,t){const n=[];for(const i of t.shapes){if(i.container||Sc.has(i.type))continue;const r=Qm(e,i);r>=Zm&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function ht(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of bn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const r=e.shapes.filter(m=>m.container&&pR.has(m.type));if(r.length){const m=(v,w)=>{const S=e.shapes.find(k=>k.id===w);return!!S&&S.x>=v.x&&S.y>=v.y&&S.x+S.width<=v.x+v.width&&S.y+S.height<=v.y+v.height};for(const v of e.edges)for(const w of bn(v,r))v.endpoints.includes(w.id)||v.endpoints.some(S=>m(w,S))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:w.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[w,S]of v){if(!w)continue;const k=e.shapes.find(D=>D.id===w);if(!k||k.container)continue;const O=Math.max(k.x-S.x,S.x-(k.x+k.width),0),N=Math.max(k.y-S.y,S.y-(k.y+k.height),0),T=Math.hypot(O,N);T>vR&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:w,distance:Math.round(T)})}}const o=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<o.length;m++)for(let v=m+1;v<o.length;v++){const w=o[m],S=o[v];if(w.x+w.width<=S.x||S.x+S.width<=w.x||w.y+w.height<=S.y||S.y+S.height<=w.y)continue;const k=(O,N)=>O.x<=N.x&&O.y<=N.y&&O.x+O.width>=N.x+N.width&&O.y+O.height>=N.y+N.height;n.push({kind:"pool-overlap",pools:[w.id,S.id],contained:k(w,S)||k(S,w)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const w=a[m],S=a[v];if(!Dp(w,S,fR))continue;const k=w.id<S.id?[w.id,S.id]:[S.id,w.id];n.push({kind:"shape-overlap",shapes:k,identical:_R(w,S)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const w=s[m],S=s[v],k=Math.min(w.x+w.width,S.x+S.width)-Math.max(w.x,S.x),O=Math.min(w.y+w.height,S.y+S.height)-Math.max(w.y,S.y);if(k<=Rc||O<=Rc)continue;const N=w.id<S.id?[w.id,S.id]:[S.id,w.id],T=new Set(S.members);if(w.members.some(j=>T.has(j))){const j=qm(e,s,{x:Math.max(w.x,S.x),y:Math.max(w.y,S.y),right:Math.min(w.x+w.width,S.x+S.width),bottom:Math.min(w.y+w.height,S.y+S.height)});j.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:N,shapes:j});continue}const D=w.x<=S.x&&w.y<=S.y&&w.x+w.width>=S.x+S.width&&w.y+w.height>=S.y+S.height?w.id:S.x<=w.x&&S.y<=w.y&&S.x+S.width>=w.x+w.width&&S.y+S.height>=w.y+w.height?S.id:void 0;n.push({kind:"group-overlap-unintended",groups:N,...D?{container:D}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!Sc.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const w=new Set(m.members),S=v.filter(k=>!w.has(k.id));S.some(k=>c.has(k.id))&&(S.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:S.map(k=>k.id).sort()}))}for(const m of s){const v=new Set(l(m).map(T=>T.id)),w=new Set(m.members),S=new Set([...v].filter(T=>!w.has(T)&&c.has(T)));if(!S.size)continue;let k=!1,O=!1,N=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const D=S.has(T.source),j=S.has(T.target);!D&&j&&!v.has(T.source)?k=!0:D&&!j&&!v.has(T.target)?O=!0:D&&j&&(N=!0)}k&&O&&N&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...S].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let w=v+1;w<u.length;w++){const S=[u[m],u[v],u[w]],k={x:Math.max(...S.map(T=>T.x)),y:Math.max(...S.map(T=>T.y)),right:Math.min(...S.map(T=>T.x+T.width)),bottom:Math.min(...S.map(T=>T.y+T.height))};if(k.right-k.x<=Rc||k.bottom-k.y<=Rc)continue;const O=qm(e,[],k);if(!O.length)continue;const N=S.map(T=>T.id).sort();n.push({kind:"group-stack-unreadable",groups:N,shapes:O})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Sc.has(v.type)||v.width<=0||v.height<=0)continue;const w=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[S,k,O,N,T]of w){const D=O==="h"?v.x:v.y,j=O==="h"?v.x+v.width:v.y+v.height;if(!(D<T&&N<j))continue;const ee=O==="h"?v.y:v.x,ge=O==="h"?v.y+v.height:v.x+v.width;if(!(ee<k&&k<ge))continue;const Pe=Math.min(k-ee,ge-k);Pe<hR||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:S,depth:Pe})}}const p=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(p.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const w=vn(v);if(w.length)for(const S of p){const k=S.x+S.width,O=S.y+S.height,N=v.endpoints.some(D=>{const j=m.get(D);return!!j&&S.x<j.x&&j.x<k&&S.y<j.y&&j.y<O});let T=null;for(const D of w){const[j,ee,ge]=D.axis==="v"?[S.y,O,[["left",S.x],["right",k]]]:[S.x,k,[["top",S.y],["bottom",O]]],Pe=Math.min(D.hi,ee)-Math.max(D.lo,j);if(Pe<Pp)continue;const De=D.axis==="v"?S.x<D.at&&D.at<k:S.y<D.at&&D.at<O;if(!(De&&N))for(const[Ue,ot]of ge){const Me=Math.abs(D.at-ot);Me<=Jo&&(!T||Me<T.distance)&&(T={side:Ue,inside:De,distance:Me,length:Pe})}}T&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:S.id,side:T.side,inside:T.inside,distance:Math.round(T.distance),length:Math.round(T.length)})}}}const f=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const w=m.x<v.x+v.width&&v.x<m.x+m.width,S=m.y<v.y+v.height&&v.y<m.y+m.height,k=[["top",m.y,v.y,w],["bottom",m.y+m.height,v.y+v.height,w],["left",m.x,v.x,S],["right",m.x+m.width,v.x+v.width,S]];for(const[O,N,T,D]of k)D&&Math.abs(N-T)<=Im&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:O})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const w=d[m],S=d[v],k=w.x<S.x+S.width&&S.x<w.x+w.width,O=w.y<S.y+S.height&&S.y<w.y+w.height,N=[["x",w.x+w.width,S.x,O],["x",S.x+S.width,w.x,O],["y",w.y+w.height,S.y,k],["y",S.y+S.height,w.y,k]];for(const[T,D,j,ee]of N)if(ee&&Math.abs(D-j)<=Im){n.push({kind:"group-on-group-boundary",groups:w.id<S.id?[w.id,S.id]:[S.id,w.id],axis:T});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const w=e.edges[m],S=e.edges[v],k=ea(w,S);if(!k)continue;const O=w.id<S.id?[w.id,S.id]:[S.id,w.id];n.push({kind:k.kind==="opposite"?"edge-overlap-opposite":k.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:O,axis:k.axis,length:Math.round(k.length)})}for(const m of e.edges){if(!m.label)continue;const v=Mc(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=Hm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:w}of Ja(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(w)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=Xm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:w}of mo(e))v===m.id||y.has(v)||Dp(m.label,w,ta)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const C=mo(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:w}of C)v!==m.id&&Dp(m,w,ta)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const x=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??RR(m,e,x);if(!v)continue;const w=x.get(v);!w||!w.container||xR(w,m,bR)||m.type==="bpmn:TextAnnotation"&&!CR(m,w,e)||n.push({kind:"shape-outside-container",shape:m.id,container:w.id})}return n.sort((m,v)=>pt(m).localeCompare(pt(v)))}const Nt=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,sr=e=>{const t=Nt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function MR(e){const t=Nt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=sr(o);a&&n.push(a)}}return n}function AR(e){const t=Nt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:sr(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:sr(t.targetRef);return n&&i?{source:n,target:i}:{}}function PR(e,t){const n=Nt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=sr(n);return r?t.get(r):void 0}if(Ec.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return sr(n)}function Jm(e){var a,s,c,l,u;const t=[],n=[],i=((a=Nt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=Nt(e))==null?void 0:s.rootElements)??[]){const f=Nt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Nt(d),h=sr(g),y=sr(g==null?void 0:g.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const p of i){const f=Nt((c=Nt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Nt(g);if(!h)continue;const y=Nt(h.bpmnElement),C=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!C)continue;const x=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=Nt(h.bounds);if(m){const w=h.isExpanded===!1&&x!=="bpmn:Participant",S=Nt((l=Nt(h.label))==null?void 0:l.bounds),k={id:C,type:x,x:Xt(m.x),y:Xt(m.y),width:Xt(m.width),height:Xt(m.height),container:Ec.has(x)&&!w,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:PR(y,r)}:{},...S?{label:{x:Xt(S.x),y:Xt(S.y),width:Xt(S.width),height:Xt(S.height)}}:{},...x==="bpmn:Group"?Km(Ym(y)):{}},O=h.isHorizontal!==!1,N=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(C)&&O&&N&&(k.label=Tp(k,N)),t.push(k);continue}const v=h.waypoint;if(Array.isArray(v)){const w=Nt((u=Nt(h.label))==null?void 0:u.bounds);n.push({id:C,type:x,waypoints:v.map(S=>{var k,O;return{x:Xt((k=Nt(S))==null?void 0:k.x),y:Xt((O=Nt(S))==null?void 0:O.y)}}),endpoints:MR(y),...AR(y),...w?{label:{x:Xt(w.x),y:Xt(w.y),width:Xt(w.width),height:Xt(w.height)}}:{}})}}}return{shapes:t,edges:n}}function eg(e){return ht(Jm(e),{includeObservationOnly:!0})}async function TR(e){const{definitions:t,warnings:n}=await Xo(e);return{findings:eg(t),warnings:n}}function We(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=Nt(o.label),y=sr(o.source),C=sr(o.target);n.push({id:o.id,type:a,waypoints:s.map(x=>({x:Xt(x.x),y:Xt(x.y)})),endpoints:[y,C].filter(x=>!!x),...y&&C?{source:y,target:C}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Nt(o.businessObject),l=Nt(o.label);let u=Nt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Nt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Ec.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Xt(o.width),height:Xt(o.height),container:Ec.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?Km(Ym(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Nt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Tp(d,g)),t.push(d)}return{shapes:t,edges:n}}const kR={"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 OR(e,t){const n=kR[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function tg(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function ng(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 OR(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&tg(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?tg(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}},eventDefinitionOf:n=>{var o;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const r=(((o=i.businessObject)==null?void 0:o.eventDefinitions)??[]).map(a=>a.$type);return tp(r)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Cr(i.businessObject).map(r=>r.locale)}}}const Lp=20,DR=4,Lt=(e,t)=>Math.abs(e-t)<.5;function Pc(e,t,n,i=Lp){if(Lt(e.y,t.y)&&!Lt(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=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Lt(e.x,t.x)&&!Lt(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=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function ig(e,t,n,i=Lp){if(n.length<2)return null;if(Lt(e.y,t.y)&&!Lt(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,l=e.x<t.x?s:a,u=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:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(Lt(e.x,t.x)&&!Lt(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,l=e.y<t.y?s:a,u=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:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function rg(e,t,n=Lp){if(e.length!==4)return null;const[i,r,o,a]=e;if(Lt(i.y,r.y)&&Lt(r.x,o.x)&&Lt(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(Lt(i.x,r.x)&&Lt(r.y,o.y)&&Lt(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 Tc(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,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const og=30,LR=[0,-25,25,-40,40];function IR(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+og:s-og,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return LR.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>bn({...e,endpoints:[],waypoints:f},[n]).length===0)}const Ip=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ia=(e,t,n)=>bn({...e,waypoints:t},n).length;function Bp(e,t,n,i){let r=[...e.waypoints],o=ia(e,r,t);if(o===0)return null;let a=!1;for(const p of Tc(e,t))if(ia(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(vn),c=p=>vn({...e,waypoints:p}).some(f=>Cc(f,s).length>0),l=IR(e,t).filter(p=>ia(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=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&&Lt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(Lt(d[0].y,d[1].y)&&!Lt(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&bn({...e,waypoints:d},[x]).length>0),h=g.length>=2?ig(d[0],d[1],g):null,C=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(Pc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>ia(e,x,t)===0&&x.length<=r.length).sort((x,m)=>Number(u(m))-Number(u(x)));if(C.length)return C.find(x=>!c(x))??C[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(C=>!e.endpoints.includes(C.id)&&bn({...e,waypoints:[f,d]},[C]).length>0);if(g.length<2)continue;const h=ig(f,d,g);if(!h)continue;const y=h.map(C=>Ip(r,p,C)).filter(C=>ia(e,C,t)===0).sort((C,x)=>Number(u(x))-Number(u(C)));if(y.length)return y.find(C=>!c(C))??y[0]}for(let p=0;p<DR&&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 y of t){if(e.endpoints.includes(y.id)||bn({...e,waypoints:[g,h]},[y]).length===0)continue;const C=Pc(g,h,y),x=C?C.map(v=>Ip(r,d,v)):rg(r,y)??[];if(!x.length)continue;const m=[...x].sort((v,w)=>Number(u(w))-Number(u(v)));for(const v of m){const w=ia(e,v,t);if(w<o){r=v,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Np(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=We(i),a=fi(o),s=new Set,c=ht(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(pt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=o.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=bn(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const y=Bp(p,a,g,o.edges);if(!y){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const C=o.edges.filter(v=>v.id!==u),x=ui(p,C);ui({...p,waypoints:y},C)>x||r.updateWaypoints(f,y)}return s}const BR=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},$p=(e,t)=>Qa(e,[t])>0;function ag(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=We(i),a=fi(o);let s=o;const c=new Set(ht(o).map(pt));for(const[l,u]of Ac(o))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(N=>N.id===p),g=s.edges.find(N=>N.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const y=h.parent,C=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,x=BR(g),m=[...Tc(d,a)??[]],v=Bp(d,[...a,...x],C,o.edges);v&&m.push(v);for(let N=0;N+1<d.waypoints.length;N++)for(const T of x)for(const D of Pc(d.waypoints[N],d.waypoints[N+1],T)??[])m.push(Ip(d.waypoints,N,D));const w=s.edges.filter(N=>N.id!==p),S=N=>({...s,edges:s.edges.map(T=>T.id===p?{...T,waypoints:N}:T)}),k=N=>!C||N.every(T=>T.x>=C.x&&T.x<=C.x+C.width&&T.y>=C.y&&T.y<=C.y+C.height),O=m.find(N=>{const T={...d,waypoints:N};return $p(T,g)||!k(N)||w.some(D=>D.id!==f&&!$p(d,D)&&$p(T,D))?!1:ht(S(N)).every(D=>c.has(pt(D)))});if(O){r.updateWaypoints(h,O),s=S(O);break}}}const NR=10;function sg(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 cg(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=sg(i,n),a=sg(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(j=>j.id!==o.id&&j.id!==a.id&&j.y>=c.y+c.height&&j.y+j.height<=l.y).sort((j,ee)=>j.y-ee.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,y=s?g:d,C=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],m=fi(t),v=t.edges.filter(j=>j.id!==e.id),w=pi(e,v),S=bn(e,m).length;if(w===0&&S===0||S===0&&e.waypoints.length===2)return null;const k=Math.min(...u.map(j=>j.x)),O=Math.max(...u.map(j=>j.x+j.width)),N=(C.x+x.x)/2,T=j=>j.filter((ee,ge)=>ge===0||!(Lt(ee.x,j[ge-1].x)&&Lt(ee.y,j[ge-1].y)));let D;for(let j=k;j<=O;j+=NR){const ee=T([C,{x:C.x,y:h},{x:j,y:h},{x:j,y},{x:x.x,y},x]),ge={...e,waypoints:ee};if(bn(ge,m).length>0)continue;const Pe=pi(ge,v),De=Math.abs(j-N);(!D||Pe<D.cross||Pe===D.cross&&De<D.detour)&&(D={pts:ee,cross:Pe,detour:De})}return D&&(S>0?D.cross<=w:D.cross<w)?D.pts:null}function lg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=We(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=We(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=cg(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Vi=[25,-25,40,-40],ra=35;function $R(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-ra:Math.max(e.y+e.height,t.y+t.height)+ra;for(const l of[0,...Vi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Vi]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function kc(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 $R(n,i);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,l=s?n.y:n.y+n.height,u=s?n.y-ra:n.y+n.height+ra,p=[];for(const x of[0,...Vi]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;p.push({pts:[{x:n.x,y:r},{x:m,y:r},{x:m,y:c}],cost:Math.abs(x)});for(const v of[0,...Vi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;p.push({pts:[{x:w,y:l},{x:w,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...Vi]){if(Math.abs(x)>=n.width/2-5)continue;const m=a+x;p.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,y=s?i.y+i.height:i.y,C=s?i.y+i.height+ra:i.y-ra;for(const x of[0,...Vi]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;for(const v of[0,...Vi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;p.push({pts:[{x:w,y:g},{x:w,y:C},{x:m,y:C},{x:m,y}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const Oc=30;function ug(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Lt(i.y,r.y)&&!Lt(i.x,r.x),a=Lt(i.x,r.x)&&!Lt(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)<Oc||Math.abs(i.y-(s.y+s.height))<Oc)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)<Oc||Math.abs(i.x-(s.x+s.width))<Oc)return!0}}return!1}const Dc=40;function FR(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Dc,a=r.x+r.width+Dc,s=r.y-Dc,c=r.y+r.height+Dc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function pg(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(S=>S.container),i=new Map(t.shapes.map(S=>[S.id,S])),r=fi(t),o=t.edges.filter(S=>S.id!==e.id),a=ui(e,o),s=pi(e,o),c=S=>FR(S,t.shapes,e.endpoints)+(ug(S,n)?1:0),l=c(e.waypoints),u=S=>{if(!S)return;const k=S.x+S.width/2,O=S.y+S.height/2;return n.find(N=>N.type==="bpmn:Lane"&&k>=N.x&&k<=N.x+N.width&&O>=N.y&&O<=N.y+N.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=S=>{if(!d||!f)return!1;for(let k=1;k<S.length-2;k++){const O=S[k],N=S[k+1];if(Lt(O.y,N.y)&&!Lt(O.x,N.x)&&O.y>f.y&&O.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),C=(S=>{if(!S)return;const k=S.x+S.width/2,O=S.y+S.height/2;return n.filter(N=>N.type==="bpmn:Participant"&&k>=N.x&&k<=N.x+N.width&&O>=N.y&&O<=N.y+N.height).sort((N,T)=>N.width*N.height-T.width*T.height)[0]})(i.get(e.endpoints[0]??"")),x=S=>{if(!C)return 0;let k=0;for(let O=1;O<S.length-1;O++){const N=S[O];(N.x<C.x||N.x>C.x+C.width||N.y<C.y||N.y>C.y+C.height)&&k++}return k},m=x(e.waypoints);if(!ug(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=S=>S.reduce((k,O,N)=>N?k+Math.abs(O.x-S[N-1].x)+Math.abs(O.y-S[N-1].y):0,0);let w;for(const{pts:S,cost:k}of kc(e,i)){const O={...e,waypoints:S};if(bn(O,r).length>0)continue;const N=ui(O,o);if(N>a)continue;const T=x(S);if(T>m)continue;const D=T<m&&N===0;if(!D&&pi(O,o)>s)continue;const j=c(S),ee=g(S);if(!D&&!(ee&&!h)&&j>=l)continue;const Pe=ee?0:1,De=v(S);(!w||T<w.out||T===w.out&&(Pe<w.lane||Pe===w.lane&&(N<w.opp||N===w.opp&&(j<w.sc||j===w.sc&&(k<w.cost||k===w.cost&&De<w.len)))))&&(w={pts:S,out:T,sc:j,lane:Pe,opp:N,cost:k,len:De})}return(w==null?void 0:w.pts)??null}function jR(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,r=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),o=r.filter(p=>p.endpoints[1]===i),a=r.filter(p=>p.endpoints[0]===i);if(o.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function HR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=We(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of o){const s=We(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=fi(s),u=s.edges.filter(y=>y.id!==a),p=bn(c,l).length,f=ui(c,u),d=pi(c,u),g=n.has(a)?new Set(ht(s).map(pt)):null,h=Tc(c,s.shapes);h.length===2&&jR(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const C={...c,waypoints:y};if(bn(C,l).length>p||ui(C,u)>f||pi(C,u)>d)continue;if(g){const m=new Set(ht({...s,edges:s.edges.map(S=>S.id===a?C:S)}).map(pt)),v=[...m].filter(S=>!g.has(S)).length,w=[...g].filter(S=>!m.has(S)).length;if(v>w)continue}const x=i.get(a);x&&r.updateWaypoints(x,y);break}}}function fg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=We(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=We(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=pg(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Fp(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=Lt(n[0].x,n[1].x)&&!Lt(n[0].y,n[1].y),s=Lt(n[n.length-1].x,n[n.length-2].x)&&!Lt(n[n.length-1].y,n[n.length-2].y);for(const c of Vi){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function zR(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,l=n.y+n.height/2,u=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,y=[];for(const C of[0,...Vi])Math.abs(C)<i.width/2-5&&y.push({pts:[{x:f,y:l},{x:u+C,y:l},{x:u+C,y:h}],cost:Math.abs(C)}),Math.abs(C)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:p+C},{x:g,y:p+C}],cost:Math.abs(C)});return y}function jp(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,l=a?i.y+i.height:i.y,u=(r+o)/2,p=[];for(const f of[0,...Vi]){const d=u+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function dg(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=fi(t),r=t.edges.filter(d=>d.id!==e.id),o=ui(e,r);if(o===0)return null;const a=pi(e,r);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},p=u(e.waypoints),f=[...kc(e,n),...jp(e,n),...Fp(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(bn(h,i).length>0)continue;const y=ui(h,r),C=pi(h,r),x=o-y+(p-u(d));if(y>=o||C-a>x)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(C<s.cross||C===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:C,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function hg(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=ea(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function GR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=fi(t),r=t.edges.filter(f=>f.id!==e.id),o=hg(e,r);if(o===0)return null;const a=ui(e,r),s=pi(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),l=2;let u;const p=[...kc(e,n),...jp(e,n),...zR(e,n),...Fp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=hg(g,r);if(h>=o)continue;const y=ui(g,r);if(y-h>a-o)continue;const C=pi(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function mg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ht(We(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(pt(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=We(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=GR(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function gg(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 yg(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=ea(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:gg(e,n)&&gg(t,n)}function vg(e,t,n){let i=0;for(const r of t)r.id!==e.id&&yg(e,r,n)&&i++;return i}function VR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=fi(t),r=t.edges.filter(f=>f.id!==e.id),o=vg(e,r,n);if(o===0)return null;const a=ui(e,r),s=pi(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),l=2;let u;const p=[...kc(e,n),...jp(e,n),...Fp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=vg(g,r,n);if(h>=o)continue;const y=ui(g,r);if(y-h>a-o)continue;const C=pi(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function WR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=We(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=ht(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(pt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!u||!p||!yg(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=We(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=VR(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function bg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=We(i),a=ht(o).filter(u=>kp(u)&&!t.has(pt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(kp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=o.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=We(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=dg(f,p);if(!d)continue;const g=i.get(u);g&&r.updateWaypoints(g,d)}}const UR=10,qR=(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 xg(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Mc(e,i))return null;const r=fi(t),o=i.flatMap(vn);for(const a of vn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Cc(a,o))s=s.flatMap(([h,y])=>{const C=[];return d>h&&C.push([h,Math.min(y,d)]),g<y&&C.push([Math.max(h,g),y]),C.filter(([x,m])=>m>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+UR*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Fm}:{x:a.at+An+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Mc({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&qR(f,d)))return f}return null}const An=8;function Hp(e,t){const n=e.label;if(!n)return null;const i=vn(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(vn),...t.shapes.filter(f=>f.container).flatMap(na)],l=f=>!c.some(d=>Gi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+An,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+An,s.at-An-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(l(h))return h}else for(const f of[s.at-An-n.height,s.at+An])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(l(h))return h}return null}const wg=30,YR=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n},_g=(e,t)=>YR({x:e.x+e.width/2,y:e.y+e.height/2},t);function KR(e,t){const n=e.label;if(!n)return null;const i=vn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(vn),...t.shapes.filter(c=>c.container).flatMap(na)],o=mo(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!r.some(l=>Gi(c,l))&&!Ja(c,t).length&&!o.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+An,c.at-An-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+An,c.at-An-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function Eg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=We(n),o=new Set(ht(r).map(pt));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((S,k)=>S.x-u[k].x===d&&S.y-u[k].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const S=r.edges.find(D=>D.id===c);if(!(S!=null&&S.label)||!Ja(S.label,r).length)continue;let k={...S.label,x:l.label.x,y:l.label.y};if((Ja(k,r).length||_g(k,S.waypoints)>wg)&&(k=null),!k&&_g(S.label,S.waypoints)>wg&&(k=KR(S,r)),!k)continue;const O=k,N={...r,edges:r.edges.map(D=>D.id===c?{...D,label:O}:D)},T=ht(N);if(T.some(D=>!o.has(pt(D))))continue;i.moveElements([f],{x:O.x-f.x,y:O.y-f.y}),r=N,o=new Set(T.map(pt));continue}const y=l.label.x+d-f.x,C=l.label.y+g-f.y;if(y===0&&C===0)continue;const x=r.edges.find(S=>S.id===c);if(!(x!=null&&x.label))continue;const m={...x.label,x:x.label.x+y,y:x.label.y+C},v={...r,edges:r.edges.map(S=>S.id===c?{...S,label:m}:S)},w=ht(v);w.some(S=>!o.has(pt(S)))||(i.moveElements([f],{x:y,y:C}),r=v,o=new Set(w.map(pt)))}}function Sg(e,t,n=new Set){const{elementRegistry:i}=e,r=e.modeling,o=We(i);for(const a of o.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Hp(a,o);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&r.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function Rg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=We(i),a=ht(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(pt(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 l=xg(c,o);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function Cg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(vn),...t.shapes.filter(f=>f.container).flatMap(na)],r=i.filter(f=>Gi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=mo(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=>Gi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of r)f.axis==="h"?l.push({...n,y:f.at-An-n.height},{...n,y:f.at+An}):l.push({...n,x:f.at-An-n.width},{...n,x:f.at+An});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+An},{...n,x:u-n.width/2,y:e.y-An-n.height},{...n,x:e.x+e.width+An,y:p-n.height/2},{...n,x:e.x-An-n.width,y:p-n.height/2}),l.find(c)??null}function Mg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=We(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Cg(o,We(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})}}function XR(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function Ag(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=We(n),o=new Set(ht(r).map(pt));const a=[...new Set(ht(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(pt(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,y]of u){const C=h?r.shapes.find(m=>m.id===h):void 0;if(!C)continue;const x=XR(C,l[y]);x.x===l[y].x&&x.y===l[y].y||(l[y]=x,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ht(f);if(d.some(h=>!o.has(pt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),r=f,o=new Set(d.map(pt)))}}const zp=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Pg(e,t){const n=(r,o,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>o?`${o}.${u}`:u;return{id:r,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((r,o)=>n(r.id,`participant.lanes[${o}]`,r))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((r,o)=>({...n(r.id,`lanes[${o}]`,r),omittedMeansRemove:(t==null?void 0:t.categoryOf(r.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function ZR(e,t,n){const i=[],r=n?Ua(n):[];return e.forEach((o,a)=>{if(o.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:o.id,field:"locale"});return}if(!r.includes(o.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:o.id,field:"locale",locale:o.locale,locales:r});return}t.categoryOf(o.id)!==void 0&&!t.reviewRequestLocalesOf(o.id).includes(o.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:o.id,locale:o.locale});return}for(const s of Pg(o,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:r});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:r});continue}if(!l)continue;if(!zp(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):r.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:r}),p=!1);if(!p)continue;const f=r.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function vi(e,t,n){const i=t==="text"?"texts":"names",{[i]:r,...o}=e;return n===void 0?o:{...o,[t]:n}}function QR(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:r}=n,o=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(zp(c.map)){const l=c.map;return o(c.id).texts={...l},l[r]}if(c.plain===null||c.condition===null&&c.plain===void 0){o(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(o(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=o(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=Pg(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=vi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>vi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=vi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>vi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:vi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:vi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:vi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:vi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:vi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:vi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(vi(c,"text",a(l[0])));break;default:s.push(zp(l[0].map)?vi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const JR=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Tg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),kg={"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"]},{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}],"translation.confirm":[{path:"id",shape:null},{path:"locale",shape:null}],"element.remove":[{path:"id",shape:null}]},es=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Lc=e=>typeof e=="string"&&e!=="";function eC(e){const t=[];function n(i,r,o,a){if(a===null){Lc(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!es(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Lc(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!es(i)||!Lc(i.kind)||!(i.kind in kg)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of kg[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!es(f))break;f=f[g]}if(!es(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(r,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:r,field:c.path});continue}d.forEach((g,h)=>n(r,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;es(c)&&!Lc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:r,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const l=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!nm(l)){t.push({kind:"node-type-unsupported",opIndex:r,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!im(p)){t.push({kind:"payload-invalid",opIndex:r,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:r,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function Og(e,t,n={}){const i=eC(e);if(i.length>0)return i;const r=[],o=new Map,a=new Map;function s(h,y,C){if(!JR.test(y)){r.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||o.has(y)){r.push({kind:"id-duplicate",opIndex:h,id:y});return}o.set(y,{...C,opIndex:h})}e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(y,x.id,{category:"lane"});break;case"node.add":s(y,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(y,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(y,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(y,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(y,h.association.id,{category:"association"});break;case"annotation.add":s(y,h.annotation.id,{category:"annotation"}),(C=h.association)!=null&&C.id&&s(y,h.association.id,{category:"association"});break;case"group.add":s(y,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(y,x.id,{category:"lane"})}break}});const c=h=>{var y;return((y=o.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=o.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,C,x){const m=c(y);if(m===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:C});return}if(x&&!x.includes(m)){r.push({kind:"ref-category",opIndex:h,ref:y,role:C,expected:x.join("|"),actual:m});return}return m}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:x,lane:m}=h.node;if(x===void 0){(p||m!==void 0)&&r.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,x,"participant",["participant"])===void 0)break;m!==void 0&&((((C=o.get(x))==null?void 0:C.lanes)??a.get(x)??t.lanesOf(x)).includes(m)||r.push({kind:"lane-unknown",opIndex:y,lane:m,participant:x}));break}case"sequenceFlow.add":{const{id:x,source:m,target:v,name:w,condition:S}=h.flow,k=u(y,m,"source",["flowNode"]),O=u(y,v,"target",["flowNode"]);k&&O&&l(m)!==l(v)&&r.push({kind:"flow-cross-pool",opIndex:y,id:x}),w!==void 0&&S!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:x});break}case"messageFlow.add":{const{id:x,source:m,target:v}=h.flow,w=u(y,m,"source",["flowNode","participant"]),S=u(y,v,"target",["flowNode","participant"]);if(w&&S){const k=l(m),O=l(v);k!==void 0&&k===O&&r.push({kind:"message-flow-same-pool",opIndex:y,id:x})}for(const k of[m,v])d(k)&&r.push({kind:"message-flow-timer-endpoint",opIndex:y,id:x,ref:k});break}case"dataStore.add":{for(const x of h.associations??[]){if([x.source,x.target].filter(w=>w===h.dataStore.id).length!==1){r.push({kind:"data-association-ends",opIndex:y,source:x.source,target:x.target});continue}const v=x.source===h.dataStore.id?x.target:x.source;u(y,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:x,target:m}=h.association,v=u(y,x,"source"),w=u(y,m,"target");if(v&&w){const S=new Set([v,w]);S.has("dataStore")&&S.has("flowNode")||r.push({kind:"data-association-ends",opIndex:y,source:x,target:m})}break}case"association.add":{const{id:x,source:m,target:v}=h.association,w=u(y,m,"source"),S=u(y,v,"target");w&&S&&w!=="annotation"&&S!=="annotation"&&r.push({kind:"association-detached",opIndex:y,annotation:x??`${m}->${v}`});break}case"annotation.add":{if(h.association){const{source:x,target:m}=h.association;if(x!==h.annotation.id&&m!==h.annotation.id)r.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const v=x===h.annotation.id?m:x;u(y,v,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const x of h.group.members??[]){const m=u(y,x,"member");m&&Tg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const x=t.lanesOf(h.id),m=h.lanes.map(w=>w.id);for(const w of x)m.includes(w)||r.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:w});for(const w of m)t.categoryOf(w)!==void 0&&!x.includes(w)&&r.push({kind:"id-duplicate",opIndex:y,id:w});const v=m.filter(w=>x.includes(w));v.length===x.length&&v.some((w,S)=>w!==x[S])&&r.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(g(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const x=t.participantOf(h.id);(x?a.get(x)??t.lanesOf(x):[]).includes(h.lane)||r.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:x??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const x=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,m=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),w=h.source??(v==null?void 0:v.source),S=h.target??(v==null?void 0:v.target);x&&m&&w!==void 0&&S!==void 0&&new Set([l(w),l(S),l(h.id)]).size>1&&r.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":g(y,h.id,"messageFlow");break;case"dataStore.update":g(y,h.id,"dataStore");break;case"annotation.update":{if(g(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(g(y,h.id,"group")===void 0)break;for(const x of h.members??[]){const m=u(y,x,"member");m&&Tg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&r.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),r.push(...ZR(e,t,n.i18n)),r;function g(h,y,C){if(o.has(y)){r.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const x=t.categoryOf(y);if(x===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(C&&x!==C){r.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:C,actual:x});return}return x}}function Dg(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"),spaceTool:e.get("spaceTool")}}function Ic(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Bc={"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]},Pn=10,tC=300,nC=160,Lg=20,Gp=100,Ig=40,iC=10;function Vp(e,t,n,i,r){const o=n,a=(T,D)=>{const[j,ee]=Bc[T];let ge={x:t.x+t.width/2+j*(t.width/2+o.width/2+D),y:t.y+t.height/2+ee*(t.height/2+o.height/2+D)};const Pe=i.x+Pn+o.width/2,De=i.x+i.width-Pn-o.width/2,Ue=i.y+Pn+o.height/2,ot=i.y+i.height-Pn-o.height/2,Me={x:Math.min(De,Math.max(Pe,ge.x)),y:Math.min(ot,Math.max(Ue,ge.y))};return(Me.x!==ge.x||Me.y!==ge.y)&&(ge=Math.abs(Me.x-(t.x+t.width/2))<(t.width+o.width)/2+Pn&&Math.abs(Me.y-(t.y+t.height/2))<(t.height+o.height)/2+Pn?{x:t.x+t.width+Pn+o.width/2,y:Me.y}:Me),ge},s=(i.children??[]).filter(T=>!("waypoints"in T&&T.waypoints)&&T.type!=="bpmn:Lane"&&T.type!=="label"&&typeof T.x=="number"&&T.id!==r.selfId),c=We(e),l=T=>{var j,ee;if(!r.selfId)return!1;const D=e.get(T);return!!D&&(((j=D.source)==null?void 0:j.id)===r.selfId||((ee=D.target)==null?void 0:ee.id)===r.selfId)},u=c.edges.filter(T=>!l(T.id)).flatMap(vn),p=mo(c).filter(T=>T.owner!==r.selfId).map(T=>T.rect),f=T=>({x0:T.x-o.width/2-Pn,x1:T.x+o.width/2+Pn,y0:T.y-o.height/2-Pn,y1:T.y+o.height/2+Pn}),d=T=>{const D=f(T);return s.some(j=>D.x0<j.x+j.width&&D.x1>j.x&&D.y0<j.y+j.height&&D.y1>j.y)},g=T=>{const D=f(T);return u.some(j=>j.axis==="h"?j.at>D.y0&&j.at<D.y1&&j.lo<D.x1&&j.hi>D.x0:j.at>D.x0&&j.at<D.x1&&j.lo<D.y1&&j.hi>D.y0)},h=T=>{const D=f(T);return p.some(j=>D.x0<j.x+j.width&&D.x1>j.x&&D.y0<j.y+j.height&&D.y1>j.y)},y=c.shapes.filter(T=>T.type==="bpmn:Group").flatMap(T=>[{axis:"h",at:T.y,lo:T.x,hi:T.x+T.width},{axis:"h",at:T.y+T.height,lo:T.x,hi:T.x+T.width},{axis:"v",at:T.x,lo:T.y,hi:T.y+T.height},{axis:"v",at:T.x+T.width,lo:T.y,hi:T.y+T.height}]),C=T=>{const D=f(T);return y.some(j=>j.axis==="h"?j.at>D.y0&&j.at<D.y1&&j.lo<D.x1&&j.hi>D.x0:j.at>D.x0&&j.at<D.x1&&j.lo<D.y1&&j.hi>D.y0)},x=T=>d(T)||g(T)||h(T)||C(T),m=T=>T.x-o.width/2>=i.x&&T.x+o.width/2<=i.x+i.width&&T.y-o.height/2>=i.y&&T.y+o.height/2<=i.y+i.height;if(r.placement){const T=De=>De.startsWith("top")?De.replace(/^top/,"bottom"):De.replace(/^bottom/,"top"),D=De=>De.endsWith("left")?De.replace(/left$/,"right"):De.replace(/right$/,"left"),j=r.placement.side,ee=[j,T(j),D(j),T(D(j)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ge=r.placement.offset??50;let Pe=a(j,ge);if(x(Pe)){const De=new Set;for(const Ue of ee){if(De.has(Ue))continue;De.add(Ue);const ot=a(Ue,ge);if(m(ot)&&!x(ot)){Pe=ot;break}}}return Pe}const v=r.from,w=i.x+Pn+o.width/2,S=i.x+i.width-Pn-o.width/2,k=i.y+Pn+o.height/2,O=i.y+i.height-Pn-o.height/2;let N={x:Math.min(S,Math.max(w,v.x)),y:Math.min(O,Math.max(k,v.y))};if(x(N)){const T=(t.width+o.width)/2+Pn,j=[{x:N.x+T,y:N.y},{x:N.x-T,y:N.y},{x:N.x,y:N.y-o.height-Pn},{x:N.x,y:N.y+o.height+Pn}].filter(m).find(ee=>!x(ee));j&&(N=j)}return N}function en(e,t){return e.filter(n=>n.kind===t)}class Bg extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Ng(e,t){var NE,$E,FE,jE,HE,zE,GE,VE,WE,UE,qE,YE,KE,XE,ZE,QE,JE,e1,t1,n1,i1,r1,o1;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>o.get(b),f=b=>{const E=p(b);if(!E)throw new Error(`하강 참조 해소 실패: ${b}`);return E},d=b=>{let E=b.parent;for(;E;){if(E.type==="bpmn:Participant")return E;E=E.parent}},g=new Map;for(const b of o.filter(E=>!("waypoints"in E&&E.waypoints)&&E.type!=="bpmn:Lane"&&E.type!=="label"&&typeof E.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=en(e,"participant.add"),y=en(e,"node.add"),C=en(e,"sequenceFlow.add"),x=en(e,"messageFlow.add"),m=en(e,"dataStore.add"),v=en(e,"dataAssociation.add"),w=en(e,"annotation.add"),S=en(e,"group.add"),k=new Map(y.map(b=>[b.node.id,b])),O=(b,E,A)=>{var F;const P=b.businessObject,I=(((F=P.extensionElements)==null?void 0:F.values)??[]).filter(B=>B.$type!==E),L=A?[...I,i.create(E,A)]:I;if(!L.length){P.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const H=i.create("bpmn:ExtensionElements",{values:L});L.forEach(B=>{B.$parent=H}),n.updateProperties(b,{extensionElements:H})},N=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of en(e,"element.remove")){const E=p(b.id);E&&n.removeElements([E])}const T=b=>o.filter(E=>{var A;return E.type==="bpmn:Lane"&&((A=d(E))==null?void 0:A.id)===b}).sort((E,A)=>E.y-A.y);for(const b of en(e,"participant.update")){const E=f(b.id);if(b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),!b.lanes)continue;const A=T(b.id);if(!A.length){n.splitLane(E,b.lanes.length),T(b.id).forEach((I,L)=>{const H=b.lanes[L];H&&n.updateProperties(I,{id:H.id,name:H.name})});continue}const P=new Set(A.map(I=>I.id));b.lanes.forEach((I,L)=>{if(P.has(I.id)){n.updateProperties(f(I.id),{name:I.name});return}const H=L===0?n.addLane(T(b.id)[0],"top"):n.addLane(f(b.lanes[L-1].id),"bottom");n.updateProperties(H,{id:I.id,name:I.name})})}const D=150,j=130,ee=80,ge=90,Pe=180,De=30,Ue=30,ot=(b,E,A,P,I)=>{const L=A-E.width/2,H=P-E.height/2;return(b.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(I!=null&&I.has(F.id))&&typeof F.x=="number"&&L<F.x+F.width+Ue&&L+E.width+Ue>F.x&&H<F.y+F.height&&H+E.height>F.y)},Me=new Set;for(const b of h){Me.add(`pool:${b.participant.id}`);for(const E of b.participant.lanes??[])Me.add(E.id)}const X=new Map;for(const b of y){const E=b.node.lane??`pool:${b.node.participant??""}`;let A=X.get(E);A||X.set(E,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ne=new Map;for(const[b,E]of X){if(!Me.has(b))continue;const A=[...E].sort((L,H)=>L-H),P=A.map((L,H)=>H===0?0:H%2===1?Math.ceil(H/2):-(H/2)),I=Math.min(...P);ne.set(b,new Map(A.map((L,H)=>[L,P[H]-I])))}{const b=new Map;for(const E of h)(E.participant.lanes??[]).forEach((A,P)=>b.set(A.id,P));for(const[E,A]of ne){if(!b.has(E)||A.size<2)continue;const P=b.get(E),I=A.get(0)??0,L=new Set;for(const J of y){if(J.node.lane!==E||(J.band??0)!==0||!J.node.type.endsWith("Gateway"))continue;const fe={in:new Set,out:new Set,cross:new Set};for(const ue of C){const me=ue.flow.source===J.node.id;if(!me&&ue.flow.target!==J.node.id)continue;const qe=k.get(me?ue.flow.target:ue.flow.source);if(!qe||qe.node.participant!==J.node.participant||!qe.node.lane)continue;let Ce,Q=!1;if(qe.node.lane!==E){const re=b.get(qe.node.lane);if(re===void 0)continue;Ce=re>P?"down":"up",Q=!0}else{const re=A.get(qe.band??0)??I;Ce=re>I?"down":re<I?"up":void 0}Ce&&(fe[me?"out":"in"].add(Ce),Q&&fe.cross.add(Ce))}for(const ue of["up","down"])fe.in.has(ue)&&fe.out.has(ue)&&fe.cross.has(ue)&&L.add(ue)}if(L.size!==1)continue;const[H]=L,F=Math.max(...A.values()),B=H==="down"?F:0;if(I===B)continue;const V=[...A.entries()].filter(([J])=>J!==0).sort((J,fe)=>J[1]-fe[1]),Y=[...Array(F+1).keys()].filter(J=>J!==B),ie=new Map([[0,B]]);V.forEach(([J],fe)=>ie.set(J,Y[fe])),ne.set(E,ie)}}const q=b=>{var E;return(((E=X.get(b))==null?void 0:E.size)??0)>1},K=b=>b.band??(b.node.lane||!q(`pool:${b.node.participant??""}`)?void 0:0),se=new Map,de=b=>se.get(b.node.id)??K(b),Te=new Set,$=new Set;{const b=new Map;for(const P of C)b.set(P.flow.target,(b.get(P.flow.target)??0)+1);const E=P=>{const I=[],L=new Set([P]),H=[P];for(;H.length;){const F=H.shift();I.push(F);for(const B of C)B.flow.source!==F||L.has(B.flow.target)||(b.get(B.flow.target)??0)!==1||(L.add(B.flow.target),H.push(B.flow.target))}return I},A=(P,I)=>{var L;return((L=ne.get(P))==null?void 0:L.get(I))??I};for(const P of y){if(!P.node.type.endsWith("Gateway"))continue;const I=P.node.lane??`pool:${P.node.participant??""}`,L=ne.get(I);if(!L||L.size<2)continue;const H=de(P);if(H===void 0||A(I,H)!==A(I,0))continue;const F=A(I,H),B=C.filter(ue=>ue.flow.source===P.node.id).map(ue=>k.get(ue.flow.target)).filter(ue=>!!ue&&(ue.node.lane??`pool:${ue.node.participant??""}`)===I),V=B.filter(ue=>{const me=de(ue);return me!==void 0&&A(I,me)===F&&(b.get(ue.node.id)??0)===1}),Y=B.some(ue=>{const me=de(ue);return me!==void 0&&A(I,me)>F});if(V.length!==1||!Y)continue;const ie=new Set(B.flatMap(ue=>E(ue.node.id)));if(!C.some(ue=>ue.flow.target===P.node.id&&ie.has(ue.flow.source)))continue;const fe=new Map;for(const[ue,me]of L)fe.set(ue,me+1);fe.set(-1,0),ne.set(I,fe);for(const ue of E(V[0].node.id))k.has(ue)&&(se.set(ue,-1),$.add(ue));Te.add(P.node.id)}}const R=(b,E)=>{var A;return((A=ne.get(b))==null?void 0:A.get(E))??E},_=(b,E,A,P)=>{const I=b?p(b):E?p(E):void 0;if(!I)return!1;const L=b?I.y+Math.min(I.height/2,ge):I.y+ee;return Math.abs(L+R(b??`pool:${E??""}`,A)*D-P)<=D/2},G=new Map;for(const[b,E]of X){let A=0;for(const P of E)A=Math.max(A,R(b,P));G.set(b,A)}const W=b=>Pe+D*b,te=(b,E,A)=>{const P=u().children.filter(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="label"&&I.id!==E&&typeof I.y=="number"&&I.y>=b);P.length&&n.moveElements(P,{x:0,y:A})},Re=(b,E,A)=>{const P=b.type==="bpmn:Participant"?b:void 0;if(!P||P.children.some(F=>F.type==="bpmn:Lane"))return;const I=A+E.height/2+De-P.y;if(P.height>=I)return;const L=I-P.height,H=P.y+P.height;n.resizeShape(P,{x:P.x,y:P.y,width:P.width,height:I}),te(H,P.id,L)},Ke=(b,E)=>{const A=E-b.height;if(A<=0)return;const P=d(b)??b,I=[],L=B=>{I.push(B);for(const V of B.children??[])L(V)};L(P);const H=b.y+b.height-10,F=l.calculateAdjustments(I,"y",A,H);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",H)},mt=(b,E,A)=>{if(b){const H=f(b),F=W(E);if(H.height>=F)return;const B=F-H.height,V=d(H),Y=V?V.y+V.height:H.y+H.height;Ke(H,F),te(Y,V==null?void 0:V.id,B);return}if(!A)return;const P=D*(E+1);if(A.height>=P)return;const I=P-A.height,L=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:P}),te(L,A.id,I)},qt=new Map;for(const b of C)qt.set(b.flow.target,(qt.get(b.flow.target)??0)+1);const Et=b=>(qt.get(b)??0)<=1,mn=new Set(y.map(b=>b.node.id).filter(b=>en(e,"sequenceFlow.update").filter(E=>E.target===b).length===1&&!C.some(E=>E.flow.target===b||E.flow.source===b&&k.has(E.flow.target)))),Sn=new Map,Gn=(b,E)=>{if(!b)return;const A=p(b);if(!A||A.height>=W(E))return;const P=A.y+A.height-10,I=d(A);if(I)return new Set((I.children??[]).filter(L=>L.type!=="bpmn:Lane"&&typeof L.y=="number"&&L.y>P).map(L=>L.id))},Ct=(b,E,A)=>{if(!b)return!0;const P=p(b);return P?A-E.height/2>=P.y&&A+E.height/2<=P.y+P.height:!0},Qt=h.map((b,E)=>({op:b,declared:E}));Qt.sort((b,E)=>{const A=b.op.order??Number.POSITIVE_INFINITY,P=E.op.order??Number.POSITIVE_INFINITY;return A!==P?A-P:b.declared-E.declared});let wn=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(wn=Math.max(wn,b.y+b.height+60));for(const{op:b}of Qt){const E=b.participant,A=y.filter(J=>J.node.participant===E.id).length,P=((NE=E.lanes)==null?void 0:NE.length)??0,I=Math.max(1200,A*160+300),L=(E.lanes??[]).map(J=>W(G.get(J.id)??0)),H=L.reduce((J,fe)=>J+fe,0);P&&H<300&&(L[P-1]+=300-H);const F=Math.max(300,D*((G.get(`pool:${E.id}`)??0)+1)),B=E.blackBox||A+P===0?120:P?Math.max(300,H):F,V=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:E.id,name:E.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...E.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:I,height:B,isExpanded:!0}),Y=n.createShape(V,{x:100+I/2,y:wn+B/2},u()),ie=E.lanes??[];if(ie.length&&n.splitLane(Y,ie.length),ie.length){const J=o.filter(fe=>{var ue;return fe.type==="bpmn:Lane"&&((ue=d(fe))==null?void 0:ue.id)===E.id}).sort((fe,ue)=>fe.y-ue.y);if(J.forEach((fe,ue)=>{const me=ie[ue];me&&n.updateProperties(fe,{id:me.id,name:me.name})}),L.some(fe=>fe!==Y.height/P)){let fe=Y.y;J.forEach((ue,me)=>{const qe=L[me];n.resizeShape(ue,{x:ue.x,y:fe,width:ue.width,height:qe}),fe+=qe})}}wn=Y.y+Y.height+60}const Fa=b=>{var P;const E=k.get(b);if(E)return E.node.participant??"";const A=p(b);return A?A.type==="bpmn:Participant"?A.id:((P=d(A))==null?void 0:P.id)??"":""},Vn=new Map,Ni=b=>{let E=Vn.get(b);return E||Vn.set(b,E={nodes:[],flows:[]}),E};for(const b of y)Ni(b.node.participant??"").nodes.push(b);for(const b of C)Ni(Fa(b.flow.source)).flows.push(b);const ai=b=>{var E;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((E=b.condition)==null?void 0:E.label)})},nn=(b,E,A)=>r.createShape({type:Ic(b.type),...b.eventDefinition?{eventDefinitionType:pc[b.eventDefinition]}:{},businessObject:i.create(Ic(b.type),{id:b.id,name:b.name,...E!==void 0?{"bwl:band":E}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Do=[...Qt.map(({op:b})=>b.participant.id).filter(b=>Vn.has(b)),...[...Vn.keys()].filter(b=>!h.some(E=>E.participant.id===b))],ja=b=>b.endsWith("Gateway");for(const b of Do){const E=Vn.get(b),A=b?f(b):void 0,P=A?A.x+150:250;let I=A?A.y+80:120;const L=(Q,re,ae)=>{if(Q){const ve=f(Q);return ve.y+Math.min(ve.height/2,ge)+R(Q,re??0)*D}return re!==void 0&&A?A.y+ee+R(`pool:${b}`,re)*D:ae},H=(Q,re,ae)=>{if(Q){const ve=f(Q);return ve.y+Math.min(ve.height/2,ge)+re*D}return A?A.y+ee+re*D:ae},F=Q=>Q.participant?f(Q.participant):u(),B=(Q,re,ae,ve,Xe,Ze,kt,$t)=>{const be=ae!==void 0||ve!==void 0,ye=Ie=>{const we=()=>mt(ae,Ie,A);$t?$t(we):we()},oe=R(ae??`pool:${b}`,ve??0);if((ve===void 0||_(ae,b,ve,kt??Number.NaN))&&kt!==void 0&&Ct(ae,re,kt)&&!ot(Q,re,Xe,kt))return{x:Xe,y:kt};if(be)for(let Ie=0;Ie<4;Ie++){const we=H(ae,oe+Ie,Ze);if(!ot(Q,re,Xe,we,Gn(ae,oe+Ie)))return ye(oe+Ie),{x:Xe,y:we}}const xe=L(ae,ve,Ze);be?ye(oe):$t?$t(()=>Re(Q,re,re.y+re.height/2)):Re(Q,re,xe);let Ne=Xe;for(let Ie=0;Ie<64;Ie++){const we=ot(Q,re,Ne,xe);if(!we)break;Ne=we.x+we.width+j+re.width/2}return{x:Ne,y:xe}},V=new Set(E.flows.map(Q=>Q.flow.target)),Y=new Map,ie=Q=>{if(Q===void 0)return;const re=o.get(Q);if(!(!re||typeof re.x!="number"||typeof re.width!="number"))return re.x+re.width+j};for(const Q of E.nodes){if(V.has(Q.node.id))continue;const re=nn(Q.node,Q.band,Q.afterColumn),ae=K(Q),ve=Q.node.lane?`${Q.node.lane}|${ae??""}`:ae!==void 0?`band:${ae}`:"",Xe=F(Q.node),Ze=Y.get(ve)??P,kt=ie(Q.afterColumn),$t=kt===void 0?Ze:Math.max(Ze,kt);let be;const ye=B(Xe,re,Q.node.lane,ae,$t,I,void 0,mn.has(Q.node.id)&&Q.node.participant!==void 0?oe=>be=oe:void 0);if(be?n.createShape(re,ye,Xe,{autoResize:!1}):n.createShape(re,ye,Xe),be){const oe=Q.node.lane?f(Q.node.lane):Xe;Sn.set(Q.node.id,{container:oe,relCy:ye.y-oe.y,grow:be})}Y.set(ve,ye.x+re.width+j),!Q.node.lane&&ae===void 0&&(I+=160)}const J=new Set,fe=new Map,ue=new Map,me=new Map;if(b&&Me.has(`pool:${b}`)){const Q=new Map;for(const be of E.flows)Q.set(be.flow.target,(Q.get(be.flow.target)??0)+1);const re=be=>L(be.node.lane,de(be),Number.NaN),ae=new Set,ve=be=>{var xe;const ye=(xe=k.get(be))==null?void 0:xe.node.participant;if(ye)return p(ye);const oe=p(be);if(oe)return oe.type==="bpmn:Participant"?oe:d(oe)},Xe=be=>{const ye=[],oe=new Set([be]),xe=[be];for(;xe.length;){const Ne=xe.shift(),Ie=k.get(Ne);Ie&&ye.push(Ie);for(const we of E.flows)we.flow.source!==Ne||oe.has(we.flow.target)||(Q.get(we.flow.target)??0)!==1||(oe.add(we.flow.target),xe.push(we.flow.target))}return ye},Ze=be=>{if(!A)return;const ye=new Set(be.map(Ne=>Ne.node.id));let oe=!1,xe=!1;for(const Ne of x){if(!ye.has(Ne.flow.source))continue;const Ie=ve(Ne.flow.target);!Ie||Ie.id===A.id||(Ie.y<A.y?oe=!0:xe=!0)}return oe&&!xe?"up":xe&&!oe?"down":void 0};for(const be of E.nodes){if(!ja(be.node.type))continue;const ye=L(be.node.lane,K(be),Number.NaN);if(Number.isNaN(ye))continue;const oe=[];for(const we of E.flows){if(we.flow.source!==be.node.id)continue;const it=k.get(we.flow.target);if(!it||it.node.lane!==be.node.lane||(Q.get(it.node.id)??0)!==1)continue;const lt=K(it);if(lt===void 0)continue;const Jt=L(it.node.lane,lt,Number.NaN);if(Number.isNaN(Jt))continue;const si=Xe(it.node.id),tt=Ze(si);tt&&oe.push({subtree:si,band:lt,row:Jt,dir:tt})}if(!oe.some(we=>we.dir==="up")||!oe.some(we=>we.dir==="down")||!oe.some(we=>we.dir==="up"&&oe.some(it=>it.dir==="down"&&it.row<we.row)))continue;const Ne=[...oe].sort((we,it)=>we.row-it.row);[...oe.filter(we=>we.dir==="up"),...oe.filter(we=>we.dir==="down")].sort((we,it)=>we.dir===it.dir?we.row-it.row:we.dir==="up"?-1:1).forEach((we,it)=>{const lt=Ne[it].band;if(lt!==we.band){ae.add(be.node.id);for(const Jt of we.subtree)K(Jt)===we.band&&se.set(Jt.node.id,lt)}})}const kt=be=>{if(!A)return;const ye=new Set(be.map(Ne=>Ne.node.id));let oe=!1,xe=!1;for(const Ne of x){if(!ye.has(Ne.flow.target))continue;const Ie=ve(Ne.flow.source);!Ie||Ie.id===A.id||(Ie.y<A.y?oe=!0:xe=!0)}return oe&&!xe?"up":xe&&!oe?"down":void 0};for(const be of E.nodes){if(!ja(be.node.type))continue;const ye=be.node.lane??`pool:${b}`,oe=ne.get(ye);if(!oe||oe.size<2)continue;const xe=oe.get(0);if(xe===void 0)continue;const Ne=Math.max(...oe.values()),Ie=xe===Ne&&xe!==0?"down":void 0;if(!Ie)continue;const we=[];for(const tt of E.flows){if(tt.flow.source!==be.node.id)continue;const zt=k.get(tt.flow.target);if(!zt||zt.node.lane!==be.node.lane||(Q.get(zt.node.id)??0)!==1)continue;const Ae=de(zt);Ae!==void 0&&we.push({t:zt,subtree:Xe(zt.node.id),band:Ae})}const it=we.find(tt=>(oe.get(tt.band)??tt.band)===xe);if(!it||kt(it.subtree)===Ie||Ze(it.subtree)===Ie)continue;const lt=we.find(tt=>tt!==it&&kt(tt.subtree)===Ie);if(!lt)continue;const Jt=it.band,si=lt.band;for(const tt of it.subtree)de(tt)===Jt&&se.set(tt.node.id,si);for(const tt of lt.subtree)de(tt)===si&&se.set(tt.node.id,Jt);ae.add(be.node.id)}for(const be of E.nodes){if(!ja(be.node.type))continue;const ye=re(be);if(Number.isNaN(ye)||w.some(we=>{var it,lt;return(((it=we.placement)==null?void 0:it.anchor)??(we.association?we.association.source===we.annotation.id?we.association.target:we.association.source:void 0))===be.node.id&&((lt=we.placement)==null?void 0:lt.side.startsWith("bottom"))}))continue;let xe,Ne=!1,Ie;for(const we of E.flows){if(we.flow.source!==be.node.id)continue;const it=k.get(we.flow.target);if(!it||!it.node.lane&&K(it)===void 0)continue;const lt=re(it);Number.isNaN(lt)||(Math.abs(lt-ye)<.5&&(Ne=!0),lt>ye?!xe||lt>xe.row?xe={id:it.node.id,row:lt,count:1}:lt===xe.row&&xe.count++:lt<ye&&it.node.lane===be.node.lane&&(!Ie||lt>Ie.row?Ie={op:it,row:lt,count:1}:lt===Ie.row&&Ie.count++))}xe&&xe.count===1&&(Q.get(xe.id)??0)===1&&!ae.has(be.node.id)&&J.add(xe.id),!Ne&&Ie&&Ie.count===1&&(Q.get(Ie.op.node.id)??0)===1&&!Te.has(be.node.id)&&fe.set(Ie.op.node.id,{lane:be.node.lane,band:de(be)})}const $t=new Map;for(const be of x)$t.set(be.flow.target,[...$t.get(be.flow.target)??[],be]);for(const be of E.nodes){const ye=$t.get(be.node.id);if(!ye||ye.length!==1||!Q.get(be.node.id)||!be.node.lane&&K(be)===void 0||$.has(be.node.id))continue;const oe=($E=k.get(ye[0].flow.source))==null?void 0:$E.node.participant,xe=oe?p(oe):void 0;if(!xe||!A||xe.id===A.id)continue;const Ne=be.node.lane??`pool:${b}`,Ie=ne.get(Ne);if(!Ie)continue;const we=Ie.get(0)??0,it=(Ie.get(de(be)??0)??we)-we;if(it===0)continue;const lt=xe.y<A.y;if(lt&&it<0||!lt&&it>0)continue;let Jt;for(const[si,tt]of Ie){const zt=tt-we;(lt&&zt<0&&(!Jt||zt<Jt.row)||!lt&&zt>0&&(!Jt||zt>Jt.row))&&(Jt={band:si,row:zt})}Jt&&ue.set(be.node.id,{lane:be.node.lane,band:Jt.band})}}const qe=new Set;let Ce=0;for(;Ce++<E.nodes.length+2;){for(let ae=0;ae<E.nodes.length+E.flows.length+2;ae++){let ve=!1;for(const Xe of E.flows){const Ze=Xe.flow;if(qe.has(Ze.id))continue;const kt=p(Ze.source);if(!kt)continue;const $t=p(Ze.target),be=k.get(Ze.target);if(!$t&&be){const ye=nn(be.node,be.band),oe=de(be);if(be.node.lane||oe!==void 0){const xe=F(be.node),Ne=kt,Ie=Ne.x+(me.get(Ze.source)??0)+Ne.width+j,we=fe.get(Ze.target)??ue.get(Ze.target),it=B(xe,ye,we?we.lane:be.node.lane,we?we.band:oe,J.has(Ze.target)?Ne.x+Ne.width/2:Ie,Number.NaN,we||!Et(Ze.target)?void 0:Ne.y+Ne.height/2),lt=n.createShape(ye,it,xe);J.has(Ze.target)&&me.set(Ze.target,Ie-(lt.x+lt.width/2)),n.connect(kt,lt,{type:"bpmn:SequenceFlow",businessObject:ai(Ze)})}else s.append(kt,ye,{connection:{type:"bpmn:SequenceFlow",businessObject:ai(Ze)}})}else if($t)n.connect(kt,$t,{type:"bpmn:SequenceFlow",businessObject:ai(Ze)});else continue;qe.add(Ze.id),ve=!0}if(!ve)break}const Q=E.nodes.filter(ae=>!p(ae.node.id));if(!Q.length)break;const re=Q[0];{const ae=nn(re.node,re.band),ve=F(re.node),Xe=K(re);n.createShape(ae,B(ve,ae,re.node.lane,Xe,P,I),ve),!re.node.lane&&Xe===void 0&&(I+=160)}}}const Rn=40,dt=b=>{const E=Y=>Y.kind==="label-over-line"||Y.kind==="label-over-shape"||Y.kind==="label-on-shared-segment"?Y.edge===b.id:Y.kind==="annotation-over-label"||Y.kind==="pool-name-over-label"?Y.label===b.id:!1,A=()=>new Set(ht(We(o)).filter(Y=>!E(Y)).map(Y=>pt(Y))),P=A(),I=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),L=b.label,H=L&&{x:L.x,y:L.y};n.layoutConnection(b,{waypoints:[]});const F=A(),B=[...F].filter(Y=>!P.has(Y)).length,V=[...P].filter(Y=>!F.has(Y)).length;B<=V||(n.updateWaypoints(b,I),L&&H&&(L.x!==H.x||L.y!==H.y)&&n.moveElements([L],{x:H.x-L.x,y:H.y-L.y}))},wt=5,ki=10,uE=200,ic=new Set([...C.map(b=>b.flow.id),...x.map(b=>b.flow.id),...en(e,"sequenceFlow.update").map(b=>b.id),...en(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),WN=(b,E,A,P,I,L)=>{const H=new Set(b.map(Q=>Q.id)),F=Math.min(...b.map(Q=>Q.x))+E-ki,B=Math.max(...b.map(Q=>Q.x+Q.width))+E+uE+ki,V=Math.min(...b.map(Q=>Q.y+Math.min(0,...A)))-ki,Y=Math.max(...b.map(Q=>Q.y+Q.height+Math.max(0,...A)))+ki,ie=o.getAll().filter(Q=>{if(Q.type!=="bpmn:SequenceFlow"&&Q.type!=="bpmn:MessageFlow")return!1;const re=Q;return ic.has(re.id)||!re.waypoints||re.waypoints.length<2||[re.source,re.target].some(ve=>!ve||H.has(ve.id)||ve.x>=P)?!1:re.waypoints.some((ve,Xe)=>{const Ze=re.waypoints[Xe+1];return!!Ze&&Math.max(ve.x,Ze.x)>=F&&Math.min(ve.x,Ze.x)<=B&&Math.max(ve.y,Ze.y)>=V&&Math.min(ve.y,Ze.y)<=Y})});if(!ie.length)return 0;const J=Q=>{const re=new Map;for(const ae of b)for(const ve of A){const Xe={id:ae.id,type:ae.type,x:ae.x+E+Q,y:ae.y+ve,width:ae.width,height:ae.height};for(const Ze of ie){let kt=1/0;for(let be=0;be+1<Ze.waypoints.length;be++)kt=Math.min(kt,Za(Ze.waypoints[be],Ze.waypoints[be+1],Xe));const $t=`${Ze.id}|${ae.id}`;re.set($t,Math.min(re.get($t)??1/0,kt))}}return re},fe=[...J(0)].filter(([,Q])=>Q<=wt).map(([Q])=>Q);if(!fe.length)return 0;let ue=0;for(let Q=1;Q<=uE;Q++){const re=J(Q);if([...re.values()].every(ae=>ae>wt)&&fe.every(ae=>(re.get(ae)??1/0)>=ki)){ue=Q;break}}if(!ue)return 0;const me=Math.min(...b.map(Q=>Q.x))+E+ue,qe=new Set(fe.map(Q=>Q.slice(0,Q.indexOf("|"))));return ie.some(Q=>Q.type==="bpmn:SequenceFlow"&&qe.has(Q.id)&&Q.waypoints.some((re,ae)=>{const ve=Q.waypoints[ae+1];if(!ve||Math.min(re.y,ve.y)>L||Math.max(re.y,ve.y)<L||re.y===ve.y)return!1;const Xe=re.x+(L-re.y)*(ve.x-re.x)/(ve.y-re.y);return Xe>I&&Xe<me}))?0:ue},Lo=(b,E=()=>!0)=>{const A=p(b);if(!A)return[];const P=[A],I=new Set([b]);for(let L=0;L<P.length;L++){const H=P[L].id;for(const F of C){const B=F.flow.target;if(F.flow.source!==H||I.has(B)||!k.has(B))continue;I.add(B);const V=p(B);V&&E(V)&&P.push(V)}}return P},UN=(b,E=()=>!0)=>{const A=p(b);if(!A)return[];const P=[A],I=new Set([b]);for(let L=0;L<P.length;L++){const H=P[L].id;for(const F of C){const B=F.flow.source;if(F.flow.target!==H||I.has(B)||!k.has(B))continue;I.add(B);const V=p(B);V&&E(V)&&P.push(V)}}return P},Oi=30,$i=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",qu=(b,E)=>Up(n,b,E),rc=(b,E,A=!1)=>{const P=new Set(b.flatMap(B=>B.subtree.map(V=>V.id)));for(const B of b){const V=(B.pool.children??[]).filter($i).filter(ie=>!P.has(ie.id));if(B.subtree.some(ie=>V.some(J=>ie.x+E<J.x+J.width+Oi&&ie.x+E+ie.width+Oi>J.x&&ie.y<J.y+J.height&&ie.y+ie.height>J.y)))return null}const I=b.map(B=>B.pool.width),L=A?o.filter(B=>Array.isArray(B.waypoints)).map(B=>({c:B,wps:B.waypoints.map(V=>({x:V.x,y:V.y}))})):[],H=o.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(b.flatMap(B=>B.subtree),{x:E,y:0});const F=b.map(B=>{const Y=Math.max(...B.subtree.map(ie=>ie.x+ie.width))+$g-(B.pool.x+B.pool.width);return Y>0&&qu(B.pool,B.pool.width+Y),Y});return()=>{n.moveElements(b.flatMap(B=>B.subtree),{x:-E,y:0}),b.forEach((B,V)=>{F[V]>0&&qu(B.pool,I[V])});for(const{c:B,wps:V}of L){const Y=B.waypoints??[];Y.length===V.length&&Y.every((J,fe)=>Math.abs(J.x-V[fe].x)<=.5&&Math.abs(J.y-V[fe].y)<=.5)||n.updateWaypoints(B,V.map(J=>({x:J.x,y:J.y})))}for(let B=0;B<3;B++){let V=0;for(const Y of H){const ie=Y.x-Y.label.x,J=Y.y-Y.label.y;Math.abs(ie)<=.5&&Math.abs(J)<=.5||(n.moveElements([Y.label],{x:ie,y:J}),V++)}if(!V)break}}},Uh=b=>{var I,L;const E=new Map,A=new Map;for(const H of o.getAll()){if(H.type!=="bpmn:Participant")continue;const F=H;(F.children??[]).length||(E.set(F.id,F),A.set(F.id,[]))}for(const H of o.getAll()){if(H.type!=="bpmn:MessageFlow")continue;const F=H,B=(I=F.source)==null?void 0:I.id,V=(L=F.target)==null?void 0:L.id;B&&V&&A.has(B)&&A.get(B).push(V),B&&V&&A.has(V)&&A.get(V).push(B)}const P=[];for(const[H,F]of A)F.length&&F.every(B=>b.has(B))&&P.push(E.get(H));return P},pE=(b,E)=>{if(!b.length)return null;const A=new Set(b.map(Y=>Y.id)),P=o.getAll().filter(Y=>Y.type==="bpmn:Participant"&&!A.has(Y.id)),I=Math.min(...P.filter(Y=>(Y.children??[]).length>0).map(Y=>Y.x)),L=new Set(b.filter(Y=>Math.abs(Y.x-I)<=2).map(Y=>Y.id));if(b.some(Y=>{const ie=L.has(Y.id)?Y.x:Y.x+E,J=L.has(Y.id)?Y.width+E:Y.width;return P.some(fe=>ie<fe.x+fe.width+Oi&&ie+J+Oi>fe.x&&Y.y<fe.y+fe.height&&Y.y+Y.height>fe.y)}))return null;const F=o.filter(Y=>Y.type==="label").map(Y=>({label:Y,x:Y.x,y:Y.y})),B=b.filter(Y=>!L.has(Y.id)),V=b.filter(Y=>L.has(Y.id)).map(Y=>({pool:Y,was:{x:Y.x,y:Y.y,width:Y.width,height:Y.height}}));B.length&&n.moveElements(B,{x:E,y:0});for(const{pool:Y,was:ie}of V)n.resizeShape(Y,{...ie,width:ie.width+E});return()=>{for(const{pool:Y,was:ie}of V)n.resizeShape(Y,ie);B.length&&n.moveElements(B,{x:-E,y:0});for(let Y=0;Y<3;Y++){let ie=0;for(const J of F){const fe=J.x-J.label.x,ue=J.y-J.label.y;Math.abs(fe)<=.5&&Math.abs(ue)<=.5||(n.moveElements([J.label],{x:fe,y:ue}),ie++)}if(!ie)break}}},fE=(b,E,A)=>{const P=A.x+A.width/2,I=E.y>A.y,L=I?A.y+A.height:A.y,H=I?E.y:E.y+E.height,F=b.source===E?[{x:P,y:H},{x:P,y:L}]:[{x:P,y:L},{x:P,y:H}],B=We(o),V={...B.edges.find(Y=>Y.id===b.id),waypoints:F};return bn(V,fi(B)).length?!1:(n.updateWaypoints(b,F),!0)},qN=()=>{const b=o.filter(I=>I.type==="bpmn:Participant"),E=Math.min(...b.filter(I=>(I.children??[]).length>0).map(I=>I.x)),A=I=>!!I&&I.type==="bpmn:Participant"&&!(I.children??[]).length&&Math.abs(I.x-E)<=2&&!h.some(L=>L.participant.id===I.id),P=new Set;for(const I of o.getAll()){if(I.type!=="bpmn:MessageFlow")continue;const L=I;if((L.waypoints??[]).length!==2)continue;const H=[L.source,L.target].find(B=>A(B)),F=H===L.source?L.target:L.source;H&&F&&F.type!=="bpmn:Participant"&&P.add(L.id)}return P},YN=b=>{var A;const E=new Map;for(const P of b){const I=o.get(P);if(!I||(I.waypoints??[]).length===2)continue;const L=((A=I.source)==null?void 0:A.type)==="bpmn:Participant"?I.source:I.target,H=L===I.source?I.target:I.source;if(H.x+H.width/2<=L.x+L.width)continue;const F=E.get(L.id)??{pool:L,msgs:[]};F.msgs.push({conn:I,other:H}),E.set(L.id,F)}for(const{pool:P,msgs:I}of E.values()){const L=Math.max(...I.map(({other:ue})=>ue.x+ue.width/2))+Gp;if(o.getAll().some(ue=>{if(ue.type!=="bpmn:Participant"||ue.id===P.id)return!1;const me=ue;return P.x<me.x+me.width+Oi&&L+Oi>me.x&&P.y<me.y+me.height&&P.y+P.height>me.y}))continue;const F={x:P.x,y:P.y,width:P.width,height:P.height},B=[...P.incoming??[],...P.outgoing??[]],V=B.map(ue=>({c:ue,wps:(ue.waypoints??[]).map(me=>({x:me.x,y:me.y}))})),Y=B.flatMap(ue=>{const me=ue.label;return me?[{label:me,x:me.x,y:me.y}]:[]}),ie=ro();n.resizeShape(P,{...F,width:L-P.x});const J=I.filter(({conn:ue,other:me})=>fE(ue,P,me)).length,fe=ro();if(!(J>0&&fe.messages>ie.messages&&fe.lines>=ie.lines)){n.resizeShape(P,F);for(const{c:ue,wps:me}of V){const qe=ue.waypoints??[];qe.length===me.length&&qe.every((Q,re)=>Math.abs(Q.x-me[re].x)<=.5&&Math.abs(Q.y-me[re].y)<=.5)||n.updateWaypoints(ue,me.map(Q=>({x:Q.x,y:Q.y})))}for(let ue=0;ue<3;ue++){let me=0;for(const qe of Y){const Ce=qe.x-qe.label.x,Q=qe.y-qe.label.y;Math.abs(Ce)<=.5&&Math.abs(Q)<=.5||(n.moveElements([qe.label],{x:Ce,y:Q}),me++)}if(!me)break}}}},dE=()=>{let b=0;for(const E of o.getAll()){if(E.type!=="bpmn:DataInputAssociation"&&E.type!=="bpmn:DataOutputAssociation")continue;const A=E.waypoints??[];for(let P=1;P<A.length;P++)b+=Math.hypot(A[P].x-A[P-1].x,A[P].y-A[P-1].y)}return b},hE=()=>{let b=0;for(const E of o.getAll()){if(E.type!=="bpmn:Association")continue;const A=E.waypoints??[];for(let P=1;P<A.length;P++)b+=Math.hypot(A[P].x-A[P-1].x,A[P].y-A[P-1].y)}return b},KN=b=>{const E=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const P=A;if(b.has(P.id))continue;const L=[...P.incoming??[],...P.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===P?B.target:B.source);if(!L.length||L.some(B=>B===void 0))continue;const H=B=>{if(!("waypoints"in B&&B.waypoints))return[B.id];const V=B,Y=[V.source,V.target];return Y.some(ie=>!ie)?[]:Y.map(ie=>ie.id)},F=L.flatMap(B=>H(B));F.length&&F.every(B=>b.has(B))&&E.push(P)}return E},mE=()=>ht(We(o)).filter(b=>b.kind==="edge-crosses-shape").length,gE=b=>{const E=(b.children??[]).filter($i);let A=0;for(let P=0;P<E.length;P++)for(let I=P+1;I<E.length;I++){const L=E[P],H=E[I];L.x<H.x+H.width&&L.x+L.width>H.x&&L.y<H.y+H.height&&L.y+L.height>H.y&&A++}return A},ro=()=>{const b=We(o),E=A=>A.length>=2&&(A.every(P=>Math.abs(P.x-A[0].x)<.01)||A.every(P=>Math.abs(P.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>E(A.waypoints)).length}},yE=b=>{const E=new Map;for(const P of o.getAll()){if(P.type!=="bpmn:MessageFlow")continue;const I=P;if(!I.waypoints||I.waypoints.length!==2)continue;const L=I.source,H=I.target;if(!L||!H)continue;const F=b.has(L.id);if(F===b.has(H.id))continue;const B=F?H:L,V=d(B);if(!V||b.has(B.id))continue;const Y=E.get(V.id);Y?B.x<Y.minX&&(Y.minX=B.x):E.set(V.id,{pool:V,minX:B.x})}const A=[];for(const{pool:P,minX:I}of E.values()){const L=(P.children??[]).filter(H=>$i(H)&&!b.has(H.id)&&H.x>=I);L.length&&A.push({subtree:L,pool:P})}return A},XN=(b,E,A)=>{const P=new Map(E.map(H=>[H.pool.id,{subtree:[...H.subtree],pool:H.pool}])),I=new Set(b);for(const H of E)for(const F of H.subtree)I.add(F.id);let L=!1;for(;;){let H=0;for(const F of yE(I)){if(F.pool===A)continue;const B=P.get(F.pool.id);B?B.subtree.push(...F.subtree):P.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const V of F.subtree)I.add(V.id);H+=F.subtree.length}if(!H)break;L=!0}return L?[...P.values()]:null},ZN=(b,E)=>{const A=new Map;for(const I of o.getAll()){if(I.type!=="bpmn:DataInputAssociation"&&I.type!=="bpmn:DataOutputAssociation")continue;const L=I,H=L.waypoints;if(!H||H.length<2||!H.every(fe=>Math.abs(fe.x-H[0].x)<1))continue;const F=L.source,B=L.target;if(!F||!B)continue;const V=b.has(F.id);if(V===b.has(B.id))continue;const Y=V?B:F,ie=d(Y);if(!ie||ie===E||ie===d(V?F:B))continue;const J=A.get(ie.id);J?Y.x<J.minX&&(J.minX=Y.x):A.set(ie.id,{pool:ie,minX:Y.x})}const P=[];for(const{pool:I,minX:L}of A.values()){const H=(I.children??[]).filter(F=>$i(F)&&!b.has(F.id)&&F.x>=L);H.length&&P.push({subtree:H,pool:I})}return P},vE=b=>{const E=We(o),A=E.shapes.filter(I=>b.has(I.id)),P=new Set;for(const I of E.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const L of bn(I,A))P.add(`${I.id}|${L.id}`);return P},bE=new Map;for(const b of en(e,"sequenceFlow.update")){if(b.target===void 0)continue;const E=k.get(b.target);if(!E)continue;const A=p(b.target),P=p(b.id);if(!A||!P)continue;const I=b.source!==void 0?p(b.source):P.source,L=P.target;if(!I||!L||L.id===A.id)continue;const H=P.waypoints&&P.waypoints.length>=3&&Math.abs(P.waypoints[0].x-P.waypoints[1].x)<1&&Math.abs(P.waypoints[0].y-P.waypoints[1].y)>1?{x:P.waypoints[0].x,y:P.waypoints[0].y}:void 0,F=H?P.waypoints[1].y:void 0,B=H&&P.label?{x:P.label.x,y:P.label.y}:void 0,V=B&&P.label&&Math.abs(B.y+P.label.height/2-F)<=D/5&&B.x+P.label.width>H.x?B.x+P.label.width+6:void 0,Y=(I.outgoing??[]).filter(Ae=>Ae.type==="bpmn:SequenceFlow"&&Ae.id!==P.id&&Ae.target&&!ic.has(Ae.id)),ie=new Set(Y.map(Ae=>Ae.target.id)),J=Ae=>{const St={type:"bpmn:Task",x:Ae.x+2,y:Ae.y+2,width:Ae.width-4,height:Ae.height-4};return Y.find(bt=>(bt.waypoints??[]).some((Cn,xt)=>!!bt.waypoints[xt+1]&&Za(Cn,bt.waypoints[xt+1],St)===0))},fe=Lo(b.target),ue=new Set(fe.map(Ae=>Ae.id)),me=Sn.has(b.target)?{autoResize:!1}:void 0,qe=Math.min(...fe.map(Ae=>Ae.x)),Ce=Math.max(...fe.map(Ae=>Ae.x+Ae.width)),Q=I.x+I.width,re=L.x+L.width<=I.x,ae=(()=>{if(!re)return;const Ae=d(A),St=((Ae==null?void 0:Ae.children)??[]).filter(Je=>$i(Je)&&!ue.has(Je.id)&&Je.type!=="bpmn:Group"&&Je.type!=="bpmn:Participant"),bt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Cn=o.getAll().filter(Je=>{if(!bt.includes(Je.type))return!1;const Ft=Je;return Ft.id===P.id||ic.has(Ft.id)||!Ft.waypoints||Ft.waypoints.length<2?!1:![Ft.source,Ft.target].some(It=>!It||ue.has(It.id))}),xt=(Je,Ft)=>fe.every(It=>{var $o;const yt={id:It.id,type:It.type,x:It.x+Je,y:It.y+Ft,width:It.width,height:It.height};return Ae&&(yt.x<Ae.x||yt.x+yt.width>Ae.x+Ae.width||yt.y<Ae.y||yt.y+yt.height>Ae.y+Ae.height)||!Ct(($o=k.get(It.id))==null?void 0:$o.node.lane,It,It.y+Ft+It.height/2)||St.some(Wn=>yt.x<Wn.x+Wn.width+ki&&yt.x+yt.width+ki>Wn.x&&yt.y<Wn.y+Wn.height+ki&&yt.y+yt.height+ki>Wn.y)?!1:Cn.every(Wn=>{for(let rr=0;rr+1<Wn.waypoints.length;rr++)if(Za(Wn.waypoints[rr],Wn.waypoints[rr+1],yt)<ki)return!1;return!0})}),ct=I.x+I.width/2,Ot=I.y+I.height/2,ke=P.waypoints??[],_t=ke.length>=2&&Math.abs(ke[0].y-ke[1].y)<1&&ke[1].x<ke[0].x;return[...F!==void 0?[{cx:ct,cy:F}]:[],..._t?[{cx:I.x-Rn-A.width/2,cy:ke[0].y}]:[],{cx:ct,cy:Ot+D},{cx:ct,cy:Ot-D}].find(Je=>xt(Je.cx-(A.x+A.width/2),Je.cy-(A.y+A.height/2)))})(),ve=re&&!ae?Q:L.x,Xe=A.y+A.height/2,Ze=WN(fe,Q+Rn-qe,[0,I.y+I.height/2-Xe,L.y+L.height/2-Xe],ve,Q,I.y+I.height/2),kt=Q+Rn+Ze,$t=(()=>{if(V===void 0)return 0;const Ae=Q+Rn,St=I.y+I.height/2-A.height/2,bt={x:Ae,y:St,width:Ce-qe,height:A.height},Cn=d(I);return((Cn==null?void 0:Cn.children)??[]).some(ct=>$i(ct)&&!ue.has(ct.id)&&ct.id!==I.id&&ct.id!==L.id&&ct.type!=="bpmn:Group"&&ct.type!=="bpmn:Participant"&&ct.x<bt.x+bt.width&&ct.x+ct.width>bt.x&&ct.y<bt.y+bt.height&&ct.y+ct.height>bt.y)||J(bt)?Math.max(0,V-Ae):0})(),be=ae?0:Ce-qe+Rn*2+Ze+$t-(re?0:L.x-Q);let ye=[];if(be>0){const Ae=d(A),St=(Ae==null?void 0:Ae.children)??[],bt=ke=>ke.type==="bpmn:Lane";ye=(()=>{const ke=new Set;for(const Le of St)$i(Le)&&!ue.has(Le.id)&&Le.id!==I.id&&Le.x>=ve&&ke.add(Le.id);const _t=[];for(const Le of St){if(Le.type!=="bpmn:DataStoreReference"&&Le.type!=="bpmn:DataObjectReference")continue;const Je=Le,It=[...Je.incoming??[],...Je.outgoing??[]].filter(yt=>yt.type==="bpmn:DataInputAssociation"||yt.type==="bpmn:DataOutputAssociation").map(yt=>yt.source===Je?yt.target:yt.source);It.length&&It.every(yt=>yt!==void 0&&ke.has(yt.id))&&_t.push(Je)}return _t})();const xt=St.filter(ke=>!("waypoints"in ke&&ke.waypoints)&&!bt(ke)&&ke.type!=="label"&&!ue.has(ke.id)&&ke.id!==I.id&&ke.x>=ve),ct=xt.flatMap(ke=>ke.labels??[]),Ot=Ae?[Ae,...St.filter(ke=>bt(ke))]:[];if(xt.length){const ke=new Set(xt.map(Ye=>Ye.id)),_t=yE(ke),Le=_t.length?XN(ke,_t,Ae):null,Je=Ye=>{const vt=new Set(ke);for(const Dt of Ye)for(const Sr of Dt.subtree)vt.add(Sr.id);return KN(vt)},Ft=Je(_t),It=Le?Je(Le):Ft,yt=Uh(ke),$o=new Set(ke);for(const Ye of _t)for(const vt of Ye.subtree)$o.add(vt.id);const Wn=_t.length?Uh($o):yt,rr=(()=>{if(!Le)return[];const Ye=new Set(ke);for(const vt of Le)for(const Dt of vt.subtree)Ye.add(Dt.id);return Uh(Ye)})(),Ga=Le??_t,Fo=(()=>{const Ye=new Set(ke);for(const vt of Ga)for(const Dt of vt.subtree)Ye.add(Dt.id);return ZN(Ye,Ae)})(),em=Fo.length?Je([...Ga,...Fo]):Ft,Fi=new Set([...xt,...Ot].map(Ye=>Ye.id)),gt=St.filter(Ye=>{const vt=Ye.labelTarget;return Ye.type==="label"&&!!vt&&"waypoints"in vt&&!!vt.source&&!!vt.target&&Fi.has(vt.source.id)&&Fi.has(vt.target.id)}),_n=qN();n.createSpace([...xt,...ct,...gt],Ot,{x:be,y:0},"e",ve-1);const Yt=(Ye,vt,Dt)=>{const Sr=ro(),Qu=Dt?vE(Dt):null,Ju=rc(Ye,be,!!Dt);if(!Ju)return!1;const sc=vt.length?pE(vt,be):null,ep=ro(),Kt=!!Dt&&!!Qu&&[...vE(Dt)].some(Ho=>!Qu.has(Ho));return ep.messages>Sr.messages&&ep.lines>=Sr.lines&&!Kt?!0:(sc==null||sc(),Ju(),!1)},ci=Fo.length>0&&Yt([...Ga,...Fo],Le?rr:Wn,new Set(Fo.flatMap(Ye=>Ye.subtree.map(vt=>vt.id)))),jo=!ci&&Le?Yt(Le,rr):!1;let or=ci||jo;!or&&_t.length&&(or=Yt(_t,Wn));const Va=ci?em:jo?It:Ft;if(!or){for(const Ye of _t){const vt=ro(),Dt=rc([Ye],be);if(!Dt)continue;const Sr=ro();(Sr.messages<=vt.messages||Sr.lines<vt.lines)&&Dt()}if(yt.length){const Ye=ro(),vt=pE(yt,be);if(vt){const Dt=ro();(Dt.messages<=Ye.messages||Dt.lines<Ye.lines)&&vt()}}}if(YN(_n),Va.length){const Ye=()=>new Set(ht(We(o)).map(Dt=>pt(Dt))),vt=Dt=>{const Sr=hE(),Qu=Ye(),Ju=Dt.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),sc=o.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(Dt,{x:be,y:0});const ep=[...Ye()].filter(Kt=>!Qu.has(Kt));if(hE()<Sr&&ep.length===0)return!0;for(const{a:Kt,x:Ho,y:cc}of Ju)(Kt.x!==Ho||Kt.y!==cc)&&n.moveElements([Kt],{x:Ho-Kt.x,y:cc-Kt.y});for(const Kt of sc){const Ho=Kt.x-Kt.label.x,cc=Kt.y-Kt.label.y;(Ho!==0||cc!==0)&&n.moveElements([Kt.label],{x:Ho,y:cc})}return!1};if(!vt(Va)&&Va.length>1)for(const Dt of Va)vt([Dt])}}}const oe=E.node.lane!==void 0?p(E.node.lane):E.node.participant!==void 0?p(E.node.participant):void 0,xe=Ae=>{if(!oe)return!0;const St=Ae.y+Ae.height/2;return St>=oe.y&&St<=oe.y+oe.height},Ne=!xe(I)&&xe(L)?L:I,Ie=Ne.y+Ne.height/2,we=Ie-(A.y+A.height/2),it=E.band!==void 0,lt=it?[A]:fe,Jt=(E.band===void 0||_(E.node.lane,E.node.participant,E.band,Ie))&&Et(b.target)&<.every(Ae=>{var St;return Ct((St=k.get(Ae.id))==null?void 0:St.node.lane,Ae,Ae.y+Ae.height/2+we)}),si=Ae=>Math.abs(Ae.y+Ae.height/2-(A.y+A.height/2))<=D/2;if(Jt&&it){const Ae=Math.abs(we)<=D/2?fe.filter(St=>St.id!==A.id&&si(St)):[];if(n.moveElements(fe,{x:kt-qe,y:0},void 0,me),n.moveElements([A],{x:0,y:we},void 0,me),Ae.length){const St=()=>new Set(ht(We(o)).map(ke=>pt(ke))),bt=St(),Cn=o.filter(ke=>ke.type==="label").map(ke=>({label:ke,x:ke.x,y:ke.y}));n.moveElements(Ae,{x:0,y:we});const xt=St(),ct=[...xt].filter(ke=>!bt.has(ke)).length,Ot=[...bt].filter(ke=>!xt.has(ke)).length;if(ct>Ot){n.moveElements(Ae,{x:0,y:-we});for(const ke of Cn){const _t=ke.x-ke.label.x,Le=ke.y-ke.label.y;(_t!==0||Le!==0)&&n.moveElements([ke.label],{x:_t,y:Le})}}}}else n.moveElements(fe,{x:kt-qe,y:Jt?we:0},void 0,me);const tt=d(A);if(!Jt&&E.node.lane===void 0&&E.band!==void 0&&tt){const Ae=tt.y+ee+R(`pool:${E.node.participant??""}`,E.band)*D,St=Ae-(A.y+A.height/2);St!==0&&!ot(tt,A,A.x+A.width/2,Ae,ue)&&n.moveElements([A],{x:0,y:St},void 0,me)}if(ae)n.moveElements(fe,{x:ae.cx-(A.x+A.width/2),y:ae.cy-(A.y+A.height/2)},void 0,me);else if(tt){const Ae=(tt.children??[]).filter(xt=>$i(xt)&&!ue.has(xt.id)&&xt.type!=="bpmn:Group"&&xt.type!=="bpmn:Participant"),St=(xt,ct,Ot,ke,_t)=>xt.x+ct<_t.x+_t.width+ke&&xt.x+ct+xt.width+ke>_t.x&&xt.y+Ot<_t.y+_t.height+ke&&xt.y+Ot+xt.height+ke>_t.y,bt=Ae.find(xt=>St(A,0,0,0,xt)),Cn=bt?void 0:J(A);if(bt||Cn){const xt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],ct=o.getAll().filter(gt=>{if(!xt.includes(gt.type))return!1;const _n=gt;return ic.has(_n.id)||!_n.waypoints||_n.waypoints.length<2?!1:![_n.source,_n.target].some(Yt=>!Yt||ue.has(Yt.id))}),Ot=(gt,_n,Yt)=>{var ci;return Ct((ci=k.get(gt.id))==null?void 0:ci.node.lane,gt,gt.y+Yt+gt.height/2)&>.x+_n>=tt.x&>.x+_n+gt.width<=tt.x+tt.width&>.y+Yt>=tt.y&>.y+Yt+gt.height<=tt.y+tt.height},ke=(gt,_n)=>fe.every(Yt=>Ot(Yt,gt,_n)&&!Ae.some(ci=>St(Yt,gt,_n,ki,ci))&&ct.every(ci=>{const jo={id:Yt.id,type:Yt.type,x:Yt.x+gt,y:Yt.y+_n,width:Yt.width,height:Yt.height};for(let or=0;or+1<ci.waypoints.length;or++)if(Za(ci.waypoints[or],ci.waypoints[or+1],jo)<ki)return!1;return!0})),_t=A.y+A.height/2,Le=[F,L.y+L.height/2].filter(gt=>gt!==void 0&&Math.abs(gt-_t)>=1),Je=bt&&ie.has(bt.id)?bt:Cn==null?void 0:Cn.target,Ft=Je?Je.x-A.x:0,It=Math.max(...fe.map(gt=>gt.x+gt.width)),yt=[...Ft!==0?[Ft]:[],...Ze!==0?[-Ze]:[],0],$o=V===void 0?[]:yt.map(gt=>Math.max(gt,V-A.x)),Wn=gt=>It+gt+Rn<=L.x,rr=[...new Set([...$o,...yt])].filter(Wn),Ga=bt&&ie.has(bt.id)?[bt.x+bt.width+Rn-A.x]:[],Fo=V===void 0?[]:Ga.map(gt=>Math.max(gt,V-A.x)),em=[...new Set([...Fo,...Ga])].filter(gt=>Wn(gt)&&!rr.includes(gt));let Fi;for(const gt of[rr,em]){for(const _n of Le){for(const Yt of gt)if(ke(Yt,_n-_t)){Fi={dx:Yt,dy:_n-_t};break}if(Fi)break}if(Fi)break}if(Fi){const gt=Ye=>{const vt=Ye;return[vt.edge,vt.other,...Array.isArray(vt.edges)?vt.edges:[]].some(Dt=>typeof Dt=="string"&&ic.has(Dt))},_n=()=>new Set(ht(We(o)).filter(Ye=>!gt(Ye)).map(Ye=>pt(Ye))),Yt=_n(),ci=o.filter(Ye=>Ye.type==="label").map(Ye=>({label:Ye,x:Ye.x,y:Ye.y}));n.moveElements(fe,{x:Fi.dx,y:Fi.dy},void 0,me);const jo=_n(),or=[...jo].filter(Ye=>!Yt.has(Ye)).length,Va=[...Yt].filter(Ye=>!jo.has(Ye)).length;if(or>Va){n.moveElements(fe,{x:-Fi.dx,y:-Fi.dy},void 0,me);for(const Ye of ci){const vt=Ye.x-Ye.label.x,Dt=Ye.y-Ye.label.y;(vt!==0||Dt!==0)&&n.moveElements([Ye.label],{x:vt,y:Dt})}}else H&&bE.set(P.id,{exit:H,channelY:F,label:B})}}}{const Ae=new Set(fe.map(ct=>ct.id)),St=new Set(C.map(ct=>ct.flow.id)),bt=20,Cn=ct=>{const Ot=ct.source,ke=ct.target,_t=Math.min(Ot.x,ke.x)-bt,Le=Math.max(Ot.x+Ot.width,ke.x+ke.width)+bt,Je=Math.min(Ot.y,ke.y)-bt,Ft=Math.max(Ot.y+Ot.height,ke.y+ke.height)+bt;return ct.waypoints.some(It=>It.x<_t||It.x>Le||It.y<Je||It.y>Ft)},xt=new Map;for(const ct of fe)for(const Ot of[...ct.incoming??[],...ct.outgoing??[]])Ot.id!==b.id&&St.has(Ot.id)&&!(Ae.has(Ot.source.id)&&Ae.has(Ot.target.id))&&xt.set(Ot.id,Ot);for(const ct of xt.values())Cn(ct)&&dt(ct)}const zt=ye.length?d(ye[0]):void 0;if(zt){const Ae={assoc:dE(),overlaps:gE(zt),crosses:mE()},St=ye.map(Le=>({st:Le,x:Le.x})),bt=o.filter(Le=>Le.type==="label").map(Le=>({label:Le,x:Le.x,y:Le.y})),Cn=Math.min(...ye.flatMap(Le=>[...Le.incoming??[],...Le.outgoing??[]].filter(Je=>Je.type==="bpmn:DataInputAssociation"||Je.type==="bpmn:DataOutputAssociation").map(Je=>(Je.source===Le?Je.target:Je.source).x))),xt=new Set(ye.map(Le=>Le.id)),ct=(zt.children??[]).filter($i).filter(Le=>!xt.has(Le.id));let Ot=Cn;for(const Le of[...ye].sort((Je,Ft)=>Je.x-Ft.x)){let Je=Ot;for(let Ft=0;Ft<100;Ft++){const It=ct.find(yt=>Je<yt.x+yt.width+Oi&&Je+Le.width+Oi>yt.x&&Le.y<yt.y+yt.height&&Le.y+Le.height>yt.y);if(!It)break;Je=It.x+It.width+Oi}Je!==Le.x&&n.moveElements([Le],{x:Je-Le.x,y:0}),Ot=Je+Le.width+Oi}const ke=Ot+150-(zt.x+zt.width);ke>0&&qu(zt,zt.width+ke);const _t={assoc:dE(),overlaps:gE(zt),crosses:mE()};if(_t.assoc>=Ae.assoc||_t.overlaps>Ae.overlaps||_t.crosses>Ae.crosses){for(const{st:Le,x:Je}of St)Le.x!==Je&&n.moveElements([Le],{x:Je-Le.x,y:0});ke>0&&qu(zt,zt.width-ke);for(const Le of bt){const Je=Le.x-Le.label.x,Ft=Le.y-Le.label.y;(Je!==0||Ft!==0)&&n.moveElements([Le.label],{x:Je,y:Ft})}}}}for(const[b,E]of Sn){const A=p(b);if(!A)continue;const P=E.container,I=Math.abs(A.y+A.height/2-P.y-E.relCy)>=.5,L=A.label,H=Math.min(A.y,L&&!L.hidden?L.y:A.y),F=Math.max(A.y+A.height,L&&!L.hidden?L.y+L.height:0);if(I&&H>=P.y&&F<=P.y+P.height)continue;const B=A.y;E.grow(),A.y!==B&&n.moveElements([A],{x:0,y:B-A.y},void 0,{autoResize:!1})}const xE=(b,E)=>{const A=E.target===b,P=f(E.source),I=f(E.target),L=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(P,I,E.id?{type:L,businessObject:i.create(L,{id:E.id})}:{type:L})},wE=b=>{for(const E of h){if(!E.participant.blackBox)continue;const A=p(E.participant.id);if(!A)continue;const P=[];for(const L of x){const H=L.flow.source===E.participant.id?L.flow.target:L.flow.target===E.participant.id?L.flow.source:void 0,F=H?p(H):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&P.push(F)}if(!P.length)continue;if(!b&&E.order===void 0){const L=(()=>{var F;const H=new Map;for(const B of P){const V=d(B);if(!V)continue;const Y=H.get(V.id);Y?Y.n+=1:H.set(V.id,{shape:V,n:1})}return(F=[...H.values()].sort((B,V)=>V.n-B.n)[0])==null?void 0:F.shape})();if(L){const H=V=>V.reduce((Y,ie)=>Y+ie,0)/V.length,F=H(P.map(V=>V.y+V.height/2))<L.y+L.height/2,B=o.filter(V=>V.type==="bpmn:Participant"&&V.id!==E.participant.id&&V.id!==L.id).filter(V=>F?V.y+V.height<=L.y+5:V.y>=L.y+L.height-5);if(B.length){const V=[...B.reduce((ae,ve)=>ae.set(ve.y,(ae.get(ve.y)??0)+1),new Map)].sort((ae,ve)=>ve[1]-ae[1]||(F?ve[0]-ae[0]:ae[0]-ve[0]))[0][0],Y=Math.min(A.width,tC),ie=nC,J=P.map(ae=>ae.x+ae.width/2),fe=Math.round(H(J)-Y/2),ue=Math.max(...J)+Gp,me=ae=>({x:ae,width:Math.max(Y,ue-ae)}),qe=B.filter(ae=>Math.min(ae.y+ae.height,V+ie)-Math.max(ae.y,V)>0),Ce=ae=>{const ve=me(ae);return qe.some(Xe=>Xe.x<ve.x+ve.width&&ve.x<Xe.x+Xe.width)},Q=ae=>{const ve=me(ae);return J.filter(Xe=>Xe>=ve.x+10&&Xe<=ve.x+ve.width-10).length},re=(()=>{if(!Ce(fe))return fe;const ae=Q(fe);return qe.flatMap(ve=>[ve.x+ve.width+Lg,ve.x-Lg-Y]).map(ve=>Math.round(ve)).filter(ve=>!Ce(ve)&&Q(ve)>=ae).sort((ve,Xe)=>Math.abs(ve-fe)-Math.abs(Xe-fe))[0]??fe})();if(re!==A.x||V!==A.y||Y!==A.width||ie!==A.height){const ae=()=>new Set(ht(We(o)).map(be=>pt(be))),ve=ae(),Xe={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:re,y:V,width:Y,height:ie});const Ze=ae(),kt=[...Ze].filter(be=>!ve.has(be)).length,$t=[...ve].filter(be=>!Ze.has(be)).length;kt>$t&&n.resizeShape(A,Xe)}}}}const I=Math.max(...P.map(L=>L.x+L.width/2))+Gp;if(I>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:I-A.x,height:A.height}),!!b)for(const L of x){const H=p(L.flow.id),F=L.flow.source===E.participant.id?L.flow.target:L.flow.target===E.participant.id?L.flow.source:void 0,B=F?p(F):void 0;if(!H||!B||B.type==="bpmn:Participant")continue;const V=B.x+B.width/2;V<A.x+10||V>A.x+A.width-10||fE(H,A,B)}}};wE(!1);for(const b of x){const E=b.flow;n.connect(f(E.source),f(E.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:E.id,name:E.name})})}{const A=new Set([...C.map(B=>B.flow.id),...x.map(B=>B.flow.id)].filter(B=>!!B)),P=o.filter(B=>!!B.waypoints),I=(B,V)=>Math.abs(V.x-B.x)<2?"L":Math.abs(V.x-(B.x+B.width))<2?"R":Math.abs(V.y-B.y)<2?"T":Math.abs(V.y-(B.y+B.height))<2?"B":void 0,L=new Map,H=(B,V,Y)=>{if(!B||!V||typeof B.x!="number")return;const ie=I(B,V);if(!ie)return;let J=L.get(B.id);J||L.set(B.id,J=new Map),J.set(ie,[...J.get(ie)??[],Y])};for(const B of P){const V=B.waypoints;!V||V.length<2||(H(B.source,V[0],{id:B.id,dir:"out"}),H(B.target,V[V.length-1],{id:B.id,dir:"in"}))}const F=new Set;for(const[B,V]of L){const Y=p(B);if(!Y||typeof Y.x!="number"||![...V.values()].some(Ce=>{const Q=Ce.filter(re=>re.dir==="in");return Ce.length>=3&&Q.length>=1&&Ce.some(re=>re.dir==="out")&&Q.some(re=>A.has(re.id))}))continue;const J=d(Y);if(!J||F.has(J.id)||(J.children??[]).some(Ce=>Ce.type==="bpmn:Lane"))continue;const fe=(FE=V.get("T"))!=null&&FE.length?(jE=V.get("B"))!=null&&jE.length?void 0:"B":"T";if(!fe||(fe==="T"?Y.y-J.y:J.y+J.height-(Y.y+Y.height))>=D)continue;const me=(J.children??[]).filter(Ce=>!("waypoints"in Ce&&Ce.waypoints)&&Ce.type!=="label"&&typeof Ce.x=="number"),qe=J.y+J.height;n.resizeShape(J,{x:J.x,y:J.y,width:J.width,height:J.height+D}),te(qe,J.id,D),fe==="T"&&me.length&&n.moveElements(me,{x:0,y:D}),F.add(J.id)}}const qh=20,_E=4,QN=3,JN=2,e$=[10,30,80],oo=()=>{const b=We(o);return{bad:ht(b).filter(E=>E.kind==="edge-crosses-shape"||E.kind==="edge-overlap-opposite"||E.kind==="edge-overlap-mixed").length,crossings:Wm(b),straight:b.edges.filter(E=>E.type==="bpmn:MessageFlow"&&E.waypoints.length===2).length}},Ha=b=>{const E=We(o),A=E.edges.find(P=>P.id===b);return A?bn(A,fi(E)).length:0},Yu=b=>Ha(b)>0,Ku=b=>We(o).edges.filter(E=>E.type==="bpmn:MessageFlow"&&E.id!==b&&E.waypoints.length===2).length,t$=(b,E,A)=>rc([{subtree:b,pool:E}],A),EE=(b,E)=>E.bad>b.bad||E.crossings>b.crossings&&E.straight<=b.straight&&E.bad>=b.bad,za=(b,E)=>EE(b,E)||E.straight<b.straight,Io=(b,E,A=()=>!0,P=EE,I=!1)=>{const L=oo(),H=rc(b,E,I);if(!H)return!1;const F=oo();return P(L,F)||!A()?(H(),!1):!0},n$=(b,E,A,P=()=>!0)=>Io([{subtree:b,pool:E}],A,P),Bo=b=>{var E;return!!((E=k.get(b))!=null&&E.node.participant)},oc=new Map;for(const b of x){if(!Bo(b.flow.target))continue;const E=oc.get(b.flow.target)??[];E.push(b),oc.set(b.flow.target,E)}const Xu=[...oc.keys()],Yh=new Set(C.map(b=>b.flow.target)),SE=b=>Qt.findIndex(({op:E})=>E.participant.id===b);Xu.sort((b,E)=>{var I,L;const A=Yh.has(b)?1:0,P=Yh.has(E)?1:0;return A!==P?A-P:SE((I=k.get(b))==null?void 0:I.node.participant)-SE((L=k.get(E))==null?void 0:L.node.participant)});const ao=b=>b.x+b.width/2,i$=b=>{const E=new Map;for(const I of o.getAll()){const L=I;if(!L.waypoints||!L.source||!L.target)continue;(E.get(L.source.id)??E.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const A=new Set([b]),P=[b];for(let I=0;I<P.length;I++)for(const L of E.get(P[I])??[])A.has(L)||(A.add(L),P.push(L));return A},r$=(b,E)=>{const A=i$(E);let P;for(const I of o.getAll()){const L=I;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==b||A.has(L.source.id))continue;const H=L.source;if(typeof H.x!="number"||H.type==="bpmn:Participant")continue;const F=ao(H);(P===void 0||F>P)&&(P=F)}return P},Kh=(b,E)=>{const A=p(b.flow.source);if(A)return A.type==="bpmn:Participant"?r$(A.id,E):ao(A)},RE=b=>{let E;for(const A of oc.get(b)??[]){const P=Kh(A,b);P!==void 0&&(!E||P>E.cx)&&(E={op:A,cx:P})}return E==null?void 0:E.op},o$=b=>{const E=RE(b),A=p(b),P=E?Kh(E,b):void 0;return A&&P!==void 0?P-ao(A):void 0},a$=b=>{const E=o$(b);return E!==void 0&&Math.abs(E)<qh},Xh=(b,E,A,P,I)=>{var L;for(let H=!0;H;){H=!1;for(const F of x){if(F.flow.id===A)continue;const B=E.has(F.flow.source),V=E.has(F.flow.target);if(B===V||P(B?F.flow.source:F.flow.target))continue;const Y=B?F.flow.target:F.flow.source;if(I(Y)||!Bo(Y))continue;const ie=p(F.flow.id);if(!(ie!=null&&ie.waypoints)||ie.waypoints.length!==2)continue;const J=p(Y),fe=(L=k.get(Y))==null?void 0:L.node.participant;if(!J||!fe)continue;const ue=Lo(Y,me=>me.x>=J.x).filter(me=>!E.has(me.id));if(!(!ue.length||ue.some(me=>I(me.id)))){for(const me of ue)E.add(me.id);b.set(fe,[...b.get(fe)??[],...ue]),H=!0}}}return[...b].map(([H,F])=>({subtree:F,pool:f(H)}))},CE=(b,E,A,P,I)=>Xh(new Map([[E,[...b]]]),new Set(b.map(L=>L.id)),P,L=>L===A,L=>L===I),Zh=b=>{const E=RE(b);if(!E)return null;const A=p(b),P=p(E.flow.source),I=Kh(E,b);if(!A||!P||I===void 0)return null;const L=I-ao(A);if(L>=qh){const H=k.get(b).node.participant,F=Lo(b,B=>B.x>=A.x);return{groups:CE(F,H,b,E.flow.id,E.flow.source),dx:L}}if(-L>=qh&&Bo(E.flow.source)){const H=k.get(E.flow.source).node.participant,F=Lo(E.flow.source,B=>B.x>=P.x&&!a$(B.id));return{groups:CE(F,H,E.flow.source,E.flow.id,b),dx:-L}}return null},ME=()=>Xu.map(b=>({id:b,plan:Zh(b)})).filter(b=>!!b.plan).sort((b,E)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(P=>P.x)))-Math.min(...E.plan.groups.flatMap(A=>A.subtree.map(P=>P.x)))).map(b=>b.id);for(let b=0;b<3;b++){const E=oo(),A=[];for(const I of ME()){const L=Zh(I);if(!L)continue;const H=rc(L.groups,L.dx);H&&A.push(H)}if(!A.length)break;if(!za(E,oo()))continue;for(const I of A.reverse())I();let P=!1;for(const I of ME()){const L=Zh(I);L&&Io(L.groups,L.dx,()=>!0,za)&&(P=!0)}if(!P)break}for(const b of Xu){if(Yh.has(b))continue;const E=k.get(b);if(!E||E.node.lane!==void 0)continue;const A=K(E);if(A===void 0)continue;const P=p(b),I=P?d(P):void 0;if(!P||!I)continue;const L=I.y+ee+R(`pool:${E.node.participant??""}`,A)*D,H=L-(P.y+P.height/2);H!==0&&!ot(I,P,P.x+P.width/2,L)&&n.moveElements([P],{x:0,y:H})}const AE=new Set;for(let b=0,E=!0;E&&b<QN;b++){E=!1;for(const A of Xu.flatMap(P=>oc.get(P)??[])){if(AE.has(A.flow.id)||!Yu(A.flow.id))continue;const P=p(A.flow.target);if(!P)continue;const I=f(k.get(A.flow.target).node.participant),L=Lo(A.flow.target,V=>V.x>=P.x),H=P.width+j,F=Ha(A.flow.id),B=Ku(A.flow.id);for(let V=1;V<=_E;V++){const Y=()=>Ha(A.flow.id)<F&&Ku(A.flow.id)>=B;if(n$(L,I,H*V,Y)){AE.add(A.flow.id),E=!0;break}}}}const Qh=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),PE=new Set(Qh.map(b=>b.id));for(const b of o.filter(E=>E.type==="bpmn:MessageFlow"))PE.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Qh.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Qh){if(!Yu(b.id))continue;const E=p(b.source),A=p(b.target);if(!E||!A)continue;let P,I,L;if(b.preexisting){const[F,B]=E.type==="bpmn:Participant"?[A,E]:[E,A];if(P=ao(F),P<B.x||P>B.x+B.width)continue;[I,L]=F.y<B.y?[F.y+F.height,B.y]:[B.y+B.height,F.y]}else{if(E.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(P=E.x+E.width/2,Math.abs(P-(A.x+A.width/2))>15))continue;[I,L]=E.y<A.y?[E.y+E.height,A.y]:[A.y+A.height,E.y]}const H=[...k.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==E.id&&F.id!==A.id).filter(F=>F.x<=P&&P<=F.x+F.width&&F.y+F.height>I&&F.y<L).sort((F,B)=>F.x-B.x);for(const F of H){const B=(HE=k.get(F.id))==null?void 0:HE.node.participant,V=B?p(B):void 0;if(!B||!V)continue;const Y=[...k.values()].filter(re=>re.node.participant===B).map(re=>re.node.id),ie=re=>re.map(ae=>p(ae)).filter(ae=>!!ae),fe=[UN(F.id,re=>{var ae;return((ae=k.get(re.id))==null?void 0:ae.node.participant)===B}),ie(Y)].filter(re=>re.length).map(re=>[{subtree:re,pool:V}]);if(b.preexisting){const re=ie(Y);re.length&&fe.push(Xh(new Map([[B,[...re]]]),new Set(re.map(ae=>ae.id)),b.id,()=>!1,ae=>ae===E.id||ae===A.id))}const ue=F.width+j,me=Ha(b.id),qe=Ku(b.id),Ce=()=>Ha(b.id)<me&&Ku(b.id)>=qe;let Q=!1;for(const re of fe){for(let ae=1;ae<=_E;ae++)if(Io(re,ue*ae,Ce)){Q=!0;break}if(Q)break}if(!Yu(b.id))break}}const Zu=()=>{var E;const b=new Set;for(const A of ht(We(o)))A.kind!=="edge-crosses-shape"||PE.has(A.edge)||((E=p(A.edge))==null?void 0:E.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},s$=(b,E)=>oo().bad>=b&&[...Zu()].some(A=>!E.has(A)),TE=b=>{var E,A;return Ha(b)===0&&((A=(E=p(b))==null?void 0:E.waypoints)==null?void 0:A.length)===2},c$=(b,E,A)=>{const P=new Set(b.flatMap(L=>L.subtree.map(H=>H.id))),I=[...Zu()].filter(L=>!A.has(L)).map(L=>L.split(">")[1]);return[...new Set(I)].filter(L=>P.has(L)&&L!==E.source&&L!==E.target)},l$=(b,E,A,P,I)=>{const L=b.map(V=>({...V,subtree:V.subtree.filter(Y=>!I.includes(Y.id))})).filter(V=>V.subtree.length),H=new Set(L.flatMap(V=>V.subtree.map(Y=>Y.id))),F=()=>I.every(V=>{const Y=p(V);return!!Y&&C.filter(ie=>ie.flow.target===V&&H.has(ie.flow.source)).every(ie=>{const J=p(ie.flow.source);return!!J&&J.x+J.width<=Y.x})});return Io(L,E,()=>TE(A.id)&&[...Zu()].every(V=>P.has(V))&&F(),za,!0)};for(const b of x){if(!Yu(b.flow.id))continue;const E=p(b.flow.id);if(((zE=E==null?void 0:E.waypoints)==null?void 0:zE.length)!==2)continue;const A=p(b.flow.source),P=p(b.flow.target);if(!A||!P||A.type==="bpmn:Participant"||P.type==="bpmn:Participant"||!Bo(b.flow.source)||!Bo(b.flow.target)||Math.abs(ao(A)-ao(P))>JN)continue;const I=ao(A),L=E.waypoints.map(me=>me.y),[H,F]=[Math.min(...L),Math.max(...L)],B=fi(We(o)).filter(me=>me.id!==A.id&&me.id!==P.id&&me.x<I&&I<me.x+me.width&&H<me.y+me.height&&me.y<F);if(!B.length)continue;const V=(GE=k.get(b.flow.source))==null?void 0:GE.node.participant,Y=(VE=k.get(b.flow.target))==null?void 0:VE.node.participant;if(!V||!Y)continue;const ie=new Map;for(const[me,qe,Ce]of[[b.flow.source,A,V],[b.flow.target,P,Y]]){const Q=ie.get(Ce)??[],re=Lo(me,ae=>ae.x>=qe.x).filter(ae=>!Q.some(ve=>ve.id===ae.id));ie.set(Ce,[...Q,...re])}const J=new Set([...ie.values()].flat().map(me=>me.id)),fe=Xh(ie,J,b.flow.id,me=>me===b.flow.source||me===b.flow.target,()=>!1),ue=Math.max(...B.map(me=>me.x+me.width));for(const me of e$){const qe=ue+me-I;if(qe<=0)continue;const Ce=oo().bad,Q=Zu();let re=[],ae=!0;const ve=()=>!TE(b.flow.id)||ae&&(re=c$(fe,b.flow,Q),re.length)?!1:!s$(Ce,Q);if(Io(fe,qe,ve,za))break;if(re.length&&(l$(fe,qe,b.flow,Q,re)||(ae=!1,Io(fe,qe,ve,za))))break}}{const b=A=>A.y+A.height/2,E=[];for(const A of k.keys()){if(!Bo(A))continue;const P=C.filter(H=>H.flow.target===A);if(P.length!==1)continue;const I=p(P[0].flow.source),L=p(A);!I||!L||!k.has(I.id)||Math.abs(b(I)-b(L))>1||L.x-(I.x+I.width)<=j+1||E.push({id:A,pred:I,node:L})}E.sort((A,P)=>A.node.x-P.node.x);for(const{id:A}of E){const P=k.get(A),I=p(A),L=p(C.find(J=>J.flow.target===A).flow.source);if(!I||!L)continue;const H=I.x-(L.x+L.width);if(H<=j+1)continue;const F=f(P.node.participant),B=Lo(A,J=>J.x>=I.x),V=oo(),Y=t$(B,F,-(H-j));if(!Y)continue;const ie=oo();(ie.bad>V.bad||ie.crossings>=V.crossings||ie.straight<V.straight)&&Y()}}wE(!0);const u$=10,p$=400,f$=b=>[...b.incoming??[],...b.outgoing??[]].filter(E=>E.type==="bpmn:DataInputAssociation"||E.type==="bpmn:DataOutputAssociation").map(E=>E.source===b?E.target:E.source).filter(E=>!!E&&typeof E.y=="number"),d$=o.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),h$=(b,E)=>{const A=b.x+b.width/2,P=b.y+b.height/2;let I;for(const L of d$){if((d(L)??u())!==E||L.y<b.y+b.height)continue;const H=Math.abs(L.x+L.width/2-A);H>p$||H<L.width||!f$(L).some(B=>B.height===b.height&&Math.abs(B.y+B.height/2-P)<=u$&&L.y>=B.y+B.height)||(!I||H<I.dx||H===I.dx&&L.id<I.id)&&(I={dx:H,id:L.id,cy:L.y+L.height/2})}return I==null?void 0:I.cy};for(const b of m){const E=b.associations??[],A=E.map(L=>L.source===b.dataStore.id?L.target:L.source).map(p).find(Boolean),P=A?d(A)??u():u(),I=A?{x:A.x+A.width/2,y:h$(A,P)??A.y+A.height+110}:{x:200,y:wn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},I,P);for(const L of E)xE(b.dataStore.id,L)}for(const b of v){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;xE(A,b.association)}let kE=0;const No=10,OE=40,m$=(b,E)=>{const A=E.map(B=>d(B)).filter(B=>!!B);for(const B of A){const V=No,Y=B.y,ie=B.y+B.height,J=B.x,fe=B.x+B.width;if(Math.abs(b.y-Y)<V){const ue=Y+V-b.y;b.y+=ue,b.height-=ue}if(Math.abs(b.y+b.height-ie)<V&&(b.height=ie-V-b.y),Math.abs(b.x-J)<V){const ue=J+V-b.x;b.x+=ue,b.width-=ue}Math.abs(b.x+b.width-fe)<V&&(b.width=fe-V-b.x)}if(!A.length)return;const P=Math.min(...A.map(B=>B.y)),I=Math.max(...A.map(B=>B.y+B.height)),L=P-b.y,H=b.y+b.height-I,F=OE-No;if(L>0!=H>0)if(L>0&&L<F){const B=L+No;b.y+=B,b.height-=B}else H>0&&H<F&&(b.height-=H+No)},g$=(b,E)=>{const A=No,P=30,I=o.filter(L=>L.type==="bpmn:Group"&&L.id!==E);for(const L of I){const H=L.x,F=L.x+L.width,B=L.y,V=L.y+L.height,Y=b.y<V&&B<b.y+b.height,ie=b.x<F&&H<b.x+b.width;if(Y){if(Math.abs(b.x-F)<A){const J=Math.min(F+A-b.x,P);J>0&&b.width-J>0&&(b.x+=J,b.width-=J)}if(Math.abs(b.x+b.width-H)<A){const J=Math.min(b.x+b.width-(H-A),P);J>0&&b.width-J>0&&(b.width-=J)}}if(ie){if(Math.abs(b.y-V)<A){const J=Math.min(V+A-b.y,P);J>0&&b.height-J>0&&(b.y+=J,b.height-=J)}if(Math.abs(b.y+b.height-B)<A){const J=Math.min(b.y+b.height-(B-A),P);J>0&&b.height-J>0&&(b.height-=J)}}}},Jh=(b,E)=>{const A=OE,P=Math.min(...b.map(B=>B.x))-A,I=Math.min(...b.map(B=>B.y))-A,L=Math.max(...b.map(B=>B.x+B.width))+A,H=Math.max(...b.map(B=>B.y+B.height))+A,F={x:P,y:I,width:L-P,height:H-I};return m$(F,b),g$(F,E),F};for(const b of S){const E=(b.group.members??[]).map(p).filter(I=>!!I);let A;E.length?A=Jh(E,b.group.id):(A={x:300+kE*350,y:40,width:300,height:200},kE++);const P=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(P,b.group.name),(WE=b.group.members)!=null&&WE.length&&O(P,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(I=>!!I.waypoints),E=new Map,A=(I,L)=>{!I||!L||(E.has(I)||E.set(I,new Set),E.get(I).add(L))};for(const I of b){const L=(UE=I.source)==null?void 0:UE.id,H=(qE=I.target)==null?void 0:qE.id;A(L,H),((YE=I.type)!=null&&YE.includes("DataOutputAssociation")||(KE=I.type)!=null&&KE.includes("DataInputAssociation")||I.type==="bpmn:Association")&&A(H,L)}const P=o.filter(I=>I.type==="bpmn:Group");for(const I of P){const H=(((XE=I.businessObject.extensionElements)==null?void 0:XE.values)??[]).find(Ce=>Ce.$type==="bwl:Members"),F=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const B=new Set(F),V=[...F];for(;V.length;){const Ce=V.shift();for(const Q of E.get(Ce)??[])B.has(Q)||(B.add(Q),V.push(Q))}const Y=I.x,ie=I.x+I.width,J=I.y,fe=I.y+I.height,ue=Ce=>C.filter(Q=>Q.flow.target===Ce).length,me=Ce=>{var re;const Q=((re=p(Ce))==null?void 0:re.type)??"";if(Q==="bpmn:StartEvent"&&ue(Ce)===0)return!1;if(Q.endsWith("Gateway")){const ae=C.filter(ve=>ve.flow.target===Ce).map(ve=>ve.flow.source);if(ae.length&&ae.every(ve=>{var Xe;return((Xe=p(ve))==null?void 0:Xe.type)==="bpmn:StartEvent"&&ue(ve)===0}))return!1}return!0},qe=o.filter(Ce=>$i(Ce)).filter(Ce=>Ce.type!=="bpmn:Group"&&Ce.type!=="bpmn:Participant"&&Ce.type!=="bpmn:TextAnnotation"&&!B.has(Ce.id)&&Bo(Ce.id)&&me(Ce.id)&&Ce.x<ie&&Ce.x+Ce.width>Y&&Ce.y<fe&&Ce.y+Ce.height>J);if(qe.length)for(const Ce of[-1,1]){const Q=qe.filter(ye=>(ye.x+ye.width-Y<=ie-ye.x?-1:1)===Ce);if(!Q.length)continue;const re=[];for(const ye of Q){const oe=re.find(xe=>xe.some(Ne=>ye.y<Ne.y+Ne.height&&ye.y+ye.height>Ne.y));oe?oe.push(ye):re.push([ye])}const ae=new Map;for(const ye of re){let oe=Ce<0?Y-No:ie+No;for(const xe of[...ye].sort((Ne,Ie)=>Ce<0?Ie.x-Ne.x:Ne.x-Ie.x)){const Ne=Ce<0?Math.min(xe.x,oe-xe.width):Math.max(xe.x,oe);oe=Ce<0?Ne-Oi:Ne+xe.width+Oi,Ne!==xe.x&&Math.sign(Ne-xe.x)===Ce&&ae.set(xe.id,Ne-xe.x)}}const ve=new Map,Xe=ye=>ve.get(ye)===ye||!ve.get(ye)?ye:Xe(ve.get(ye));for(const ye of Q)ve.set(ye.id,ye.id);for(const ye of x){const oe=ae.has(ye.flow.source)?ye.flow.source:void 0,xe=ae.has(ye.flow.target)?ye.flow.target:void 0;if(!oe||!xe)continue;const Ne=p(ye.flow.id);((ZE=Ne==null?void 0:Ne.waypoints)==null?void 0:ZE.length)===2&&ve.set(Xe(oe),Xe(xe))}const Ze=new Map;for(const ye of Q){if(!ae.has(ye.id))continue;const oe=Xe(ye.id);Ze.set(oe,[...Ze.get(oe)??[],ye])}const kt=[...Ze.values()].sort((ye,oe)=>Ce<0?Math.min(...ye.map(xe=>xe.x))-Math.min(...oe.map(xe=>xe.x)):Math.max(...oe.map(xe=>xe.x))-Math.max(...ye.map(xe=>xe.x))),$t=[];let be=!0;for(const ye of kt){const oe=ye.map(Ie=>ae.get(Ie.id)??0).reduce((Ie,we)=>Math.abs(we)>Math.abs(Ie)?we:Ie,0),xe=new Map;let Ne=!0;for(const Ie of ye){const we=d(Ie);if(!we){Ne=!1;break}xe.has(we.id)||xe.set(we.id,{subtree:[],pool:we}),xe.get(we.id).subtree.push(Ie)}Ne&&Io([...xe.values()],oe,()=>!0,za)?$t.push({shapes:ye,dx:oe}):be=!1}if(!be)for(const ye of $t.reverse())n.moveElements(ye.shapes,{x:-ye.dx,y:0})}}}{const b=new Set([...S.map(E=>E.group.id),...en(e,"group.update").map(E=>E.id)]);for(const E of o.filter(A=>A.type==="bpmn:Group")){if(b.has(E.id))continue;const P=(((QE=E.businessObject.extensionElements)==null?void 0:QE.values)??[]).find(F=>F.$type==="bwl:Members"),I=((P==null?void 0:P.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!I.length||!I.some(F=>{const B=g.get(F.id);return!B||B.x!==F.x||B.y!==F.y})||!I.some(F=>F.x<E.x||F.y<E.y||F.x+F.width>E.x+E.width||F.y+F.height>E.y+E.height)||n.resizeShape(E,Jh(I,E.id))}}{const E=new Map(mo(We(o)).map(F=>[F.owner,F.rect])),A=o.filter(F=>!!F.waypoints),P=new Map,I=(F,B)=>{!F||!B||(P.has(F)||P.set(F,new Set),P.get(F).add(B))};for(const F of A){const B=(JE=F.source)==null?void 0:JE.id,V=(e1=F.target)==null?void 0:e1.id;I(B,V),((t1=F.type)!=null&&t1.includes("DataOutputAssociation")||(n1=F.type)!=null&&n1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&I(V,B)}const L=F=>C.filter(B=>B.flow.target===F).length,H=F=>{var V;const B=((V=p(F))==null?void 0:V.type)??"";if(B==="bpmn:StartEvent"&&L(F)===0)return!1;if(B.endsWith("Gateway")){const Y=C.filter(ie=>ie.flow.target===F).map(ie=>ie.flow.source);if(Y.length&&Y.every(ie=>{var J;return((J=p(ie))==null?void 0:J.type)==="bpmn:StartEvent"&&L(ie)===0}))return!1}return!0};for(const F of o.filter(B=>B.type==="bpmn:Group")){const V=(((i1=F.businessObject.extensionElements)==null?void 0:i1.values)??[]).find(oe=>oe.$type==="bwl:Members"),Y=((V==null?void 0:V.refs)??"").split(" ").filter(Boolean);if(!Y.length)continue;const ie=Y.map(p).filter(oe=>!!oe);if(!ie.length||!(S.some(oe=>oe.group.id===F.id)||en(e,"group.update").some(oe=>oe.id===F.id)||ie.some(oe=>{const xe=g.get(oe.id);return!xe||xe.x!==oe.x||xe.y!==oe.y})))continue;const fe=new Set(Y),ue=[...Y];for(;ue.length;){const oe=ue.shift();for(const xe of P.get(oe)??[])fe.has(xe)||(fe.add(xe),ue.push(xe))}const me=F.x,qe=F.x+F.width,Ce=F.y,Q=F.y+F.height,re=oe=>{const xe=E.get(oe.id),Ne={x:oe.x,y:oe.y,width:oe.width,height:oe.height};return xe?[Ne,{x:xe.x,y:xe.y,width:xe.width,height:xe.height}]:[Ne]},ae=ie.flatMap(re),ve=Math.min(...ae.map(oe=>oe.x)),Xe=Math.max(...ae.map(oe=>oe.x+oe.width)),Ze=Math.min(...ae.map(oe=>oe.y)),kt=Math.max(...ae.map(oe=>oe.y+oe.height)),$t={L:ve-me,R:qe-Xe,T:Ze-Ce,B:Q-kt},be=o.filter(oe=>$i(oe)).filter(oe=>oe.type!=="bpmn:Group"&&oe.type!=="bpmn:Participant"&&oe.type!=="bpmn:TextAnnotation"&&!fe.has(oe.id)&&H(oe.id)&&oe.x<qe&&oe.x+oe.width>me&&oe.y<Q&&oe.y+oe.height>Ce);if(!be.length)continue;const ye={L:0,R:0,T:0,B:0};for(const oe of be){const xe=re(oe),Ne=Math.min(...xe.map(tt=>tt.x)),Ie=Math.max(...xe.map(tt=>tt.x+tt.width)),we=Math.min(...xe.map(tt=>tt.y)),it=Math.max(...xe.map(tt=>tt.y+tt.height)),lt={L:Ie-me,R:qe-Ne,T:it-Ce,B:Q-we},Jt=["L","R","T","B"].filter(tt=>lt[tt]<=$t[tt]+.001);if(!Jt.length)continue;const si=Jt.reduce((tt,zt)=>lt[zt]<lt[tt]?zt:tt,Jt[0]);ye[si]=Math.max(ye[si],Math.min(lt[si]+10,$t[si]))}!ye.L&&!ye.R&&!ye.T&&!ye.B||n.resizeShape(F,{x:F.x+ye.L,y:F.y+ye.T,width:F.width-ye.L-ye.R,height:F.height-ye.T-ye.B})}}const DE=b=>{const E=b.waypoints;if(E!=null&&E.length){const P=E[Math.floor((E.length-1)/2)];return{x:P.x,y:P.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let ac=0;const LE=12,IE=14,y$=15,v$=300,b$=b=>{const E=b.split(`
|
|
7
|
-
`),A=Math.max(...E.map(L=>Qo(L,LE))),P=Math.max(100,Math.min(v$,Math.ceil(A)+IE)),I=E.reduce((L,H)=>L+Math.max(1,Math.ceil((Qo(H,LE)+IE)/P)),0);return{width:P,height:Math.max(30,I*y$+10)}};for(const b of w){const E=b.association,A=((r1=b.placement)==null?void 0:r1.anchor)??(E?E.source===b.annotation.id?E.target:E.source:void 0),P=A?p(A):void 0,I=P?DE(P):void 0,L=b$(b.annotation.text??"");let H;if(I&&b.placement){const[Y,ie]=Bc[b.placement.side],J=b.placement.offset??50;H={x:I.x+I.width/2+Y*(I.width/2+L.width/2+J),y:I.y+I.height/2+ie*(I.height/2+L.height/2+J)}}else I?(H={x:I.x+I.width/2+180+ac%3*260,y:I.y-110-ac%2*95},ac++):(H={x:300+ac*260,y:60},ac++);const F=P?d(P)??u():u(),B=F;I&&typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant"&&(H=Vp(o,I,L,B,b.placement?{placement:b.placement}:{from:H}));const V=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},H,F);if(E){const Y=ie=>ie===b.annotation.id?V:f(ie);n.connect(Y(E.source),Y(E.target),E.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:E.id})}:{type:"bpmn:Association"})}b.placement&&O(V,"bwl:Placement",N(b.placement))}for(const b of en(e,"association.add")){const E=b.association;n.connect(f(E.source),f(E.target),E.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:E.id})}:{type:"bpmn:Association"})}const BE=()=>new Set(o.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of en(e,"node.update")){let E=f(b.id);if(b.type&&Ic(b.type)!==E.type){const A=E.x+E.width/2,P=E.y+E.height/2,I=BE();E=c.replaceElement(E,{type:Ic(b.type),...b.eventDefinition?{eventDefinitionType:pc[b.eventDefinition]}:{}});const L=BE(),H=[...I].filter(V=>V!==b.id&&!L.has(V));if(H.length)throw new Bg({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:H});const F=Math.round(A-(E.x+E.width/2)),B=Math.round(P-(E.y+E.height/2));if(F!==0||B!==0){n.moveShape(E,{x:F,y:B});for(const V of[...E.incoming??[],...E.outgoing??[]])dt(V)}}if(b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(E,{"bwl:band":b.band});const A=E.y+E.height/2,P=d(E),I=b.lane?f(b.lane):((P==null?void 0:P.children)??[]).find(H=>H.type==="bpmn:Lane"&&A>=H.y&&A<=H.y+H.height);b.band!==void 0&&mt(I==null?void 0:I.id,b.band,P);const L=I?I.y+(b.band===void 0?I.height/2:Math.min(I.height/2,ge)+R(I.id,b.band)*D):b.band!==void 0&&P?P.y+ee+R(`pool:${P.id}`,b.band)*D:void 0;if(L!==void 0){const H=L-A;H!==0&&n.moveElements([E],{x:0,y:H})}}}for(const b of en(e,"sequenceFlow.update")){const E=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=E,P=b.source!==void 0?f(b.source):A.source,I=b.target!==void 0?f(b.target):A.target,L=B=>({x:B.x+B.width/2,y:B.y+B.height/2});n.reconnect(A,P,I,[L(P),L(I)]);const H=bE.get(A.id),F=I.y+I.height/2;if(H&&I.x>H.exit.x&&Math.abs(F-H.exit.y)>1){n.updateWaypoints(A,[H.exit,{x:H.exit.x,y:F},{x:I.x,y:F}]);const B=A.label;if(B&&H.label){const Y=Math.abs(H.label.y+B.height/2-H.channelY)<=D/5&&H.label.x+B.width>H.exit.x,ie=H.exit.x+6,J=I.x-6-B.width,fe=Y?J>=ie?{x:Math.max(ie,Math.min(H.label.x,J)),y:H.label.y+(F-H.channelY)}:void 0:H.label;fe&&(fe.x!==B.x||fe.y!==B.y)&&n.moveElements([B],{x:fe.x-B.x,y:fe.y-B.y})}}else Math.abs(F-(P.y+P.height/2))>1&&dt(A)}b.name!==void 0&&n.updateProperties(E,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(E,{name:((o1=b.condition)==null?void 0:o1.label)??void 0})}for(const b of en(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"annotation.update")){const E=f(b.id);if(b.text!==void 0&&n.updateProperties(E,{text:b.text}),b.placement===null)O(E,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),P=DE(A),I=d(A)??u(),L=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[H,F]=Bc[b.placement.side],B=b.placement.offset??50,V={x:P.x+P.width/2+H*(P.width/2+E.width/2+B),y:P.y+P.height/2+F*(P.height/2+E.height/2+B)},Y=L?Vp(o,P,{width:E.width,height:E.height},I,{placement:b.placement,selfId:b.id}):V;n.moveElements([E],{x:Y.x-(E.x+E.width/2),y:Y.y-(E.y+E.height/2)}),O(E,"bwl:Placement",N(b.placement))}}for(const b of en(e,"group.update")){const E=f(b.id);if(b.name!==void 0&&n.updateLabel(E,b.name??""),b.members){const A=b.members.map(p).filter(P=>!!P);A.length&&n.resizeShape(E,Jh(A,b.id)),O(E,"bwl:Members",{refs:b.members.join(" ")})}}}function Wp(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 rC(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>ht(f).filter(d=>!t.has(pt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=We(i),c=o(s),l=[...new Set(c.flatMap(Wp))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){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 ge=d.x+d.width/2,Pe=d.y+d.height/2;h=i.getAll().find(De=>{if(De.type!=="bpmn:Participant")return!1;const Ue=De;return typeof Ue.x=="number"&&typeof Ue.width=="number"&&ge>=Ue.x&&ge<=Ue.x+Ue.width&&Pe>=Ue.y&&Pe<=Ue.y+Ue.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const C=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ge=>ge.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(ge=>ge.type==="bpmn:Association"),m=(C!=null&&C.anchor?i.get(C.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!m)continue;const v=m.waypoints,w=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},S={width:d.width,height:d.height},k={x:d.x+d.width/2,y:d.y+d.height/2},O=C==null?void 0:C.side,N=[];O&&O in Bc&&N.push(Vp(i,w,S,h,{placement:{side:O,offset:(C==null?void 0:C.offset)??null},selfId:f}));for(const[ge,Pe]of[[-1,0],[1,0],[0,-1],[0,1]])for(let De=1;De<=iC;De++)N.push({x:k.x+ge*Ig*De,y:k.y+Pe*Ig*De});const T={...s,edges:s.edges.filter(ge=>ge.id!==(x==null?void 0:x.id))},D=o(T),j=D.filter(ge=>Wp(ge).includes(f)).length;if(!j)continue;let ee;for(const ge of N){const Pe=ge.x-k.x,De=ge.y-k.y;if(!Pe&&!De||ge.x-S.width/2<h.x||ge.x+S.width/2>h.x+h.width||ge.y-S.height/2<h.y||ge.y+S.height/2>h.y+h.height)continue;const Ue={...T,shapes:T.shapes.map(ne=>ne.id===f?{...ne,x:ne.x+Pe,y:ne.y+De}:ne)},ot=o(Ue),Me=ot.filter(ne=>Wp(ne).includes(f)).length;if(Me>=j||ot.length>D.length)continue;const X=Math.abs(Pe)+Math.abs(De);if((!ee||Me<ee.mine||Me===ee.mine&&(ot.length<ee.all||ot.length===ee.all&&X<ee.dist))&&(ee={x:ge.x,y:ge.y,mine:Me,all:ot.length,dist:X}),ee.mine===0&&ee.all<D.length)break}ee&&r.moveElements([d],{x:ee.x-k.x,y:ee.y-k.y})}}const oC=60;function Up(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function aC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>ht(u).filter(p=>!t.has(pt(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const C of n.shapes)C.type!=="bpmn:Group"||f.has(C.id)||[...d].some(x=>{const m=s.get(x);return m&&c(C,m)})&&(f.add(C.id),y=!0);for(const C of n.shapes)C.type!=="bpmn:Participant"||d.has(C.id)||[...f].some(x=>{const m=s.get(x);return m&&c(m,C)})&&(d.add(C.id),y=!0);if(!y)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(y=>{const C=s.get(y);return C&&c(C,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=We(i),f=o(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[w,S]=v.pools,k=g.get(w),O=g.get(S);if(!k||!O)continue;const[N,T]=k.x<=O.x?[k,O]:[O,k];if(v.contained)continue;const D=s.get(N.id),j=s.get(T.id),ee=D&&j?Math.max(j.x-(D.x+D.width),0):oC,ge=N.x+N.width+ee-T.x;if(ge<=0)continue;const Pe=l(T.id).filter(De=>i.get(De));Pe.length&&(!h||ge>h.dx)&&(h={movers:Pe,dx:ge})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const C=f.length,x=d.length;r.moveElements(y,{x:h.dx,y:0});const m=o(We(i));if(!(a(m).length<x&&m.length<=C)){r.moveElements(y,{x:-h.dx,y:0});return}}}const Nc=.5,$g=150;function sC(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(m=>m.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(m=>m.x+m.width),a=Math.max(...o);if(a-Math.min(...o)>Nc)return;const s=r.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(s.length<2)return;const c=new Map(r.map(m=>[m.id,m.x]));if(s.some(m=>Math.abs(m.x-c.get(m.id))>Nc))return;const l=s.map(m=>m.x+m.width);if(Math.max(...l)-Math.min(...l)<=Nc)return;const u=m=>m.x+m.width,p=m=>!!m&&typeof m.width=="number",f=m=>{const v={shapes:[],edges:[],lanes:[]},w=S=>{for(const k of S.children??[]){if("waypoints"in k&&k.waypoints){v.edges.push(k);continue}k.type!=="label"&&(k.type==="bpmn:Lane"?v.lanes.push(k):v.shapes.push(k),w(k))}};return w(m),v},d=new Map(s.map(m=>[m.id,f(m)]));let g=a;for(const m of s){const{shapes:v}=d.get(m.id),w=v.flatMap(S=>[u(S),...p(S.label)?[u(S.label)]:[]]);w.length&&(g=Math.max(g,Math.max(...w)+$g))}const h=s.filter(m=>Math.abs(u(m)-g)>Nc);if(!h.length)return;for(const m of h){const v=u(m),{shapes:w,edges:S,lanes:k}=d.get(m.id);if([...w.flatMap(T=>[u(T),...p(T.label)?[u(T.label)]:[]]),...S.flatMap(T=>[...T.waypoints.map(D=>D.x),...p(T.label)?[u(T.label)]:[]])].some(T=>T>g)||[...(m.incoming??[]).map(T=>T.waypoints[T.waypoints.length-1]),...(m.outgoing??[]).map(T=>T.waypoints[0])].some(T=>!T||T.x>g||Math.abs(T.x-v)<1))return;if(g>v){const T={x:v,y:m.y,width:g-v,height:m.height},D=new Set([m.id,...w.map(ee=>ee.id),...S.map(ee=>ee.id),...k.map(ee=>ee.id)]);if(n.getAll().some(ee=>{var De;if("waypoints"in ee&&ee.waypoints||ee.type==="bpmn:Group"||!p(ee))return!1;const ge=ee.type==="label"?(De=ee.labelTarget)==null?void 0:De.id:ee.id;if(!ge||D.has(ge)||D.has(ee.id))return!1;const Pe=ee;return Pe.x<T.x+T.width&&Pe.x+Pe.width>T.x&&Pe.y<T.y+T.height&&Pe.y+Pe.height>T.y}))return}}const y=()=>new Set(ht(We(n)).map(pt)),C=y(),x=h.map(m=>m.width);for(const m of h)Up(i,m,g-m.x,{layout:!1});[...y()].every(m=>C.has(m))||h.forEach((m,v)=>Up(i,m,x[v],{layout:!1}))}function cC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>ht(l).filter(u=>!t.has(pt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(S=>S.id!==l.id&&S.type!=="bpmn:Group"&&a(l,S));if(!p.length)continue;const f=p.map(S=>i.get(S.id)).filter(S=>!!S&&typeof S.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),C=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),m={x:h,y,width:C-h,height:x-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=o(We(i)).length,w={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,m),o(We(i)).length>v&&r.resizeShape(u,w)}}const $c=20,Fc=10;function lC(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(ht(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(pt)),s=We(r),c=ht(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(pt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const x=h.members.map(Te=>r.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!x.length)continue;const m=Math.min(...x.map(Te=>Te.x)),v=Math.min(...x.map(Te=>Te.y)),w=Math.max(...x.map(Te=>Te.x+Te.width)),S=Math.max(...x.map(Te=>Te.y+Te.height)),k=h.x,O=h.y,N=h.x+h.width,T=h.y+h.height;let D=k,j=O,ee=N,ge=T;for(const Te of g){const $=s.edges.find(_=>_.id===Te.edge);if(!$)continue;const R=$.endpoints.some(_=>{const G=s.shapes.find(Re=>Re.id===_);if(!G||G.container)return!1;const W=G.x+G.width/2,te=G.y+G.height/2;return k<W&&W<N&&O<te&&te<T});for(const _ of vn($)){const G=_.axis==="v"?[O,T]:[k,N];Math.min(_.hi,G[1])-Math.max(_.lo,G[0])<Pp||(_.axis==="v"?k<_.at&&_.at<N:O<_.at&&_.at<T)&&R||(_.axis==="v"?(Math.abs(_.at-k)<=Jo&&(D=Math.max(D,_.at+$c)),Math.abs(_.at-N)<=Jo&&(ee=Math.min(ee,_.at-$c))):(Math.abs(_.at-O)<=Jo&&(j=Math.max(j,_.at+$c)),Math.abs(_.at-T)<=Jo&&(ge=Math.min(ge,_.at-$c))))}}if(D>m-Fc&&(D=k),j>v-Fc&&(j=O),ee<w+Fc&&(ee=N),ge<S+Fc&&(ge=T),D===k&&j===O&&ee===N&&ge===T)continue;const Pe=r.get(d),De={x:Pe.x,y:Pe.y,width:Pe.width,height:Pe.height},Ue=We(r),ot=new Set(ht(Ue).map(pt)),Me=a(Ue);o.resizeShape(Pe,{x:D,y:j,width:ee-D,height:ge-j});let X=We(r),ne=ht(X).filter(Te=>!ot.has(pt(Te)));const q=[];if(ne.length>0&&ne.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&X.edges.some($=>$.id===Te.edge))){for(const Te of ne){if(Te.kind!=="label-over-line")continue;const $=X.edges.find(te=>te.id===Te.edge),R=$&&Hp($,X),_=(f=r.get(Te.edge))==null?void 0:f.label;if(!R||!_)continue;const G=R.x-_.x,W=R.y-_.y;o.moveElements([_],{x:G,y:W}),q.push({label:_,dx:G,dy:W})}X=We(r),ne=ht(X).filter(Te=>!ot.has(pt(Te)))}const se=a(X),de=[...se].some(Te=>!Me.has(Te));if(ne.length||de||se.size>=Me.size){for(const Te of q.reverse())o.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});o.resizeShape(Pe,De)}}}function uC(e,t,n,i){var c;const r=n.getRootElement().businessObject,o=cp((r==null?void 0:r.$parent)??r),a=Ua(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:lp(u,i,o),requests:dp(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...o?{rootLang:o}:{},before:s.get(l)}]:[]})}}function Fg(e,t,n={}){var N,T;const{i18n:i,lower:r=Ng}=n,o=Dg(e),a=ng(o.elementRegistry),s=Og(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=QR(t,a,i),u=i&&l.writes.size?uC(l.writes,o.elementRegistry,o.canvas,i):void 0,p=We(o.elementRegistry),f=new Set(ht(p).map(pt)),d=new Set(ht(p,{includeObservationOnly:!0}).map(pt)),g=new Set(p.edges.map(D=>D.id)),h=new Set(t.flatMap(D=>D.kind==="sequenceFlow.update"&&(D.source!==void 0||D.target!==void 0)?[D.id]:[])),y=new Set(p.shapes.map(D=>D.id)),C=Ac(p),x=C.length,m=new Set(C.map(([D,j])=>`${D}|${j}`)),v=new Map;for(const D of o.elementRegistry.filter(j=>"waypoints"in j&&!!j.waypoints))D.label&&v.set(D.id,{wps:D.waypoints.map(j=>({x:j.x,y:j.y})),label:{x:D.label.x,y:D.label.y},source:(N=D.source)==null?void 0:N.id,target:(T=D.target)==null?void 0:T.id});const w=e.get("commandStack");try{sm(w,()=>{r(l.ops,o);for(const j of(u==null?void 0:u.contexts())??[])w.execute(pp,j);aC(o,f,p),sC(o,p),cC(o,f,p),lg(o,g);const D=Np(o,f);ag(o,m,g),bg(o,f,g),fg(o,g),HR(o,g,h),mg(o,f,g),WR(o,f,g),Rg(o,f,g),Sg(o,g,h),Mg(o,y),rC(o,f,y),Np(o,f,D),lC(o,d,p,g),Ag(o,f),Eg(o,v)})}catch(D){return{ok:!1,issues:[D instanceof Bg?D.issue:{kind:"lower-failed",message:D instanceof Error?D.message:String(D)}],findings:[],stats:c}}const S=We(o.elementRegistry),k=ht(S,{includeObservationOnly:!0}).filter(D=>!d.has(pt(D))),O=Um(S);return{ok:!0,issues:[],findings:k,stats:{edgeCrossings:{before:x,after:O.pairs.length,pairs:O.pairs,solidPairs:O.solidPairs,dashedPairs:O.dashedPairs,mixedPairs:O.mixedPairs,crossPoolMessages:O.crossPoolMessages}}}}function pC(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function jg(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Hg(e,t){const n=jg(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function zg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function fC(e){return typeof e=="string"&&ip.includes(e)}function Li(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Gg(e,t={}){const n=e.rootElements??[],i=n.find(X=>X.$type==="bpmn:Collaboration"),r=new Map(n.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),o=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],y=[],C=[],x=[],m=new Map,v=new Set,w=new Set,S=X=>{X&&v.add(X)},k=X=>{v.add(X),w.add(X)},O=X=>{const ne=zg(X,"bwl:Placement");if(!ne)return;const q=typeof ne.anchor=="string"?ne.anchor:void 0;if(!q||!fC(ne.side))return;const K=typeof ne.offset=="number"?ne.offset:void 0;y.push({owner:X.id,anchor:q,side:ne.side,...K!==void 0?{offset:K}:{}})},N=X=>{const ne=zg(X,"bwl:Members"),q=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];q.length&&x.push({owner:X.id,refs:q})},T=X=>{var ne;for(const q of X)switch(S(q.id),q.$type){case"bpmn:TextAnnotation":k(q.id),m.set(q.id,q),c.push({id:q.id,text:typeof q.text=="string"?q.text:""}),O(q);break;case"bpmn:Association":g.push({id:q.id,type:q.$type,source:Li(q.sourceRef),target:Li(q.targetRef)});break;case"bpmn:Group":{k(q.id),m.set(q.id,q);const K=(ne=q.categoryValueRef)==null?void 0:ne.value;l.push({id:q.id,...typeof K=="string"&&K?{name:K}:{}}),N(q);break}default:u.push({id:q.id,type:q.$type,reason:"type-outside-mvp"})}},D=X=>{for(const ne of X.flowElements??[])S(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"}),(ne.flowElements??[]).length&&D(ne);for(const ne of X.artifacts??[])S(ne.id),u.push({id:ne.id,type:ne.$type,reason:"inside-container"})},j=(X,ne)=>{const q=X.flowElements??[],K=(X.laneSets??[]).flatMap(de=>de.lanes??[]),se=new Map;for(const de of K){S(de.id),m.set(de.id,de);for(const Te of de.flowNodeRef??[]){const $=Li(Te);$&&se.set($,de.id)}}for(const de of q){if(S(de.id),m.set(de.id,de),de.$type==="bpmn:SequenceFlow"){f.push({id:de.id,source:Li(de.sourceRef),target:Li(de.targetRef),...typeof de.name=="string"&&de.name?{name:de.name}:{}});continue}if(de.$type==="bpmn:DataStoreReference"){k(de.id),s.push({id:de.id,...de.name?{name:de.name}:{}});continue}const Te=pC(de.$type),$=Te==="intermediateCatchEvent"?tp((de.eventDefinitions??[]).map(W=>W.$type)):void 0;if(!tm(Te)||Te==="intermediateCatchEvent"&&!$){u.push({id:de.id,type:de.$type,reason:"type-outside-mvp"});continue}k(de.id);const R=Te==="boundaryEvent"?Li(de.attachedToRef):void 0;a.push({id:de.id,type:Te,...de.name?{name:de.name}:{},...ne?{participant:ne}:{},...se.has(de.id)?{lane:se.get(de.id)}:{},...R?{attachedTo:R}:{},...$?{eventDefinition:$}:{}}),Te==="subProcess"&&D(de);const _=Hg(de,"bwl:band");_!==void 0&&(p.bands[de.id]=_);const G=jg(de,"bwl:afterColumn");typeof G=="string"&&G!==""&&C.push([de.id,G]);for(const W of de.dataOutputAssociations??[])S(W.id),h.push({id:W.id,type:W.$type,source:de.id,target:Li(W.targetRef)});for(const W of de.dataInputAssociations??[])S(W.id),h.push({id:W.id,type:W.$type,source:Li((W.sourceRef??[])[0]),target:de.id})}T(X.artifacts??[])};if(i){const X=new Set;for(const ne of i.participants??[]){k(ne.id),m.set(ne.id,ne);const q=Li(ne.processRef);q&&X.add(q);const K=q?r.get(q):void 0,se=((K==null?void 0:K.laneSets)??[]).flatMap(R=>R.lanes??[]),de=se.map(R=>({id:R.id,...R.name?{name:R.name}:{}}));for(const R of de)k(R.id);const Te=!K||(K.flowElements??[]).length===0&&se.length===0&&(K.artifacts??[]).length===0;o.push({id:ne.id,...ne.name?{name:ne.name}:{},...Te?{blackBox:!0}:{},...de.length?{lanes:de}:{}});const $=Hg(ne,"bwl:poolOrder");$!==void 0&&(p.poolOrders[ne.id]=$),K&&j(K,ne.id)}for(const ne of i.messageFlows??[])S(ne.id),m.set(ne.id,ne),d.push({id:ne.id,source:Li(ne.sourceRef),target:Li(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});T(i.artifacts??[]);for(const[ne,q]of r)!X.has(ne)&&(q.flowElements??[]).length>0&&u.push({id:ne,type:q.$type,reason:"unreachable-process"})}else for(const X of r.values())j(X);const ee=[],ge=[],Pe=[],De=[],Ue=(X,ne)=>!!X&&!!ne&&w.has(X)&&w.has(ne);for(const X of f){if(!Ue(X.source,X.target)){u.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}ee.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),w.add(X.id)}for(const X of d){if(!Ue(X.source,X.target)){u.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}ge.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),w.add(X.id)}for(const X of h){if(!Ue(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}De.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&w.add(X.id)}for(const X of g){if(!Ue(X.source,X.target)){u.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}Pe.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const ot=new Map(l.map(X=>[X.id,X]));for(const{owner:X,refs:ne}of x){const q=ne.filter(se=>v.has(se)),K=ot.get(X);K&&q.length&&(K.members=q)}for(const X of y)v.has(X.anchor)&&(p.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,ne]of C)v.has(ne)&&(p.afterColumns[X]=ne);const Me={...o.length?{participants:o}:{},nodes:a,sequenceFlows:ee,...ge.length?{messageFlows:ge}:{},...s.length?{dataStores:s}:{},...De.length?{dataAssociations:De}:{},...c.length?{annotations:c}:{},...Pe.length?{associations:Pe}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Me,hints:p,omitted:u,i18n:dC(Me,m,e,t.i18n)}:{definition:Me,hints:p,omitted:u}}function dC(e,t,n,i){const r=cp(n),o=Ua(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=lp(u,i,r);Object.keys(p).length&&(c[l]=p);for(const f of dp(u))o.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:o.slice(1),reviewRequests:a}}async function hC(e,t={}){const{definitions:n,warnings:i}=await Xo(e);return{...Gg(n,t),warnings:i}}const mC=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function qp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function gC(e){return qp(e.processRef)!==void 0}function yC(e){const t=new Set,n=r=>{const o=qp(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function vC(e){const t=[],n=i=>{for(const r of i.flowElements??[])mC.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function bC(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Yp(e){const t=[],n=e.rootElements??[],i=yC(e);for(const o of vC(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])gC(s)&&bC(o.get(qp(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function xC(e){const{definitions:t,warnings:n}=await Xo(e);return{issues:Yp(t),warnings:n}}const wC=.5,_C=8,EC=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),oa=e=>typeof e=="number"?e:Number(e??NaN),jc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function SC(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${jc(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${jc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(jc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function RC(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[oa(s.x),oa(s.y),oa(s.width),oa(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=jc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[oa(f.x),oa(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function Vg(e){const t=RC(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!EC.has(s)&&n.set(c,{type:s,props:SC(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function Wg(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function Ug(e,t,n={}){const i=n.moveTolerance??wC,r=Vg(e),o=Vg(t),a=[],s=[],c=[];for(const[l,u]of o){const p=r.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||Wg(p.geometry,u.geometry,i)||Wg(p.label,u.label,n.labelTolerance??_C))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function CC(e,t,n={}){const[i,r]=await Promise.all([Xo(e),Xo(t)]);return{...Ug(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function MC(e){return new Set([...e.added,...e.modified])}function AC(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function qg(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=Fg(e,t.ops,{i18n:i});if(!r.ok)return{status:"rejected",issues:r.issues};const{xml:o}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:o??"",findings:r.findings,stats:r.stats}}const PC=Symbol("bpmn-editor"),Kp={geometry:[],semantic:[]};function TC(){const e=he.ref(!1),t=he.ref(!0),n=he.ref(!1),i=he.shallowRef(Kp),r=he.shallowRef(void 0),o=he.shallowRef(void 0);let a,s,c,l;const u=()=>{if(f(),!c){i.value=Kp;return}const x=ht(We(c.get("elementRegistry")),{includeObservationOnly:!0}),m=c.getDefinitions();i.value={geometry:x,semantic:m?Yp(m):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function f(){const x=p();if(!x||!a){o.value=void 0;return}const m=x.locales(),v={};for(const w of m)v[w]={untranslated:x.untranslatedCount(w),reviewRequested:x.reviewRequestedCount(w)};o.value={designLocale:a.designLocale,locales:m,displayLocale:x.getDisplayLocale()??a.designLocale,counts:v}}function d(){const x=p();x&&(x.configure(a),a&&s&&(s=x.setDisplayLocale(s)))}const g=()=>{e.value=!0,u()};function h(x,m){x.get("canvas").getContainer().style.pointerEvents=m?"":"none";const v=x.get("keyboard");m?(l&&v.bind(l),l=void 0):l||(l=v.getBinding(),v.unbind())}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function C(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:r,i18n:o,configureI18n(x){a=x,d(),f()},setDisplayLocale(x){var v;s=x;const m=(v=p())==null?void 0:v.setDisplayLocale(x);m&&(s=m),f()},setChangeScope(x){r.value=x===void 0?void 0:new Set(x)},requestFocus(x){if(!c)return;const m=c.get("elementRegistry").get(x);m&&(c.get("canvas").scrollToElement(m,180),c.get("selection").select(m))},describeElement(x){const m=c==null?void 0:c.get("elementRegistry").get(x),v=m==null?void 0:m.businessObject;if(!v)return;const w=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof w=="string"&&w.trim()!==""?w.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(x){c&&this.detach(),c=x,c.get("eventBus").on("commandStack.changed",g),t.value||h(c,!1),d(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",g),c&&!t.value&&h(c,!0),l=void 0,c=void 0,i.value=Kp,r.value=void 0,o.value=void 0},setEditable(x){t.value=x,c&&h(c,x)},async applyAgentBatch(x,m){const v=y();n.value=!0;try{const w=await qg(v,x,{currentVersion:m,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return w.status==="applied"&&(e.value=!1),w}finally{n.value=!1}},async importXml(x){const{warnings:m}=await y().importXML(x);return e.value=!1,r.value=void 0,u(),{warnings:Ap(m)}},async saveXml(){const{xml:x}=await y().saveXML({format:!0});return e.value=!1,x??""},undo:()=>{var x;return(x=C())==null?void 0:x.undo()},redo:()=>{var x;return(x=C())==null?void 0:x.redo()},canUndo:()=>{var x;return((x=C())==null?void 0:x.canUndo())??!1},canRedo:()=>{var x;return((x=C())==null?void 0:x.canRedo())??!1}}}const kC=new RegExp("\\p{Script=Hangul}","u"),OC=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,DC=new RegExp("\\p{Script=Han}","u");function Xp(e){const t=kC.test(e),n=OC.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:DC.test(e)?"han":"other"}}function Yg(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function Kg(e){var i;const t=new Set,n=[];for(const r of(e==null?void 0:e.diagrams)??[])for(const o of((i=r==null?void 0:r.plane)==null?void 0:i.planeElement)??[]){const a=o==null?void 0:o.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=uo(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:qo(a).filter(l=>In(l))})}return n}const ts=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function LC(e){const t=Yg(e),n=Kg(e);let i;const r={},o=[],a=[],s=[];for(const g of n){const h=g.trs.filter(y=>(y.body??"")===g.name).map(In);if(h.length){const y=[...h].sort().join("+");r[y]=(r[y]??0)+1,i=i?new Set([...i].filter(C=>h.includes(C))):new Set(h)}else g.trs.some(y=>y.body)?o.push(ts(g)):s.push({e:g,inference:Xp(g.name)});for(const y of g.trs){const C=In(y),x=y.body??"",m=Xp(x);m.locale&&m.locale!==C?a.push({...ts(g),locale:C,script:m.script}):C==="ko"&&m.script==="han"&&g.trs.some(v=>v!==y&&v.body===x)&&a.push({...ts(g),locale:C,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...ts(g),locale:h.locale}):d.push({...ts(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:o,matchedBy:r,scriptMismatch:a}}function IC(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Yg(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const r=new Map(Kg(e).map(o=>[o.bo.id,o]));for(const{id:o,name:a,locale:s}of t.additions){const c=r.get(o);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>In(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Uo,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function BC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zp={exports:{}},Xg;function NC(){if(Xg)return Zp.exports;Xg=1;var e=Zp.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 l=parseInt(a,n);return l!==1/0&&l>=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},Zp.exports}var $C=NC(),FC=BC($C);function Wi(e){if(!(this instanceof Wi))return new Wi(e);e=e||[128,36,1],this._seed=e.length?FC.rack(e[0],e[1],e[2]):e}Wi.prototype.next=function(e){return this._seed(e||!0)},Wi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Wi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Wi.prototype.assigned=function(e){return this._seed.get(e)||!1},Wi.prototype.unclaim=function(e){delete this._seed.hats[e]},Wi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const pn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};pn.td=pn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],pn.option=pn.optgroup=[1,'<select multiple="multiple">',"</select>"],pn.thead=pn.tbody=pn.colgroup=pn.caption=pn.tfoot=[1,"<table>","</table>"],pn.polyline=pn.ellipse=pn.polygon=pn.circle=pn.text=pn.line=pn.path=pn.rect=pn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Bt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(pn,i)?pn[i]:pn._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function jC(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 Hn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(r,o){n[o]=r})}),e}function Nn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const HC=Object.prototype.toString;function Ht(e){return new Tr(e)}function Tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Tr.prototype.add=function(e){return this.list.add(e),this},Tr.prototype.remove=function(e){return HC.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Tr.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},Tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Tr.prototype.array=function(){return Array.from(this.list)},Tr.prototype.has=Tr.prototype.contains=function(e){return this.list.contains(e)};function Hc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function go(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function zC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zc={},Zg;function GC(){if(Zg)return zc;Zg=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return zc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},zc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},zc}var Qg=GC(),VC=zC(Qg),ze=jC({__proto__:null,default:VC},[Qg]),Jg=["focus","blur"];function WC(e,t,n,i,r){return Jg.indexOf(n)!==-1&&(r=!0),ze.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=go(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function UC(e,t,n,i){return Jg.indexOf(t)!==-1&&(i=!0),ze.unbind(e,t,n,i)}var Qn={bind:WC,unbind:UC};function Qp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function Gc(e,t){return t=t||document,t.querySelectorAll(e)}function Ui(e){e.parentNode&&e.parentNode.removeChild(e)}function qC(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function YC(e,t){return t.appendChild(qC(e,t))}function Ge(e,t){return YC(t,e),e}var Jp=2,ey={"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":Jp,"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":Jp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function KC(e,t){return ey[t]?e.style[t]:e.getAttributeNS(null,t)}function ty(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ey[i];r?(r===Jp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function XC(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)ty(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)ty(e,t,n);else return KC(e,t);else XC(e,t);return e}const ZC=Object.prototype.toString;function st(e){return new kr(e)}function kr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}kr.prototype.add=function(e){return this.list.add(e),this},kr.prototype.remove=function(e){return ZC.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},kr.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},kr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},kr.prototype.array=function(){return Array.from(this.list)},kr.prototype.has=kr.prototype.contains=function(e){return this.list.contains(e)};function Vc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ny(e){return e.cloneNode(!0)}var ef={svg:"http://www.w3.org/2000/svg"},iy='<svg xmlns="'+ef.svg+'"';function QC(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(ef.svg)===-1&&(e=iy+e.substring(4)):(e=iy+">"+e+"</svg>",t=!0);var n=JC(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function JC(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=QC(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(ef.svg,e),t&&Se(n,t),n}var tf=null;function ry(){return tf===null&&(tf=Oe("svg")),tf}function oy(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function eM(e,t,n,i,r,o){var a=ry().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return oy(a,e);case 6:return oy(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function ns(e){return ry().createSVGTransform()}var ay=/([&<>]{1})/g,tM=/([&<>\n\r"]{1})/g,nM={"&":"&","<":"<",">":">",'"':"'"};function nf(e,t){function n(i,r){return nM[r]||r}return e.replace(t,n)}function sy(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(nf(e.textContent,ay));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,'="',nf(o.value,tM),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)sy(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",nf(e.nodeValue,ay),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function iM(e){for(var t=e.firstChild,n=[];t;)sy(t,n),t=t.nextSibling;return n.join("")}function cy(e,t){return iM(e)}function fn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function rM(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function oM(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(rM(e,i))}function is(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),oM(n,t)),n.consolidate()}const aM=/^class[ {]/;function sM(e){return aM.test(e.toString())}function rf(e){return Array.isArray(e)}function of(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Wc(...e){e.length===1&&rf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const cM=/constructor\s*[^(]*\(\s*([^)]*)\)/m,lM=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,uM=/\/\*([^*]*)\*\//m;function pM(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(sM(e)?cM:lM);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(uM);return(r&&r[1]||i).trim()})||[]}function ly(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!r[m]&&m.includes(".")){const w=m.split(".");let S=c(w.shift());for(;w.length;)S=S[w.shift()];return S}if(of(o,m))return o[m];if(of(r,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),o[m]=r[m][0](r[m][1]),i.pop(),o[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(rf(m))m=Wc(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const S=(m.$inject||pM(m)).map(k=>of(v,k)?v[k]:c(k));return{fn:m,dependencies:S}}function u(m){const{fn:v,dependencies:w}=l(m),S=Function.prototype.bind.call(v,null,...w);return new S}function p(m,v,w){const{fn:S,dependencies:k}=l(m,w);return S.apply(v,k)}function f(m){return Wc(v=>m.get(v))}function d(m,v){if(v&&v.length){const w=Object.create(null),S=Object.create(null),k=[],O=[],N=[];let T,D,j,ee;for(let ge in r)T=r[ge],v.indexOf(ge)!==-1&&(T[2]==="private"?(D=k.indexOf(T[3]),D===-1?(j=T[3].createChild([],v),ee=f(j),k.push(T[3]),O.push(j),N.push(ee),w[ge]=[ee,ge,"private",j]):w[ge]=[N[D],ge,"private",O[D]]):w[ge]=[T[2],T[1]],S[ge]=!0),(T[2]==="factory"||T[2]==="type")&&T[1].$scope&&v.forEach(Pe=>{T[1].$scope.indexOf(Pe)!==-1&&(w[ge]=[T[2],T[1]],S[Pe]=!0)});v.forEach(ge=>{if(!S[ge])throw new Error('No provider for "'+ge+'". Cannot use provider from the parent!')}),m.unshift(w)}return new ly(m,a)}const g={factory:p,type:u,value:function(m){return m}};function h(m,v){const w=m.__init__||[];return function(){w.forEach(S=>{typeof S=="string"?v.get(S):v.invoke(S)})}}function y(m){const v=m.__exports__;if(v){const w=m.__modules__,S=Object.keys(m).reduce((D,j)=>(j!=="__exports__"&&j!=="__modules__"&&j!=="__init__"&&j!=="__depends__"&&(D[j]=m[j]),D),Object.create(null)),k=(w||[]).concat(S),O=d(k),N=Wc(function(D){return O.get(D)});v.forEach(function(D){r[D]=[N,D,"private",O]});const T=(m.__init__||[]).slice();return T.unshift(function(){O.init()}),m=Object.assign({},m,{__init__:T}),h(m,O)}return Object.keys(m).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const S=m[w];if(S[2]==="private"){r[w]=S;return}const k=S[0],O=S[1];r[w]=[g[k],fM(k,O),k]}),h(m,a)}function C(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(C,m),m.indexOf(v)!==-1)?m:m.concat(v)}function x(m){const v=m.reduce(C,[]).map(y);let w=!1;return function(){w||(w=!0,v.forEach(S=>S()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function fM(e,t){return e!=="value"&&rf(t)&&(t=Wc(t.slice())),t}var dM=1e3;function cr(e,t){var n=this;t=t||dM,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)})}cr.prototype.canRender=function(e){},cr.prototype.drawShape=function(e,t){},cr.prototype.drawConnection=function(e,t){},cr.prototype.getShapePath=function(e){},cr.prototype.getConnectionPath=function(e){};function yo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function hM(e){return["M",e.x,e.y]}function af(e){return["L",e.x,e.y]}function mM(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function gM(e,t){const n=e.length,i=[hM(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(af(a));continue}const c=Math.min(t,sf(a.x-o.x,a.y-o.y),sf(s.x-a.x,s.y-a.y));if(!c){i.push(af(a));continue}const l=Uc(a,o,c),u=Uc(a,o,c*.5),p=Uc(a,s,c),f=Uc(a,s,c*.5);i.push(af(l)),i.push(mM(u,f,p))}return i}function Uc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=sf(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function sf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function rs(e,t,n){He(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return He(n)&&(i.dataset.cornerRadius=String(n)),cf(i,e)}function cf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:yo(gM(t,n))}),e}function qc(e){var t=new Set(e);return nt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function vo(e,t,n){n=n||0,$e(e)||(e=[e]),z(e,function(i,r){var o=t(i,r,n);$e(o)&&o.length&&vo(o,t,n+1)})}function lf(e,t,n){var i=new Set,r=new Set;return vo(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 os(e,t){return lf(e)}function yM(e,t,n){co(t)&&(t=!0),gn(t)&&(n=t,t=!0),n=n||{};var i=as(n.allShapes),r=as(n.allConnections),o=as(n.enclosedElements),a=as(n.enclosedConnections),s=as(n.topLevel,t&&Vo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,z(u.incoming,c),z(u.outgoing,c),u.children}return vo(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function rn(e,t){t=!!t,$e(e)||(e=[e]);var n,i,r,o;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=rn(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>r||r===void 0)&&(r=c+p),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function aa(e,t){var n={};return z(e,function(i){var r=i;r.waypoints&&(r=rn(r)),!He(t.y)&&r.x>t.x&&(n[i.id]=i),!He(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(He(t.width)&&He(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!He(t.width)||!He(t.height))&&(n[i.id]=i)}),n}function uy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function py(e){return!!(e&&e.isFrame)}function as(e,t){return U({},e||{},t||{})}var vM=1;function Or(e,t){cr.call(this,e,vM),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})}Ee(Or,cr),Or.prototype.canRender=function(){return!0},Or.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),py(n)?Se(r,U({},this.FRAME_STYLE,i||{})):Se(r,U({},this.SHAPE_STYLE,i||{})),Ge(t,r),r},Or.prototype.drawConnection=function(t,n,i){var r=rs(n.waypoints,U({},this.CONNECTION_STYLE,i||{}));return Ge(t,r),r},Or.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 yo(a)},Or.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 yo(o)},Or.$inject=["eventBus","styles"];function bM(){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 U(o,{class:n})},this.style=function(n,i){!$e(n)&&!i&&(i=n,n=[]);var r=Zn(n,function(o,a){return U(o,e[a]||{})},{});return i?U(r,i):r},this.computeStyle=function(n,i,r){return $e(i)||(r=i,i=[]),t.style(i||[],U({},r,n||{}))}}const xM={__init__:["defaultRenderer"],defaultRenderer:["type",Or],styles:["type",bM]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function tn(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 uf(e,t){return!e||!t?-1:e.indexOf(t)}function ss(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pf(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=ss(e,t);return Math.abs(r/o)<=i}var wM=2;function lr(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(_M(r,n))return o;return!1}function _M(e,t){const n=t[0];return lo(t,function(i){return Math.abs(n[e]-i[e])<=wM})}function fy(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 ff(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var EM=/,?([a-z]),?/gi,dy=parseFloat,on=Math,Dr=on.PI,qi=on.min,Yi=on.max,hy=on.pow,Lr=on.abs,SM=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,RM=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,my=Array.isArray||function(e){return e instanceof Array};function CM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function MM(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 AM(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 CM(r,i)?(MM(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function PM(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(SM,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(RM,function(c,l){l&&a.push(+l)}),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=hf,n}function TM(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 kM(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 df(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 hf(){return this.join(",").replace(EM,"$1")}function OM(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=hf,t}function gy(e,t,n,i,r,o,a,s,c){var l=1-c,u=hy(l,3),p=hy(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*r+d*a,h=u*t+p*3*c*i+l*3*c*c*o+d*s;return{x:Yc(g),y:Yc(h)}}function yy(e){var t=$M(...e);return df(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Ir(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function DM(e,t){return e=df(e),t=df(t),Ir(t,e.x,e.y)||Ir(t,e.x2,e.y)||Ir(t,e.x,e.y2)||Ir(t,e.x2,e.y2)||Ir(e,t.x,t.y)||Ir(e,t.x2,t.y)||Ir(e,t.x,t.y2)||Ir(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 vy(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 by(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=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<u;g++){var h=l*p[g]+l,y=vy(h,e,n,r,a),C=vy(h,t,i,o,s),x=y*y+C*C;d+=f[g]*on.sqrt(x)}return l*d}function LM(e,t,n,i,r,o,a,s){if(!(Yi(e,n)<qi(r,a)||qi(e,n)>Yi(r,a)||Yi(t,i)<qi(o,s)||qi(t,i)>Yi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var p=Yc(c/u),f=Yc(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+qi(e,n).toFixed(2)||d>+Yi(e,n).toFixed(2)||d<+qi(r,a).toFixed(2)||d>+Yi(r,a).toFixed(2)||g<+qi(t,i).toFixed(2)||g>+Yi(t,i).toFixed(2)||g<+qi(o,s).toFixed(2)||g>+Yi(o,s).toFixed(2)))return{x:p,y:f}}}}function Yc(e){return Math.round(e*1e11)/1e11}function IM(e,t,n){var i=yy(e),r=yy(t);if(!DM(i,r))return[];var o=by(...e),a=by(...t),s=wy(e)?1:~~(o/5)||1,c=wy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=gy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=gy(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],C=l[d+1],x=u[g],m=u[g+1],v=Lr(C.x-y.x)<.01?"y":"x",w=Lr(m.x-x.x)<.01?"y":"x",S=LM(y.x,y.y,C.x,C.y,x.x,x.y,m.x,m.y),k;if(S){if(k=S.x.toFixed(9)+"#"+S.y.toFixed(9),p[k])continue;p[k]=!0;var O=y.t+Lr((S[v]-y[v])/(C[v]-y[v]))*(C.t-y.t),N=x.t+Lr((S[w]-x[w])/(m[w]-x[w]))*(m.t-x.t);O>=0&&O<=1&&N>=0&&N<=1&&f.push({x:S.x,y:S.y,t1:O,t2:N})}}return f}function xy(e,t,n){e=Sy(e),t=Sy(t);for(var i,r,o,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(p=[i,r,...y.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var C=0,x=t.length;C<x;C++){var m=t[C];if(m[0]=="M")o=l=m[1],a=u=m[2];else{m[0]=="C"?(f=[o,a,...m.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,l,u,l,u],o=l,a=u);var v=IM(p,f);{for(var w=0,S=v.length;w<S;w++)v[w].segment1=g,v[w].segment2=C,v[w].bez1=p,v[w].bez2=f;d=d.concat(v)}}}}}return d}function BM(e){return my(e)&&my(e[0])}function NM(e){if(TM(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,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[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=hf,t}function wy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Kc(e,t,n,i){return[e,t,n,i,n,i]}function _y(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 Ey(e,t,n,i,r,o,a,s,c,l){var u=Dr*120/180,p=Dr/180*(+r||0),f=[],d,g=AM(function($,R,_){var G=$*on.cos(_)-R*on.sin(_),W=$*on.sin(_)+R*on.cos(_);return{x:G,y:W}});if(l)k=l[0],O=l[1],w=l[2],S=l[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,y=(t-c)/2,C=h*h/(n*n)+y*y/(i*i);C>1&&(C=on.sqrt(C),n=C*n,i=C*i);var x=n*n,m=i*i,v=(o==a?-1:1)*on.sqrt(Lr((x*m-x*y*y-m*h*h)/(x*y*y+m*h*h))),w=v*n*y/i+(e+s)/2,S=v*-i*h/n+(t+c)/2,k=on.asin(((t-S)/i).toFixed(9)),O=on.asin(((c-S)/i).toFixed(9));k=e<w?Dr-k:k,O=s<w?Dr-O:O,k<0&&(k=Dr*2+k),O<0&&(O=Dr*2+O),a&&k>O&&(k=k-Dr*2),!a&&O>k&&(O=O-Dr*2)}var N=O-k;if(Lr(N)>u){var T=O,D=s,j=c;O=k+u*(a&&O>k?1:-1),s=w+n*on.cos(O),c=S+i*on.sin(O),f=Ey(s,c,n,i,r,0,a,D,j,[O,T,w,S])}N=O-k;var ee=on.cos(k),ge=on.sin(k),Pe=on.cos(O),De=on.sin(O),Ue=on.tan(N/4),ot=4/3*n*Ue,Me=4/3*i*Ue,X=[e,t],ne=[e+ot*ge,t-Me*ee],q=[s+ot*De,c-Me*Pe],K=[s,c];if(ne[0]=2*X[0]-ne[0],ne[1]=2*X[1]-ne[1],l)return[ne,q,K].concat(f);f=[ne,q,K].concat(f).join().split(",");for(var se=[],de=0,Te=f.length;de<Te;de++)se[de]=de%2?g(f[de-1],f[de],p).y:g(f[de],f[de+1],p).x;return se}function $M(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,y,C,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,f=3*i-3*t),Lr(u)<1e-12){if(Lr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*u,C=on.sqrt(y),!(y<0)&&(g=(-p+C)/(2*u),0<g&&g<1&&c.push(g),h=(-p-C)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,w;m--;)d=c[m],w=1-d,l[0][m]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,l[1][m]=w*w*w*t+3*w*w*d*i+3*w*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:qi(...l[0]),y0:qi(...l[1]),x1:Yi(...l[0]),y1:Yi(...l[1])}}function Sy(e){if(BM(e)||(e=PM(e)),kM(e))return e;for(var t=OM(NM(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,y;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",...Ey(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),f=["C",h,y,...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",..._y(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",..._y(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Kc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Kc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Kc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Kc(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),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;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 u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=dy(u[p-4])||n.x,n.by=dy(u[p-3])||n.y}return t}function Mt(e){return gn(e)&&Xn(e,"waypoints")}function Qe(e){return gn(e)&&Xn(e,"labelTarget")}function FM(e){return gn(e)&&zo(e.parent)}function Ry(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ur(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Xc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function jM(e){return ur({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function HM(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=VM(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.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 Fe(e){return Mt(e)?HM(e):jM(e)}function Tn(e,t,n){n=n||0,gn(n)||(n={x:n,y:n});var i=Be(e),r=Be(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,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function cs(e,t,n){var i=zM(e,t);return i.length===1||i.length===2&&ss(i[0],i[1])<1?ur(i[0]):i.length>1?(i=ji(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ur(i[n?0:i.length-1])):null}function zM(e,t){return xy(e,t)}function GM(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ss(n,r)===0||pf(i,r,n)?e.splice(t,1):t++;return e}function VM(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zc(e,t){return Math.round(e*t)/t}function Cy(e){return He(e)?e+"px":e}function WM(e){for(;e.parent;)e=e.parent;return e}function UM(e){e=U({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Hn(n,{position:"relative",overflow:"hidden",width:Cy(e.width),height:Cy(e.height)}),t.appendChild(n),n}function My(e,t,n){const i=Oe("g");st(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const qM="base",Ay=0,YM=1,KM={shape:["x","y","width","height"],connection:["waypoints"]};function je(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||{})}je.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],je.prototype._init=function(e){const t=this._eventBus,n=this._container=UM(e),i=this._svg=Oe("svg");Se(i,{width:"100%",height:"100%"}),Nn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Ge(n,i);const r=this._viewport=My(i,"viewport");e.deferUpdate&&(this._viewboxChanged=sp(this._viewboxChanged,300)),this._restoreFocus=sp(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)},je.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},je.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},je.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=uy(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},je.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},je.prototype.restoreFocus=function(){this._restoreFocus()},je.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},je.prototype.isFocused=function(){return this._focused},je.prototype.getDefaultLayer=function(){return this.getLayer(qM,Ay)},je.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},je.prototype._getChildIndex=function(e){return Zn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},je.prototype._createLayer=function(e,t){typeof t>"u"&&(t=YM);const n=this._getChildIndex(t);return{group:My(this._viewport,"layer-"+e,n),index:t,visible:!0}},je.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},je.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&&(fn(n),t.visible=!1),n},je.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],fn(t.group))},je.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},je.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(WM(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},je.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},je.prototype._findPlaneForRoot=function(e){return Tt(this._planes,function(t){return t.rootElement===e})},je.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},je.prototype._resolveElements=function(e){return $e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},je.prototype.getContainer=function(){return this._container},je.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&&(z([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),st(r).add(t)):(e.markers.delete(t),st(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},je.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},je.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},je.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},je.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},je.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},je.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,Ay);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},je.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},je.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},je.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)},je.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})},je.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})},je.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=KM[e];if(!lo(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},je.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},je.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},je.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},je.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},je.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),Zt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},je.prototype.removeShape=function(e){return this._removeElement(e,"shape")},je.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},je.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},je.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},je.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},je.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,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);is(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=is(t),r=a?a.matrix:eM(),s=Zc(r.a,1e3),c=Zc(-r.e||0,1e3),l=Zc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/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},je.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=U({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Py(t,n)}),{x:n.e,y:n.f}},je.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=rn(o),s=Be(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Be(c);if(!(a.width<c.width&&a.height<c.height))u=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),y=Math.max(0,s.bottom-f.bottom),C=Math.min(0,s.top-f.top);u=g||h,p=y||C}this.scroll({dx:-u*l,dy:-p*l})},je.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)}),Zc(i.a,1e3)};function Py(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}je.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},je.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=U(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),Py(this._viewport,u),u},je.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},je.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}},je.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var sa="data-element-id";function di(e){this._elements={},this._eventBus=e}di.$inject=["eventBus"],di.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,sa,i),n&&Se(n,sa,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},di.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,sa,""),i.secondaryGfx&&Se(i.secondaryGfx,sa,""),delete t[n])},di.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)},di.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,sa,i),t},di.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,sa);var n=this._elements[t];return n&&n.element},di.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},di.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}},di.prototype.getAll=function(){return this.filter(function(e){return e})},di.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)})},di.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},di.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 XM(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 ZM(e){return e.__refs_collection===!0}function QM(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Ty(e,t,n){var i=XM(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 JM(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 bi(e,t){if(!(this instanceof bi))return new bi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}bi.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?Ty(this,t,e):JM(this,t,e)},bi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return ZM(n)||Ty(this,t,e),n},bi.prototype.ensureBound=function(e,t){QM(e,t)||this.bind(e,t)},bi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},bi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var mf=new bi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),ky=new bi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Oy=new bi({name:"attachers",collection:!0},{name:"host"}),Dy=new bi({name:"outgoing",collection:!0},{name:"source"}),Ly=new bi({name:"incoming",collection:!0},{name:"target"});function ca(){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)}}),mf.bind(this,"parent"),ky.bind(this,"labels"),Dy.bind(this,"outgoing"),Ly.bind(this,"incoming")}function ls(){ca.call(this),mf.bind(this,"children"),Oy.bind(this,"host"),Oy.bind(this,"attachers")}Ee(ls,ca);function Iy(){ca.call(this),mf.bind(this,"children")}Ee(Iy,ls);function By(){ls.call(this),ky.bind(this,"labelTarget")}Ee(By,ls);function Ny(){ca.call(this),Dy.bind(this,"source"),Ly.bind(this,"target")}Ee(Ny,ca);var eA={connection:Ny,shape:ls,label:By,root:Iy};function tA(e,t){var n=eA[e];if(!n)throw new Error("unknown type: <"+e+">");return U(new n,t)}function nA(e){return e instanceof ca}function pr(){this._uid=12}pr.prototype.createRoot=function(e){return this.create("root",e)},pr.prototype.createLabel=function(e){return this.create("label",e)},pr.prototype.createShape=function(e){return this.create("shape",e)},pr.prototype.createConnection=function(e){return this.create("connection",e)},pr.prototype.create=function(e,t){return t=U({},t||{}),t.id||(t.id=e+"_"+this._uid++),tA(e,t)};var Qc="__fn",$y=1e3,iA=Array.prototype.slice;function Jn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Jn.prototype.on=function(e,t,n,i){if(e=$e(e)?e:[e],yn(t)&&(i=n,n=t,t=$y),!He(t))throw new Error("priority must be a number");var r=n;i&&(r=Un(n,i),r[Qc]=n[Qc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Jn.prototype.once=function(e,t,n,i){var r=this;if(yn(t)&&(i=n,n=t,t=$y),!He(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[Qc]=n,this.on(e,t,o)},Jn.prototype.off=function(e,t){e=$e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Jn.prototype.createEvent=function(e){var t=new us;return t.init(e),t},Jn.prototype.fire=function(e,t){var n,i,r,o;if(o=iA.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 us?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}},Jn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Jn.prototype._destroy=function(){this._listeners={}},Jn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Jn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=rA(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},Jn.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},Jn.prototype._getListeners=function(e){return this._listeners[e]},Jn.prototype._setListeners=function(e,t){this._listeners[e]=t},Jn.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[Qc]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function us(){}us.prototype.stopPropagation=function(){this.cancelBubble=!0},us.prototype.preventDefault=function(){this.defaultPrevented=!0},us.prototype.init=function(e){U(this,e||{})};function rA(e,t){return e.apply(null,t)}function bo(e){return e.childNodes[0]}function oA(e){return e.parentNode.childNodes[1]}function Jc(e,t,n,i,r){var o=ns();o.setTranslate(t,n);var a=ns();a.setRotate(i||0,0,0);var s=ns();s.setScale(1,1),is(e,[o,a,s])}function kn(e,t,n){var i=ns();i.setTranslate(t,n),is(e,i)}function Fy(e,t){var n=ns();n.setRotate(t,0,0),is(e,n)}function hi(e,t){this._eventBus=e,this._elementRegistry=t}hi.$inject=["eventBus","elementRegistry"],hi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=oA(t),n||(n=Oe("g"),st(n).add("djs-children"),Ge(t.parentNode,n))):n=t,n},hi.prototype._clear=function(e){var t=bo(e);return Hc(t),t},hi.prototype._createContainer=function(e,t,n,i){var r=Oe("g");st(r).add("djs-group"),typeof n<"u"?aA(r,t,t.childNodes[n]):Ge(t,r);var o=Oe("g");st(o).add("djs-element"),st(o).add("djs-"+e),i&&st(o).add("djs-frame"),Ge(r,o);var a=Oe("g");return st(a).add("djs-visual"),Ge(o,a),o},hi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,py(t))},hi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Zn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),z(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;z(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},hi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},hi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},hi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},hi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},hi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),kn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},hi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);fn(t.parentNode)};function aA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const sA={__depends__:[xM],__init__:["canvas"],canvas:["type",je],elementRegistry:["type",di],elementFactory:["type",pr],eventBus:["type",Jn],graphicsFactory:["type",hi]};function cA(e){var t=new ly(e);return t.init(),t}function lA(e){e=e||{};var t={config:["value",e]},n=[t,sA].concat(e.modules||[]);return cA(n)}function Br(e,t){this._injector=t||lA(e),this.get("eventBus").fire("diagram.init")}Br.prototype.get=function(e,t){return this._injector.get(e,t)},Br.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Br.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Br.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function $n(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function qn(e,t){return e.$instanceOf(t)}function uA(e){return Tt(e.rootElements,function(t){return qn(t,"bpmn:Process")||qn(t,"bpmn:Collaboration")})}function pA(e){var t={},n=[],i={};function r(q,K){return function(se){q(se,K)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,K){var se=q.gfx;if(se)throw new Error(`already rendered ${$n(q)}`);return e.element(q,i[q.id],K)}function c(q,K){return e.root(q,i[q.id],K)}function l(q,K){try{var se=i[q.id]&&s(q,K);return o(q),se}catch(de){u(de.message,{element:q,error:de}),console.error(`failed to import ${$n(q)}`,de)}}function u(q,K){e.error(q,K)}var p=this.registerDi=function(K){var se=K.bpmnElement;se?i[se.id]?u(`multiple DI elements defined for ${$n(se)}`,{element:se}):i[se.id]=K:u(`no bpmnElement referenced in ${$n(K)}`,{element:K})};function f(q){d(q.plane)}function d(q){p(q),z(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(K,se){var de=K.diagrams;if(se&&de.indexOf(se)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!se&&de&&de.length&&(se=de[0]),!se)throw new Error("no diagram to display");i={},f(se);var Te=se.plane;if(!Te)throw new Error(`no plane for ${$n(se)}`);var $=Te.bpmnElement;if(!$)if($=uA(K),$)u(`correcting missing bpmnElement on ${$n(Te)} to ${$n($)}`),Te.bpmnElement=$,p(Te);else throw new Error("no process or collaboration to display");var R=c($,Te);if(qn($,"bpmn:Process")||qn($,"bpmn:SubProcess"))y($,R);else if(qn($,"bpmn:Collaboration"))X($,R),C(K.rootElements,R);else throw new Error(`unsupported bpmnElement for ${$n(Te)}: ${$n($)}`);h(n)};var h=this.handleDeferred=function(){for(var K;n.length;)K=n.shift(),K()};function y(q,K){Ue(q,K),N(q.ioSpecification,K),O(q.artifacts,K),o(q)}function C(q,K){var se=nt(q,function(de){return!a(de)&&qn(de,"bpmn:Process")&&de.laneSets});se.forEach(r(y,K))}function x(q,K){l(q,K)}function m(q,K){z(q,r(x,K))}function v(q,K){l(q,K)}function w(q,K){l(q,K)}function S(q,K){l(q,K)}function k(q,K){l(q,K)}function O(q,K){z(q,function(se){qn(se,"bpmn:Association")?n.push(function(){k(se,K)}):k(se,K)})}function N(q,K){q&&(z(q.dataInputs,r(w,K)),z(q.dataOutputs,r(S,K)))}var T=this.handleSubProcess=function(K,se){Ue(K,se),O(K.artifacts,se)};function D(q,K){var se=l(q,K);qn(q,"bpmn:SubProcess")&&T(q,se||K),qn(q,"bpmn:Activity")&&N(q.ioSpecification,K),n.push(function(){z(q.dataInputAssociations,r(v,K)),z(q.dataOutputAssociations,r(v,K))})}function j(q,K){l(q,K)}function ee(q,K){l(q,K)}function ge(q,K){n.push(function(){var se=l(q,K);q.childLaneSet&&Pe(q.childLaneSet,se||K),ne(q)})}function Pe(q,K){z(q.lanes,r(ge,K))}function De(q,K){z(q,r(Pe,K))}function Ue(q,K){ot(q.flowElements,K),q.laneSets&&De(q.laneSets,K)}function ot(q,K){z(q,function(se){qn(se,"bpmn:SequenceFlow")?n.push(function(){j(se,K)}):qn(se,"bpmn:BoundaryEvent")?n.unshift(function(){D(se,K)}):qn(se,"bpmn:FlowNode")?D(se,K):qn(se,"bpmn:DataObject")||(qn(se,"bpmn:DataStoreReference")||qn(se,"bpmn:DataObjectReference")?ee(se,K):u(`unrecognized flowElement ${$n(se)} in context ${$n(K&&K.businessObject)}`,{element:se,context:K}))})}function Me(q,K){var se=l(q,K),de=q.processRef;de&&y(de,se||K)}function X(q,K){z(q.participants,r(Me,K)),n.push(function(){m(q.messageFlows,K)}),O(q.artifacts,K)}function ne(q){z(q.flowNodeRef,function(K){var se=K.get("lanes");se&&se.push(q)})}}function fA(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,C){return i.add(h,y,C)},error:function(h,y){s.push({message:h,context:y})}},f=new pA(p);u=u||l.diagrams&&l.diagrams[0];var d=dA(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(l,u){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}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function dA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=hA(n));var r;M(i,"bpmn:Collaboration")?r=i:r=Tt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Tt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Ln(r.participants,function(l){return l.processRef}),o.push(r));var a=jy(o),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function jy(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(jy(n.flowElements)))}),t}function hA(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var mA='<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>',Hy=mA,zy={verticalAlign:"middle"},Gy={color:"#404040"},gA={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},yA={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},vA={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"},bA='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Hy+'</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>',Ki;function xA(){Ki=Bt(bA),Hn(Ki,gA),Hn(Rt("svg",Ki),zy),Hn(Rt(".backdrop",Ki),yA),Hn(Rt(".notice",Ki),vA),Hn(Rt(".link",Ki),Gy,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function wA(){Ki||(xA(),Qn.bind(Ki,".backdrop","click",function(e){document.body.removeChild(Ki)})),document.body.appendChild(Ki)}const el=5,Vy="djs-outline-hidden";function Gt(e){e=U({},EA,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),RA(this._container)}Ee(Gt,Br),Gt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,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||[]),tl(s,o),s=_A(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw tl(o,[]),o}if(typeof t=="string"&&(i=SA(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw tl(o,[]),o}try{this.clear()}catch(o){throw tl(o,[]),o}const{warnings:r}=await fA(this,n,i);return{warnings:r}},Gt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Rt(":scope > defs",i._svg),a=cy(r),s=o?"<defs>"+cy(o)+"</defs>":"",c=i.getContainer();Ht(c).add(Vy);let l;try{l=r.getBBox()}finally{Ht(c).remove(Vy)}const u=l.x-el,p=l.y-el,f=l.width+el*2,d=l.height+el*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
1
|
+
(function(Q,ge){typeof exports=="object"&&typeof module<"u"?ge(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ge):(Q=typeof globalThis<"u"?globalThis:Q||self,ge(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,ge){"use strict";var E$=Object.defineProperty;var S$=(Q,ge,so)=>ge in Q?E$(Q,ge,{enumerable:!0,configurable:!0,writable:!0,value:so}):Q[ge]=so;var gi=(Q,ge,so)=>S$(Q,typeof ge!="symbol"?ge+"":ge,so);const so=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],lc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function nm(e){return so.includes(e)}function im(e){return lc.includes(e)}const uc=["timer"],pc={timer:"bpmn:TimerEventDefinition"};function rm(e){return typeof e=="string"&&uc.includes(e)}function ip(e){if(e.length===1)return uc.find(t=>pc[t]===e[0])}const fc=["ko","en","ja","zh"];function c1(e){return typeof e=="string"&&fc.includes(e)}const om="http://g1project.net/spec/bpmn/bwl/1.0",rp="bwl",op=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],dc="bwl:ReviewRequest",am={name:"bwl-hints",uri:om,prefix:rp,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]},{name:"ReviewRequest",superClass:["Element"],properties:[{name:"locale",isAttr:!0,type:"String"},{name:"sourceLocale",isAttr:!0,type:"String"},{name:"previous",isBody:!0,type:"String"}]}]},ap="bwl.undoEpisode",sm=new WeakSet;function l1(e){sm.has(e)||(e.register(ap,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),sm.add(e))}function cm(e,t){l1(e);const n={run:t};if(e.execute(ap,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function sp(e){return Array.prototype.concat.apply([],e)}const Wa=Object.prototype.toString,u1=Object.prototype.hasOwnProperty;function co(e){return e===void 0}function un(e){return e!==void 0}function zo(e){return e==null}function Ne(e){return Wa.call(e)==="[object Array]"}function gn(e){return Wa.call(e)==="[object Object]"}function ze(e){return Wa.call(e)==="[object Number]"}function yn(e){const t=Wa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Kn(e){return Wa.call(e)==="[object String]"}function p1(e){if(!Ne(e))throw new Error("must supply array")}function Xn(e,t){return!zo(e)&&u1.call(e,t)}function Tt(e,t){const n=mc(t);let i;return H(e,function(r,o){if(n(r,o))return i=r,!1}),i}function lm(e,t){const n=mc(t);let i=Ne(e)?-1:void 0;return H(e,function(r,o){if(n(r,o))return i=o,!1}),i}function it(e,t){const n=mc(t);let i=[];return H(e,function(r,o){n(r,o)&&i.push(r)}),i}function H(e,t){let n,i;if(co(e))return;const r=Ne(e)?g1:m1;for(let o in e)if(Xn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function f1(e,t){if(co(e))return[];p1(e);const n=mc(t);return e.filter(function(i,r){return!n(i,r)})}function Zn(e,t,n){return H(e,function(i,r){n=t(n,i,r)}),n}function lo(e,t){return!!Zn(e,function(n,i,r){return n&&t(i,r)},!0)}function Rr(e,t){return!!Tt(e,t)}function Ln(e,t){let n=[];return H(e,function(i,r){n.push(t(i,r))}),n}function hc(e){return e&&Object.keys(e)||[]}function d1(e){return hc(e).length}function Go(e){return Ln(e,t=>t)}function Vo(e,t,n={}){return t=cp(t),H(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function um(e,...t){e=cp(e);let n={};return H(t,r=>Vo(r,e,n)),Ln(n,function(r,o){return r[0]})}const h1=um;function ji(e,t){t=cp(t);let n=[];return H(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)}),Ln(n,i=>i.v)}function Wo(e){return function(t){return lo(e,function(n,i){return t[i]===n})}}function cp(e){return yn(e)?e:t=>t[e]}function mc(e){return yn(e)?e:t=>t===e}function m1(e){return e}function g1(e){return Number(e)}function lp(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 l(){n&&a(!0),c()}function u(...p){o=Date.now(),i=p,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Un(e,t){return e.bind(t)}function q(e,...t){return Object.assign(e,...t)}function y1(e,t,n){let i=e;return H(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];un(a)&&zo(s)&&(s=i[r]=isNaN(+a)?{}:[]),co(a)?co(n)?delete i[r]:i[r]=n:i=s}),e}function Di(e,t){let n={},i=Object(e);return H(t,function(r){r in i&&(n[r]=e[r])}),n}function Hi(e,t){let n={},i=Object(e);return H(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function M(e,t){var n=de(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return Rr(t,function(n){return M(e,n)})}function de(e){return e&&e.businessObject||e}function ut(e){return e&&e.di}const v1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",pm="i18n",Uo="i18n:Translation";function uo(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function qo(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,Uo)})}function In(e){return e.get("xml:lang")}function Cr(e){var t;return(((t=e==null?void 0:e.extensionElements)==null?void 0:t.values)??[]).filter(n=>{var i;return(i=n==null?void 0:n.$instanceOf)==null?void 0:i.call(n,dc)})}function Ua(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,r,o)=>i!==t&&o.indexOf(i)===r)]}function up(e){var n,i;const t=((n=e==null?void 0:e.get)==null?void 0:n.call(e,"xml:lang"))??((i=e==null?void 0:e.$attrs)==null?void 0:i["xml:lang"]);return typeof t=="string"&&t?t:void 0}function pp(e,t,n){const i=uo(e);if(!i)return{};const r=i.target[i.key]??"",o=qo(e).filter(u=>In(u)),a=u=>u.body??"",s=r?o.filter(u=>a(u)===r).map(In):[],c=r?s.length?s:[n??t.designLocale]:[],l={};for(const u of Ua(t)){if(c.includes(u)){l[u]=r;continue}const p=o.find(f=>In(f)===u&&a(f));p&&(l[u]=a(p))}return l}const gc="bwl.updateTranslation";class fp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:r,locales:o,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=uo(c),u=[];t.undo=u;const p=qo(c).filter($=>In($)),f=s??(l?l.target[l.key]??"":""),d=a??r,h=($=>{if(!$)return[];const N=p.filter(L=>L.body===$).map(In);return N.length?N:[d]})(f),y=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,C=$=>{var N;return((N=p.find(L=>In(L)===$&&L.body))==null?void 0:N.body)??(h.includes($)?f:"")},x=$=>Cr(c).some(N=>N.locale===$),m=C(y);if(m===i)return[];const v=!!m&&!x(y),w=v?o.filter($=>$!==y&&C($)&&!x($)):[],E=()=>{let $=c.extensionElements;return $||($=this.moddle.create("bpmn:ExtensionElements",{values:[]}),$.$parent=c,c.extensionElements=$,u.push(()=>delete c.extensionElements)),$.get("values")},P=($,N)=>{const L=E();let z=L.find(X=>{var oe;return((oe=X.$instanceOf)==null?void 0:oe.call(X,Uo))&&In(X)===$});if(z){const X=z.body;z.body=N,u.push(()=>z.body=X)}else z=this.moddle.create(Uo,{body:N}),z.set("xml:lang",$),z.$parent=c.extensionElements,L.push(z),u.push(()=>L.splice(L.indexOf(z),1))},k=$=>{const N=E(),L=N.indexOf($);N.splice(L,1),u.push(()=>N.splice(L,0,$))};if(s===void 0){if(y===r&&l){if(f&&!p.some(N=>N.body===f)){const N=a&&a!==r?a:void 0;N&&P(N,f)}const $=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{$?l.target[l.key]=f:delete l.target[l.key]})}P(y,i)}else(p.some($=>In($)===y)||!f&&y!==d)&&P(y,i);if(!v)for(const $ of Cr(c).filter(N=>N.locale===y))k($);for(const $ of w){const N=E(),L=this.moddle.create(dc,{locale:$,sourceLocale:y,previous:m});L.$parent=c.extensionElements,N.push(L),u.push(()=>N.splice(N.indexOf(L),1))}for(const $ of Cr(c).filter(N=>N.sourceLocale===y&&(N.previous??"")===i))k($);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}gi(fp,"$inject",["moddle"]);const dp="bwl.setTranslations",b1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class hp{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:r=[],designLocale:o,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!uo(l))return[];const p=()=>{let C=l.extensionElements;return C||(C=this.moddle.create("bpmn:ExtensionElements",{values:[]}),C.$parent=l,l.extensionElements=C,u.push(()=>delete l.extensionElements)),C.get("values")},f=C=>{const x=p(),m=x.indexOf(C);m<0||(x.splice(m,1),u.push(()=>x.splice(m,0,C)))},d=C=>qo(l).find(x=>In(x)===C);if(i===null)for(const C of a){const x=d(C);x&&f(x)}else if(i)for(const C of a){const x=i[C];if(x===void 0)continue;const m=d(C);if(m){if(m.body===x)continue;const E=m.body;m.body=x,u.push(()=>m.body=E);continue}if(C===o&&(s??o)===o)continue;const v=p(),w=this.moddle.create(Uo,{body:x});w.set("xml:lang",C),w.$parent=l.extensionElements,v.push(w),u.push(()=>v.splice(v.indexOf(w),1))}const h=[...i===null?[]:c.requests.filter(C=>!r.includes(C.locale)&&!(i&&i[C.locale]!==void 0&&i[C.locale]!==c.texts[C.locale])&&!(i&&C.sourceLocale&&i[C.sourceLocale]===C.previous))];for(const C of Cr(l)){const x=h.findIndex(m=>b1(C,m));x>=0?h.splice(x,1):f(C)}for(const C of h){const x=p(),m=this.moddle.create(dc,{locale:C.locale,...C.sourceLocale?{sourceLocale:C.sourceLocale}:{},previous:C.previous});m.$parent=l.extensionElements,x.push(m),u.push(()=>x.splice(x.indexOf(m),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}gi(hp,"$inject",["moddle"]);function mp(e){return Cr(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class gp{constructor(t){t.registerHandler(gc,fp),t.registerHandler(dp,hp)}}gi(gp,"$inject",["commandStack"]);const yp={__init__:["translationCommands"],translationCommands:["type",gp]},fm=["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","translation.confirm","element.remove"],x1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},w1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(fc.map(e=>[e,{type:"string"}])),additionalProperties:!1},_1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},E1={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},S1={type:"string",enum:[...uc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},R1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...lc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},C1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},M1={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},A1={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id","source","target"],additionalProperties:!1},P1={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},T1={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},k1={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},O1={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},D1={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},L1={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...op]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Mn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const I1={"participant.add":Mn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Mn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Mn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":Mn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lane:{type:"string"},type:{type:"string",enum:[...lc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Mn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Mn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":Mn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Mn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Mn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Mn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Mn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Mn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Mn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Mn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":Mn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Mn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":Mn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...fc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Mn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},dm={anyOf:fm.map(e=>I1[e])},B1={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라. 문서에 문서 언어 설정이 있으면(describe 의 i18n) 문구는 평문 name/text 가 아니라 names/texts 로 문서 언어 전부를 준다.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:_1,irParticipant:E1,irNode:R1,irFlowCondition:C1,irSequenceFlow:M1,irMessageFlow:A1,irDataStore:P1,irDataAssociation:T1,irTextAnnotation:k1,irAssociation:O1,irGroup:D1,bwlPlacement:L1,eventDefinition:S1,localeTexts:w1,nullableString:x1,symbolicOp:dm}};function vp(){}vp.prototype.get=function(e){return this.$model.properties.get(this,e)},vp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function hm(e,t){this.model=e,this.properties=t}hm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(vp.prototype);H(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}),H(a,Un(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 N1=q(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),mm=q(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 bp(e,t){var n=mm[e];return n?n(t):t}function xp(e){return!!N1[e]}function gm(e){return!!mm[e]}function Bn(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 li(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}li.prototype.build=function(){return Di(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},li.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)},li.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},li.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Bn(r[0],i),a=Bn(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},li.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},li.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},li.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},li.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},li.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},li.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")},li.prototype.hasProperty=function(e){return this.propertiesByName[e]},li.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(H(e.properties,Un(function(o){o=q({},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 Mr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,H(e,Un(this.registerPackage,this))}Mr.prototype.getPackage=function(e){return this.packageMap[e]},Mr.prototype.getPackages=function(){return this.packages},Mr.prototype.registerPackage=function(e){e=q({},e);var t=this.packageMap;ym(t,e,"prefix"),ym(t,e,"uri"),H(e.types,Un(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Mr.prototype.registerType=function(e,t){e=q({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:q({},e.meta||{})});var n=Bn(e.name,t.prefix),i=n.name,r=Object.create(null);H(e.properties,Un(function(o){var a=Bn(o.name,n.prefix),s=a.name;xp(o.type)||(o.type=Bn(o.type,a.prefix).name),q(o,{ns:a,name:s}),r[s]=o},this)),q(e,{ns:n,name:i,propertiesByName:r}),H(e.extends,Un(function(o){var a=Bn(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},Mr.prototype.mapTypes=function(e,t,n){var i=xp(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=Bn(c,xp(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");H(i.superClass,n?a:s),t(i,!n),H(i.traits,a)},Mr.prototype.getEffectiveDescriptor=function(e){var t=Bn(e),n=new li(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},Mr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function ym(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function po(e){this.model=e}po.prototype.set=function(e,t,n){if(!Kn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;$1(n)?i?delete e[r]:delete e.$attrs[wp(t)]:i?r in e?e[r]=n:vm(e,i,n):e.$attrs[wp(t)]=n},po.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[wp(t)];var i=n.name;return!e[i]&&n.isMany&&vm(e,n,[]),e[i]},po.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=q({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},po.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},po.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},po.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 $1(e){return typeof e>"u"}function vm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function wp(e){return e.replace(/^:/,"")}function yi(e,t={}){this.properties=new po(this),this.factory=new hm(this,this.properties),this.registry=new Mr(e,this.properties),this.typeCache=Object.create(null),this.config=t}yi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},yi.prototype.getType=function(e){var t=this.typeCache,n=Kn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},yi.prototype.createAny=function(e,t,n){var i=Bn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){y1(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}),H(n,function(a,s){gn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},yi.prototype.getPackage=function(e){return this.registry.getPackage(e)},yi.prototype.getPackages=function(){return this.registry.getPackages()},yi.prototype.getElementDescriptor=function(e){return e.$descriptor},yi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},yi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},yi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var bm=String.fromCharCode,F1=Object.prototype.hasOwnProperty,j1=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,qa={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(qa).forEach(function(e){qa[e.toUpperCase()]=qa[e]});function H1(e,t,n,i){return i?F1.call(qa,i)?qa[i]:"&"+i+";":bm(t||parseInt(n,16))}function fo(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(j1,H1):e}var xm="non-whitespace outside of root node";function Ar(e){return new Error(e)}function z1(e){return"missing namespace for prefix <"+e+">"}function yc(e){return{get:e,enumerable:!0}}function G1(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var wm=Symbol("nameCache");function _p(e){return e+"$uri"}function V1(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[_p(i)]=n;return t}function vc(){return{line:0,column:0}}function W1(e){throw e}function _m(e){if(!this)return new _m(e);var t=e&&e.proxy,n,i,r,o,a=W1,s,c,l,u,p=vc,f=!1,d=!1,g="",h=!1,y=!1,C=null,x=!1,m,v,w,E;function P(L){L instanceof Error||(L=Ar(L)),C=L,a(L,p)}function k(L){s&&(L instanceof Error||(L=Ar(L)),s(L,p))}this.on=function(L,z){if(typeof z!="function")throw Ar("required args <name, cb>");switch(L){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":u=z;break;case"question":l=z;break;case"comment":c=z;break;default:throw Ar("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Ar("required args <nsMap={}>");var z=Object.create(null),X;for(X in L)z[X]=L[X];return y=!0,E=z,this};function $(){m=y?[]:null,v=y?V1(E):null,w=[],p=vc,x=!1,C=null,d=!1,g=""}this.parse=function(L){if(typeof L!="string")throw Ar("required args <xml=string>");if(f)throw Ar("parse during stream; call end() first");return $(),N(L),p=vc,x=!1,C},this.write=function(L){if(typeof L!="string")throw Ar("required args <xml=string>");return f||($(),f=!0),C||(g=N(g+L,!0)||""),this},this.end=function(){return f||$(),f=!1,C||N(g),g="",p=vc,x=!1,C},this.stop=function(){x=!0};function N(L,z=!1){var X=null,oe=null,te,je=0,qe=!1,He=!1,Se=0,Z=0,ie,V,Y,ae,me,Te,B,R,_,G="",U=0,ne;function Me(Et,mn){var Sn=Et.indexOf(":");if(Sn===-1)return Et;var Gn=v[Et.substring(0,Sn)];return Gn?mn===Gn?Et.substr(Sn+1):Gn+Et.substr(Sn):(k(z1(Et.substring(0,Sn))),null)}function Xe(){if(ne!==null)return ne;var Et,mn,Sn=y&&v.xmlns,Gn=y&&h?[]:null,Ct=U,Qt=G,wn=Qt.length,Fa,Vn,Ni,ai,nn,Do={},ja=new Set,Rn,dt,wt;e:for(;Ct<wn;Ct++)if(Rn=!1,dt=Qt.charCodeAt(Ct),!(dt===32||dt<14&&dt>8)){for((dt<65||dt>122||dt>90&&dt<97)&&dt!==95&&dt!==58&&(k("illegal first char attribute name"),Rn=!0),wt=Ct+1;wt<wn;wt++)if(dt=Qt.charCodeAt(wt),!(dt>96&&dt<123||dt>64&&dt<91||dt>47&&dt<59||dt===46||dt===45||dt===95)){if(dt===32||dt<14&&dt>8){k("missing attribute value"),Ct=wt;continue e}if(dt===61)break;k("illegal attribute name char"),Rn=!0}if(nn=Qt.substring(Ct,wt),nn==="xmlns:xmlns"&&(k("illegal declaration of xmlns"),Rn=!0),dt=Qt.charCodeAt(wt+1),dt===34)wt=Qt.indexOf('"',Ct=wt+2),wt===-1&&(wt=Qt.indexOf("'",Ct),wt!==-1&&(k("attribute value quote missmatch"),Rn=!0));else if(dt===39)wt=Qt.indexOf("'",Ct=wt+2),wt===-1&&(wt=Qt.indexOf('"',Ct),wt!==-1&&(k("attribute value quote missmatch"),Rn=!0));else for(k("missing attribute value quotes"),Rn=!0,wt=wt+1;wt<wn&&(dt=Qt.charCodeAt(wt+1),!(dt===32||dt<14&&dt>8));wt++);for(wt===-1&&(k("missing closing quotes"),wt=wn,Rn=!0),Rn||(Ni=Qt.substring(Ct,wt)),Ct=wt;wt+1<wn&&(dt=Qt.charCodeAt(wt+1),!(dt===32||dt<14&&dt>8));wt++)Ct===wt&&(k("illegal character after attribute end"),Rn=!0);if(Ct=wt+1,Rn)continue e;if(ja.has(nn)){k("attribute <"+nn+"> already defined");continue}if(ja.add(nn),!y){Do[nn]=Ni;continue}if(h){if(Vn=nn==="xmlns"?"xmlns":nn.charCodeAt(0)===120&&nn.substr(0,6)==="xmlns:"?nn.substr(6):null,Vn!==null){if(Et=fo(Ni),mn=_p(Vn),ai=E[Et],!ai){if(Vn==="xmlns"||mn in v&&v[mn]!==Et)do ai="ns"+je++;while(typeof v[ai]<"u");else ai=Vn;E[Et]=ai}v[Vn]!==ai&&(Fa||(v=G1(v),Fa=!0),v[Vn]=ai,Vn==="xmlns"&&(v[_p(ai)]=Et,Sn=ai),v[mn]=Et),Do[nn]=Ni;continue}Gn.push(nn,Ni);continue}nn=Me(nn,Sn),nn!==null&&(Do[nn]=Ni)}if(h)for(Ct=0,wn=Gn.length;Ct<wn;Ct++)nn=Me(Gn[Ct++],Sn),Ni=Gn[Ct],nn!==null&&(Do[nn]=Ni);return ne=Do}function mt(){for(var Et=/(\r\n|\r|\n)/g,mn=0,Sn=0,Gn=0,Ct=Z,Qt,wn;Se>=Gn&&(Qt=Et.exec(L),!(!Qt||(Ct=Qt[0].length+Qt.index,Ct>Se)));)mn+=1,Gn=Ct;return Se==-1?(Sn=Ct,wn=L.substring(Z)):Z===0?wn=L.substring(Z,Se):(Sn=Se-Gn,wn=Z==-1?L.substring(Se):L.substring(Se,Z+1)),{data:wn,line:mn,column:Sn}}for(p=mt,t&&(_=Object.create({},{name:yc(function(){return B}),originalName:yc(function(){return R}),attrs:yc(Xe),ns:yc(function(){return v})}));Z!==-1;){if(L.charCodeAt(Z)===60?Se=Z:Se=L.indexOf("<",Z),Se===-1){if(z)return L.substring(Z);if(w.length)return P("unexpected end of file");if(!d)return P("missing start tag");Z<L.length&&L.substring(Z).trim()&&k(xm);return}if(d||(d=!0),Z!==Se){if(w.length){if(n&&(n(L.substring(Z,Se),fo,p),x))return}else if(L.substring(Z,Se).trim()&&(k(xm),x))return}if(ae=L.charCodeAt(Se+1),ae===33){if(Y=L.charCodeAt(Se+2),Y===91&&L.substr(Se+3,6)==="CDATA["){if(Z=L.indexOf("]]>",Se),Z===-1)return z?L.substring(Se):P("unclosed cdata");if(o&&(o(L.substring(Se+9,Z),p),x))return;Z+=3;continue}if(Y===45&&L.charCodeAt(Se+3)===45){if(Z=L.indexOf("-->",Se),Z===-1)return z?L.substring(Se):P("unclosed comment");if(c&&(c(L.substring(Se+4,Z),fo,p),x))return;Z+=3;continue}}if(ae===63){if(Z=L.indexOf("?>",Se),Z===-1)return z?L.substring(Se):P("unclosed question");if(l&&(l(L.substring(Se,Z+2),p),x))return;Z+=2;continue}for(ie=Se+1;;ie++){if(me=L.charCodeAt(ie),isNaN(me))return z?L.substring(Se):(Z=-1,P("unclosed tag"));if(me===34)Y=L.indexOf('"',ie+1),ie=Y!==-1?Y:ie;else if(me===39)Y=L.indexOf("'",ie+1),ie=Y!==-1?Y:ie;else if(me===62){Z=ie;break}}if(ae===33){if(u&&(u(L.substring(Se,Z+1),fo,p),x))return;Z+=1;continue}if(ne={},ae===47){if(qe=!1,He=!0,!w.length)return P("missing open tag");if(ie=B=w.pop(),Y=Se+2+ie.length,L.substring(Se+2,Y)!==ie)return P("closing tag mismatch");for(;Y<Z;Y++)if(ae=L.charCodeAt(Y),!(ae===32||ae>8&&ae<14))return P("close tag")}else{if(L.charCodeAt(Z-1)===47?(ie=B=L.substring(Se+1,Z-1),qe=!0,He=!0):(ie=B=L.substring(Se+1,Z),qe=!0,He=!1),!(ae>96&&ae<123||ae>64&&ae<91||ae===95||ae===58))return P("illegal first char nodeName");for(Y=1,V=ie.length;Y<V;Y++)if(ae=ie.charCodeAt(Y),!(ae>96&&ae<123||ae>64&&ae<91||ae>47&&ae<59||ae===45||ae===95||ae==46)){if(ae===32||ae<14&&ae>8){B=ie.substring(0,Y),ne=null;break}return P("invalid nodeName")}He||w.push(B)}if(y){te=v,qe&&(He||m.push(te),ne===null&&(h=ie.indexOf("xmlns",Y)!==-1)&&(U=Y,G=ie,Xe(),h=!1)),R=B,oe!==v&&(X=v[wm],X===void 0&&(X=v[wm]=Object.create(null)),oe=v);var qt=X[B];if(qt!==void 0)B=qt;else{if(ae=B.indexOf(":"),ae!==-1){if(Te=v[B.substring(0,ae)],!Te)return P("missing namespace on <"+R+">");B=B.substr(ae+1)}else Te=v.xmlns;Te&&(B=Te+":"+B),X[R]=B}}if(qe&&(U=Y,G=ie,i&&(t?i(_,fo,He,p):i(B,Xe,fo,He,p),x)))return;if(He){if(r&&(r(t?_:B,fo,qe,p),x))return;y&&(qe?v=te:v=m.pop())}Z+=1}}}function Em(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Ep={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Sm="property";function Rm(e){return e.xml&&e.xml.serialize}function U1(e){const t=Rm(e);return t!==Sm&&(t||null)}function q1(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Cm(e,t){return Em(t)?e.prefix+":"+q1(e.localName):e.name}function Y1(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 K1(e,t,n){const i=Bn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Bn(r);var a=n.getPackage(o.prefix);return Y1(o,a)}function Pr(e){return new Error(e)}function ar(e){return e.$descriptor}function X1(e){q(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Pr("expected element");var n=this.elementsById,i=ar(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 Pr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ya(){}Ya.prototype.handleEnd=function(){},Ya.prototype.handleText=function(){},Ya.prototype.handleNode=function(){};function Sp(){}Sp.prototype=Object.create(Ya.prototype),Sp.prototype.handleNode=function(){return this};function Yo(){}Yo.prototype=Object.create(Ya.prototype),Yo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ka(e,t){this.property=e,this.context=t}Ka.prototype=Object.create(Yo.prototype),Ka.prototype.handleNode=function(e){if(this.element)throw Pr("expected no sub nodes");return this.element=this.createReference(e),this},Ka.prototype.handleEnd=function(){this.element.id=this.body},Ka.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Rp(e,t){this.element=t,this.propertyDesc=e}Rp.prototype=Object.create(Yo.prototype),Rp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=bp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function bc(){}bc.prototype=Object.create(Yo.prototype),bc.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 jn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}jn.prototype=Object.create(bc.prototype),jn.prototype.addReference=function(e){this.context.addReference(e)},jn.prototype.handleText=function(e){var t=this.element,n=ar(t),i=n.bodyProperty;if(!i)throw Pr("unexpected body text <"+e+">");Yo.prototype.handleText.call(this,e)},jn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ar(t),i=n.bodyProperty;i&&e!==void 0&&(e=bp(i.type,e),t.set(i.name,e))},jn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ar(n),r=this.context,o=new n({}),a=this.model,s;return H(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),H(p,function(f){r.addReference({element:o,property:u.ns.name,id:f})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=bp(u.type,c):l==="xmlns"?l=":"+l:(s=Bn(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},jn.prototype.getPropertyForNode=function(e){var t=e.name,n=Bn(t),i=this.type,r=this.model,o=ar(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=U1(s);if(l){const u=e.attributes[l];if(u){const p=K1(u,e.ns,r),f=r.getType(p);return q({},s,{effectiveType:ar(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Cm(n,c),u=r.getType(l);if(s=Tt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return q({},s,{effectiveType:ar(u).name})}else if(s=Tt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Pr("unrecognized element <"+n.name+">")},jn.prototype.toString=function(){return"ElementDescriptor["+ar(this.type).name+"]"},jn.prototype.valueHandler=function(e,t){return new Rp(e,t)},jn.prototype.referenceHandler=function(e){return new Ka(e,this.context)},jn.prototype.handler=function(e){return e==="Element"?new Ko(this.model,e,this.context):new jn(this.model,e,this.context)},jn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,gm(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?(q(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Cp(e,t,n){jn.call(this,e,t,n)}Cp.prototype=Object.create(jn.prototype),Cp.prototype.createElement=function(e){var t=e.name,n=Bn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Cm(n,o)||t;if(!r.hasType(a))throw Pr("unexpected element <"+e.originalName+">");return jn.prototype.createElement.call(this,e)};function Ko(e,t,n){this.model=e,this.context=n}Ko.prototype=Object.create(bc.prototype),Ko.prototype.createElement=function(e){var t=e.name,n=Bn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Ko.prototype.handleChild=function(e){var t=new Ko(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},Ko.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Mp(e){e instanceof yi&&(e={model:e}),q(this,{lax:!1},e)}Mp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof jn?(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 X1(q({},t,{rootHandler:i})),s=new _m({proxy:!0}),c=Z1();i.context=a,c.push(i);function l(w,E,P){var k=E(),$=k.line,N=k.column,L=k.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var z="unparsable content "+(L?L+" ":"")+`detected
|
|
2
|
+
line: `+$+`
|
|
3
|
+
column: `+N+`
|
|
4
|
+
nested error: `+w.message;if(P)return a.addWarning({message:z,error:w}),!0;throw Pr(z)}function u(w,E){return l(w,E,!0)}function p(){var w=a.elementsById,E=a.references,P,k;for(P=0;k=E[P];P++){var $=k.element,N=w[k.id],L=ar($).propertiesByName[k.property];if(N||a.addWarning({message:"unresolved reference <"+k.id+">",element:k.element,property:k.property,value:k.id}),L.isMany){var z=$.get(L.name),X=z.indexOf(k);X===-1&&(X=z.length),N?z[X]=N:z.splice(X,1)}else $.set(L.name,N)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(w){if(d.test(w)){var E=g.exec(w),P=E&&E[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function C(w,E){var P=c.peek();try{c.push(P.handleNode(w))}catch(k){l(k,E,o)&&c.push(new Sp)}}function x(w,E){try{c.peek().handleText(w)}catch(P){u(P,E)}}function m(w,E){w.trim()&&x(w,E)}var v=r.getPackages().reduce(function(w,E){return w[E.uri]=E.prefix,w},Object.entries(Ep).reduce(function(w,[E,P]){return w[P]=E,w},r.config&&r.config.nsMap||{}));return s.ns(v).on("openTag",function(w,E,P,k){var $=w.attrs||{},N=Object.keys($).reduce(function(z,X){var oe=E($[X]);return z[X]=oe,z},{}),L={name:w.name,originalName:w.originalName,attributes:N,ns:w.ns};C(L,k)}).on("question",y).on("closeTag",f).on("cdata",x).on("text",function(w,E,P){m(E(w),P)}).on("error",l).on("warn",u),new Promise(function(w,E){var P;try{s.parse(e),p()}catch(z){P=z}var k=i.element;!P&&!k&&(P=Pr("failed to parse document as <"+i.type.$descriptor.name+">"));var $=a.warnings,N=a.references,L=a.elementsById;return P?(P.warnings=$,E(P)):w({rootElement:k,elementsById:L,references:N,warnings:$})})},Mp.prototype.handler=function(e){return new Cp(this.model,e)};function Z1(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Q1=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,J1=/<|>|'|"|&|\n\r|\n/g,Mm=/<|>|&/g;function zi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}zi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},zi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},zi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},zi.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)},zi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},zi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},zi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},zi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},zi.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 eS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function tS(e,t){return Em(t)?eS(e):e}function Am(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Pm(e){return Kn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function nS(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 iS(e,t){return t.isGeneric?q({localName:t.ns.localName},e):q({localName:tS(t.ns.localName,t.$pkg)},e)}function rS(e,t){return q({localName:t.ns.localName},e)}function oS(e){var t=e.$descriptor;return it(t.properties,function(n){var i=n.name;if(n.isVirtual||!Xn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var aS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},sS={"<":"lt",">":"gt","&":"amp"};function Tm(e,t,n){return e=Kn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function cS(e){return Tm(e,J1,aS)}function lS(e){return Tm(e,Mm,sS)}function uS(e){return it(e,function(t){return t.isAttr})}function pS(e){return it(e,function(t){return!t.isAttr})}function Ap(e){this.tagName=e}Ap.prototype.build=function(e){return this.element=e,this},Ap.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function ho(){}ho.prototype.serializeValue=ho.prototype.serializeTo=function(e){e.append(this.escape?lS(this.value):this.value)},ho.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Mm)!==-1&&(this.escape=!0),this};function Pp(e){this.tagName=e}Am(Pp,ho),Pp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function jt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}jt.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=oS(e),this.parseAttributes(uS(r)),this.parseContainments(pS(r))),this.parseGenericAttributes(e,i),this},jt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return iS(t,e)},jt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return rS(t,e)},jt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},jt.prototype.nsAttributeName=function(e){var t;if(Kn(e)?t=Bn(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}:q({localName:t.localName},n)},jt.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}))},jt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new ho().build({type:"String"},t));var n=e.$children;n&&H(n,i=>{this.body.push(new jt(this).build(i))})},jt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Bn(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)}},jt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return H(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},jt.prototype.parseGenericAttributes=function(e,t){var n=this;H(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)}})},jt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;H(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new ho().build(r,o[0]));else if(gm(r.type))H(o,function(l){n.push(new Pp(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)H(o,function(l){n.push(new Ap(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=Rm(r);H(o,function(l){var u;c?c===Sm?u=new jt(t,r):u=new xc(t,r,c):u=new jt(t),n.push(u.build(l))})}})},jt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new zi(i):t=i),t},jt.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},jt.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},jt.prototype.parseAttributes=function(e){var t=this,n=this.element;H(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];H(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},jt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Pm(e)},jt.prototype.addAttribute=function(e,t){var n=this.attrs;Kn(t)&&(t=cS(t));var i=lm(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)},jt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=nS(n).concat(t)),H(t,function(i){e.append(" ").append(Pm(i.name)).append('="').append(i.value).append('"')})},jt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==ho;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),H(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function xc(e,t,n){jt.call(this,e,t),this.serialization=n}Am(xc,jt),xc.prototype.parseNsAttributes=function(e){var t=jt.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},xc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function fS(){this.value="",this.write=function(e){this.value+=e}}function dS(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 hS(e){e=q({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new fS,o=new dS(r,e.format);e.preamble&&o.append(Q1);var a=new jt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(mS(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function mS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Ep)n[i]=Ep[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 wc(e,t){yi.call(this,e,t)}wc.prototype=Object.create(yi.prototype),wc.prototype.fromXML=function(e,t,n){Kn(t)||(n=t,t="bpmn:Definitions");var i=new Mp(q({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},wc.prototype.toXML=function(e,t){var n=new hS(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var gS="BPMN20",yS="http://www.omg.org/spec/BPMN/20100524/MODEL",vS="bpmn",bS=[],xS=[{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"}]}],wS=[{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"}]}],_S={tagAlias:"lowerCase",typePrefix:"t"},ES={name:gS,uri:yS,prefix:vS,associations:bS,types:xS,enumerations:wS,xml:_S},SS="BPMNDI",RS="http://www.omg.org/spec/BPMN/20100524/DI",CS="bpmndi",MS=[{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"]}],AS=[{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"}]}],PS=[],TS={name:SS,uri:RS,prefix:CS,types:MS,enumerations:AS,associations:PS},kS="DC",OS="http://www.omg.org/spec/DD/20100524/DC",DS="dc",LS=[{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}]}],IS=[],BS={name:kS,uri:OS,prefix:DS,types:LS,associations:IS},NS="DI",$S="http://www.omg.org/spec/DD/20100524/DI",FS="di",jS=[{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"}]}],HS=[],zS={tagAlias:"lowerCase"},GS={name:NS,uri:$S,prefix:FS,types:jS,associations:HS,xml:zS},VS="bpmn.io colors for BPMN",WS="http://bpmn.io/schema/bpmn/biocolor/1.0",US="bioc",qS=[{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"}]}],YS=[],KS=[],XS={name:VS,uri:WS,prefix:US,types:qS,enumerations:YS,associations:KS},ZS="BPMN in Color",QS="http://www.omg.org/spec/BPMN/non-normative/color/1.0",JS="color",eR=[{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"}]}],tR=[],nR=[],iR={name:ZS,uri:QS,prefix:JS,types:eR,enumerations:tR,associations:nR};const rR={bpmn:ES,bpmndi:TS,dc:BS,di:GS,bioc:XS,color:iR};function km(e,t){const n=q({},rR,e);return new wc(n,t)}const oR={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"}},_c={[pm]:oR,[rp]:am};function Om(){return km(_c)}const Dm=Om();async function Xo(e){const{rootElement:t,warnings:n}=await Dm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function aR(e){const{xml:t}=await Dm.toXML(e,{format:!0});return t}function Tp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Zo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},sR=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function cR(e){const t=Zo;return sR.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 Qo(e,t){let n=0;for(const i of e)n+=t*cR(i);return n}function Lm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&lR(e),uR(e),pR(e),fR(e)}function lR(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:Qo(r,o),fontBoundingBoxAscent:o*Zo.ascentEm,fontBoundingBoxDescent:o*Zo.descentEm,actualBoundingBoxAscent:o*Zo.ascentEm,actualBoundingBoxDescent:o*Zo.descentEm}}};t.getContext=()=>n}function uR(e){if(e.SVGMatrix)return;class t{constructor(){gi(this,"a",1);gi(this,"b",0);gi(this,"c",0);gi(this,"d",1);gi(this,"e",0);gi(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 pR(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,l=0){const u=s*Math.PI/180,p=Math.cos(u),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},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 fR(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:Qo(n,12),height:14}})}const Ec=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),dR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),hR=1,Sc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),mR=2;function pt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${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"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;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"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Im=20,Rc=5,Bm=3,gR=8,Jo=15,kp=50,Nm=12,yR=Nm*1.2;function Op(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Qo(o,Nm))),r=n.length*yR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const $m=1;function vn(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 ea(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 vn(e))for(const s of vn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>$m)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Im&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Dp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Fm(e,t){const n=ea(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function vR(e,t){let n=0;for(const i of t)i.id!==e.id&&Fm(e,i)&&n++;return n}function ui(e,t){let n=0;for(const i of t)i.id!==e.id&&ea(e,i)&&n++;return n}const jm=15,Hm=20;function bR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Hm||t.at>n[1]+Hm)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 Lp=20;function Cc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>$m)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Im||n.push([r-Lp,o+Lp])}return n}function Mc(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of vn(e)){const o=bR(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Cc(r,vn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const xR=10,wR=1,_R=(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 ER(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,l=t.y-e.y;let u=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>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,l)&&f(e.y-s,-l)&&p>u}function Ip(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 SR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ta=1;function Gi(e,t){const n=e.x+ta,i=e.x+e.width-ta,r=e.y+ta,o=e.y+e.height-ta;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 na(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 zm(e,t){const n=e.label;if(!n)return null;if(vn(e).some(i=>Gi(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(vn(i).some(r=>Gi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Gi(n,r)))return i.id;return null}function bn(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(ER(e.waypoints[o],e.waypoints[o+1],r,mR)){i.push(r);break}}return i}const Xa=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},RR=(e,t,n,i)=>Vm(e,t,n,i)?0:Math.min(Xa(e,n,i),Xa(t,n,i),Xa(n,e,t),Xa(i,e,t)),Gm=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function Za(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,Xa({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(Gm(e,s)||Gm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,RR(e,t,s[l],s[(l+1)%s.length]));return c}function Vm(e,t,n,i){const r=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.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 Wm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Qa(e,t){let n=0;for(const i of t){if(i.id===e.id||Wm(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++)Vm(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function pi(e,t){let n=0;for(const i of t)i.id===e.id||Wm(e,i)||Qa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Um(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++)Qa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Ac(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Qa(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 qm(e){const t=Ac(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),l=i.get(s);if(!c||!l)continue;const u=n(c.type),p=n(l.type);u==="solid"&&p==="solid"?r++:u==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:CR(e)}}function CR(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(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Ym(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Sc.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 Km(e){var n;const t=(n=Nt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Nt(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 Xm=e=>e?{members:e}:{},fi=e=>e.shapes.filter(t=>!t.container);function MR(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&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function AR(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function Zm(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(vn(i).some(r=>Gi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Gi(n,r)))return i.id;return null}function mo(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}const Qm=3;function Jm(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function Ja(e,t){const n=[];for(const i of t.shapes){if(i.container||Sc.has(i.type))continue;const r=Jm(e,i);r>=Qm&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function ht(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of bn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const r=e.shapes.filter(m=>m.container&&dR.has(m.type));if(r.length){const m=(v,w)=>{const E=e.shapes.find(P=>P.id===w);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const w of bn(v,r))v.endpoints.includes(w.id)||v.endpoints.some(E=>m(w,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:w.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[w,E]of v){if(!w)continue;const P=e.shapes.find(L=>L.id===w);if(!P||P.container)continue;const k=Math.max(P.x-E.x,E.x-(P.x+P.width),0),$=Math.max(P.y-E.y,E.y-(P.y+P.height),0),N=Math.hypot(k,$);N>xR&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:w,distance:Math.round(N)})}}const o=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<o.length;m++)for(let v=m+1;v<o.length;v++){const w=o[m],E=o[v];if(w.x+w.width<=E.x||E.x+E.width<=w.x||w.y+w.height<=E.y||E.y+E.height<=w.y)continue;const P=(k,$)=>k.x<=$.x&&k.y<=$.y&&k.x+k.width>=$.x+$.width&&k.y+k.height>=$.y+$.height;n.push({kind:"pool-overlap",pools:[w.id,E.id],contained:P(w,E)||P(E,w)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const w=a[m],E=a[v];if(!Ip(w,E,hR))continue;const P=w.id<E.id?[w.id,E.id]:[E.id,w.id];n.push({kind:"shape-overlap",shapes:P,identical:SR(w,E)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const w=s[m],E=s[v],P=Math.min(w.x+w.width,E.x+E.width)-Math.max(w.x,E.x),k=Math.min(w.y+w.height,E.y+E.height)-Math.max(w.y,E.y);if(P<=Rc||k<=Rc)continue;const $=w.id<E.id?[w.id,E.id]:[E.id,w.id],N=new Set(E.members);if(w.members.some(z=>N.has(z))){const z=Ym(e,s,{x:Math.max(w.x,E.x),y:Math.max(w.y,E.y),right:Math.min(w.x+w.width,E.x+E.width),bottom:Math.min(w.y+w.height,E.y+E.height)});z.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:$,shapes:z});continue}const L=w.x<=E.x&&w.y<=E.y&&w.x+w.width>=E.x+E.width&&w.y+w.height>=E.y+E.height?w.id:E.x<=w.x&&E.y<=w.y&&E.x+E.width>=w.x+w.width&&E.y+E.height>=w.y+w.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:$,...L?{container:L}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!Sc.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const w=new Set(m.members),E=v.filter(P=>!w.has(P.id));E.some(P=>c.has(P.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:E.map(P=>P.id).sort()}))}for(const m of s){const v=new Set(l(m).map(N=>N.id)),w=new Set(m.members),E=new Set([...v].filter(N=>!w.has(N)&&c.has(N)));if(!E.size)continue;let P=!1,k=!1,$=!1;for(const N of e.edges){if(N.type!=="bpmn:SequenceFlow"||!N.source||!N.target)continue;const L=E.has(N.source),z=E.has(N.target);!L&&z&&!v.has(N.source)?P=!0:L&&!z&&!v.has(N.target)?k=!0:L&&z&&($=!0)}P&&k&&$&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...E].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let w=v+1;w<u.length;w++){const E=[u[m],u[v],u[w]],P={x:Math.max(...E.map(N=>N.x)),y:Math.max(...E.map(N=>N.y)),right:Math.min(...E.map(N=>N.x+N.width)),bottom:Math.min(...E.map(N=>N.y+N.height))};if(P.right-P.x<=Rc||P.bottom-P.y<=Rc)continue;const k=Ym(e,[],P);if(!k.length)continue;const $=E.map(N=>N.id).sort();n.push({kind:"group-stack-unreadable",groups:$,shapes:k})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Sc.has(v.type)||v.width<=0||v.height<=0)continue;const w=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[E,P,k,$,N]of w){const L=k==="h"?v.x:v.y,z=k==="h"?v.x+v.width:v.y+v.height;if(!(L<N&&$<z))continue;const X=k==="h"?v.y:v.x,oe=k==="h"?v.y+v.height:v.x+v.width;if(!(X<P&&P<oe))continue;const te=Math.min(P-X,oe-P);te<gR||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:E,depth:te})}}const p=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(p.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const w=vn(v);if(w.length)for(const E of p){const P=E.x+E.width,k=E.y+E.height,$=v.endpoints.some(L=>{const z=m.get(L);return!!z&&E.x<z.x&&z.x<P&&E.y<z.y&&z.y<k});let N=null;for(const L of w){const[z,X,oe]=L.axis==="v"?[E.y,k,[["left",E.x],["right",P]]]:[E.x,P,[["top",E.y],["bottom",k]]],te=Math.min(L.hi,X)-Math.max(L.lo,z);if(te<kp)continue;const je=L.axis==="v"?E.x<L.at&&L.at<P:E.y<L.at&&L.at<k;if(!(je&&$))for(const[qe,He]of oe){const Se=Math.abs(L.at-He);Se<=Jo&&(!N||Se<N.distance)&&(N={side:qe,inside:je,distance:Se,length:te})}}N&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:N.side,inside:N.inside,distance:Math.round(N.distance),length:Math.round(N.length)})}}}const f=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const w=m.x<v.x+v.width&&v.x<m.x+m.width,E=m.y<v.y+v.height&&v.y<m.y+m.height,P=[["top",m.y,v.y,w],["bottom",m.y+m.height,v.y+v.height,w],["left",m.x,v.x,E],["right",m.x+m.width,v.x+v.width,E]];for(const[k,$,N,L]of P)L&&Math.abs($-N)<=Bm&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:k})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const w=d[m],E=d[v],P=w.x<E.x+E.width&&E.x<w.x+w.width,k=w.y<E.y+E.height&&E.y<w.y+w.height,$=[["x",w.x+w.width,E.x,k],["x",E.x+E.width,w.x,k],["y",w.y+w.height,E.y,P],["y",E.y+E.height,w.y,P]];for(const[N,L,z,X]of $)if(X&&Math.abs(L-z)<=Bm){n.push({kind:"group-on-group-boundary",groups:w.id<E.id?[w.id,E.id]:[E.id,w.id],axis:N});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const w=e.edges[m],E=e.edges[v],P=ea(w,E);if(!P)continue;const k=w.id<E.id?[w.id,E.id]:[E.id,w.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:k,axis:P.axis,length:Math.round(P.length)})}for(const m of e.edges){if(!m.label)continue;const v=Mc(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=zm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:w}of Ja(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(w)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=Zm(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:w}of mo(e))v===m.id||y.has(v)||Ip(m.label,w,ta)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const C=mo(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:w}of C)v!==m.id&&Ip(m,w,ta)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const x=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??MR(m,e,x);if(!v)continue;const w=x.get(v);!w||!w.container||_R(w,m,wR)||m.type==="bpmn:TextAnnotation"&&!AR(m,w,e)||n.push({kind:"shape-outside-container",shape:m.id,container:w.id})}return n.sort((m,v)=>pt(m).localeCompare(pt(v)))}const Nt=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,sr=e=>{const t=Nt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function PR(e){const t=Nt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=sr(o);a&&n.push(a)}}return n}function TR(e){const t=Nt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:sr(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:sr(t.targetRef);return n&&i?{source:n,target:i}:{}}function kR(e,t){const n=Nt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=sr(n);return r?t.get(r):void 0}if(Ec.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return sr(n)}function eg(e){var a,s,c,l,u;const t=[],n=[],i=((a=Nt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=Nt(e))==null?void 0:s.rootElements)??[]){const f=Nt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=Nt(d),h=sr(g),y=sr(g==null?void 0:g.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const p of i){const f=Nt((c=Nt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=Nt(g);if(!h)continue;const y=Nt(h.bpmnElement),C=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!C)continue;const x=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=Nt(h.bounds);if(m){const w=h.isExpanded===!1&&x!=="bpmn:Participant",E=Nt((l=Nt(h.label))==null?void 0:l.bounds),P={id:C,type:x,x:Xt(m.x),y:Xt(m.y),width:Xt(m.width),height:Xt(m.height),container:Ec.has(x)&&!w,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:kR(y,r)}:{},...E?{label:{x:Xt(E.x),y:Xt(E.y),width:Xt(E.width),height:Xt(E.height)}}:{},...x==="bpmn:Group"?Xm(Km(y)):{}},k=h.isHorizontal!==!1,$=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(C)&&k&&$&&(P.label=Op(P,$)),t.push(P);continue}const v=h.waypoint;if(Array.isArray(v)){const w=Nt((u=Nt(h.label))==null?void 0:u.bounds);n.push({id:C,type:x,waypoints:v.map(E=>{var P,k;return{x:Xt((P=Nt(E))==null?void 0:P.x),y:Xt((k=Nt(E))==null?void 0:k.y)}}),endpoints:PR(y),...TR(y),...w?{label:{x:Xt(w.x),y:Xt(w.y),width:Xt(w.width),height:Xt(w.height)}}:{}})}}}return{shapes:t,edges:n}}function tg(e){return ht(eg(e),{includeObservationOnly:!0})}async function OR(e){const{definitions:t,warnings:n}=await Xo(e);return{findings:tg(t),warnings:n}}function Ue(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=Nt(o.label),y=sr(o.source),C=sr(o.target);n.push({id:o.id,type:a,waypoints:s.map(x=>({x:Xt(x.x),y:Xt(x.y)})),endpoints:[y,C].filter(x=>!!x),...y&&C?{source:y,target:C}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Nt(o.businessObject),l=Nt(o.label);let u=Nt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Nt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Ec.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Xt(o.width),height:Xt(o.height),container:Ec.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?Xm(Km(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=Nt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Op(d,g)),t.push(d)}return{shapes:t,edges:n}}const DR={"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 LR(e,t){const n=DR[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function ng(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function ig(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 LR(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&ng(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?ng(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}},eventDefinitionOf:n=>{var o;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const r=(((o=i.businessObject)==null?void 0:o.eventDefinitions)??[]).map(a=>a.$type);return ip(r)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Cr(i.businessObject).map(r=>r.locale)}}}const Bp=20,IR=4,Lt=(e,t)=>Math.abs(e-t)<.5;function Pc(e,t,n,i=Bp){if(Lt(e.y,t.y)&&!Lt(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=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Lt(e.x,t.x)&&!Lt(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=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function rg(e,t,n,i=Bp){if(n.length<2)return null;if(Lt(e.y,t.y)&&!Lt(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,l=e.x<t.x?s:a,u=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:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(Lt(e.x,t.x)&&!Lt(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,l=e.y<t.y?s:a,u=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:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function og(e,t,n=Bp){if(e.length!==4)return null;const[i,r,o,a]=e;if(Lt(i.y,r.y)&&Lt(r.x,o.x)&&Lt(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(Lt(i.x,r.x)&&Lt(r.y,o.y)&&Lt(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 Tc(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,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const ag=30,BR=[0,-25,25,-40,40];function NR(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+ag:s-ag,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return BR.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>bn({...e,endpoints:[],waypoints:f},[n]).length===0)}const Np=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ia=(e,t,n)=>bn({...e,waypoints:t},n).length;function $p(e,t,n,i){let r=[...e.waypoints],o=ia(e,r,t);if(o===0)return null;let a=!1;for(const p of Tc(e,t))if(ia(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(vn),c=p=>vn({...e,waypoints:p}).some(f=>Cc(f,s).length>0),l=NR(e,t).filter(p=>ia(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=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&&Lt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(Lt(d[0].y,d[1].y)&&!Lt(d[0].x,d[1].x)){const g=t.filter(x=>!e.endpoints.includes(x.id)&&bn({...e,waypoints:d},[x]).length>0),h=g.length>=2?rg(d[0],d[1],g):null,C=(h?h.map(x=>[d[0],...x,d[1]]):g.length===1?(Pc(d[0],d[1],g[0])??[]).map(x=>[d[0],...x,d[1]]):g.length===0?[d]:[]).filter(x=>ia(e,x,t)===0&&x.length<=r.length).sort((x,m)=>Number(u(m))-Number(u(x)));if(C.length)return C.find(x=>!c(x))??C[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],g=t.filter(C=>!e.endpoints.includes(C.id)&&bn({...e,waypoints:[f,d]},[C]).length>0);if(g.length<2)continue;const h=rg(f,d,g);if(!h)continue;const y=h.map(C=>Np(r,p,C)).filter(C=>ia(e,C,t)===0).sort((C,x)=>Number(u(x))-Number(u(C)));if(y.length)return y.find(C=>!c(C))??y[0]}for(let p=0;p<IR&&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 y of t){if(e.endpoints.includes(y.id)||bn({...e,waypoints:[g,h]},[y]).length===0)continue;const C=Pc(g,h,y),x=C?C.map(v=>Np(r,d,v)):og(r,y)??[];if(!x.length)continue;const m=[...x].sort((v,w)=>Number(u(w))-Number(u(v)));for(const v of m){const w=ia(e,v,t);if(w<o){r=v,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Fp(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=fi(o),s=new Set,c=ht(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(pt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const p=o.edges.find(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=bn(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const y=$p(p,a,g,o.edges);if(!y){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const C=o.edges.filter(v=>v.id!==u),x=ui(p,C);ui({...p,waypoints:y},C)>x||r.updateWaypoints(f,y)}return s}const $R=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},jp=(e,t)=>Qa(e,[t])>0;function sg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=fi(o);let s=o;const c=new Set(ht(o).map(pt));for(const[l,u]of Ac(o))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find($=>$.id===p),g=s.edges.find($=>$.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const y=h.parent,C=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,x=$R(g),m=[...Tc(d,a)??[]],v=$p(d,[...a,...x],C,o.edges);v&&m.push(v);for(let $=0;$+1<d.waypoints.length;$++)for(const N of x)for(const L of Pc(d.waypoints[$],d.waypoints[$+1],N)??[])m.push(Np(d.waypoints,$,L));const w=s.edges.filter($=>$.id!==p),E=$=>({...s,edges:s.edges.map(N=>N.id===p?{...N,waypoints:$}:N)}),P=$=>!C||$.every(N=>N.x>=C.x&&N.x<=C.x+C.width&&N.y>=C.y&&N.y<=C.y+C.height),k=m.find($=>{const N={...d,waypoints:$};return jp(N,g)||!P($)||w.some(L=>L.id!==f&&!jp(d,L)&&jp(N,L))?!1:ht(E($)).every(L=>c.has(pt(L)))});if(k){r.updateWaypoints(h,k),s=E(k);break}}}const FR=10;function cg(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 lg(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=cg(i,n),a=cg(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=l.y).sort((z,X)=>z.y-X.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,y=s?g:d,C=e.waypoints[0],x=e.waypoints[e.waypoints.length-1],m=fi(t),v=t.edges.filter(z=>z.id!==e.id),w=pi(e,v),E=bn(e,m).length;if(w===0&&E===0||E===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(z=>z.x)),k=Math.max(...u.map(z=>z.x+z.width)),$=(C.x+x.x)/2,N=z=>z.filter((X,oe)=>oe===0||!(Lt(X.x,z[oe-1].x)&&Lt(X.y,z[oe-1].y)));let L;for(let z=P;z<=k;z+=FR){const X=N([C,{x:C.x,y:h},{x:z,y:h},{x:z,y},{x:x.x,y},x]),oe={...e,waypoints:X};if(bn(oe,m).length>0)continue;const te=pi(oe,v),je=Math.abs(z-$);(!L||te<L.cross||te===L.cross&&je<L.detour)&&(L={pts:X,cross:te,detour:je})}return L&&(E>0?L.cross<=w:L.cross<w)?L.pts:null}function ug(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ue(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Ue(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=lg(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Vi=[25,-25,40,-40],ra=35;function jR(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-ra:Math.max(e.y+e.height,t.y+t.height)+ra;for(const l of[0,...Vi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Vi]){if(Math.abs(u)>=t.width/2-5)continue;const p=n+l,f=i+u;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function kc(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 jR(n,i);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,l=s?n.y:n.y+n.height,u=s?n.y-ra:n.y+n.height+ra,p=[];for(const x of[0,...Vi]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;p.push({pts:[{x:n.x,y:r},{x:m,y:r},{x:m,y:c}],cost:Math.abs(x)});for(const v of[0,...Vi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;p.push({pts:[{x:w,y:l},{x:w,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(x)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const x of[0,...Vi]){if(Math.abs(x)>=n.width/2-5)continue;const m=a+x;p.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(x)})}const h=60,y=s?i.y+i.height:i.y,C=s?i.y+i.height+ra:i.y-ra;for(const x of[0,...Vi]){if(Math.abs(x)>=i.width/2-5)continue;const m=o+x;for(const v of[0,...Vi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;p.push({pts:[{x:w,y:g},{x:w,y:C},{x:m,y:C},{x:m,y}],cost:h+Math.abs(x)+Math.abs(v)})}}return p}const Oc=30;function pg(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Lt(i.y,r.y)&&!Lt(i.x,r.x),a=Lt(i.x,r.x)&&!Lt(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)<Oc||Math.abs(i.y-(s.y+s.height))<Oc)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)<Oc||Math.abs(i.x-(s.x+s.width))<Oc)return!0}}return!1}const Dc=40;function HR(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Dc,a=r.x+r.width+Dc,s=r.y-Dc,c=r.y+r.height+Dc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function fg(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(E=>E.container),i=new Map(t.shapes.map(E=>[E.id,E])),r=fi(t),o=t.edges.filter(E=>E.id!==e.id),a=ui(e,o),s=pi(e,o),c=E=>HR(E,t.shapes,e.endpoints)+(pg(E,n)?1:0),l=c(e.waypoints),u=E=>{if(!E)return;const P=E.x+E.width/2,k=E.y+E.height/2;return n.find($=>$.type==="bpmn:Lane"&&P>=$.x&&P<=$.x+$.width&&k>=$.y&&k<=$.y+$.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=E=>{if(!d||!f)return!1;for(let P=1;P<E.length-2;P++){const k=E[P],$=E[P+1];if(Lt(k.y,$.y)&&!Lt(k.x,$.x)&&k.y>f.y&&k.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),C=(E=>{if(!E)return;const P=E.x+E.width/2,k=E.y+E.height/2;return n.filter($=>$.type==="bpmn:Participant"&&P>=$.x&&P<=$.x+$.width&&k>=$.y&&k<=$.y+$.height).sort(($,N)=>$.width*$.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),x=E=>{if(!C)return 0;let P=0;for(let k=1;k<E.length-1;k++){const $=E[k];($.x<C.x||$.x>C.x+C.width||$.y<C.y||$.y>C.y+C.height)&&P++}return P},m=x(e.waypoints);if(!pg(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=E=>E.reduce((P,k,$)=>$?P+Math.abs(k.x-E[$-1].x)+Math.abs(k.y-E[$-1].y):0,0);let w;for(const{pts:E,cost:P}of kc(e,i)){const k={...e,waypoints:E};if(bn(k,r).length>0)continue;const $=ui(k,o);if($>a)continue;const N=x(E);if(N>m)continue;const L=N<m&&$===0;if(!L&&pi(k,o)>s)continue;const z=c(E),X=g(E);if(!L&&!(X&&!h)&&z>=l)continue;const te=X?0:1,je=v(E);(!w||N<w.out||N===w.out&&(te<w.lane||te===w.lane&&($<w.opp||$===w.opp&&(z<w.sc||z===w.sc&&(P<w.cost||P===w.cost&&je<w.len)))))&&(w={pts:E,out:N,sc:z,lane:te,opp:$,cost:P,len:je})}return(w==null?void 0:w.pts)??null}function zR(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,r=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),o=r.filter(p=>p.endpoints[1]===i),a=r.filter(p=>p.endpoints[0]===i);if(o.length!==1||a.length!==1)return!1;const s=t.shapes.find(p=>p.id===n),c=t.shapes.find(p=>p.id===i),l=t.shapes.find(p=>p.id===a[0].endpoints[1]);if(!s||!c||!l||!(s.x+s.width<c.x&&c.x+c.width<l.x))return!1;const u=s.y+s.height/2;return u<l.y||u>l.y+l.height?!1:u<c.y||u>c.y+c.height}function GR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of o){const s=Ue(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=fi(s),u=s.edges.filter(y=>y.id!==a),p=bn(c,l).length,f=ui(c,u),d=pi(c,u),g=n.has(a)?new Set(ht(s).map(pt)):null,h=Tc(c,s.shapes);h.length===2&&zR(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const C={...c,waypoints:y};if(bn(C,l).length>p||ui(C,u)>f||pi(C,u)>d)continue;if(g){const m=new Set(ht({...s,edges:s.edges.map(E=>E.id===a?C:E)}).map(pt)),v=[...m].filter(E=>!g.has(E)).length,w=[...g].filter(E=>!m.has(E)).length;if(v>w)continue}const x=i.get(a);x&&r.updateWaypoints(x,y);break}}}function dg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ue(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Ue(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=fg(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Hp(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=Lt(n[0].x,n[1].x)&&!Lt(n[0].y,n[1].y),s=Lt(n[n.length-1].x,n[n.length-2].x)&&!Lt(n[n.length-1].y,n[n.length-2].y);for(const c of Vi){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function VR(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,l=n.y+n.height/2,u=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,y=[];for(const C of[0,...Vi])Math.abs(C)<i.width/2-5&&y.push({pts:[{x:f,y:l},{x:u+C,y:l},{x:u+C,y:h}],cost:Math.abs(C)}),Math.abs(C)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:p+C},{x:g,y:p+C}],cost:Math.abs(C)});return y}function zp(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,l=a?i.y+i.height:i.y,u=(r+o)/2,p=[];for(const f of[0,...Vi]){const d=u+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function hg(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=fi(t),r=t.edges.filter(d=>d.id!==e.id),o=ui(e,r);if(o===0)return null;const a=pi(e,r);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},p=u(e.waypoints),f=[...kc(e,n),...zp(e,n),...Hp(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(bn(h,i).length>0)continue;const y=ui(h,r),C=pi(h,r),x=o-y+(p-u(d));if(y>=o||C-a>x)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(C<s.cross||C===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:C,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function mg(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=ea(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function WR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=fi(t),r=t.edges.filter(f=>f.id!==e.id),o=mg(e,r);if(o===0)return null;const a=ui(e,r),s=pi(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),l=2;let u;const p=[...kc(e,n),...zp(e,n),...VR(e,n),...Hp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=mg(g,r);if(h>=o)continue;const y=ui(g,r);if(y-h>a-o)continue;const C=pi(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,fake:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function gg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=ht(Ue(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(pt(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=Ue(i),l=c.edges.find(f=>f.id===s);if(!l)continue;const u=WR(l,c);if(!u)continue;const p=i.get(s);p&&r.updateWaypoints(p,u)}}function yg(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 vg(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=ea(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:yg(e,n)&&yg(t,n)}function bg(e,t,n){let i=0;for(const r of t)r.id!==e.id&&vg(e,r,n)&&i++;return i}function UR(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=fi(t),r=t.edges.filter(f=>f.id!==e.id),o=bg(e,r,n);if(o===0)return null;const a=ui(e,r),s=pi(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),l=2;let u;const p=[...kc(e,n),...zp(e,n),...Hp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(bn(g,i).length>0)continue;const h=bg(g,r,n);if(h>=o)continue;const y=ui(g,r);if(y-h>a-o)continue;const C=pi(g,r);if(C-s>(o-h)*l)continue;const x=c(f);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&x<u.length))))&&(u={pts:f,chain:h,unreadable:y,cross:C,cost:d,length:x})}return(u==null?void 0:u.pts)??null}function qR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=ht(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(pt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!u||!p||!vg(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ue(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=UR(p,u);if(!f)continue;const d=i.get(l);d&&r.updateWaypoints(d,f)}}function xg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=ht(o).filter(u=>Dp(u)&&!t.has(pt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Dp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=o.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ue(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=hg(f,p);if(!d)continue;const g=i.get(u);g&&r.updateWaypoints(g,d)}}const YR=10,KR=(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 wg(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Mc(e,i))return null;const r=fi(t),o=i.flatMap(vn);for(const a of vn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Cc(a,o))s=s.flatMap(([h,y])=>{const C=[];return d>h&&C.push([h,Math.min(y,d)]),g<y&&C.push([Math.max(h,g),y]),C.filter(([x,m])=>m>x)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+YR*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-jm}:{x:a.at+An+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Mc({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&KR(f,d)))return f}return null}const An=8;function Gp(e,t){const n=e.label;if(!n)return null;const i=vn(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(vn),...t.shapes.filter(f=>f.container).flatMap(na)],l=f=>!c.some(d=>Gi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+An,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+An,s.at-An-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(l(h))return h}else for(const f of[s.at-An-n.height,s.at+An])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(l(h))return h}return null}const _g=30,XR=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n},Eg=(e,t)=>XR({x:e.x+e.width/2,y:e.y+e.height/2},t);function ZR(e,t){const n=e.label;if(!n)return null;const i=vn(e);if(!i.length)return null;const r=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(vn),...t.shapes.filter(c=>c.container).flatMap(na)],o=mo(t).filter(c=>c.owner!==e.id).map(c=>c.rect),a=(c,l)=>c.x<l.x+l.width&&l.x<c.x+c.width&&c.y<l.y+l.height&&l.y<c.y+c.height,s=c=>!r.some(l=>Gi(c,l))&&!Ja(c,t).length&&!o.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+An,c.at-An-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+An,c.at-An-n.width].map(p=>({...n,x:p,y:l-n.height/2}));for(const p of u)if(s(p))return p}return null}function Sg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Ue(n),o=new Set(ht(r).map(pt));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((E,P)=>E.x-u[P].x===d&&E.y-u[P].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const E=r.edges.find(L=>L.id===c);if(!(E!=null&&E.label)||!Ja(E.label,r).length)continue;let P={...E.label,x:l.label.x,y:l.label.y};if((Ja(P,r).length||Eg(P,E.waypoints)>_g)&&(P=null),!P&&Eg(E.label,E.waypoints)>_g&&(P=ZR(E,r)),!P)continue;const k=P,$={...r,edges:r.edges.map(L=>L.id===c?{...L,label:k}:L)},N=ht($);if(N.some(L=>!o.has(pt(L))))continue;i.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=$,o=new Set(N.map(pt));continue}const y=l.label.x+d-f.x,C=l.label.y+g-f.y;if(y===0&&C===0)continue;const x=r.edges.find(E=>E.id===c);if(!(x!=null&&x.label))continue;const m={...x.label,x:x.label.x+y,y:x.label.y+C},v={...r,edges:r.edges.map(E=>E.id===c?{...E,label:m}:E)},w=ht(v);w.some(E=>!o.has(pt(E)))||(i.moveElements([f],{x:y,y:C}),r=v,o=new Set(w.map(pt)))}}function Rg(e,t,n=new Set){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i);for(const a of o.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Gp(a,o);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&r.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function Cg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ue(i),a=ht(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(pt(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 l=wg(c,o);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&r.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function Mg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(vn),...t.shapes.filter(f=>f.container).flatMap(na)],r=i.filter(f=>Gi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=mo(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=>Gi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of r)f.axis==="h"?l.push({...n,y:f.at-An-n.height},{...n,y:f.at+An}):l.push({...n,x:f.at-An-n.width},{...n,x:f.at+An});const u=e.x+e.width/2,p=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+An},{...n,x:u-n.width/2,y:e.y-An-n.height},{...n,x:e.x+e.width+An,y:p-n.height/2},{...n,x:e.x-An-n.width,y:p-n.height/2}),l.find(c)??null}function Ag(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Ue(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Mg(o,Ue(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})}}function QR(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function Pg(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Ue(n),o=new Set(ht(r).map(pt));const a=[...new Set(ht(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(pt(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[h,y]of u){const C=h?r.shapes.find(m=>m.id===h):void 0;if(!C)continue;const x=QR(C,l[y]);x.x===l[y].x&&x.y===l[y].y||(l[y]=x,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ht(f);if(d.some(h=>!o.has(pt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),r=f,o=new Set(d.map(pt)))}}const Vp=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Tg(e,t){const n=(r,o,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>o?`${o}.${u}`:u;return{id:r,plainField:l(s),mapField:l(c),plain:a[s],map:a[c]}},i=e;switch(e.kind){case"participant.add":return[n(e.participant.id,"participant",e.participant),...(e.participant.lanes??[]).map((r,o)=>n(r.id,`participant.lanes[${o}]`,r))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((r,o)=>({...n(r.id,`lanes[${o}]`,r),omittedMeansRemove:(t==null?void 0:t.categoryOf(r.id))==="lane"}))];case"node.add":return[n(e.node.id,"node",e.node)];case"sequenceFlow.add":return[{...n(e.flow.id,"flow",e.flow),condition:e.flow.condition,conditionField:"flow.condition"}];case"sequenceFlow.update":return[{...n(e.id,"",i),condition:e.condition,conditionField:"condition"}];case"messageFlow.add":return[n(e.flow.id,"flow",e.flow)];case"dataStore.add":return[n(e.dataStore.id,"dataStore",e.dataStore)];case"annotation.add":return[n(e.annotation.id,"annotation",e.annotation,"text")];case"annotation.update":return[n(e.id,"",i,"text")];case"group.add":return[n(e.group.id,"group",e.group)];case"node.update":case"messageFlow.update":case"dataStore.update":case"group.update":return[n(e.id,"",i)];default:return[]}}function JR(e,t,n){const i=[],r=n?Ua(n):[];return e.forEach((o,a)=>{if(o.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:o.id,field:"locale"});return}if(!r.includes(o.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:o.id,field:"locale",locale:o.locale,locales:r});return}t.categoryOf(o.id)!==void 0&&!t.reviewRequestLocalesOf(o.id).includes(o.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:o.id,locale:o.locale});return}for(const s of Tg(o,t)){const c=s.plain!==void 0,l=s.map!==void 0;if(c&&l){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.mapField});continue}if(l&&s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-conflict",opIndex:a,id:s.id,field:s.conditionField});continue}if(!n){l&&i.push({kind:"locale-texts-not-enabled",opIndex:a,id:s.id,field:s.mapField});continue}if(c&&s.plain!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.plainField,locales:r});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:r});continue}if(!l)continue;if(!Vp(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):r.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:r}),p=!1);if(!p)continue;const f=r.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function vi(e,t,n){const i=t==="text"?"texts":"names",{[i]:r,...o}=e;return n===void 0?o:{...o,[t]:n}}function eC(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:r}=n,o=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Vp(c.map)){const l=c.map;return o(c.id).texts={...l},l[r]}if(c.plain===null||c.condition===null&&c.plain===void 0){o(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(o(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=o(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=Tg(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=vi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>vi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=vi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>vi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:vi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:vi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:vi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:vi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:vi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:vi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(vi(c,"text",a(l[0])));break;default:s.push(Vp(l[0].map)?vi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const tC=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,kg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Og={"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"]},{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}],"translation.confirm":[{path:"id",shape:null},{path:"locale",shape:null}],"element.remove":[{path:"id",shape:null}]},es=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Lc=e=>typeof e=="string"&&e!=="";function nC(e){const t=[];function n(i,r,o,a){if(a===null){Lc(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!es(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Lc(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a,s;if(!es(i)||!Lc(i.kind)||!(i.kind in Og)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const c of Og[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!es(f))break;f=f[g]}if(!es(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(r,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:r,field:c.path});continue}d.forEach((g,h)=>n(r,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;es(c)&&!Lc(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:r,field:"annotation.text"})}if(i.kind==="node.add"||i.kind==="node.update"){const c=i.band;c!==void 0&&(!Number.isInteger(c)||c<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const l=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!im(l)){t.push({kind:"node-type-unsupported",opIndex:r,id:u,type:l});return}const p=i.kind==="node.add"?(s=i.node)==null?void 0:s.eventDefinition:i.eventDefinition;if(p!==void 0&&!rm(p)){t.push({kind:"payload-invalid",opIndex:r,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:r,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function Dg(e,t,n={}){const i=nC(e);if(i.length>0)return i;const r=[],o=new Map,a=new Map;function s(h,y,C){if(!tC.test(y)){r.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||o.has(y)){r.push({kind:"id-duplicate",opIndex:h,id:y});return}o.set(y,{...C,opIndex:h})}e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(x=>x.id)});for(const x of h.participant.lanes??[])s(y,x.id,{category:"lane"});break;case"node.add":s(y,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(y,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,h.dataStore.id,{category:"dataStore"});for(const x of h.associations??[])x.id&&s(y,x.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(y,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(y,h.association.id,{category:"association"});break;case"annotation.add":s(y,h.annotation.id,{category:"annotation"}),(C=h.association)!=null&&C.id&&s(y,h.association.id,{category:"association"});break;case"group.add":s(y,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(x=>x.id));for(const x of h.lanes)t.categoryOf(x.id)===void 0&&s(y,x.id,{category:"lane"})}break}});const c=h=>{var y;return((y=o.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=o.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,C,x){const m=c(y);if(m===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:C});return}if(x&&!x.includes(m)){r.push({kind:"ref-category",opIndex:h,ref:y,role:C,expected:x.join("|"),actual:m});return}return m}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var C;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:x,lane:m}=h.node;if(x===void 0){(p||m!==void 0)&&r.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,x,"participant",["participant"])===void 0)break;m!==void 0&&((((C=o.get(x))==null?void 0:C.lanes)??a.get(x)??t.lanesOf(x)).includes(m)||r.push({kind:"lane-unknown",opIndex:y,lane:m,participant:x}));break}case"sequenceFlow.add":{const{id:x,source:m,target:v,name:w,condition:E}=h.flow,P=u(y,m,"source",["flowNode"]),k=u(y,v,"target",["flowNode"]);P&&k&&l(m)!==l(v)&&r.push({kind:"flow-cross-pool",opIndex:y,id:x}),w!==void 0&&E!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:x});break}case"messageFlow.add":{const{id:x,source:m,target:v}=h.flow,w=u(y,m,"source",["flowNode","participant"]),E=u(y,v,"target",["flowNode","participant"]);if(w&&E){const P=l(m),k=l(v);P!==void 0&&P===k&&r.push({kind:"message-flow-same-pool",opIndex:y,id:x})}for(const P of[m,v])d(P)&&r.push({kind:"message-flow-timer-endpoint",opIndex:y,id:x,ref:P});break}case"dataStore.add":{for(const x of h.associations??[]){if([x.source,x.target].filter(w=>w===h.dataStore.id).length!==1){r.push({kind:"data-association-ends",opIndex:y,source:x.source,target:x.target});continue}const v=x.source===h.dataStore.id?x.target:x.source;u(y,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:x,target:m}=h.association,v=u(y,x,"source"),w=u(y,m,"target");if(v&&w){const E=new Set([v,w]);E.has("dataStore")&&E.has("flowNode")||r.push({kind:"data-association-ends",opIndex:y,source:x,target:m})}break}case"association.add":{const{id:x,source:m,target:v}=h.association,w=u(y,m,"source"),E=u(y,v,"target");w&&E&&w!=="annotation"&&E!=="annotation"&&r.push({kind:"association-detached",opIndex:y,annotation:x??`${m}->${v}`});break}case"annotation.add":{if(h.association){const{source:x,target:m}=h.association;if(x!==h.annotation.id&&m!==h.annotation.id)r.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const v=x===h.annotation.id?m:x;u(y,v,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const x of h.group.members??[]){const m=u(y,x,"member");m&&kg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const x=t.lanesOf(h.id),m=h.lanes.map(w=>w.id);for(const w of x)m.includes(w)||r.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:w});for(const w of m)t.categoryOf(w)!==void 0&&!x.includes(w)&&r.push({kind:"id-duplicate",opIndex:y,id:w});const v=m.filter(w=>x.includes(w));v.length===x.length&&v.some((w,E)=>w!==x[E])&&r.push({kind:"lane-reorder-unsupported",opIndex:y,participant:h.id})}break}case"node.update":{if(g(y,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const x=t.participantOf(h.id);(x?a.get(x)??t.lanesOf(x):[]).includes(h.lane)||r.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:x??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&r.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const x=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,m=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),w=h.source??(v==null?void 0:v.source),E=h.target??(v==null?void 0:v.target);x&&m&&w!==void 0&&E!==void 0&&new Set([l(w),l(E),l(h.id)]).size>1&&r.push({kind:"flow-cross-pool",opIndex:y,id:h.id})}break}case"messageFlow.update":g(y,h.id,"messageFlow");break;case"dataStore.update":g(y,h.id,"dataStore");break;case"annotation.update":{if(g(y,h.id,"annotation")===void 0)break;h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.update":{if(g(y,h.id,"group")===void 0)break;for(const x of h.members??[]){const m=u(y,x,"member");m&&kg.has(m)&&r.push({kind:"ref-category",opIndex:y,ref:x,role:"member",expected:"shape",actual:m})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&r.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),r.push(...JR(e,t,n.i18n)),r;function g(h,y,C){if(o.has(y)){r.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const x=t.categoryOf(y);if(x===void 0){r.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(C&&x!==C){r.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:C,actual:x});return}return x}}function Lg(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"),spaceTool:e.get("spaceTool")}}function Ic(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Bc={"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]},Pn=10,iC=300,rC=160,Ig=20,Wp=100,Bg=40,oC=10,aC=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Ng(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,r=t.y+t.height/2;let o;for(const a of e.getAll()){if(a.type!=="bpmn:Lane")continue;const s=a;typeof s.x!="number"||typeof s.width!="number"||i>=s.x&&i<=s.x+s.width&&r>=s.y&&r<=s.y+s.height&&(!o||s.width*s.height<o.width*o.height)&&(o=s)}return o?{x:n.x,width:n.width,y:o.y,height:o.height}:void 0}const Nc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function $c(e,t,n,i,r){const o=n,a=Ng(e,t,i),s=a??i,c=(X,oe,te=s)=>{const[je,qe]=Bc[X];let He={x:t.x+t.width/2+je*(t.width/2+o.width/2+oe),y:t.y+t.height/2+qe*(t.height/2+o.height/2+oe)};const Se=te.x+Pn+o.width/2,Z=te.x+te.width-Pn-o.width/2,ie=te.y+Pn+o.height/2,V=te.y+te.height-Pn-o.height/2,Y={x:Math.min(Z,Math.max(Se,He.x)),y:Math.min(V,Math.max(ie,He.y))};return(Y.x!==He.x||Y.y!==He.y)&&(He=Math.abs(Y.x-(t.x+t.width/2))<(t.width+o.width)/2+Pn&&Math.abs(Y.y-(t.y+t.height/2))<(t.height+o.height)/2+Pn?{x:t.x+t.width+Pn+o.width/2,y:Y.y}:Y),He},l=(i.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="bpmn:Lane"&&X.type!=="label"&&typeof X.x=="number"&&X.id!==r.selfId),u=Ue(e),p=X=>{var te,je;if(!r.selfId)return!1;const oe=e.get(X);return!!oe&&(((te=oe.source)==null?void 0:te.id)===r.selfId||((je=oe.target)==null?void 0:je.id)===r.selfId)},f=u.edges.filter(X=>!p(X.id)).flatMap(vn),d=mo(u).filter(X=>X.owner!==r.selfId).map(X=>X.rect),g=X=>({x0:X.x-o.width/2-Pn,x1:X.x+o.width/2+Pn,y0:X.y-o.height/2-Pn,y1:X.y+o.height/2+Pn}),h=X=>{const oe=g(X);return l.some(te=>oe.x0<te.x+te.width&&oe.x1>te.x&&oe.y0<te.y+te.height&&oe.y1>te.y)},y=X=>{const oe=g(X);return f.some(te=>te.axis==="h"?te.at>oe.y0&&te.at<oe.y1&&te.lo<oe.x1&&te.hi>oe.x0:te.at>oe.x0&&te.at<oe.x1&&te.lo<oe.y1&&te.hi>oe.y0)},C=X=>{const oe=g(X);return d.some(te=>oe.x0<te.x+te.width&&oe.x1>te.x&&oe.y0<te.y+te.height&&oe.y1>te.y)},x=u.shapes.filter(X=>X.type==="bpmn:Group").flatMap(X=>[{axis:"h",at:X.y,lo:X.x,hi:X.x+X.width},{axis:"h",at:X.y+X.height,lo:X.x,hi:X.x+X.width},{axis:"v",at:X.x,lo:X.y,hi:X.y+X.height},{axis:"v",at:X.x+X.width,lo:X.y,hi:X.y+X.height}]),m=X=>{const oe=g(X);return x.some(te=>te.axis==="h"?te.at>oe.y0&&te.at<oe.y1&&te.lo<oe.x1&&te.hi>oe.x0:te.at>oe.x0&&te.at<oe.x1&&te.lo<oe.y1&&te.hi>oe.y0)},v=X=>h(X)||y(X)||C(X)||m(X),w=X=>X.x-o.width/2>=i.x&&X.x+o.width/2<=i.x+i.width&&X.y-o.height/2>=i.y&&X.y+o.height/2<=i.y+i.height,E=X=>w(X)&&(!a||Nc(X,o,a));if(r.placement){const X=Se=>Se.startsWith("top")?Se.replace(/^top/,"bottom"):Se.replace(/^bottom/,"top"),oe=Se=>Se.endsWith("left")?Se.replace(/left$/,"right"):Se.replace(/right$/,"left"),te=r.placement.side,je=[te,X(te),oe(te),X(oe(te)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=r.placement.offset??50;let He=c(te,qe);if(v(He)||a&&!Nc(He,o,a)){const Se=(Z,ie)=>{const V=new Set;for(const Y of je){if(V.has(Y))continue;V.add(Y);const ae=c(Y,qe,Z);if(ie(ae)&&!v(ae))return He=ae,!0}return!1};!Se(s,E)&&a&&Se(i,w)}return He}const P=r.from,k=s.x+Pn+o.width/2,$=s.x+s.width-Pn-o.width/2,N=s.y+Pn+o.height/2,L=s.y+s.height-Pn-o.height/2;let z={x:Math.min($,Math.max(k,P.x)),y:Math.min(L,Math.max(N,P.y))};if(v(z)){const X=(t.width+o.width)/2+Pn,te=[{x:z.x+X,y:z.y},{x:z.x-X,y:z.y},{x:z.x,y:z.y-o.height-Pn},{x:z.x,y:z.y+o.height+Pn}].filter(E).find(je=>!v(je));te&&(z=te)}return z}function en(e,t){return e.filter(n=>n.kind===t)}class $g extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function Fg(e,t){var FE,jE,HE,zE,GE,VE,WE,UE,qE,YE,KE,XE,ZE,QE,JE,e1,t1,n1,i1,r1,o1,a1,s1;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=b=>o.get(b),f=b=>{const S=p(b);if(!S)throw new Error(`하강 참조 해소 실패: ${b}`);return S},d=b=>{let S=b.parent;for(;S;){if(S.type==="bpmn:Participant")return S;S=S.parent}},g=new Map;for(const b of o.filter(S=>!("waypoints"in S&&S.waypoints)&&S.type!=="bpmn:Lane"&&S.type!=="label"&&typeof S.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=en(e,"participant.add"),y=en(e,"node.add"),C=en(e,"sequenceFlow.add"),x=en(e,"messageFlow.add"),m=en(e,"dataStore.add"),v=en(e,"dataAssociation.add"),w=en(e,"annotation.add"),E=en(e,"group.add"),P=new Map(y.map(b=>[b.node.id,b])),k=(b,S,A)=>{var F;const T=b.businessObject,D=(((F=T.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==S),O=A?[...D,i.create(S,A)]:D;if(!O.length){T.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:O});O.forEach(I=>{I.$parent=j}),n.updateProperties(b,{extensionElements:j})},$=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of en(e,"element.remove")){const S=p(b.id);S&&n.removeElements([S])}const N=b=>o.filter(S=>{var A;return S.type==="bpmn:Lane"&&((A=d(S))==null?void 0:A.id)===b}).sort((S,A)=>S.y-A.y);for(const b of en(e,"participant.update")){const S=f(b.id);if(b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),!b.lanes)continue;const A=N(b.id);if(!A.length){n.splitLane(S,b.lanes.length),N(b.id).forEach((D,O)=>{const j=b.lanes[O];j&&n.updateProperties(D,{id:j.id,name:j.name})});continue}const T=new Set(A.map(D=>D.id));b.lanes.forEach((D,O)=>{if(T.has(D.id)){n.updateProperties(f(D.id),{name:D.name});return}const j=O===0?n.addLane(N(b.id)[0],"top"):n.addLane(f(b.lanes[O-1].id),"bottom");n.updateProperties(j,{id:D.id,name:D.name})})}const L=150,z=130,X=80,oe=90,te=180,je=30,qe=30,He=(b,S,A,T,D)=>{const O=A-S.width/2,j=T-S.height/2;return(b.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(D!=null&&D.has(F.id))&&typeof F.x=="number"&&O<F.x+F.width+qe&&O+S.width+qe>F.x&&j<F.y+F.height&&j+S.height>F.y)},Se=new Set;for(const b of h){Se.add(`pool:${b.participant.id}`);for(const S of b.participant.lanes??[])Se.add(S.id)}const Z=new Map;for(const b of y){const S=b.node.lane??`pool:${b.node.participant??""}`;let A=Z.get(S);A||Z.set(S,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ie=new Map;for(const[b,S]of Z){if(!Se.has(b))continue;const A=[...S].sort((O,j)=>O-j),T=A.map((O,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),D=Math.min(...T);ie.set(b,new Map(A.map((O,j)=>[O,T[j]-D])))}{const b=new Map;for(const S of h)(S.participant.lanes??[]).forEach((A,T)=>b.set(A.id,T));for(const[S,A]of ie){if(!b.has(S)||A.size<2)continue;const T=b.get(S),D=A.get(0)??0,O=new Set;for(const ee of y){if(ee.node.lane!==S||(ee.band??0)!==0||!ee.node.type.endsWith("Gateway"))continue;const he={in:new Set,out:new Set,cross:new Set};for(const fe of C){const ye=fe.flow.source===ee.node.id;if(!ye&&fe.flow.target!==ee.node.id)continue;const Ye=P.get(ye?fe.flow.target:fe.flow.source);if(!Ye||Ye.node.participant!==ee.node.participant||!Ye.node.lane)continue;let Ae,J=!1;if(Ye.node.lane!==S){const se=b.get(Ye.node.lane);if(se===void 0)continue;Ae=se>T?"down":"up",J=!0}else{const se=A.get(Ye.band??0)??D;Ae=se>D?"down":se<D?"up":void 0}Ae&&(he[ye?"out":"in"].add(Ae),J&&he.cross.add(Ae))}for(const fe of["up","down"])he.in.has(fe)&&he.out.has(fe)&&he.cross.has(fe)&&O.add(fe)}if(O.size!==1)continue;const[j]=O,F=Math.max(...A.values()),I=j==="down"?F:0;if(D===I)continue;const W=[...A.entries()].filter(([ee])=>ee!==0).sort((ee,he)=>ee[1]-he[1]),K=[...Array(F+1).keys()].filter(ee=>ee!==I),re=new Map([[0,I]]);W.forEach(([ee],he)=>re.set(ee,K[he])),ie.set(S,re)}}const V=b=>{var S;return(((S=Z.get(b))==null?void 0:S.size)??0)>1},Y=b=>b.band??(b.node.lane||!V(`pool:${b.node.participant??""}`)?void 0:0),ae=new Map,me=b=>ae.get(b.node.id)??Y(b),Te=new Set,B=new Set;{const b=new Map;for(const T of C)b.set(T.flow.target,(b.get(T.flow.target)??0)+1);const S=T=>{const D=[],O=new Set([T]),j=[T];for(;j.length;){const F=j.shift();D.push(F);for(const I of C)I.flow.source!==F||O.has(I.flow.target)||(b.get(I.flow.target)??0)!==1||(O.add(I.flow.target),j.push(I.flow.target))}return D},A=(T,D)=>{var O;return((O=ie.get(T))==null?void 0:O.get(D))??D};for(const T of y){if(!T.node.type.endsWith("Gateway"))continue;const D=T.node.lane??`pool:${T.node.participant??""}`,O=ie.get(D);if(!O||O.size<2)continue;const j=me(T);if(j===void 0||A(D,j)!==A(D,0))continue;const F=A(D,j),I=C.filter(fe=>fe.flow.source===T.node.id).map(fe=>P.get(fe.flow.target)).filter(fe=>!!fe&&(fe.node.lane??`pool:${fe.node.participant??""}`)===D),W=I.filter(fe=>{const ye=me(fe);return ye!==void 0&&A(D,ye)===F&&(b.get(fe.node.id)??0)===1}),K=I.some(fe=>{const ye=me(fe);return ye!==void 0&&A(D,ye)>F});if(W.length!==1||!K)continue;const re=new Set(I.flatMap(fe=>S(fe.node.id)));if(!C.some(fe=>fe.flow.target===T.node.id&&re.has(fe.flow.source)))continue;const he=new Map;for(const[fe,ye]of O)he.set(fe,ye+1);he.set(-1,0),ie.set(D,he);for(const fe of S(W[0].node.id))P.has(fe)&&(ae.set(fe,-1),B.add(fe));Te.add(T.node.id)}}const R=(b,S)=>{var A;return((A=ie.get(b))==null?void 0:A.get(S))??S},_=(b,S,A,T)=>{const D=b?p(b):S?p(S):void 0;if(!D)return!1;const O=b?D.y+Math.min(D.height/2,oe):D.y+X;return Math.abs(O+R(b??`pool:${S??""}`,A)*L-T)<=L/2},G=new Map;for(const[b,S]of Z){let A=0;for(const T of S)A=Math.max(A,R(b,T));G.set(b,A)}const U=b=>te+L*b,ne=(b,S,A)=>{const T=u().children.filter(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="label"&&D.id!==S&&typeof D.y=="number"&&D.y>=b);T.length&&n.moveElements(T,{x:0,y:A})},Me=(b,S,A)=>{const T=b.type==="bpmn:Participant"?b:void 0;if(!T||T.children.some(F=>F.type==="bpmn:Lane"))return;const D=A+S.height/2+je-T.y;if(T.height>=D)return;const O=D-T.height,j=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:D}),ne(j,T.id,O)},Xe=(b,S)=>{const A=S-b.height;if(A<=0)return;const T=d(b)??b,D=[],O=I=>{D.push(I);for(const W of I.children??[])O(W)};O(T);const j=b.y+b.height-10,F=l.calculateAdjustments(D,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(b,S,A)=>{if(b){const j=f(b),F=U(S);if(j.height>=F)return;const I=F-j.height,W=d(j),K=W?W.y+W.height:j.y+j.height;Xe(j,F),ne(K,W==null?void 0:W.id,I);return}if(!A)return;const T=L*(S+1);if(A.height>=T)return;const D=T-A.height,O=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:T}),ne(O,A.id,D)},qt=new Map;for(const b of C)qt.set(b.flow.target,(qt.get(b.flow.target)??0)+1);const Et=b=>(qt.get(b)??0)<=1,mn=new Set(y.map(b=>b.node.id).filter(b=>en(e,"sequenceFlow.update").filter(S=>S.target===b).length===1&&!C.some(S=>S.flow.target===b||S.flow.source===b&&P.has(S.flow.target)))),Sn=new Map,Gn=(b,S)=>{if(!b)return;const A=p(b);if(!A||A.height>=U(S))return;const T=A.y+A.height-10,D=d(A);if(D)return new Set((D.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>T).map(O=>O.id))},Ct=(b,S,A)=>{if(!b)return!0;const T=p(b);return T?A-S.height/2>=T.y&&A+S.height/2<=T.y+T.height:!0},Qt=h.map((b,S)=>({op:b,declared:S}));Qt.sort((b,S)=>{const A=b.op.order??Number.POSITIVE_INFINITY,T=S.op.order??Number.POSITIVE_INFINITY;return A!==T?A-T:b.declared-S.declared});let wn=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(wn=Math.max(wn,b.y+b.height+60));for(const{op:b}of Qt){const S=b.participant,A=y.filter(ee=>ee.node.participant===S.id).length,T=((FE=S.lanes)==null?void 0:FE.length)??0,D=Math.max(1200,A*160+300),O=(S.lanes??[]).map(ee=>U(G.get(ee.id)??0)),j=O.reduce((ee,he)=>ee+he,0);T&&j<300&&(O[T-1]+=300-j);const F=Math.max(300,L*((G.get(`pool:${S.id}`)??0)+1)),I=S.blackBox||A+T===0?120:T?Math.max(300,j):F,W=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:S.id,name:S.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...S.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:D,height:I,isExpanded:!0}),K=n.createShape(W,{x:100+D/2,y:wn+I/2},u()),re=S.lanes??[];if(re.length&&n.splitLane(K,re.length),re.length){const ee=o.filter(he=>{var fe;return he.type==="bpmn:Lane"&&((fe=d(he))==null?void 0:fe.id)===S.id}).sort((he,fe)=>he.y-fe.y);if(ee.forEach((he,fe)=>{const ye=re[fe];ye&&n.updateProperties(he,{id:ye.id,name:ye.name})}),O.some(he=>he!==K.height/T)){let he=K.y;ee.forEach((fe,ye)=>{const Ye=O[ye];n.resizeShape(fe,{x:fe.x,y:he,width:fe.width,height:Ye}),he+=Ye})}}wn=K.y+K.height+60}const Fa=b=>{var T;const S=P.get(b);if(S)return S.node.participant??"";const A=p(b);return A?A.type==="bpmn:Participant"?A.id:((T=d(A))==null?void 0:T.id)??"":""},Vn=new Map,Ni=b=>{let S=Vn.get(b);return S||Vn.set(b,S={nodes:[],flows:[]}),S};for(const b of y)Ni(b.node.participant??"").nodes.push(b);for(const b of C)Ni(Fa(b.flow.source)).flows.push(b);const ai=b=>{var S;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((S=b.condition)==null?void 0:S.label)})},nn=(b,S,A)=>r.createShape({type:Ic(b.type),...b.eventDefinition?{eventDefinitionType:pc[b.eventDefinition]}:{},businessObject:i.create(Ic(b.type),{id:b.id,name:b.name,...S!==void 0?{"bwl:band":S}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Do=[...Qt.map(({op:b})=>b.participant.id).filter(b=>Vn.has(b)),...[...Vn.keys()].filter(b=>!h.some(S=>S.participant.id===b))],ja=b=>b.endsWith("Gateway");for(const b of Do){const S=Vn.get(b),A=b?f(b):void 0,T=A?A.x+150:250;let D=A?A.y+80:120;const O=(J,se,le)=>{if(J){const be=f(J);return be.y+Math.min(be.height/2,oe)+R(J,se??0)*L}return se!==void 0&&A?A.y+X+R(`pool:${b}`,se)*L:le},j=(J,se,le)=>{if(J){const be=f(J);return be.y+Math.min(be.height/2,oe)+se*L}return A?A.y+X+se*L:le},F=J=>J.participant?f(J.participant):u(),I=(J,se,le,be,Ze,Qe,kt,$t)=>{const xe=le!==void 0||be!==void 0,ve=Le=>{const _e=()=>mt(le,Le,A);$t?$t(_e):_e()},ce=R(le??`pool:${b}`,be??0);if((be===void 0||_(le,b,be,kt??Number.NaN))&&kt!==void 0&&Ct(le,se,kt)&&!He(J,se,Ze,kt))return{x:Ze,y:kt};if(xe)for(let Le=0;Le<4;Le++){const _e=j(le,ce+Le,Qe);if(!He(J,se,Ze,_e,Gn(le,ce+Le)))return ve(ce+Le),{x:Ze,y:_e}}const we=O(le,be,Qe);xe?ve(ce):$t?$t(()=>Me(J,se,se.y+se.height/2)):Me(J,se,we);let Be=Ze;for(let Le=0;Le<64;Le++){const _e=He(J,se,Be,we);if(!_e)break;Be=_e.x+_e.width+z+se.width/2}return{x:Be,y:we}},W=new Set(S.flows.map(J=>J.flow.target)),K=new Map,re=J=>{if(J===void 0)return;const se=o.get(J);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+z};for(const J of S.nodes){if(W.has(J.node.id))continue;const se=nn(J.node,J.band,J.afterColumn),le=Y(J),be=J.node.lane?`${J.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",Ze=F(J.node),Qe=K.get(be)??T,kt=re(J.afterColumn),$t=kt===void 0?Qe:Math.max(Qe,kt);let xe;const ve=I(Ze,se,J.node.lane,le,$t,D,void 0,mn.has(J.node.id)&&J.node.participant!==void 0?ce=>xe=ce:void 0);if(xe?n.createShape(se,ve,Ze,{autoResize:!1}):n.createShape(se,ve,Ze),xe){const ce=J.node.lane?f(J.node.lane):Ze;Sn.set(J.node.id,{container:ce,relCy:ve.y-ce.y,grow:xe})}K.set(be,ve.x+se.width+z),!J.node.lane&&le===void 0&&(D+=160)}const ee=new Set,he=new Map,fe=new Map,ye=new Map;if(b&&Se.has(`pool:${b}`)){const J=new Map;for(const xe of S.flows)J.set(xe.flow.target,(J.get(xe.flow.target)??0)+1);const se=xe=>O(xe.node.lane,me(xe),Number.NaN),le=new Set,be=xe=>{var we;const ve=(we=P.get(xe))==null?void 0:we.node.participant;if(ve)return p(ve);const ce=p(xe);if(ce)return ce.type==="bpmn:Participant"?ce:d(ce)},Ze=xe=>{const ve=[],ce=new Set([xe]),we=[xe];for(;we.length;){const Be=we.shift(),Le=P.get(Be);Le&&ve.push(Le);for(const _e of S.flows)_e.flow.source!==Be||ce.has(_e.flow.target)||(J.get(_e.flow.target)??0)!==1||(ce.add(_e.flow.target),we.push(_e.flow.target))}return ve},Qe=xe=>{if(!A)return;const ve=new Set(xe.map(Be=>Be.node.id));let ce=!1,we=!1;for(const Be of x){if(!ve.has(Be.flow.source))continue;const Le=be(Be.flow.target);!Le||Le.id===A.id||(Le.y<A.y?ce=!0:we=!0)}return ce&&!we?"up":we&&!ce?"down":void 0};for(const xe of S.nodes){if(!ja(xe.node.type))continue;const ve=O(xe.node.lane,Y(xe),Number.NaN);if(Number.isNaN(ve))continue;const ce=[];for(const _e of S.flows){if(_e.flow.source!==xe.node.id)continue;const rt=P.get(_e.flow.target);if(!rt||rt.node.lane!==xe.node.lane||(J.get(rt.node.id)??0)!==1)continue;const lt=Y(rt);if(lt===void 0)continue;const Jt=O(rt.node.lane,lt,Number.NaN);if(Number.isNaN(Jt))continue;const si=Ze(rt.node.id),nt=Qe(si);nt&&ce.push({subtree:si,band:lt,row:Jt,dir:nt})}if(!ce.some(_e=>_e.dir==="up")||!ce.some(_e=>_e.dir==="down")||!ce.some(_e=>_e.dir==="up"&&ce.some(rt=>rt.dir==="down"&&rt.row<_e.row)))continue;const Be=[...ce].sort((_e,rt)=>_e.row-rt.row);[...ce.filter(_e=>_e.dir==="up"),...ce.filter(_e=>_e.dir==="down")].sort((_e,rt)=>_e.dir===rt.dir?_e.row-rt.row:_e.dir==="up"?-1:1).forEach((_e,rt)=>{const lt=Be[rt].band;if(lt!==_e.band){le.add(xe.node.id);for(const Jt of _e.subtree)Y(Jt)===_e.band&&ae.set(Jt.node.id,lt)}})}const kt=xe=>{if(!A)return;const ve=new Set(xe.map(Be=>Be.node.id));let ce=!1,we=!1;for(const Be of x){if(!ve.has(Be.flow.target))continue;const Le=be(Be.flow.source);!Le||Le.id===A.id||(Le.y<A.y?ce=!0:we=!0)}return ce&&!we?"up":we&&!ce?"down":void 0};for(const xe of S.nodes){if(!ja(xe.node.type))continue;const ve=xe.node.lane??`pool:${b}`,ce=ie.get(ve);if(!ce||ce.size<2)continue;const we=ce.get(0);if(we===void 0)continue;const Be=Math.max(...ce.values()),Le=we===Be&&we!==0?"down":void 0;if(!Le)continue;const _e=[];for(const nt of S.flows){if(nt.flow.source!==xe.node.id)continue;const zt=P.get(nt.flow.target);if(!zt||zt.node.lane!==xe.node.lane||(J.get(zt.node.id)??0)!==1)continue;const Pe=me(zt);Pe!==void 0&&_e.push({t:zt,subtree:Ze(zt.node.id),band:Pe})}const rt=_e.find(nt=>(ce.get(nt.band)??nt.band)===we);if(!rt||kt(rt.subtree)===Le||Qe(rt.subtree)===Le)continue;const lt=_e.find(nt=>nt!==rt&&kt(nt.subtree)===Le);if(!lt)continue;const Jt=rt.band,si=lt.band;for(const nt of rt.subtree)me(nt)===Jt&&ae.set(nt.node.id,si);for(const nt of lt.subtree)me(nt)===si&&ae.set(nt.node.id,Jt);le.add(xe.node.id)}for(const xe of S.nodes){if(!ja(xe.node.type))continue;const ve=se(xe);if(Number.isNaN(ve)||w.some(_e=>{var rt,lt;return(((rt=_e.placement)==null?void 0:rt.anchor)??(_e.association?_e.association.source===_e.annotation.id?_e.association.target:_e.association.source:void 0))===xe.node.id&&((lt=_e.placement)==null?void 0:lt.side.startsWith("bottom"))}))continue;let we,Be=!1,Le;for(const _e of S.flows){if(_e.flow.source!==xe.node.id)continue;const rt=P.get(_e.flow.target);if(!rt||!rt.node.lane&&Y(rt)===void 0)continue;const lt=se(rt);Number.isNaN(lt)||(Math.abs(lt-ve)<.5&&(Be=!0),lt>ve?!we||lt>we.row?we={id:rt.node.id,row:lt,count:1}:lt===we.row&&we.count++:lt<ve&&rt.node.lane===xe.node.lane&&(!Le||lt>Le.row?Le={op:rt,row:lt,count:1}:lt===Le.row&&Le.count++))}we&&we.count===1&&(J.get(we.id)??0)===1&&!le.has(xe.node.id)&&ee.add(we.id),!Be&&Le&&Le.count===1&&(J.get(Le.op.node.id)??0)===1&&!Te.has(xe.node.id)&&he.set(Le.op.node.id,{lane:xe.node.lane,band:me(xe)})}const $t=new Map;for(const xe of x)$t.set(xe.flow.target,[...$t.get(xe.flow.target)??[],xe]);for(const xe of S.nodes){const ve=$t.get(xe.node.id);if(!ve||ve.length!==1||!J.get(xe.node.id)||!xe.node.lane&&Y(xe)===void 0||B.has(xe.node.id))continue;const ce=(jE=P.get(ve[0].flow.source))==null?void 0:jE.node.participant,we=ce?p(ce):void 0;if(!we||!A||we.id===A.id)continue;const Be=xe.node.lane??`pool:${b}`,Le=ie.get(Be);if(!Le)continue;const _e=Le.get(0)??0,rt=(Le.get(me(xe)??0)??_e)-_e;if(rt===0)continue;const lt=we.y<A.y;if(lt&&rt<0||!lt&&rt>0)continue;let Jt;for(const[si,nt]of Le){const zt=nt-_e;(lt&&zt<0&&(!Jt||zt<Jt.row)||!lt&&zt>0&&(!Jt||zt>Jt.row))&&(Jt={band:si,row:zt})}Jt&&fe.set(xe.node.id,{lane:xe.node.lane,band:Jt.band})}}const Ye=new Set;let Ae=0;for(;Ae++<S.nodes.length+2;){for(let le=0;le<S.nodes.length+S.flows.length+2;le++){let be=!1;for(const Ze of S.flows){const Qe=Ze.flow;if(Ye.has(Qe.id))continue;const kt=p(Qe.source);if(!kt)continue;const $t=p(Qe.target),xe=P.get(Qe.target);if(!$t&&xe){const ve=nn(xe.node,xe.band),ce=me(xe);if(xe.node.lane||ce!==void 0){const we=F(xe.node),Be=kt,Le=Be.x+(ye.get(Qe.source)??0)+Be.width+z,_e=he.get(Qe.target)??fe.get(Qe.target),rt=I(we,ve,_e?_e.lane:xe.node.lane,_e?_e.band:ce,ee.has(Qe.target)?Be.x+Be.width/2:Le,Number.NaN,_e||!Et(Qe.target)?void 0:Be.y+Be.height/2),lt=n.createShape(ve,rt,we);ee.has(Qe.target)&&ye.set(Qe.target,Le-(lt.x+lt.width/2)),n.connect(kt,lt,{type:"bpmn:SequenceFlow",businessObject:ai(Qe)})}else s.append(kt,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:ai(Qe)}})}else if($t)n.connect(kt,$t,{type:"bpmn:SequenceFlow",businessObject:ai(Qe)});else continue;Ye.add(Qe.id),be=!0}if(!be)break}const J=S.nodes.filter(le=>!p(le.node.id));if(!J.length)break;const se=J[0];{const le=nn(se.node,se.band),be=F(se.node),Ze=Y(se);n.createShape(le,I(be,le,se.node.lane,Ze,T,D),be),!se.node.lane&&Ze===void 0&&(D+=160)}}}const Rn=40,dt=b=>{const S=K=>K.kind==="label-over-line"||K.kind==="label-over-shape"||K.kind==="label-on-shared-segment"?K.edge===b.id:K.kind==="annotation-over-label"||K.kind==="pool-name-over-label"?K.label===b.id:!1,A=()=>new Set(ht(Ue(o)).filter(K=>!S(K)).map(K=>pt(K))),T=A(),D=b.waypoints.map(K=>({x:K.x,y:K.y})),O=b.label,j=O&&{x:O.x,y:O.y};n.layoutConnection(b,{waypoints:[]});const F=A(),I=[...F].filter(K=>!T.has(K)).length,W=[...T].filter(K=>!F.has(K)).length;I<=W||(n.updateWaypoints(b,D),O&&j&&(O.x!==j.x||O.y!==j.y)&&n.moveElements([O],{x:j.x-O.x,y:j.y-O.y}))},wt=5,ki=10,fE=200,ic=new Set([...C.map(b=>b.flow.id),...x.map(b=>b.flow.id),...en(e,"sequenceFlow.update").map(b=>b.id),...en(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),YN=(b,S,A,T,D,O)=>{const j=new Set(b.map(J=>J.id)),F=Math.min(...b.map(J=>J.x))+S-ki,I=Math.max(...b.map(J=>J.x+J.width))+S+fE+ki,W=Math.min(...b.map(J=>J.y+Math.min(0,...A)))-ki,K=Math.max(...b.map(J=>J.y+J.height+Math.max(0,...A)))+ki,re=o.getAll().filter(J=>{if(J.type!=="bpmn:SequenceFlow"&&J.type!=="bpmn:MessageFlow")return!1;const se=J;return ic.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||j.has(be.id)||be.x>=T)?!1:se.waypoints.some((be,Ze)=>{const Qe=se.waypoints[Ze+1];return!!Qe&&Math.max(be.x,Qe.x)>=F&&Math.min(be.x,Qe.x)<=I&&Math.max(be.y,Qe.y)>=W&&Math.min(be.y,Qe.y)<=K})});if(!re.length)return 0;const ee=J=>{const se=new Map;for(const le of b)for(const be of A){const Ze={id:le.id,type:le.type,x:le.x+S+J,y:le.y+be,width:le.width,height:le.height};for(const Qe of re){let kt=1/0;for(let xe=0;xe+1<Qe.waypoints.length;xe++)kt=Math.min(kt,Za(Qe.waypoints[xe],Qe.waypoints[xe+1],Ze));const $t=`${Qe.id}|${le.id}`;se.set($t,Math.min(se.get($t)??1/0,kt))}}return se},he=[...ee(0)].filter(([,J])=>J<=wt).map(([J])=>J);if(!he.length)return 0;let fe=0;for(let J=1;J<=fE;J++){const se=ee(J);if([...se.values()].every(le=>le>wt)&&he.every(le=>(se.get(le)??1/0)>=ki)){fe=J;break}}if(!fe)return 0;const ye=Math.min(...b.map(J=>J.x))+S+fe,Ye=new Set(he.map(J=>J.slice(0,J.indexOf("|"))));return re.some(J=>J.type==="bpmn:SequenceFlow"&&Ye.has(J.id)&&J.waypoints.some((se,le)=>{const be=J.waypoints[le+1];if(!be||Math.min(se.y,be.y)>O||Math.max(se.y,be.y)<O||se.y===be.y)return!1;const Ze=se.x+(O-se.y)*(be.x-se.x)/(be.y-se.y);return Ze>D&&Ze<ye}))?0:fe},Lo=(b,S=()=>!0)=>{const A=p(b);if(!A)return[];const T=[A],D=new Set([b]);for(let O=0;O<T.length;O++){const j=T[O].id;for(const F of C){const I=F.flow.target;if(F.flow.source!==j||D.has(I)||!P.has(I))continue;D.add(I);const W=p(I);W&&S(W)&&T.push(W)}}return T},KN=(b,S=()=>!0)=>{const A=p(b);if(!A)return[];const T=[A],D=new Set([b]);for(let O=0;O<T.length;O++){const j=T[O].id;for(const F of C){const I=F.flow.source;if(F.flow.target!==j||D.has(I)||!P.has(I))continue;D.add(I);const W=p(I);W&&S(W)&&T.push(W)}}return T},Oi=30,$i=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",Ku=(b,S)=>qp(n,b,S),rc=(b,S,A=!1)=>{const T=new Set(b.flatMap(I=>I.subtree.map(W=>W.id)));for(const I of b){const W=(I.pool.children??[]).filter($i).filter(re=>!T.has(re.id));if(I.subtree.some(re=>W.some(ee=>re.x+S<ee.x+ee.width+Oi&&re.x+S+re.width+Oi>ee.x&&re.y<ee.y+ee.height&&re.y+re.height>ee.y)))return null}const D=b.map(I=>I.pool.width),O=A?o.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(W=>({x:W.x,y:W.y}))})):[],j=o.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(b.flatMap(I=>I.subtree),{x:S,y:0});const F=b.map(I=>{const K=Math.max(...I.subtree.map(re=>re.x+re.width))+jg-(I.pool.x+I.pool.width);return K>0&&Ku(I.pool,I.pool.width+K),K});return()=>{n.moveElements(b.flatMap(I=>I.subtree),{x:-S,y:0}),b.forEach((I,W)=>{F[W]>0&&Ku(I.pool,D[W])});for(const{c:I,wps:W}of O){const K=I.waypoints??[];K.length===W.length&&K.every((ee,he)=>Math.abs(ee.x-W[he].x)<=.5&&Math.abs(ee.y-W[he].y)<=.5)||n.updateWaypoints(I,W.map(ee=>({x:ee.x,y:ee.y})))}for(let I=0;I<3;I++){let W=0;for(const K of j){const re=K.x-K.label.x,ee=K.y-K.label.y;Math.abs(re)<=.5&&Math.abs(ee)<=.5||(n.moveElements([K.label],{x:re,y:ee}),W++)}if(!W)break}}},qh=b=>{var D,O;const S=new Map,A=new Map;for(const j of o.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(S.set(F.id,F),A.set(F.id,[]))}for(const j of o.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(D=F.source)==null?void 0:D.id,W=(O=F.target)==null?void 0:O.id;I&&W&&A.has(I)&&A.get(I).push(W),I&&W&&A.has(W)&&A.get(W).push(I)}const T=[];for(const[j,F]of A)F.length&&F.every(I=>b.has(I))&&T.push(S.get(j));return T},dE=(b,S)=>{if(!b.length)return null;const A=new Set(b.map(K=>K.id)),T=o.getAll().filter(K=>K.type==="bpmn:Participant"&&!A.has(K.id)),D=Math.min(...T.filter(K=>(K.children??[]).length>0).map(K=>K.x)),O=new Set(b.filter(K=>Math.abs(K.x-D)<=2).map(K=>K.id));if(b.some(K=>{const re=O.has(K.id)?K.x:K.x+S,ee=O.has(K.id)?K.width+S:K.width;return T.some(he=>re<he.x+he.width+Oi&&re+ee+Oi>he.x&&K.y<he.y+he.height&&K.y+K.height>he.y)}))return null;const F=o.filter(K=>K.type==="label").map(K=>({label:K,x:K.x,y:K.y})),I=b.filter(K=>!O.has(K.id)),W=b.filter(K=>O.has(K.id)).map(K=>({pool:K,was:{x:K.x,y:K.y,width:K.width,height:K.height}}));I.length&&n.moveElements(I,{x:S,y:0});for(const{pool:K,was:re}of W)n.resizeShape(K,{...re,width:re.width+S});return()=>{for(const{pool:K,was:re}of W)n.resizeShape(K,re);I.length&&n.moveElements(I,{x:-S,y:0});for(let K=0;K<3;K++){let re=0;for(const ee of F){const he=ee.x-ee.label.x,fe=ee.y-ee.label.y;Math.abs(he)<=.5&&Math.abs(fe)<=.5||(n.moveElements([ee.label],{x:he,y:fe}),re++)}if(!re)break}}},hE=(b,S,A)=>{const T=A.x+A.width/2,D=S.y>A.y,O=D?A.y+A.height:A.y,j=D?S.y:S.y+S.height,F=b.source===S?[{x:T,y:j},{x:T,y:O}]:[{x:T,y:O},{x:T,y:j}],I=Ue(o),W={...I.edges.find(K=>K.id===b.id),waypoints:F};return bn(W,fi(I)).length?!1:(n.updateWaypoints(b,F),!0)},XN=()=>{const b=o.filter(D=>D.type==="bpmn:Participant"),S=Math.min(...b.filter(D=>(D.children??[]).length>0).map(D=>D.x)),A=D=>!!D&&D.type==="bpmn:Participant"&&!(D.children??[]).length&&Math.abs(D.x-S)<=2&&!h.some(O=>O.participant.id===D.id),T=new Set;for(const D of o.getAll()){if(D.type!=="bpmn:MessageFlow")continue;const O=D;if((O.waypoints??[]).length!==2)continue;const j=[O.source,O.target].find(I=>A(I)),F=j===O.source?O.target:O.source;j&&F&&F.type!=="bpmn:Participant"&&T.add(O.id)}return T},ZN=b=>{var A;const S=new Map;for(const T of b){const D=o.get(T);if(!D||(D.waypoints??[]).length===2)continue;const O=((A=D.source)==null?void 0:A.type)==="bpmn:Participant"?D.source:D.target,j=O===D.source?D.target:D.source;if(j.x+j.width/2<=O.x+O.width)continue;const F=S.get(O.id)??{pool:O,msgs:[]};F.msgs.push({conn:D,other:j}),S.set(O.id,F)}for(const{pool:T,msgs:D}of S.values()){const O=Math.max(...D.map(({other:fe})=>fe.x+fe.width/2))+Wp;if(o.getAll().some(fe=>{if(fe.type!=="bpmn:Participant"||fe.id===T.id)return!1;const ye=fe;return T.x<ye.x+ye.width+Oi&&O+Oi>ye.x&&T.y<ye.y+ye.height&&T.y+T.height>ye.y}))continue;const F={x:T.x,y:T.y,width:T.width,height:T.height},I=[...T.incoming??[],...T.outgoing??[]],W=I.map(fe=>({c:fe,wps:(fe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),K=I.flatMap(fe=>{const ye=fe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),re=ro();n.resizeShape(T,{...F,width:O-T.x});const ee=D.filter(({conn:fe,other:ye})=>hE(fe,T,ye)).length,he=ro();if(!(ee>0&&he.messages>re.messages&&he.lines>=re.lines)){n.resizeShape(T,F);for(const{c:fe,wps:ye}of W){const Ye=fe.waypoints??[];Ye.length===ye.length&&Ye.every((J,se)=>Math.abs(J.x-ye[se].x)<=.5&&Math.abs(J.y-ye[se].y)<=.5)||n.updateWaypoints(fe,ye.map(J=>({x:J.x,y:J.y})))}for(let fe=0;fe<3;fe++){let ye=0;for(const Ye of K){const Ae=Ye.x-Ye.label.x,J=Ye.y-Ye.label.y;Math.abs(Ae)<=.5&&Math.abs(J)<=.5||(n.moveElements([Ye.label],{x:Ae,y:J}),ye++)}if(!ye)break}}}},mE=()=>{let b=0;for(const S of o.getAll()){if(S.type!=="bpmn:DataInputAssociation"&&S.type!=="bpmn:DataOutputAssociation")continue;const A=S.waypoints??[];for(let T=1;T<A.length;T++)b+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return b},gE=()=>{let b=0;for(const S of o.getAll()){if(S.type!=="bpmn:Association")continue;const A=S.waypoints??[];for(let T=1;T<A.length;T++)b+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return b},QN=b=>{const S=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const T=A;if(b.has(T.id))continue;const O=[...T.incoming??[],...T.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===T?I.target:I.source);if(!O.length||O.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const W=I,K=[W.source,W.target];return K.some(re=>!re)?[]:K.map(re=>re.id)},F=O.flatMap(I=>j(I));F.length&&F.every(I=>b.has(I))&&S.push(T)}return S},yE=()=>ht(Ue(o)).filter(b=>b.kind==="edge-crosses-shape").length,vE=b=>{const S=(b.children??[]).filter($i);let A=0;for(let T=0;T<S.length;T++)for(let D=T+1;D<S.length;D++){const O=S[T],j=S[D];O.x<j.x+j.width&&O.x+O.width>j.x&&O.y<j.y+j.height&&O.y+O.height>j.y&&A++}return A},ro=()=>{const b=Ue(o),S=A=>A.length>=2&&(A.every(T=>Math.abs(T.x-A[0].x)<.01)||A.every(T=>Math.abs(T.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>S(A.waypoints)).length}},bE=b=>{const S=new Map;for(const T of o.getAll()){if(T.type!=="bpmn:MessageFlow")continue;const D=T;if(!D.waypoints||D.waypoints.length!==2)continue;const O=D.source,j=D.target;if(!O||!j)continue;const F=b.has(O.id);if(F===b.has(j.id))continue;const I=F?j:O,W=d(I);if(!W||b.has(I.id))continue;const K=S.get(W.id);K?I.x<K.minX&&(K.minX=I.x):S.set(W.id,{pool:W,minX:I.x})}const A=[];for(const{pool:T,minX:D}of S.values()){const O=(T.children??[]).filter(j=>$i(j)&&!b.has(j.id)&&j.x>=D);O.length&&A.push({subtree:O,pool:T})}return A},JN=(b,S,A)=>{const T=new Map(S.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),D=new Set(b);for(const j of S)for(const F of j.subtree)D.add(F.id);let O=!1;for(;;){let j=0;for(const F of bE(D)){if(F.pool===A)continue;const I=T.get(F.pool.id);I?I.subtree.push(...F.subtree):T.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const W of F.subtree)D.add(W.id);j+=F.subtree.length}if(!j)break;O=!0}return O?[...T.values()]:null},e$=(b,S)=>{const A=new Map;for(const D of o.getAll()){if(D.type!=="bpmn:DataInputAssociation"&&D.type!=="bpmn:DataOutputAssociation")continue;const O=D,j=O.waypoints;if(!j||j.length<2||!j.every(he=>Math.abs(he.x-j[0].x)<1))continue;const F=O.source,I=O.target;if(!F||!I)continue;const W=b.has(F.id);if(W===b.has(I.id))continue;const K=W?I:F,re=d(K);if(!re||re===S||re===d(W?F:I))continue;const ee=A.get(re.id);ee?K.x<ee.minX&&(ee.minX=K.x):A.set(re.id,{pool:re,minX:K.x})}const T=[];for(const{pool:D,minX:O}of A.values()){const j=(D.children??[]).filter(F=>$i(F)&&!b.has(F.id)&&F.x>=O);j.length&&T.push({subtree:j,pool:D})}return T},xE=b=>{const S=Ue(o),A=S.shapes.filter(D=>b.has(D.id)),T=new Set;for(const D of S.edges)if(!(D.type!=="bpmn:SequenceFlow"&&D.type!=="bpmn:MessageFlow"))for(const O of bn(D,A))T.add(`${D.id}|${O.id}`);return T},wE=new Map;for(const b of en(e,"sequenceFlow.update")){if(b.target===void 0)continue;const S=P.get(b.target);if(!S)continue;const A=p(b.target),T=p(b.id);if(!A||!T)continue;const D=b.source!==void 0?p(b.source):T.source,O=T.target;if(!D||!O||O.id===A.id)continue;const j=T.waypoints&&T.waypoints.length>=3&&Math.abs(T.waypoints[0].x-T.waypoints[1].x)<1&&Math.abs(T.waypoints[0].y-T.waypoints[1].y)>1?{x:T.waypoints[0].x,y:T.waypoints[0].y}:void 0,F=j?T.waypoints[1].y:void 0,I=j&&T.label?{x:T.label.x,y:T.label.y}:void 0,W=I&&T.label&&Math.abs(I.y+T.label.height/2-F)<=L/5&&I.x+T.label.width>j.x?I.x+T.label.width+6:void 0,K=(D.outgoing??[]).filter(Pe=>Pe.type==="bpmn:SequenceFlow"&&Pe.id!==T.id&&Pe.target&&!ic.has(Pe.id)),re=new Set(K.map(Pe=>Pe.target.id)),ee=Pe=>{const St={type:"bpmn:Task",x:Pe.x+2,y:Pe.y+2,width:Pe.width-4,height:Pe.height-4};return K.find(bt=>(bt.waypoints??[]).some((Cn,xt)=>!!bt.waypoints[xt+1]&&Za(Cn,bt.waypoints[xt+1],St)===0))},he=Lo(b.target),fe=new Set(he.map(Pe=>Pe.id)),ye=Sn.has(b.target)?{autoResize:!1}:void 0,Ye=Math.min(...he.map(Pe=>Pe.x)),Ae=Math.max(...he.map(Pe=>Pe.x+Pe.width)),J=D.x+D.width,se=O.x+O.width<=D.x,le=(()=>{if(!se)return;const Pe=d(A),St=((Pe==null?void 0:Pe.children)??[]).filter(et=>$i(et)&&!fe.has(et.id)&&et.type!=="bpmn:Group"&&et.type!=="bpmn:Participant"),bt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Cn=o.getAll().filter(et=>{if(!bt.includes(et.type))return!1;const Ft=et;return Ft.id===T.id||ic.has(Ft.id)||!Ft.waypoints||Ft.waypoints.length<2?!1:![Ft.source,Ft.target].some(It=>!It||fe.has(It.id))}),xt=(et,Ft)=>he.every(It=>{var $o;const yt={id:It.id,type:It.type,x:It.x+et,y:It.y+Ft,width:It.width,height:It.height};return Pe&&(yt.x<Pe.x||yt.x+yt.width>Pe.x+Pe.width||yt.y<Pe.y||yt.y+yt.height>Pe.y+Pe.height)||!Ct(($o=P.get(It.id))==null?void 0:$o.node.lane,It,It.y+Ft+It.height/2)||St.some(Wn=>yt.x<Wn.x+Wn.width+ki&&yt.x+yt.width+ki>Wn.x&&yt.y<Wn.y+Wn.height+ki&&yt.y+yt.height+ki>Wn.y)?!1:Cn.every(Wn=>{for(let rr=0;rr+1<Wn.waypoints.length;rr++)if(Za(Wn.waypoints[rr],Wn.waypoints[rr+1],yt)<ki)return!1;return!0})}),ct=D.x+D.width/2,Ot=D.y+D.height/2,ke=T.waypoints??[],_t=ke.length>=2&&Math.abs(ke[0].y-ke[1].y)<1&&ke[1].x<ke[0].x;return[...F!==void 0?[{cx:ct,cy:F}]:[],..._t?[{cx:D.x-Rn-A.width/2,cy:ke[0].y}]:[],{cx:ct,cy:Ot+L},{cx:ct,cy:Ot-L}].find(et=>xt(et.cx-(A.x+A.width/2),et.cy-(A.y+A.height/2)))})(),be=se&&!le?J:O.x,Ze=A.y+A.height/2,Qe=YN(he,J+Rn-Ye,[0,D.y+D.height/2-Ze,O.y+O.height/2-Ze],be,J,D.y+D.height/2),kt=J+Rn+Qe,$t=(()=>{if(W===void 0)return 0;const Pe=J+Rn,St=D.y+D.height/2-A.height/2,bt={x:Pe,y:St,width:Ae-Ye,height:A.height},Cn=d(D);return((Cn==null?void 0:Cn.children)??[]).some(ct=>$i(ct)&&!fe.has(ct.id)&&ct.id!==D.id&&ct.id!==O.id&&ct.type!=="bpmn:Group"&&ct.type!=="bpmn:Participant"&&ct.x<bt.x+bt.width&&ct.x+ct.width>bt.x&&ct.y<bt.y+bt.height&&ct.y+ct.height>bt.y)||ee(bt)?Math.max(0,W-Pe):0})(),xe=le?0:Ae-Ye+Rn*2+Qe+$t-(se?0:O.x-J);let ve=[];if(xe>0){const Pe=d(A),St=(Pe==null?void 0:Pe.children)??[],bt=ke=>ke.type==="bpmn:Lane";ve=(()=>{const ke=new Set;for(const De of St)$i(De)&&!fe.has(De.id)&&De.id!==D.id&&De.x>=be&&ke.add(De.id);const _t=[];for(const De of St){if(De.type!=="bpmn:DataStoreReference"&&De.type!=="bpmn:DataObjectReference")continue;const et=De,It=[...et.incoming??[],...et.outgoing??[]].filter(yt=>yt.type==="bpmn:DataInputAssociation"||yt.type==="bpmn:DataOutputAssociation").map(yt=>yt.source===et?yt.target:yt.source);It.length&&It.every(yt=>yt!==void 0&&ke.has(yt.id))&&_t.push(et)}return _t})();const xt=St.filter(ke=>!("waypoints"in ke&&ke.waypoints)&&!bt(ke)&&ke.type!=="label"&&!fe.has(ke.id)&&ke.id!==D.id&&ke.x>=be),ct=xt.flatMap(ke=>ke.labels??[]),Ot=Pe?[Pe,...St.filter(ke=>bt(ke))]:[];if(xt.length){const ke=new Set(xt.map(Ke=>Ke.id)),_t=bE(ke),De=_t.length?JN(ke,_t,Pe):null,et=Ke=>{const vt=new Set(ke);for(const Dt of Ke)for(const Sr of Dt.subtree)vt.add(Sr.id);return QN(vt)},Ft=et(_t),It=De?et(De):Ft,yt=qh(ke),$o=new Set(ke);for(const Ke of _t)for(const vt of Ke.subtree)$o.add(vt.id);const Wn=_t.length?qh($o):yt,rr=(()=>{if(!De)return[];const Ke=new Set(ke);for(const vt of De)for(const Dt of vt.subtree)Ke.add(Dt.id);return qh(Ke)})(),Ga=De??_t,Fo=(()=>{const Ke=new Set(ke);for(const vt of Ga)for(const Dt of vt.subtree)Ke.add(Dt.id);return e$(Ke,Pe)})(),tm=Fo.length?et([...Ga,...Fo]):Ft,Fi=new Set([...xt,...Ot].map(Ke=>Ke.id)),gt=St.filter(Ke=>{const vt=Ke.labelTarget;return Ke.type==="label"&&!!vt&&"waypoints"in vt&&!!vt.source&&!!vt.target&&Fi.has(vt.source.id)&&Fi.has(vt.target.id)}),_n=XN();n.createSpace([...xt,...ct,...gt],Ot,{x:xe,y:0},"e",be-1);const Yt=(Ke,vt,Dt)=>{const Sr=ro(),ep=Dt?xE(Dt):null,tp=rc(Ke,xe,!!Dt);if(!tp)return!1;const sc=vt.length?dE(vt,xe):null,np=ro(),Kt=!!Dt&&!!ep&&[...xE(Dt)].some(Ho=>!ep.has(Ho));return np.messages>Sr.messages&&np.lines>=Sr.lines&&!Kt?!0:(sc==null||sc(),tp(),!1)},ci=Fo.length>0&&Yt([...Ga,...Fo],De?rr:Wn,new Set(Fo.flatMap(Ke=>Ke.subtree.map(vt=>vt.id)))),jo=!ci&&De?Yt(De,rr):!1;let or=ci||jo;!or&&_t.length&&(or=Yt(_t,Wn));const Va=ci?tm:jo?It:Ft;if(!or){for(const Ke of _t){const vt=ro(),Dt=rc([Ke],xe);if(!Dt)continue;const Sr=ro();(Sr.messages<=vt.messages||Sr.lines<vt.lines)&&Dt()}if(yt.length){const Ke=ro(),vt=dE(yt,xe);if(vt){const Dt=ro();(Dt.messages<=Ke.messages||Dt.lines<Ke.lines)&&vt()}}}if(ZN(_n),Va.length){const Ke=()=>new Set(ht(Ue(o)).map(Dt=>pt(Dt))),vt=Dt=>{const Sr=gE(),ep=Ke(),tp=Dt.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),sc=o.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(Dt,{x:xe,y:0});const np=[...Ke()].filter(Kt=>!ep.has(Kt));if(gE()<Sr&&np.length===0)return!0;for(const{a:Kt,x:Ho,y:cc}of tp)(Kt.x!==Ho||Kt.y!==cc)&&n.moveElements([Kt],{x:Ho-Kt.x,y:cc-Kt.y});for(const Kt of sc){const Ho=Kt.x-Kt.label.x,cc=Kt.y-Kt.label.y;(Ho!==0||cc!==0)&&n.moveElements([Kt.label],{x:Ho,y:cc})}return!1};if(!vt(Va)&&Va.length>1)for(const Dt of Va)vt([Dt])}}}const ce=S.node.lane!==void 0?p(S.node.lane):S.node.participant!==void 0?p(S.node.participant):void 0,we=Pe=>{if(!ce)return!0;const St=Pe.y+Pe.height/2;return St>=ce.y&&St<=ce.y+ce.height},Be=!we(D)&&we(O)?O:D,Le=Be.y+Be.height/2,_e=Le-(A.y+A.height/2),rt=S.band!==void 0,lt=rt?[A]:he,Jt=(S.band===void 0||_(S.node.lane,S.node.participant,S.band,Le))&&Et(b.target)&<.every(Pe=>{var St;return Ct((St=P.get(Pe.id))==null?void 0:St.node.lane,Pe,Pe.y+Pe.height/2+_e)}),si=Pe=>Math.abs(Pe.y+Pe.height/2-(A.y+A.height/2))<=L/2;if(Jt&&rt){const Pe=Math.abs(_e)<=L/2?he.filter(St=>St.id!==A.id&&si(St)):[];if(n.moveElements(he,{x:kt-Ye,y:0},void 0,ye),n.moveElements([A],{x:0,y:_e},void 0,ye),Pe.length){const St=()=>new Set(ht(Ue(o)).map(ke=>pt(ke))),bt=St(),Cn=o.filter(ke=>ke.type==="label").map(ke=>({label:ke,x:ke.x,y:ke.y}));n.moveElements(Pe,{x:0,y:_e});const xt=St(),ct=[...xt].filter(ke=>!bt.has(ke)).length,Ot=[...bt].filter(ke=>!xt.has(ke)).length;if(ct>Ot){n.moveElements(Pe,{x:0,y:-_e});for(const ke of Cn){const _t=ke.x-ke.label.x,De=ke.y-ke.label.y;(_t!==0||De!==0)&&n.moveElements([ke.label],{x:_t,y:De})}}}}else n.moveElements(he,{x:kt-Ye,y:Jt?_e:0},void 0,ye);const nt=d(A);if(!Jt&&S.node.lane===void 0&&S.band!==void 0&&nt){const Pe=nt.y+X+R(`pool:${S.node.participant??""}`,S.band)*L,St=Pe-(A.y+A.height/2);St!==0&&!He(nt,A,A.x+A.width/2,Pe,fe)&&n.moveElements([A],{x:0,y:St},void 0,ye)}if(le)n.moveElements(he,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(nt){const Pe=(nt.children??[]).filter(xt=>$i(xt)&&!fe.has(xt.id)&&xt.type!=="bpmn:Group"&&xt.type!=="bpmn:Participant"),St=(xt,ct,Ot,ke,_t)=>xt.x+ct<_t.x+_t.width+ke&&xt.x+ct+xt.width+ke>_t.x&&xt.y+Ot<_t.y+_t.height+ke&&xt.y+Ot+xt.height+ke>_t.y,bt=Pe.find(xt=>St(A,0,0,0,xt)),Cn=bt?void 0:ee(A);if(bt||Cn){const xt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],ct=o.getAll().filter(gt=>{if(!xt.includes(gt.type))return!1;const _n=gt;return ic.has(_n.id)||!_n.waypoints||_n.waypoints.length<2?!1:![_n.source,_n.target].some(Yt=>!Yt||fe.has(Yt.id))}),Ot=(gt,_n,Yt)=>{var ci;return Ct((ci=P.get(gt.id))==null?void 0:ci.node.lane,gt,gt.y+Yt+gt.height/2)&>.x+_n>=nt.x&>.x+_n+gt.width<=nt.x+nt.width&>.y+Yt>=nt.y&>.y+Yt+gt.height<=nt.y+nt.height},ke=(gt,_n)=>he.every(Yt=>Ot(Yt,gt,_n)&&!Pe.some(ci=>St(Yt,gt,_n,ki,ci))&&ct.every(ci=>{const jo={id:Yt.id,type:Yt.type,x:Yt.x+gt,y:Yt.y+_n,width:Yt.width,height:Yt.height};for(let or=0;or+1<ci.waypoints.length;or++)if(Za(ci.waypoints[or],ci.waypoints[or+1],jo)<ki)return!1;return!0})),_t=A.y+A.height/2,De=[F,O.y+O.height/2].filter(gt=>gt!==void 0&&Math.abs(gt-_t)>=1),et=bt&&re.has(bt.id)?bt:Cn==null?void 0:Cn.target,Ft=et?et.x-A.x:0,It=Math.max(...he.map(gt=>gt.x+gt.width)),yt=[...Ft!==0?[Ft]:[],...Qe!==0?[-Qe]:[],0],$o=W===void 0?[]:yt.map(gt=>Math.max(gt,W-A.x)),Wn=gt=>It+gt+Rn<=O.x,rr=[...new Set([...$o,...yt])].filter(Wn),Ga=bt&&re.has(bt.id)?[bt.x+bt.width+Rn-A.x]:[],Fo=W===void 0?[]:Ga.map(gt=>Math.max(gt,W-A.x)),tm=[...new Set([...Fo,...Ga])].filter(gt=>Wn(gt)&&!rr.includes(gt));let Fi;for(const gt of[rr,tm]){for(const _n of De){for(const Yt of gt)if(ke(Yt,_n-_t)){Fi={dx:Yt,dy:_n-_t};break}if(Fi)break}if(Fi)break}if(Fi){const gt=Ke=>{const vt=Ke;return[vt.edge,vt.other,...Array.isArray(vt.edges)?vt.edges:[]].some(Dt=>typeof Dt=="string"&&ic.has(Dt))},_n=()=>new Set(ht(Ue(o)).filter(Ke=>!gt(Ke)).map(Ke=>pt(Ke))),Yt=_n(),ci=o.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y}));n.moveElements(he,{x:Fi.dx,y:Fi.dy},void 0,ye);const jo=_n(),or=[...jo].filter(Ke=>!Yt.has(Ke)).length,Va=[...Yt].filter(Ke=>!jo.has(Ke)).length;if(or>Va){n.moveElements(he,{x:-Fi.dx,y:-Fi.dy},void 0,ye);for(const Ke of ci){const vt=Ke.x-Ke.label.x,Dt=Ke.y-Ke.label.y;(vt!==0||Dt!==0)&&n.moveElements([Ke.label],{x:vt,y:Dt})}}else j&&wE.set(T.id,{exit:j,channelY:F,label:I})}}}{const Pe=new Set(he.map(ct=>ct.id)),St=new Set(C.map(ct=>ct.flow.id)),bt=20,Cn=ct=>{const Ot=ct.source,ke=ct.target,_t=Math.min(Ot.x,ke.x)-bt,De=Math.max(Ot.x+Ot.width,ke.x+ke.width)+bt,et=Math.min(Ot.y,ke.y)-bt,Ft=Math.max(Ot.y+Ot.height,ke.y+ke.height)+bt;return ct.waypoints.some(It=>It.x<_t||It.x>De||It.y<et||It.y>Ft)},xt=new Map;for(const ct of he)for(const Ot of[...ct.incoming??[],...ct.outgoing??[]])Ot.id!==b.id&&St.has(Ot.id)&&!(Pe.has(Ot.source.id)&&Pe.has(Ot.target.id))&&xt.set(Ot.id,Ot);for(const ct of xt.values())Cn(ct)&&dt(ct)}const zt=ve.length?d(ve[0]):void 0;if(zt){const Pe={assoc:mE(),overlaps:vE(zt),crosses:yE()},St=ve.map(De=>({st:De,x:De.x})),bt=o.filter(De=>De.type==="label").map(De=>({label:De,x:De.x,y:De.y})),Cn=Math.min(...ve.flatMap(De=>[...De.incoming??[],...De.outgoing??[]].filter(et=>et.type==="bpmn:DataInputAssociation"||et.type==="bpmn:DataOutputAssociation").map(et=>(et.source===De?et.target:et.source).x))),xt=new Set(ve.map(De=>De.id)),ct=(zt.children??[]).filter($i).filter(De=>!xt.has(De.id));let Ot=Cn;for(const De of[...ve].sort((et,Ft)=>et.x-Ft.x)){let et=Ot;for(let Ft=0;Ft<100;Ft++){const It=ct.find(yt=>et<yt.x+yt.width+Oi&&et+De.width+Oi>yt.x&&De.y<yt.y+yt.height&&De.y+De.height>yt.y);if(!It)break;et=It.x+It.width+Oi}et!==De.x&&n.moveElements([De],{x:et-De.x,y:0}),Ot=et+De.width+Oi}const ke=Ot+150-(zt.x+zt.width);ke>0&&Ku(zt,zt.width+ke);const _t={assoc:mE(),overlaps:vE(zt),crosses:yE()};if(_t.assoc>=Pe.assoc||_t.overlaps>Pe.overlaps||_t.crosses>Pe.crosses){for(const{st:De,x:et}of St)De.x!==et&&n.moveElements([De],{x:et-De.x,y:0});ke>0&&Ku(zt,zt.width-ke);for(const De of bt){const et=De.x-De.label.x,Ft=De.y-De.label.y;(et!==0||Ft!==0)&&n.moveElements([De.label],{x:et,y:Ft})}}}}for(const[b,S]of Sn){const A=p(b);if(!A)continue;const T=S.container,D=Math.abs(A.y+A.height/2-T.y-S.relCy)>=.5,O=A.label,j=Math.min(A.y,O&&!O.hidden?O.y:A.y),F=Math.max(A.y+A.height,O&&!O.hidden?O.y+O.height:0);if(D&&j>=T.y&&F<=T.y+T.height)continue;const I=A.y;S.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const _E=(b,S)=>{const A=S.target===b,T=f(S.source),D=f(S.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(T,D,S.id?{type:O,businessObject:i.create(O,{id:S.id})}:{type:O})},EE=b=>{for(const S of h){if(!S.participant.blackBox)continue;const A=p(S.participant.id);if(!A)continue;const T=[];for(const O of x){const j=O.flow.source===S.participant.id?O.flow.target:O.flow.target===S.participant.id?O.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&T.push(F)}if(!T.length)continue;if(!b&&S.order===void 0){const O=(()=>{var F;const j=new Map;for(const I of T){const W=d(I);if(!W)continue;const K=j.get(W.id);K?K.n+=1:j.set(W.id,{shape:W,n:1})}return(F=[...j.values()].sort((I,W)=>W.n-I.n)[0])==null?void 0:F.shape})();if(O){const j=W=>W.reduce((K,re)=>K+re,0)/W.length,F=j(T.map(W=>W.y+W.height/2))<O.y+O.height/2,I=o.filter(W=>W.type==="bpmn:Participant"&&W.id!==S.participant.id&&W.id!==O.id).filter(W=>F?W.y+W.height<=O.y+5:W.y>=O.y+O.height-5);if(I.length){const W=[...I.reduce((le,be)=>le.set(be.y,(le.get(be.y)??0)+1),new Map)].sort((le,be)=>be[1]-le[1]||(F?be[0]-le[0]:le[0]-be[0]))[0][0],K=Math.min(A.width,iC),re=rC,ee=T.map(le=>le.x+le.width/2),he=Math.round(j(ee)-K/2),fe=Math.max(...ee)+Wp,ye=le=>({x:le,width:Math.max(K,fe-le)}),Ye=I.filter(le=>Math.min(le.y+le.height,W+re)-Math.max(le.y,W)>0),Ae=le=>{const be=ye(le);return Ye.some(Ze=>Ze.x<be.x+be.width&&be.x<Ze.x+Ze.width)},J=le=>{const be=ye(le);return ee.filter(Ze=>Ze>=be.x+10&&Ze<=be.x+be.width-10).length},se=(()=>{if(!Ae(he))return he;const le=J(he);return Ye.flatMap(be=>[be.x+be.width+Ig,be.x-Ig-K]).map(be=>Math.round(be)).filter(be=>!Ae(be)&&J(be)>=le).sort((be,Ze)=>Math.abs(be-he)-Math.abs(Ze-he))[0]??he})();if(se!==A.x||W!==A.y||K!==A.width||re!==A.height){const le=()=>new Set(ht(Ue(o)).map(xe=>pt(xe))),be=le(),Ze={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:se,y:W,width:K,height:re});const Qe=le(),kt=[...Qe].filter(xe=>!be.has(xe)).length,$t=[...be].filter(xe=>!Qe.has(xe)).length;kt>$t&&n.resizeShape(A,Ze)}}}}const D=Math.max(...T.map(O=>O.x+O.width/2))+Wp;if(D>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:D-A.x,height:A.height}),!!b)for(const O of x){const j=p(O.flow.id),F=O.flow.source===S.participant.id?O.flow.target:O.flow.target===S.participant.id?O.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const W=I.x+I.width/2;W<A.x+10||W>A.x+A.width-10||hE(j,A,I)}}};EE(!1);for(const b of x){const S=b.flow;n.connect(f(S.source),f(S.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:S.id,name:S.name})})}{const A=new Set([...C.map(I=>I.flow.id),...x.map(I=>I.flow.id)].filter(I=>!!I)),T=o.filter(I=>!!I.waypoints),D=(I,W)=>Math.abs(W.x-I.x)<2?"L":Math.abs(W.x-(I.x+I.width))<2?"R":Math.abs(W.y-I.y)<2?"T":Math.abs(W.y-(I.y+I.height))<2?"B":void 0,O=new Map,j=(I,W,K)=>{if(!I||!W||typeof I.x!="number")return;const re=D(I,W);if(!re)return;let ee=O.get(I.id);ee||O.set(I.id,ee=new Map),ee.set(re,[...ee.get(re)??[],K])};for(const I of T){const W=I.waypoints;!W||W.length<2||(j(I.source,W[0],{id:I.id,dir:"out"}),j(I.target,W[W.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,W]of O){const K=p(I);if(!K||typeof K.x!="number"||![...W.values()].some(Ae=>{const J=Ae.filter(se=>se.dir==="in");return Ae.length>=3&&J.length>=1&&Ae.some(se=>se.dir==="out")&&J.some(se=>A.has(se.id))}))continue;const ee=d(K);if(!ee||F.has(ee.id)||(ee.children??[]).some(Ae=>Ae.type==="bpmn:Lane"))continue;const he=(HE=W.get("T"))!=null&&HE.length?(zE=W.get("B"))!=null&&zE.length?void 0:"B":"T";if(!he||(he==="T"?K.y-ee.y:ee.y+ee.height-(K.y+K.height))>=L)continue;const ye=(ee.children??[]).filter(Ae=>!("waypoints"in Ae&&Ae.waypoints)&&Ae.type!=="label"&&typeof Ae.x=="number"),Ye=ee.y+ee.height;n.resizeShape(ee,{x:ee.x,y:ee.y,width:ee.width,height:ee.height+L}),ne(Ye,ee.id,L),he==="T"&&ye.length&&n.moveElements(ye,{x:0,y:L}),F.add(ee.id)}}const Yh=20,SE=4,t$=3,n$=2,i$=[10,30,80],oo=()=>{const b=Ue(o);return{bad:ht(b).filter(S=>S.kind==="edge-crosses-shape"||S.kind==="edge-overlap-opposite"||S.kind==="edge-overlap-mixed").length,crossings:Um(b),straight:b.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length}},Ha=b=>{const S=Ue(o),A=S.edges.find(T=>T.id===b);return A?bn(A,fi(S)).length:0},Xu=b=>Ha(b)>0,Zu=b=>Ue(o).edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.id!==b&&S.waypoints.length===2).length,r$=(b,S,A)=>rc([{subtree:b,pool:S}],A),RE=(b,S)=>S.bad>b.bad||S.crossings>b.crossings&&S.straight<=b.straight&&S.bad>=b.bad,za=(b,S)=>RE(b,S)||S.straight<b.straight,Io=(b,S,A=()=>!0,T=RE,D=!1)=>{const O=oo(),j=rc(b,S,D);if(!j)return!1;const F=oo();return T(O,F)||!A()?(j(),!1):!0},o$=(b,S,A,T=()=>!0)=>Io([{subtree:b,pool:S}],A,T),Bo=b=>{var S;return!!((S=P.get(b))!=null&&S.node.participant)},oc=new Map;for(const b of x){if(!Bo(b.flow.target))continue;const S=oc.get(b.flow.target)??[];S.push(b),oc.set(b.flow.target,S)}const Qu=[...oc.keys()],Kh=new Set(C.map(b=>b.flow.target)),CE=b=>Qt.findIndex(({op:S})=>S.participant.id===b);Qu.sort((b,S)=>{var D,O;const A=Kh.has(b)?1:0,T=Kh.has(S)?1:0;return A!==T?A-T:CE((D=P.get(b))==null?void 0:D.node.participant)-CE((O=P.get(S))==null?void 0:O.node.participant)});const ao=b=>b.x+b.width/2,a$=b=>{const S=new Map;for(const D of o.getAll()){const O=D;if(!O.waypoints||!O.source||!O.target)continue;(S.get(O.source.id)??S.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([b]),T=[b];for(let D=0;D<T.length;D++)for(const O of S.get(T[D])??[])A.has(O)||(A.add(O),T.push(O));return A},s$=(b,S)=>{const A=a$(S);let T;for(const D of o.getAll()){const O=D;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==b||A.has(O.source.id))continue;const j=O.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=ao(j);(T===void 0||F>T)&&(T=F)}return T},Xh=(b,S)=>{const A=p(b.flow.source);if(A)return A.type==="bpmn:Participant"?s$(A.id,S):ao(A)},ME=b=>{let S;for(const A of oc.get(b)??[]){const T=Xh(A,b);T!==void 0&&(!S||T>S.cx)&&(S={op:A,cx:T})}return S==null?void 0:S.op},c$=b=>{const S=ME(b),A=p(b),T=S?Xh(S,b):void 0;return A&&T!==void 0?T-ao(A):void 0},l$=b=>{const S=c$(b);return S!==void 0&&Math.abs(S)<Yh},Zh=(b,S,A,T,D)=>{var O;for(let j=!0;j;){j=!1;for(const F of x){if(F.flow.id===A)continue;const I=S.has(F.flow.source),W=S.has(F.flow.target);if(I===W||T(I?F.flow.source:F.flow.target))continue;const K=I?F.flow.target:F.flow.source;if(D(K)||!Bo(K))continue;const re=p(F.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const ee=p(K),he=(O=P.get(K))==null?void 0:O.node.participant;if(!ee||!he)continue;const fe=Lo(K,ye=>ye.x>=ee.x).filter(ye=>!S.has(ye.id));if(!(!fe.length||fe.some(ye=>D(ye.id)))){for(const ye of fe)S.add(ye.id);b.set(he,[...b.get(he)??[],...fe]),j=!0}}}return[...b].map(([j,F])=>({subtree:F,pool:f(j)}))},AE=(b,S,A,T,D)=>Zh(new Map([[S,[...b]]]),new Set(b.map(O=>O.id)),T,O=>O===A,O=>O===D),Qh=b=>{const S=ME(b);if(!S)return null;const A=p(b),T=p(S.flow.source),D=Xh(S,b);if(!A||!T||D===void 0)return null;const O=D-ao(A);if(O>=Yh){const j=P.get(b).node.participant,F=Lo(b,I=>I.x>=A.x);return{groups:AE(F,j,b,S.flow.id,S.flow.source),dx:O}}if(-O>=Yh&&Bo(S.flow.source)){const j=P.get(S.flow.source).node.participant,F=Lo(S.flow.source,I=>I.x>=T.x&&!l$(I.id));return{groups:AE(F,j,S.flow.source,S.flow.id,b),dx:-O}}return null},PE=()=>Qu.map(b=>({id:b,plan:Qh(b)})).filter(b=>!!b.plan).sort((b,S)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))-Math.min(...S.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))).map(b=>b.id);for(let b=0;b<3;b++){const S=oo(),A=[];for(const D of PE()){const O=Qh(D);if(!O)continue;const j=rc(O.groups,O.dx);j&&A.push(j)}if(!A.length)break;if(!za(S,oo()))continue;for(const D of A.reverse())D();let T=!1;for(const D of PE()){const O=Qh(D);O&&Io(O.groups,O.dx,()=>!0,za)&&(T=!0)}if(!T)break}for(const b of Qu){if(Kh.has(b))continue;const S=P.get(b);if(!S||S.node.lane!==void 0)continue;const A=Y(S);if(A===void 0)continue;const T=p(b),D=T?d(T):void 0;if(!T||!D)continue;const O=D.y+X+R(`pool:${S.node.participant??""}`,A)*L,j=O-(T.y+T.height/2);j!==0&&!He(D,T,T.x+T.width/2,O)&&n.moveElements([T],{x:0,y:j})}const TE=new Set;for(let b=0,S=!0;S&&b<t$;b++){S=!1;for(const A of Qu.flatMap(T=>oc.get(T)??[])){if(TE.has(A.flow.id)||!Xu(A.flow.id))continue;const T=p(A.flow.target);if(!T)continue;const D=f(P.get(A.flow.target).node.participant),O=Lo(A.flow.target,W=>W.x>=T.x),j=T.width+z,F=Ha(A.flow.id),I=Zu(A.flow.id);for(let W=1;W<=SE;W++){const K=()=>Ha(A.flow.id)<F&&Zu(A.flow.id)>=I;if(o$(O,D,j*W,K)){TE.add(A.flow.id),S=!0;break}}}}const Jh=x.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),kE=new Set(Jh.map(b=>b.id));for(const b of o.filter(S=>S.type==="bpmn:MessageFlow"))kE.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&Jh.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of Jh){if(!Xu(b.id))continue;const S=p(b.source),A=p(b.target);if(!S||!A)continue;let T,D,O;if(b.preexisting){const[F,I]=S.type==="bpmn:Participant"?[A,S]:[S,A];if(T=ao(F),T<I.x||T>I.x+I.width)continue;[D,O]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.y]}else{if(S.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(T=S.x+S.width/2,Math.abs(T-(A.x+A.width/2))>15))continue;[D,O]=S.y<A.y?[S.y+S.height,A.y]:[A.y+A.height,S.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==S.id&&F.id!==A.id).filter(F=>F.x<=T&&T<=F.x+F.width&&F.y+F.height>D&&F.y<O).sort((F,I)=>F.x-I.x);for(const F of j){const I=(GE=P.get(F.id))==null?void 0:GE.node.participant,W=I?p(I):void 0;if(!I||!W)continue;const K=[...P.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),re=se=>se.map(le=>p(le)).filter(le=>!!le),he=[KN(F.id,se=>{var le;return((le=P.get(se.id))==null?void 0:le.node.participant)===I}),re(K)].filter(se=>se.length).map(se=>[{subtree:se,pool:W}]);if(b.preexisting){const se=re(K);se.length&&he.push(Zh(new Map([[I,[...se]]]),new Set(se.map(le=>le.id)),b.id,()=>!1,le=>le===S.id||le===A.id))}const fe=F.width+z,ye=Ha(b.id),Ye=Zu(b.id),Ae=()=>Ha(b.id)<ye&&Zu(b.id)>=Ye;let J=!1;for(const se of he){for(let le=1;le<=SE;le++)if(Io(se,fe*le,Ae)){J=!0;break}if(J)break}if(!Xu(b.id))break}}const Ju=()=>{var S;const b=new Set;for(const A of ht(Ue(o)))A.kind!=="edge-crosses-shape"||kE.has(A.edge)||((S=p(A.edge))==null?void 0:S.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},u$=(b,S)=>oo().bad>=b&&[...Ju()].some(A=>!S.has(A)),OE=b=>{var S,A;return Ha(b)===0&&((A=(S=p(b))==null?void 0:S.waypoints)==null?void 0:A.length)===2},p$=(b,S,A)=>{const T=new Set(b.flatMap(O=>O.subtree.map(j=>j.id))),D=[...Ju()].filter(O=>!A.has(O)).map(O=>O.split(">")[1]);return[...new Set(D)].filter(O=>T.has(O)&&O!==S.source&&O!==S.target)},f$=(b,S,A,T,D)=>{const O=b.map(W=>({...W,subtree:W.subtree.filter(K=>!D.includes(K.id))})).filter(W=>W.subtree.length),j=new Set(O.flatMap(W=>W.subtree.map(K=>K.id))),F=()=>D.every(W=>{const K=p(W);return!!K&&C.filter(re=>re.flow.target===W&&j.has(re.flow.source)).every(re=>{const ee=p(re.flow.source);return!!ee&&ee.x+ee.width<=K.x})});return Io(O,S,()=>OE(A.id)&&[...Ju()].every(W=>T.has(W))&&F(),za,!0)};for(const b of x){if(!Xu(b.flow.id))continue;const S=p(b.flow.id);if(((VE=S==null?void 0:S.waypoints)==null?void 0:VE.length)!==2)continue;const A=p(b.flow.source),T=p(b.flow.target);if(!A||!T||A.type==="bpmn:Participant"||T.type==="bpmn:Participant"||!Bo(b.flow.source)||!Bo(b.flow.target)||Math.abs(ao(A)-ao(T))>n$)continue;const D=ao(A),O=S.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...O),Math.max(...O)],I=fi(Ue(o)).filter(ye=>ye.id!==A.id&&ye.id!==T.id&&ye.x<D&&D<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const W=(WE=P.get(b.flow.source))==null?void 0:WE.node.participant,K=(UE=P.get(b.flow.target))==null?void 0:UE.node.participant;if(!W||!K)continue;const re=new Map;for(const[ye,Ye,Ae]of[[b.flow.source,A,W],[b.flow.target,T,K]]){const J=re.get(Ae)??[],se=Lo(ye,le=>le.x>=Ye.x).filter(le=>!J.some(be=>be.id===le.id));re.set(Ae,[...J,...se])}const ee=new Set([...re.values()].flat().map(ye=>ye.id)),he=Zh(re,ee,b.flow.id,ye=>ye===b.flow.source||ye===b.flow.target,()=>!1),fe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of i$){const Ye=fe+ye-D;if(Ye<=0)continue;const Ae=oo().bad,J=Ju();let se=[],le=!0;const be=()=>!OE(b.flow.id)||le&&(se=p$(he,b.flow,J),se.length)?!1:!u$(Ae,J);if(Io(he,Ye,be,za))break;if(se.length&&(f$(he,Ye,b.flow,J,se)||(le=!1,Io(he,Ye,be,za))))break}}{const b=A=>A.y+A.height/2,S=[];for(const A of P.keys()){if(!Bo(A))continue;const T=C.filter(j=>j.flow.target===A);if(T.length!==1)continue;const D=p(T[0].flow.source),O=p(A);!D||!O||!P.has(D.id)||Math.abs(b(D)-b(O))>1||O.x-(D.x+D.width)<=z+1||S.push({id:A,pred:D,node:O})}S.sort((A,T)=>A.node.x-T.node.x);for(const{id:A}of S){const T=P.get(A),D=p(A),O=p(C.find(ee=>ee.flow.target===A).flow.source);if(!D||!O)continue;const j=D.x-(O.x+O.width);if(j<=z+1)continue;const F=f(T.node.participant),I=Lo(A,ee=>ee.x>=D.x),W=oo(),K=r$(I,F,-(j-z));if(!K)continue;const re=oo();(re.bad>W.bad||re.crossings>=W.crossings||re.straight<W.straight)&&K()}}EE(!0);const d$=10,h$=400,m$=b=>[...b.incoming??[],...b.outgoing??[]].filter(S=>S.type==="bpmn:DataInputAssociation"||S.type==="bpmn:DataOutputAssociation").map(S=>S.source===b?S.target:S.source).filter(S=>!!S&&typeof S.y=="number"),g$=o.filter(b=>b.type==="bpmn:DataStoreReference"&&g.has(b.id)),y$=(b,S)=>{const A=b.x+b.width/2,T=b.y+b.height/2;let D;for(const O of g$){if((d(O)??u())!==S||O.y<b.y+b.height)continue;const j=Math.abs(O.x+O.width/2-A);j>h$||j<O.width||!m$(O).some(I=>I.height===b.height&&Math.abs(I.y+I.height/2-T)<=d$&&O.y>=I.y+I.height)||(!D||j<D.dx||j===D.dx&&O.id<D.id)&&(D={dx:j,id:O.id,cy:O.y+O.height/2})}return D==null?void 0:D.cy};for(const b of m){const S=b.associations??[],A=S.map(O=>O.source===b.dataStore.id?O.target:O.source).map(p).find(Boolean),T=A?d(A)??u():u(),D=A?{x:A.x+A.width/2,y:y$(A,T)??A.y+A.height+110}:{x:200,y:wn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},D,T);for(const O of S)_E(b.dataStore.id,O)}for(const b of v){const A=f(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;_E(A,b.association)}let DE=0;const No=10,LE=40,v$=(b,S)=>{const A=S.map(I=>d(I)).filter(I=>!!I);for(const I of A){const W=No,K=I.y,re=I.y+I.height,ee=I.x,he=I.x+I.width;if(Math.abs(b.y-K)<W){const fe=K+W-b.y;b.y+=fe,b.height-=fe}if(Math.abs(b.y+b.height-re)<W&&(b.height=re-W-b.y),Math.abs(b.x-ee)<W){const fe=ee+W-b.x;b.x+=fe,b.width-=fe}Math.abs(b.x+b.width-he)<W&&(b.width=he-W-b.x)}if(!A.length)return;const T=Math.min(...A.map(I=>I.y)),D=Math.max(...A.map(I=>I.y+I.height)),O=T-b.y,j=b.y+b.height-D,F=LE-No;if(O>0!=j>0)if(O>0&&O<F){const I=O+No;b.y+=I,b.height-=I}else j>0&&j<F&&(b.height-=j+No)},b$=(b,S)=>{const A=No,T=30,D=o.filter(O=>O.type==="bpmn:Group"&&O.id!==S);for(const O of D){const j=O.x,F=O.x+O.width,I=O.y,W=O.y+O.height,K=b.y<W&&I<b.y+b.height,re=b.x<F&&j<b.x+b.width;if(K){if(Math.abs(b.x-F)<A){const ee=Math.min(F+A-b.x,T);ee>0&&b.width-ee>0&&(b.x+=ee,b.width-=ee)}if(Math.abs(b.x+b.width-j)<A){const ee=Math.min(b.x+b.width-(j-A),T);ee>0&&b.width-ee>0&&(b.width-=ee)}}if(re){if(Math.abs(b.y-W)<A){const ee=Math.min(W+A-b.y,T);ee>0&&b.height-ee>0&&(b.y+=ee,b.height-=ee)}if(Math.abs(b.y+b.height-I)<A){const ee=Math.min(b.y+b.height-(I-A),T);ee>0&&b.height-ee>0&&(b.height-=ee)}}}},em=(b,S)=>{const A=LE,T=Math.min(...b.map(I=>I.x))-A,D=Math.min(...b.map(I=>I.y))-A,O=Math.max(...b.map(I=>I.x+I.width))+A,j=Math.max(...b.map(I=>I.y+I.height))+A,F={x:T,y:D,width:O-T,height:j-D};return v$(F,b),b$(F,S),F};for(const b of E){const S=(b.group.members??[]).map(p).filter(D=>!!D);let A;S.length?A=em(S,b.group.id):(A={x:300+DE*350,y:40,width:300,height:200},DE++);const T=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(T,b.group.name),(qE=b.group.members)!=null&&qE.length&&k(T,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(D=>!!D.waypoints),S=new Map,A=(D,O)=>{!D||!O||(S.has(D)||S.set(D,new Set),S.get(D).add(O))};for(const D of b){const O=(YE=D.source)==null?void 0:YE.id,j=(KE=D.target)==null?void 0:KE.id;A(O,j),((XE=D.type)!=null&&XE.includes("DataOutputAssociation")||(ZE=D.type)!=null&&ZE.includes("DataInputAssociation")||D.type==="bpmn:Association")&&A(j,O)}const T=o.filter(D=>D.type==="bpmn:Group");for(const D of T){const j=(((QE=D.businessObject.extensionElements)==null?void 0:QE.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),W=[...F];for(;W.length;){const Ae=W.shift();for(const J of S.get(Ae)??[])I.has(J)||(I.add(J),W.push(J))}const K=D.x,re=D.x+D.width,ee=D.y,he=D.y+D.height,fe=Ae=>C.filter(J=>J.flow.target===Ae).length,ye=Ae=>{var se;const J=((se=p(Ae))==null?void 0:se.type)??"";if(J==="bpmn:StartEvent"&&fe(Ae)===0)return!1;if(J.endsWith("Gateway")){const le=C.filter(be=>be.flow.target===Ae).map(be=>be.flow.source);if(le.length&&le.every(be=>{var Ze;return((Ze=p(be))==null?void 0:Ze.type)==="bpmn:StartEvent"&&fe(be)===0}))return!1}return!0},Ye=o.filter(Ae=>$i(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!I.has(Ae.id)&&Bo(Ae.id)&&ye(Ae.id)&&Ae.x<re&&Ae.x+Ae.width>K&&Ae.y<he&&Ae.y+Ae.height>ee);if(Ye.length)for(const Ae of[-1,1]){const J=Ye.filter(ve=>(ve.x+ve.width-K<=re-ve.x?-1:1)===Ae);if(!J.length)continue;const se=[];for(const ve of J){const ce=se.find(we=>we.some(Be=>ve.y<Be.y+Be.height&&ve.y+ve.height>Be.y));ce?ce.push(ve):se.push([ve])}const le=new Map;for(const ve of se){let ce=Ae<0?K-No:re+No;for(const we of[...ve].sort((Be,Le)=>Ae<0?Le.x-Be.x:Be.x-Le.x)){const Be=Ae<0?Math.min(we.x,ce-we.width):Math.max(we.x,ce);ce=Ae<0?Be-Oi:Be+we.width+Oi,Be!==we.x&&Math.sign(Be-we.x)===Ae&&le.set(we.id,Be-we.x)}}const be=new Map,Ze=ve=>be.get(ve)===ve||!be.get(ve)?ve:Ze(be.get(ve));for(const ve of J)be.set(ve.id,ve.id);for(const ve of x){const ce=le.has(ve.flow.source)?ve.flow.source:void 0,we=le.has(ve.flow.target)?ve.flow.target:void 0;if(!ce||!we)continue;const Be=p(ve.flow.id);((JE=Be==null?void 0:Be.waypoints)==null?void 0:JE.length)===2&&be.set(Ze(ce),Ze(we))}const Qe=new Map;for(const ve of J){if(!le.has(ve.id))continue;const ce=Ze(ve.id);Qe.set(ce,[...Qe.get(ce)??[],ve])}const kt=[...Qe.values()].sort((ve,ce)=>Ae<0?Math.min(...ve.map(we=>we.x))-Math.min(...ce.map(we=>we.x)):Math.max(...ce.map(we=>we.x))-Math.max(...ve.map(we=>we.x))),$t=[];let xe=!0;for(const ve of kt){const ce=ve.map(Le=>le.get(Le.id)??0).reduce((Le,_e)=>Math.abs(_e)>Math.abs(Le)?_e:Le,0),we=new Map;let Be=!0;for(const Le of ve){const _e=d(Le);if(!_e){Be=!1;break}we.has(_e.id)||we.set(_e.id,{subtree:[],pool:_e}),we.get(_e.id).subtree.push(Le)}Be&&Io([...we.values()],ce,()=>!0,za)?$t.push({shapes:ve,dx:ce}):xe=!1}if(!xe)for(const ve of $t.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const b=new Set([...E.map(S=>S.group.id),...en(e,"group.update").map(S=>S.id)]);for(const S of o.filter(A=>A.type==="bpmn:Group")){if(b.has(S.id))continue;const T=(((e1=S.businessObject.extensionElements)==null?void 0:e1.values)??[]).find(F=>F.$type==="bwl:Members"),D=((T==null?void 0:T.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!D.length||!D.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!D.some(F=>F.x<S.x||F.y<S.y||F.x+F.width>S.x+S.width||F.y+F.height>S.y+S.height)||n.resizeShape(S,em(D,S.id))}}{const S=new Map(mo(Ue(o)).map(F=>[F.owner,F.rect])),A=o.filter(F=>!!F.waypoints),T=new Map,D=(F,I)=>{!F||!I||(T.has(F)||T.set(F,new Set),T.get(F).add(I))};for(const F of A){const I=(t1=F.source)==null?void 0:t1.id,W=(n1=F.target)==null?void 0:n1.id;D(I,W),((i1=F.type)!=null&&i1.includes("DataOutputAssociation")||(r1=F.type)!=null&&r1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&D(W,I)}const O=F=>C.filter(I=>I.flow.target===F).length,j=F=>{var W;const I=((W=p(F))==null?void 0:W.type)??"";if(I==="bpmn:StartEvent"&&O(F)===0)return!1;if(I.endsWith("Gateway")){const K=C.filter(re=>re.flow.target===F).map(re=>re.flow.source);if(K.length&&K.every(re=>{var ee;return((ee=p(re))==null?void 0:ee.type)==="bpmn:StartEvent"&&O(re)===0}))return!1}return!0};for(const F of o.filter(I=>I.type==="bpmn:Group")){const W=(((o1=F.businessObject.extensionElements)==null?void 0:o1.values)??[]).find(ce=>ce.$type==="bwl:Members"),K=((W==null?void 0:W.refs)??"").split(" ").filter(Boolean);if(!K.length)continue;const re=K.map(p).filter(ce=>!!ce);if(!re.length||!(E.some(ce=>ce.group.id===F.id)||en(e,"group.update").some(ce=>ce.id===F.id)||re.some(ce=>{const we=g.get(ce.id);return!we||we.x!==ce.x||we.y!==ce.y})))continue;const he=new Set(K),fe=[...K];for(;fe.length;){const ce=fe.shift();for(const we of T.get(ce)??[])he.has(we)||(he.add(we),fe.push(we))}const ye=F.x,Ye=F.x+F.width,Ae=F.y,J=F.y+F.height,se=ce=>{const we=S.get(ce.id),Be={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return we?[Be,{x:we.x,y:we.y,width:we.width,height:we.height}]:[Be]},le=re.flatMap(se),be=Math.min(...le.map(ce=>ce.x)),Ze=Math.max(...le.map(ce=>ce.x+ce.width)),Qe=Math.min(...le.map(ce=>ce.y)),kt=Math.max(...le.map(ce=>ce.y+ce.height)),$t={L:be-ye,R:Ye-Ze,T:Qe-Ae,B:J-kt},xe=o.filter(ce=>$i(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!he.has(ce.id)&&j(ce.id)&&ce.x<Ye&&ce.x+ce.width>ye&&ce.y<J&&ce.y+ce.height>Ae);if(!xe.length)continue;const ve={L:0,R:0,T:0,B:0};for(const ce of xe){const we=se(ce),Be=Math.min(...we.map(nt=>nt.x)),Le=Math.max(...we.map(nt=>nt.x+nt.width)),_e=Math.min(...we.map(nt=>nt.y)),rt=Math.max(...we.map(nt=>nt.y+nt.height)),lt={L:Le-ye,R:Ye-Be,T:rt-Ae,B:J-_e},Jt=["L","R","T","B"].filter(nt=>lt[nt]<=$t[nt]+.001);if(!Jt.length)continue;const si=Jt.reduce((nt,zt)=>lt[zt]<lt[nt]?zt:nt,Jt[0]);ve[si]=Math.max(ve[si],Math.min(lt[si]+10,$t[si]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const IE=b=>{const S=b.waypoints;if(S!=null&&S.length){const T=S[Math.floor((S.length-1)/2)];return{x:T.x,y:T.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let ac=0;const BE=12,NE=14,x$=15,w$=300,_$=b=>{const S=b.split(`
|
|
7
|
+
`),A=Math.max(...S.map(O=>Qo(O,BE))),T=Math.max(100,Math.min(w$,Math.ceil(A)+NE)),D=S.reduce((O,j)=>O+Math.max(1,Math.ceil((Qo(j,BE)+NE)/T)),0);return{width:T,height:Math.max(30,D*x$+10)}};for(const b of w){const S=b.association,A=((a1=b.placement)==null?void 0:a1.anchor)??(S?S.source===b.annotation.id?S.target:S.source:void 0),T=A?p(A):void 0,D=T?IE(T):void 0,O=_$(b.annotation.text??"");let j;if(D&&b.placement){const[K,re]=Bc[b.placement.side],ee=b.placement.offset??50;j={x:D.x+D.width/2+K*(D.width/2+O.width/2+ee),y:D.y+D.height/2+re*(D.height/2+O.height/2+ee)}}else D?(j={x:D.x+D.width/2+180+ac%3*260,y:D.y-110-ac%2*95},ac++):(j={x:300+ac*260,y:60},ac++);const F=T?d(T)??u():u(),I=F;D&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=$c(o,D,O,I,b.placement?{placement:b.placement}:{from:j}));const W=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},j,F);if(S){const K=re=>re===b.annotation.id?W:f(re);n.connect(K(S.source),K(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}b.placement&&k(W,"bwl:Placement",$(b.placement))}for(const b of en(e,"association.add")){const S=b.association;n.connect(f(S.source),f(S.target),S.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:S.id})}:{type:"bpmn:Association"})}const $E=()=>new Set(o.getAll().filter(b=>b.type!=="label").map(b=>b.id));for(const b of en(e,"node.update")){let S=f(b.id);if(b.type&&Ic(b.type)!==S.type){const A=S.x+S.width/2,T=S.y+S.height/2,D=$E();S=c.replaceElement(S,{type:Ic(b.type),...b.eventDefinition?{eventDefinitionType:pc[b.eventDefinition]}:{}});const O=$E(),j=[...D].filter(W=>W!==b.id&&!O.has(W));if(j.length)throw new $g({kind:"type-change-drops-elements",opIndex:e.indexOf(b),id:b.id,type:b.type,dropped:j});const F=Math.round(A-(S.x+S.width/2)),I=Math.round(T-(S.y+S.height/2));if(F!==0||I!==0){n.moveShape(S,{x:F,y:I});for(const W of[...S.incoming??[],...S.outgoing??[]])dt(W)}}if(b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(S,{"bwl:band":b.band});const A=S.y+S.height/2,T=d(S),D=b.lane?f(b.lane):((T==null?void 0:T.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);b.band!==void 0&&mt(D==null?void 0:D.id,b.band,T);const O=D?D.y+(b.band===void 0?D.height/2:Math.min(D.height/2,oe)+R(D.id,b.band)*L):b.band!==void 0&&T?T.y+X+R(`pool:${T.id}`,b.band)*L:void 0;if(O!==void 0){const j=O-A;j!==0&&n.moveElements([S],{x:0,y:j})}}}for(const b of en(e,"sequenceFlow.update")){const S=f(b.id);if(b.source!==void 0||b.target!==void 0){const A=S,T=b.source!==void 0?f(b.source):A.source,D=b.target!==void 0?f(b.target):A.target,O=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,T,D,[O(T),O(D)]);const j=wE.get(A.id),F=D.y+D.height/2;if(j&&D.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:D.x,y:F}]);const I=A.label;if(I&&j.label){const K=Math.abs(j.label.y+I.height/2-j.channelY)<=L/5&&j.label.x+I.width>j.exit.x,re=j.exit.x+6,ee=D.x-6-I.width,he=K?ee>=re?{x:Math.max(re,Math.min(j.label.x,ee)),y:j.label.y+(F-j.channelY)}:void 0:j.label;he&&(he.x!==I.x||he.y!==I.y)&&n.moveElements([I],{x:he.x-I.x,y:he.y-I.y})}}else Math.abs(F-(T.y+T.height/2))>1&&dt(A)}b.name!==void 0&&n.updateProperties(S,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(S,{name:((s1=b.condition)==null?void 0:s1.label)??void 0})}for(const b of en(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(f(b.id),{name:b.name??void 0});for(const b of en(e,"annotation.update")){const S=f(b.id);if(b.text!==void 0&&n.updateProperties(S,{text:b.text}),b.placement===null)k(S,"bwl:Placement",null);else if(b.placement){const A=f(b.placement.anchor),T=IE(A),D=d(A)??u(),O=typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant",[j,F]=Bc[b.placement.side],I=b.placement.offset??50,W={x:T.x+T.width/2+j*(T.width/2+S.width/2+I),y:T.y+T.height/2+F*(T.height/2+S.height/2+I)},K=O?$c(o,T,{width:S.width,height:S.height},D,{placement:b.placement,selfId:b.id}):W;n.moveElements([S],{x:K.x-(S.x+S.width/2),y:K.y-(S.y+S.height/2)}),k(S,"bwl:Placement",$(b.placement))}}for(const b of en(e,"group.update")){const S=f(b.id);if(b.name!==void 0&&n.updateLabel(S,b.name??""),b.members){const A=b.members.map(p).filter(T=>!!T);A.length&&n.resizeShape(S,em(A,b.id)),k(S,"bwl:Members",{refs:b.members.join(" ")})}}}function Up(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 sC(e,t,n){var u,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>ht(f).filter(d=>!t.has(pt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ue(i),c=o(s),l=[...new Set(c.flatMap(Up))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){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 te=d.x+d.width/2,je=d.y+d.height/2;h=i.getAll().find(qe=>{if(qe.type!=="bpmn:Participant")return!1;const He=qe;return typeof He.x=="number"&&typeof He.width=="number"&&te>=He.x&&te<=He.x+He.width&&je>=He.y&&je<=He.y+He.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const C=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(te=>te.$type==="bwl:Placement"),x=[...d.incoming??[],...d.outgoing??[]].find(te=>te.type==="bpmn:Association"),m=(C!=null&&C.anchor?i.get(C.anchor):void 0)??(x?((p=x.source)==null?void 0:p.id)===f?x.target:x.source:void 0);if(!m)continue;const v=m.waypoints,w=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},E={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},k=C==null?void 0:C.side,$=Ng(i,w,h),N=[];if(k&&k in Bc&&N.push($c(i,w,E,h,{placement:{side:k,offset:(C==null?void 0:C.offset)??null},selfId:f})),$&&!Nc(P,E,$))for(const te of aC)N.push($c(i,w,E,h,{placement:{side:te,offset:null},selfId:f}));for(const[te,je]of[[-1,0],[1,0],[0,-1],[0,1]])for(let qe=1;qe<=oC;qe++)N.push({x:P.x+te*Bg*qe,y:P.y+je*Bg*qe});const L={...s,edges:s.edges.filter(te=>te.id!==(x==null?void 0:x.id))},z=o(L),X=z.filter(te=>Up(te).includes(f)).length;if(!X)continue;let oe;for(const te of N){const je=te.x-P.x,qe=te.y-P.y;if(!je&&!qe||te.x-E.width/2<h.x||te.x+E.width/2>h.x+h.width||te.y-E.height/2<h.y||te.y+E.height/2>h.y+h.height||$&&!Nc(te,E,$))continue;const He={...L,shapes:L.shapes.map(V=>V.id===f?{...V,x:V.x+je,y:V.y+qe}:V)},Se=o(He),Z=Se.filter(V=>Up(V).includes(f)).length;if(Z>=X||Se.length>z.length)continue;const ie=Math.abs(je)+Math.abs(qe);if((!oe||Z<oe.mine||Z===oe.mine&&(Se.length<oe.all||Se.length===oe.all&&ie<oe.dist))&&(oe={x:te.x,y:te.y,mine:Z,all:Se.length,dist:ie}),oe.mine===0&&oe.all<z.length)break}oe&&r.moveElements([d],{x:oe.x-P.x,y:oe.y-P.y})}}const cC=60;function qp(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function lC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>ht(u).filter(p=>!t.has(pt(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const C of n.shapes)C.type!=="bpmn:Group"||f.has(C.id)||[...d].some(x=>{const m=s.get(x);return m&&c(C,m)})&&(f.add(C.id),y=!0);for(const C of n.shapes)C.type!=="bpmn:Participant"||d.has(C.id)||[...f].some(x=>{const m=s.get(x);return m&&c(m,C)})&&(d.add(C.id),y=!0);if(!y)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(y=>{const C=s.get(y);return C&&c(C,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ue(i),f=o(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[w,E]=v.pools,P=g.get(w),k=g.get(E);if(!P||!k)continue;const[$,N]=P.x<=k.x?[P,k]:[k,P];if(v.contained)continue;const L=s.get($.id),z=s.get(N.id),X=L&&z?Math.max(z.x-(L.x+L.width),0):cC,oe=$.x+$.width+X-N.x;if(oe<=0)continue;const te=l(N.id).filter(je=>i.get(je));te.length&&(!h||oe>h.dx)&&(h={movers:te,dx:oe})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const C=f.length,x=d.length;r.moveElements(y,{x:h.dx,y:0});const m=o(Ue(i));if(!(a(m).length<x&&m.length<=C)){r.moveElements(y,{x:-h.dx,y:0});return}}}const Fc=.5,jg=150;function uC(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(m=>m.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(m=>m.x+m.width),a=Math.max(...o);if(a-Math.min(...o)>Fc)return;const s=r.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(s.length<2)return;const c=new Map(r.map(m=>[m.id,m.x]));if(s.some(m=>Math.abs(m.x-c.get(m.id))>Fc))return;const l=s.map(m=>m.x+m.width);if(Math.max(...l)-Math.min(...l)<=Fc)return;const u=m=>m.x+m.width,p=m=>!!m&&typeof m.width=="number",f=m=>{const v={shapes:[],edges:[],lanes:[]},w=E=>{for(const P of E.children??[]){if("waypoints"in P&&P.waypoints){v.edges.push(P);continue}P.type!=="label"&&(P.type==="bpmn:Lane"?v.lanes.push(P):v.shapes.push(P),w(P))}};return w(m),v},d=new Map(s.map(m=>[m.id,f(m)]));let g=a;for(const m of s){const{shapes:v}=d.get(m.id),w=v.flatMap(E=>[u(E),...p(E.label)?[u(E.label)]:[]]);w.length&&(g=Math.max(g,Math.max(...w)+jg))}const h=s.filter(m=>Math.abs(u(m)-g)>Fc);if(!h.length)return;for(const m of h){const v=u(m),{shapes:w,edges:E,lanes:P}=d.get(m.id);if([...w.flatMap(N=>[u(N),...p(N.label)?[u(N.label)]:[]]),...E.flatMap(N=>[...N.waypoints.map(L=>L.x),...p(N.label)?[u(N.label)]:[]])].some(N=>N>g)||[...(m.incoming??[]).map(N=>N.waypoints[N.waypoints.length-1]),...(m.outgoing??[]).map(N=>N.waypoints[0])].some(N=>!N||N.x>g||Math.abs(N.x-v)<1))return;if(g>v){const N={x:v,y:m.y,width:g-v,height:m.height},L=new Set([m.id,...w.map(X=>X.id),...E.map(X=>X.id),...P.map(X=>X.id)]);if(n.getAll().some(X=>{var je;if("waypoints"in X&&X.waypoints||X.type==="bpmn:Group"||!p(X))return!1;const oe=X.type==="label"?(je=X.labelTarget)==null?void 0:je.id:X.id;if(!oe||L.has(oe)||L.has(X.id))return!1;const te=X;return te.x<N.x+N.width&&te.x+te.width>N.x&&te.y<N.y+N.height&&te.y+te.height>N.y}))return}}const y=()=>new Set(ht(Ue(n)).map(pt)),C=y(),x=h.map(m=>m.width);for(const m of h)qp(i,m,g-m.x,{layout:!1});[...y()].every(m=>C.has(m))||h.forEach((m,v)=>qp(i,m,x[v],{layout:!1}))}function pC(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>ht(l).filter(u=>!t.has(pt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const p=n.shapes.filter(E=>E.id!==l.id&&E.type!=="bpmn:Group"&&a(l,E));if(!p.length)continue;const f=p.map(E=>i.get(E.id)).filter(E=>!!E&&typeof E.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),C=g.r+(l.x+l.width-d.r),x=g.b+(l.y+l.height-d.b),m={x:h,y,width:C-h,height:x-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=o(Ue(i)).length,w={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,m),o(Ue(i)).length>v&&r.resizeShape(u,w)}}const jc=20,Hc=10;function fC(e,t,n,i){var p,f;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(ht(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(pt)),s=Ue(r),c=ht(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(pt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const x=h.members.map(Te=>r.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!x.length)continue;const m=Math.min(...x.map(Te=>Te.x)),v=Math.min(...x.map(Te=>Te.y)),w=Math.max(...x.map(Te=>Te.x+Te.width)),E=Math.max(...x.map(Te=>Te.y+Te.height)),P=h.x,k=h.y,$=h.x+h.width,N=h.y+h.height;let L=P,z=k,X=$,oe=N;for(const Te of g){const B=s.edges.find(_=>_.id===Te.edge);if(!B)continue;const R=B.endpoints.some(_=>{const G=s.shapes.find(Me=>Me.id===_);if(!G||G.container)return!1;const U=G.x+G.width/2,ne=G.y+G.height/2;return P<U&&U<$&&k<ne&&ne<N});for(const _ of vn(B)){const G=_.axis==="v"?[k,N]:[P,$];Math.min(_.hi,G[1])-Math.max(_.lo,G[0])<kp||(_.axis==="v"?P<_.at&&_.at<$:k<_.at&&_.at<N)&&R||(_.axis==="v"?(Math.abs(_.at-P)<=Jo&&(L=Math.max(L,_.at+jc)),Math.abs(_.at-$)<=Jo&&(X=Math.min(X,_.at-jc))):(Math.abs(_.at-k)<=Jo&&(z=Math.max(z,_.at+jc)),Math.abs(_.at-N)<=Jo&&(oe=Math.min(oe,_.at-jc))))}}if(L>m-Hc&&(L=P),z>v-Hc&&(z=k),X<w+Hc&&(X=$),oe<E+Hc&&(oe=N),L===P&&z===k&&X===$&&oe===N)continue;const te=r.get(d),je={x:te.x,y:te.y,width:te.width,height:te.height},qe=Ue(r),He=new Set(ht(qe).map(pt)),Se=a(qe);o.resizeShape(te,{x:L,y:z,width:X-L,height:oe-z});let Z=Ue(r),ie=ht(Z).filter(Te=>!He.has(pt(Te)));const V=[];if(ie.length>0&&ie.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&Z.edges.some(B=>B.id===Te.edge))){for(const Te of ie){if(Te.kind!=="label-over-line")continue;const B=Z.edges.find(ne=>ne.id===Te.edge),R=B&&Gp(B,Z),_=(f=r.get(Te.edge))==null?void 0:f.label;if(!R||!_)continue;const G=R.x-_.x,U=R.y-_.y;o.moveElements([_],{x:G,y:U}),V.push({label:_,dx:G,dy:U})}Z=Ue(r),ie=ht(Z).filter(Te=>!He.has(pt(Te)))}const ae=a(Z),me=[...ae].some(Te=>!Se.has(Te));if(ie.length||me||ae.size>=Se.size){for(const Te of V.reverse())o.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});o.resizeShape(te,je)}}}function dC(e,t,n,i){var c;const r=n.getRootElement().businessObject,o=up((r==null?void 0:r.$parent)??r),a=Ua(i),s=new Map;for(const l of e.keys()){const u=(c=t.get(l))==null?void 0:c.businessObject;s.set(l,u?{texts:pp(u,i,o),requests:mp(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...o?{rootLang:o}:{},before:s.get(l)}]:[]})}}function Hg(e,t,n={}){var $,N;const{i18n:i,lower:r=Fg}=n,o=Lg(e),a=ig(o.elementRegistry),s=Dg(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=eC(t,a,i),u=i&&l.writes.size?dC(l.writes,o.elementRegistry,o.canvas,i):void 0,p=Ue(o.elementRegistry),f=new Set(ht(p).map(pt)),d=new Set(ht(p,{includeObservationOnly:!0}).map(pt)),g=new Set(p.edges.map(L=>L.id)),h=new Set(t.flatMap(L=>L.kind==="sequenceFlow.update"&&(L.source!==void 0||L.target!==void 0)?[L.id]:[])),y=new Set(p.shapes.map(L=>L.id)),C=Ac(p),x=C.length,m=new Set(C.map(([L,z])=>`${L}|${z}`)),v=new Map;for(const L of o.elementRegistry.filter(z=>"waypoints"in z&&!!z.waypoints))L.label&&v.set(L.id,{wps:L.waypoints.map(z=>({x:z.x,y:z.y})),label:{x:L.label.x,y:L.label.y},source:($=L.source)==null?void 0:$.id,target:(N=L.target)==null?void 0:N.id});const w=e.get("commandStack");try{cm(w,()=>{r(l.ops,o);for(const z of(u==null?void 0:u.contexts())??[])w.execute(dp,z);lC(o,f,p),uC(o,p),pC(o,f,p),ug(o,g);const L=Fp(o,f);sg(o,m,g),xg(o,f,g),dg(o,g),GR(o,g,h),gg(o,f,g),qR(o,f,g),Cg(o,f,g),Rg(o,g,h),Ag(o,y),sC(o,f,y),Fp(o,f,L),fC(o,d,p,g),Pg(o,f),Sg(o,v)})}catch(L){return{ok:!1,issues:[L instanceof $g?L.issue:{kind:"lower-failed",message:L instanceof Error?L.message:String(L)}],findings:[],stats:c}}const E=Ue(o.elementRegistry),P=ht(E,{includeObservationOnly:!0}).filter(L=>!d.has(pt(L))),k=qm(E);return{ok:!0,issues:[],findings:P,stats:{edgeCrossings:{before:x,after:k.pairs.length,pairs:k.pairs,solidPairs:k.solidPairs,dashedPairs:k.dashedPairs,mixedPairs:k.mixedPairs,crossPoolMessages:k.crossPoolMessages}}}}function hC(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function zg(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Gg(e,t){const n=zg(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Vg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function mC(e){return typeof e=="string"&&op.includes(e)}function Li(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Wg(e,t={}){const n=e.rootElements??[],i=n.find(Z=>Z.$type==="bpmn:Collaboration"),r=new Map(n.filter(Z=>Z.$type==="bpmn:Process").map(Z=>[Z.id,Z])),o=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],y=[],C=[],x=[],m=new Map,v=new Set,w=new Set,E=Z=>{Z&&v.add(Z)},P=Z=>{v.add(Z),w.add(Z)},k=Z=>{const ie=Vg(Z,"bwl:Placement");if(!ie)return;const V=typeof ie.anchor=="string"?ie.anchor:void 0;if(!V||!mC(ie.side))return;const Y=typeof ie.offset=="number"?ie.offset:void 0;y.push({owner:Z.id,anchor:V,side:ie.side,...Y!==void 0?{offset:Y}:{}})},$=Z=>{const ie=Vg(Z,"bwl:Members"),V=typeof(ie==null?void 0:ie.refs)=="string"?ie.refs.split(/\s+/).filter(Boolean):[];V.length&&x.push({owner:Z.id,refs:V})},N=Z=>{var ie;for(const V of Z)switch(E(V.id),V.$type){case"bpmn:TextAnnotation":P(V.id),m.set(V.id,V),c.push({id:V.id,text:typeof V.text=="string"?V.text:""}),k(V);break;case"bpmn:Association":g.push({id:V.id,type:V.$type,source:Li(V.sourceRef),target:Li(V.targetRef)});break;case"bpmn:Group":{P(V.id),m.set(V.id,V);const Y=(ie=V.categoryValueRef)==null?void 0:ie.value;l.push({id:V.id,...typeof Y=="string"&&Y?{name:Y}:{}}),$(V);break}default:u.push({id:V.id,type:V.$type,reason:"type-outside-mvp"})}},L=Z=>{for(const ie of Z.flowElements??[])E(ie.id),u.push({id:ie.id,type:ie.$type,reason:"inside-container"}),(ie.flowElements??[]).length&&L(ie);for(const ie of Z.artifacts??[])E(ie.id),u.push({id:ie.id,type:ie.$type,reason:"inside-container"})},z=(Z,ie)=>{const V=Z.flowElements??[],Y=(Z.laneSets??[]).flatMap(me=>me.lanes??[]),ae=new Map;for(const me of Y){E(me.id),m.set(me.id,me);for(const Te of me.flowNodeRef??[]){const B=Li(Te);B&&ae.set(B,me.id)}}for(const me of V){if(E(me.id),m.set(me.id,me),me.$type==="bpmn:SequenceFlow"){f.push({id:me.id,source:Li(me.sourceRef),target:Li(me.targetRef),...typeof me.name=="string"&&me.name?{name:me.name}:{}});continue}if(me.$type==="bpmn:DataStoreReference"){P(me.id),s.push({id:me.id,...me.name?{name:me.name}:{}});continue}const Te=hC(me.$type),B=Te==="intermediateCatchEvent"?ip((me.eventDefinitions??[]).map(U=>U.$type)):void 0;if(!nm(Te)||Te==="intermediateCatchEvent"&&!B){u.push({id:me.id,type:me.$type,reason:"type-outside-mvp"});continue}P(me.id);const R=Te==="boundaryEvent"?Li(me.attachedToRef):void 0;a.push({id:me.id,type:Te,...me.name?{name:me.name}:{},...ie?{participant:ie}:{},...ae.has(me.id)?{lane:ae.get(me.id)}:{},...R?{attachedTo:R}:{},...B?{eventDefinition:B}:{}}),Te==="subProcess"&&L(me);const _=Gg(me,"bwl:band");_!==void 0&&(p.bands[me.id]=_);const G=zg(me,"bwl:afterColumn");typeof G=="string"&&G!==""&&C.push([me.id,G]);for(const U of me.dataOutputAssociations??[])E(U.id),h.push({id:U.id,type:U.$type,source:me.id,target:Li(U.targetRef)});for(const U of me.dataInputAssociations??[])E(U.id),h.push({id:U.id,type:U.$type,source:Li((U.sourceRef??[])[0]),target:me.id})}N(Z.artifacts??[])};if(i){const Z=new Set;for(const ie of i.participants??[]){P(ie.id),m.set(ie.id,ie);const V=Li(ie.processRef);V&&Z.add(V);const Y=V?r.get(V):void 0,ae=((Y==null?void 0:Y.laneSets)??[]).flatMap(R=>R.lanes??[]),me=ae.map(R=>({id:R.id,...R.name?{name:R.name}:{}}));for(const R of me)P(R.id);const Te=!Y||(Y.flowElements??[]).length===0&&ae.length===0&&(Y.artifacts??[]).length===0;o.push({id:ie.id,...ie.name?{name:ie.name}:{},...Te?{blackBox:!0}:{},...me.length?{lanes:me}:{}});const B=Gg(ie,"bwl:poolOrder");B!==void 0&&(p.poolOrders[ie.id]=B),Y&&z(Y,ie.id)}for(const ie of i.messageFlows??[])E(ie.id),m.set(ie.id,ie),d.push({id:ie.id,source:Li(ie.sourceRef),target:Li(ie.targetRef),...typeof ie.name=="string"&&ie.name?{name:ie.name}:{}});N(i.artifacts??[]);for(const[ie,V]of r)!Z.has(ie)&&(V.flowElements??[]).length>0&&u.push({id:ie,type:V.$type,reason:"unreachable-process"})}else for(const Z of r.values())z(Z);const X=[],oe=[],te=[],je=[],qe=(Z,ie)=>!!Z&&!!ie&&w.has(Z)&&w.has(ie);for(const Z of f){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}X.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),w.add(Z.id)}for(const Z of d){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}oe.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),w.add(Z.id)}for(const Z of h){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}je.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target}),Z.id&&w.add(Z.id)}for(const Z of g){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}te.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target})}const He=new Map(l.map(Z=>[Z.id,Z]));for(const{owner:Z,refs:ie}of x){const V=ie.filter(ae=>v.has(ae)),Y=He.get(Z);Y&&V.length&&(Y.members=V)}for(const Z of y)v.has(Z.anchor)&&(p.placements[Z.owner]={anchor:Z.anchor,side:Z.side,...Z.offset!==void 0?{offset:Z.offset}:{}});for(const[Z,ie]of C)v.has(ie)&&(p.afterColumns[Z]=ie);const Se={...o.length?{participants:o}:{},nodes:a,sequenceFlows:X,...oe.length?{messageFlows:oe}:{},...s.length?{dataStores:s}:{},...je.length?{dataAssociations:je}:{},...c.length?{annotations:c}:{},...te.length?{associations:te}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Se,hints:p,omitted:u,i18n:gC(Se,m,e,t.i18n)}:{definition:Se,hints:p,omitted:u}}function gC(e,t,n,i){const r=up(n),o=Ua(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=pp(u,i,r);Object.keys(p).length&&(c[l]=p);for(const f of mp(u))o.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:o.slice(1),reviewRequests:a}}async function yC(e,t={}){const{definitions:n,warnings:i}=await Xo(e);return{...Wg(n,t),warnings:i}}const vC=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Yp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function bC(e){return Yp(e.processRef)!==void 0}function xC(e){const t=new Set,n=r=>{const o=Yp(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function wC(e){const t=[],n=i=>{for(const r of i.flowElements??[])vC.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function _C(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Kp(e){const t=[],n=e.rootElements??[],i=xC(e);for(const o of wC(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])bC(s)&&_C(o.get(Yp(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function EC(e){const{definitions:t,warnings:n}=await Xo(e);return{issues:Kp(t),warnings:n}}const SC=.5,RC=8,CC=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),oa=e=>typeof e=="number"?e:Number(e??NaN),zc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function MC(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${zc(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${zc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(zc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function AC(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[oa(s.x),oa(s.y),oa(s.width),oa(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=zc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[oa(f.x),oa(f.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function Ug(e){const t=AC(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!CC.has(s)&&n.set(c,{type:s,props:MC(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function qg(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function Yg(e,t,n={}){const i=n.moveTolerance??SC,r=Ug(e),o=Ug(t),a=[],s=[],c=[];for(const[l,u]of o){const p=r.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||qg(p.geometry,u.geometry,i)||qg(p.label,u.label,n.labelTolerance??RC))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function PC(e,t,n={}){const[i,r]=await Promise.all([Xo(e),Xo(t)]);return{...Yg(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function TC(e){return new Set([...e.added,...e.modified])}function kC(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Kg(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=Hg(e,t.ops,{i18n:i});if(!r.ok)return{status:"rejected",issues:r.issues};const{xml:o}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:o??"",findings:r.findings,stats:r.stats}}const OC=Symbol("bpmn-editor"),Xp={geometry:[],semantic:[]};function DC(){const e=ge.ref(!1),t=ge.ref(!0),n=ge.ref(!1),i=ge.shallowRef(Xp),r=ge.shallowRef(void 0),o=ge.shallowRef(void 0);let a,s,c,l;const u=()=>{if(f(),!c){i.value=Xp;return}const x=ht(Ue(c.get("elementRegistry")),{includeObservationOnly:!0}),m=c.getDefinitions();i.value={geometry:x,semantic:m?Kp(m):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function f(){const x=p();if(!x||!a){o.value=void 0;return}const m=x.locales(),v={};for(const w of m)v[w]={untranslated:x.untranslatedCount(w),reviewRequested:x.reviewRequestedCount(w)};o.value={designLocale:a.designLocale,locales:m,displayLocale:x.getDisplayLocale()??a.designLocale,counts:v}}function d(){const x=p();x&&(x.configure(a),a&&s&&(s=x.setDisplayLocale(s)))}const g=()=>{e.value=!0,u()};function h(x,m){x.get("canvas").getContainer().style.pointerEvents=m?"":"none";const v=x.get("keyboard");m?(l&&v.bind(l),l=void 0):l||(l=v.getBinding(),v.unbind())}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function C(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:r,i18n:o,configureI18n(x){a=x,d(),f()},setDisplayLocale(x){var v;s=x;const m=(v=p())==null?void 0:v.setDisplayLocale(x);m&&(s=m),f()},setChangeScope(x){r.value=x===void 0?void 0:new Set(x)},requestFocus(x){if(!c)return;const m=c.get("elementRegistry").get(x);m&&(c.get("canvas").scrollToElement(m,180),c.get("selection").select(m))},describeElement(x){const m=c==null?void 0:c.get("elementRegistry").get(x),v=m==null?void 0:m.businessObject;if(!v)return;const w=typeof v.name=="string"&&v.name.trim()!==""?v.name:v.text;return{name:typeof w=="string"&&w.trim()!==""?w.trim():void 0,type:typeof v.$type=="string"?v.$type:""}},attach(x){c&&this.detach(),c=x,c.get("eventBus").on("commandStack.changed",g),t.value||h(c,!1),d(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",g),c&&!t.value&&h(c,!0),l=void 0,c=void 0,i.value=Xp,r.value=void 0,o.value=void 0},setEditable(x){t.value=x,c&&h(c,x)},async applyAgentBatch(x,m){const v=y();n.value=!0;try{const w=await Kg(v,x,{currentVersion:m,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return w.status==="applied"&&(e.value=!1),w}finally{n.value=!1}},async importXml(x){const{warnings:m}=await y().importXML(x);return e.value=!1,r.value=void 0,u(),{warnings:Tp(m)}},async saveXml(){const{xml:x}=await y().saveXML({format:!0});return e.value=!1,x??""},undo:()=>{var x;return(x=C())==null?void 0:x.undo()},redo:()=>{var x;return(x=C())==null?void 0:x.redo()},canUndo:()=>{var x;return((x=C())==null?void 0:x.canUndo())??!1},canRedo:()=>{var x;return((x=C())==null?void 0:x.canRedo())??!1}}}const LC=new RegExp("\\p{Script=Hangul}","u"),IC=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,BC=new RegExp("\\p{Script=Han}","u");function Zp(e){const t=LC.test(e),n=IC.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:BC.test(e)?"han":"other"}}function Xg(e){var t,n;return((t=e==null?void 0:e.get)==null?void 0:t.call(e,"xml:lang"))??((n=e==null?void 0:e.$attrs)==null?void 0:n["xml:lang"])}function Zg(e){var i;const t=new Set,n=[];for(const r of(e==null?void 0:e.diagrams)??[])for(const o of((i=r==null?void 0:r.plane)==null?void 0:i.planeElement)??[]){const a=o==null?void 0:o.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=uo(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:qo(a).filter(l=>In(l))})}return n}const ts=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function NC(e){const t=Xg(e),n=Zg(e);let i;const r={},o=[],a=[],s=[];for(const g of n){const h=g.trs.filter(y=>(y.body??"")===g.name).map(In);if(h.length){const y=[...h].sort().join("+");r[y]=(r[y]??0)+1,i=i?new Set([...i].filter(C=>h.includes(C))):new Set(h)}else g.trs.some(y=>y.body)?o.push(ts(g)):s.push({e:g,inference:Zp(g.name)});for(const y of g.trs){const C=In(y),x=y.body??"",m=Zp(x);m.locale&&m.locale!==C?a.push({...ts(g),locale:C,script:m.script}):C==="ko"&&m.script==="han"&&g.trs.some(v=>v!==y&&v.body===x)&&a.push({...ts(g),locale:C,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...ts(g),locale:h.locale}):d.push({...ts(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:o,matchedBy:r,scriptMismatch:a}}function $C(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Xg(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const r=new Map(Zg(e).map(o=>[o.bo.id,o]));for(const{id:o,name:a,locale:s}of t.additions){const c=r.get(o);if(!c||c.name!==a||c.trs.some(f=>f.body))continue;const l=c.trs.find(f=>In(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Uo,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Re(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function FC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qp={exports:{}},Qg;function jC(){if(Qg)return Qp.exports;Qg=1;var e=Qp.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 l=parseInt(a,n);return l!==1/0&&l>=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},Qp.exports}var HC=jC(),zC=FC(HC);function Wi(e){if(!(this instanceof Wi))return new Wi(e);e=e||[128,36,1],this._seed=e.length?zC.rack(e[0],e[1],e[2]):e}Wi.prototype.next=function(e){return this._seed(e||!0)},Wi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Wi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Wi.prototype.assigned=function(e){return this._seed.get(e)||!1},Wi.prototype.unclaim=function(e){delete this._seed.hats[e]},Wi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const pn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};pn.td=pn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],pn.option=pn.optgroup=[1,'<select multiple="multiple">',"</select>"],pn.thead=pn.tbody=pn.colgroup=pn.caption=pn.tfoot=[1,"<table>","</table>"],pn.polyline=pn.ellipse=pn.polygon=pn.circle=pn.text=pn.line=pn.path=pn.rect=pn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Bt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:p}=u;return p.remove(),p}let[r,o,a]=Object.hasOwn(pn,i)?pn[i]:pn._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function GC(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 Hn(e,...t){const n=e.style;return H(t,function(i){i&&H(i,function(r,o){n[o]=r})}),e}function Nn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const VC=Object.prototype.toString;function Ht(e){return new Tr(e)}function Tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Tr.prototype.add=function(e){return this.list.add(e),this},Tr.prototype.remove=function(e){return VC.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Tr.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},Tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Tr.prototype.array=function(){return Array.from(this.list)},Tr.prototype.has=Tr.prototype.contains=function(e){return this.list.contains(e)};function Gc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function go(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function WC(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vc={},Jg;function UC(){if(Jg)return Vc;Jg=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Vc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Vc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Vc}var ey=UC(),qC=WC(ey),Ge=GC({__proto__:null,default:qC},[ey]),ty=["focus","blur"];function YC(e,t,n,i,r){return ty.indexOf(n)!==-1&&(r=!0),Ge.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=go(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function KC(e,t,n,i){return ty.indexOf(t)!==-1&&(i=!0),Ge.unbind(e,t,n,i)}var Qn={bind:YC,unbind:KC};function Jp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function Wc(e,t){return t=t||document,t.querySelectorAll(e)}function Ui(e){e.parentNode&&e.parentNode.removeChild(e)}function XC(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function ZC(e,t){return t.appendChild(XC(e,t))}function Ve(e,t){return ZC(t,e),e}var ef=2,ny={"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":ef,"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":ef,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function QC(e,t){return ny[t]?e.style[t]:e.getAttributeNS(null,t)}function iy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ny[i];r?(r===ef&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function JC(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)iy(e,r,t[r])}function Ce(e,t,n){if(typeof t=="string")if(n!==void 0)iy(e,t,n);else return QC(e,t);else JC(e,t);return e}const eM=Object.prototype.toString;function st(e){return new kr(e)}function kr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}kr.prototype.add=function(e){return this.list.add(e),this},kr.prototype.remove=function(e){return eM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},kr.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},kr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},kr.prototype.array=function(){return Array.from(this.list)},kr.prototype.has=kr.prototype.contains=function(e){return this.list.contains(e)};function Uc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function ry(e){return e.cloneNode(!0)}var tf={svg:"http://www.w3.org/2000/svg"},oy='<svg xmlns="'+tf.svg+'"';function tM(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(tf.svg)===-1&&(e=oy+e.substring(4)):(e=oy+">"+e+"</svg>",t=!0);var n=nM(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function nM(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=tM(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(tf.svg,e),t&&Ce(n,t),n}var nf=null;function ay(){return nf===null&&(nf=Oe("svg")),nf}function sy(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function iM(e,t,n,i,r,o){var a=ay().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return sy(a,e);case 6:return sy(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function ns(e){return ay().createSVGTransform()}var cy=/([&<>]{1})/g,rM=/([&<>\n\r"]{1})/g,oM={"&":"&","<":"<",">":">",'"':"'"};function rf(e,t){function n(i,r){return oM[r]||r}return e.replace(t,n)}function ly(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(rf(e.textContent,cy));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,'="',rf(o.value,rM),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ly(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",rf(e.nodeValue,cy),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function aM(e){for(var t=e.firstChild,n=[];t;)ly(t,n),t=t.nextSibling;return n.join("")}function uy(e,t){return aM(e)}function fn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function sM(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function cM(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(sM(e,i))}function is(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),cM(n,t)),n.consolidate()}const lM=/^class[ {]/;function uM(e){return lM.test(e.toString())}function of(e){return Array.isArray(e)}function af(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function qc(...e){e.length===1&&of(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const pM=/constructor\s*[^(]*\(\s*([^)]*)\)/m,fM=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,dM=/\/\*([^*]*)\*\//m;function hM(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(uM(e)?pM:fM);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(dM);return(r&&r[1]||i).trim()})||[]}function py(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!r[m]&&m.includes(".")){const w=m.split(".");let E=c(w.shift());for(;w.length;)E=E[w.shift()];return E}if(af(o,m))return o[m];if(af(r,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),o[m]=r[m][0](r[m][1]),i.pop(),o[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(of(m))m=qc(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const E=(m.$inject||hM(m)).map(P=>af(v,P)?v[P]:c(P));return{fn:m,dependencies:E}}function u(m){const{fn:v,dependencies:w}=l(m),E=Function.prototype.bind.call(v,null,...w);return new E}function p(m,v,w){const{fn:E,dependencies:P}=l(m,w);return E.apply(v,P)}function f(m){return qc(v=>m.get(v))}function d(m,v){if(v&&v.length){const w=Object.create(null),E=Object.create(null),P=[],k=[],$=[];let N,L,z,X;for(let oe in r)N=r[oe],v.indexOf(oe)!==-1&&(N[2]==="private"?(L=P.indexOf(N[3]),L===-1?(z=N[3].createChild([],v),X=f(z),P.push(N[3]),k.push(z),$.push(X),w[oe]=[X,oe,"private",z]):w[oe]=[$[L],oe,"private",k[L]]):w[oe]=[N[2],N[1]],E[oe]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&v.forEach(te=>{N[1].$scope.indexOf(te)!==-1&&(w[oe]=[N[2],N[1]],E[te]=!0)});v.forEach(oe=>{if(!E[oe])throw new Error('No provider for "'+oe+'". Cannot use provider from the parent!')}),m.unshift(w)}return new py(m,a)}const g={factory:p,type:u,value:function(m){return m}};function h(m,v){const w=m.__init__||[];return function(){w.forEach(E=>{typeof E=="string"?v.get(E):v.invoke(E)})}}function y(m){const v=m.__exports__;if(v){const w=m.__modules__,E=Object.keys(m).reduce((L,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(L[z]=m[z]),L),Object.create(null)),P=(w||[]).concat(E),k=d(P),$=qc(function(L){return k.get(L)});v.forEach(function(L){r[L]=[$,L,"private",k]});const N=(m.__init__||[]).slice();return N.unshift(function(){k.init()}),m=Object.assign({},m,{__init__:N}),h(m,k)}return Object.keys(m).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const E=m[w];if(E[2]==="private"){r[w]=E;return}const P=E[0],k=E[1];r[w]=[g[P],mM(P,k),P]}),h(m,a)}function C(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(C,m),m.indexOf(v)!==-1)?m:m.concat(v)}function x(m){const v=m.reduce(C,[]).map(y);let w=!1;return function(){w||(w=!0,v.forEach(E=>E()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=x(e)}function mM(e,t){return e!=="value"&&of(t)&&(t=qc(t.slice())),t}var gM=1e3;function cr(e,t){var n=this;t=t||gM,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)})}cr.prototype.canRender=function(e){},cr.prototype.drawShape=function(e,t){},cr.prototype.drawConnection=function(e,t){},cr.prototype.getShapePath=function(e){},cr.prototype.getConnectionPath=function(e){};function yo(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function yM(e){return["M",e.x,e.y]}function sf(e){return["L",e.x,e.y]}function vM(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function bM(e,t){const n=e.length,i=[yM(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(sf(a));continue}const c=Math.min(t,cf(a.x-o.x,a.y-o.y),cf(s.x-a.x,s.y-a.y));if(!c){i.push(sf(a));continue}const l=Yc(a,o,c),u=Yc(a,o,c*.5),p=Yc(a,s,c),f=Yc(a,s,c*.5);i.push(sf(l)),i.push(vM(u,f,p))}return i}function Yc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=cf(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function cf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function rs(e,t,n){ze(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return ze(n)&&(i.dataset.cornerRadius=String(n)),lf(i,e)}function lf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Ce(e,{d:yo(bM(t,n))}),e}function Kc(e){var t=new Set(e);return it(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function vo(e,t,n){n=n||0,Ne(e)||(e=[e]),H(e,function(i,r){var o=t(i,r,n);Ne(o)&&o.length&&vo(o,t,n+1)})}function uf(e,t,n){var i=new Set,r=new Set;return vo(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 os(e,t){return uf(e)}function xM(e,t,n){co(t)&&(t=!0),gn(t)&&(n=t,t=!0),n=n||{};var i=as(n.allShapes),r=as(n.allConnections),o=as(n.enclosedElements),a=as(n.enclosedConnections),s=as(n.topLevel,t&&Vo(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,H(u.incoming,c),H(u.outgoing,c),u.children}return vo(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function rn(e,t){t=!!t,Ne(e)||(e=[e]);var n,i,r,o;return H(e,function(a){var s=a;a.waypoints&&!t&&(s=rn(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>r||r===void 0)&&(r=c+p),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function aa(e,t){var n={};return H(e,function(i){var r=i;r.waypoints&&(r=rn(r)),!ze(t.y)&&r.x>t.x&&(n[i.id]=i),!ze(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ze(t.width)&&ze(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ze(t.width)||!ze(t.height))&&(n[i.id]=i)}),n}function fy(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function dy(e){return!!(e&&e.isFrame)}function as(e,t){return q({},e||{},t||{})}var wM=1;function Or(e,t){cr.call(this,e,wM),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})}Re(Or,cr),Or.prototype.canRender=function(){return!0},Or.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Ce(r,{x:0,y:0,width:n.width||0,height:n.height||0}),dy(n)?Ce(r,q({},this.FRAME_STYLE,i||{})):Ce(r,q({},this.SHAPE_STYLE,i||{})),Ve(t,r),r},Or.prototype.drawConnection=function(t,n,i){var r=rs(n.waypoints,q({},this.CONNECTION_STYLE,i||{}));return Ve(t,r),r},Or.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 yo(a)},Or.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 yo(o)},Or.$inject=["eventBus","styles"];function _M(){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 q(o,{class:n})},this.style=function(n,i){!Ne(n)&&!i&&(i=n,n=[]);var r=Zn(n,function(o,a){return q(o,e[a]||{})},{});return i?q(r,i):r},this.computeStyle=function(n,i,r){return Ne(i)||(r=i,i=[]),t.style(i||[],q({},r,n||{}))}}const EM={__init__:["defaultRenderer"],defaultRenderer:["type",Or],styles:["type",_M]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function tn(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 pf(e,t){return!e||!t?-1:e.indexOf(t)}function ss(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ff(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=ss(e,t);return Math.abs(r/o)<=i}var SM=2;function lr(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(RM(r,n))return o;return!1}function RM(e,t){const n=t[0];return lo(t,function(i){return Math.abs(n[e]-i[e])<=SM})}function hy(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 df(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var CM=/,?([a-z]),?/gi,my=parseFloat,on=Math,Dr=on.PI,qi=on.min,Yi=on.max,gy=on.pow,Lr=on.abs,MM=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,AM=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,yy=Array.isArray||function(e){return e instanceof Array};function PM(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function TM(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 kM(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 PM(r,i)?(TM(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function OM(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(MM,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(AM,function(c,l){l&&a.push(+l)}),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=mf,n}function DM(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 LM(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 hf(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 mf(){return this.join(",").replace(CM,"$1")}function IM(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=mf,t}function vy(e,t,n,i,r,o,a,s,c){var l=1-c,u=gy(l,3),p=gy(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*r+d*a,h=u*t+p*3*c*i+l*3*c*c*o+d*s;return{x:Xc(g),y:Xc(h)}}function by(e){var t=HM(...e);return hf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Ir(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function BM(e,t){return e=hf(e),t=hf(t),Ir(t,e.x,e.y)||Ir(t,e.x2,e.y)||Ir(t,e.x,e.y2)||Ir(t,e.x2,e.y2)||Ir(e,t.x,t.y)||Ir(e,t.x2,t.y)||Ir(e,t.x,t.y2)||Ir(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 xy(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 wy(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=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<u;g++){var h=l*p[g]+l,y=xy(h,e,n,r,a),C=xy(h,t,i,o,s),x=y*y+C*C;d+=f[g]*on.sqrt(x)}return l*d}function NM(e,t,n,i,r,o,a,s){if(!(Yi(e,n)<qi(r,a)||qi(e,n)>Yi(r,a)||Yi(t,i)<qi(o,s)||qi(t,i)>Yi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var p=Xc(c/u),f=Xc(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+qi(e,n).toFixed(2)||d>+Yi(e,n).toFixed(2)||d<+qi(r,a).toFixed(2)||d>+Yi(r,a).toFixed(2)||g<+qi(t,i).toFixed(2)||g>+Yi(t,i).toFixed(2)||g<+qi(o,s).toFixed(2)||g>+Yi(o,s).toFixed(2)))return{x:p,y:f}}}}function Xc(e){return Math.round(e*1e11)/1e11}function $M(e,t,n){var i=by(e),r=by(t);if(!BM(i,r))return[];var o=wy(...e),a=wy(...t),s=Ey(e)?1:~~(o/5)||1,c=Ey(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=vy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=vy(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],C=l[d+1],x=u[g],m=u[g+1],v=Lr(C.x-y.x)<.01?"y":"x",w=Lr(m.x-x.x)<.01?"y":"x",E=NM(y.x,y.y,C.x,C.y,x.x,x.y,m.x,m.y),P;if(E){if(P=E.x.toFixed(9)+"#"+E.y.toFixed(9),p[P])continue;p[P]=!0;var k=y.t+Lr((E[v]-y[v])/(C[v]-y[v]))*(C.t-y.t),$=x.t+Lr((E[w]-x[w])/(m[w]-x[w]))*(m.t-x.t);k>=0&&k<=1&&$>=0&&$<=1&&f.push({x:E.x,y:E.y,t1:k,t2:$})}}return f}function _y(e,t,n){e=Cy(e),t=Cy(t);for(var i,r,o,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(p=[i,r,...y.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var C=0,x=t.length;C<x;C++){var m=t[C];if(m[0]=="M")o=l=m[1],a=u=m[2];else{m[0]=="C"?(f=[o,a,...m.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,l,u,l,u],o=l,a=u);var v=$M(p,f);{for(var w=0,E=v.length;w<E;w++)v[w].segment1=g,v[w].segment2=C,v[w].bez1=p,v[w].bez2=f;d=d.concat(v)}}}}}return d}function FM(e){return yy(e)&&yy(e[0])}function jM(e){if(DM(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,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[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=mf,t}function Ey(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Zc(e,t,n,i){return[e,t,n,i,n,i]}function Sy(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 Ry(e,t,n,i,r,o,a,s,c,l){var u=Dr*120/180,p=Dr/180*(+r||0),f=[],d,g=kM(function(B,R,_){var G=B*on.cos(_)-R*on.sin(_),U=B*on.sin(_)+R*on.cos(_);return{x:G,y:U}});if(l)P=l[0],k=l[1],w=l[2],E=l[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,y=(t-c)/2,C=h*h/(n*n)+y*y/(i*i);C>1&&(C=on.sqrt(C),n=C*n,i=C*i);var x=n*n,m=i*i,v=(o==a?-1:1)*on.sqrt(Lr((x*m-x*y*y-m*h*h)/(x*y*y+m*h*h))),w=v*n*y/i+(e+s)/2,E=v*-i*h/n+(t+c)/2,P=on.asin(((t-E)/i).toFixed(9)),k=on.asin(((c-E)/i).toFixed(9));P=e<w?Dr-P:P,k=s<w?Dr-k:k,P<0&&(P=Dr*2+P),k<0&&(k=Dr*2+k),a&&P>k&&(P=P-Dr*2),!a&&k>P&&(k=k-Dr*2)}var $=k-P;if(Lr($)>u){var N=k,L=s,z=c;k=P+u*(a&&k>P?1:-1),s=w+n*on.cos(k),c=E+i*on.sin(k),f=Ry(s,c,n,i,r,0,a,L,z,[k,N,w,E])}$=k-P;var X=on.cos(P),oe=on.sin(P),te=on.cos(k),je=on.sin(k),qe=on.tan($/4),He=4/3*n*qe,Se=4/3*i*qe,Z=[e,t],ie=[e+He*oe,t-Se*X],V=[s+He*je,c-Se*te],Y=[s,c];if(ie[0]=2*Z[0]-ie[0],ie[1]=2*Z[1]-ie[1],l)return[ie,V,Y].concat(f);f=[ie,V,Y].concat(f).join().split(",");for(var ae=[],me=0,Te=f.length;me<Te;me++)ae[me]=me%2?g(f[me-1],f[me],p).y:g(f[me],f[me+1],p).x;return ae}function HM(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,y,C,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,f=3*i-3*t),Lr(u)<1e-12){if(Lr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}y=p*p-4*f*u,C=on.sqrt(y),!(y<0)&&(g=(-p+C)/(2*u),0<g&&g<1&&c.push(g),h=(-p-C)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,w;m--;)d=c[m],w=1-d,l[0][m]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,l[1][m]=w*w*w*t+3*w*w*d*i+3*w*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:qi(...l[0]),y0:qi(...l[1]),x1:Yi(...l[0]),y1:Yi(...l[1])}}function Cy(e){if(FM(e)||(e=OM(e)),LM(e))return e;for(var t=IM(jM(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,y;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",...Ry(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),f=["C",h,y,...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",...Sy(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",...Sy(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Zc(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Zc(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Zc(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Zc(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),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;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 u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=my(u[p-4])||n.x,n.by=my(u[p-3])||n.y}return t}function Mt(e){return gn(e)&&Xn(e,"waypoints")}function Je(e){return gn(e)&&Xn(e,"labelTarget")}function zM(e){return gn(e)&&zo(e.parent)}function My(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function ur(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Qc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function GM(e){return ur({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function VM(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=qM(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.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 $e(e){return Mt(e)?VM(e):GM(e)}function Tn(e,t,n){n=n||0,gn(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(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,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function cs(e,t,n){var i=WM(e,t);return i.length===1||i.length===2&&ss(i[0],i[1])<1?ur(i[0]):i.length>1?(i=ji(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),ur(i[n?0:i.length-1])):null}function WM(e,t){return _y(e,t)}function UM(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ss(n,r)===0||ff(i,r,n)?e.splice(t,1):t++;return e}function qM(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Jc(e,t){return Math.round(e*t)/t}function Ay(e){return ze(e)?e+"px":e}function YM(e){for(;e.parent;)e=e.parent;return e}function KM(e){e=q({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Hn(n,{position:"relative",overflow:"hidden",width:Ay(e.width),height:Ay(e.height)}),t.appendChild(n),n}function Py(e,t,n){const i=Oe("g");st(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const XM="base",Ty=0,ZM=1,QM={shape:["x","y","width","height"],connection:["waypoints"]};function Fe(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||{})}Fe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Fe.prototype._init=function(e){const t=this._eventBus,n=this._container=KM(e),i=this._svg=Oe("svg");Ce(i,{width:"100%",height:"100%"}),Nn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Ve(n,i);const r=this._viewport=Py(i,"viewport");e.deferUpdate&&(this._viewboxChanged=lp(this._viewboxChanged,300)),this._restoreFocus=lp(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)},Fe.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},Fe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Fe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=fy(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Fe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Fe.prototype.restoreFocus=function(){this._restoreFocus()},Fe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Fe.prototype.isFocused=function(){return this._focused},Fe.prototype.getDefaultLayer=function(){return this.getLayer(XM,Ty)},Fe.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},Fe.prototype._getChildIndex=function(e){return Zn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Fe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=ZM);const n=this._getChildIndex(t);return{group:Py(this._viewport,"layer-"+e,n),index:t,visible:!0}},Fe.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},Fe.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&&(fn(n),t.visible=!1),n},Fe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],fn(t.group))},Fe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Fe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(YM(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Fe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Fe.prototype._findPlaneForRoot=function(e){return Tt(this._planes,function(t){return t.rootElement===e})},Fe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Fe.prototype._resolveElements=function(e){return Ne(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Fe.prototype.getContainer=function(){return this._container},Fe.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&&(H([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),st(r).add(t)):(e.markers.delete(t),st(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Fe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Fe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Fe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Fe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Fe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Fe.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,Ty);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Fe.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},Fe.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},Fe.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)},Fe.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})},Fe.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})},Fe.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=QM[e];if(!lo(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Fe.prototype._setParent=function(e,t,n){tn(t.children,e,n),e.parent=t},Fe.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},Fe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Fe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Fe.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),Zt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Fe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Fe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Fe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Fe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Fe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Fe.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,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);is(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=is(t),r=a?a.matrix:iM(),s=Jc(r.a,1e3),c=Jc(-r.e||0,1e3),l=Jc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/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},Fe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=q({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),ky(t,n)}),{x:n.e,y:n.f}},Fe.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=rn(o),s=Ie(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Ie(c);if(!(a.width<c.width&&a.height<c.height))u=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),y=Math.max(0,s.bottom-f.bottom),C=Math.min(0,s.top-f.top);u=g||h,p=y||C}this.scroll({dx:-u*l,dy:-p*l})},Fe.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)}),Jc(i.a,1e3)};function ky(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Fe.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},Fe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=q(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),ky(this._viewport,u),u},Fe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Fe.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}},Fe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var sa="data-element-id";function di(e){this._elements={},this._eventBus=e}di.$inject=["eventBus"],di.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Ce(t,sa,i),n&&Ce(n,sa,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},di.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Ce(i.gfx,sa,""),i.secondaryGfx&&Ce(i.secondaryGfx,sa,""),delete t[n])},di.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)},di.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Ce(t,sa,i),t},di.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Ce(e,sa);var n=this._elements[t];return n&&n.element},di.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},di.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}},di.prototype.getAll=function(){return this.filter(function(e){return e})},di.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)})},di.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},di.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 JM(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 eA(e){return e.__refs_collection===!0}function tA(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Oy(e,t,n){var i=JM(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 nA(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 bi(e,t){if(!(this instanceof bi))return new bi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}bi.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?Oy(this,t,e):nA(this,t,e)},bi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return eA(n)||Oy(this,t,e),n},bi.prototype.ensureBound=function(e,t){tA(e,t)||this.bind(e,t)},bi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},bi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var gf=new bi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Dy=new bi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ly=new bi({name:"attachers",collection:!0},{name:"host"}),Iy=new bi({name:"outgoing",collection:!0},{name:"source"}),By=new bi({name:"incoming",collection:!0},{name:"target"});function ca(){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)}}),gf.bind(this,"parent"),Dy.bind(this,"labels"),Iy.bind(this,"outgoing"),By.bind(this,"incoming")}function ls(){ca.call(this),gf.bind(this,"children"),Ly.bind(this,"host"),Ly.bind(this,"attachers")}Re(ls,ca);function Ny(){ca.call(this),gf.bind(this,"children")}Re(Ny,ls);function $y(){ls.call(this),Dy.bind(this,"labelTarget")}Re($y,ls);function Fy(){ca.call(this),Iy.bind(this,"source"),By.bind(this,"target")}Re(Fy,ca);var iA={connection:Fy,shape:ls,label:$y,root:Ny};function rA(e,t){var n=iA[e];if(!n)throw new Error("unknown type: <"+e+">");return q(new n,t)}function oA(e){return e instanceof ca}function pr(){this._uid=12}pr.prototype.createRoot=function(e){return this.create("root",e)},pr.prototype.createLabel=function(e){return this.create("label",e)},pr.prototype.createShape=function(e){return this.create("shape",e)},pr.prototype.createConnection=function(e){return this.create("connection",e)},pr.prototype.create=function(e,t){return t=q({},t||{}),t.id||(t.id=e+"_"+this._uid++),rA(e,t)};var el="__fn",jy=1e3,aA=Array.prototype.slice;function Jn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Jn.prototype.on=function(e,t,n,i){if(e=Ne(e)?e:[e],yn(t)&&(i=n,n=t,t=jy),!ze(t))throw new Error("priority must be a number");var r=n;i&&(r=Un(n,i),r[el]=n[el]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Jn.prototype.once=function(e,t,n,i){var r=this;if(yn(t)&&(i=n,n=t,t=jy),!ze(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[el]=n,this.on(e,t,o)},Jn.prototype.off=function(e,t){e=Ne(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Jn.prototype.createEvent=function(e){var t=new us;return t.init(e),t},Jn.prototype.fire=function(e,t){var n,i,r,o;if(o=aA.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 us?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}},Jn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Jn.prototype._destroy=function(){this._listeners={}},Jn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Jn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=sA(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},Jn.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},Jn.prototype._getListeners=function(e){return this._listeners[e]},Jn.prototype._setListeners=function(e,t){this._listeners[e]=t},Jn.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[el]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function us(){}us.prototype.stopPropagation=function(){this.cancelBubble=!0},us.prototype.preventDefault=function(){this.defaultPrevented=!0},us.prototype.init=function(e){q(this,e||{})};function sA(e,t){return e.apply(null,t)}function bo(e){return e.childNodes[0]}function cA(e){return e.parentNode.childNodes[1]}function tl(e,t,n,i,r){var o=ns();o.setTranslate(t,n);var a=ns();a.setRotate(i||0,0,0);var s=ns();s.setScale(1,1),is(e,[o,a,s])}function kn(e,t,n){var i=ns();i.setTranslate(t,n),is(e,i)}function Hy(e,t){var n=ns();n.setRotate(t,0,0),is(e,n)}function hi(e,t){this._eventBus=e,this._elementRegistry=t}hi.$inject=["eventBus","elementRegistry"],hi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=cA(t),n||(n=Oe("g"),st(n).add("djs-children"),Ve(t.parentNode,n))):n=t,n},hi.prototype._clear=function(e){var t=bo(e);return Gc(t),t},hi.prototype._createContainer=function(e,t,n,i){var r=Oe("g");st(r).add("djs-group"),typeof n<"u"?lA(r,t,t.childNodes[n]):Ve(t,r);var o=Oe("g");st(o).add("djs-element"),st(o).add("djs-"+e),i&&st(o).add("djs-frame"),Ve(r,o);var a=Oe("g");return st(a).add("djs-visual"),Ve(o,a),o},hi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,dy(t))},hi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Zn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),H(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;H(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},hi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},hi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},hi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},hi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},hi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),kn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Ce(n,"display","none"):Ce(n,"display","block")}},hi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);fn(t.parentNode)};function lA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const uA={__depends__:[EM],__init__:["canvas"],canvas:["type",Fe],elementRegistry:["type",di],elementFactory:["type",pr],eventBus:["type",Jn],graphicsFactory:["type",hi]};function pA(e){var t=new py(e);return t.init(),t}function fA(e){e=e||{};var t={config:["value",e]},n=[t,uA].concat(e.modules||[]);return pA(n)}function Br(e,t){this._injector=t||fA(e),this.get("eventBus").fire("diagram.init")}Br.prototype.get=function(e,t){return this._injector.get(e,t)},Br.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Br.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Br.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function $n(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function qn(e,t){return e.$instanceOf(t)}function dA(e){return Tt(e.rootElements,function(t){return qn(t,"bpmn:Process")||qn(t,"bpmn:Collaboration")})}function hA(e){var t={},n=[],i={};function r(V,Y){return function(ae){V(ae,Y)}}function o(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,Y){var ae=V.gfx;if(ae)throw new Error(`already rendered ${$n(V)}`);return e.element(V,i[V.id],Y)}function c(V,Y){return e.root(V,i[V.id],Y)}function l(V,Y){try{var ae=i[V.id]&&s(V,Y);return o(V),ae}catch(me){u(me.message,{element:V,error:me}),console.error(`failed to import ${$n(V)}`,me)}}function u(V,Y){e.error(V,Y)}var p=this.registerDi=function(Y){var ae=Y.bpmnElement;ae?i[ae.id]?u(`multiple DI elements defined for ${$n(ae)}`,{element:ae}):i[ae.id]=Y:u(`no bpmnElement referenced in ${$n(Y)}`,{element:Y})};function f(V){d(V.plane)}function d(V){p(V),H(V.planeElement,g)}function g(V){p(V)}this.handleDefinitions=function(Y,ae){var me=Y.diagrams;if(ae&&me.indexOf(ae)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ae&&me&&me.length&&(ae=me[0]),!ae)throw new Error("no diagram to display");i={},f(ae);var Te=ae.plane;if(!Te)throw new Error(`no plane for ${$n(ae)}`);var B=Te.bpmnElement;if(!B)if(B=dA(Y),B)u(`correcting missing bpmnElement on ${$n(Te)} to ${$n(B)}`),Te.bpmnElement=B,p(Te);else throw new Error("no process or collaboration to display");var R=c(B,Te);if(qn(B,"bpmn:Process")||qn(B,"bpmn:SubProcess"))y(B,R);else if(qn(B,"bpmn:Collaboration"))Z(B,R),C(Y.rootElements,R);else throw new Error(`unsupported bpmnElement for ${$n(Te)}: ${$n(B)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function y(V,Y){qe(V,Y),$(V.ioSpecification,Y),k(V.artifacts,Y),o(V)}function C(V,Y){var ae=it(V,function(me){return!a(me)&&qn(me,"bpmn:Process")&&me.laneSets});ae.forEach(r(y,Y))}function x(V,Y){l(V,Y)}function m(V,Y){H(V,r(x,Y))}function v(V,Y){l(V,Y)}function w(V,Y){l(V,Y)}function E(V,Y){l(V,Y)}function P(V,Y){l(V,Y)}function k(V,Y){H(V,function(ae){qn(ae,"bpmn:Association")?n.push(function(){P(ae,Y)}):P(ae,Y)})}function $(V,Y){V&&(H(V.dataInputs,r(w,Y)),H(V.dataOutputs,r(E,Y)))}var N=this.handleSubProcess=function(Y,ae){qe(Y,ae),k(Y.artifacts,ae)};function L(V,Y){var ae=l(V,Y);qn(V,"bpmn:SubProcess")&&N(V,ae||Y),qn(V,"bpmn:Activity")&&$(V.ioSpecification,Y),n.push(function(){H(V.dataInputAssociations,r(v,Y)),H(V.dataOutputAssociations,r(v,Y))})}function z(V,Y){l(V,Y)}function X(V,Y){l(V,Y)}function oe(V,Y){n.push(function(){var ae=l(V,Y);V.childLaneSet&&te(V.childLaneSet,ae||Y),ie(V)})}function te(V,Y){H(V.lanes,r(oe,Y))}function je(V,Y){H(V,r(te,Y))}function qe(V,Y){He(V.flowElements,Y),V.laneSets&&je(V.laneSets,Y)}function He(V,Y){H(V,function(ae){qn(ae,"bpmn:SequenceFlow")?n.push(function(){z(ae,Y)}):qn(ae,"bpmn:BoundaryEvent")?n.unshift(function(){L(ae,Y)}):qn(ae,"bpmn:FlowNode")?L(ae,Y):qn(ae,"bpmn:DataObject")||(qn(ae,"bpmn:DataStoreReference")||qn(ae,"bpmn:DataObjectReference")?X(ae,Y):u(`unrecognized flowElement ${$n(ae)} in context ${$n(Y&&Y.businessObject)}`,{element:ae,context:Y}))})}function Se(V,Y){var ae=l(V,Y),me=V.processRef;me&&y(me,ae||Y)}function Z(V,Y){H(V.participants,r(Se,Y)),n.push(function(){m(V.messageFlows,Y)}),k(V.artifacts,Y)}function ie(V){H(V.flowNodeRef,function(Y){var ae=Y.get("lanes");ae&&ae.push(V)})}}function mA(e,t,n){var i,r,o,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,C){return i.add(h,y,C)},error:function(h,y){s.push({message:h,context:y})}},f=new hA(p);u=u||l.diagrams&&l.diagrams[0];var d=gA(l,u);if(!d)throw new Error("no diagram to display");H(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}return new Promise(function(l,u){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}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function gA(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=yA(n));var r;M(i,"bpmn:Collaboration")?r=i:r=Tt(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Tt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Ln(r.participants,function(l){return l.processRef}),o.push(r));var a=zy(o),s=[t],c=[n];return H(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function zy(e){var t=[];return H(e,function(n){n&&(t.push(n),t=t.concat(zy(n.flowElements)))}),t}function yA(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var vA='<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>',Gy=vA,Vy={verticalAlign:"middle"},Wy={color:"#404040"},bA={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},xA={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},wA={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"},_A='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Gy+'</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>',Ki;function EA(){Ki=Bt(_A),Hn(Ki,bA),Hn(Rt("svg",Ki),Vy),Hn(Rt(".backdrop",Ki),xA),Hn(Rt(".notice",Ki),wA),Hn(Rt(".link",Ki),Wy,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function SA(){Ki||(EA(),Qn.bind(Ki,".backdrop","click",function(e){document.body.removeChild(Ki)})),document.body.appendChild(Ki)}const nl=5,Uy="djs-outline-hidden";function Gt(e){e=q({},CA,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),AA(this._container)}Re(Gt,Br),Gt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,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||[]),il(s,o),s=RA(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw il(o,[]),o}if(typeof t=="string"&&(i=MA(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw il(o,[]),o}try{this.clear()}catch(o){throw il(o,[]),o}const{warnings:r}=await mA(this,n,i);return{warnings:r}},Gt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Rt(":scope > defs",i._svg),a=uy(r),s=o?"<defs>"+uy(o)+"</defs>":"",c=i.getContainer();Ht(c).add(Uy);let l;try{l=r.getBBox()}finally{Ht(c).remove(Uy)}const u=l.x-nl,p=l.y-nl,f=l.width+nl*2,d=l.height+nl*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="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&Br.prototype.clear.call(this)},Gt.prototype.destroy=function(){Br.prototype.destroy.call(this),Ui(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=U(Hi(n,["additionalModules"]),{canvas:U({},n.canvas,{container:e}),modules:a});Br.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=Bt('<div class="bjs-container"></div>');return Hn(t,{width:Wy(e.width),height:Wy(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=U({},this._moddleExtensions,e.moddleExtensions);return new Tm(t)},Gt.prototype._modules=[];function tl(e,t){return e.warnings=t,e}function _A(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 EA={width:"100%",height:"100%",position:"relative"};function Wy(e){return e+(He(e)?"px":"")}function SA(e,t){return t&&Tt(e.diagrams,function(n){return n.id===t})||null}function RA(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Hy+"</a>",i=Bt(n);Hn(Rt("svg",i),zy),Hn(i,Gy,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),ze.bind(i,"click",function(r){wA(),r.preventDefault()})}function la(e){Gt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(la,Gt),la.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Wi([32,36,1]),t},la.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 at(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||ut(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!pe(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=ut(e).isHorizontal;return t===void 0?!0:t}}function CA(e){return e&&pe(e).isInterrupting!==!1}function Fn(e){return e&&!!pe(e).triggeredByEvent}function ua(e,t){var n=pe(e).eventDefinitions;return Rr(n,function(i){return M(i,t)})}function MA(e){return ua(e,"bpmn:ErrorEventDefinition")}function AA(e){return ua(e,"bpmn:EscalationEventDefinition")}function PA(e){return ua(e,"bpmn:CompensateEventDefinition")}var xo={width:90,height:20},Uy=15;function Nr(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function nl(e){return Qe(e.label)}function TA(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=kA(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-=Uy:a+=Uy,{x:a,y:s}}function kA(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 gf(e){return e.waypoints?TA(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+xo.height/2}:{x:e.x+e.width/2,y:e.y+e.height+xo.height/2}}function OA(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(xo.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=gf(t),i=xo),U({x:n.x-i.width/2,y:n.y-i.height/2},i)}function qy(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function DA(e){var t=e.categoryValueRef;return t&&t.value||""}function mi(e){var t=e.businessObject,n=qy(t);if(n)return n==="categoryValueRef"?DA(t):t[n]||""}function LA(e,t){var n=e.businessObject,i=qy(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function IA(e){return Qe(e)&&Nr(e.labelTarget)}var pa=7;function Yy(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ps(e){const t=new Map;return z(lf(e),n=>{z(Yy(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 yf="hsl(225, 10%, 15%)",BA="white";function Xi(e,t){return Rr(e.eventDefinitions,function(n){return n.$type===t})}function NA(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function $A(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function rt(e,t,n){var i=ut(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||BA}function _e(e,t,n){var i=ut(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||yf}function fs(e,t,n,i){var r=ut(e),o=r.get("label");return i||o&&o.get("color:color")||t||_e(e,n)}function Ky(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 yo(r)}function vf(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 yo(a)}function FA(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 yo(s)}function jA(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 yo(o)}function ds(e,t={}){return{width:xi(e,t),height:ei(e,t)}}function xi(e,t={}){return Xn(t,"width")?t.width:e.width}function ei(e,t={}){return Xn(t,"height")?t.height:e.height}var HA=new Wi,zA=10,il=3,GA=1.5,rl=10,VA=4,fa=.95,WA=1,UA=.25;function wo(e,t,n,i,r,o,a){cr.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u($){return n.computeStyle($,{strokeLinecap:"round",strokeLinejoin:"round",stroke:yf,strokeWidth:2,fill:"white"})}function p($){return n.computeStyle($,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:yf,strokeWidth:2})}function f($,R){var{ref:_={x:0,y:0},scale:G=1,element:W,parentGfx:te=r._svg}=R,Re=Oe("marker",{id:$,viewBox:"0 0 20 20",refX:_.x,refY:_.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ge(Re,W);var Ke=Rt(":scope > defs",te);Ke||(Ke=Oe("defs"),Ge(te,Ke)),Ge(Ke,Re)}function d($,R,_,G){var W=HA.nextPrefixed("marker-");return g($,W,R,_,G),"url(#"+W+")"}function g($,R,_,G,W){if(_==="sequenceflow-end"){var te=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:W,stroke:W,strokeWidth:1})});f(R,{element:te,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(_==="messageflow-start"){var Re=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Re,ref:{x:6,y:6},parentGfx:$})}if(_==="messageflow-end"){var Ke=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:W,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Ke,ref:{x:8.5,y:5},parentGfx:$})}if(_==="association-start"){var mt=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:$})}if(_==="association-end"){var qt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:W,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:qt,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(_==="conditional-flow-marker"){var Et=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:W})});f(R,{element:Et,ref:{x:-1,y:10},scale:.5,parentGfx:$})}if(_==="conditional-default-flow-marker"){var mn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:W,fill:"none"})});f(R,{element:mn,ref:{x:0,y:10},scale:.5,parentGfx:$})}}function h($,R,_,G,W={}){gn(G)&&(W=G,G=0),G=G||0,W=u(W);var te=R/2,Re=_/2,Ke=Oe("circle",{cx:te,cy:Re,r:Math.round((R+_)/4-G),...W});return Ge($,Ke),Ke}function y($,R,_,G,W,te){gn(W)&&(te=W,W=0),W=W||0,te=u(te);var Re=Oe("rect",{x:W,y:W,width:R-W*2,height:_-W*2,rx:G,ry:G,...te});return Ge($,Re),Re}function C($,R,_,G){var W=R/2,te=_/2,Re=[{x:W,y:0},{x:R,y:te},{x:W,y:_},{x:0,y:te}],Ke=Re.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var mt=Oe("polygon",{...G,points:Ke});return Ge($,mt),mt}function x($,R,_,G){_=p(_);var W=rs(R,_,G);return Ge($,W),W}function m($,R,_){return x($,R,_,5)}function v($,R,_){_=p(_);var G=Oe("path",{..._,d:R});return Ge($,G),G}function w($,R,_,G){return v(R,_,U({"data-marker":$},G))}function S($){return Te[$]}function k($){return function(R,_,G){return S($)(R,_,G)}}var O={"bpmn:MessageEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.235,my:.315}}),te=G?_e(R,c,_.stroke):rt(R,s,_.fill),Re=G?rt(R,s,_.fill):_e(R,c,_.stroke),Ke=v($,W,{fill:te,stroke:Re,strokeWidth:1});return Ke},"bpmn:TimerEventDefinition":function($,R,_={}){var G=_.width||R.width,W=_.height||R.height,te=_.width?1:2,Re=h($,G,W,.2*W,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:te}),Ke=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:W,position:{mx:.5,my:.5}});v($,Ke,{stroke:_e(R,c,_.stroke),strokeWidth:te});for(var mt=0;mt<12;mt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:W,position:{mx:.5,my:.5}}),Et=G/2,mn=W/2;v($,qt,{strokeWidth:1,stroke:_e(R,c,_.stroke),transform:"rotate("+mt*30+","+mn+","+Et+")"})}return Re},"bpmn:EscalationEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.2}}),te=G?_e(R,c,_.stroke):rt(R,s,_.fill);return v($,W,{fill:te,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function($,R,_={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.222}});return v($,G,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.57,my:.263}}),te=G?_e(R,c,_.stroke):rt(R,s,_.fill);return v($,W,{fill:te,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.2,my:.722}}),te=G?_e(R,c,_.stroke):rt(R,s,_.fill);return v($,W,{fill:te,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.638,my:-.055}}),te=G?_e(R,c,_.stroke):"none",Re=v($,W,{fill:te,stroke:_e(R,c,_.stroke),strokeWidth:1});return Fy(Re,45),Re},"bpmn:CompensateEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.22,my:.5}}),te=G?_e(R,c,_.stroke):rt(R,s,_.fill);return v($,W,{fill:te,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.2}}),te=G?_e(R,c,_.stroke):rt(R,s,_.fill);return v($,W,{strokeWidth:1,fill:te,stroke:_e(R,c,_.stroke)})},"bpmn:MultipleEventDefinition":function($,R,_={},G){var W=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.211,my:.36}}),te=G?_e(R,c,_.stroke):rt(R,s,_.fill);return v($,W,{fill:te,stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function($,R,_={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.458,my:.194}});return v($,G,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function($,R,_={}){var G=h($,R.width,R.height,8,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:4});return G}};function N($,R,_={},G){var W=pe($),te=NA(W),Re=G||$;return W.get("eventDefinitions")&&W.get("eventDefinitions").length>1?W.get("parallelMultiple")?O["bpmn:ParallelMultipleEventDefinition"](R,Re,_,te):O["bpmn:MultipleEventDefinition"](R,Re,_,te):Xi(W,"bpmn:MessageEventDefinition")?O["bpmn:MessageEventDefinition"](R,Re,_,te):Xi(W,"bpmn:TimerEventDefinition")?O["bpmn:TimerEventDefinition"](R,Re,_,te):Xi(W,"bpmn:ConditionalEventDefinition")?O["bpmn:ConditionalEventDefinition"](R,Re,_,te):Xi(W,"bpmn:SignalEventDefinition")?O["bpmn:SignalEventDefinition"](R,Re,_,te):Xi(W,"bpmn:EscalationEventDefinition")?O["bpmn:EscalationEventDefinition"](R,Re,_,te):Xi(W,"bpmn:LinkEventDefinition")?O["bpmn:LinkEventDefinition"](R,Re,_,te):Xi(W,"bpmn:ErrorEventDefinition")?O["bpmn:ErrorEventDefinition"](R,Re,_,te):Xi(W,"bpmn:CancelEventDefinition")?O["bpmn:CancelEventDefinition"](R,Re,_,te):Xi(W,"bpmn:CompensateEventDefinition")?O["bpmn:CompensateEventDefinition"](R,Re,_,te):Xi(W,"bpmn:TerminateEventDefinition")?O["bpmn:TerminateEventDefinition"](R,Re,_,te):null}var T={ParticipantMultiplicityMarker:function($,R,_={}){var G=xi(R,_),W=ei(R,_),te=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2-6)/G,my:(W-15)/W}});w("participant-multiplicity",$,te,{strokeWidth:2,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},SubProcessMarker:function($,R,_={}){var G=y($,14,14,0,{strokeWidth:1,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)});kn(G,R.width/2-7.5,R.height-20);var W=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2-7.5)/R.width,my:(R.height-20)/R.height}});w("sub-process",$,W,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},ParallelMarker:function($,R,_){var G=xi(R,_),W=ei(R,_),te=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2+_.parallel)/G,my:(W-20)/W}});w("parallel",$,te,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},SequentialMarker:function($,R,_){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+_.seq)/R.width,my:(R.height-19)/R.height}});w("sequential",$,G,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},CompensationMarker:function($,R,_){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+_.compensation)/R.width,my:(R.height-13)/R.height}});w("compensation",$,G,{strokeWidth:1,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})},LoopMarker:function($,R,_){var G=xi(R,_),W=ei(R,_),te=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2+_.loop)/G,my:(W-7)/W}});w("loop",$,te,{strokeWidth:1.5,fill:"none",stroke:_e(R,c,_.stroke),strokeMiterlimit:.5})},AdhocMarker:function($,R,_){var G=xi(R,_),W=ei(R,_),te=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:(G/2+_.adhoc)/G,my:(W-15)/W}});w("adhoc",$,te,{strokeWidth:1,fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke)})}};function D($,R,_,G){T[$](R,_,G)}function j($,R,_=[],G={}){G={fill:G.fill,stroke:G.stroke,width:xi(R,G),height:ei(R,G)};var W=pe(R),te=_.includes("SubProcessMarker");te?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},W.get("isForCompensation")&&_.push("CompensationMarker"),M(W,"bpmn:AdHocSubProcess")&&(_.push("AdhocMarker"),te||U(G,{compensation:G.compensation-18}));var Re=W.get("loopCharacteristics"),Ke=Re&&Re.get("isSequential");Re&&(U(G,{compensation:G.compensation-18}),_.includes("AdhocMarker")&&U(G,{seq:-23,loop:-18,parallel:-24}),Ke===void 0&&_.push("LoopMarker"),Ke===!1&&_.push("ParallelMarker"),Ke===!0&&_.push("SequentialMarker")),_.includes("CompensationMarker")&&_.length===1&&U(G,{compensation:-8}),z(_,function(mt){D(mt,$,R,G)})}function ee($,R,_={}){_=U({size:{width:100}},_);var G=o.createText(R||"",_);return st(G).add("djs-label"),Ge($,G),G}function ge($,R,_,G={}){var W=pe(R),te=ds({x:R.x,y:R.y,width:R.width,height:R.height},G);return ee($,W.name,{align:_,box:te,padding:7,style:{fill:fs(R,l,c,G.stroke)}})}function Pe($,R,_={}){var G={width:R.width,height:R.height,x:R.width/2+R.x,y:R.height/2+R.y};return ee($,mi(R),{box:G,style:U({},o.getExternalStyle(),{fill:fs(R,l,c,_.stroke)})})}function De($,R,_,G={}){var W=xn(_),te=ee($,R,{box:{height:30,width:W?ei(_,G):xi(_,G)},align:"center-middle",style:{fill:fs(_,l,c,G.stroke)}});if(W){var Re=-1*ei(_,G);Jc(te,0,-Re,270)}}function Ue($,R,_={}){var{width:G,height:W}=ds(R,_);return y($,G,W,rl,{..._,fill:rt(R,s,_.fill),fillOpacity:fa,stroke:_e(R,c,_.stroke)})}function ot($,R,_={}){var G=pe(R),W=rt(R,s,_.fill),te=_e(R,c,_.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(_.markerEnd=d($,"association-end",W,te)),G.get("associationDirection")==="Both"&&(_.markerStart=d($,"association-start",W,te)),_=ft(_,["markerStart","markerEnd"]),m($,R.waypoints,{..._,stroke:te,strokeDasharray:"0, 5"})}function Me($,R,_={}){var G=rt(R,s,_.fill),W=_e(R,c,_.stroke),te=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}}),Re=v($,te,{fill:G,fillOpacity:fa,stroke:W}),Ke=pe(R);if($A(Ke)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.33,my:(R.height-18)/R.height}});v($,mt,{strokeWidth:2,fill:G,stroke:W})}return Re}function X($,R,_={}){return h($,R.width,R.height,{fillOpacity:fa,..._,fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke)})}function ne($,R,_={}){return C($,R.width,R.height,{fill:rt(R,s,_.fill),fillOpacity:fa,stroke:_e(R,c,_.stroke)})}function q($,R,_={}){var G=y($,xi(R,_),ei(R,_),0,{fill:rt(R,s,_.fill),fillOpacity:_.fillOpacity||fa,stroke:_e(R,c,_.stroke),strokeWidth:1.5}),W=pe(R);if(M(W,"bpmn:Lane")){var te=W.get("name");De($,te,R,_)}return G}function K($,R,_={}){var G=Ue($,R,_),W=at(R);if(Fn(R)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!W)){var te=pe(R).flowElements||[],Re=te.filter(Ke=>M(Ke,"bpmn:StartEvent"));Re.length===1&&se(Re[0],$,_,R)}return ge($,R,W?"center-top":"center-middle",_),W?j($,R,void 0,_):j($,R,["SubProcessMarker"],_),G}function se($,R,_,G){var W=22,te={fill:rt(G,s,_.fill),stroke:_e(G,c,_.stroke),width:W,height:W},Re=pe($).isInterrupting,Ke=Re?0:3,mt=Re?1:1.2,qt=20,Et=(W-qt)/2,mn="translate("+Et+","+Et+")";h(R,qt,qt,{fill:te.fill,stroke:te.stroke,strokeWidth:mt,strokeDasharray:Ke,transform:mn}),N($,R,te,G)}function de($,R,_={}){var G=Ue($,R,_);return ge($,R,"center-middle",_),j($,R,void 0,_),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function($,R,_={}){return at(R)?_=ft(_,["fill","stroke","width","height"]):_=ft(_,["fill","stroke"]),K($,R,_)},"bpmn:Association":function($,R,_={}){return _=ft(_,["fill","stroke"]),ot($,R,_)},"bpmn:BoundaryEvent":function($,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var W=pe(R),te=W.get("cancelActivity");_={strokeWidth:1.5,fill:rt(R,s,_.fill),fillOpacity:WA,stroke:_e(R,c,_.stroke)},te||(_.strokeDasharray="6");var Re=X($,R,_);return h($,R.width,R.height,il,{..._,fill:"none"}),G&&N(R,$,_),Re},"bpmn:BusinessRuleTask":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=de($,R,_),W=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),te=v($,W);Se(te,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ke=v($,Re);return Se(Ke,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function($,R,_={}){return _=ft(_,["fill","stroke"]),K($,R,{strokeWidth:5,..._})},"bpmn:ComplexGateway":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=ne($,R,_),W=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.26}});return v($,W,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:DataInput":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),W=Me($,R,_);return v($,G,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1}),W},"bpmn:DataInputAssociation":function($,R,_={}){return _=ft(_,["fill","stroke"]),ot($,R,{..._,markerEnd:d($,"association-end",rt(R,s,_.fill),_e(R,c,_.stroke))})},"bpmn:DataObject":function($,R,_={}){return _=ft(_,["fill","stroke"]),Me($,R,_)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),W=Me($,R,_);return v($,G,{strokeWidth:1,fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke)}),W},"bpmn:DataOutputAssociation":function($,R,_={}){return _=ft(_,["fill","stroke"]),ot($,R,{..._,markerEnd:d($,"association-end",rt(R,s,_.fill),_e(R,c,_.stroke))})},"bpmn:DataStoreReference":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:0,my:.133}});return v($,G,{fill:rt(R,s,_.fill),fillOpacity:fa,stroke:_e(R,c,_.stroke),strokeWidth:2})},"bpmn:EndEvent":function($,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var W=X($,R,{..._,strokeWidth:4});return G&&N(R,$,_),W},"bpmn:EventBasedGateway":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=pe(R),W=ne($,R,_);h($,R.width,R.height,R.height*.2,{fill:rt(R,"none",_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1});var te=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Ke(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:R.width,containerHeight:R.height,position:{mx:.36,my:.44}});v($,qt,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:2})}if(te==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}});v($,mt,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1})}else te==="Exclusive"&&(Re||h($,R.width,R.height,R.height*.26,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1}),Ke());return W},"bpmn:ExclusiveGateway":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=ne($,R,_),W=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}}),te=ut(R);return te.get("isMarkerVisible")&&v($,W,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:Gateway":function($,R,_={}){return _=ft(_,["fill","stroke"]),ne($,R,_)},"bpmn:Group":function($,R,_={}){return _=ft(_,["fill","stroke","width","height"]),y($,R.width,R.height,rl,{stroke:_e(R,c,_.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:xi(R,_),height:ei(R,_)})},"bpmn:InclusiveGateway":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=ne($,R,_);return h($,R.width,R.height,R.height*.24,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function($,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var W=X($,R,{..._,strokeWidth:1.5});return h($,R.width,R.height,il,{fill:"none",stroke:_e(R,c,_.stroke),strokeWidth:1.5}),G&&N(R,$,_),W},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function($,R,_={}){return _=ft(_,["fill","stroke","width","height"]),q($,R,{..._,fillOpacity:UA})},"bpmn:ManualTask":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=de($,R,_),W=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v($,W,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=pe(R),W=ut(R),te=rt(R,s,_.fill),Re=_e(R,c,_.stroke),Ke=m($,R.waypoints,{markerEnd:d($,"messageflow-end",te,Re),markerStart:d($,"messageflow-start",te,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=Ke.getPointAtLength(Ke.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Et={strokeWidth:1};W.get("messageVisibleKind")==="initiating"?(Et.fill=te,Et.stroke=Re):(Et.fill=Re,Et.stroke=te);var mn=v($,qt,Et),Sn=G.get("messageRef"),Gn=Sn.get("name"),Ct=ee($,Gn,{align:"center-top",fitBox:!0,style:{fill:Re}}),Qt=mn.getBBox(),wn=Ct.getBBox(),Fa=mt.x-wn.width/2,Vn=mt.y+Qt.height/2+zA;Jc(Ct,Fa,Vn,0)}return Ke},"bpmn:ParallelGateway":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=ne($,R,_),W=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.2}});return v($,W,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:Participant":function($,R,_={}){_=ft(_,["fill","stroke","width","height"]);var G=q($,R,_),W=at(R),te=xn(R),Re=pe(R),Ke=Re.get("name");if(W){var mt=te?[{x:30,y:0},{x:30,y:ei(R,_)}]:[{x:0,y:30},{x:xi(R,_),y:30}];x($,mt,{stroke:_e(R,c,_.stroke),strokeWidth:GA}),De($,Ke,R,_)}else{var qt=ds(R,_);te||(qt.height=xi(R,_),qt.width=ei(R,_));var Et=ee($,Ke,{box:qt,align:"center-middle",style:{fill:fs(R,l,c,_.stroke)}});if(!te){var mn=-1*ei(R,_);Jc(Et,0,-mn,270)}}return Re.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",$,R,_),G},"bpmn:ReceiveTask":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=pe(R),W=de($,R,_),te;return G.get("instantiate")?(h($,28,28,20*.22,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),te=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):te=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v($,te,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),W},"bpmn:ScriptTask":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=de($,R,_),W=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v($,W,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:SendTask":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=de($,R,_),W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v($,W,{fill:_e(R,c,_.stroke),stroke:rt(R,s,_.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=rt(R,s,_.fill),W=_e(R,c,_.stroke),te=m($,R.waypoints,{markerEnd:d($,"sequenceflow-end",G,W),stroke:W}),Re=pe(R),{source:Ke}=R;if(Ke){var mt=pe(Ke);Re.get("conditionExpression")&&M(mt,"bpmn:Activity")&&Se(te,{markerStart:d($,"conditional-flow-marker",G,W)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Re&&Se(te,{markerStart:d($,"conditional-default-flow-marker",G,W)})}return te},"bpmn:ServiceTask":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=de($,R,_);h($,10,10,{fill:rt(R,s,_.fill),stroke:"none",transform:"translate(6, 6)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v($,W,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),h($,10,10,{fill:rt(R,s,_.fill),stroke:"none",transform:"translate(11, 10)"});var te=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v($,te,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function($,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var W=pe(R);W.get("isInterrupting")||(_={..._,strokeDasharray:"6"});var te=X($,R,_);return G&&N(R,$,_),te},"bpmn:SubProcess":function($,R,_={}){return at(R)?_=ft(_,["fill","stroke","width","height"]):_=ft(_,["fill","stroke"]),K($,R,_)},"bpmn:Task":function($,R,_={}){return _=ft(_,["fill","stroke"]),de($,R,_)},"bpmn:TextAnnotation":function($,R,_={}){_=ft(_,["fill","stroke"]);var{width:G,height:W}=ds(R,_),te=y($,G,W,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:W,position:{mx:0,my:0}});v($,Re,{stroke:_e(R,c,_.stroke)});var Ke=pe(R),mt=Ke.get("text")||"";return ee($,mt,{align:"left-top",box:ds(R,_),padding:pa,style:{fill:fs(R,l,c,_.stroke)}}),te},"bpmn:Transaction":function($,R,_={}){at(R)?_=ft(_,["fill","stroke","width","height"]):_=ft(_,["fill","stroke"]);var G=K($,R,{strokeWidth:1.5,..._}),W=n.style(["no-fill","no-events"],{stroke:_e(R,c,_.stroke),strokeWidth:1.5}),te=at(R);return te||(_={}),y($,xi(R,_),ei(R,_),rl-il,il,W),G},"bpmn:UserTask":function($,R,_={}){_=ft(_,["fill","stroke"]);var G=de($,R,_),W=15,te=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:W,y:te}});v($,Re,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:.5});var Ke=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:W,y:te}});v($,Ke,{fill:rt(R,s,_.fill),stroke:_e(R,c,_.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:W,y:te}});return v($,mt,{fill:_e(R,c,_.stroke),stroke:_e(R,c,_.stroke),strokeWidth:.5}),G},label:function($,R,_={}){return Pe($,R,_)}};this._drawPath=v,this._renderer=S}Ee(wo,cr),wo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],wo.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},wo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},wo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},wo.prototype.getShapePath=function(e){return Qe(e)?vf(e,VA):M(e,"bpmn:Event")?Ky(e):M(e,"bpmn:Activity")?vf(e,rl):M(e,"bpmn:Gateway")?FA(e):jA(e)};function ft(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var qA=0,YA={width:150,height:50};function KA(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function XA(e){return gn(e)?U({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var bf=null;function ZA(){return bf||(bf=document.createElement("canvas").getContext("2d")),bf}function QA(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(Xy(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Xy(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function JA(e,t){var n=ZA();if(!n)return{width:0,height:0};n.font=QA(t),"letterSpacing"in n&&(n.letterSpacing=Xy(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 eP(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=JA(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return tP(e,r,i,o);r=iP(r,o.width,t)}}function tP(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 Zy="";function nP(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===Zy)&&r.pop();break}var a=r[r.length-1];return a&&a===Zy&&(r[r.length-1]="-"),r.join("")}function iP(e,t,n){var i=Math.max(e.length*(n/t),1),r=nP(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function ol(e){this._config=U({},{size:YA,padding:qA,style:{},align:"center-top"},e||{})}ol.prototype.createText=function(e,t){return this.layoutText(e,t).element},ol.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ol.prototype.layoutText=function(e,t){for(var n=U({},this._config.size,t.box),i=U({},this._config.style,t.style),r=KA(t.align||this._config.align),o=XA(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=rP(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(eP(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Zn(l,function(y,C,x){return y+(s||C.height)},0)+o.top+o.bottom,f=Zn(l,function(y,C,x){return C.width>y?C.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");Se(g,i),z(l,function(y){var C;switch(d+=s||y.height,r.horizontal){case"left":C=o.left;break;case"right":C=(a?f:u)-o.right-y.width;break;default:C=Math.max(((a?f:u)-y.width)/2+o.left,0)}var x=Oe("tspan");Se(x,{x:C,y:d}),x.textContent=y.text,Ge(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function rP(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var oP=12,aP=1.2,sP=40;function Qy(e){var t=U({fontFamily:"Arial, sans-serif",fontSize:oP,fontWeight:"normal",lineHeight:aP},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=U({},t,{fontSize:n},e&&e.externalStyle||{}),r=new ol({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,xo.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:pa});return{x:a.x,y:a.y,width:a.width,height:Math.max(sP,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,U({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Qy.$inject=["config.textRenderer"];function cP(){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,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=fP(i.d,{mx:r,my:o,e:a});return p}}var lP=/\{([^{}]+)\}/g,uP=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function pP(e,t,n){var i=n;return t.replace(uP,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 fP(e,t){return String(e).replace(lP,function(n,i){return pP(n,i,t)})}const dP={__init__:["bpmnRenderer"],bpmnRenderer:["type",wo],textRenderer:["type",Qy],pathMap:["type",cP]};function hP(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const hs={translate:["value",hP]};function al(e,t,n){return U({id:e.id,type:e.$type,businessObject:e,di:t},n)}function mP(e,t,n){var i=e.waypoint;return!i||i.length<2?[Fe(t),Fe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Jy(e,t,n){return new Error(`element ${$n(t)} referenced by ${$n(e)}#${n} not yet drawn`)}function fr(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}fr.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],fr.prototype.add=function(e,t,n){var i,r,o;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(al(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!at(e,t),c=yP(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(al(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(o=0),M(e,"bpmn:DataStoreReference")&&(gP(n,Fe(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(al(e,t,{hidden:r,source:u,target:p,waypoints:mP(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${$n(t)} for element ${$n(e)}`);return Nr(e)&&mi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},fr.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${$n(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Jy(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},fr.prototype.addLabel=function(e,t,n){var i,r,o;return i=OA(t,n),r=mi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(al(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!mi(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)},fr.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?Jy(e,i,t+"Ref"):new Error(`${$n(e)}#${t} Ref not specified`)},fr.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},fr.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},fr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function gP(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 yP(e){return M(e,"bpmn:Group")}const ev={__depends__:[dP,{__depends__:[hs],bpmnImporter:["type",fr]}]};function ms(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xf(e){return Math.log(e)/Math.log(10)}var vP=1e3;function le(e){this._eventBus=e}le.$inject=["eventBus"];function bP(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}le.prototype.on=function(e,t,n,i,r,o){if((yn(t)||He(t))&&(o=r,r=i,i=n,n=t,t=null),yn(n)&&(o=r,r=i,i=n,n=vP),gn(r)&&(o=r,r=!1),!yn(i))throw new Error("handlerFn must be a function");$e(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?bP(i,o):i,o)})},le.prototype.canExecute=dr("canExecute"),le.prototype.preExecute=dr("preExecute"),le.prototype.preExecuted=dr("preExecuted"),le.prototype.execute=dr("execute"),le.prototype.executed=dr("executed"),le.prototype.postExecute=dr("postExecute"),le.prototype.postExecuted=dr("postExecuted"),le.prototype.revert=dr("revert"),le.prototype.reverted=dr("reverted");function dr(e){return function(n,i,r,o,a){(yn(n)||He(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var wf=["top","bottom","left","right"],sl=10;function _f(e,t){le.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,l=o.hints||{};l.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(nl(r)&&!Mt(r)){var o=_P(r);o&&i(r,o)}}function i(r,o){var a=Fe(r),s=r.label,c=Fe(s);if(s.parent){var l=Be(r),u;switch(o){case"top":u={x:a.x,y:l.top-sl-s.height/2};break;case"left":u={x:l.left-sl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+sl+s.height/2};break;case"right":u={x:l.right+sl+s.width/2,y:a.y};break}var p=Ii(u,c);t.moveShape(s,p)}}}Ee(_f,le),_f.$inject=["eventBus","modeling"];function xP(e){var t=e.host,n=Fe(e),i=Tn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=wf.filter(function(a){return r.indexOf(a)===-1});return o}function wP(e){var t=Fe(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 tv(t,i)});return n}function _P(e){var t=Fe(e.label),n=Fe(e),i=tv(n,t);if(EP(i)){var r=wP(e);if(e.host){var o=xP(e);r=r.concat(o)}var a=wf.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Tn(e.label,e)!=="intersect"?void 0:i:a[0]}}function tv(e,t){return Tn(t,e,5)}function EP(e){return wf.indexOf(e)!==-1}function Ef(e){le.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(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)}Ee(Ef,le),Ef.$inject=["eventBus"];var SP=1500;function Sf(e,t,n){e.invoke(le,this),this.preExecute("elements.delete",SP,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=nt(r,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(o,l=>{const u=new Set(Go(aa(Array.from(s),rn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(Sf,le),Sf.$inject=["injector","eventBus","canvas"];function Rf(e,t){e.invoke(le,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=nt(r.incoming.concat(r.outgoing),function(a){return M(a,"bpmn:Association")});z(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee(Rf,le),Rf.$inject=["injector","modeling"];function da(e,t){for(Kn(t)&&(t=[t]);e=e.parent;)if(et(e,t))return e;return null}function nv(e,t){var n=da(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=da(e,i),n)return xn(n);if(et(e,i))return xn(e);var r;for(r=pe(e);r&&!M(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=pe(a);return s&&s.get("processRef")===r});return o?xn(o):!0}var iv=500;function cl(e,t){t.invoke(le,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",iv,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return rv(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",iv,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];rv(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}cl.$inject=["bpmnReplace","injector"],Ee(cl,le),cl.prototype._replaceShape=function(e,t){var n=RP(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function RP(e){var t=pe(e),n=t.eventDefinitions;return n&&n[0]}function rv(e,t){return!Qe(e)&&et(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Cf(e,t){le.call(this,e);function n(i){return nt(i.attachers,function(r){return M(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);M(r,"bpmn:EventBasedGateway")&&M(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;M(r,"bpmn:Gateway")&&M(o,"bpmn:EventBasedGateway")&&z(o.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Cf.$inject=["eventBus","modeling"],Ee(Cf,le);function ov(e){return e.create("bpmn:Category")}function CP(e){return e.create("bpmn:CategoryValue")}function av(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=CP(e)),n.$parent||(n.$parent=ov(e)),n}function MP(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function AP(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function PP(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var TP=500;function Mf(e,t,n){n.invoke(le,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(pe).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&MP(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&PP(l),c&&!r(c,u)&&AP(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,pe(l))},!0),this.executed(["shape.move","shape.resize"],TP,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,pe(l))},!0),this.executed("group.updateRefs",function(c){sv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){sv(c).forEach(function(l){s(l.categoryValue,l.category,pe(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,pe(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Mf.$inject=["bpmnjs","elementRegistry","injector"],Ee(Mf,le);function sv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Af(e,t,n){le.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(y){const C=y.source,x=y.target;ha(C)&&gs(x)&&u(x)}function r(y){const C=y.connection,x=y.source,m=y.target;ha(x)&&ll(m)&&(l(m),f(x,[C]))}function o(y){const C=y.newTarget,x=y.oldSource,m=y.oldTarget;if(m!==C){const v=x;gs(m)&&u(m),ha(v)&&ll(C)&&l(C)}}function a(y){const{element:C}=y;gs(C)?(p(C),d(C)):ll(C)&&g(C)}function s(y){const{newData:C,oldShape:x}=y;if(ha(y.oldShape)&&C.eventDefinitionType!=="bpmn:CompensateEventDefinition"||C.type!=="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>gs(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!ha(y.oldShape)&&C.eventDefinitionType==="bpmn:CompensateEventDefinition"&&C.type==="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>ll(v));m&&m.target&&(y._connectionTarget=m.target),h(x)}}function c(y){const{_connectionTarget:C,newShape:x}=y;C&&t.connect(x,C)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const C of y.incoming)n.canConnect(C.source,y)||t.removeConnection(C);for(const C of y.outgoing)n.canConnect(y,C.target)||t.removeConnection(C)}function f(y,C){y.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>gs(v.target)&&!C.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const C=y.attachers.slice();C.length&&t.removeElements(C)}function g(y){const C=y.incoming.filter(x=>ha(x.source));t.removeElements(C)}function h(y){const C=y.outgoing.filter(x=>M(x,"bpmn:SequenceFlow"));t.removeElements(C)}}Ee(Af,le),Af.$inject=["eventBus","modeling","bpmnRules"];function gs(e){const t=pe(e);return t&&t.get("isForCompensation")}function ha(e){return e&&M(e,"bpmn:BoundaryEvent")&&ua(e,"bpmn:CompensateEventDefinition")}function ll(e){return e&&M(e,"bpmn:Activity")&&!Fn(e)}function Pf(e){e.invoke(le,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;M(i,"bpmn:Lane")&&!M(r,"bpmn:Lane")&&(n.parent=da(i,"bpmn:Participant"))})}Pf.$inject=["injector"],Ee(Pf,le);function Tf(e,t){le.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(M(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}})}Tf.$inject=["eventBus","bpmnFactory"],Ee(Tf,le);var kf=20,Of=20,cv=30,ul=2e3;function Df(e,t,n){le.call(this,t),t.on(["create.start","shape.move.start"],ul,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!Qe(p)&&!Mt(p)});if(c.length){var l=rn(c),u=kP(a,l);U(a,u),o.createConstraints=OP(a,l)}}}),t.on("create.start",ul,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",ul,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return M(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",ul,function(r){var o=r.elements,a=r.parent,s=DP(o),c;s&&M(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=pe(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;M(a,"bpmn:Participant")&&M(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=pe(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)&&pe(s).set("processRef",pe(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,l=o.participant;a&&(!l||c===l)&&pe(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 l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Df.$inject=["canvas","eventBus","modeling"],Ee(Df,le);function kP(e,t){t={width:t.width+kf*2+cv,height:t.height+Of*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 OP(e,t){return t=Be(t),{bottom:t.top+e.height/2-Of,left:t.right-e.width/2+kf,top:t.bottom-e.height/2+Of,right:t.left+e.width/2-kf-cv}}function DP(e){return Tt(e,function(t){return M(t,"bpmn:Participant")})}var lv="__targetRef_placeholder";function Lf(e,t){le.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],uv(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],uv(o));function n(a,s,c){var l=a.get("dataInputAssociations");return Tt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Tt(c,function(u){return u.name===lv});return!l&&s&&(l=t.create("bpmn:Property",{name:lv}),tn(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,C;h&&h!==p&&r(h,l),d&&d!==p&&r(d,l),p?(C=i(p,!0),y.targetRef=C):y.targetRef=null}}Lf.$inject=["eventBus","bpmnFactory"],Ee(Lf,le);function uv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function pl(e){this._bpmnUpdater=e}pl.$inject=["bpmnUpdater"],pl.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),[]},pl.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 If(e,t,n,i){le.call(this,i),t.registerHandler("dataStore.updateContainment",pl);function r(){return n.filter(function(s){return M(s,"bpmn:Participant")&&pe(s).processRef})[0]}function o(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ut(s),newSemanticParent:u.processRef||u,newDiParent:ut(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:IP(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();et(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&o(u).filter(function(p){return LP(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}If.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(If,le);function LP(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 IP(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var fl=Math.max,dl=Math.min,BP=20;function pv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function NP(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 $P(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 hl(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return He(r)&&(i=(/top|left/.test(e)?dl:fl)(i,r)),He(o)&&(i=(/top|left/.test(e)?fl:dl)(i,o)),i}function FP(e,t){if(!t)return e;var n=Be(e);return Xc({top:hl("top",n,t),right:hl("right",n,t),bottom:hl("bottom",n,t),left:hl("left",n,t)})}function jP(e,t,n,i){var r=Be(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?Be(i):o,s={top:dl(o.top,a.top),left:dl(o.left,a.left),bottom:fl(o.bottom,a.bottom),right:fl(o.right,a.right)};return Xc(s)}function ys(e,t){return typeof e<"u"?e:BP}function HP(e,t){var n,i,r,o;return typeof t=="object"?(n=ys(t.left),i=ys(t.right),r=ys(t.top),o=ys(t.bottom)):n=i=r=o=ys(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function zP(e){return!(e.waypoints||e.type==="label")}function fv(e,t){var n;if(e.length===void 0?n=nt(e.children,zP):n=e,n.length)return HP(rn(n),t)}var $r=Math.abs;function GP(e,t){return pv(Be(t),Be(e))}var VP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function ml(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(ml(n,t),t.push(n))}),t}function Fr(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function _i(e){return da(e,VP)||e}function WP(e,t){var n=_i(e),i=M(n,"bpmn:Process")?[]:[n],r=ml(n,i),o=Be(e),a=Be(t),s=GP(e,t),c=[],l=xn(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Be(u);s.top&&($r(h.bottom-o.top)<10&&(d=a.top-h.bottom),$r(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&($r(h.right-o.left)<10&&(f=a.left-h.right),$r(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&($r(h.top-o.bottom)<10&&(p=a.bottom-h.top),$r(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&($r(h.left-o.right)<10&&(g=a.right-h.left),$r(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:$P(u,{top:p,right:f,bottom:d,left:g})})}}),c}var UP=500;function Bf(e,t){le.call(this,e);function n(i,r){var o=xn(i),a=Fr(r),s=[],c=[],l=[],u=[];if(vo(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.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")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",UP,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;M(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Bf.$inject=["eventBus","spaceTool"],Ee(Bf,le);var dv=500;function gl(e,t){t.invoke(le,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",dv,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return hv(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",dv,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;hv(a,YP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}gl.$inject=["bpmnReplace","injector"],Ee(gl,le),gl.prototype._replaceShape=function(e){var t=qP(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function qP(e){var t=pe(e),n=t.eventDefinitions;return n&&n[0]}function hv(e,t){return!Qe(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function YP(e,t){return e.indexOf(t)!==-1}var yl=Math.round,KP=Math.max;function XP(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 ZP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var mv=10;function QP(e,t){var n,i;for(n=0;i=e[n];n++)if(ss(i,t)<=mv)return{point:e[n],bendpoint:!0,index:n};return null}function JP(e,t){var n=xy(XP(t,mv),ZP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=KP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:yl(i.x+r.x)/2,y:yl(i.y+r.y)/2},index:i.segment2}:{point:{x:yl(i.x),y:yl(i.y)},index:i.segment2}:null}function Nf(e,t){return QP(e,t)||JP(e,t)}function $f(e,t,n){le.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,g,h=r.outgoing.slice(),y=r.incoming.slice(),C;He(a.width)?C=Fe(a):C=a;var x=Nf(s,C);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:C,(c.length===1||!gv(r,c[c.length-1]))&&c.push(yv(u)),(l.length===1||!gv(r,l[0]))&&l.unshift(yv(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||C),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||C),g=o));var m=[].concat(d&&nt(y,function(v){return v.source===d.source})||[],g&&nt(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}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 l=Fe(c),u={x:l.x+s.x,y:l.y+s.y},p=Tt(o.children,function(f){var d=t.canInsert(a,f);return d&&Nf(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!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)}Ee($f,le),$f.$inject=["eventBus","bpmnRules","modeling"];function gv(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 yv(e){return U({},e)}function Ff(e,t){le.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)&&ma(r)){var c=[];M(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&ma(l)):c=a.incoming.filter(l=>l!==r&&ma(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(M(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ma).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ma).forEach(function(s){const c=a.incoming.filter(ma).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Ff.$inject=["eventBus","modeling"],Ee(Ff,le);function ma(e){return M(e,"bpmn:SequenceFlow")}var vl=1500,vv=2e3;function bv(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"],vl,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!et(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=_i(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||et(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"],vl,function(i){var r=i.hover;M(r,"bpmn:Lane")&&(i.hover=_i(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],vl,function(i){var r=i.context,o=i.hover,a=r.type;M(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=_i(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],vl,function(i){var r=i.context,o=r.start;M(o,"bpmn:Lane")&&(r.start=_i(o)||o)}),t.on("shape.move.start",vv,function(i){var r=i.shape;M(r,"bpmn:Lane")&&(i.shape=_i(r)||r)}),t.on("spaceTool.move",vv,function(i){var r=i.hover;r&&M(r,"bpmn:Lane")&&(i.hover=_i(r))})}bv.$inject=["elementRegistry","eventBus","canvas"];var xv=770;function jf(e,t,n,i){n.invoke(le,this);function r(s,c){var l=pe(s),u=c.categoryValue||l.categoryValueRef;u||(u=av(e,l));var p=c.category||u.$parent||ov(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function o(s,c){var l=pe(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=pe(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=pe(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!pe(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!pe(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||pe(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",xv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=pe(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",xv,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,p=c.category;u&&(u=l.categoryValueRef=a(u)),p&&(u.$parent=a(p)),delete c.category,delete c.categoryValue})}jf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ee(jf,le);function Hf(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 wv(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Hf(i,r,o,a),l=Hf(i,r,o,s),u;c&&l?_v(c,o)>_v(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],Fe(i.source)),t(r[r.length-1],r[r.length-2],Fe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}wv.$inject=["eventBus"];function _v(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zf(e){le.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=pe(i),o=ut(i);if(et(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}zf.$inject=["eventBus"],Ee(zf,le);function Ev(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Sv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function eT(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 tT(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 Gf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=tT([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 Rv(e,t){var n=Gf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Ev(i)}function vs(e,t){return Ev({x:e.x-t.x,y:e.y-t.y})}var Cv=Math.sqrt,Mv=Math.min,nT=Math.max,Av=Math.abs;function Pv(e){return Math.pow(e,2)}function bs(e,t){return Cv(Pv(e.x-t.x)+Pv(e.y-t.y))}function iT(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],kv(i,r)?l=[i]:(o=bs(e,i),a=bs(e,r),c=Mv(o,a),l=rT(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:kv(i,l[0])?n:n+1}),l.length===2&&(s=aT(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:bs(i,s)/bs(i,r)}),p=bs(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function rT(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,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=Cv(d),h=-p+g,y=-p-g,C={x:e.x-r*h,y:e.y-o*h};if(d===0)return[C];var x={x:e.x-r*y,y:e.y-o*y};return[C,x].filter(function(m){return oT(m,e,t)})}function oT(e,t,n){return Tv(e.x,t.x,n.x)&&Tv(e.y,t.y,n.y)}function Tv(e,t,n){return e>=Mv(t,n)-bl&&e<=nT(t,n)+bl}function aT(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var bl=.1;function kv(e,t){return Av(e.x-t.x)<=bl&&Av(e.y-t.y)<=bl}function sT(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,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=Dv(t,l);p<n.relativeLocation&&u++}return u}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 Ov(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=iT(e,n),c=s.segmentIndex,l=sT(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Lv(n,c),p=Lv(t,l),f=s.position,d=lT(u,f),g=cT(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,C=n[y];if(t.indexOf(C)!==-1)return a;if(h===0){var x=t[y];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=Dv(n,y))}var m={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=eT({x:e.x-f.x,y:e.y-f.y},g);return r=m.x+v.x-e.x,o=m.y+v.y-e.y,{point:ur(m),delta:ur({x:r,y:o})}}function Dv(e,t){var n=vs(e[t-1],e[t]),i=vs(e[t],e[t+1]),r=n/(n+i);return r}function cT(e,t){var n=Sv(e),i=Sv(t);return i-n}function Lv(e,t){return[e[t],e[t+1]]}function lT(e,t){var n=vs(e[0],e[1]),i=vs(e[0],t);return n===0?0:i/n}function uT(e,t,n,i){var r=Fe(e);return Ov(r,t,n,i).delta}function xs(e,t,n){var i=ms(t),r=ms(n),o=Ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ur({x:r.x+a.x,y:r.y+a.y})}function Iv(e,t,n){var i=ms(e),r=ms(t),o=ms(n),a=Ii(e,i),s=Ii(i,r),c=pT(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return ur({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function pT(e,t,n){var i=Be(t),r=Be(n);if(fT(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 fT(e,t){return dT(e,t)||hT(e,t)}function dT(e,t){return e.right!==t.right&&e.left!==t.left}function hT(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Bv="name",Nv="text";function Vf(e,t,n,i){le.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{pe(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Bv in l&&t.updateLabel(c,l[Bv]),Nv in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Nv]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Qe(l)||!Nr(l)||mi(l)&&t.updateLabel(l,mi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=U({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),uT(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=pe(c);u&&Nr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Qe(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(mi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(nl(c)){var p=c.label,f=Fe(p),d=yT(u),g=gT(f,d),h=mT(g,u,l);t.moveShape(p,h)}})}Ee(Vf,le),Vf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function mT(e,t,n){var i=xs(e,t,n);return ur(Ii(i,e))}function gT(e,t){if(t.length){var n=vT(e,t);return Gf(e,n)}}function yT(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 vT(e,t){var n=t.map(function(r){return{line:r,distance:Rv(e,r)}}),i=ji(n,"distance");return i[0].line}function bT(e,t,n,i){return Ov(e,t,n,i).point}function Wf(e,t){le.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=U({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),bT(r,c,l,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 l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],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(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ee(Wf,le),Wf.$inject=["eventBus","modeling"];function xl(e,t,n){var i=_l(e),r=Fv(i,t),o=i[0];return r.length?r[r.length-1]:xs(o.original||o,n,t)}function wl(e,t,n){var i=_l(e),r=Fv(i,t),o=i[i.length-1];return r.length?r[0]:xs(o.original||o,n,t)}function Uf(e,t,n){var i=_l(e),r=$v(t,n),o=i[0];return xs(o.original||o,r,t)}function qf(e,t,n){var i=_l(e),r=$v(t,n),o=i[i.length-1];return xs(o.original||o,r,t)}function $v(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function _l(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Fv(e,t){var n=Ln(e,wT);return nt(n,function(i){return xT(i,t)})}function xT(e,t){return Tn(t,e,1)==="intersect"}function wT(e){return e.original||e}function Yf(e,t){le.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(_T(i,r)){var o=ET(i);o.incoming.forEach(function(a){var s=wl(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=xl(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Yf.$inject=["eventBus","modeling"],Ee(Yf,le);function _T(e,t){return M(e,"bpmn:Participant")&&at(e)&&M(t,"bpmn:Participant")&&!at(t)}function ET(e){var t=os([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){M(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){M(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const ST=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function jv(e){const t=pe(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&Fn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:ST.some(i=>M(n[0],i))}function Hv(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Kf(e,t){e.invoke(le,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!jv(r))return;const a=Hv(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=pe(i).get(a),l=pe(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Kf.$inject=["injector","modeling"],Ee(Kf,le);function Xf(e,t){le.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ut(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(Xf,le),Xf.$inject=["eventBus","modeling"];function Zf(e,t,n){le.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(!(!M(o,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=RT(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(Zf,le),Zf.$inject=["eventBus","bpmnRules","modeling"];function ga(e){return e.original||e}function RT(e,t){var n=Hf(ga(e[e.length-2]),ga(e[e.length-1]),ga(t[1]),ga(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ga(e[0]),ga(t[t.length-1])]}function Qf(e,t){le.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;M(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)}Qf.$inject=["eventBus","modeling"],Ee(Qf,le);function Jf(e,t,n,i){le.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,r&&s(u,g))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Tt(p.outgoing,Wo({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ee(Jf,le),Jf.$inject=["eventBus","modeling","bpmnRules","injector"];function El(e,t,n,i,r,o){i.invoke(le,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Zn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){Fn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Ee(El,le),El.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;z(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)},El.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var CT=1500,MT={width:140,height:120},ed={width:300,height:60},td={width:60,height:300},Sl={width:300,height:150},Rl={width:150,height:300},zv={width:140,height:120},Gv={width:100,height:40};function Vv(e){e.on("resize.start",CT,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=OT(i,r,o)),M(i,"bpmn:SubProcess")&&at(i)&&(n.minDimensions=zv),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=Gv)})}Vv.$inject=["eventBus"];var jr=Math.abs,AT=Math.min,PT=Math.max;function Wv(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function ya(e,t,n){return Wv(e,t,n,AT)}function va(e,t,n){return Wv(e,t,n,PT)}var TT={top:20,left:50,right:20,bottom:20},kT={top:50,left:20,right:20,bottom:20};function OT(e,t,n){var i=_i(e),r=!0,o=!0,a=ml(i,[i]),s=Be(e),c={},l={},u=xn(e),p=u?ed:td;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Be(g);u?(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&&jr(s.top-h.bottom)<10&&va(c,"top",h.top+p.height),jr(s.top-h.top)<5&&ya(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&jr(s.right-h.left)<10&&ya(c,"right",h.right-p.width),jr(s.right-h.right)<5&&va(l,"right",h.left+p.width)),/s/.test(t)&&(n&&jr(s.bottom-h.top)<10&&ya(c,"bottom",h.bottom-p.height),jr(s.bottom-h.bottom)<5&&va(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&jr(s.left-h.right)<10&&va(c,"left",h.left+p.width),jr(s.left-h.left)<5&&ya(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?TT:kT;return f.forEach(function(g){var h=Be(g);/n/.test(t)&&(!u||r)&&ya(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&va(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&va(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&ya(l,"left",h.left-d.left)}),{min:l,max:c}}function Uv(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ba(e){return e.originalEvent||e.srcEvent}function nd(e){Uv(e),Uv(ba(e))}function _o(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 qv(){return/mac/i.test(navigator.platform)}function Yv(e,t){return(ba(e)||e).button===t}function Hr(e){return Yv(e,0)}function DT(e){return Yv(e,1)}function ws(e){var t=ba(e)||e;return Hr(e)?qv()?t.metaKey:t.ctrlKey:!1}function Cl(e){var t=ba(e)||e;return Hr(e)&&t.shiftKey}var Kv=1001;function Xv(e,t){e.on("resize.start",Kv+500,function(n){var i=n.context,r=i.shape;(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))&&(i.balanced=!ws(n))}),e.on("resize.end",Kv,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))return o&&(a=Ry(a),t.resizeLane(r,a,i.balanced)),!1})}Xv.$inject=["eventBus","modeling"];var LT=500;function id(e,t,n,i,r){n.invoke(le,this);function o(u){return et(u,["bpmn:ReceiveTask","bpmn:SendTask"])||IT(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Tt(f,Wo({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(et(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(et(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=pe(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),tn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=pe(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",LT,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}id.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(id,le);function IT(e,t){return $e(t)||(t=[t]),Rr(t,function(n){return ua(e,n)})}var Zv=Math.max;function Qv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(o[s]=NT(a,i,r)),M(a,"bpmn:Lane")&&(o[s]=xn(a)?ed:td),M(a,"bpmn:SubProcess")&&at(a)&&(o[s]=zv),M(a,"bpmn:TextAnnotation")&&(o[s]=Gv),M(a,"bpmn:Group")&&(o[s]=MT)}),o})}Qv.$inject=["eventBus"];function BT(e){return e==="x"}function NT(e,t,n){var i=xn(e);if(!jT(e))return i?Sl:Rl;var r=BT(t),o={};return r?i?o=Sl:o={width:FT(e,n,r),height:Rl.height}:i?o={width:Sl.width,height:$T(e,n,r)}:o=Rl,o}function $T(e,t,n){var i;return i=HT(e,t,n),Zv(Sl.height,i)}function FT(e,t,n){var i;return i=zT(e,t,n),Zv(Rl.width,i)}function jT(e){return!!Fr(e).length}function HT(e,t,n){var i=Fr(e),r;return r=rd(i,t,n),e.height-r.height+ed.height}function zT(e,t,n){var i=Fr(e),r;return r=rd(i,t,n),e.width-r.width+td.width}function rd(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=Fr(r),o.length?rd(o,t,n):r}var Jv="_plane";function eb(e){var t=e.id;return GT(t)}function Zi(e){var t=e.id;return M(e,"bpmn:SubProcess")?tb(t):t}function Eo(e){return tb(e)}function Ml(e){var t=ut(e);return M(t,"bpmndi:BPMNPlane")}function tb(e){return e+Jv}function GT(e){return e.replace(new RegExp(Jv+"$"),"")}var nb=400,VT=600,ib={x:180,y:160};function hr(e,t,n,i,r,o,a){le.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 M(p,"bpmn:SubProcess")&&!at(p)}function l(p){var f=p.shape,d=p.newRootElement,g=pe(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=pe(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Zi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;z(f,function(d){if(c(d)){var g=a.get(Zi(d));if(!(!g||!d.children||!d.children.length)){var h=rb(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!at(f)||z(ps([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Zi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Zi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Zi(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(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(Ml(f)){a.updateId(f,Eo(y)),a.updateId(h,y);return}var C=a.get(Eo(h));C&&a.updateId(Eo(h),Eo(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(Ml(f)){a.updateId(f,Eo(h)),a.updateId(y,h);return}var C=a.get(Eo(y));C&&a.updateId(C,Eo(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Ml(f)){var d=f,g=a.get(eb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",nb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",nb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",VT,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(at(f))s._moveChildrenToShape(d.children.slice(),f),z(ps(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=rb(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Zi(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,y=M(ut(h),"bpmndi:BPMNPlane");if(y){var C=eb(h),x=Tt(g,function(m){return m.id===C});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ee(hr,le),hr.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=rn(i),o;if(!t.x)o={x:ib.x-r.x,y:ib.y-r.y};else{var a=Fe(t),s=Fe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},hr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Yy(e).map(i=>i.annotation));n.size&&z(ps(e.children),i=>{n.has(i.annotation)&&z(i.associations,r=>{t.removeConnection(r)})})},hr.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},hr.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},hr.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:Zi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},hr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Tt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},hr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function WT(e){var t=[];return z(ps(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function rb(e){return e.children.slice().concat(WT(e.children)).concat(UT(e))}function UT(e){return lf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function od(e,t){e.invoke(le,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!M(r,"bpmn:SubProcess")||M(r,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!at(r))){var o=qT(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}od.$inject=["injector","modeling"],Ee(od,le);function qT(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ad(e,t){le.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(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&&M(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(!(!M(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,mi(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Ee(ad,le),ad.$inject=["eventBus","textRenderer"];function sd(e,t){le.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(at(i))return;var r=os(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){o(l,!0)}),z(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Fe(i)):t.reconnectStart(a,i,Fe(i)))}},!0)}Ee(sd,le),sd.$inject=["eventBus","modeling"];var cd=500;function ld(e,t,n){le.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,l=s,u,p;return u=YT(c).concat([a]),p=fv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}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"],cd,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?ut(c).isExpanded=!1:(i(c.children),ut(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],cd,function(a){var s=a.context,c=s.shape;c.collapsed?ut(c).isExpanded=!1:ut(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],cd,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Ee(ld,le),ld.$inject=["eventBus","elementFactory","modeling"];function YT(e){return e.filter(function(t){return!t.hidden})}function ud(e,t,n,i){t.invoke(le,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Qe(a)||(M(a,"bpmn:Participant")&&at(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;M(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Ee(ud,le),ud.$inject=["canvas","injector","moddle","modeling"];function pd(e,t){le.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;KT(r,o)&&t.updateProperties(o,{default:null})})}Ee(pd,le),pd.$inject=["eventBus","modeling"];function KT(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=pe(t),i=pe(e);return n.get("default")===i}var XT=500,ZT=5e3,ob=["shape.create","shape.delete","shape.move","shape.resize"],ab=[...ob,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function fd(e,t){le.call(this,e);var n;function i(){return n=n||new QT,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(ab,ZT,function(){i()}),this.postExecuted(ab,XT,function(){o()}),this.preExecute(ob,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}fd.$inject=["eventBus","modeling"],Ee(fd,le);function QT(){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 JT=500,ek=5e3,sb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],cb=[...sb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function dd(e,t){le.call(this,e);var n;function i(){return n=n||new tk,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(cb,ek,function(){i()}),this.postExecuted(cb,JT,function(){o()}),this.preExecute(sb,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&r().addGroup(s)})}dd.$inject=["eventBus","modeling"],Ee(dd,le);function tk(){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 hd(e,t){le.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)nk(o)&&!rk(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(hd,le),hd.$inject=["eventBus","modeling"];function nk(e){const t=pe(e);return t&&t.isForCompensation}function ik(e){return e&&M(e,"bpmn:BoundaryEvent")&&ua(e,"bpmn:CompensateEventDefinition")}function rk(e){return e.incoming.filter(n=>ik(n.source)).length>0}const ok={__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",_f],appendBehavior:["type",Ef],associationBehavior:["type",Rf],attachEventBehavior:["type",cl],artifactBehavior:["type",Sf],boundaryEventBehavior:["type",Cf],categoryRootElementReferenceBehavior:["type",Mf],compensateBoundaryEventBehaviour:["type",Af],createBehavior:["type",Pf],createDataObjectBehavior:["type",Tf],createParticipantBehavior:["type",Df],dataInputAssociationBehavior:["type",Lf],dataStoreBehavior:["type",If],deleteLaneBehavior:["type",Bf],detachEventBehavior:["type",gl],dropOnFlowBehavior:["type",$f],eventBasedGatewayBehavior:["type",Ff],fixHoverBehavior:["type",bv],groupBehavior:["type",jf],importDockingFix:["type",wv],isHorizontalFix:["type",zf],labelBehavior:["type",Vf],layoutConnectionBehavior:["type",Wf],messageFlowBehavior:["type",Yf],nonInterruptingBehavior:["type",Kf],removeElementBehavior:["type",Zf],removeEmbeddedLabelBoundsBehavior:["type",Xf],removeParticipantBehavior:["type",Qf],replaceConnectionBehavior:["type",Jf],replaceElementBehaviour:["type",El],resizeBehavior:["type",Vv],resizeLaneBehavior:["type",Xv],rootElementReferenceBehavior:["type",id],spaceToolBehavior:["type",Qv],subProcessPlaneBehavior:["type",hr],subProcessStartEventBehavior:["type",od],textAnnotationBehavior:["type",ad],toggleCollapseConnectionBehaviour:["type",sd],toggleElementCollapseBehaviour:["type",ld],unclaimIdBehavior:["type",ud],unsetDefaultFlowBehavior:["type",pd],updateFlowNodeRefsBehavior:["type",fd],updateCategoryValueRefsBehavior:["type",dd],setCompensationActivityAfterPasteBehavior:["type",hd]};function md(e){this._commandStack=e.get("commandStack",!1)}md.$inject=["injector"],md.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Qi={__init__:["rules"],rules:["type",md]};function Ei(e){le.call(this,e),this.init()}Ei.$inject=["eventBus"],Ee(Ei,le),Ei.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)})},Ei.prototype.init=function(){};function lb(e,t){var n=Tn(e,t,-15);return n!=="intersect"?n:null}function On(e){Ei.call(this,e)}Ee(On,Ei),On.$inject=["eventBus"],On.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return ak(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 Pl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Pl(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 _b(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Mt(i)&&!Tl(t,i)?!1:lo(t,function(r){return Mt(r)?Pl(r.source,r.target,r):r.host?_s(r,r.host,null,n):bd(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 gb(a)&&!n.includes(a.host)})?!1:_s(n,t,null,i)||xb(n,t,i)||wb(n,t)||Tl(n,t)}),this.addRule("shape.create",function(e){return bd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return _s(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Mb(n,t)})},On.prototype.canConnectMessageFlow=Rb,On.prototype.canConnectSequenceFlow=Cb,On.prototype.canConnectDataAssociation=xd,On.prototype.canConnectAssociation=Eb,On.prototype.canConnectCompensationAssociation=Sb,On.prototype.canMove=wb,On.prototype.canAttach=_s,On.prototype.canReplace=xb,On.prototype.canDrop=xa,On.prototype.canInsert=Tl,On.prototype.canCreate=bd,On.prototype.canConnect=Pl,On.prototype.canResize=_b,On.prototype.canCopy=Mb;function ak(e){return gd(e)?null:et(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function gd(e){return!e||Qe(e)}function ub(e){do{if(M(e,"bpmn:Process"))return pe(e);if(M(e,"bpmn:Participant"))return pe(e).processRef||pe(e)}while(e=e.parent)}function yd(e){return M(e,"bpmn:TextAnnotation")}function vd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function pb(e){return M(e,"bpmn:BoundaryEvent")&&Ji(e,"bpmn:CompensateEventDefinition")}function Al(e){return pe(e).isForCompensation}function sk(e,t){var n=ub(e),i=ub(t);return n===i}function ck(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&hb(e,"bpmn:MessageEventDefinition"))}function lk(e){return M(e,"bpmn:InteractionNode")&&!Al(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&hb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!Ji(e,"bpmn:MessageEventDefinition"))}function fb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return pe(t);if(M(t,"bpmn:Participant"))return pe(t).processRef}return null}function db(e,t){var n=fb(e),i=fb(t);return n===i}function Ji(e,t){var n=pe(e);return!!Tt(n.eventDefinitions||[],function(i){return M(i,t)})}function hb(e,t){var n=pe(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function uk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!Fn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&Ji(e,"bpmn:LinkEventDefinition"))&&!pb(e)&&!Al(e)}function pk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!Fn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&Ji(e,"bpmn:LinkEventDefinition"))&&!Al(e)}function fk(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(Ji(e,"bpmn:MessageEventDefinition")||Ji(e,"bpmn:TimerEventDefinition")||Ji(e,"bpmn:ConditionalEventDefinition")||Ji(e,"bpmn:SignalEventDefinition"))}function dk(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function mb(e,t){var n=dk(t);return n.indexOf(e)!==-1}function Pl(e,t,n){if(gd(e)||gd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Rb(e,t))return{type:"bpmn:MessageFlow"};if(Cb(e,t))return{type:"bpmn:SequenceFlow"}}var i=xd(e,t);return i||(Sb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Eb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function xa(e,t){return Qe(e)||vd(e)?!0:M(t,"bpmn:Participant")&&!at(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):et(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!hk(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?at(t):et(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Rr(pe(t).get("participants"),function(n){return!!n.get("processRef")}):et(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?et(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function hk(e){return pe(e).cancelActivity&&(yb(e)||vb(e))}function gb(e){return!Qe(e)&&M(e,"bpmn:BoundaryEvent")}function mk(e){return M(e,"bpmn:Lane")}function gk(e){return gb(e)||M(e,"bpmn:IntermediateThrowEvent")&&yb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&vb(e)}function yb(e){var t=pe(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function vb(e){return bb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function bb(e,t){return t.some(function(n){return Ji(e,n)})}function yk(e){return M(e,"bpmn:ReceiveTask")&&Tt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function _s(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Qe(r)||!gk(r)||Fn(t)||!M(t,"bpmn:Activity")||Al(t)||i&&!lb(i,t)||yk(t)?!1:"attach"}function xb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(r){Fn(t)||M(r,"bpmn:StartEvent")&&r.type!=="label"&&xa(r,t)&&(CA(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(MA(r)||AA(r)||PA(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),bb(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||Ji(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(M(r,"bpmn:EndEvent")&&xa(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),M(r,"bpmn:BoundaryEvent")&&_s(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function wb(e,t){return Rr(e,mk)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return xa(n,t)})}function bd(e,t,n,i){return t?Qe(e)||vd(e)?!0:xa(e,t)||Tl(e,t):!1}function _b(e,t,n){return M(e,"bpmn:SubProcess")?at(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:yd(e)?n?n==="e"||n==="w":!0:vd(e)?!0:Qe(e)?n?n==="e"||n==="w":!0:!1}function vk(e,t){var n=yd(e),i=yd(t);return(n||i)&&n!==i}function Eb(e,t){return mb(t,e)||mb(e,t)?!1:vk(e,t)?!0:!!xd(e,t)}function Sb(e,t){return db(e,t)&&pb(e)&&M(t,"bpmn:Activity")&&!xk(t,e)&&!Fn(t)}function Rb(e,t){return Pb(e)&&!Pb(t)?!1:ck(e)&&lk(t)&&!sk(e,t)}function Cb(e,t){return uk(e)&&pk(t)&&db(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!fk(t))}function xd(e,t){return et(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&et(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:et(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&et(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Tl(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:et(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Qe(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&xa(e,t.parent)}function wd(e,t){return e&&t&&e.indexOf(t)!==-1}function Mb(e,t){return Qe(t)?!0:!(M(t,"bpmn:Lane")&&!wd(e,t.parent)||M(t,"bpmn:MessageFlow")&&!bk(e,t))}function bk(e,t){var n=Ab(t.source),i=Ab(t.target);return wd(e,n)&&wd(e,i)}function Ab(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Pb(e){return da(e,"bpmn:Process")||da(e,"bpmn:Collaboration")}function xk(e,t){return e.attachers.includes(t)}const wk={__depends__:[Qi],__init__:["bpmnRules"],bpmnRules:["type",On]};var _k=2e3;function Tb(e,t){e.on("saveXML.start",_k,n);function n(){var i=t.getRootElements();z(i,function(r){var o=ut(r),a,s;a=os([r]),a=nt(a,function(c){return c!==r&&!c.labelTarget}),s=Ln(a,ut),o.set("planeElement",s)})}}Tb.$inject=["eventBus","canvas"];const Ek={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Tb]};function kl(e){le.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)})}kl.prototype.getOrdering=function(e,t){return null},Ee(kl,le);function _d(e,t){kl.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=Tt(n,function(c){return et(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 l=s;l&&!et(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(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 l=s.children.indexOf(a),u=cm(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}_d.$inject=["eventBus","canvas"],Ee(_d,kl);const Sk={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",_d]};function Es(){}Es.prototype.get=function(){return this._data},Es.prototype.set=function(e){this._data=e},Es.prototype.clear=function(){var e=this._data;return delete this._data,e},Es.prototype.isEmpty=function(){return!this._data};const Rk={clipboard:["type",Es]};var kb=1500;function Ob(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),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",kb,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",kb,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=_o(a),c=document.elementFromPoint(s.x,s.y),Ck(c)}}Ob.$inject=["elementRegistry","eventBus","injector"];function Ck(e){return go(e,"svg, .djs-element",!0)}const Mk={__init__:["hoverFix"],hoverFix:["type",Ob]};function Ak(e){return!0}function Ol(e){return Hr(e)||DT(e)}var Db=500;function Lb(e,t,n){var i=this;function r(O,N,T){if(!s(O,N)){var D,j,ee;T?j=t.getGraphics(T):(D=N.delegateTarget||N.target,D&&(j=D,T=t.get(j))),!(!j||!T)&&(ee=e.fire(O,{element:T,gfx:j,originalEvent:N}),ee===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(O){return o[O]}function s(O,N){var T=l[O]||Hr;return!T(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"},l={"element.contextmenu":Ak,"element.mousedown":Ol,"element.mouseup":Ol,"element.click":Ol,"element.dblclick":Ol};function u(O,N,T){var D=c[O];if(!D)throw new Error("unmapped DOM event name <"+O+">");return r(D,N,T)}var p="svg, .djs-element";function f(O,N,T,D){var j=o[T]=function(ee){r(T,ee)};D&&(l[T]=D),j.$delegate=Qn.bind(O,p,N,j)}function d(O,N,T){var D=a(T);D&&Qn.unbind(O,N,D.$delegate)}function g(O){z(c,function(N,T){f(O,T,N)})}function h(O){z(c,function(N,T){d(O,T,N)})}e.on("canvas.destroy",function(O){h(O.svg)}),e.on("canvas.init",function(O){g(O.svg)}),e.on(["shape.added","connection.added"],function(O){var N=O.element,T=O.gfx;e.fire("interactionEvents.createHit",{element:N,gfx:T})}),e.on(["shape.changed","connection.changed"],Db,function(O){var N=O.element,T=O.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:T})}),e.on("interactionEvents.createHit",Db,function(O){var N=O.element,T=O.gfx;i.createDefaultHit(N,T)}),e.on("interactionEvents.updateHit",function(O){var N=O.element,T=O.gfx;i.updateDefaultHit(N,T)});var y=w("djs-hit djs-hit-stroke"),C=w("djs-hit djs-hit-click-stroke"),x=w("djs-hit djs-hit-all"),m=w("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":C,stroke:y,"no-move":m};function w(O,N){return N=U({stroke:"white",strokeWidth:15},N||{}),n.cls(O,["no-fill","no-border"],N)}function S(O,N){var T=v[N];if(!T)throw new Error("invalid hit type <"+N+">");return Se(O,T),O}function k(O,N){Ge(O,N)}this.removeHits=function(O){var N=Gc(".djs-hit",O);z(N,fn)},this.createDefaultHit=function(O,N){var T=O.waypoints,D=O.isFrame,j;return T?this.createWaypointsHit(N,T):(j=D?"stroke":"all",this.createBoxHit(N,j,{width:O.width,height:O.height}))},this.createWaypointsHit=function(O,N){var T=rs(N);return S(T,"stroke"),k(O,T),T},this.createBoxHit=function(O,N,T){T=U({x:0,y:0},T);var D=Oe("rect");return S(D,N),Se(D,T),k(O,D),D},this.updateDefaultHit=function(O,N){var T=Rt(".djs-hit",N);if(T)return O.waypoints?cf(T,O.waypoints):Se(T,{width:O.width,height:O.height}),T},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Lb.$inject=["eventBus","elementRegistry","styles"];const Dl={__init__:["interactionEvents"],interactionEvents:["type",Lb]};function wa(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)})}wa.$inject=["eventBus","canvas"],wa.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()})}},wa.prototype.get=function(){return Array.from(this._selectedElements)},wa.prototype.isSelected=function(e){return this._selectedElements.has(e)},wa.prototype.select=function(e,t){var n=this.get();$e(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?z(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ib="hover",Bb="selected";function Nb(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,Ib)}),t.on("element.out",function(r){i(r.element,Ib)}),t.on("selection.changed",function(r){function o(l){i(l,Bb)}function a(l){n(l,Bb)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Nb.$inject=["canvas","eventBus"];function $b(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;$e(l)?t.select(l):t.select(s.filter(Pk))}}),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=Tt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Hr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Cl(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}$b.$inject=["eventBus","selection","canvas","elementRegistry"];function Pk(e){return!e.hidden}const Si={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Dl],selection:["type",wa],selectionVisuals:["type",Nb],selectionBehavior:["type",$b]};var Tk=/^djs-cursor-.*$/;function Ll(e){var t=Ht(document.body);t.removeMatching(Tk),e&&t.add("djs-cursor-"+e)}function Fb(){Ll(null)}var kk=5e3;function jb(e,t){t=t||"element.click";function n(){return!1}return e.once(t,kk,n),function(){e.off(t,n)}}var Ok=["c","C"],Dk=["v","V"],Lk=["d","D"],Ik=["x","X"],Bk=["y","Y"],Hb=["z","Z"];function Nk(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ti(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function dn(e,t){return e=$e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Ed(e){return e.shiftKey}function $k(e){return ti(e)&&dn(Ok,e)}function Fk(e){return ti(e)&&dn(Dk,e)}function jk(e){return ti(e)&&dn(Lk,e)}function Hk(e){return ti(e)&&dn(Ik,e)}function zk(e){return ti(e)&&!Ed(e)&&dn(Hb,e)}function Gk(e){return ti(e)&&(dn(Bk,e)||dn(Hb,e)&&Ed(e))}var _a=Math.round,zb="djs-drag-active";function So(e){e.preventDefault()}function Vk(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Wk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Gb(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(m){var v=t.viewbox(),w=t._container.getBoundingClientRect();return{x:v.x+(m.x-w.left)/v.scale,y:v.y+(m.y-w.top)/v.scale}}function s(m,v){v=v||o;var w=e.createEvent(U({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,w)===!1?!1:e.fire(v.prefix+"."+m,w)}function c(m){var v=m.filter(function(w){return i.get(w.id)});v.length&&n.select(v)}function l(m,v){var w=o.payload,S=o.displacement,k=o.globalStart,O=_o(m),N=Ii(O,k),T=o.localStart,D=a(O),j=Ii(D,T);if(!o.active&&(v||Wk(N)>o.threshold)){if(U(w,{x:_a(T.x+S.x),y:_a(T.y+S.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&Ll(o.cursor),t.addMarker(t.getRootElement(),zb)}nd(m),o.active&&(U(w,{x:_a(D.x+S.x),y:_a(D.y+S.y),dx:_a(j.x),dy:_a(j.y)},{originalEvent:m}),s("move"))}function u(m){var v,w=!0;o.active&&(m&&(o.payload.originalEvent=m,nd(m)),w=s("end")),w===!1&&s("rejected"),v=C(w!==!0),s("ended",v)}function p(m){dn("Escape",m)&&(So(m),y())}function f(m){var v;o.active&&(v=jb(e),setTimeout(v,400),So(m)),u(m)}function d(m){l(m)}function g(m){var v=o.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(o){var w=o.active;w&&s("cancel"),v=C(m),w&&s("canceled",v)}}function C(m){var v,w;s("cleanup"),Fb(),o.trapClick?w=f:w=u,ze.unbind(document,"mousemove",l),ze.unbind(document,"dragstart",So),ze.unbind(document,"selectstart",So),ze.unbind(document,"mousedown",w,!0),ze.unbind(document,"mouseup",w,!0),ze.unbind(document,"keyup",p),ze.unbind(document,"touchstart",d,!0),ze.unbind(document,"touchcancel",y,!0),ze.unbind(document,"touchmove",l,!0),ze.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),zb);var S=o.payload.previousSelection;return m!==!1&&S&&!n.get().length&&c(S),v=o,o=null,v}function x(m,v,w,S){o&&y(!1),typeof v=="string"&&(S=w,w=v,v=null),S=U({},r,S||{});var k=S.data||{},O,N,T,D,j;if(S.trapClick?D=f:D=u,m?(O=ba(m)||m,N=_o(m),nd(m),O.type==="dragstart"&&So(O)):(O=null,N={x:0,y:0}),T=a(N),v||(v=T),j=Vk(O),o=U({prefix:w,data:k,payload:{},globalStart:N,displacement:Ii(v,T),localStart:T,isTouch:j},S),S.manual||(j?(ze.bind(document,"touchstart",d,!0),ze.bind(document,"touchcancel",y,!0),ze.bind(document,"touchmove",l,!0),ze.bind(document,"touchend",u,!0)):(ze.bind(document,"mousemove",l),ze.bind(document,"dragstart",So),ze.bind(document,"selectstart",So),ze.bind(document,"mousedown",D,!0),ze.bind(document,"mouseup",D,!0)),ze.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;S.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(m){U(r,m)}}Gb.$inject=["eventBus","canvas","selection","elementRegistry"];const mr={__depends__:[Mk,Si],dragging:["type",Gb]};function Ea(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ea.prototype.next=function(){return this._prefix+ ++this._counter};const Uk=new Ea("ps");var qk=["marker-start","marker-mid","marker-end"],Yk=["circle","ellipse","line","path","polygon","polyline","path","rect"];function zr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}zr.$inject=["elementRegistry","eventBus","canvas","styles"],zr.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")},zr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},zr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ny(n);return this._cloneMarkers(bo(r),i),Se(r,this._styles.cls(i,[])),Ge(t,r),Se(r,"data-preview-support-element-id",e.id),r},zr.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ge(t,n),Se(n,"data-preview-support-element-id",e.id),n},zr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),Qk(e)&&qk.forEach(function(r){if(Se(e,r)){var o=Kk(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},zr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Uk.next()].join("-"),a=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ny(n);s.id=o,st(s).add(r);var c=Rt(":scope > defs",e);c||(c=Oe("defs"),Ge(e,c)),Ge(c,s);var l=Zk(s.id);Se(t,i,l)};function Kk(e,t,n){var i=Xk(Se(e,t));return Rt("marker#"+i,n||document)}function Xk(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function Zk(e){return"url(#"+e+")"}function Qk(e){return Yk.indexOf(e.nodeName)!==-1}const Sa={__init__:["previewSupport"],previewSupport:["type",zr]};var Jk="drop-ok",Vb="drop-not-ok",Wb="attach-ok",Ub="new-parent",qb="create",e2=2e3;function Yb(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=nt(c,function(x){var m=x.labelTarget;return!x.parent&&!(Qe(x)&&c.indexOf(m)!==-1)});var d=Tt(c,function(x){return!Mt(x)}),g=!1,h=!1,y=!1;Xb(c)&&(g=r.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Xb(c)?y=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var C=f.connectionTarget;return y||g?(d&&p&&(h=r.allowed("connection.create",{source:C===p?d:p,target:C===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[Wb,Jk,Vb,Ub].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Kb(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&o(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,Wb):a(p,h?Ub:Vb))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,C=l.hints||{};if(g===!1||!d)return!1;Kb(c);var x={x:c.x,y:c.y};y?p=i.appendShape(u,p,x,d,{attach:h,connection:y===!0?{}:y,connectionTarget:C.connectionTarget}):(f=i.createElements(f,x,d,U({},C,{attach:h})),p=Tt(f,function(m){return!Mt(m)})),U(l,{elements:f,shape:p}),U(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===qb&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],e2,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){$e(l)||(l=[l]);var p=Tt(l,function(g){return!Mt(g)});if(p){u=U({elements:l,hints:{},shape:p},u||{}),z(l,function(g){He(g.x)||(g.x=0),He(g.y)||(g.y=0)});var f=nt(l,function(g){return!g.hidden}),d=rn(f);z(l,function(g){Mt(g)&&(g.waypoints=Ln(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),U(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,qb,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Yb.$inject=["canvas","dragging","eventBus","modeling","rules"];function Kb(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 Xb(e){return e&&e.length===1&&!Mt(e[0])}var t2=750;function Zb(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(bo(u),l)):(u=n._createContainer("shape",c),n.drawShape(bo(u),l),kn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",t2,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),Ge(p,u)),kn(u,a.x,a.y)):fn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&fn(c)})}Zb.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Il={__depends__:[mr,Sa,Qi,Si],__init__:["create","createPreview"],create:["type",Yb],createPreview:["type",Zb]};function Sd(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)})}Sd.$inject=["eventBus"],Sd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||n2(0,0)};function n2(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 Ss={__init__:["mouse"],mouse:["type",Sd]};var Qb=2e3;function ni(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 l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),i2(u)&&(l.priority=2,l.host=u.host.id),Mt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=r2(u)),Qe(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){He(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",Qb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Qb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;U(l,{createElementsBehavior:!1})})}ni.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ni.prototype.copy=function(e,t={}){var n,i;return $e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree($e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ni.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})}}},ni.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ni.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},ni.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},ni.prototype._paste=function(e,t,n,i){z(e,function(o){He(o.x)||(o.x=0),He(o.y)||(o.y=0)});var r=rn(e);return z(e,function(o){Mt(o)&&(o.waypoints=Ln(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),U(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,U({},i))},ni.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return z(e,function(o,a){o=ji(o,"priority"),z(o,function(s){var c=U({},Hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Mt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Qe(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},ni.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Hi(e,["id"]));return t},ni.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Hi(e,["id"]));return t},ni.prototype.createShape=function(e){var t=this._elementFactory.createShape(Hi(e,["id"]));return t},ni.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Mt(e)&&(!n.has(e.source)||!n.has(e.target))||Qe(e)&&!n.has(e.labelTarget))},ni.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=qc(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=l(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}vo(a,function(p,f,d){if(Qe(p))return;z(p.labels,function(y){c(y,d)});function g(y){y&&y.length&&z(y,function(C){z(C.labels,function(x){c(x,d)}),c(C,d)})}z([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=Ln(r,function(p){return p.element});var u=new Set(e);return r=Ln(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),r=ji(r,function(p){return p.descriptor.priority}),e=Ln(r,function(p){return p.element}),z(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){ex(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){ex(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function i2(e){return!!e.host}function r2(e){return Ln(e.waypoints,function(t){return t=Jb(t),t.original&&(t.original=Jb(t.original)),t})}function Jb(e){return U({},e)}function ex(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const o2={__depends__:[Rk,Il,Ss,Qi],__init__:["copyPaste"],copyPaste:["type",ni]};function Rd(e,t,n){$e(n)||(n=[n]),z(n,function(i){co(e[i])||(t[i]=e[i])})}var Cd=750;function tx(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Cd,function(c){var l=c.descriptor,u=c.element,p=pe(u);if(Qe(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(ut(u),!0);d.bpmnElement=f,Rd(f,l,"name"),Rd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=pe(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(pe(c).attachedToRef=pe(l[c.host])),Hi(u,Zn(u,function(f,d,g){var h=d.element,y=d.property;return g===c.id&&(h.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Qe(u)){u.businessObject=pe(l[u.labelTarget]),u.di=ut(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Rd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Cd,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=pe(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&z(ps(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Cd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}tx.$inject=["bpmnFactory","eventBus","moddleCopy"];const a2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],s2=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Rs(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 ji(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=gn(r)&&r.$descriptor;if(a&&s2.includes(a))return o;if(a&&a2.includes(a)||a&&s&&!Tt(s.properties,Wo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(M(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Rs.$inject=["eventBus","bpmnFactory","moddle"],Rs.prototype.copyElement=function(e,t,n,i=!1){n&&!$e(n)&&(n=[n]),n=n||Md(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||($e(r)&&(n=r),z(n,o=>{let a;Xn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!un(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Rs.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 gn(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):$e(e)?Zn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):gn(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},Rs.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 Md(e,t){return Zn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const nx={__depends__:[o2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",tx],moddleCopy:["type",Rs]};var ix=Math.round;function Ad(e,t){this._modeling=e,this._eventBus=t}Ad.$inject=["modeling","eventBus"],Ad.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,l=ix(s+o/2),u=ix(c+a/2),p=i.replaceShape(e,U({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function rx(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}rx.$inject=["selection","eventBus"];const c2={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",rx],replace:["type",Ad]};function l2(e,t,n){$e(n)||(n=[n]),z(n,function(i){co(e[i])||(t[i]=e[i])})}var u2=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function p2(e,t){var n=e&&Xn(e,"collapsed")?e.collapsed:!at(e),i;return t&&(Xn(t,"collapsed")||Xn(t,"isExpanded"))?i=Xn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function ox(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Bl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&p2(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),l2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Md(p.$descriptor),h=Md(f.$descriptor,!0),y=f2(g,h);U(f,Di(c,u2));var C=nt(y,function(v){return v==="eventDefinitions"?ax(s,c.eventDefinitionType):v==="loopCharacteristics"?!Fn(f):Xn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!Fn(f):!0});if(f=n.copyElement(p,f,C),c.eventDefinitionType&&(ax(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(Bl(p))d.isExpanded=at(s);else if(c&&Xn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}at(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Bl(p)&&!Bl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=xn(s);ut(s).isHorizontal||(ut(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?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,et(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&et(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(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,{...l,targetElement:c})}this.replaceElement=a}ox.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Bl(e){return M(e,"bpmn:SubProcess")}function ax(e,t){var n=pe(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function f2(e,t){return e.filter(function(n){return t.includes(n)})}const sx={__depends__:[nx,c2,Si],bpmnReplace:["type",ox]};var d2=250;function Ro(e){this._eventBus=e,this._tools=[],this._active=null}Ro.$inject=["eventBus"],Ro.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)},Ro.prototype.isActive=function(e){return e&&this._active===e},Ro.prototype.length=function(e){return this._tools.length},Ro.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Ro.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),z(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,d2,function(r){this._active&&(h2(r)||this.setActive(null))},this)};function h2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&go(t,'.group[data-group="tools"]')}const Nl={__depends__:[mr],__init__:["toolManager"],toolManager:["type",Ro]};function m2(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 g2(e,t){var n=[],i=new Set(e);z(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;z(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function y2(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 Pd=Math.abs,v2=Math.round,gr={x:"width",y:"height"},cx="crosshair",Gr={n:"top",w:"left",s:"bottom",e:"right"},b2=1500,$l={n:"s",w:"e",s:"n",e:"w"},Fl=20;function Ri(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",b2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&ux(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){ux(c);var h={x:0,y:0};h[u]=v2(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Ri.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ri.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:cx,data:{context:{reactivate:n}},trapClick:!1})},Ri.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:cx,data:{context:{}}})},Ri.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Ri.prototype.init=function(e,t){var n=Pd(e.dx)>Pd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Pd(i)<5)return!1;i<0&&(i*=-1),ws(e)&&(i*=-1);var o=m2(n,i),a=this._canvas.getRootElement();!Cl(e)&&e.hover&&(a=e.hover);var s=[...os(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=x2(c,n,o,r,l);return U(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Ll("resize-"+(n==="x"?"ew":"ns")),!0},Ri.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];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 z(e,function(d){if(!(!d.parent||Qe(d))){if(Mt(d)){u.push(d);return}var g=d[t],h=g+d[gr[t]];if(w2(d)&&(n>0&&Fe(d)[t]>i||n<0&&Fe(d)[t]<i)){l.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}}}),z(o,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:o,resizingShapes:a}},Ri.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ri.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function lx(e){return{top:e.top-Fl,right:e.right+Fl,bottom:e.bottom+Fl,left:e.left-Fl}}function ux(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;He(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),He(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),He(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),He(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function x2(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),p=new Set(a);return z(a,function(f){var d=f.attachers,g=f.children,h=Be(f),y=nt(g,function(j){return!Mt(j)&&!Qe(j)&&!u.has(j)&&!p.has(j)}),C=nt(g,function(j){return!Mt(j)&&!Qe(j)&&u.has(j)}),x,m,v,w=[],S=[],k,O,N,T;y.length&&(m=lx(Be(rn(y))),x=i-h[Gr[n]]+m[Gr[n]],n==="n"?s.bottom=l=He(l)?Math.min(l,x):x:n==="w"?s.right=l=He(l)?Math.min(l,x):x:n==="s"?s.top=c=He(c)?Math.max(c,x):x:n==="e"&&(s.left=c=He(c)?Math.max(c,x):x)),C.length&&(v=lx(Be(rn(C))),x=i-v[Gr[$l[n]]]+h[Gr[$l[n]]],n==="n"?s.bottom=l=He(l)?Math.min(l,x):x:n==="w"?s.right=l=He(l)?Math.min(l,x):x:n==="s"?s.top=c=He(c)?Math.max(c,x):x:n==="e"&&(s.left=c=He(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(j){u.has(j)?w.push(j):S.push(j)}),w.length&&(k=Be(rn(w.map(Fe))),O=h[Gr[$l[n]]]-(k[Gr[$l[n]]]-i)),S.length&&(N=Be(rn(S.map(Fe))),T=N[Gr[n]]-(h[Gr[n]]-i)),n==="n"?(x=Math.min(O||1/0,T||1/0),s.bottom=l=He(l)?Math.min(l,x):x):n==="w"?(x=Math.min(O||1/0,T||1/0),s.right=l=He(l)?Math.min(l,x):x):n==="s"?(x=Math.max(O||-1/0,T||-1/0),s.top=c=He(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(O||-1/0,T||-1/0),s.left=c=He(c)?Math.max(c,x):x));var D=r&&r[f.id];D&&(n==="n"?(x=i+f[gr[t]]-D[gr[t]],s.bottom=l=He(l)?Math.min(l,x):x):n==="w"?(x=i+f[gr[t]]-D[gr[t]],s.right=l=He(l)?Math.min(l,x):x):n==="s"?(x=i-f[gr[t]]+D[gr[t]],s.top=c=He(c)?Math.max(c,x):x):n==="e"&&(x=i-f[gr[t]]+D[gr[t]],s.left=c=He(c)?Math.max(c,x):x))}),s}}function w2(e){return!!e.host}var Td="djs-dragging",px="djs-resizing",_2=250,jl=Math.max;function fx(e,t,n,i,r){function o(a,s){z(a,function(c){r.addDragger(c,s),n.addMarker(c,Td)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),Ge(s,u);var p=Oe("path");Se(p,"d",l.x),st(p).add("djs-crosshair"),Ge(u,p);var f=Oe("path");Se(f,"d",l.y),st(f).add("djs-crosshair"),Ge(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;kn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&fn(c)}),e.on("spaceTool.move",_2,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),Se(c,"d","M0,0 L0,0"),st(c).add("djs-crosshair"),Ge(f,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),Ge(n.getActiveLayer(),d),o(u,d);var g=new Set(u);z(p,function(S){g.add(S)});var h=new Set,y=s.movingConnections=[];g.forEach(function(S){z(S.outgoing,function(k){h.has(k)||!Mt(k)||!g.has(k.target)||(h.add(k),y.push(k))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var C=Oe("g");Se(C,i.cls("djs-frame-group",["no-events"])),Ge(n.getActiveLayer(),C);var x=[];z(p,function(S){var k=r.addFrame(S,C),O=k.getBBox();x.push({element:k,initialBounds:O}),n.addMarker(S,px)}),s.frameGroup=C,s.frames=x}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:m[l]});var v={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[v[s.axis]]=0,kn(s.dragGroup,w.x,w.y),z(s.frames,function(S){var k=S.element,O=S.initialBounds,N,T;s.direction==="e"?Se(k,{width:jl(O.width+w.x,5)}):(N=jl(O.width-w.x,5),Se(k,{width:N,x:O.x+O.width-N})),s.direction==="s"?Se(k,{height:jl(O.height+w.y,5)}):(T=jl(O.height-w.y,5),Se(k,{height:T,y:O.y+O.height-T}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,Td)}),z(l,function(g){n.removeMarker(g,Td)}),f&&(fn(p),fn(f)),z(u,function(g){n.removeMarker(g,px)}),d&&fn(d)})}fx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const E2={__init__:["spaceToolPreview"],__depends__:[mr,Qi,Nl,Sa,Ss],spaceTool:["type",Ri],spaceToolPreview:["type",fx]};function Hl(e,t){e.invoke(Ri,this),this._canvas=t}Hl.$inject=["injector","canvas"],Ee(Hl,Ri),Hl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Go(aa(r.children.filter(l=>M(l,"bpmn:Artifact")),rn(o))));const s=[...e,...a];var c=Ri.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||S2(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function S2(e){return M(e,"bpmn:Participant")&&!pe(e).processRef}const dx={__depends__:[E2],spaceTool:["type",Hl]};function Vt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Vt.$inject=["eventBus","injector"],Vt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Vt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Vt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.register=function(e,t){this._setHandler(e,t)},Vt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Vt.prototype.canUndo=function(){return!!this._getUndoAction()},Vt.prototype.canRedo=function(){return!!this._getRedoAction()},Vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Vt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Vt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Vt.prototype._createId=function(){return this._uid++},Vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Vt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Vt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Vt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:lm("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=$e(e)?e:[e],t.dirty=t.dirty.concat(e))},Vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Vt.prototype._revertedAction=function(e){this._stackIdx--},Vt.prototype._getHandler=function(e){return this._handlerMap[e]},Vt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const R2={commandStack:["type",Vt]};function Vr(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 C2=250,hx=1400;function kd(e,t,n){le.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",hx,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=mx(a),o.validatedShapes=mx(s)}),i&&t.on("shape.move.start",C2,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",hx,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Vr(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=uf(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&&(tn(s.labels,a,c),a.labelTarget=s)})}Ee(kd,le),kd.$inject=["injector","eventBus","modeling"];function mx(e){var t=new Set(e);return nt(e,function(n){return!t.has(n.labelTarget)})}const M2={__init__:["labelSupport"],labelSupport:["type",kd]};var A2=251,gx=1401,yx="attach-ok";function Od(e,t,n,i,r){le.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",gx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=P2(c),s.validatedShapes=T2(l)}),o&&t.on("shape.move.start",A2,function(a){var s=a.context,c=s.shapes,l=Dd(c);z(l,function(u){o.makeDraggable(s,u,!0),z(u.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 l=c[0],u=l.host;u&&(n.addMarker(u,yx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,yx)}))}}),this.preExecuted("elements.move",gx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Dd(l);z(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=nt(c,function(p){var f=p.host;return k2(p)&&!O2(c,f)}),z(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),z(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Vr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&z(l.attachers,function(u){var p=Iv(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=Iv(d,l,u);r.moveShape(d,g,d.parent),z(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Vr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Ee(Od,le),Od.$inject=["injector","eventBus","canvas","rules","modeling"];function Dd(e){return op(Ln(e,function(t){return t.attachers||[]}))}function P2(e){var t=Dd(e);return f1("id",e,t)}function T2(e){var t=Vo(e,"id");return nt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function k2(e){return!!e.host}function O2(e,t){return e.indexOf(t)!==-1}const D2={__depends__:[Qi],__init__:["attachSupport"],attachSupport:["type",Od]};function vx(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(uy(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)})}vx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Ld={__init__:["changeSupport"],changeSupport:["type",vx]};function Ci(e){this._model=e}Ci.$inject=["moddle"],Ci.prototype._needsId=function(e){return et(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"])},Ci.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":et(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))},Ci.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Ci.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Ci.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",U({bpmnElement:e,bounds:this.createDiBounds()},t))},Ci.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Ci.prototype.createDiWaypoints=function(e){var t=this;return Ln(e,function(n){return t.createDiWaypoint(n)})},Ci.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Di(e,["x","y"]))},Ci.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",U({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Ci.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",U({bpmnElement:e},t))};function ii(e,t,n){le.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),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,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ri(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ri(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;z(y,function(C){M(C,"bpmn:BaseElement")&&i.updateParent(C)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],ri(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ri(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ri(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ri(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ri(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ri(u)),this.executed("connection.reconnect",ri(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=pe(h),m=pe(y),v=pe(C);x.conditionExpression&&!et(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),y!==C&&m.default===x&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",ri(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=pe(h),m=pe(y),v=pe(C);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],ri(p)),this.reverted(["element.updateAttachment"],ri(p)),this.executed("element.updateLabel",ri(f)),this.reverted("element.updateLabel",ri(f));function f(d){const{element:g}=d.context,h=mi(g),y=ut(g),C=y&&y.get("label");Nr(g)||Ml(g)||(h&&!C?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&C&&y.set("label",void 0))}}Ee(ii,le),ii.$inject=["eventBus","bpmnFactory","connectionDocking"],ii.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ii.prototype.updateParent=function(e,t){if(!Qe(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ut(e),o=n&&n.businessObject,a=ut(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),M(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},ii.prototype.updateBounds=function(e){var t=ut(e),n=I2(e);if(n){var i=Ii(n,t.get("bounds"));U(n,{x:e.x+i.x,y:e.y+i.y})}var r=Qe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),U(o,{x:e.x,y:e.y,width:e.width,height:e.height})},ii.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),tn(r,e))}},ii.prototype.updateDiConnection=function(e,t,n){var i=ut(e),r=ut(t),o=ut(n);i.sourceElement&&i.sourceElement.bpmnElement!==pe(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==pe(n)&&(i.targetElement=n&&o)},ii.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function L2(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ii.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(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)},ii.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=L2(e.$parent||t),e.$parent&&(Zt(o.get("rootElements"),r),r.$parent=null),t&&(tn(o.get("rootElements"),r),r.$parent=o))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(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),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ii.prototype.updateConnectionWaypoints=function(e){var t=ut(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ii.prototype.updateConnection=function(e){var t=e.connection,n=pe(t),i=t.source,r=pe(i),o=t.target,a=pe(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Zt(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)},ii.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ri(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function I2(e){if(M(e,"bpmn:Activity")){var t=ut(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Wr(e,t){pr.call(this),this._bpmnFactory=e,this._moddle=t}Ee(Wr,pr),Wr.$inject=["bpmnFactory","moddle"],Wr.prototype._baseCreate=pr.prototype.create,Wr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,U({type:"label",di:n},xo,t))}return this.createElement(e,t)},Wr.prototype.createElement=function(e,t){t=U({},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(!N2(r)){var o=U({},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)}M(i,"bpmn:Group")&&(t=U({isFrame:!0},t)),t=B2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Id(r,t,"isExpanded")),et(i,["bpmn:Lane","bpmn:Participant"])&&(t=Id(r,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!at(i,r)),M(i,"bpmn:ExclusiveGateway")&&(Xn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),un(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),un(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=U({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Wr.prototype.getDefaultSize=function(e,t){var n=pe(e);if(t=t||ut(e),M(n,"bpmn:SubProcess"))return at(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return at(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Wr.prototype.createParticipantShape=function(e){return gn(e)||(e={isExpanded:e}),e=U({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function B2(e,t,n){return z(n,function(i){t=Id(e,t,i)}),t}function Id(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Hi(t,[n]))}function N2(e){return et(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function zl(e,t){this._modeling=e,this._canvas=t}zl.$inject=["modeling","canvas"],zl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(r){var o={x:0,y:0};un(i.left)?o.x=i.left-r.x:un(i.right)?o.x=i.right-r.width-r.x:un(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:un(i.top)?o.y=i.top-r.y:un(i.bottom)?o.y=i.bottom-r.height-r.y:un(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},zl.prototype.postExecute=function(e){};function Gl(e){this._modeling=e}Gl.$inject=["modeling"],Gl.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},Gl.prototype.postExecute=function(e){var t=e.hints||{};$2(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 $2(e,t){return Rr(e.outgoing,function(n){return n.target===t})}function Vl(e,t){this._canvas=e,this._layouter=t}Vl.$inject=["canvas","layouter"],Vl.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},Vl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Wl=Math.round;function Bd(e){this._modeling=e}Bd.$inject=["modeling"],Bd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;z(t,function(p){He(p.x)||(p.x=0),He(p.y)||(p.y=0)});var s=nt(t,function(p){return!p.hidden}),c=rn(s);z(t,function(p){Mt(p)&&(p.waypoints=Ln(p.waypoints,function(f){return{x:Wl(f.x-c.x-c.width/2+r.x),y:Wl(f.y-c.y-c.height/2+r.y)}})),U(p,{x:Wl(p.x-c.x-c.width/2+r.x),y:Wl(p.y-c.y-c.height/2+r.y)})});var l=new Set(qc(t)),u={};z(t,function(p){if(Mt(p)){u[p.id]=He(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=U({},o);l.has(p)||(f.autoResize=!1),Qe(p)&&(f=Hi(f,["attach"])),u[p.id]=He(i)?a.createShape(p,Di(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Di(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Go(u)};var bx=Math.round;function Ur(e){this._canvas=e}Ur.$inject=["canvas"],Ur.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?U(t,n):U(t,{x:n.x-bx(t.width/2),y:n.y-bx(t.height/2)}),this._canvas.addShape(t,i,r),t},Ur.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Cs(e){Ur.call(this,e)}Ee(Cs,Ur),Cs.$inject=["canvas"];var F2=Ur.prototype.execute;Cs.prototype.execute=function(e){var t=e.shape;return H2(t),t.labelTarget=e.labelTarget,F2.call(this,e)};var j2=Ur.prototype.revert;Cs.prototype.revert=function(e){return e.shape.labelTarget=null,j2.call(this,e)};function H2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Ms(e,t){this._canvas=e,this._modeling=t}Ms.$inject=["canvas","modeling"],Ms.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Vr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Vr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Ms.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=uf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Ms.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t};function Nd(e,t){this._modeling=e,this._elementRegistry=t}Nd.$inject=["modeling","elementRegistry"],Nd.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function As(e,t){this._canvas=e,this._modeling=t}As.$inject=["canvas","modeling"],As.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Vr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Vr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Vr(n.children,function(i){Mt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},As.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=uf(i.children,n),t.removeShape(n),n},As.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return tn(i.children,n,r),t.addShape(n,i),n};function Ul(e){this._modeling=e}Ul.$inject=["modeling"];var xx={x:"y",y:"x"};Ul.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,C){y.range.min=Math.min(C[i],y.range.min),y.range.max=Math.max(C[i]+C[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,C){var x={y:0};x[i]=y-a(C),x[i]&&(x[xx[i]]=0,t.moveElements([C],x,C.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(y,C){var x,m,v;if(y.elements.length<2){C&&C!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}x=ji(y.elements,i),m=x[0],C===p&&(m=x[s(x)]),v=a(m),y.range=null,z(x,function(w){if(l(v,w),y.range===null){y.range={min:w[i],max:w[i]+w[r]};return}o(y,w)}),C&&C!==n.length-1&&(h+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(y,C){var x={},m;y===u||y===f||(m=n[C-1],y.range.max=0,z(y.elements,function(v,w){x[xx[i]]=0,x[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(x[i]+=v[i]-y.range.min),x[i]&&t.moveElements([v],x,v.parent),y.range.max=Math.max(v[i]+v[r],w?y.range.max:0)}))})},Ul.prototype.postExecute=function(e){};function ql(e,t){this._layouter=e,this._canvas=t}ql.$inject=["layouter","canvas"],ql.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return U(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},ql.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function $d(){}$d.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=Zt(o.children,t),tn(i.children,t,r),t.parent=i,z(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},$d.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Zt(n.children,t),tn(i.children,t,r),t.parent=i,z(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 Fd(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Fd.prototype.add=function(e,t){return this.addAll([e],t)},Fd.prototype.addAll=function(e,t){var n=yM(e,!!t,this);return U(this,n),this};function Ps(e){this._modeling=e}Ps.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ps.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),z(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&Uf(p,p.source,t),connectionEnd:d&&qf(p,p.target,t)})})},Ps.prototype.getClosure=function(e){return new Fd().addAll(e,!0)};function Yl(e){this._helper=new Ps(e)}Yl.$inject=["modeling"],Yl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Yl.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 Co(e){this._modeling=e,this._helper=new Ps(e)}Co.$inject=["modeling"],Co.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=Di(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Zt(o.children,t),tn(i.children,t,r),U(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Co.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(z(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:qf(o,t,n)})}),z(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Uf(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Co.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return tn(n.children,t,i),U(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Co.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Co.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ts(e){this._modeling=e}Ts.$inject=["modeling"],Ts.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return $e(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Ts.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||wx($e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||wx($e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Ts.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 wx(e){return e.original||e}function yr(e,t){this._modeling=e,this._rules=t}yr.$inject=["modeling","rules"],yr.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,y){return i.allowed("connection.reconnect",{connection:y,source:g,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,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();z(f,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,wl(g,s,u),a)}),z(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,xl(g,s,u),a)})},yr.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},yr.prototype.execute=function(e){},yr.prototype.revert=function(e){},yr.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},yr.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},yr.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ks(e){this._modeling=e}ks.$inject=["modeling"],ks.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},U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ks.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(z(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:wl(o,n,i)})}),z(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:xl(o,n,i)})}))},ks.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return U(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function qr(e){this._modeling=e}qr.$inject=["modeling"],qr.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),z(r,function(s){a[s.id]=G2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(g2(i,r),t,n,o,i,r,a)},qr.prototype.execute=function(){},qr.prototype.revert=function(){},qr.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},qr.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(r){var o=y2(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},qr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);z(e,function(u){var p=u.source,f=u.target,d=z2(u),g=Ex(n),h={},y=c.has(p)||l.has(p),C=c.has(f)||l.has(f);y&&C?(d=Ln(d,function(x){return Sx(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&Sx(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||C)&&(c.has(p)?h.connectionStart=Uf(u,p,t):c.has(f)?h.connectionEnd=qf(u,f,t):l.has(p)?h.connectionStart=xl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=wl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function _x(e){return U({},e)}function z2(e){return Ln(e.waypoints,function(t){return t=_x(t),t.original&&(t.original=_x(t.original)),t})}function Ex(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Sx(e,t,n){var i=Ex(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function G2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Kl(e){this._modeling=e}Kl.$inject=["modeling"],Kl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Rx(n),t.collapsed=!t.collapsed;var i=Cx(n,t.collapsed);return[t].concat(i)},Kl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Mx(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Rx(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=U({},t,Rx(n.children)))}),t}function Cx(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Cx(i.children,i.collapsed||t)))}),n}function Mx(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Mx(i.children,t)))}),n}function Xl(e){this._modeling=e}Xl.$inject=["modeling"],Xl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Ax(i,t),Px(n,t),t.host=n,t},Xl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Ax(n,t),Px(i,t,r),t};function Ax(e,t){return Zt(e&&e.attachers,t)}function Px(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function jd(){}jd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},jd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function At(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}At.$inject=["eventBus","elementFactory","commandStack"],At.prototype.getHandlers=function(){return{"shape.append":Gl,"shape.create":Ur,"shape.delete":As,"shape.move":Co,"shape.resize":ks,"shape.replace":yr,"shape.toggleCollapse":Kl,spaceTool:qr,"label.create":Cs,"connection.create":Vl,"connection.delete":Ms,"connection.move":$d,"connection.layout":ql,"connection.updateWaypoints":jd,"connection.reconnect":Ts,"elements.create":Bd,"elements.move":Yl,"elements.delete":Nd,"elements.distribute":Ul,"elements.align":zl,"element.updateAttachment":Xl}},At.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},At.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)},At.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},At.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)},At.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)},At.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},At.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},At.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},At.prototype.createElements=function(e,t,n,i,r){$e(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},At.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},At.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},At.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},At.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},At.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},At.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},At.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},At.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},At.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},At.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)},At.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},At.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)},At.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,U(i,{docking:"source"}))},At.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,U(i,{docking:"target"}))},At.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},At.prototype._create=function(e,t){return nA(t)?t:this._elementFactory.create(e,t)},At.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Os(e){this._elementRegistry=e}Os.$inject=["elementRegistry"],Os.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||V2(n,hc(i));return Tx(n,i),e.oldProperties=o,e.changed=r,r},Os.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Tx(n,t),i},Os.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?W2(e,t):[]};function V2(e,t){return Zn(t,function(n,i){return n[i]=e.get(i),n},{})}function Tx(e,t){z(t,function(n,i){e.set(i,n)})}function W2(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&pe(n).dataObjectRef===e})}var Ds="default",vr="id",kx="di",U2={width:0,height:0};function Ls(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ls.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ls.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=Z2(e.properties),s=e.oldProperties||q2(t,a);return Ox(a,o)&&(r.unclaim(o[vr]),i.updateId(t,a[vr]),r.claim(a[vr],o)),Ds in a&&(a[Ds]&&n.push(i.get(a[Ds].id)),o[Ds]&&n.push(i.get(o[Ds].id))),Dx(t,a),e.oldProperties=s,e.changed=n,n},Ls.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&pe(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,U2)}},Ls.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 Dx(t,i),Ox(n,r)&&(a.unclaim(n[vr]),o.updateId(t,i[vr]),a.claim(i[vr],r)),e.changed};function Ox(e,t){return vr in e&&e[vr]!==t[vr]}function q2(e,t){var n=hc(t),i=e.businessObject,r=ut(e);return Zn(n,function(o,a){return a!==kx?o[a]=i.get(a):o[a]=Y2(r,hc(t.di)),o},{})}function Y2(e,t){return Zn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Dx(e,t){var n=e.businessObject,i=ut(e);z(t,function(r,o){o!==kx?n.set(o,r):i&&K2(i,r)})}function K2(e,t){z(t,function(n,i){e.set(i,n)})}var X2=["default"];function Z2(e){var t=U({},e);return X2.forEach(function(n){n in e&&(t[n]=pe(t[n]))}),t}function Zl(e,t){this._canvas=e,this._modeling=t}Zl.$inject=["canvas","modeling"],Zl.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ut(r);return t.setRootElement(n),t.removeRootElement(r),tn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Zl.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ut(n);return t.setRootElement(r),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,tn(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Hd(e,t){this._modeling=e,this._spaceTool=t}Hd.$inject=["modeling","spaceTool"],Hd.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=_i(i),a=o===i,s=a?i:i.parent,c=Fr(s),l=xn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];vo(o,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:nt(v.children,function(w){return w!==i})});var f,d,g,h,y;r==="top"?(f=-120,d=i.y,g=d+10,h="n",y="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",y="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",y="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",y="x");var C=t.calculateAdjustments(p,y,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(C.movingShapes,C.resizingShapes,x,h,g);var m=l?{x:i.x+(a?wi:0),y:d-(r==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function zd(e){this._modeling=e}zd.$inject=["modeling"],zd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Fr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Is(e,t){this._modeling=e,this._spaceTool=t}Is.$inject=["modeling","spaceTool"],Is.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Is.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=WP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Is.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Be(e),r=Be(t),o=pv(r,i),a=_i(e),s=[],c=[];vo(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Bs="flowNodeRef",Gd="lanes";function Ql(){}Ql.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Be(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=_i(u);return r[p.id]||(r[p.id]=ml(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=_i(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(Gd),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Bs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Ql.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(Gd);n.remove.forEach(function(o){Zt(r,o),Zt(o.get(Bs),i)}),n.add.forEach(function(o){tn(r,o),tn(o.get(Bs),i)})}),[]},Ql.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Gd);n.add.forEach(function(o){Zt(r,o),Zt(o.get(Bs),i)}),n.remove.forEach(function(o){tn(r,o),tn(o.get(Bs),i)})}),[]};var Vd="categoryValueRef";function Ns(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ns.$inject=["bpmnFactory","elementRegistry"],Ns.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,m,v){if(m){var w=a.get(x);w||(w={},a.set(x,w)),!(v&&w.present)&&(!v&&w.past||(v?w.present={categoryValue:m,root:Wd(x)}:w.past={categoryValue:m}))}}function c(x){r.set(x,pe(x))}function l(){n.filter(function(x){return M(x,"bpmn:FlowElement")&&!Qe(x)&&x.parent}).forEach(c)}function u(x){var m=pe(x),v=m.get("categoryValueRef");return v||(v=av(i,m),o.push(Q2(x,v))),v}function p(x){return x.reduce(function(m,v){var w=Wd(v),S=m.get(w);return S||(S=[],m.set(w,S)),S.push(v),m},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return M(x,"bpmn:Group")&&!Qe(x)&&x.parent}).forEach(function(x){var m=pe(x).get("categoryValueRef");if(!m){var v=Wd(x),w=f.get(v)||[],S=aa(w,x),k=Object.keys(S).length>0;k&&(m=u(x))}s(x,m,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(x,m){return m.present&&x.add(m.present.categoryValue),m.past&&x.add(m.past.categoryValue),x},new Set),h=new Map,y=p(d);a.forEach(function(x,m){var v=x.present;if(v){var w=y.get(v.root)||[],S=aa(w,m);w.forEach(function(k){if(S[k.id]){var O=h.get(k);O||(O=new Set,h.set(k,O)),O.add(v.categoryValue)}})}});var C=d.reduce(function(x,m){var v=r.get(m),w=v.get(Vd),S=new Set(w),k=h.get(m)||new Set,O=Array.from(k).filter(function(T){return!S.has(T)}),N=w.filter(function(T){return g.has(T)&&!k.has(T)});return(O.length||N.length)&&x.push({businessObject:v,categoryValuesToAdd:O,categoryValuesToRemove:N}),x},[]);return{flowElements:C,groups:o}},Ns.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),J2(t.groups),tO(t.flowElements),[]},Ns.prototype.revert=function(e){var t=e.updates;return nO(t.flowElements),eO(t.groups),[]};function Q2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function J2(e){e.forEach(function(t){pe(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function eO(e){e.forEach(function(t){pe(t.groupShape).categoryValueRef=null})}function tO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vd);t.categoryValuesToRemove.forEach(function(r){Zt(i,r)}),t.categoryValuesToAdd.forEach(function(r){tn(i,r,!0)})})}function nO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vd);t.categoryValuesToAdd.forEach(function(r){Zt(i,r)}),t.categoryValuesToRemove.forEach(function(r){tn(i,r,!0)})})}function Wd(e){for(;e.parent;)e=e.parent;return e}function Jl(e){this._moddle=e}Jl.$inject=["moddle"],Jl.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),[]},Jl.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 iO={fill:void 0,stroke:void 0};function Ud(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Kn(t)){var n=rO(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Ud.$inject=["commandStack"],Ud.prototype.postExecute=function(e){var t=e.elements,n=e.colors||iO,i=this,r={};"fill"in n&&U(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&U(r,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(o){var a=Mt(o)?Di(r,["border-color"]):r,s=ut(o);if(oO(a),Qe(o)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!et(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function rO(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 oO(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var aO={width:0,height:0};function Lx(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return LA(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Qe(l)&&Nr(l)&&!nl(l)&&!Ix(p)){var f=7,d=gf(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=mi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Qe(u)&&!M(u,"bpmn:TextAnnotation"))){if(Qe(u)&&Ix(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=mi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,aO)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Lx.$inject=["modeling","textRenderer","bpmnFactory"];function Ix(e){return!e||!e.trim()}function Dn(e,t,n,i){At.call(this,e,t,n),this._bpmnRules=i}Ee(Dn,At),Dn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Dn.prototype.getHandlers=function(){var e=At.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Os,e["element.updateProperties"]=Ls,e["canvas.updateRoot"]=Zl,e["lane.add"]=Hd,e["lane.resize"]=Is,e["lane.split"]=zd,e["lane.updateRefs"]=Ql,e["group.updateRefs"]=Ns,e["id.updateClaim"]=Jl,e["element.setColor"]=Ud,e["element.updateLabel"]=Lx,e},Dn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Dn.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)},Dn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Dn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Dn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Dn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Dn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Dn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Dn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Dn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Dn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Dn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Dn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Dn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Bx(){}Bx.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Fe(t.source||e.source),t.connectionEnd||Fe(t.target||e.target)]};var eu=20,sO=5,tu=Math.round,Nx=20,cO={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function lO(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function uO(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function $x(e,t,n){var i=Tn(t,e,sO),r=n.split(":")[0],o=tu((t.x-e.x)/2+e.x),a=tu((t.y-e.y)/2+e.y),s,c,l=uO(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=lO(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+eu*(/l/.test(r)?-1:1),y:f?a+eu:a}):(f=o===e.x,s={x:f?o+eu:o,y:e.y+eu*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:qd(e,s,c).concat(s),directions:c,turnNextDirections:f}}function pO(e,t,n){return $x(e,t,n)}function fO(e,t,n){var i=$x(t,e,Fx(n));return{waypoints:i.waypoints.slice().reverse(),directions:Fx(i.directions),turnNextDirections:i.turnNextDirections}}function dO(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=qd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Fx(e){return e.split(":").reverse().join(":")}function hO(e,t,n){var i=tu((t.x-e.x)/2+e.x),r=tu((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 qd(e,t,n){if(n=n||"h:h",!EO(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Hx(n)){var i=pO(e,t,n),r=fO(e,t,n),o=dO(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return hO(e,t,n)}function mO(e,t,n){var i=qd(e,t,n);return i.unshift(e),i.push(t),Gx(i)}function gO(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=u1(o,"straight")[0]||"h:h",s=cO[a]||0,c=Tn(e,t,s),l=_O(c,a);n=n||Fe(e),i=i||Fe(t);var u=l.split(":"),p=zx(n,e,u[0],SO(c)),f=zx(i,t,u[1],c);return mO(p,f,l)}function yO(e,t,n,i,r,o){$e(n)&&(r=n,o=i,n=Fe(e),i=Fe(t)),o=U({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&bO(e,t,n,i,o),c||(c=o.connectionEnd&&wO(t,e,i,r),c)||(c=o.connectionStart&&xO(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:gO(e,t,n,i,o)}function vO(e,t,n){return e>=t&&e<=n}function jx(e,t,n){var i={x:"width",y:"height"};return vO(t[e],n[e],n[e]+n[i[e]])}function bO(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"?jx(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:jx(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 xO(e,t,n,i){return Yd(e,t,n,i)}function wO(e,t,n,i){var r=i.slice().reverse();return r=Yd(e,t,n,r),r?r.reverse():null}function Yd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!Tt(u,function(p,f){var d=u[f-1];return d&&ss(p,d)<3})}function o(u,p,f){var d=lr(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(fy(u[d],p,Nx)||fy(u[d],f,Nx))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Yd(e,t,n,l)),c&&lr(c)?null:c}function _O(e,t){if(Hx(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 EO(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Hx(e){return e&&/t|r|b|l/.test(e)}function SO(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 zx(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 Gx(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return pf(r,o,n,0)||t.push(n),t},[])}var RO=-10,CO=40,MO={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},AO={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},Kd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},$s={top:"t",right:"r",bottom:"b",left:"l"};function nu(e){this._elementRegistry=e}Ee(nu,Bx),nu.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,l;if(o||(o=Vx(r&&r[0],n)),a||(a=Vx(r&&r[r.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&r&&!Wx(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=nv(n,s)?MO:AO;return M(e,"bpmn:MessageFlow")?c=TO(n,i,u):(M(e,"bpmn:SequenceFlow")||Wx(n,i))&&(n===i?c={preferredLayouts:BO(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:NO(n,i,a,u)}:Fs(n)||Fs(i)?c={preferredLayouts:u.subProcess,preserveDocking:OO(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=U(c,t),l=Gx(yO(n,i,o,a,r,c))),l||[o,a]};function PO(e){var t=e.host;return Tn(Fe(e),t,RO)}function TO(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:kO(e,t)}}function kO(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Fs(t)?"source":Fs(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function OO(e){return Fs(e)?"target":"source"}function Vx(e,t){return e?e.original||e:Fe(t)}function Wx(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Fs(e){return M(e,"bpmn:SubProcess")&&at(e)}function Mo(e,t){return e===t}function DO(e,t){return t.indexOf(e)!==-1}function Ra(e){var t=/right|left/.exec(e);return t&&t[0]}function Ca(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ux(e,t){return Kd[e]===t}function LO(e,t){var n=Ra(e),i=Kd[n];return t.indexOf(i)!==-1}function IO(e,t){var n=Ca(e),i=Kd[n];return t.indexOf(i)!==-1}function qx(e){return e==="right"||e==="left"}function BO(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 NO(e,t,n,i){var r=Fe(e),o=Fe(t),a=PO(e),s,c,l=Mo(e.host,t),u=DO(a,["top","right","bottom","left"]),p=Tn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?$O(a,u,e,t,n,i):(s=FO(a,p,u,i.isHorizontal),c=jO(a,p,u,i.isHorizontal),[s+":"+c])}function $O(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ca(e):Ra(e),s=$s[a],c;return t?qx(e)?c=Yx("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Yx("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Yx(e,t,n,i){var r=CO;return!(Xd(e,i,n,r)||Xd(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Xd(e,i,Fe(t),r))}function Xd(e,t,n,i){return Math.abs(t[e]-n[e])<i}function FO(e,t,n,i){if(n)return $s[e];var r=Ca(e),o=Ra(e),a=Ca(t),s=Ra(t);if(i){if(Mo(r,a)||Ux(o,s))return $s[r]}else if(Mo(o,s)||Ux(r,a))return $s[o];return $s[i?o:r]}function jO(e,t,n,i){if(n)return qx(e)?LO(e,t)||Mo(e,t)?"h":"v":IO(e,t)||Mo(e,t)?"v":"h";var r=Ca(e),o=Ra(e),a=Ca(t),s=Ra(t);return a&&!s?"v":s&&!a?"h":i?Mo(r,a)?"h":"v":Mo(o,s)?"v":"h"}nu.$inject=["elementRegistry"];function Kx(e){return U({original:e.point.original||e.point},e.actual)}function Yr(e,t){this._elementRegistry=e,this._graphicsFactory=t}Yr.$inject=["elementRegistry","graphicsFactory"],Yr.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(Kx(i)),o.push(Kx(r)),o},Yr.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}},Yr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return cs(i,r,n)},Yr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Yr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Yr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Zd={__init__:["modeling","bpmnUpdater"],__depends__:[ok,wk,Ek,Sk,sx,R2,M2,D2,Si,Ld,dx],bpmnFactory:["type",Ci],bpmnUpdater:["type",ii],elementFactory:["type",Wr],modeling:["type",Dn],layouter:["type",nu],connectionDocking:["type",Yr]};var HO=10,Xx=50,zO=250;function Qd(e,t,n,i){for(var r;r=GO(e,n,t);)n=i(t,n,r);return n}function Jd(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,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function GO(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=WO(e);return Tt(r,function(o){if(o===n)return!1;var a=Tn(o,i,HO);return a==="intersect"})}function VO(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Xx,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||zO,c=t.reference||"start";o||(o=YO);function l(g,h){return r==="n"?c==="start"?Be(g).top-Be(h).bottom:c==="center"?Be(g).top-Fe(h).y:Be(g).top-Be(h).top:r==="w"?c==="start"?Be(g).left-Be(h).right:c==="center"?Be(g).left-Fe(h).x:Be(g).left-Be(h).left:r==="s"?c==="start"?Be(h).top-Be(g).bottom:c==="center"?Fe(h).y-Be(g).bottom:Be(h).bottom-Be(g).bottom:c==="start"?Be(h).left-Be(g).right:c==="center"?Fe(h).x-Be(g).right:Be(h).right-Be(g).right}var u=e.incoming.filter(o).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Zn(f,function(g,h){var y=h.distance,C=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*C,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function WO(e){var t=eh(e);return e.host&&(t=t.concat(eh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(eh(i))},[]))),t}function eh(e){return qO(e).concat(UO(e))}function UO(e){return e.incoming.map(function(t){return t.source})}function qO(e){return e.outgoing.map(function(t){return t.target})}function YO(){return!0}var KO=100;function Zx(e,t,n){e.on("autoPlace",KO,function(i){var r=i.shape,o=i.source;return XO(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}}Zx.$inject=["eventBus","modeling","canvas"];function XO(e,t,n){n||(n={});var i=n.defaultDistance||Xx,r=Fe(e),o=Be(e);return{x:o.right+i+t.width/2,y:r.y}}function Qx(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Qx.$inject=["eventBus","selection"];const ZO={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Zx],autoPlaceSelectionBehavior:["type",Qx]};function Jx(e,t,n){var i=nv(e,n);if(M(t,"bpmn:TextAnnotation"))return JO(e,t,i);if(et(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return eD(e,t,i);if(M(t,"bpmn:FlowNode"))return QO(e,t,i)}function QO(e,t,n){var i=Be(e),r=Fe(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=VO(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=Tn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+ew(l,c,o)}:{x:r.x+ew(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Qd(e,t,u,Jd(f))}function ew(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function JO(e,t,n){var i=Be(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};Mt(e)&&(r=Fe(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 Qd(e,t,r,Jd(a))}function eD(e,t,n){var i=Be(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 Qd(e,t,r,Jd(a))}function tw(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Jx(r,i,t)})}tw.$inject=["eventBus","elementRegistry"];const iu={__depends__:[ZO],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",tw]},nw=[ev,hs,Zd,iu,mp];function tD(e={}){Dm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new la({container:t,moddleExtensions:e.moddleExtensions??_c,additionalModules:[...nw,...e.additionalModules??[]]})}const iw={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},nD={이:["이","가"],을:["을","를"],와:["과","와"]};function iD(e,t){const[n,i]=nD[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const rD={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},oD="요소";function th(e){return(e&&rD[e.type])??oD}const rw=20;function aD(e){const t=e.replace(/\s+/g," ").trim();return t.length>rw?`${t.slice(0,rw)}…`:t}function ru(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:aD(r.name),a=o===void 0?i+th(r):o,s=o===void 0?a:`「${o}」`;return n?s+iD(a,n).slice(a.length):s}function sD(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&th(o)===th(a);return[ru(e,t,i),ru(e,n,r,s?"다른 ":"")]}function cD(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function lD(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const ou={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function uD(e,t){const n=(r,o)=>ru(t,r,o),i=(r,o,a,s)=>sD(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${ou[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${ou[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${ou[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${ou[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function pD(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${ru(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const ow="기타",nh={error:0,warning:1,info:2};function aw(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${pt(i)}`,source:"geometry",code:i.kind,severity:cD(i),targetRefs:lD(i),category:iw[i.kind]??ow,message:uD(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:iw[i.ruleId]??ow,message:pD(i,t)});return n}function sw(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ma(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function ih(e,t){if(t===void 0||e.length===0)return!1;const n=Ma(e[0],t);return e.some(i=>Ma(i,t)!==n)}function cw(e,t){const n=ih(e,t);return e.slice().sort((i,r)=>(n?Number(Ma(r,t))-Number(Ma(i,t)):0)||nh[i.severity]-nh[r.severity])}const lw="i18n-untranslated",uw="i18n-review-requested",pw=[["untranslated",lw],["reviewRequested",uw]];class rh{constructor(t,n,i,r,o,a,s,c){gi(this,"config");gi(this,"displayLocale");this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=r.drawShape.bind(r);r.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=o.activate.bind(o);o.activate=f=>this.withDisplayText(f,()=>u(f));const p=o.update.bind(o);o.update=(f,d,g,h)=>{const y=this.resolve(f);if(!y||y.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(gc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(gc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,r,o;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((r=n==null?void 0:n.get)==null?void 0:r.call(n,"xml:lang"))??((o=n==null?void 0:n.$attrs)==null?void 0:o["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=uo(n);if(!i)return;const r=this.displayLocale,o=i.target[i.key]??"",a=qo(n).filter(f=>In(f)),s=f=>f.body??"",c=a.find(f=>In(f)===r&&s(f)),l=Cr(n).some(f=>f.locale===r)?"reviewRequested":"ok";if(!o)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===o).map(In);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(r)?{text:o,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:o,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var o;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let r=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((o=this.resolve(a))==null?void 0:o.status)===n&&r++}finally{this.displayLocale=i}return r}withDisplayText(t,n,i){var f;if(!this.config)return n();const r=this.resolve(t),o=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(o)for(const[d,g]of pw)o.toggle(g,(r==null?void 0:r.status)===d);if(!r||r.native)return n();const{target:a,key:s}=uo((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===r.text)return n();a[s]=r.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,r.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:r}=t,o=this.textRenderer.getExternalLabelBounds(t,n);return t.width=o.width,t.height=o.height,{dx:(i-o.width)/2,restore:()=>(t.width=i,t.height=r)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,r]of pw)i.classList.remove(r);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}}}gi(rh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const fw={__depends__:[mp],__init__:["i18nDisplay"],i18nDisplay:["type",rh]};var fD=new Ea("ov"),dD=500;function En(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=fD,this._overlayDefaults=U({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=hD(n.getContainer()),this._init()}En.$inject=["config.overlays","eventBus","canvas","elementRegistry"],En.prototype.get=function(e){if(Kn(e)&&(e={id:e}),Kn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?nt(t.overlays,Wo({type:e.type})):t.overlays.slice():[]}else return e.type?nt(this._overlays,Wo({type:e.type})):e.id?this._overlays[e.id]:null},En.prototype.add=function(e,t,n){if(gn(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=U({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},En.prototype.remove=function(e){var t=this.get(e)||[];$e(t)||(t=[t]);var n=this;z(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Ui(i.html),Ui(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)}})},En.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},En.prototype.show=function(){au(this._overlayRoot)},En.prototype.hide=function(){au(this._overlayRoot,!1)},En.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Hc(this._overlayRoot)},En.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=rn(t);i=o.x,r=o.y}dw(n,i,r),Nn(e.html,"data-container-id",t.id)},En.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=rn(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=rn(i).height:s=i.height,o=t.bottom*-1+s}dw(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},En.prototype._createOverlayContainer=function(e){var t=Bt('<div class="djs-overlays" />');Hn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},En.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";hw(this._overlayRoot,n)},En.prototype._getOverlayContainer=function(e,t){var n=Tt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},En.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)),Kn(i)&&(i=Bt(i)),o=this._getOverlayContainer(n),r=Bt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Hn(r,{position:"absolute"}),r.appendChild(i),e.type&&Ht(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();au(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())},En.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&&(un(r)&&r>t.scale||un(o)&&o<t.scale))&&(c=!1),au(a,c),this._updateOverlayScale(e,t)},En.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),un(i)&&t.scale<i&&(a=(1/t.scale||1)*i),un(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),un(a)&&(s="scale("+a+","+a+")"),hw(o,s)},En.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},En.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});z(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Ui(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",dD,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(z(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Ht(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function hD(e){var t=Bt('<div class="djs-overlay-container" />');return Hn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function dw(e,t,n){Hn(e,{left:t+"px",top:n+"px"})}function au(e,t){e.style.display=t===!1?"none":""}function hw(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const su={__init__:["overlays"],overlays:["type",En]};function oh(e,t){t.invoke(le,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)})}Ee(oh,le),oh.$inject=["canvas","injector"];const mD={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",oh]};function js(e){return CSS.escape(e)}var gD={"&":"&","<":"<",">":">",'"':""","'":"'"};function mw(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return gD[t]})}var yD="bjs-breadcrumbs-shown";function gw(e,t,n){var i=Bt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ht(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=pe(l),p=Tt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=vD(c));var l=a.flatMap(function(p){var f=n.findRoot(Zi(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(y){var C=pe(y);return C&&C.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=mw(p.name||p.id),h=Bt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;o.toggle(yD,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}gw.$inject=["eventBus","elementRegistry","canvas"];function vD(e){for(var t=pe(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function yw(e,t){var n=null,i=new bD;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,!(!M(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}yw.$inject=["eventBus","canvas"];function bD(){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 vw={x:180,y:160};function Ao(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Ao.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)})}},Ao.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;M(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),wD(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},Ao.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=xD(e),i={x:n.x-vw.x,y:n.y-vw.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)})},Ao.prototype._moveToDiPlane=function(e,t){var n=bw(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Ao.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},Ao.$inject=["eventBus","moddle"];function bw(e){return M(e,"bpmndi:BPMNDiagram")?e:bw(e.$parent)}function xD(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=Be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Xc(t)}function wD(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||et(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var cu=250,_D='<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>',ED="bjs-drilldown-empty";function Kr(e,t,n,i,r){le.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",cu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",cu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],cu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],cu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Ee(Kr,le),Kr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Kr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(Zi(e))},Kr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=pe(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ht(i.html).toggle(ED,!r)}},Kr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=pe(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Bt('<button type="button" class="bjs-drilldown">'+_D+"</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(Zi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Kr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Kr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const SD={__depends__:[su,Ld,mD],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",gw],drilldownCentering:["type",yw],drilldownOverlayBehavior:["type",Kr],subprocessCompatibility:["type",Ao]};function Xr(e){Gt.call(this,e)}Ee(Xr,Gt),Xr.prototype._modules=[ev,SD,su,Si,hs],Xr.prototype._moddleExtensions={};var lu="keyboard.keydown",RD="keyboard.keyup",CD=1e3,xw="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 zn(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(xw));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}zn.$inject=["config.keyboard","eventBus"],zn.prototype._keydownHandler=function(e){this._keyHandler(e,lu)},zn.prototype._keyupHandler=function(e){this._keyHandler(e,RD)},zn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||lu,i),n&&e.preventDefault()}},zn.prototype._isEventIgnored=function(e){return!1},zn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(xw)),this.unbind(),e=this._node=this._target,ze.bind(e,"keydown",this._keydownHandler),ze.bind(e,"keyup",this._keyupHandler),this._fire("bind")},zn.prototype.getBinding=function(){return this._node},zn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ze.unbind(e,"keydown",this._keydownHandler),ze.unbind(e,"keyup",this._keyupHandler)),this._node=null},zn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},zn.prototype.addListener=function(e,t,n){yn(e)&&(n=t,t=e,e=CD),this._eventBus.on(n||lu,e,t)},zn.prototype.removeListener=function(e,t){this._eventBus.off(t||lu,e)},zn.prototype.hasModifier=Nk,zn.prototype.isCmd=ti,zn.prototype.isShift=Ed,zn.prototype.isKey=dn;var MD=500;function Aa(e,t){var n=this;e.on("editorActions.init",MD,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Aa.$inject=["eventBus","keyboard"],Aa.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(zk(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(Gk(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if($k(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(Fk(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(jk(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(Hk(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(dn(["+","Add","="],r)&&ti(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(dn(["-","Subtract"],r)&&ti(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(dn("0",r)&&ti(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(dn(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const ah={__init__:["keyboard","keyboardBindings"],keyboard:["type",zn],keyboardBindings:["type",Aa]};var AD={moveSpeed:50,moveSpeedAccelerated:200};function ww(e,t,n){var i=this;this._config=U({},AD,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,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}ww.$inject=["config.keyboardMove","keyboard","canvas"];const _w={__depends__:[ah],__init__:["keyboardMove"],keyboardMove:["type",ww]};var PD=15;function Ew(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,l=n.button,u=_o(s),p=Ii(u,c);if(!n.dragging&&TD(p)>PD&&(n.dragging=!0,l===0&&jb(e),Ll("grab")),n.dragging){var f=n.last||n.start;p=Ii(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function o(s){ze.unbind(document,"mousemove",r),ze.unbind(document,"mouseup",o),n=null,Fb()}function a(s){if(!go(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:_o(s)},ze.bind(document,"mousemove",r),ze.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Ew.$inject=["eventBus","canvas"];function TD(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Sw={__init__:["moveCanvas"],moveCanvas:["type",Ew]};function Rw(e,t){var n=xf(e.min),i=xf(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function kD(e,t){return Math.max(e.min,Math.min(e.max,t))}var OD=Math.sign||function(e){return e>=0?1:-1},sh={min:.2,max:4},Cw=10,DD=.1,LD=.75;function er(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Un(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||LD;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}er.$inject=["config.zoomScroll","eventBus","canvas"],er.prototype.scroll=function(t){this._canvas.scroll(t)},er.prototype.reset=function(){this._canvas.zoom("fit-viewport")},er.prototype.zoom=function(t,n){var i=Rw(sh,Cw*2);this._totalDelta+=t,Math.abs(this._totalDelta)>DD&&(this._zoom(t,n,i),this._totalDelta=0)},er.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||qv()&&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))*OD(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)}},er.prototype.stepZoom=function(t,n){var i=Rw(sh,Cw);this._zoom(t,n,i)},er.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=xf(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(kD(sh,s),t)},er.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&ze[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},er.prototype._init=function(e){this.toggle(e)};const Mw={__init__:["zoomScroll"],zoomScroll:["type",er]};function Hs(e){Xr.call(this,e)}Ee(Hs,Xr),Hs.prototype._navigationModules=[_w,Sw,Mw],Hs.prototype._modules=[].concat(Xr.prototype._modules,Hs.prototype._navigationModules);function ch(e){return e&&e[e.length-1]}function Aw(e){return e.y}function Pw(e){return e.x}var ID={left:Pw,center:Pw,right:function(e){return e.x+e.width},top:Aw,middle:Aw,bottom:function(e){return e.y+e.height}};function Pa(e,t){this._modeling=e,this._rules=t}Pa.$inject=["modeling","rules"],Pa.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}},Pa.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Pa.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;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"]))u=ch(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(z(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=ji(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=ch(c).center,o;l=t[0],t=ji(t,function(f){return f[i]+f[r]}),u=ch(t),o[e]=p(l,u)}return o},Pa.prototype.trigger=function(e,t){var n=this._modeling,i,r=nt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),$e(i)&&(r=i),!(r.length<2||!i)){var o=ID[t],a=ji(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const BD={__init__:["alignElements"],alignElements:["type",Pa]},ND=new Ea;function Ta(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ta.$inject=["eventBus"],Ta.prototype.schedule=function(e,t=ND.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ta.prototype._schedule=function(e,t){const n=$D();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}},Ta.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ta.prototype._cancel=function(e){clearTimeout(e.executionId)};function $D(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const FD={scheduler:["type",Ta]};var jD="djs-element-hidden",uu=".entry",HD=1e3,Tw=8,zD=300;function an(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}an.$inject=["canvas","elementRegistry","eventBus","scheduler"],an.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=$e(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=$e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},an.prototype._createContainer=function(){var e=Bt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},an.prototype.registerProvider=function(e,t){t||(t=e,e=HD),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},an.prototype.getEntries=function(e){var t=this._getProviders(),n=$e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(r){if(yn(r[n])){var o=r[n](e);yn(o)?i=o(i):z(o,function(a,s){i[s]=a})}}),i},an.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Nn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},zD);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},an.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(yn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},an.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))}},an.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},an.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(r,o){var a=r.group||"default",s=Bt(r.html||'<div class="entry" draggable="true"></div>'),c;Nn(s,"data-action",o),c=Rt("[data-group="+js(a)+"]",n),c||(c=Bt('<div class="group"></div>'),Nn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&GD(s,r.className),r.title&&Nn(s,"title",r.title),r.imageUrl&&(i=Bt("<img>"),Nn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ht(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},an.prototype._createHtml=function(e){var t=this,n=Bt('<div class="djs-context-pad"></div>');return Qn.bind(n,uu,"click",function(i){t.trigger("click",i)}),Qn.bind(n,uu,"dragstart",function(i){t.trigger("dragstart",i)}),Qn.bind(n,uu,"mouseover",function(i){t.trigger("mouseover",i)}),Qn.bind(n,uu,"mouseout",function(i){t.trigger("mouseout",i)}),ze.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},an.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()&&WD(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},an.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},an.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return $e(e)!==$e(n)?!1:$e(e)?e.length===n.length&&lo(e,function(i){return n.includes(i)}):n===e},an.prototype.isShown=function(){return this.isOpen()&&Ht(this._current.html).has("open")},an.prototype.show=function(){this.isOpen()&&(Ht(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},an.prototype.hide=function(){this.isOpen()&&(Ht(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},an.prototype._getPosition=function(e){if(!$e(e)&&Mt(e)){var t=this._canvas.viewbox(),n=VD(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Tw*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Tw*this._canvas.zoom(),top:s.top-a.top}},an.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")},an.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=$e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,jD)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},an.prototype._getTargetBounds=function(e){var t=this,n=$e(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function GD(e,t){var n=Ht(e);t=$e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function VD(e){return e.waypoints[e.waypoints.length-1]}function WD(e,t){return e=$e(e)?e:[e],t=$e(t)?t:[t],e.length===t.length&&lo(e,function(n){return t.includes(n)})}const kw={__depends__:[Dl,FD,su],contextPad:["type",an]};var pu,Wt,Ow,Zr,Dw,Lw,Iw,lh,fu,zs,Bw,uh,ph,fh,du={},hu=[],UD=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,mu=Array.isArray;function br(e,t){for(var n in t)e[n]=t[n];return e}function dh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Nw(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?pu.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 gu(e,a,i,r,null)}function gu(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??++Ow,__i:-1,__u:0};return r==null&&Wt.vnode!=null&&Wt.vnode(o),o}function yu(e){return e.children}function vu(e,t){this.props=e,this.context=t}function Po(e,t){if(t==null)return e.__?Po(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"?Po(e):null}function qD(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=br({},t);o.__v=t.__v+1,Wt.vnode&&Wt.vnode(o),hh(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Po(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Ww(i,o,r),t.__e=t.__=null,o.__e!=n&&$w(o)}}function $w(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}),$w(e)}function Fw(e){(!e.__d&&(e.__d=!0)&&Zr.push(e)&&!bu.__r++||Dw!=Wt.debounceRendering)&&((Dw=Wt.debounceRendering)||Lw)(bu)}function bu(){try{for(var e,t=1;Zr.length;)Zr.length>t&&Zr.sort(Iw),e=Zr.shift(),t=Zr.length,qD(e)}finally{Zr.length=bu.__r=0}}function jw(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,g,h,y,C=i&&i.__k||hu,x=t.length;for(c=YD(n,t,C,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&C[d.__i]||du,d.__i=p,y=hh(e,d,f,r,o,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&mh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=Hw(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function YD(e,t,n,i,r){var o,a,s,c,l,u=n.length,p=u,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]=gu(null,a,null,null,null):mu(a)?a=e.__k[o]=gu(yu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=gu(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,(l=a.__i=KD(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?f--:r<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Po(s)),qw(s,s));return i}function Hw(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=Hw(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Po(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function KD(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function zw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||UD.test(t)?n:n+"px"}function xu(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||zw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||zw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Bw,"$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[zs]=i[zs]:(n[zs]=uh,e.addEventListener(t,o?fh:ph,o)):e.removeEventListener(t,o?fh:ph,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 Gw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[fu]==null)t[fu]=uh++;else if(t[fu]<n[zs])return;return n(Wt.event?Wt.event(t):t)}}}function hh(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,g,h,y,C,x,m,v,w,S,k,O,N,T=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof T=="function"){p=a.length;try{if(x=t.props,m=T.prototype&&T.prototype.render,v=(u=T.contextType)&&i[u.__c],w=u?v?v.props.value:u.__:i,n.__c?C=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new T(x,w):(t.__c=f=new vu(x,w),f.constructor=T,f.render=ZD),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&T.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=br({},f.__s)),br(f.__s,T.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)m&&T.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&T.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,w)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),hu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Po(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,w),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=w,f.props=x,f.__P=e,f.__e=!1,S=Wt.__r,k=0,m)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),hu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(i=br(br({},i),f.getChildContext())),m&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),O=u!=null&&u.type===yu&&u.key==null?Uw(u.props.children):u,s=jw(e,mu(O)?O:[O],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),C&&(f.__E=f.__=null)}catch(D){if(a.length=p,t.__v=null,c||o!=null){if(D.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--;)dh(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||Vw(t),Wt.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=XD(n.__e,t,n,i,r,o,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function Vw(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Vw))}function Ww(e,t,n){for(var i=0;i<n.length;i++)mh(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Wt.__e(o,r.__v)}})}function Uw(e){return typeof e!="object"||e==null||e.__b>0?e:mu(e)?e.map(Uw):e.constructor!==void 0?null:br({},e)}function XD(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,g,h,y=n.props||du,C=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(C);e=document.createElementNS(r,x,C.is&&C),s&&(Wt.__m&&Wt.__m(t,o),s=!1),o=null}if(x==null)y===C||s&&e.data==C||(e.data=C);else{if(o=x=="textarea"&&C.defaultValue!=null?null:o&&pu.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in C||l=="value"&&"defaultValue"in C||l=="checked"&&"defaultChecked"in C||xu(e,l,null,d,r);for(l in C)d=C[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||xu(e,l,d,y[l],r);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),jw(t.type=="template"?e.content:e,mu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Po(n,0),s,c),o!=null)for(l=o.length;l--;)dh(o[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=y[l])&&xu(e,l,g,y[l],r),l="checked",h!=null&&h!=e[l]&&xu(e,l,h,y[l],r))}return e}function mh(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){Wt.__e(r,n)}}function qw(e,t,n){var i,r;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||mh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Wt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&qw(i[r],t,n||typeof e.type!="function");n||dh(e.__e),e.__c=e.__=e.__e=void 0}function ZD(e,t,n){return this.constructor(e,n)}function Yw(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],hh(t,e=t.__k=Nw(yu,null,[e]),r||du,du,t.namespaceURI,r?null:t.firstChild?pu.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Ww(o,e,a),e.props.children=null}pu=hu.slice,Wt={__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}},Ow=0,vu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=br({},this.state),typeof e=="function"&&(e=e(br({},n),this.props)),e&&br(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fw(this))},vu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Fw(this))},vu.prototype.render=yu,Zr=[],Lw=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Iw=function(e,t){return e.__v.__b-t.__v.__b},bu.__r=0,lh=Math.random().toString(8),fu="__d"+lh,zs="__a"+lh,Bw=/(PointerCapture)$|Capture$/i,uh=0,ph=Gw(!1),fh=Gw(!0);var Kw=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,Kw(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Xw=new Map;function QD(e){var t=Xw.get(this);return t||(t=new Map,Xw.set(this,t)),(t=Kw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=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=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),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===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Pt=
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&Br.prototype.clear.call(this)},Gt.prototype.destroy=function(){Br.prototype.destroy.call(this),Ui(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=q(Hi(n,["additionalModules"]),{canvas:q({},n.canvas,{container:e}),modules:a});Br.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=Bt('<div class="bjs-container"></div>');return Hn(t,{width:qy(e.width),height:qy(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=q({},this._moddleExtensions,e.moddleExtensions);return new km(t)},Gt.prototype._modules=[];function il(e,t){return e.warnings=t,e}function RA(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 CA={width:"100%",height:"100%",position:"relative"};function qy(e){return e+(ze(e)?"px":"")}function MA(e,t){return t&&Tt(e.diagrams,function(n){return n.id===t})||null}function AA(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Gy+"</a>",i=Bt(n);Hn(Rt("svg",i),Vy),Hn(i,Wy,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ge.bind(i,"click",function(r){SA(),r.preventDefault()})}function la(e){Gt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Re(la,Gt),la.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Wi([32,36,1]),t},la.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 at(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||ut(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!de(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=ut(e).isHorizontal;return t===void 0?!0:t}}function PA(e){return e&&de(e).isInterrupting!==!1}function Fn(e){return e&&!!de(e).triggeredByEvent}function ua(e,t){var n=de(e).eventDefinitions;return Rr(n,function(i){return M(i,t)})}function TA(e){return ua(e,"bpmn:ErrorEventDefinition")}function kA(e){return ua(e,"bpmn:EscalationEventDefinition")}function OA(e){return ua(e,"bpmn:CompensateEventDefinition")}var xo={width:90,height:20},Yy=15;function Nr(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function rl(e){return Je(e.label)}function DA(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=LA(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-=Yy:a+=Yy,{x:a,y:s}}function LA(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 yf(e){return e.waypoints?DA(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+xo.height/2}:{x:e.x+e.width/2,y:e.y+e.height+xo.height/2}}function IA(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(xo.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=yf(t),i=xo),q({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Ky(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function BA(e){var t=e.categoryValueRef;return t&&t.value||""}function mi(e){var t=e.businessObject,n=Ky(t);if(n)return n==="categoryValueRef"?BA(t):t[n]||""}function NA(e,t){var n=e.businessObject,i=Ky(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function $A(e){return Je(e)&&Nr(e.labelTarget)}var pa=7;function Xy(e){let t=[];return H(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),H(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ps(e){const t=new Map;return H(uf(e),n=>{H(Xy(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 vf="hsl(225, 10%, 15%)",FA="white";function Xi(e,t){return Rr(e.eventDefinitions,function(n){return n.$type===t})}function jA(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function HA(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function ot(e,t,n){var i=ut(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||FA}function Ee(e,t,n){var i=ut(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||vf}function fs(e,t,n,i){var r=ut(e),o=r.get("label");return i||o&&o.get("color:color")||t||Ee(e,n)}function Zy(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 yo(r)}function bf(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 yo(a)}function zA(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 yo(s)}function GA(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 yo(o)}function ds(e,t={}){return{width:xi(e,t),height:ei(e,t)}}function xi(e,t={}){return Xn(t,"width")?t.width:e.width}function ei(e,t={}){return Xn(t,"height")?t.height:e.height}var VA=new Wi,WA=10,ol=3,UA=1.5,al=10,qA=4,fa=.95,YA=1,KA=.25;function wo(e,t,n,i,r,o,a){cr.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:vf,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:vf,strokeWidth:2})}function f(B,R){var{ref:_={x:0,y:0},scale:G=1,element:U,parentGfx:ne=r._svg}=R,Me=Oe("marker",{id:B,viewBox:"0 0 20 20",refX:_.x,refY:_.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ve(Me,U);var Xe=Rt(":scope > defs",ne);Xe||(Xe=Oe("defs"),Ve(ne,Xe)),Ve(Xe,Me)}function d(B,R,_,G){var U=VA.nextPrefixed("marker-");return g(B,U,R,_,G),"url(#"+U+")"}function g(B,R,_,G,U){if(_==="sequenceflow-end"){var ne=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});f(R,{element:ne,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(_==="messageflow-start"){var Me=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Me,ref:{x:6,y:6},parentGfx:B})}if(_==="messageflow-end"){var Xe=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});f(R,{element:Xe,ref:{x:8.5,y:5},parentGfx:B})}if(_==="association-start"){var mt=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(_==="association-end"){var qt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(R,{element:qt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(_==="conditional-flow-marker"){var Et=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});f(R,{element:Et,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(_==="conditional-default-flow-marker"){var mn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});f(R,{element:mn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,R,_,G,U={}){gn(G)&&(U=G,G=0),G=G||0,U=u(U);var ne=R/2,Me=_/2,Xe=Oe("circle",{cx:ne,cy:Me,r:Math.round((R+_)/4-G),...U});return Ve(B,Xe),Xe}function y(B,R,_,G,U,ne){gn(U)&&(ne=U,U=0),U=U||0,ne=u(ne);var Me=Oe("rect",{x:U,y:U,width:R-U*2,height:_-U*2,rx:G,ry:G,...ne});return Ve(B,Me),Me}function C(B,R,_,G){var U=R/2,ne=_/2,Me=[{x:U,y:0},{x:R,y:ne},{x:U,y:_},{x:0,y:ne}],Xe=Me.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var mt=Oe("polygon",{...G,points:Xe});return Ve(B,mt),mt}function x(B,R,_,G){_=p(_);var U=rs(R,_,G);return Ve(B,U),U}function m(B,R,_){return x(B,R,_,5)}function v(B,R,_){_=p(_);var G=Oe("path",{..._,d:R});return Ve(B,G),G}function w(B,R,_,G){return v(R,_,q({"data-marker":B},G))}function E(B){return Te[B]}function P(B){return function(R,_,G){return E(B)(R,_,G)}}var k={"bpmn:MessageEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.235,my:.315}}),ne=G?Ee(R,c,_.stroke):ot(R,s,_.fill),Me=G?ot(R,s,_.fill):Ee(R,c,_.stroke),Xe=v(B,U,{fill:ne,stroke:Me,strokeWidth:1});return Xe},"bpmn:TimerEventDefinition":function(B,R,_={}){var G=_.width||R.width,U=_.height||R.height,ne=_.width?1:2,Me=h(B,G,U,.2*U,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:ne}),Xe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});v(B,Xe,{stroke:Ee(R,c,_.stroke),strokeWidth:ne});for(var mt=0;mt<12;mt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),Et=G/2,mn=U/2;v(B,qt,{strokeWidth:1,stroke:Ee(R,c,_.stroke),transform:"rotate("+mt*30+","+mn+","+Et+")"})}return Me},"bpmn:EscalationEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.2}}),ne=G?Ee(R,c,_.stroke):ot(R,s,_.fill);return v(B,U,{fill:ne,stroke:Ee(R,c,_.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,R,_={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.222}});return v(B,G,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.57,my:.263}}),ne=G?Ee(R,c,_.stroke):ot(R,s,_.fill);return v(B,U,{fill:ne,stroke:Ee(R,c,_.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.2,my:.722}}),ne=G?Ee(R,c,_.stroke):ot(R,s,_.fill);return v(B,U,{fill:ne,stroke:Ee(R,c,_.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.638,my:-.055}}),ne=G?Ee(R,c,_.stroke):"none",Me=v(B,U,{fill:ne,stroke:Ee(R,c,_.stroke),strokeWidth:1});return Hy(Me,45),Me},"bpmn:CompensateEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.22,my:.5}}),ne=G?Ee(R,c,_.stroke):ot(R,s,_.fill);return v(B,U,{fill:ne,stroke:Ee(R,c,_.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.5,my:.2}}),ne=G?Ee(R,c,_.stroke):ot(R,s,_.fill);return v(B,U,{strokeWidth:1,fill:ne,stroke:Ee(R,c,_.stroke)})},"bpmn:MultipleEventDefinition":function(B,R,_={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.211,my:.36}}),ne=G?Ee(R,c,_.stroke):ot(R,s,_.fill);return v(B,U,{fill:ne,stroke:Ee(R,c,_.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,R,_={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:_.width||R.width,containerHeight:_.height||R.height,position:{mx:.458,my:.194}});return v(B,G,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,R,_={}){var G=h(B,R.width,R.height,8,{fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke),strokeWidth:4});return G}};function $(B,R,_={},G){var U=de(B),ne=jA(U),Me=G||B;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?k["bpmn:ParallelMultipleEventDefinition"](R,Me,_,ne):k["bpmn:MultipleEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:MessageEventDefinition")?k["bpmn:MessageEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:TimerEventDefinition")?k["bpmn:TimerEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:ConditionalEventDefinition")?k["bpmn:ConditionalEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:SignalEventDefinition")?k["bpmn:SignalEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:EscalationEventDefinition")?k["bpmn:EscalationEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:LinkEventDefinition")?k["bpmn:LinkEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:ErrorEventDefinition")?k["bpmn:ErrorEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:CancelEventDefinition")?k["bpmn:CancelEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:CompensateEventDefinition")?k["bpmn:CompensateEventDefinition"](R,Me,_,ne):Xi(U,"bpmn:TerminateEventDefinition")?k["bpmn:TerminateEventDefinition"](R,Me,_,ne):null}var N={ParticipantMultiplicityMarker:function(B,R,_={}){var G=xi(R,_),U=ei(R,_),ne=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});w("participant-multiplicity",B,ne,{strokeWidth:2,fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke)})},SubProcessMarker:function(B,R,_={}){var G=y(B,14,14,0,{strokeWidth:1,fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke)});kn(G,R.width/2-7.5,R.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2-7.5)/R.width,my:(R.height-20)/R.height}});w("sub-process",B,U,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke)})},ParallelMarker:function(B,R,_){var G=xi(R,_),U=ei(R,_),ne=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+_.parallel)/G,my:(U-20)/U}});w("parallel",B,ne,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke)})},SequentialMarker:function(B,R,_){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+_.seq)/R.width,my:(R.height-19)/R.height}});w("sequential",B,G,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke)})},CompensationMarker:function(B,R,_){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:(R.width/2+_.compensation)/R.width,my:(R.height-13)/R.height}});w("compensation",B,G,{strokeWidth:1,fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke)})},LoopMarker:function(B,R,_){var G=xi(R,_),U=ei(R,_),ne=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+_.loop)/G,my:(U-7)/U}});w("loop",B,ne,{strokeWidth:1.5,fill:"none",stroke:Ee(R,c,_.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,R,_){var G=xi(R,_),U=ei(R,_),ne=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+_.adhoc)/G,my:(U-15)/U}});w("adhoc",B,ne,{strokeWidth:1,fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke)})}};function L(B,R,_,G){N[B](R,_,G)}function z(B,R,_=[],G={}){G={fill:G.fill,stroke:G.stroke,width:xi(R,G),height:ei(R,G)};var U=de(R),ne=_.includes("SubProcessMarker");ne?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&_.push("CompensationMarker"),M(U,"bpmn:AdHocSubProcess")&&(_.push("AdhocMarker"),ne||q(G,{compensation:G.compensation-18}));var Me=U.get("loopCharacteristics"),Xe=Me&&Me.get("isSequential");Me&&(q(G,{compensation:G.compensation-18}),_.includes("AdhocMarker")&&q(G,{seq:-23,loop:-18,parallel:-24}),Xe===void 0&&_.push("LoopMarker"),Xe===!1&&_.push("ParallelMarker"),Xe===!0&&_.push("SequentialMarker")),_.includes("CompensationMarker")&&_.length===1&&q(G,{compensation:-8}),H(_,function(mt){L(mt,B,R,G)})}function X(B,R,_={}){_=q({size:{width:100}},_);var G=o.createText(R||"",_);return st(G).add("djs-label"),Ve(B,G),G}function oe(B,R,_,G={}){var U=de(R),ne=ds({x:R.x,y:R.y,width:R.width,height:R.height},G);return X(B,U.name,{align:_,box:ne,padding:7,style:{fill:fs(R,l,c,G.stroke)}})}function te(B,R,_={}){var G={width:R.width,height:R.height,x:R.width/2+R.x,y:R.height/2+R.y};return X(B,mi(R),{box:G,style:q({},o.getExternalStyle(),{fill:fs(R,l,c,_.stroke)})})}function je(B,R,_,G={}){var U=xn(_),ne=X(B,R,{box:{height:30,width:U?ei(_,G):xi(_,G)},align:"center-middle",style:{fill:fs(_,l,c,G.stroke)}});if(U){var Me=-1*ei(_,G);tl(ne,0,-Me,270)}}function qe(B,R,_={}){var{width:G,height:U}=ds(R,_);return y(B,G,U,al,{..._,fill:ot(R,s,_.fill),fillOpacity:fa,stroke:Ee(R,c,_.stroke)})}function He(B,R,_={}){var G=de(R),U=ot(R,s,_.fill),ne=Ee(R,c,_.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(_.markerEnd=d(B,"association-end",U,ne)),G.get("associationDirection")==="Both"&&(_.markerStart=d(B,"association-start",U,ne)),_=ft(_,["markerStart","markerEnd"]),m(B,R.waypoints,{..._,stroke:ne,strokeDasharray:"0, 5"})}function Se(B,R,_={}){var G=ot(R,s,_.fill),U=Ee(R,c,_.stroke),ne=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}}),Me=v(B,ne,{fill:G,fillOpacity:fa,stroke:U}),Xe=de(R);if(HA(Xe)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:.33,my:(R.height-18)/R.height}});v(B,mt,{strokeWidth:2,fill:G,stroke:U})}return Me}function Z(B,R,_={}){return h(B,R.width,R.height,{fillOpacity:fa,..._,fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke)})}function ie(B,R,_={}){return C(B,R.width,R.height,{fill:ot(R,s,_.fill),fillOpacity:fa,stroke:Ee(R,c,_.stroke)})}function V(B,R,_={}){var G=y(B,xi(R,_),ei(R,_),0,{fill:ot(R,s,_.fill),fillOpacity:_.fillOpacity||fa,stroke:Ee(R,c,_.stroke),strokeWidth:1.5}),U=de(R);if(M(U,"bpmn:Lane")){var ne=U.get("name");je(B,ne,R,_)}return G}function Y(B,R,_={}){var G=qe(B,R,_),U=at(R);if(Fn(R)&&(Ce(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var ne=de(R).flowElements||[],Me=ne.filter(Xe=>M(Xe,"bpmn:StartEvent"));Me.length===1&&ae(Me[0],B,_,R)}return oe(B,R,U?"center-top":"center-middle",_),U?z(B,R,void 0,_):z(B,R,["SubProcessMarker"],_),G}function ae(B,R,_,G){var U=22,ne={fill:ot(G,s,_.fill),stroke:Ee(G,c,_.stroke),width:U,height:U},Me=de(B).isInterrupting,Xe=Me?0:3,mt=Me?1:1.2,qt=20,Et=(U-qt)/2,mn="translate("+Et+","+Et+")";h(R,qt,qt,{fill:ne.fill,stroke:ne.stroke,strokeWidth:mt,strokeDasharray:Xe,transform:mn}),$(B,R,ne,G)}function me(B,R,_={}){var G=qe(B,R,_);return oe(B,R,"center-middle",_),z(B,R,void 0,_),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function(B,R,_={}){return at(R)?_=ft(_,["fill","stroke","width","height"]):_=ft(_,["fill","stroke"]),Y(B,R,_)},"bpmn:Association":function(B,R,_={}){return _=ft(_,["fill","stroke"]),He(B,R,_)},"bpmn:BoundaryEvent":function(B,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var U=de(R),ne=U.get("cancelActivity");_={strokeWidth:1.5,fill:ot(R,s,_.fill),fillOpacity:YA,stroke:Ee(R,c,_.stroke)},ne||(_.strokeDasharray="6");var Me=Z(B,R,_);return h(B,R.width,R.height,ol,{..._,fill:"none"}),G&&$(R,B,_),Me},"bpmn:BusinessRuleTask":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=me(B,R,_),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ne=v(B,U);Ce(ne,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1});var Me=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Xe=v(B,Me);return Ce(Xe,{fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,R,_={}){return _=ft(_,["fill","stroke"]),Y(B,R,{strokeWidth:5,..._})},"bpmn:ComplexGateway":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=ie(B,R,_),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.26}});return v(B,U,{fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Se(B,R,_);return v(B,G,{fill:"none",stroke:Ee(R,c,_.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(B,R,_={}){return _=ft(_,["fill","stroke"]),He(B,R,{..._,markerEnd:d(B,"association-end",ot(R,s,_.fill),Ee(R,c,_.stroke))})},"bpmn:DataObject":function(B,R,_={}){return _=ft(_,["fill","stroke"]),Se(B,R,_)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Se(B,R,_);return v(B,G,{strokeWidth:1,fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke)}),U},"bpmn:DataOutputAssociation":function(B,R,_={}){return _=ft(_,["fill","stroke"]),He(B,R,{..._,markerEnd:d(B,"association-end",ot(R,s,_.fill),Ee(R,c,_.stroke))})},"bpmn:DataStoreReference":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width,containerHeight:R.height,position:{mx:0,my:.133}});return v(B,G,{fill:ot(R,s,_.fill),fillOpacity:fa,stroke:Ee(R,c,_.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var U=Z(B,R,{..._,strokeWidth:4});return G&&$(R,B,_),U},"bpmn:EventBasedGateway":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=de(R),U=ie(B,R,_);h(B,R.width,R.height,R.height*.2,{fill:ot(R,"none",_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1});var ne=G.get("eventGatewayType"),Me=!!G.get("instantiate");function Xe(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:R.width,containerHeight:R.height,position:{mx:.36,my:.44}});v(B,qt,{fill:"none",stroke:Ee(R,c,_.stroke),strokeWidth:2})}if(ne==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.474,my:.296}});v(B,mt,{fill:"none",stroke:Ee(R,c,_.stroke),strokeWidth:1})}else ne==="Exclusive"&&(Me||h(B,R.width,R.height,R.height*.26,{fill:"none",stroke:Ee(R,c,_.stroke),strokeWidth:1}),Xe());return U},"bpmn:ExclusiveGateway":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=ie(B,R,_),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:R.width,containerHeight:R.height,position:{mx:.32,my:.3}}),ne=ut(R);return ne.get("isMarkerVisible")&&v(B,U,{fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,R,_={}){return _=ft(_,["fill","stroke"]),ie(B,R,_)},"bpmn:Group":function(B,R,_={}){return _=ft(_,["fill","stroke","width","height"]),y(B,R.width,R.height,al,{stroke:Ee(R,c,_.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:xi(R,_),height:ei(R,_)})},"bpmn:InclusiveGateway":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=ie(B,R,_);return h(B,R.width,R.height,R.height*.24,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var U=Z(B,R,{..._,strokeWidth:1.5});return h(B,R.width,R.height,ol,{fill:"none",stroke:Ee(R,c,_.stroke),strokeWidth:1.5}),G&&$(R,B,_),U},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,R,_={}){return _=ft(_,["fill","stroke","width","height"]),V(B,R,{..._,fillOpacity:KA})},"bpmn:ManualTask":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=me(B,R,_),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(B,U,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=de(R),U=ut(R),ne=ot(R,s,_.fill),Me=Ee(R,c,_.stroke),Xe=m(B,R.waypoints,{markerEnd:d(B,"messageflow-end",ne,Me),markerStart:d(B,"messageflow-start",ne,Me),stroke:Me,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=Xe.getPointAtLength(Xe.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Et={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(Et.fill=ne,Et.stroke=Me):(Et.fill=Me,Et.stroke=ne);var mn=v(B,qt,Et),Sn=G.get("messageRef"),Gn=Sn.get("name"),Ct=X(B,Gn,{align:"center-top",fitBox:!0,style:{fill:Me}}),Qt=mn.getBBox(),wn=Ct.getBBox(),Fa=mt.x-wn.width/2,Vn=mt.y+Qt.height/2+WA;tl(Ct,Fa,Vn,0)}return Xe},"bpmn:ParallelGateway":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=ie(B,R,_),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:R.width,containerHeight:R.height,position:{mx:.46,my:.2}});return v(B,U,{fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,R,_={}){_=ft(_,["fill","stroke","width","height"]);var G=V(B,R,_),U=at(R),ne=xn(R),Me=de(R),Xe=Me.get("name");if(U){var mt=ne?[{x:30,y:0},{x:30,y:ei(R,_)}]:[{x:0,y:30},{x:xi(R,_),y:30}];x(B,mt,{stroke:Ee(R,c,_.stroke),strokeWidth:UA}),je(B,Xe,R,_)}else{var qt=ds(R,_);ne||(qt.height=xi(R,_),qt.width=ei(R,_));var Et=X(B,Xe,{box:qt,align:"center-middle",style:{fill:fs(R,l,c,_.stroke)}});if(!ne){var mn=-1*ei(R,_);tl(Et,0,-mn,270)}}return Me.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",B,R,_),G},"bpmn:ReceiveTask":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=de(R),U=me(B,R,_),ne;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1}),ne=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ne=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v(B,ne,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=me(B,R,_),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(B,U,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=me(B,R,_),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(B,U,{fill:Ee(R,c,_.stroke),stroke:ot(R,s,_.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=ot(R,s,_.fill),U=Ee(R,c,_.stroke),ne=m(B,R.waypoints,{markerEnd:d(B,"sequenceflow-end",G,U),stroke:U}),Me=de(R),{source:Xe}=R;if(Xe){var mt=de(Xe);Me.get("conditionExpression")&&M(mt,"bpmn:Activity")&&Ce(ne,{markerStart:d(B,"conditional-flow-marker",G,U)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Me&&Ce(ne,{markerStart:d(B,"conditional-default-flow-marker",G,U)})}return ne},"bpmn:ServiceTask":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=me(B,R,_);h(B,10,10,{fill:ot(R,s,_.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(B,U,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1}),h(B,10,10,{fill:ot(R,s,_.fill),stroke:"none",transform:"translate(11, 10)"});var ne=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(B,ne,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,R,_={}){var{renderIcon:G=!0}=_;_=ft(_,["fill","stroke"]);var U=de(R);U.get("isInterrupting")||(_={..._,strokeDasharray:"6"});var ne=Z(B,R,_);return G&&$(R,B,_),ne},"bpmn:SubProcess":function(B,R,_={}){return at(R)?_=ft(_,["fill","stroke","width","height"]):_=ft(_,["fill","stroke"]),Y(B,R,_)},"bpmn:Task":function(B,R,_={}){return _=ft(_,["fill","stroke"]),me(B,R,_)},"bpmn:TextAnnotation":function(B,R,_={}){_=ft(_,["fill","stroke"]);var{width:G,height:U}=ds(R,_),ne=y(B,G,U,0,0,{fill:"none",stroke:"none"}),Me=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});v(B,Me,{stroke:Ee(R,c,_.stroke)});var Xe=de(R),mt=Xe.get("text")||"";return X(B,mt,{align:"left-top",box:ds(R,_),padding:pa,style:{fill:fs(R,l,c,_.stroke)}}),ne},"bpmn:Transaction":function(B,R,_={}){at(R)?_=ft(_,["fill","stroke","width","height"]):_=ft(_,["fill","stroke"]);var G=Y(B,R,{strokeWidth:1.5,..._}),U=n.style(["no-fill","no-events"],{stroke:Ee(R,c,_.stroke),strokeWidth:1.5}),ne=at(R);return ne||(_={}),y(B,xi(R,_),ei(R,_),al-ol,ol,U),G},"bpmn:UserTask":function(B,R,_={}){_=ft(_,["fill","stroke"]);var G=me(B,R,_),U=15,ne=12,Me=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:ne}});v(B,Me,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:ne}});v(B,Xe,{fill:ot(R,s,_.fill),stroke:Ee(R,c,_.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:ne}});return v(B,mt,{fill:Ee(R,c,_.stroke),stroke:Ee(R,c,_.stroke),strokeWidth:.5}),G},label:function(B,R,_={}){return te(B,R,_)}};this._drawPath=v,this._renderer=E}Re(wo,cr),wo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],wo.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},wo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},wo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},wo.prototype.getShapePath=function(e){return Je(e)?bf(e,qA):M(e,"bpmn:Event")?Zy(e):M(e,"bpmn:Activity")?bf(e,al):M(e,"bpmn:Gateway")?zA(e):GA(e)};function ft(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var XA=0,ZA={width:150,height:50};function QA(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function JA(e){return gn(e)?q({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var xf=null;function eP(){return xf||(xf=document.createElement("canvas").getContext("2d")),xf}function tP(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(Qy(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Qy(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function nP(e,t){var n=eP();if(!n)return{width:0,height:0};n.font=tP(t),"letterSpacing"in n&&(n.letterSpacing=Qy(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 iP(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=nP(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return rP(e,r,i,o);r=aP(r,o.width,t)}}function rP(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 Jy="";function oP(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===Jy)&&r.pop();break}var a=r[r.length-1];return a&&a===Jy&&(r[r.length-1]="-"),r.join("")}function aP(e,t,n){var i=Math.max(e.length*(n/t),1),r=oP(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function sl(e){this._config=q({},{size:ZA,padding:XA,style:{},align:"center-top"},e||{})}sl.prototype.createText=function(e,t){return this.layoutText(e,t).element},sl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},sl.prototype.layoutText=function(e,t){for(var n=q({},this._config.size,t.box),i=q({},this._config.style,t.style),r=QA(t.align||this._config.align),o=JA(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=sP(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(iP(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Zn(l,function(y,C,x){return y+(s||C.height)},0)+o.top+o.bottom,f=Zn(l,function(y,C,x){return C.width>y?C.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");Ce(g,i),H(l,function(y){var C;switch(d+=s||y.height,r.horizontal){case"left":C=o.left;break;case"right":C=(a?f:u)-o.right-y.width;break;default:C=Math.max(((a?f:u)-y.width)/2+o.left,0)}var x=Oe("tspan");Ce(x,{x:C,y:d}),x.textContent=y.text,Ve(g,x)});var h={width:f,height:p};return{dimensions:h,element:g}};function sP(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var cP=12,lP=1.2,uP=40;function ev(e){var t=q({fontFamily:"Arial, sans-serif",fontSize:cP,fontWeight:"normal",lineHeight:lP},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=q({},t,{fontSize:n},e&&e.externalStyle||{}),r=new sl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,xo.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:pa});return{x:a.x,y:a.y,width:a.width,height:Math.max(uP,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,q({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}ev.$inject=["config.textRenderer"];function pP(){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,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var p=mP(i.d,{mx:r,my:o,e:a});return p}}var fP=/\{([^{}]+)\}/g,dP=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function hP(e,t,n){var i=n;return t.replace(dP,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 mP(e,t){return String(e).replace(fP,function(n,i){return hP(n,i,t)})}const gP={__init__:["bpmnRenderer"],bpmnRenderer:["type",wo],textRenderer:["type",ev],pathMap:["type",pP]};function yP(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const hs={translate:["value",yP]};function cl(e,t,n){return q({id:e.id,type:e.$type,businessObject:e,di:t},n)}function vP(e,t,n){var i=e.waypoint;return!i||i.length<2?[$e(t),$e(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function tv(e,t,n){return new Error(`element ${$n(t)} referenced by ${$n(e)}#${n} not yet drawn`)}function fr(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}fr.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],fr.prototype.add=function(e,t,n){var i,r,o;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(cl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!at(e,t),c=xP(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(cl(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(o=0),M(e,"bpmn:DataStoreReference")&&(bP(n,$e(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(cl(e,t,{hidden:r,source:u,target:p,waypoints:vP(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${$n(t)} for element ${$n(e)}`);return Nr(e)&&mi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},fr.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${$n(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw tv(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},fr.prototype.addLabel=function(e,t,n){var i,r,o;return i=IA(t,n),r=mi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(cl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!mi(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)},fr.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?tv(e,i,t+"Ref"):new Error(`${$n(e)}#${t} Ref not specified`)},fr.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},fr.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},fr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function bP(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 xP(e){return M(e,"bpmn:Group")}const nv={__depends__:[gP,{__depends__:[hs],bpmnImporter:["type",fr]}]};function ms(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ii(e,t){return{x:e.x-t.x,y:e.y-t.y}}function wf(e){return Math.log(e)/Math.log(10)}var wP=1e3;function pe(e){this._eventBus=e}pe.$inject=["eventBus"];function _P(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}pe.prototype.on=function(e,t,n,i,r,o){if((yn(t)||ze(t))&&(o=r,r=i,i=n,n=t,t=null),yn(n)&&(o=r,r=i,i=n,n=wP),gn(r)&&(o=r,r=!1),!yn(i))throw new Error("handlerFn must be a function");Ne(e)||(e=[e]);var a=this._eventBus;H(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?_P(i,o):i,o)})},pe.prototype.canExecute=dr("canExecute"),pe.prototype.preExecute=dr("preExecute"),pe.prototype.preExecuted=dr("preExecuted"),pe.prototype.execute=dr("execute"),pe.prototype.executed=dr("executed"),pe.prototype.postExecute=dr("postExecute"),pe.prototype.postExecuted=dr("postExecuted"),pe.prototype.revert=dr("revert"),pe.prototype.reverted=dr("reverted");function dr(e){return function(n,i,r,o,a){(yn(n)||ze(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var _f=["top","bottom","left","right"],ll=10;function Ef(e,t){pe.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,l=o.hints||{};l.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(rl(r)&&!Mt(r)){var o=RP(r);o&&i(r,o)}}function i(r,o){var a=$e(r),s=r.label,c=$e(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-ll-s.height/2};break;case"left":u={x:l.left-ll-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+ll+s.height/2};break;case"right":u={x:l.right+ll+s.width/2,y:a.y};break}var p=Ii(u,c);t.moveShape(s,p)}}}Re(Ef,pe),Ef.$inject=["eventBus","modeling"];function EP(e){var t=e.host,n=$e(e),i=Tn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=_f.filter(function(a){return r.indexOf(a)===-1});return o}function SP(e){var t=$e(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return iv(t,i)});return n}function RP(e){var t=$e(e.label),n=$e(e),i=iv(n,t);if(CP(i)){var r=SP(e);if(e.host){var o=EP(e);r=r.concat(o)}var a=_f.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Tn(e.label,e)!=="intersect"?void 0:i:a[0]}}function iv(e,t){return Tn(t,e,5)}function CP(e){return _f.indexOf(e)!==-1}function Sf(e){pe.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(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)}Re(Sf,pe),Sf.$inject=["eventBus"];var MP=1500;function Rf(e,t,n){e.invoke(pe,this),this.preExecute("elements.delete",MP,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=it(r,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return H(o,l=>{const u=new Set(Go(aa(Array.from(s),rn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Re(Rf,pe),Rf.$inject=["injector","eventBus","canvas"];function Cf(e,t){e.invoke(pe,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=it(r.incoming.concat(r.outgoing),function(a){return M(a,"bpmn:Association")});H(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Re(Cf,pe),Cf.$inject=["injector","modeling"];function da(e,t){for(Kn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function rv(e,t){var n=da(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=da(e,i),n)return xn(n);if(tt(e,i))return xn(e);var r;for(r=de(e);r&&!M(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=de(a);return s&&s.get("processRef")===r});return o?xn(o):!0}var ov=500;function ul(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ov,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return av(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",ov,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];av(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}ul.$inject=["bpmnReplace","injector"],Re(ul,pe),ul.prototype._replaceShape=function(e,t){var n=AP(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function AP(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function av(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Mf(e,t){pe.call(this,e);function n(i){return it(i.attachers,function(r){return M(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);M(r,"bpmn:EventBasedGateway")&&M(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;M(r,"bpmn:Gateway")&&M(o,"bpmn:EventBasedGateway")&&H(o.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Mf.$inject=["eventBus","modeling"],Re(Mf,pe);function sv(e){return e.create("bpmn:Category")}function PP(e){return e.create("bpmn:CategoryValue")}function cv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=PP(e)),n.$parent||(n.$parent=sv(e)),n}function TP(e,t,n){return tn(t.get("categoryValue"),e),e.$parent=t,tn(n.get("rootElements"),t),t.$parent=n,e}function kP(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function OP(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var DP=500;function Af(e,t,n){n.invoke(pe,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(de).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&TP(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&OP(l),c&&!r(c,u)&&kP(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.executed(["shape.move","shape.resize"],DP,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,de(l))},!0),this.executed("group.updateRefs",function(c){lv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){lv(c).forEach(function(l){s(l.categoryValue,l.category,de(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Af.$inject=["bpmnjs","elementRegistry","injector"],Re(Af,pe);function lv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Pf(e,t,n){pe.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(y){const C=y.source,x=y.target;ha(C)&&gs(x)&&u(x)}function r(y){const C=y.connection,x=y.source,m=y.target;ha(x)&&pl(m)&&(l(m),f(x,[C]))}function o(y){const C=y.newTarget,x=y.oldSource,m=y.oldTarget;if(m!==C){const v=x;gs(m)&&u(m),ha(v)&&pl(C)&&l(C)}}function a(y){const{element:C}=y;gs(C)?(p(C),d(C)):pl(C)&&g(C)}function s(y){const{newData:C,oldShape:x}=y;if(ha(y.oldShape)&&C.eventDefinitionType!=="bpmn:CompensateEventDefinition"||C.type!=="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>gs(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!ha(y.oldShape)&&C.eventDefinitionType==="bpmn:CompensateEventDefinition"&&C.type==="bpmn:BoundaryEvent"){const m=x.outgoing.find(({target:v})=>pl(v));m&&m.target&&(y._connectionTarget=m.target),h(x)}}function c(y){const{_connectionTarget:C,newShape:x}=y;C&&t.connect(x,C)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const C of y.incoming)n.canConnect(C.source,y)||t.removeConnection(C);for(const C of y.outgoing)n.canConnect(y,C.target)||t.removeConnection(C)}function f(y,C){y.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>gs(v.target)&&!C.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const C=y.attachers.slice();C.length&&t.removeElements(C)}function g(y){const C=y.incoming.filter(x=>ha(x.source));t.removeElements(C)}function h(y){const C=y.outgoing.filter(x=>M(x,"bpmn:SequenceFlow"));t.removeElements(C)}}Re(Pf,pe),Pf.$inject=["eventBus","modeling","bpmnRules"];function gs(e){const t=de(e);return t&&t.get("isForCompensation")}function ha(e){return e&&M(e,"bpmn:BoundaryEvent")&&ua(e,"bpmn:CompensateEventDefinition")}function pl(e){return e&&M(e,"bpmn:Activity")&&!Fn(e)}function Tf(e){e.invoke(pe,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;M(i,"bpmn:Lane")&&!M(r,"bpmn:Lane")&&(n.parent=da(i,"bpmn:Participant"))})}Tf.$inject=["injector"],Re(Tf,pe);function kf(e,t){pe.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(M(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}})}kf.$inject=["eventBus","bpmnFactory"],Re(kf,pe);var Of=20,Df=20,uv=30,fl=2e3;function Lf(e,t,n){pe.call(this,t),t.on(["create.start","shape.move.start"],fl,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!Je(p)&&!Mt(p)});if(c.length){var l=rn(c),u=LP(a,l);q(a,u),o.createConstraints=IP(a,l)}}}),t.on("create.start",fl,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",fl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return M(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",fl,function(r){var o=r.elements,a=r.parent,s=BP(o),c;s&&M(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=de(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;M(a,"bpmn:Participant")&&M(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=de(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)&&de(s).set("processRef",de(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,l=o.participant;a&&(!l||c===l)&&de(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 l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Lf.$inject=["canvas","eventBus","modeling"],Re(Lf,pe);function LP(e,t){t={width:t.width+Of*2+uv,height:t.height+Df*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 IP(e,t){return t=Ie(t),{bottom:t.top+e.height/2-Df,left:t.right-e.width/2+Of,top:t.bottom-e.height/2+Df,right:t.left+e.width/2-Of-uv}}function BP(e){return Tt(e,function(t){return M(t,"bpmn:Participant")})}var pv="__targetRef_placeholder";function If(e,t){pe.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],fv(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],fv(o));function n(a,s,c){var l=a.get("dataInputAssociations");return Tt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Tt(c,function(u){return u.name===pv});return!l&&s&&(l=t.create("bpmn:Property",{name:pv}),tn(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,C;h&&h!==p&&r(h,l),d&&d!==p&&r(d,l),p?(C=i(p,!0),y.targetRef=C):y.targetRef=null}}If.$inject=["eventBus","bpmnFactory"],Re(If,pe);function fv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function dl(e){this._bpmnUpdater=e}dl.$inject=["bpmnUpdater"],dl.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),[]},dl.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 Bf(e,t,n,i){pe.call(this,i),t.registerHandler("dataStore.updateContainment",dl);function r(){return n.filter(function(s){return M(s,"bpmn:Participant")&&de(s).processRef})[0]}function o(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ut(s),newSemanticParent:u.processRef||u,newDiParent:ut(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:$P(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&o(u).filter(function(p){return NP(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=o(l);p.forEach(function(f){M(u,"bpmn:Process")&&a(f,u)})})}Bf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Re(Bf,pe);function NP(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 $P(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var hl=Math.max,ml=Math.min,FP=20;function dv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function jP(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 HP(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 gl(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ze(r)&&(i=(/top|left/.test(e)?ml:hl)(i,r)),ze(o)&&(i=(/top|left/.test(e)?hl:ml)(i,o)),i}function zP(e,t){if(!t)return e;var n=Ie(e);return Qc({top:gl("top",n,t),right:gl("right",n,t),bottom:gl("bottom",n,t),left:gl("left",n,t)})}function GP(e,t,n,i){var r=Ie(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?Ie(i):o,s={top:ml(o.top,a.top),left:ml(o.left,a.left),bottom:hl(o.bottom,a.bottom),right:hl(o.right,a.right)};return Qc(s)}function ys(e,t){return typeof e<"u"?e:FP}function VP(e,t){var n,i,r,o;return typeof t=="object"?(n=ys(t.left),i=ys(t.right),r=ys(t.top),o=ys(t.bottom)):n=i=r=o=ys(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function WP(e){return!(e.waypoints||e.type==="label")}function hv(e,t){var n;if(e.length===void 0?n=it(e.children,WP):n=e,n.length)return VP(rn(n),t)}var $r=Math.abs;function UP(e,t){return dv(Ie(t),Ie(e))}var qP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function yl(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(yl(n,t),t.push(n))}),t}function Fr(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function _i(e){return da(e,qP)||e}function YP(e,t){var n=_i(e),i=M(n,"bpmn:Process")?[]:[n],r=yl(n,i),o=Ie(e),a=Ie(t),s=UP(e,t),c=[],l=xn(e);return r.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Ie(u);s.top&&($r(h.bottom-o.top)<10&&(d=a.top-h.bottom),$r(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&($r(h.right-o.left)<10&&(f=a.left-h.right),$r(h.left-o.left)<5&&(g=a.left-h.left)),s.bottom&&($r(h.top-o.bottom)<10&&(p=a.bottom-h.top),$r(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&($r(h.left-o.right)<10&&(g=a.right-h.left),$r(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:HP(u,{top:p,right:f,bottom:d,left:g})})}}),c}var KP=500;function Nf(e,t){pe.call(this,e);function n(i,r){var o=xn(i),a=Fr(r),s=[],c=[],l=[],u=[];if(vo(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.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")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",KP,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;M(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Nf.$inject=["eventBus","spaceTool"],Re(Nf,pe);var mv=500;function vl(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",mv,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return gv(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",mv,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;gv(a,ZP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}vl.$inject=["bpmnReplace","injector"],Re(vl,pe),vl.prototype._replaceShape=function(e){var t=XP(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function XP(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function gv(e,t){return!Je(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function ZP(e,t){return e.indexOf(t)!==-1}var bl=Math.round,QP=Math.max;function JP(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 eT(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var yv=10;function tT(e,t){var n,i;for(n=0;i=e[n];n++)if(ss(i,t)<=yv)return{point:e[n],bendpoint:!0,index:n};return null}function nT(e,t){var n=_y(JP(t,yv),eT(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=QP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:bl(i.x+r.x)/2,y:bl(i.y+r.y)/2},index:i.segment2}:{point:{x:bl(i.x),y:bl(i.y)},index:i.segment2}:null}function $f(e,t){return tT(e,t)||nT(e,t)}function Ff(e,t,n){pe.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,p,f,d,g,h=r.outgoing.slice(),y=r.incoming.slice(),C;ze(a.width)?C=$e(a):C=a;var x=$f(s,C);if(x){if(c=s.slice(0,x.index),l=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!l.length)return;u=x.bendpoint?s[x.index]:C,(c.length===1||!vv(r,c[c.length-1]))&&c.push(bv(u)),(l.length===1||!vv(r,l[0]))&&l.unshift(bv(u))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||C),d=o),t.canConnect(r,f,o)&&(d?g=n.connect(r,f,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||C),g=o));var m=[].concat(d&&it(y,function(v){return v.source===d.source})||[],g&&it(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}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 l=$e(c),u={x:l.x+s.x,y:l.y+s.y},p=Tt(o.children,function(f){var d=t.canInsert(a,f);return d&&$f(f.waypoints,u)});p&&(r.targetFlow=p,r.position=u)}},!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)}Re(Ff,pe),Ff.$inject=["eventBus","bpmnRules","modeling"];function vv(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 bv(e){return q({},e)}function jf(e,t){pe.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)&&ma(r)){var c=[];M(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&ma(l)):c=a.incoming.filter(l=>l!==r&&ma(l)&&M(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(M(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ma).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ma).forEach(function(s){const c=a.incoming.filter(ma).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}jf.$inject=["eventBus","modeling"],Re(jf,pe);function ma(e){return M(e,"bpmn:SequenceFlow")}var xl=1500,xv=2e3;function wv(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"],xl,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!tt(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=_i(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||tt(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"],xl,function(i){var r=i.hover;M(r,"bpmn:Lane")&&(i.hover=_i(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],xl,function(i){var r=i.context,o=i.hover,a=r.type;M(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=_i(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],xl,function(i){var r=i.context,o=r.start;M(o,"bpmn:Lane")&&(r.start=_i(o)||o)}),t.on("shape.move.start",xv,function(i){var r=i.shape;M(r,"bpmn:Lane")&&(i.shape=_i(r)||r)}),t.on("spaceTool.move",xv,function(i){var r=i.hover;r&&M(r,"bpmn:Lane")&&(i.hover=_i(r))})}wv.$inject=["elementRegistry","eventBus","canvas"];var _v=770;function Hf(e,t,n,i){n.invoke(pe,this);function r(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef;u||(u=cv(e,l));var p=c.category||u.$parent||sv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function o(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=de(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=de(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||de(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",_v,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=de(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",_v,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,p=c.category;u&&(u=l.categoryValueRef=a(u)),p&&(u.$parent=a(p)),delete c.category,delete c.categoryValue})}Hf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Re(Hf,pe);function zf(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 Ev(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=zf(i,r,o,a),l=zf(i,r,o,s),u;c&&l?Sv(c,o)>Sv(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],$e(i.source)),t(r[r.length-1],r[r.length-2],$e(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Ev.$inject=["eventBus"];function Sv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gf(e){pe.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=de(i),o=ut(i);if(tt(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Gf.$inject=["eventBus"],Re(Gf,pe);function Rv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Cv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function iT(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 rT(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 Vf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=rT([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 Mv(e,t){var n=Vf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Rv(i)}function vs(e,t){return Rv({x:e.x-t.x,y:e.y-t.y})}var Av=Math.sqrt,Pv=Math.min,oT=Math.max,Tv=Math.abs;function kv(e){return Math.pow(e,2)}function bs(e,t){return Av(kv(e.x-t.x)+kv(e.y-t.y))}function aT(e,t){var n=0,i,r,o,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Dv(i,r)?l=[i]:(o=bs(e,i),a=bs(e,r),c=Pv(o,a),l=sT(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:Dv(i,l[0])?n:n+1}),l.length===2&&(s=lT(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:bs(i,s)/bs(i,r)}),p=bs(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function sT(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,l=r*a+o*s,u=a*a+s*s-i*i,p=l/c,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=Av(d),h=-p+g,y=-p-g,C={x:e.x-r*h,y:e.y-o*h};if(d===0)return[C];var x={x:e.x-r*y,y:e.y-o*y};return[C,x].filter(function(m){return cT(m,e,t)})}function cT(e,t,n){return Ov(e.x,t.x,n.x)&&Ov(e.y,t.y,n.y)}function Ov(e,t,n){return e>=Pv(t,n)-wl&&e<=oT(t,n)+wl}function lT(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var wl=.1;function Dv(e,t){return Tv(e.x-t.x)<=wl&&Tv(e.y-t.y)<=wl}function uT(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,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var p=Iv(t,l);p<n.relativeLocation&&u++}return u}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 Lv(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=aT(e,n),c=s.segmentIndex,l=uT(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Bv(n,c),p=Bv(t,l),f=s.position,d=fT(u,f),g=pT(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,C=n[y];if(t.indexOf(C)!==-1)return a;if(h===0){var x=t[y];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&y!==0&&y<n.length-1&&(d=Iv(n,y))}var m={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=iT({x:e.x-f.x,y:e.y-f.y},g);return r=m.x+v.x-e.x,o=m.y+v.y-e.y,{point:ur(m),delta:ur({x:r,y:o})}}function Iv(e,t){var n=vs(e[t-1],e[t]),i=vs(e[t],e[t+1]),r=n/(n+i);return r}function pT(e,t){var n=Cv(e),i=Cv(t);return i-n}function Bv(e,t){return[e[t],e[t+1]]}function fT(e,t){var n=vs(e[0],e[1]),i=vs(e[0],t);return n===0?0:i/n}function dT(e,t,n,i){var r=$e(e);return Lv(r,t,n,i).delta}function xs(e,t,n){var i=ms(t),r=ms(n),o=Ii(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return ur({x:r.x+a.x,y:r.y+a.y})}function Nv(e,t,n){var i=ms(e),r=ms(t),o=ms(n),a=Ii(e,i),s=Ii(i,r),c=hT(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return ur({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function hT(e,t,n){var i=Ie(t),r=Ie(n);if(mT(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 mT(e,t){return gT(e,t)||yT(e,t)}function gT(e,t){return e.right!==t.right&&e.left!==t.left}function yT(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var $v="name",Fv="text";function Wf(e,t,n,i){pe.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{de(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if($v in l&&t.updateLabel(c,l[$v]),Fv in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Fv]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Je(l)||!Nr(l)||mi(l)&&t.updateLabel(l,mi(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=q({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),dT(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=o(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=de(c);u&&Nr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Je(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(mi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(rl(c)){var p=c.label,f=$e(p),d=xT(u),g=bT(f,d),h=vT(g,u,l);t.moveShape(p,h)}})}Re(Wf,pe),Wf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function vT(e,t,n){var i=xs(e,t,n);return ur(Ii(i,e))}function bT(e,t){if(t.length){var n=wT(e,t);return Vf(e,n)}}function xT(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 wT(e,t){var n=t.map(function(r){return{line:r,distance:Mv(e,r)}}),i=ji(n,"distance");return i[0].line}function _T(e,t,n,i){return Lv(e,t,n,i).point}function Uf(e,t){pe.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=q({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),_T(r,c,l,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 l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],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(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Re(Uf,pe),Uf.$inject=["eventBus","modeling"];function _l(e,t,n){var i=Sl(e),r=Hv(i,t),o=i[0];return r.length?r[r.length-1]:xs(o.original||o,n,t)}function El(e,t,n){var i=Sl(e),r=Hv(i,t),o=i[i.length-1];return r.length?r[0]:xs(o.original||o,n,t)}function qf(e,t,n){var i=Sl(e),r=jv(t,n),o=i[0];return xs(o.original||o,r,t)}function Yf(e,t,n){var i=Sl(e),r=jv(t,n),o=i[i.length-1];return xs(o.original||o,r,t)}function jv(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Sl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Hv(e,t){var n=Ln(e,ST);return it(n,function(i){return ET(i,t)})}function ET(e,t){return Tn(t,e,1)==="intersect"}function ST(e){return e.original||e}function Kf(e,t){pe.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(RT(i,r)){var o=CT(i);o.incoming.forEach(function(a){var s=El(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=_l(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Kf.$inject=["eventBus","modeling"],Re(Kf,pe);function RT(e,t){return M(e,"bpmn:Participant")&&at(e)&&M(t,"bpmn:Participant")&&!at(t)}function CT(e){var t=os([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){M(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){M(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const MT=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function zv(e){const t=de(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&Fn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:MT.some(i=>M(n[0],i))}function Gv(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Xf(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!zv(r))return;const a=Gv(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=de(i).get(a),l=de(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Xf.$inject=["injector","modeling"],Re(Xf,pe);function Zf(e,t){pe.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ut(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Re(Zf,pe),Zf.$inject=["eventBus","modeling"];function Qf(e,t,n){pe.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(!(!M(o,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=AT(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Re(Qf,pe),Qf.$inject=["eventBus","bpmnRules","modeling"];function ga(e){return e.original||e}function AT(e,t){var n=zf(ga(e[e.length-2]),ga(e[e.length-1]),ga(t[1]),ga(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ga(e[0]),ga(t[t.length-1])]}function Jf(e,t){pe.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;M(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)}Jf.$inject=["eventBus","modeling"],Re(Jf,pe);function ed(e,t,n,i){pe.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,p=c.parent;if(p){var f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,r&&s(u,g))}function s(c,l){var u=r.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;H(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Tt(p.outgoing,Wo({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Re(ed,pe),ed.$inject=["eventBus","modeling","bpmnRules","injector"];function Rl(e,t,n,i,r,o){i.invoke(pe,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Zn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];H(s.closure.topLevel,function(f){Fn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}Re(Rl,pe),Rl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;H(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)},Rl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var PT=1500,TT={width:140,height:120},td={width:300,height:60},nd={width:60,height:300},Cl={width:300,height:150},Ml={width:150,height:300},Vv={width:140,height:120},Wv={width:100,height:40};function Uv(e){e.on("resize.start",PT,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=IT(i,r,o)),M(i,"bpmn:SubProcess")&&at(i)&&(n.minDimensions=Vv),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=Wv)})}Uv.$inject=["eventBus"];var jr=Math.abs,kT=Math.min,OT=Math.max;function qv(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function ya(e,t,n){return qv(e,t,n,kT)}function va(e,t,n){return qv(e,t,n,OT)}var DT={top:20,left:50,right:20,bottom:20},LT={top:50,left:20,right:20,bottom:20};function IT(e,t,n){var i=_i(e),r=!0,o=!0,a=yl(i,[i]),s=Ie(e),c={},l={},u=xn(e),p=u?td:nd;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Ie(g);u?(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&&jr(s.top-h.bottom)<10&&va(c,"top",h.top+p.height),jr(s.top-h.top)<5&&ya(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&jr(s.right-h.left)<10&&ya(c,"right",h.right-p.width),jr(s.right-h.right)<5&&va(l,"right",h.left+p.width)),/s/.test(t)&&(n&&jr(s.bottom-h.top)<10&&ya(c,"bottom",h.bottom-p.height),jr(s.bottom-h.bottom)<5&&va(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&jr(s.left-h.right)<10&&va(c,"left",h.left+p.width),jr(s.left-h.left)<5&&ya(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?DT:LT;return f.forEach(function(g){var h=Ie(g);/n/.test(t)&&(!u||r)&&ya(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&va(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&va(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&ya(l,"left",h.left-d.left)}),{min:l,max:c}}function Yv(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function ba(e){return e.originalEvent||e.srcEvent}function id(e){Yv(e),Yv(ba(e))}function _o(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 Kv(){return/mac/i.test(navigator.platform)}function Xv(e,t){return(ba(e)||e).button===t}function Hr(e){return Xv(e,0)}function BT(e){return Xv(e,1)}function ws(e){var t=ba(e)||e;return Hr(e)?Kv()?t.metaKey:t.ctrlKey:!1}function Al(e){var t=ba(e)||e;return Hr(e)&&t.shiftKey}var Zv=1001;function Qv(e,t){e.on("resize.start",Zv+500,function(n){var i=n.context,r=i.shape;(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))&&(i.balanced=!ws(n))}),e.on("resize.end",Zv,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(M(r,"bpmn:Lane")||M(r,"bpmn:Participant"))return o&&(a=My(a),t.resizeLane(r,a,i.balanced)),!1})}Qv.$inject=["eventBus","modeling"];var NT=500;function rd(e,t,n,i,r){n.invoke(pe,this);function o(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||$T(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Tt(f,Wo({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(o(p)){var f=de(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),tn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!o(f))){var d=de(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",NT,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(f,d),delete p.referencedRootElement)})}rd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Re(rd,pe);function $T(e,t){return Ne(t)||(t=[t]),Rr(t,function(n){return ua(e,n)})}var Jv=Math.max;function eb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return H(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(o[s]=jT(a,i,r)),M(a,"bpmn:Lane")&&(o[s]=xn(a)?td:nd),M(a,"bpmn:SubProcess")&&at(a)&&(o[s]=Vv),M(a,"bpmn:TextAnnotation")&&(o[s]=Wv),M(a,"bpmn:Group")&&(o[s]=TT)}),o})}eb.$inject=["eventBus"];function FT(e){return e==="x"}function jT(e,t,n){var i=xn(e);if(!GT(e))return i?Cl:Ml;var r=FT(t),o={};return r?i?o=Cl:o={width:zT(e,n,r),height:Ml.height}:i?o={width:Cl.width,height:HT(e,n,r)}:o=Ml,o}function HT(e,t,n){var i;return i=VT(e,t,n),Jv(Cl.height,i)}function zT(e,t,n){var i;return i=WT(e,t,n),Jv(Ml.width,i)}function GT(e){return!!Fr(e).length}function VT(e,t,n){var i=Fr(e),r;return r=od(i,t,n),e.height-r.height+td.height}function WT(e,t,n){var i=Fr(e),r;return r=od(i,t,n),e.width-r.width+nd.width}function od(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=Fr(r),o.length?od(o,t,n):r}var tb="_plane";function nb(e){var t=e.id;return UT(t)}function Zi(e){var t=e.id;return M(e,"bpmn:SubProcess")?ib(t):t}function Eo(e){return ib(e)}function Pl(e){var t=ut(e);return M(t,"bpmndi:BPMNPlane")}function ib(e){return e+tb}function UT(e){return e.replace(new RegExp(tb+"$"),"")}var rb=400,qT=600,ob={x:180,y:160};function hr(e,t,n,i,r,o,a){pe.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 M(p,"bpmn:SubProcess")&&!at(p)}function l(p){var f=p.shape,d=p.newRootElement,g=de(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=de(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Zi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;H(f,function(d){if(c(d)){var g=a.get(Zi(d));if(!(!g||!d.children||!d.children.length)){var h=ab(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!at(f)||H(ps([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Zi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Zi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Zi(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(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(Pl(f)){a.updateId(f,Eo(y)),a.updateId(h,y);return}var C=a.get(Eo(h));C&&a.updateId(Eo(h),Eo(y))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,y=d.id;if(h!==y){if(Pl(f)){a.updateId(f,Eo(h)),a.updateId(y,h);return}var C=a.get(Eo(y));C&&a.updateId(C,Eo(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Pl(f)){var d=f,g=a.get(nb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",rb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",rb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(at(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",qT,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(at(f))s._moveChildrenToShape(d.children.slice(),f),H(ps(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),H(h.associations,y=>{n.moveConnection(y,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=ab(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Zi(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,y=M(ut(h),"bpmndi:BPMNPlane");if(y){var C=nb(h),x=Tt(g,function(m){return m.id===C});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Re(hr,pe),hr.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=rn(i),o;if(!t.x)o={x:ob.x-r.x,y:ob.y-r.y};else{var a=$e(t),s=$e(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},hr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Xy(e).map(i=>i.annotation));n.size&&H(ps(e.children),i=>{n.has(i.annotation)&&H(i.associations,r=>{t.removeConnection(r)})})},hr.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},hr.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},hr.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:Zi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},hr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Tt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},hr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function YT(e){var t=[];return H(ps(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function ab(e){return e.children.slice().concat(YT(e.children)).concat(KT(e))}function KT(e){return uf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function ad(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!M(r,"bpmn:SubProcess")||M(r,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!at(r))){var o=XT(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}ad.$inject=["injector","modeling"],Re(ad,pe);function XT(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function sd(e,t){pe.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(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&&M(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(!(!M(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,mi(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Re(sd,pe),sd.$inject=["eventBus","textRenderer"];function cd(e,t){pe.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(at(i))return;var r=os(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();H(s,function(l){o(l,!0)}),H(c,function(l){o(l,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,$e(i)):t.reconnectStart(a,i,$e(i)))}},!0)}Re(cd,pe),cd.$inject=["eventBus","modeling"];var ld=500;function ud(e,t,n){pe.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,l=s,u,p;return u=ZT(c).concat([a]),p=hv(u),p?(l.width=Math.max(p.width,l.width),l.height=Math.max(p.height,l.height),l.x=p.x+(p.width-l.width)/2,l.y=p.y+(p.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}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"],ld,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?ut(c).isExpanded=!1:(i(c.children),ut(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],ld,function(a){var s=a.context,c=s.shape;c.collapsed?ut(c).isExpanded=!1:ut(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],ld,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Re(ud,pe),ud.$inject=["eventBus","elementFactory","modeling"];function ZT(e){return e.filter(function(t){return!t.hidden})}function pd(e,t,n,i){t.invoke(pe,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(M(a,"bpmn:Participant")&&at(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;M(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}Re(pd,pe),pd.$inject=["canvas","injector","moddle","modeling"];function fd(e,t){pe.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;QT(r,o)&&t.updateProperties(o,{default:null})})}Re(fd,pe),fd.$inject=["eventBus","modeling"];function QT(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=de(t),i=de(e);return n.get("default")===i}var JT=500,ek=5e3,sb=["shape.create","shape.delete","shape.move","shape.resize"],cb=[...sb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function dd(e,t){pe.call(this,e);var n;function i(){return n=n||new tk,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(cb,ek,function(){i()}),this.postExecuted(cb,JT,function(){o()}),this.preExecute(sb,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}dd.$inject=["eventBus","modeling"],Re(dd,pe);function tk(){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 nk=500,ik=5e3,lb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],ub=[...lb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function hd(e,t){pe.call(this,e);var n;function i(){return n=n||new rk,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(ub,ik,function(){i()}),this.postExecuted(ub,nk,function(){o()}),this.preExecute(lb,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&r().addGroup(s)})}hd.$inject=["eventBus","modeling"],Re(hd,pe);function rk(){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 md(e,t){pe.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)ok(o)&&!sk(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Re(md,pe),md.$inject=["eventBus","modeling"];function ok(e){const t=de(e);return t&&t.isForCompensation}function ak(e){return e&&M(e,"bpmn:BoundaryEvent")&&ua(e,"bpmn:CompensateEventDefinition")}function sk(e){return e.incoming.filter(n=>ak(n.source)).length>0}const ck={__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",Ef],appendBehavior:["type",Sf],associationBehavior:["type",Cf],attachEventBehavior:["type",ul],artifactBehavior:["type",Rf],boundaryEventBehavior:["type",Mf],categoryRootElementReferenceBehavior:["type",Af],compensateBoundaryEventBehaviour:["type",Pf],createBehavior:["type",Tf],createDataObjectBehavior:["type",kf],createParticipantBehavior:["type",Lf],dataInputAssociationBehavior:["type",If],dataStoreBehavior:["type",Bf],deleteLaneBehavior:["type",Nf],detachEventBehavior:["type",vl],dropOnFlowBehavior:["type",Ff],eventBasedGatewayBehavior:["type",jf],fixHoverBehavior:["type",wv],groupBehavior:["type",Hf],importDockingFix:["type",Ev],isHorizontalFix:["type",Gf],labelBehavior:["type",Wf],layoutConnectionBehavior:["type",Uf],messageFlowBehavior:["type",Kf],nonInterruptingBehavior:["type",Xf],removeElementBehavior:["type",Qf],removeEmbeddedLabelBoundsBehavior:["type",Zf],removeParticipantBehavior:["type",Jf],replaceConnectionBehavior:["type",ed],replaceElementBehaviour:["type",Rl],resizeBehavior:["type",Uv],resizeLaneBehavior:["type",Qv],rootElementReferenceBehavior:["type",rd],spaceToolBehavior:["type",eb],subProcessPlaneBehavior:["type",hr],subProcessStartEventBehavior:["type",ad],textAnnotationBehavior:["type",sd],toggleCollapseConnectionBehaviour:["type",cd],toggleElementCollapseBehaviour:["type",ud],unclaimIdBehavior:["type",pd],unsetDefaultFlowBehavior:["type",fd],updateFlowNodeRefsBehavior:["type",dd],updateCategoryValueRefsBehavior:["type",hd],setCompensationActivityAfterPasteBehavior:["type",md]};function gd(e){this._commandStack=e.get("commandStack",!1)}gd.$inject=["injector"],gd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Qi={__init__:["rules"],rules:["type",gd]};function Ei(e){pe.call(this,e),this.init()}Ei.$inject=["eventBus"],Re(Ei,pe),Ei.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)})},Ei.prototype.init=function(){};function pb(e,t){var n=Tn(e,t,-15);return n!=="intersect"?n:null}function On(e){Ei.call(this,e)}Re(On,Ei),On.$inject=["eventBus"],On.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return lk(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 kl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return kl(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 Sb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Mt(i)&&!Ol(t,i)?!1:lo(t,function(r){return Mt(r)?kl(r.source,r.target,r):r.host?_s(r,r.host,null,n):xd(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 vb(a)&&!n.includes(a.host)})?!1:_s(n,t,null,i)||_b(n,t,i)||Eb(n,t)||Ol(n,t)}),this.addRule("shape.create",function(e){return xd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return _s(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Pb(n,t)})},On.prototype.canConnectMessageFlow=Mb,On.prototype.canConnectSequenceFlow=Ab,On.prototype.canConnectDataAssociation=wd,On.prototype.canConnectAssociation=Rb,On.prototype.canConnectCompensationAssociation=Cb,On.prototype.canMove=Eb,On.prototype.canAttach=_s,On.prototype.canReplace=_b,On.prototype.canDrop=xa,On.prototype.canInsert=Ol,On.prototype.canCreate=xd,On.prototype.canConnect=kl,On.prototype.canResize=Sb,On.prototype.canCopy=Pb;function lk(e){return yd(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function yd(e){return!e||Je(e)}function fb(e){do{if(M(e,"bpmn:Process"))return de(e);if(M(e,"bpmn:Participant"))return de(e).processRef||de(e)}while(e=e.parent)}function vd(e){return M(e,"bpmn:TextAnnotation")}function bd(e){return M(e,"bpmn:Group")&&!e.labelTarget}function db(e){return M(e,"bpmn:BoundaryEvent")&&Ji(e,"bpmn:CompensateEventDefinition")}function Tl(e){return de(e).isForCompensation}function uk(e,t){var n=fb(e),i=fb(t);return n===i}function pk(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&gb(e,"bpmn:MessageEventDefinition"))}function fk(e){return M(e,"bpmn:InteractionNode")&&!Tl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&gb(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!Ji(e,"bpmn:MessageEventDefinition"))}function hb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return de(t);if(M(t,"bpmn:Participant"))return de(t).processRef}return null}function mb(e,t){var n=hb(e),i=hb(t);return n===i}function Ji(e,t){var n=de(e);return!!Tt(n.eventDefinitions||[],function(i){return M(i,t)})}function gb(e,t){var n=de(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function dk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!Fn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&Ji(e,"bpmn:LinkEventDefinition"))&&!db(e)&&!Tl(e)}function hk(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!Fn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&Ji(e,"bpmn:LinkEventDefinition"))&&!Tl(e)}function mk(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(Ji(e,"bpmn:MessageEventDefinition")||Ji(e,"bpmn:TimerEventDefinition")||Ji(e,"bpmn:ConditionalEventDefinition")||Ji(e,"bpmn:SignalEventDefinition"))}function gk(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function yb(e,t){var n=gk(t);return n.indexOf(e)!==-1}function kl(e,t,n){if(yd(e)||yd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Mb(e,t))return{type:"bpmn:MessageFlow"};if(Ab(e,t))return{type:"bpmn:SequenceFlow"}}var i=wd(e,t);return i||(Cb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Rb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function xa(e,t){return Je(e)||bd(e)?!0:M(t,"bpmn:Participant")&&!at(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):tt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!yk(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?at(t):tt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Rr(de(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function yk(e){return de(e).cancelActivity&&(bb(e)||xb(e))}function vb(e){return!Je(e)&&M(e,"bpmn:BoundaryEvent")}function vk(e){return M(e,"bpmn:Lane")}function bk(e){return vb(e)||M(e,"bpmn:IntermediateThrowEvent")&&bb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&xb(e)}function bb(e){var t=de(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function xb(e){return wb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function wb(e,t){return t.some(function(n){return Ji(e,n)})}function xk(e){return M(e,"bpmn:ReceiveTask")&&Tt(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function _s(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Je(r)||!bk(r)||Fn(t)||!M(t,"bpmn:Activity")||Tl(t)||i&&!pb(i,t)||xk(t)?!1:"attach"}function _b(e,t,n){if(!t)return!1;var i={replacements:[]};return H(e,function(r){Fn(t)||M(r,"bpmn:StartEvent")&&r.type!=="label"&&xa(r,t)&&(PA(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(TA(r)||kA(r)||OA(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),wb(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||Ji(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(M(r,"bpmn:EndEvent")&&xa(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),M(r,"bpmn:BoundaryEvent")&&_s(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Eb(e,t){return Rr(e,vk)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return xa(n,t)})}function xd(e,t,n,i){return t?Je(e)||bd(e)?!0:xa(e,t)||Ol(e,t):!1}function Sb(e,t,n){return M(e,"bpmn:SubProcess")?at(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:vd(e)?n?n==="e"||n==="w":!0:bd(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function wk(e,t){var n=vd(e),i=vd(t);return(n||i)&&n!==i}function Rb(e,t){return yb(t,e)||yb(e,t)?!1:wk(e,t)?!0:!!wd(e,t)}function Cb(e,t){return mb(e,t)&&db(e)&&M(t,"bpmn:Activity")&&!Ek(t,e)&&!Fn(t)}function Mb(e,t){return kb(e)&&!kb(t)?!1:pk(e)&&fk(t)&&!uk(e,t)}function Ab(e,t){return dk(e)&&hk(t)&&mb(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!mk(t))}function wd(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Ol(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:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&xa(e,t.parent)}function _d(e,t){return e&&t&&e.indexOf(t)!==-1}function Pb(e,t){return Je(t)?!0:!(M(t,"bpmn:Lane")&&!_d(e,t.parent)||M(t,"bpmn:MessageFlow")&&!_k(e,t))}function _k(e,t){var n=Tb(t.source),i=Tb(t.target);return _d(e,n)&&_d(e,i)}function Tb(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function kb(e){return da(e,"bpmn:Process")||da(e,"bpmn:Collaboration")}function Ek(e,t){return e.attachers.includes(t)}const Sk={__depends__:[Qi],__init__:["bpmnRules"],bpmnRules:["type",On]};var Rk=2e3;function Ob(e,t){e.on("saveXML.start",Rk,n);function n(){var i=t.getRootElements();H(i,function(r){var o=ut(r),a,s;a=os([r]),a=it(a,function(c){return c!==r&&!c.labelTarget}),s=Ln(a,ut),o.set("planeElement",s)})}}Ob.$inject=["eventBus","canvas"];const Ck={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Ob]};function Dl(e){pe.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)})}Dl.prototype.getOrdering=function(e,t){return null},Re(Dl,pe);function Ed(e,t){Dl.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=Tt(n,function(c){return tt(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 l=s;l&&!tt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(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 l=s.children.indexOf(a),u=lm(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Ed.$inject=["eventBus","canvas"],Re(Ed,Dl);const Mk={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Ed]};function Es(){}Es.prototype.get=function(){return this._data},Es.prototype.set=function(e){this._data=e},Es.prototype.clear=function(){var e=this._data;return delete this._data,e},Es.prototype.isEmpty=function(){return!this._data};const Ak={clipboard:["type",Es]};var Db=1500;function Lb(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),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Db,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Db,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=_o(a),c=document.elementFromPoint(s.x,s.y),Pk(c)}}Lb.$inject=["elementRegistry","eventBus","injector"];function Pk(e){return go(e,"svg, .djs-element",!0)}const Tk={__init__:["hoverFix"],hoverFix:["type",Lb]};function kk(e){return!0}function Ll(e){return Hr(e)||BT(e)}var Ib=500;function Bb(e,t,n){var i=this;function r(k,$,N){if(!s(k,$)){var L,z,X;N?z=t.getGraphics(N):(L=$.delegateTarget||$.target,L&&(z=L,N=t.get(z))),!(!z||!N)&&(X=e.fire(k,{element:N,gfx:z,originalEvent:$}),X===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(k){return o[k]}function s(k,$){var N=l[k]||Hr;return!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"},l={"element.contextmenu":kk,"element.mousedown":Ll,"element.mouseup":Ll,"element.click":Ll,"element.dblclick":Ll};function u(k,$,N){var L=c[k];if(!L)throw new Error("unmapped DOM event name <"+k+">");return r(L,$,N)}var p="svg, .djs-element";function f(k,$,N,L){var z=o[N]=function(X){r(N,X)};L&&(l[N]=L),z.$delegate=Qn.bind(k,p,$,z)}function d(k,$,N){var L=a(N);L&&Qn.unbind(k,$,L.$delegate)}function g(k){H(c,function($,N){f(k,N,$)})}function h(k){H(c,function($,N){d(k,N,$)})}e.on("canvas.destroy",function(k){h(k.svg)}),e.on("canvas.init",function(k){g(k.svg)}),e.on(["shape.added","connection.added"],function(k){var $=k.element,N=k.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:N})}),e.on(["shape.changed","connection.changed"],Ib,function(k){var $=k.element,N=k.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:N})}),e.on("interactionEvents.createHit",Ib,function(k){var $=k.element,N=k.gfx;i.createDefaultHit($,N)}),e.on("interactionEvents.updateHit",function(k){var $=k.element,N=k.gfx;i.updateDefaultHit($,N)});var y=w("djs-hit djs-hit-stroke"),C=w("djs-hit djs-hit-click-stroke"),x=w("djs-hit djs-hit-all"),m=w("djs-hit djs-hit-no-move"),v={all:x,"click-stroke":C,stroke:y,"no-move":m};function w(k,$){return $=q({stroke:"white",strokeWidth:15},$||{}),n.cls(k,["no-fill","no-border"],$)}function E(k,$){var N=v[$];if(!N)throw new Error("invalid hit type <"+$+">");return Ce(k,N),k}function P(k,$){Ve(k,$)}this.removeHits=function(k){var $=Wc(".djs-hit",k);H($,fn)},this.createDefaultHit=function(k,$){var N=k.waypoints,L=k.isFrame,z;return N?this.createWaypointsHit($,N):(z=L?"stroke":"all",this.createBoxHit($,z,{width:k.width,height:k.height}))},this.createWaypointsHit=function(k,$){var N=rs($);return E(N,"stroke"),P(k,N),N},this.createBoxHit=function(k,$,N){N=q({x:0,y:0},N);var L=Oe("rect");return E(L,$),Ce(L,N),P(k,L),L},this.updateDefaultHit=function(k,$){var N=Rt(".djs-hit",$);if(N)return k.waypoints?lf(N,k.waypoints):Ce(N,{width:k.width,height:k.height}),N},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Bb.$inject=["eventBus","elementRegistry","styles"];const Il={__init__:["interactionEvents"],interactionEvents:["type",Bb]};function wa(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)})}wa.$inject=["eventBus","canvas"],wa.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()})}},wa.prototype.get=function(){return Array.from(this._selectedElements)},wa.prototype.isSelected=function(e){return this._selectedElements.has(e)},wa.prototype.select=function(e,t){var n=this.get();Ne(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?H(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Nb="hover",$b="selected";function Fb(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,Nb)}),t.on("element.out",function(r){i(r.element,Nb)}),t.on("selection.changed",function(r){function o(l){i(l,$b)}function a(l){n(l,$b)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Fb.$inject=["canvas","eventBus"];function jb(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Ne(l)?t.select(l):t.select(s.filter(Ok))}}),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=Tt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Hr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Al(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}jb.$inject=["eventBus","selection","canvas","elementRegistry"];function Ok(e){return!e.hidden}const Si={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Il],selection:["type",wa],selectionVisuals:["type",Fb],selectionBehavior:["type",jb]};var Dk=/^djs-cursor-.*$/;function Bl(e){var t=Ht(document.body);t.removeMatching(Dk),e&&t.add("djs-cursor-"+e)}function Hb(){Bl(null)}var Lk=5e3;function zb(e,t){t=t||"element.click";function n(){return!1}return e.once(t,Lk,n),function(){e.off(t,n)}}var Ik=["c","C"],Bk=["v","V"],Nk=["d","D"],$k=["x","X"],Fk=["y","Y"],Gb=["z","Z"];function jk(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ti(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function dn(e,t){return e=Ne(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Sd(e){return e.shiftKey}function Hk(e){return ti(e)&&dn(Ik,e)}function zk(e){return ti(e)&&dn(Bk,e)}function Gk(e){return ti(e)&&dn(Nk,e)}function Vk(e){return ti(e)&&dn($k,e)}function Wk(e){return ti(e)&&!Sd(e)&&dn(Gb,e)}function Uk(e){return ti(e)&&(dn(Fk,e)||dn(Gb,e)&&Sd(e))}var _a=Math.round,Vb="djs-drag-active";function So(e){e.preventDefault()}function qk(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function Yk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Wb(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(m){var v=t.viewbox(),w=t._container.getBoundingClientRect();return{x:v.x+(m.x-w.left)/v.scale,y:v.y+(m.y-w.top)/v.scale}}function s(m,v){v=v||o;var w=e.createEvent(q({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,w)===!1?!1:e.fire(v.prefix+"."+m,w)}function c(m){var v=m.filter(function(w){return i.get(w.id)});v.length&&n.select(v)}function l(m,v){var w=o.payload,E=o.displacement,P=o.globalStart,k=_o(m),$=Ii(k,P),N=o.localStart,L=a(k),z=Ii(L,N);if(!o.active&&(v||Yk($)>o.threshold)){if(q(w,{x:_a(N.x+E.x),y:_a(N.y+E.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&Bl(o.cursor),t.addMarker(t.getRootElement(),Vb)}id(m),o.active&&(q(w,{x:_a(L.x+E.x),y:_a(L.y+E.y),dx:_a(z.x),dy:_a(z.y)},{originalEvent:m}),s("move"))}function u(m){var v,w=!0;o.active&&(m&&(o.payload.originalEvent=m,id(m)),w=s("end")),w===!1&&s("rejected"),v=C(w!==!0),s("ended",v)}function p(m){dn("Escape",m)&&(So(m),y())}function f(m){var v;o.active&&(v=zb(e),setTimeout(v,400),So(m)),u(m)}function d(m){l(m)}function g(m){var v=o.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(o){var w=o.active;w&&s("cancel"),v=C(m),w&&s("canceled",v)}}function C(m){var v,w;s("cleanup"),Hb(),o.trapClick?w=f:w=u,Ge.unbind(document,"mousemove",l),Ge.unbind(document,"dragstart",So),Ge.unbind(document,"selectstart",So),Ge.unbind(document,"mousedown",w,!0),Ge.unbind(document,"mouseup",w,!0),Ge.unbind(document,"keyup",p),Ge.unbind(document,"touchstart",d,!0),Ge.unbind(document,"touchcancel",y,!0),Ge.unbind(document,"touchmove",l,!0),Ge.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Vb);var E=o.payload.previousSelection;return m!==!1&&E&&!n.get().length&&c(E),v=o,o=null,v}function x(m,v,w,E){o&&y(!1),typeof v=="string"&&(E=w,w=v,v=null),E=q({},r,E||{});var P=E.data||{},k,$,N,L,z;if(E.trapClick?L=f:L=u,m?(k=ba(m)||m,$=_o(m),id(m),k.type==="dragstart"&&So(k)):(k=null,$={x:0,y:0}),N=a($),v||(v=N),z=qk(k),o=q({prefix:w,data:P,payload:{},globalStart:$,displacement:Ii(v,N),localStart:N,isTouch:z},E),E.manual||(z?(Ge.bind(document,"touchstart",d,!0),Ge.bind(document,"touchcancel",y,!0),Ge.bind(document,"touchmove",l,!0),Ge.bind(document,"touchend",u,!0)):(Ge.bind(document,"mousemove",l),Ge.bind(document,"dragstart",So),Ge.bind(document,"selectstart",So),Ge.bind(document,"mousedown",L,!0),Ge.bind(document,"mouseup",L,!0)),Ge.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;E.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=x,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(m){q(r,m)}}Wb.$inject=["eventBus","canvas","selection","elementRegistry"];const mr={__depends__:[Tk,Si],dragging:["type",Wb]};function Ea(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ea.prototype.next=function(){return this._prefix+ ++this._counter};const Kk=new Ea("ps");var Xk=["marker-start","marker-mid","marker-end"],Zk=["circle","ellipse","line","path","polygon","polyline","path","rect"];function zr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}zr.$inject=["elementRegistry","eventBus","canvas","styles"],zr.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")},zr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},zr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=ry(n);return this._cloneMarkers(bo(r),i),Ce(r,this._styles.cls(i,[])),Ve(t,r),Ce(r,"data-preview-support-element-id",e.id),r},zr.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ve(t,n),Ce(n,"data-preview-support-element-id",e.id),n},zr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),t2(e)&&Xk.forEach(function(r){if(Ce(e,r)){var o=Qk(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},zr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,Kk.next()].join("-"),a=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||ry(n);s.id=o,st(s).add(r);var c=Rt(":scope > defs",e);c||(c=Oe("defs"),Ve(e,c)),Ve(c,s);var l=e2(s.id);Ce(t,i,l)};function Qk(e,t,n){var i=Jk(Ce(e,t));return Rt("marker#"+i,n||document)}function Jk(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function e2(e){return"url(#"+e+")"}function t2(e){return Zk.indexOf(e.nodeName)!==-1}const Sa={__init__:["previewSupport"],previewSupport:["type",zr]};var n2="drop-ok",Ub="drop-not-ok",qb="attach-ok",Yb="new-parent",Kb="create",i2=2e3;function Xb(e,t,n,i,r){function o(c,l,u,p,f){if(!l)return!1;c=it(c,function(x){var m=x.labelTarget;return!x.parent&&!(Je(x)&&c.indexOf(m)!==-1)});var d=Tt(c,function(x){return!Mt(x)}),g=!1,h=!1,y=!1;Qb(c)&&(g=r.allowed("shape.attach",{position:u,shape:d,target:l})),g||(Qb(c)?y=r.allowed("shape.create",{position:u,shape:d,source:p,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var C=f.connectionTarget;return y||g?(d&&p&&(h=r.allowed("connection.create",{source:C===p?d:p,target:C===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[qb,n2,Ub,Yb].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Zb(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&o(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,qb):a(p,h?Yb:Ub))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,C=l.hints||{};if(g===!1||!d)return!1;Zb(c);var x={x:c.x,y:c.y};y?p=i.appendShape(u,p,x,d,{attach:h,connection:y===!0?{}:y,connectionTarget:C.connectionTarget}):(f=i.createElements(f,x,d,q({},C,{attach:h})),p=Tt(f,function(m){return!Mt(m)})),q(l,{elements:f,shape:p}),q(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Kb&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],i2,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ne(l)||(l=[l]);var p=Tt(l,function(g){return!Mt(g)});if(p){u=q({elements:l,hints:{},shape:p},u||{}),H(l,function(g){ze(g.x)||(g.x=0),ze(g.y)||(g.y=0)});var f=it(l,function(g){return!g.hidden}),d=rn(f);H(l,function(g){Mt(g)&&(g.waypoints=Ln(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),q(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Kb,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Xb.$inject=["canvas","dragging","eventBus","modeling","rules"];function Zb(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 Qb(e){return e&&e.length===1&&!Mt(e[0])}var r2=750;function Jb(e,t,n,i,r){function o(a){var s=Oe("g");Ce(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(bo(u),l)):(u=n._createContainer("shape",c),n.drawShape(bo(u),l),kn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",r2,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),Ve(p,u)),kn(u,a.x,a.y)):fn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&fn(c)})}Jb.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Nl={__depends__:[mr,Sa,Qi,Si],__init__:["create","createPreview"],create:["type",Xb],createPreview:["type",Jb]};function Rd(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)})}Rd.$inject=["eventBus"],Rd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||o2(0,0)};function o2(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 Ss={__init__:["mouse"],mouse:["type",Rd]};var ex=2e3;function ni(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 l=c.descriptor,u=c.element,p=c.elementsSet;l.priority=1,l.id=u.id,p.has(u.parent)&&(l.parent=u.parent.id),a2(u)&&(l.priority=2,l.host=u.host.id),Mt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=s2(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),H(["x","y","width","height"],function(f){ze(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",ex,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",ex,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;q(l,{createElementsBehavior:!1})})}ni.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ni.prototype.copy=function(e,t={}){var n,i;return Ne(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ne(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ni.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})}}},ni.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ni.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},ni.prototype._getElementIdsFromTree=function(e){var t={};return H(e,function(n){H(n,function(i){i.id&&(t[i.id]=!0)})}),t},ni.prototype._paste=function(e,t,n,i){H(e,function(o){ze(o.x)||(o.x=0),ze(o.y)||(o.y=0)});var r=rn(e);return H(e,function(o){Mt(o)&&(o.waypoints=Ln(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),q(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,q({},i))},ni.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return H(e,function(o,a){o=ji(o,"priority"),H(o,function(s){var c=q({},Hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Mt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Je(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},ni.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Hi(e,["id"]));return t},ni.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Hi(e,["id"]));return t},ni.prototype.createShape=function(e){var t=this._elementFactory.createShape(Hi(e,["id"]));return t},ni.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Mt(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},ni.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Kc(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=l(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}vo(a,function(p,f,d){if(Je(p))return;H(p.labels,function(y){c(y,d)});function g(y){y&&y.length&&H(y,function(C){H(C.labels,function(x){c(x,d)}),c(C,d)})}H([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=Ln(r,function(p){return p.element});var u=new Set(e);return r=Ln(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),r=ji(r,function(p){return p.descriptor.priority}),e=Ln(r,function(p){return p.element}),H(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){nx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){nx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function a2(e){return!!e.host}function s2(e){return Ln(e.waypoints,function(t){return t=tx(t),t.original&&(t.original=tx(t.original)),t})}function tx(e){return q({},e)}function nx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const c2={__depends__:[Ak,Nl,Ss,Qi],__init__:["copyPaste"],copyPaste:["type",ni]};function Cd(e,t,n){Ne(n)||(n=[n]),H(n,function(i){co(e[i])||(t[i]=e[i])})}var Md=750;function ix(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Md,function(c){var l=c.descriptor,u=c.element,p=de(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(ut(u),!0);d.bpmnElement=f,Cd(f,l,"name"),Cd(d,l,"isExpanded"),p.default&&(l.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var p=de(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(de(c).attachedToRef=de(l[c.host])),Hi(u,Zn(u,function(f,d,g){var h=d.element,y=d.property;return g===c.id&&(h.set(y,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Je(u)){u.businessObject=de(l[u.labelTarget]),u.di=ut(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Cd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Md,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=de(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&H(ps(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Md,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}ix.$inject=["bpmnFactory","eventBus","moddleCopy"];const l2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],u2=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Rs(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 ji(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=gn(r)&&r.$descriptor;if(a&&u2.includes(a))return o;if(a&&l2.includes(a)||a&&s&&!Tt(s.properties,Wo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(M(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Rs.$inject=["eventBus","bpmnFactory","moddle"],Rs.prototype.copyElement=function(e,t,n,i=!1){n&&!Ne(n)&&(n=[n]),n=n||Ad(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ne(r)&&(n=r),H(n,o=>{let a;Xn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!un(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Rs.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 gn(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):Ne(e)?Zn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):gn(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},Rs.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 Ad(e,t){return Zn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const rx={__depends__:[c2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",ix],moddleCopy:["type",Rs]};var ox=Math.round;function Pd(e,t){this._modeling=e,this._eventBus=t}Pd.$inject=["modeling","eventBus"],Pd.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,l=ox(s+o/2),u=ox(c+a/2),p=i.replaceShape(e,q({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function ax(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}ax.$inject=["selection","eventBus"];const p2={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",ax],replace:["type",Pd]};function f2(e,t,n){Ne(n)||(n=[n]),H(n,function(i){co(e[i])||(t[i]=e[i])})}var d2=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function h2(e,t){var n=e&&Xn(e,"collapsed")?e.collapsed:!at(e),i;return t&&(Xn(t,"collapsed")||Xn(t,"isExpanded"))?i=Xn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function sx(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if($l(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&h2(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),f2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Ad(p.$descriptor),h=Ad(f.$descriptor,!0),y=m2(g,h);q(f,Di(c,d2));var C=it(y,function(v){return v==="eventDefinitions"?cx(s,c.eventDefinitionType):v==="loopCharacteristics"?!Fn(f):Xn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!Fn(f):!0});if(f=n.copyElement(p,f,C),c.eventDefinitionType&&(cx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if($l(p))d.isExpanded=at(s);else if(c&&Xn(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}at(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if($l(p)&&!$l(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=xn(s);ut(s).isHorizontal||(ut(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?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,tt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(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,{...l,targetElement:c})}this.replaceElement=a}sx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function $l(e){return M(e,"bpmn:SubProcess")}function cx(e,t){var n=de(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function m2(e,t){return e.filter(function(n){return t.includes(n)})}const lx={__depends__:[rx,p2,Si],bpmnReplace:["type",sx]};var g2=250;function Ro(e){this._eventBus=e,this._tools=[],this._active=null}Ro.$inject=["eventBus"],Ro.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)},Ro.prototype.isActive=function(e){return e&&this._active===e},Ro.prototype.length=function(e){return this._tools.length},Ro.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Ro.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),H(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,g2,function(r){this._active&&(y2(r)||this.setActive(null))},this)};function y2(e){var t=e.originalEvent&&e.originalEvent.target;return t&&go(t,'.group[data-group="tools"]')}const Fl={__depends__:[mr],__init__:["toolManager"],toolManager:["type",Ro]};function v2(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 b2(e,t){var n=[],i=new Set(e);H(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;H(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function x2(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 Td=Math.abs,w2=Math.round,gr={x:"width",y:"height"},ux="crosshair",Gr={n:"top",w:"left",s:"bottom",e:"right"},_2=1500,jl={n:"s",w:"e",s:"n",e:"w"},Hl=20;function Ri(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",_2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&fx(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){fx(c);var h={x:0,y:0};h[u]=w2(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Ri.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ri.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:ux,data:{context:{reactivate:n}},trapClick:!1})},Ri.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:ux,data:{context:{}}})},Ri.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Ri.prototype.init=function(e,t){var n=Td(e.dx)>Td(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Td(i)<5)return!1;i<0&&(i*=-1),ws(e)&&(i*=-1);var o=v2(n,i),a=this._canvas.getRootElement();!Al(e)&&e.hover&&(a=e.hover);var s=[...os(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=E2(c,n,o,r,l);return q(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Bl("resize-"+(n==="x"?"ew":"ns")),!0},Ri.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];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 H(e,function(d){if(!(!d.parent||Je(d))){if(Mt(d)){u.push(d);return}var g=d[t],h=g+d[gr[t]];if(S2(d)&&(n>0&&$e(d)[t]>i||n<0&&$e(d)[t]<i)){l.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}}}),H(o,function(d){var g=d.attachers;g&&H(g,function(h){p(h)})}),H(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),H(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:o,resizingShapes:a}},Ri.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ri.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function px(e){return{top:e.top-Hl,right:e.right+Hl,bottom:e.bottom+Hl,left:e.left-Hl}}function fx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ze(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ze(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ze(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ze(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function E2(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),p=new Set(a);return H(a,function(f){var d=f.attachers,g=f.children,h=Ie(f),y=it(g,function(z){return!Mt(z)&&!Je(z)&&!u.has(z)&&!p.has(z)}),C=it(g,function(z){return!Mt(z)&&!Je(z)&&u.has(z)}),x,m,v,w=[],E=[],P,k,$,N;y.length&&(m=px(Ie(rn(y))),x=i-h[Gr[n]]+m[Gr[n]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),C.length&&(v=px(Ie(rn(C))),x=i-v[Gr[jl[n]]]+h[Gr[jl[n]]],n==="n"?s.bottom=l=ze(l)?Math.min(l,x):x:n==="w"?s.right=l=ze(l)?Math.min(l,x):x:n==="s"?s.top=c=ze(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ze(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(z){u.has(z)?w.push(z):E.push(z)}),w.length&&(P=Ie(rn(w.map($e))),k=h[Gr[jl[n]]]-(P[Gr[jl[n]]]-i)),E.length&&($=Ie(rn(E.map($e))),N=$[Gr[n]]-(h[Gr[n]]-i)),n==="n"?(x=Math.min(k||1/0,N||1/0),s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=Math.min(k||1/0,N||1/0),s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=Math.max(k||-1/0,N||-1/0),s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(k||-1/0,N||-1/0),s.left=c=ze(c)?Math.max(c,x):x));var L=r&&r[f.id];L&&(n==="n"?(x=i+f[gr[t]]-L[gr[t]],s.bottom=l=ze(l)?Math.min(l,x):x):n==="w"?(x=i+f[gr[t]]-L[gr[t]],s.right=l=ze(l)?Math.min(l,x):x):n==="s"?(x=i-f[gr[t]]+L[gr[t]],s.top=c=ze(c)?Math.max(c,x):x):n==="e"&&(x=i-f[gr[t]]+L[gr[t]],s.left=c=ze(c)?Math.max(c,x):x))}),s}}function S2(e){return!!e.host}var kd="djs-dragging",dx="djs-resizing",R2=250,zl=Math.max;function hx(e,t,n,i,r){function o(a,s){H(a,function(c){r.addDragger(c,s),n.addMarker(c,kd)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");Ce(u,i.cls("djs-crosshair-group",["no-events"])),Ve(s,u);var p=Oe("path");Ce(p,"d",l.x),st(p).add("djs-crosshair"),Ve(u,p);var f=Oe("path");Ce(f,"d",l.y),st(f).add("djs-crosshair"),Ve(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;kn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&fn(c)}),e.on("spaceTool.move",R2,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),Ce(c,"d","M0,0 L0,0"),st(c).add("djs-crosshair"),Ve(f,c),s.line=c;var d=Oe("g");Ce(d,i.cls("djs-drag-group",["no-events"])),Ve(n.getActiveLayer(),d),o(u,d);var g=new Set(u);H(p,function(E){g.add(E)});var h=new Set,y=s.movingConnections=[];g.forEach(function(E){H(E.outgoing,function(P){h.has(P)||!Mt(P)||!g.has(P.target)||(h.add(P),y.push(P))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var C=Oe("g");Ce(C,i.cls("djs-frame-group",["no-events"])),Ve(n.getActiveLayer(),C);var x=[];H(p,function(E){var P=r.addFrame(E,C),k=P.getBBox();x.push({element:P,initialBounds:k}),n.addMarker(E,dx)}),s.frameGroup=C,s.frames=x}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Ce(c,{d:m[l]});var v={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[v[s.axis]]=0,kn(s.dragGroup,w.x,w.y),H(s.frames,function(E){var P=E.element,k=E.initialBounds,$,N;s.direction==="e"?Ce(P,{width:zl(k.width+w.x,5)}):($=zl(k.width-w.x,5),Ce(P,{width:$,x:k.x+k.width-$})),s.direction==="s"?Ce(P,{height:zl(k.height+w.y,5)}):(N=zl(k.height-w.y,5),Ce(P,{height:N,y:k.y+k.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;H(c,function(g){n.removeMarker(g,kd)}),H(l,function(g){n.removeMarker(g,kd)}),f&&(fn(p),fn(f)),H(u,function(g){n.removeMarker(g,dx)}),d&&fn(d)})}hx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const C2={__init__:["spaceToolPreview"],__depends__:[mr,Qi,Fl,Sa,Ss],spaceTool:["type",Ri],spaceToolPreview:["type",hx]};function Gl(e,t){e.invoke(Ri,this),this._canvas=t}Gl.$inject=["injector","canvas"],Re(Gl,Ri),Gl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Go(aa(r.children.filter(l=>M(l,"bpmn:Artifact")),rn(o))));const s=[...e,...a];var c=Ri.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||M2(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function M2(e){return M(e,"bpmn:Participant")&&!de(e).processRef}const mx={__depends__:[C2],spaceTool:["type",Gl]};function Vt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Vt.$inject=["eventBus","injector"],Vt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Vt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Vt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.register=function(e,t){this._setHandler(e,t)},Vt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Vt.prototype.canUndo=function(){return!!this._getUndoAction()},Vt.prototype.canRedo=function(){return!!this._getRedoAction()},Vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Vt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Vt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Vt.prototype._createId=function(){return this._uid++},Vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Vt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Vt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Vt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:um("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ne(e)?e:[e],t.dirty=t.dirty.concat(e))},Vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Vt.prototype._revertedAction=function(e){this._stackIdx--},Vt.prototype._getHandler=function(e){return this._handlerMap[e]},Vt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const A2={commandStack:["type",Vt]};function Vr(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 P2=250,gx=1400;function Od(e,t,n){pe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",gx,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=yx(a),o.validatedShapes=yx(s)}),i&&t.on("shape.move.start",P2,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",gx,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];H(s,function(l){H(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Vr(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=pf(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&&(tn(s.labels,a,c),a.labelTarget=s)})}Re(Od,pe),Od.$inject=["injector","eventBus","modeling"];function yx(e){var t=new Set(e);return it(e,function(n){return!t.has(n.labelTarget)})}const T2={__init__:["labelSupport"],labelSupport:["type",Od]};var k2=251,vx=1401,bx="attach-ok";function Dd(e,t,n,i,r){pe.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",vx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=O2(c),s.validatedShapes=D2(l)}),o&&t.on("shape.move.start",k2,function(a){var s=a.context,c=s.shapes,l=Ld(c);H(l,function(u){o.makeDraggable(s,u,!0),H(u.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 l=c[0],u=l.host;u&&(n.addMarker(u,bx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,bx)}))}}),this.preExecuted("elements.move",vx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Ld(l);H(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=it(c,function(p){var f=p.host;return L2(p)&&!I2(c,f)}),H(u,function(p){r.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;H(s,function(c){H(c.attachers,function(l){H(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)}),H(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Vr(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&H(l.attachers,function(u){var p=Nv(u,c,l);r.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&H(p,function(d){var g=Nv(d,l,u);r.moveShape(d,g,d.parent),H(d.labels,function(h){r.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Vr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}Re(Dd,pe),Dd.$inject=["injector","eventBus","canvas","rules","modeling"];function Ld(e){return sp(Ln(e,function(t){return t.attachers||[]}))}function O2(e){var t=Ld(e);return h1("id",e,t)}function D2(e){var t=Vo(e,"id");return it(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function L2(e){return!!e.host}function I2(e,t){return e.indexOf(t)!==-1}const B2={__depends__:[Qi],__init__:["attachSupport"],attachSupport:["type",Dd]};function xx(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(fy(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)})}xx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Id={__init__:["changeSupport"],changeSupport:["type",xx]};function Ci(e){this._model=e}Ci.$inject=["moddle"],Ci.prototype._needsId=function(e){return tt(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"])},Ci.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":tt(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))},Ci.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Ci.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Ci.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",q({bpmnElement:e,bounds:this.createDiBounds()},t))},Ci.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Ci.prototype.createDiWaypoints=function(e){var t=this;return Ln(e,function(n){return t.createDiWaypoint(n)})},Ci.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Di(e,["x","y"]))},Ci.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",q({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Ci.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",q({bpmnElement:e},t))};function ii(e,t,n){pe.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),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,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ri(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ri(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;H(y,function(C){M(C,"bpmn:BaseElement")&&i.updateParent(C)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],ri(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ri(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ri(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ri(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ri(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ri(u)),this.executed("connection.reconnect",ri(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=de(h),m=de(y),v=de(C);x.conditionExpression&&!tt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),y!==C&&m.default===x&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",ri(function(d){var g=d.context,h=g.connection,y=g.oldSource,C=g.newSource,x=de(h),m=de(y),v=de(C);g.oldConditionExpression&&(x.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],ri(p)),this.reverted(["element.updateAttachment"],ri(p)),this.executed("element.updateLabel",ri(f)),this.reverted("element.updateLabel",ri(f));function f(d){const{element:g}=d.context,h=mi(g),y=ut(g),C=y&&y.get("label");Nr(g)||Pl(g)||(h&&!C?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&C&&y.set("label",void 0))}}Re(ii,pe),ii.$inject=["eventBus","bpmnFactory","connectionDocking"],ii.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ii.prototype.updateParent=function(e,t){if(!Je(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ut(e),o=n&&n.businessObject,a=ut(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),M(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},ii.prototype.updateBounds=function(e){var t=ut(e),n=$2(e);if(n){var i=Ii(n,t.get("bounds"));q(n,{x:e.x+i.x,y:e.y+i.y})}var r=Je(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),q(o,{x:e.x,y:e.y,width:e.width,height:e.height})},ii.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),tn(r,e))}},ii.prototype.updateDiConnection=function(e,t,n){var i=ut(e),r=ut(t),o=ut(n);i.sourceElement&&i.sourceElement.bpmnElement!==de(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==de(n)&&(i.targetElement=n&&o)},ii.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function N2(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ii.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(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)},ii.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=N2(e.$parent||t),e.$parent&&(Zt(o.get("rootElements"),r),r.$parent=null),t&&(tn(o.get("rootElements"),r),r.$parent=o))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(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),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ii.prototype.updateConnectionWaypoints=function(e){var t=ut(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ii.prototype.updateConnection=function(e){var t=e.connection,n=de(t),i=t.source,r=de(i),o=t.target,a=de(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Zt(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)},ii.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ri(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function $2(e){if(M(e,"bpmn:Activity")){var t=ut(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Wr(e,t){pr.call(this),this._bpmnFactory=e,this._moddle=t}Re(Wr,pr),Wr.$inject=["bpmnFactory","moddle"],Wr.prototype._baseCreate=pr.prototype.create,Wr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,q({type:"label",di:n},xo,t))}return this.createElement(e,t)},Wr.prototype.createElement=function(e,t){t=q({},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(!j2(r)){var o=q({},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)}M(i,"bpmn:Group")&&(t=q({isFrame:!0},t)),t=F2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Bd(r,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Bd(r,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!at(i,r)),M(i,"bpmn:ExclusiveGateway")&&(Xn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),un(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),un(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=q({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Wr.prototype.getDefaultSize=function(e,t){var n=de(e);if(t=t||ut(e),M(n,"bpmn:SubProcess"))return at(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return at(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Wr.prototype.createParticipantShape=function(e){return gn(e)||(e={isExpanded:e}),e=q({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function F2(e,t,n){return H(n,function(i){t=Bd(e,t,i)}),t}function Bd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Hi(t,[n]))}function j2(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Vl(e,t){this._modeling=e,this._canvas=t}Vl.$inject=["modeling","canvas"],Vl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;H(n,function(r){var o={x:0,y:0};un(i.left)?o.x=i.left-r.x:un(i.right)?o.x=i.right-r.width-r.x:un(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:un(i.top)?o.y=i.top-r.y:un(i.bottom)?o.y=i.bottom-r.height-r.y:un(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Vl.prototype.postExecute=function(e){};function Wl(e){this._modeling=e}Wl.$inject=["modeling"],Wl.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},Wl.prototype.postExecute=function(e){var t=e.hints||{};H2(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 H2(e,t){return Rr(e.outgoing,function(n){return n.target===t})}function Ul(e,t){this._canvas=e,this._layouter=t}Ul.$inject=["canvas","layouter"],Ul.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},Ul.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ql=Math.round;function Nd(e){this._modeling=e}Nd.$inject=["modeling"],Nd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;H(t,function(p){ze(p.x)||(p.x=0),ze(p.y)||(p.y=0)});var s=it(t,function(p){return!p.hidden}),c=rn(s);H(t,function(p){Mt(p)&&(p.waypoints=Ln(p.waypoints,function(f){return{x:ql(f.x-c.x-c.width/2+r.x),y:ql(f.y-c.y-c.height/2+r.y)}})),q(p,{x:ql(p.x-c.x-c.width/2+r.x),y:ql(p.y-c.y-c.height/2+r.y)})});var l=new Set(Kc(t)),u={};H(t,function(p){if(Mt(p)){u[p.id]=ze(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,o):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,o);return}var f=q({},o);l.has(p)||(f.autoResize=!1),Je(p)&&(f=Hi(f,["attach"])),u[p.id]=ze(i)?a.createShape(p,Di(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Di(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Go(u)};var wx=Math.round;function Ur(e){this._canvas=e}Ur.$inject=["canvas"],Ur.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?q(t,n):q(t,{x:n.x-wx(t.width/2),y:n.y-wx(t.height/2)}),this._canvas.addShape(t,i,r),t},Ur.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Cs(e){Ur.call(this,e)}Re(Cs,Ur),Cs.$inject=["canvas"];var z2=Ur.prototype.execute;Cs.prototype.execute=function(e){var t=e.shape;return V2(t),t.labelTarget=e.labelTarget,z2.call(this,e)};var G2=Ur.prototype.revert;Cs.prototype.revert=function(e){return e.shape.labelTarget=null,G2.call(this,e)};function V2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Ms(e,t){this._canvas=e,this._modeling=t}Ms.$inject=["canvas","modeling"],Ms.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Vr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Vr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Ms.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=pf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Ms.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,tn(n.children,t,i),this._canvas.addConnection(t,n),t};function $d(e,t){this._modeling=e,this._elementRegistry=t}$d.$inject=["modeling","elementRegistry"],$d.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;H(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function As(e,t){this._canvas=e,this._modeling=t}As.$inject=["canvas","modeling"],As.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Vr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Vr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Vr(n.children,function(i){Mt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},As.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=pf(i.children,n),t.removeShape(n),n},As.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return tn(i.children,n,r),t.addShape(n,i),n};function Yl(e){this._modeling=e}Yl.$inject=["modeling"];var _x={x:"y",y:"x"};Yl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,C){y.range.min=Math.min(C[i],y.range.min),y.range.max=Math.max(C[i]+C[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,C){var x={y:0};x[i]=y-a(C),x[i]&&(x[_x[i]]=0,t.moveElements([C],x,C.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;H(n,function(y,C){var x,m,v;if(y.elements.length<2){C&&C!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}x=ji(y.elements,i),m=x[0],C===p&&(m=x[s(x)]),v=a(m),y.range=null,H(x,function(w){if(l(v,w),y.range===null){y.range={min:w[i],max:w[i]+w[r]};return}o(y,w)}),C&&C!==n.length-1&&(h+=c(y.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&H(n,function(y,C){var x={},m;y===u||y===f||(m=n[C-1],y.range.max=0,H(y.elements,function(v,w){x[_x[i]]=0,x[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(x[i]+=v[i]-y.range.min),x[i]&&t.moveElements([v],x,v.parent),y.range.max=Math.max(v[i]+v[r],w?y.range.max:0)}))})},Yl.prototype.postExecute=function(e){};function Kl(e,t){this._layouter=e,this._canvas=t}Kl.$inject=["layouter","canvas"],Kl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return q(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Kl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Fd(){}Fd.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=Zt(o.children,t),tn(i.children,t,r),t.parent=i,H(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},Fd.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Zt(n.children,t),tn(i.children,t,r),t.parent=i,H(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 jd(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}jd.prototype.add=function(e,t){return this.addAll([e],t)},jd.prototype.addAll=function(e,t){var n=xM(e,!!t,this);return q(this,n),this};function Ps(e){this._modeling=e}Ps.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ps.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),H(a,function(p){o.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),H(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,l[p.id]&&!u&&n):o.layoutConnection(p,{connectionStart:f&&qf(p,p.source,t),connectionEnd:d&&Yf(p,p.target,t)})})},Ps.prototype.getClosure=function(e){return new jd().addAll(e,!0)};function Xl(e){this._helper=new Ps(e)}Xl.$inject=["modeling"],Xl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Xl.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 Co(e){this._modeling=e,this._helper=new Ps(e)}Co.$inject=["modeling"],Co.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=Di(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Zt(o.children,t),tn(i.children,t,r),q(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Co.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(H(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Yf(o,t,n)})}),H(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:qf(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Co.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return tn(n.children,t,i),q(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Co.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Co.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ts(e){this._modeling=e}Ts.$inject=["modeling"],Ts.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 Ne(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},Ts.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||Ex(Ne(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Ex(Ne(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Ts.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 Ex(e){return e.original||e}function yr(e,t){this._modeling=e,this._rules=t}yr.$inject=["modeling","rules"],yr.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,y){return i.allowed("connection.reconnect",{connection:y,source:g,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,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();H(f,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,El(g,s,u),a)}),H(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,_l(g,s,u),a)})},yr.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},yr.prototype.execute=function(e){},yr.prototype.revert=function(e){},yr.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},yr.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},yr.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ks(e){this._modeling=e}ks.$inject=["modeling"],ks.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},q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ks.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(H(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:El(o,n,i)})}),H(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:_l(o,n,i)})}))},ks.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return q(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function qr(e){this._modeling=e}qr.$inject=["modeling"],qr.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),H(r,function(s){a[s.id]=U2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(b2(i,r),t,n,o,i,r,a)},qr.prototype.execute=function(){},qr.prototype.revert=function(){},qr.prototype.moveShapes=function(e,t){var n=this;H(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},qr.prototype.resizeShapes=function(e,t,n){var i=this;H(e,function(r){var o=x2(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},qr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);H(e,function(u){var p=u.source,f=u.target,d=W2(u),g=Rx(n),h={},y=c.has(p)||l.has(p),C=c.has(f)||l.has(f);y&&C?(d=Ln(d,function(x){return Cx(x,i,n)&&(x[g]=x[g]+t[g]),x.original&&Cx(x.original,i,n)&&(x.original[g]=x.original[g]+t[g]),x}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||C)&&(c.has(p)?h.connectionStart=qf(u,p,t):c.has(f)?h.connectionEnd=Yf(u,f,t):l.has(p)?h.connectionStart=_l(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=El(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Sx(e){return q({},e)}function W2(e){return Ln(e.waypoints,function(t){return t=Sx(t),t.original&&(t.original=Sx(t.original)),t})}function Rx(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Cx(e,t,n){var i=Rx(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function U2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Zl(e){this._modeling=e}Zl.$inject=["modeling"],Zl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Mx(n),t.collapsed=!t.collapsed;var i=Ax(n,t.collapsed);return[t].concat(i)},Zl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Px(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Mx(e){var t={};return H(e,function(n){t[n.id]=n.hidden,n.children&&(t=q({},t,Mx(n.children)))}),t}function Ax(e,t){var n=[];return H(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ax(i.children,i.collapsed||t)))}),n}function Px(e,t){var n=[];return H(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Px(i.children,t)))}),n}function Ql(e){this._modeling=e}Ql.$inject=["modeling"],Ql.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Tx(i,t),kx(n,t),t.host=n,t},Ql.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Tx(n,t),kx(i,t,r),t};function Tx(e,t){return Zt(e&&e.attachers,t)}function kx(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),tn(i,t,n)}}function Hd(){}Hd.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Hd.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function At(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}At.$inject=["eventBus","elementFactory","commandStack"],At.prototype.getHandlers=function(){return{"shape.append":Wl,"shape.create":Ur,"shape.delete":As,"shape.move":Co,"shape.resize":ks,"shape.replace":yr,"shape.toggleCollapse":Zl,spaceTool:qr,"label.create":Cs,"connection.create":Ul,"connection.delete":Ms,"connection.move":Fd,"connection.layout":Kl,"connection.updateWaypoints":Hd,"connection.reconnect":Ts,"elements.create":Nd,"elements.move":Xl,"elements.delete":$d,"elements.distribute":Yl,"elements.align":Vl,"element.updateAttachment":Ql}},At.prototype.registerHandlers=function(e){H(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},At.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)},At.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},At.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)},At.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)},At.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},At.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},At.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},At.prototype.createElements=function(e,t,n,i,r){Ne(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},At.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},At.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},At.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},At.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},At.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},At.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},At.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},At.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},At.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},At.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)},At.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},At.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)},At.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,q(i,{docking:"source"}))},At.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,q(i,{docking:"target"}))},At.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},At.prototype._create=function(e,t){return oA(t)?t:this._elementFactory.create(e,t)},At.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Os(e){this._elementRegistry=e}Os.$inject=["elementRegistry"],Os.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||q2(n,hc(i));return Ox(n,i),e.oldProperties=o,e.changed=r,r},Os.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Ox(n,t),i},Os.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?Y2(e,t):[]};function q2(e,t){return Zn(t,function(n,i){return n[i]=e.get(i),n},{})}function Ox(e,t){H(t,function(n,i){e.set(i,n)})}function Y2(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&de(n).dataObjectRef===e})}var Ds="default",vr="id",Dx="di",K2={width:0,height:0};function Ls(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ls.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ls.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=eO(e.properties),s=e.oldProperties||X2(t,a);return Lx(a,o)&&(r.unclaim(o[vr]),i.updateId(t,a[vr]),r.claim(a[vr],o)),Ds in a&&(a[Ds]&&n.push(i.get(a[Ds].id)),o[Ds]&&n.push(i.get(o[Ds].id))),Ix(t,a),e.oldProperties=s,e.changed=n,n},Ls.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&de(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,K2)}},Ls.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 Ix(t,i),Lx(n,r)&&(a.unclaim(n[vr]),o.updateId(t,i[vr]),a.claim(i[vr],r)),e.changed};function Lx(e,t){return vr in e&&e[vr]!==t[vr]}function X2(e,t){var n=hc(t),i=e.businessObject,r=ut(e);return Zn(n,function(o,a){return a!==Dx?o[a]=i.get(a):o[a]=Z2(r,hc(t.di)),o},{})}function Z2(e,t){return Zn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Ix(e,t){var n=e.businessObject,i=ut(e);H(t,function(r,o){o!==Dx?n.set(o,r):i&&Q2(i,r)})}function Q2(e,t){H(t,function(n,i){e.set(i,n)})}var J2=["default"];function eO(e){var t=q({},e);return J2.forEach(function(n){n in e&&(t[n]=de(t[n]))}),t}function Jl(e,t){this._canvas=e,this._modeling=t}Jl.$inject=["canvas","modeling"],Jl.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ut(r);return t.setRootElement(n),t.removeRootElement(r),tn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Jl.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ut(n);return t.setRootElement(r),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,tn(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function zd(e,t){this._modeling=e,this._spaceTool=t}zd.$inject=["modeling","spaceTool"],zd.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=_i(i),a=o===i,s=a?i:i.parent,c=Fr(s),l=xn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];vo(o,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:it(v.children,function(w){return w!==i})});var f,d,g,h,y;r==="top"?(f=-120,d=i.y,g=d+10,h="n",y="y"):r==="left"?(f=-120,d=i.x,g=d+10,h="w",y="x"):r==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",y="y"):r==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",y="x");var C=t.calculateAdjustments(p,y,f,g),x=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(C.movingShapes,C.resizingShapes,x,h,g);var m=l?{x:i.x+(a?wi:0),y:d-(r==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function Gd(e){this._modeling=e}Gd.$inject=["modeling"],Gd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Fr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<o?t.resizeShape(r[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Is(e,t){this._modeling=e,this._spaceTool=t}Is.$inject=["modeling","spaceTool"],Is.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Is.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=YP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Is.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ie(e),r=Ie(t),o=dv(r,i),a=_i(e),s=[],c=[];vo(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},p)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Bs="flowNodeRef",Vd="lanes";function eu(){}eu.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,p){var f=Ie(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var p=_i(u);return r[p.id]||(r[p.id]=yl(p)),r[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=_i(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(u){var p=u.businessObject,f=p.get(Vd),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Bs).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},eu.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(Vd);n.remove.forEach(function(o){Zt(r,o),Zt(o.get(Bs),i)}),n.add.forEach(function(o){tn(r,o),tn(o.get(Bs),i)})}),[]},eu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Vd);n.add.forEach(function(o){Zt(r,o),Zt(o.get(Bs),i)}),n.remove.forEach(function(o){tn(r,o),tn(o.get(Bs),i)})}),[]};var Wd="categoryValueRef";function Ns(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ns.$inject=["bpmnFactory","elementRegistry"],Ns.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,m,v){if(m){var w=a.get(x);w||(w={},a.set(x,w)),!(v&&w.present)&&(!v&&w.past||(v?w.present={categoryValue:m,root:Ud(x)}:w.past={categoryValue:m}))}}function c(x){r.set(x,de(x))}function l(){n.filter(function(x){return M(x,"bpmn:FlowElement")&&!Je(x)&&x.parent}).forEach(c)}function u(x){var m=de(x),v=m.get("categoryValueRef");return v||(v=cv(i,m),o.push(tO(x,v))),v}function p(x){return x.reduce(function(m,v){var w=Ud(v),E=m.get(w);return E||(E=[],m.set(w,E)),E.push(v),m},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(x){return M(x,"bpmn:Group")&&!Je(x)&&x.parent}).forEach(function(x){var m=de(x).get("categoryValueRef");if(!m){var v=Ud(x),w=f.get(v)||[],E=aa(w,x),P=Object.keys(E).length>0;P&&(m=u(x))}s(x,m,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(x,m){return m.present&&x.add(m.present.categoryValue),m.past&&x.add(m.past.categoryValue),x},new Set),h=new Map,y=p(d);a.forEach(function(x,m){var v=x.present;if(v){var w=y.get(v.root)||[],E=aa(w,m);w.forEach(function(P){if(E[P.id]){var k=h.get(P);k||(k=new Set,h.set(P,k)),k.add(v.categoryValue)}})}});var C=d.reduce(function(x,m){var v=r.get(m),w=v.get(Wd),E=new Set(w),P=h.get(m)||new Set,k=Array.from(P).filter(function(N){return!E.has(N)}),$=w.filter(function(N){return g.has(N)&&!P.has(N)});return(k.length||$.length)&&x.push({businessObject:v,categoryValuesToAdd:k,categoryValuesToRemove:$}),x},[]);return{flowElements:C,groups:o}},Ns.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),nO(t.groups),rO(t.flowElements),[]},Ns.prototype.revert=function(e){var t=e.updates;return oO(t.flowElements),iO(t.groups),[]};function tO(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function nO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function iO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=null})}function rO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Wd);t.categoryValuesToRemove.forEach(function(r){Zt(i,r)}),t.categoryValuesToAdd.forEach(function(r){tn(i,r,!0)})})}function oO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Wd);t.categoryValuesToAdd.forEach(function(r){Zt(i,r)}),t.categoryValuesToRemove.forEach(function(r){tn(i,r,!0)})})}function Ud(e){for(;e.parent;)e=e.parent;return e}function tu(e){this._moddle=e}tu.$inject=["moddle"],tu.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),[]},tu.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 aO={fill:void 0,stroke:void 0};function qd(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Kn(t)){var n=sO(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}qd.$inject=["commandStack"],qd.prototype.postExecute=function(e){var t=e.elements,n=e.colors||aO,i=this,r={};"fill"in n&&q(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&q(r,{"border-color":this._normalizeColor(n.stroke)}),H(t,function(o){var a=Mt(o)?Di(r,["border-color"]):r,s=ut(o);if(cO(a),Je(o)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function sO(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 cO(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var lO={width:0,height:0};function Bx(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return NA(u,l),[u,p]}function r(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Je(l)&&Nr(l)&&!rl(l)&&!Nx(p)){var f=7,d=yf(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=mi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Je(u)&&!M(u,"bpmn:TextAnnotation"))){if(Je(u)&&Nx(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=mi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,lO)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Bx.$inject=["modeling","textRenderer","bpmnFactory"];function Nx(e){return!e||!e.trim()}function Dn(e,t,n,i){At.call(this,e,t,n),this._bpmnRules=i}Re(Dn,At),Dn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Dn.prototype.getHandlers=function(){var e=At.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Os,e["element.updateProperties"]=Ls,e["canvas.updateRoot"]=Jl,e["lane.add"]=zd,e["lane.resize"]=Is,e["lane.split"]=Gd,e["lane.updateRefs"]=eu,e["group.updateRefs"]=Ns,e["id.updateClaim"]=tu,e["element.setColor"]=qd,e["element.updateLabel"]=Bx,e},Dn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Dn.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)},Dn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Dn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Dn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Dn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Dn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Dn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Dn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Dn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Dn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Dn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Dn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Dn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function $x(){}$x.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||$e(t.source||e.source),t.connectionEnd||$e(t.target||e.target)]};var nu=20,uO=5,iu=Math.round,Fx=20,pO={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function fO(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function dO(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function jx(e,t,n){var i=Tn(t,e,uO),r=n.split(":")[0],o=iu((t.x-e.x)/2+e.x),a=iu((t.y-e.y)/2+e.y),s,c,l=dO(r,i),u=/h|r|l/.test(r),p=!1,f=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=fO(i,r),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+nu*(/l/.test(r)?-1:1),y:f?a+nu:a}):(f=o===e.x,s={x:f?o+nu:o,y:e.y+nu*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Yd(e,s,c).concat(s),directions:c,turnNextDirections:f}}function hO(e,t,n){return jx(e,t,n)}function mO(e,t,n){var i=jx(t,e,Hx(n));return{waypoints:i.waypoints.slice().reverse(),directions:Hx(i.directions),turnNextDirections:i.turnNextDirections}}function gO(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=Yd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Hx(e){return e.split(":").reverse().join(":")}function yO(e,t,n){var i=iu((t.x-e.x)/2+e.x),r=iu((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 Yd(e,t,n){if(n=n||"h:h",!CO(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Gx(n)){var i=hO(e,t,n),r=mO(e,t,n),o=gO(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return yO(e,t,n)}function vO(e,t,n){var i=Yd(e,t,n);return i.unshift(e),i.push(t),Wx(i)}function bO(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=f1(o,"straight")[0]||"h:h",s=pO[a]||0,c=Tn(e,t,s),l=RO(c,a);n=n||$e(e),i=i||$e(t);var u=l.split(":"),p=Vx(n,e,u[0],MO(c)),f=Vx(i,t,u[1],c);return vO(p,f,l)}function xO(e,t,n,i,r,o){Ne(n)&&(r=n,o=i,n=$e(e),i=$e(t)),o=q({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&_O(e,t,n,i,o),c||(c=o.connectionEnd&&SO(t,e,i,r),c)||(c=o.connectionStart&&EO(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:bO(e,t,n,i,o)}function wO(e,t,n){return e>=t&&e<=n}function zx(e,t,n){var i={x:"width",y:"height"};return wO(t[e],n[e],n[e]+n[i[e]])}function _O(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"?zx(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:zx(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 EO(e,t,n,i){return Kd(e,t,n,i)}function SO(e,t,n,i){var r=i.slice().reverse();return r=Kd(e,t,n,r),r?r.reverse():null}function Kd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!Tt(u,function(p,f){var d=u[f-1];return d&&ss(p,d)<3})}function o(u,p,f){var d=lr(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(hy(u[d],p,Fx)||hy(u[d],f,Fx))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Kd(e,t,n,l)),c&&lr(c)?null:c}function RO(e,t){if(Gx(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 CO(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Gx(e){return e&&/t|r|b|l/.test(e)}function MO(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 Vx(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 Wx(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return ff(r,o,n,0)||t.push(n),t},[])}var AO=-10,PO=40,TO={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},kO={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},Xd={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},$s={top:"t",right:"r",bottom:"b",left:"l"};function ru(e){this._elementRegistry=e}Re(ru,$x),ru.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,l;if(o||(o=Ux(r&&r[0],n)),a||(a=Ux(r&&r[r.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&r&&!qx(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=rv(n,s)?TO:kO;return M(e,"bpmn:MessageFlow")?c=DO(n,i,u):(M(e,"bpmn:SequenceFlow")||qx(n,i))&&(n===i?c={preferredLayouts:FO(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:jO(n,i,a,u)}:Fs(n)||Fs(i)?c={preferredLayouts:u.subProcess,preserveDocking:IO(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=q(c,t),l=Wx(xO(n,i,o,a,r,c))),l||[o,a]};function OO(e){var t=e.host;return Tn($e(e),t,AO)}function DO(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:LO(e,t)}}function LO(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Fs(t)?"source":Fs(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function IO(e){return Fs(e)?"target":"source"}function Ux(e,t){return e?e.original||e:$e(t)}function qx(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Fs(e){return M(e,"bpmn:SubProcess")&&at(e)}function Mo(e,t){return e===t}function BO(e,t){return t.indexOf(e)!==-1}function Ra(e){var t=/right|left/.exec(e);return t&&t[0]}function Ca(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Yx(e,t){return Xd[e]===t}function NO(e,t){var n=Ra(e),i=Xd[n];return t.indexOf(i)!==-1}function $O(e,t){var n=Ca(e),i=Xd[n];return t.indexOf(i)!==-1}function Kx(e){return e==="right"||e==="left"}function FO(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 jO(e,t,n,i){var r=$e(e),o=$e(t),a=OO(e),s,c,l=Mo(e.host,t),u=BO(a,["top","right","bottom","left"]),p=Tn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?HO(a,u,e,t,n,i):(s=zO(a,p,u,i.isHorizontal),c=GO(a,p,u,i.isHorizontal),[s+":"+c])}function HO(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ca(e):Ra(e),s=$s[a],c;return t?Kx(e)?c=Xx("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Xx("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Xx(e,t,n,i){var r=PO;return!(Zd(e,i,n,r)||Zd(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Zd(e,i,$e(t),r))}function Zd(e,t,n,i){return Math.abs(t[e]-n[e])<i}function zO(e,t,n,i){if(n)return $s[e];var r=Ca(e),o=Ra(e),a=Ca(t),s=Ra(t);if(i){if(Mo(r,a)||Yx(o,s))return $s[r]}else if(Mo(o,s)||Yx(r,a))return $s[o];return $s[i?o:r]}function GO(e,t,n,i){if(n)return Kx(e)?NO(e,t)||Mo(e,t)?"h":"v":$O(e,t)||Mo(e,t)?"v":"h";var r=Ca(e),o=Ra(e),a=Ca(t),s=Ra(t);return a&&!s?"v":s&&!a?"h":i?Mo(r,a)?"h":"v":Mo(o,s)?"v":"h"}ru.$inject=["elementRegistry"];function Zx(e){return q({original:e.point.original||e.point},e.actual)}function Yr(e,t){this._elementRegistry=e,this._graphicsFactory=t}Yr.$inject=["elementRegistry","graphicsFactory"],Yr.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(Zx(i)),o.push(Zx(r)),o},Yr.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}},Yr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return cs(i,r,n)},Yr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Yr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Yr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Qd={__init__:["modeling","bpmnUpdater"],__depends__:[ck,Sk,Ck,Mk,lx,A2,T2,B2,Si,Id,mx],bpmnFactory:["type",Ci],bpmnUpdater:["type",ii],elementFactory:["type",Wr],modeling:["type",Dn],layouter:["type",ru],connectionDocking:["type",Yr]};var VO=10,Qx=50,WO=250;function Jd(e,t,n,i){for(var r;r=UO(e,n,t);)n=i(t,n,r);return n}function eh(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,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function UO(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=YO(e);return Tt(r,function(o){if(o===n)return!1;var a=Tn(o,i,VO);return a==="intersect"})}function qO(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||Qx,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||WO,c=t.reference||"start";o||(o=ZO);function l(g,h){return r==="n"?c==="start"?Ie(g).top-Ie(h).bottom:c==="center"?Ie(g).top-$e(h).y:Ie(g).top-Ie(h).top:r==="w"?c==="start"?Ie(g).left-Ie(h).right:c==="center"?Ie(g).left-$e(h).x:Ie(g).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(g).bottom:c==="center"?$e(h).y-Ie(g).bottom:Ie(h).bottom-Ie(g).bottom:c==="start"?Ie(h).left-Ie(g).right:c==="center"?$e(h).x-Ie(g).right:Ie(h).right-Ie(g).right}var u=e.incoming.filter(o).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),p=e.outgoing.filter(o).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Zn(f,function(g,h){var y=h.distance,C=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*C,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function YO(e){var t=th(e);return e.host&&(t=t.concat(th(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(th(i))},[]))),t}function th(e){return XO(e).concat(KO(e))}function KO(e){return e.incoming.map(function(t){return t.source})}function XO(e){return e.outgoing.map(function(t){return t.target})}function ZO(){return!0}var QO=100;function Jx(e,t,n){e.on("autoPlace",QO,function(i){var r=i.shape,o=i.source;return JO(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}}Jx.$inject=["eventBus","modeling","canvas"];function JO(e,t,n){n||(n={});var i=n.defaultDistance||Qx,r=$e(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function ew(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}ew.$inject=["eventBus","selection"];const eD={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Jx],autoPlaceSelectionBehavior:["type",ew]};function tw(e,t,n){var i=rv(e,n);if(M(t,"bpmn:TextAnnotation"))return nD(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return iD(e,t,i);if(M(t,"bpmn:FlowNode"))return tD(e,t,i)}function tD(e,t,n){var i=Ie(e),r=$e(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=qO(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=Tn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+nw(l,c,o)}:{x:r.x+nw(l,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Jd(e,t,u,eh(f))}function nw(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function nD(e,t,n){var i=Ie(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};Mt(e)&&(r=$e(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Jd(e,t,r,eh(a))}function iD(e,t,n){var i=Ie(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 Jd(e,t,r,eh(a))}function iw(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return tw(r,i,t)})}iw.$inject=["eventBus","elementRegistry"];const ou={__depends__:[eD],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",iw]},rw=[nv,hs,Qd,ou,yp];function rD(e={}){Lm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new la({container:t,moddleExtensions:e.moddleExtensions??_c,additionalModules:[...rw,...e.additionalModules??[]]})}const ow={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","label-over-shape":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},oD={이:["이","가"],을:["을","를"],와:["과","와"]};function aD(e,t){const[n,i]=oD[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const sD={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},cD="요소";function nh(e){return(e&&sD[e.type])??cD}const aw=20;function lD(e){const t=e.replace(/\s+/g," ").trim();return t.length>aw?`${t.slice(0,aw)}…`:t}function au(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:lD(r.name),a=o===void 0?i+nh(r):o,s=o===void 0?a:`「${o}」`;return n?s+aD(a,n).slice(a.length):s}function uD(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&nh(o)===nh(a);return[au(e,t,i),au(e,n,r,s?"다른 ":"")]}function pD(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function fD(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"label-over-shape":return[e.edge,e.shape];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const su={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function dD(e,t){const n=(r,o)=>au(t,r,o),i=(r,o,a,s)=>uD(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${su[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${su[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${su[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${su[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}px 나란히 흘러 테두리와 구분되지 않습니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function hD(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${au(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const sw="기타",ih={error:0,warning:1,info:2};function cw(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${pt(i)}`,source:"geometry",code:i.kind,severity:pD(i),targetRefs:fD(i),category:ow[i.kind]??sw,message:dD(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:ow[i.ruleId]??sw,message:hD(i,t)});return n}function lw(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ma(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function rh(e,t){if(t===void 0||e.length===0)return!1;const n=Ma(e[0],t);return e.some(i=>Ma(i,t)!==n)}function uw(e,t){const n=rh(e,t);return e.slice().sort((i,r)=>(n?Number(Ma(r,t))-Number(Ma(i,t)):0)||ih[i.severity]-ih[r.severity])}const pw="i18n-untranslated",fw="i18n-review-requested",dw=[["untranslated",pw],["reviewRequested",fw]];class oh{constructor(t,n,i,r,o,a,s,c){gi(this,"config");gi(this,"displayLocale");this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=r.drawShape.bind(r);r.drawShape=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=o.activate.bind(o);o.activate=f=>this.withDisplayText(f,()=>u(f));const p=o.update.bind(o);o.update=(f,d,g,h)=>{const y=this.resolve(f);if(!y||y.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(gc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(gc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,r,o;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((r=n==null?void 0:n.get)==null?void 0:r.call(n,"xml:lang"))??((o=n==null?void 0:n.$attrs)==null?void 0:o["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=uo(n);if(!i)return;const r=this.displayLocale,o=i.target[i.key]??"",a=qo(n).filter(f=>In(f)),s=f=>f.body??"",c=a.find(f=>In(f)===r&&s(f)),l=Cr(n).some(f=>f.locale===r)?"reviewRequested":"ok";if(!o)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===o).map(In);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(r)?{text:o,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:o,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var o;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let r=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((o=this.resolve(a))==null?void 0:o.status)===n&&r++}finally{this.displayLocale=i}return r}withDisplayText(t,n,i){var f;if(!this.config)return n();const r=this.resolve(t),o=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(o)for(const[d,g]of dw)o.toggle(g,(r==null?void 0:r.status)===d);if(!r||r.native)return n();const{target:a,key:s}=uo((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===r.text)return n();a[s]=r.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,r.text):void 0;try{const d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:r}=t,o=this.textRenderer.getExternalLabelBounds(t,n);return t.width=o.width,t.height=o.height,{dx:(i-o.width)/2,restore:()=>(t.width=i,t.height=r)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,r]of dw)i.classList.remove(r);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}}}gi(oh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const hw={__depends__:[yp],__init__:["i18nDisplay"],i18nDisplay:["type",oh]};var mD=new Ea("ov"),gD=500;function En(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=mD,this._overlayDefaults=q({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=yD(n.getContainer()),this._init()}En.$inject=["config.overlays","eventBus","canvas","elementRegistry"],En.prototype.get=function(e){if(Kn(e)&&(e={id:e}),Kn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?it(t.overlays,Wo({type:e.type})):t.overlays.slice():[]}else return e.type?it(this._overlays,Wo({type:e.type})):e.id?this._overlays[e.id]:null},En.prototype.add=function(e,t,n){if(gn(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=q({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},En.prototype.remove=function(e){var t=this.get(e)||[];Ne(t)||(t=[t]);var n=this;H(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Ui(i.html),Ui(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)}})},En.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},En.prototype.show=function(){cu(this._overlayRoot)},En.prototype.hide=function(){cu(this._overlayRoot,!1)},En.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Gc(this._overlayRoot)},En.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=rn(t);i=o.x,r=o.y}mw(n,i,r),Nn(e.html,"data-container-id",t.id)},En.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=rn(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=rn(i).height:s=i.height,o=t.bottom*-1+s}mw(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},En.prototype._createOverlayContainer=function(e){var t=Bt('<div class="djs-overlays" />');Hn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},En.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";gw(this._overlayRoot,n)},En.prototype._getOverlayContainer=function(e,t){var n=Tt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},En.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)),Kn(i)&&(i=Bt(i)),o=this._getOverlayContainer(n),r=Bt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Hn(r,{position:"absolute"}),r.appendChild(i),e.type&&Ht(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();cu(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())},En.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&&(un(r)&&r>t.scale||un(o)&&o<t.scale))&&(c=!1),cu(a,c),this._updateOverlayScale(e,t)},En.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),un(i)&&t.scale<i&&(a=(1/t.scale||1)*i),un(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),un(a)&&(s="scale("+a+","+a+")"),gw(o,s)},En.prototype._updateOverlaysVisibilty=function(e){var t=this;H(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},En.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});H(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Ui(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",gD,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(H(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Ht(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function yD(e){var t=Bt('<div class="djs-overlay-container" />');return Hn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function mw(e,t,n){Hn(e,{left:t+"px",top:n+"px"})}function cu(e,t){e.style.display=t===!1?"none":""}function gw(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const lu={__init__:["overlays"],overlays:["type",En]};function ah(e,t){t.invoke(pe,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)})}Re(ah,pe),ah.$inject=["canvas","injector"];const vD={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ah]};function js(e){return CSS.escape(e)}var bD={"&":"&","<":"<",">":">",'"':""","'":"'"};function yw(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return bD[t]})}var xD="bjs-breadcrumbs-shown";function vw(e,t,n){var i=Bt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ht(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=de(l),p=Tt(a,function(f){return f===u});p&&s()});function s(c){c&&(a=wD(c));var l=a.flatMap(function(p){var f=n.findRoot(Zi(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(y){var C=de(y);return C&&C.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=yw(p.name||p.id),h=Bt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;o.toggle(xD,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}vw.$inject=["eventBus","elementRegistry","canvas"];function wD(e){for(var t=de(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function bw(e,t){var n=null,i=new _D;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,!(!M(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}bw.$inject=["eventBus","canvas"];function _D(){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 xw={x:180,y:160};function Ao(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Ao.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)})}},Ao.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;M(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),SD(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},Ao.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=ED(e),i={x:n.x-xw.x,y:n.y-xw.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)})},Ao.prototype._moveToDiPlane=function(e,t){var n=ww(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Ao.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},Ao.$inject=["eventBus","moddle"];function ww(e){return M(e,"bpmndi:BPMNDiagram")?e:ww(e.$parent)}function ED(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=Ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Qc(t)}function SD(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var uu=250,RD='<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>',CD="bjs-drilldown-empty";function Kr(e,t,n,i,r){pe.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",uu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",uu,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],uu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],uu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}Re(Kr,pe),Kr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Kr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(Zi(e))},Kr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=de(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ht(i.html).toggle(CD,!r)}},Kr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=de(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Bt('<button type="button" class="bjs-drilldown">'+RD+"</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(Zi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Kr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Kr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const MD={__depends__:[lu,Id,vD],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",vw],drilldownCentering:["type",bw],drilldownOverlayBehavior:["type",Kr],subprocessCompatibility:["type",Ao]};function Xr(e){Gt.call(this,e)}Re(Xr,Gt),Xr.prototype._modules=[nv,MD,lu,Si,hs],Xr.prototype._moddleExtensions={};var pu="keyboard.keydown",AD="keyboard.keyup",PD=1e3,_w="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 zn(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(_w));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}zn.$inject=["config.keyboard","eventBus"],zn.prototype._keydownHandler=function(e){this._keyHandler(e,pu)},zn.prototype._keyupHandler=function(e){this._keyHandler(e,AD)},zn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||pu,i),n&&e.preventDefault()}},zn.prototype._isEventIgnored=function(e){return!1},zn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(_w)),this.unbind(),e=this._node=this._target,Ge.bind(e,"keydown",this._keydownHandler),Ge.bind(e,"keyup",this._keyupHandler),this._fire("bind")},zn.prototype.getBinding=function(){return this._node},zn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ge.unbind(e,"keydown",this._keydownHandler),Ge.unbind(e,"keyup",this._keyupHandler)),this._node=null},zn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},zn.prototype.addListener=function(e,t,n){yn(e)&&(n=t,t=e,e=PD),this._eventBus.on(n||pu,e,t)},zn.prototype.removeListener=function(e,t){this._eventBus.off(t||pu,e)},zn.prototype.hasModifier=jk,zn.prototype.isCmd=ti,zn.prototype.isShift=Sd,zn.prototype.isKey=dn;var TD=500;function Aa(e,t){var n=this;e.on("editorActions.init",TD,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Aa.$inject=["eventBus","keyboard"],Aa.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(Wk(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(Uk(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(Hk(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(zk(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(Gk(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(Vk(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(dn(["+","Add","="],r)&&ti(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(dn(["-","Subtract"],r)&&ti(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(dn("0",r)&&ti(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(dn(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const sh={__init__:["keyboard","keyboardBindings"],keyboard:["type",zn],keyboardBindings:["type",Aa]};var kD={moveSpeed:50,moveSpeedAccelerated:200};function Ew(e,t,n){var i=this;this._config=q({},kD,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,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}Ew.$inject=["config.keyboardMove","keyboard","canvas"];const Sw={__depends__:[sh],__init__:["keyboardMove"],keyboardMove:["type",Ew]};var OD=15;function Rw(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,l=n.button,u=_o(s),p=Ii(u,c);if(!n.dragging&&DD(p)>OD&&(n.dragging=!0,l===0&&zb(e),Bl("grab")),n.dragging){var f=n.last||n.start;p=Ii(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function o(s){Ge.unbind(document,"mousemove",r),Ge.unbind(document,"mouseup",o),n=null,Hb()}function a(s){if(!go(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:_o(s)},Ge.bind(document,"mousemove",r),Ge.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Rw.$inject=["eventBus","canvas"];function DD(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Cw={__init__:["moveCanvas"],moveCanvas:["type",Rw]};function Mw(e,t){var n=wf(e.min),i=wf(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function LD(e,t){return Math.max(e.min,Math.min(e.max,t))}var ID=Math.sign||function(e){return e>=0?1:-1},ch={min:.2,max:4},Aw=10,BD=.1,ND=.75;function er(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Un(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||ND;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}er.$inject=["config.zoomScroll","eventBus","canvas"],er.prototype.scroll=function(t){this._canvas.scroll(t)},er.prototype.reset=function(){this._canvas.zoom("fit-viewport")},er.prototype.zoom=function(t,n){var i=Mw(ch,Aw*2);this._totalDelta+=t,Math.abs(this._totalDelta)>BD&&(this._zoom(t,n,i),this._totalDelta=0)},er.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Kv()&&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))*ID(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)}},er.prototype.stepZoom=function(t,n){var i=Mw(ch,Aw);this._zoom(t,n,i)},er.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=wf(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(LD(ch,s),t)},er.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ge[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},er.prototype._init=function(e){this.toggle(e)};const Pw={__init__:["zoomScroll"],zoomScroll:["type",er]};function Hs(e){Xr.call(this,e)}Re(Hs,Xr),Hs.prototype._navigationModules=[Sw,Cw,Pw],Hs.prototype._modules=[].concat(Xr.prototype._modules,Hs.prototype._navigationModules);function lh(e){return e&&e[e.length-1]}function Tw(e){return e.y}function kw(e){return e.x}var $D={left:kw,center:kw,right:function(e){return e.x+e.width},top:Tw,middle:Tw,bottom:function(e){return e.y+e.height}};function Pa(e,t){this._modeling=e,this._rules=t}Pa.$inject=["modeling","rules"],Pa.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}},Pa.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Pa.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;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"]))u=lh(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(H(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=ji(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=lh(c).center,o;l=t[0],t=ji(t,function(f){return f[i]+f[r]}),u=lh(t),o[e]=p(l,u)}return o},Pa.prototype.trigger=function(e,t){var n=this._modeling,i,r=it(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ne(i)&&(r=i),!(r.length<2||!i)){var o=$D[t],a=ji(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const FD={__init__:["alignElements"],alignElements:["type",Pa]},jD=new Ea;function Ta(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ta.$inject=["eventBus"],Ta.prototype.schedule=function(e,t=jD.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ta.prototype._schedule=function(e,t){const n=HD();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}},Ta.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ta.prototype._cancel=function(e){clearTimeout(e.executionId)};function HD(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const zD={scheduler:["type",Ta]};var GD="djs-element-hidden",fu=".entry",VD=1e3,Ow=8,WD=300;function an(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}an.$inject=["canvas","elementRegistry","eventBus","scheduler"],an.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=Ne(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=Ne(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},an.prototype._createContainer=function(){var e=Bt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},an.prototype.registerProvider=function(e,t){t||(t=e,e=VD),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},an.prototype.getEntries=function(e){var t=this._getProviders(),n=Ne(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return H(t,function(r){if(yn(r[n])){var o=r[n](e);yn(o)?i=o(i):H(o,function(a,s){i[s]=a})}}),i},an.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Nn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},WD);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},an.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(yn(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},an.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))}},an.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},an.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;H(t,function(r,o){var a=r.group||"default",s=Bt(r.html||'<div class="entry" draggable="true"></div>'),c;Nn(s,"data-action",o),c=Rt("[data-group="+js(a)+"]",n),c||(c=Bt('<div class="group"></div>'),Nn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&UD(s,r.className),r.title&&Nn(s,"title",r.title),r.imageUrl&&(i=Bt("<img>"),Nn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ht(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},an.prototype._createHtml=function(e){var t=this,n=Bt('<div class="djs-context-pad"></div>');return Qn.bind(n,fu,"click",function(i){t.trigger("click",i)}),Qn.bind(n,fu,"dragstart",function(i){t.trigger("dragstart",i)}),Qn.bind(n,fu,"mouseover",function(i){t.trigger("mouseover",i)}),Qn.bind(n,fu,"mouseout",function(i){t.trigger("mouseout",i)}),Ge.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},an.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()&&YD(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},an.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},an.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Ne(e)!==Ne(n)?!1:Ne(e)?e.length===n.length&&lo(e,function(i){return n.includes(i)}):n===e},an.prototype.isShown=function(){return this.isOpen()&&Ht(this._current.html).has("open")},an.prototype.show=function(){this.isOpen()&&(Ht(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},an.prototype.hide=function(){this.isOpen()&&(Ht(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},an.prototype._getPosition=function(e){if(!Ne(e)&&Mt(e)){var t=this._canvas.viewbox(),n=qD(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Ow*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Ow*this._canvas.zoom(),top:s.top-a.top}},an.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")},an.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Ne(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,GD)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},an.prototype._getTargetBounds=function(e){var t=this,n=Ne(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 UD(e,t){var n=Ht(e);t=Ne(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function qD(e){return e.waypoints[e.waypoints.length-1]}function YD(e,t){return e=Ne(e)?e:[e],t=Ne(t)?t:[t],e.length===t.length&&lo(e,function(n){return t.includes(n)})}const Dw={__depends__:[Il,zD,lu],contextPad:["type",an]};var du,Wt,Lw,Zr,Iw,Bw,Nw,uh,hu,zs,$w,ph,fh,dh,mu={},gu=[],KD=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,yu=Array.isArray;function br(e,t){for(var n in t)e[n]=t[n];return e}function hh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fw(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?du.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 vu(e,a,i,r,null)}function vu(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??++Lw,__i:-1,__u:0};return r==null&&Wt.vnode!=null&&Wt.vnode(o),o}function bu(e){return e.children}function xu(e,t){this.props=e,this.context=t}function Po(e,t){if(t==null)return e.__?Po(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"?Po(e):null}function XD(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=br({},t);o.__v=t.__v+1,Wt.vnode&&Wt.vnode(o),mh(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Po(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,qw(i,o,r),t.__e=t.__=null,o.__e!=n&&jw(o)}}function jw(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}),jw(e)}function Hw(e){(!e.__d&&(e.__d=!0)&&Zr.push(e)&&!wu.__r++||Iw!=Wt.debounceRendering)&&((Iw=Wt.debounceRendering)||Bw)(wu)}function wu(){try{for(var e,t=1;Zr.length;)Zr.length>t&&Zr.sort(Nw),e=Zr.shift(),t=Zr.length,XD(e)}finally{Zr.length=wu.__r=0}}function zw(e,t,n,i,r,o,a,s,c,l,u){var p,f,d,g,h,y,C=i&&i.__k||gu,x=t.length;for(c=ZD(n,t,C,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&C[d.__i]||mu,d.__i=p,y=mh(e,d,f,r,o,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&gh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=Gw(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function ZD(e,t,n,i,r){var o,a,s,c,l,u=n.length,p=u,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]=vu(null,a,null,null,null):yu(a)?a=e.__k[o]=vu(bu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=vu(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,(l=a.__i=QD(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?f--:r<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Po(s)),Kw(s,s));return i}function Gw(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=Gw(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Po(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function QD(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function Vw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||KD.test(t)?n:n+"px"}function _u(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||Vw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Vw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace($w,"$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[zs]=i[zs]:(n[zs]=ph,e.addEventListener(t,o?dh:fh,o)):e.removeEventListener(t,o?dh:fh,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 Ww(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[hu]==null)t[hu]=ph++;else if(t[hu]<n[zs])return;return n(Wt.event?Wt.event(t):t)}}}function mh(e,t,n,i,r,o,a,s,c,l){var u,p,f,d,g,h,y,C,x,m,v,w,E,P,k,$,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(x=t.props,m=N.prototype&&N.prototype.render,v=(u=N.contextType)&&i[u.__c],w=u?v?v.props.value:u.__:i,n.__c?C=(f=t.__c=n.__c).__=f.__E:(m?t.__c=f=new N(x,w):(t.__c=f=new xu(x,w),f.constructor=N,f.render=eL),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),m&&f.__s==null&&(f.__s=f.state),m&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=br({},f.__s)),br(f.__s,N.getDerivedStateFromProps(x,f.__s))),g=f.props,h=f.state,f.__v=t,d)m&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),m&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(m&&N.getDerivedStateFromProps==null&&x!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,w)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),gu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Po(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,w),m&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,y)})}if(f.context=w,f.props=x,f.__P=e,f.__e=!1,E=Wt.__r,P=0,m)f.state=f.__s,f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),gu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,E&&E(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=br(br({},i),f.getChildContext())),m&&!d&&f.getSnapshotBeforeUpdate!=null&&(y=f.getSnapshotBeforeUpdate(g,h)),k=u!=null&&u.type===bu&&u.key==null?Yw(u.props.children):u,s=zw(e,yu(k)?k:[k],t,n,i,r,o,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),C&&(f.__E=f.__=null)}catch(L){if(a.length=p,t.__v=null,c||o!=null){if(L.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;$--;)hh(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||Uw(t),Wt.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=JD(n.__e,t,n,i,r,o,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function Uw(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Uw))}function qw(e,t,n){for(var i=0;i<n.length;i++)gh(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Wt.__e(o,r.__v)}})}function Yw(e){return typeof e!="object"||e==null||e.__b>0?e:yu(e)?e.map(Yw):e.constructor!==void 0?null:br({},e)}function JD(e,t,n,i,r,o,a,s,c){var l,u,p,f,d,g,h,y=n.props||mu,C=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(x==null)return document.createTextNode(C);e=document.createElementNS(r,x,C.is&&C),s&&(Wt.__m&&Wt.__m(t,o),s=!1),o=null}if(x==null)y===C||s&&e.data==C||(e.data=C);else{if(o=x=="textarea"&&C.defaultValue!=null?null:o&&du.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in C||l=="value"&&"defaultValue"in C||l=="checked"&&"defaultChecked"in C||_u(e,l,null,d,r);for(l in C)d=C[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||_u(e,l,d,y[l],r);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),zw(t.type=="template"?e.content:e,yu(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Po(n,0),s,c),o!=null)for(l=o.length;l--;)hh(o[l]);s&&x!="textarea"||(l="value",x=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||x=="progress"&&!g||x=="option"&&g!=y[l])&&_u(e,l,g,y[l],r),l="checked",h!=null&&h!=e[l]&&_u(e,l,h,y[l],r))}return e}function gh(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){Wt.__e(r,n)}}function Kw(e,t,n){var i,r;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||gh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Wt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Kw(i[r],t,n||typeof e.type!="function");n||hh(e.__e),e.__c=e.__=e.__e=void 0}function eL(e,t,n){return this.constructor(e,n)}function Xw(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],mh(t,e=t.__k=Fw(bu,null,[e]),r||mu,mu,t.namespaceURI,r?null:t.firstChild?du.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),qw(o,e,a),e.props.children=null}du=gu.slice,Wt={__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}},Lw=0,xu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=br({},this.state),typeof e=="function"&&(e=e(br({},n),this.props)),e&&br(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Hw(this))},xu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Hw(this))},xu.prototype.render=bu,Zr=[],Bw=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nw=function(e,t){return e.__v.__b-t.__v.__b},wu.__r=0,uh=Math.random().toString(8),hu="__d"+uh,zs="__a"+uh,$w=/(PointerCapture)$|Capture$/i,ph=0,fh=Ww(!1),dh=Ww(!0);var Zw=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,Zw(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Qw=new Map;function tL(e){var t=Qw.get(this);return t||(t=new Map,Qw.set(this,t)),(t=Zw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=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=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],o===1?i==="<"?(l(),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===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][p+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Pt=tL.bind(Fw),ka,sn,yh,Jw,Gs=0,e_=[],hn=Wt,t_=hn.__b,n_=hn.__r,i_=hn.diffed,r_=hn.__c,o_=hn.unmount,a_=hn.__;function Eu(e,t){hn.__h&&hn.__h(sn,e,Gs||t),Gs=0;var n=sn.__H||(sn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function vh(e){return Gs=1,nL(c_,e)}function nL(e,t,n){var i=Eu(ka++,2);if(i.t=e,!i.__c&&(i.__=[c_(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=sn,!sn.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,l);return u?f||p:f}return!u||p};sn.__f=!0;var o=sn.shouldComponentUpdate,a=sn.componentWillUpdate;sn.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},sn.shouldComponentUpdate=r}return i.__N||i.__}function Su(e,t){var n=Eu(ka++,3);!hn.__s&&wh(n.__H,t)&&(n.__=e,n.u=t,sn.__H.__h.push(n))}function bh(e,t){var n=Eu(ka++,4);!hn.__s&&wh(n.__H,t)&&(n.__=e,n.u=t,sn.__h.push(n))}function Ru(e){return Gs=5,xr(function(){return{current:e}},[])}function xr(e,t){var n=Eu(ka++,7);return wh(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Vs(e,t){return Gs=8,xr(function(){return e},t)}function iL(){for(var e;e=e_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Cu),t.__h.some(xh),t.__h=[]}catch(n){t.__h=[],hn.__e(n,e.__v)}}}hn.__b=function(e){sn=null,t_&&t_(e)},hn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),a_&&a_(e,t)},hn.__r=function(e){n_&&n_(e),ka=0;var t=(sn=e.__c).__H;t&&(yh===sn?(t.__h=[],sn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Cu),t.__h.some(xh),t.__h=[],ka=0)),yh=sn},hn.diffed=function(e){i_&&i_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(e_.push(t)!==1&&Jw===hn.requestAnimationFrame||((Jw=hn.requestAnimationFrame)||rL)(iL)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),yh=sn=null},hn.__c=function(e,t){t.some(function(n){try{n.__h.some(Cu),n.__h=n.__h.filter(function(i){return!i.__||xh(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],hn.__e(i,n.__v)}}),r_&&r_(e,t)},hn.unmount=function(e){o_&&o_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Cu(i)}catch(r){t=r}}),n.__H=void 0,t&&hn.__e(t,n.__v))};var s_=typeof requestAnimationFrame=="function";function rL(e){var t,n=function(){clearTimeout(i),s_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);s_&&(t=requestAnimationFrame(n))}function Cu(e){var t=sn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),sn=t}function xh(e){var t=sn;e.__c=e.__(),sn=t}function wh(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function c_(e,t){return typeof t=="function"?t(e):t}function oL(e){const{navigationStack:t,setNavigationStack:n}=e,i=xr(()=>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 Pt`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${r&&Pt`
|
|
14
14
|
<button
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function
|
|
44
|
+
`}function l_(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=l_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Mu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=l_(e))&&(i&&(i+=" "),i+=t);return i}function aL(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=xr(()=>sL(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Pt`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
47
|
${a.map(l=>Pt`
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
${l.entries.map(u=>Pt`
|
|
51
51
|
<li key=${u.id}>
|
|
52
52
|
<${s(u)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${cL(u,u===i)}
|
|
54
54
|
onClick=${p=>c(p,u)}
|
|
55
55
|
title=${u.title||u.label}
|
|
56
56
|
data-id=${u.id}
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function sL(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 cL(e,t){return Mu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function u_(e,t){return`${e}-entry-${t.id}`}function lL(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return Pt`
|
|
74
74
|
<li
|
|
75
|
-
class=${
|
|
75
|
+
class=${Mu("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${u_(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
>
|
|
89
89
|
<div class="djs-popup-entry-content">
|
|
90
90
|
<span
|
|
91
|
-
class=${
|
|
91
|
+
class=${Mu("djs-popup-entry-name",n.className)}
|
|
92
92
|
>
|
|
93
93
|
${n.imageUrl&&Pt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&Pt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
94
94
|
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function uL(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Ru();bh(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const y=h.querySelector(".selected");y&&pL(y)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return Pt`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
>
|
|
145
145
|
${i.map(h=>Pt`
|
|
146
146
|
${h.name&&Pt`
|
|
147
|
-
<div key=${h.id} id=${
|
|
147
|
+
<div key=${h.id} id=${p_(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?p_(o,h):void 0}
|
|
156
156
|
>
|
|
157
157
|
${h.entries.map(y=>Pt`
|
|
158
|
-
<${
|
|
158
|
+
<${lL}
|
|
159
159
|
key=${y.id}
|
|
160
160
|
idPrefix=${o}
|
|
161
161
|
entry=${y}
|
|
@@ -168,28 +168,28 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
171
|
+
`}function p_(e,t){return`${e}-group-${t.id}`}function pL(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const fL=new Ea("djs-popup");function dL(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:f,onOpened:d,onClosed:g}=e,[h,y]=vh([]);Su(()=>{y([])},[f]);const[C,x]=vh(""),m=C.trim().length>0,v=xr(()=>gL(f),[f]),w=xr(()=>un(l)?v.length>5:!1,[l,v]),E=xr(()=>{const V=h.length?h[h.length-1].entries:f;return w?m?p(v.filter(({searchable:Y})=>Y!==!1),C,{keys:["label","search","description"]}).map(({item:Y})=>Y):V.filter(({rank:Y=0})=>Y>=0):V},[w,m,v,C,p,h,f]),P=xr(()=>m?E.length?[{id:"default",entries:E}]:[]:yL(E),[E,m]),[k,$]=vh(E[0]),N=Ru(null),L=Ru(!1),z=xr(()=>fL.next(),[]),X=`${z}-results`,oe=k&&u_(z,k);Su(()=>{const V=N.current;V&&E.includes(V)?$(V):$(E[0]),N.current=null},[E]);const te=Vs(V=>{const Y=mL(P);let me=Y.indexOf(k)+V;me<0&&(me=Y.length-1),me>=Y.length&&(me=0),L.current=!0,$(Y[me])},[P,k]),je=Vs(V=>{V>0&&k&&k.entries&&(L.current=!0,y(Y=>[...Y,k])),V<0&&h.length>0&&(L.current=!0,N.current=h[h.length+V],y(Y=>Y.slice(0,V)))},[k,h]),qe=Vs((V,Y,ae)=>{if(!(!Y||Y.disabled))return Y.entries?(V.preventDefault(),je(1)):n(V,Y,ae)},[n,je]),He=Vs(V=>{if(V.key==="Enter"&&k){const Y=V.target;return!!go(Y,"a, button",!0)||k.disabled?void 0:qe(V,k)}if(V.key==="Backspace"){const Y=V.target;if(!(Jp(Y,"input")&&Y.value!==""))return je(-1),V.preventDefault()}if(V.key==="ArrowUp")return te(-1),V.preventDefault();if(V.key==="ArrowDown")return te(1),V.preventDefault();if(V.key==="ArrowRight")return je(1),V.preventDefault();if(V.key==="ArrowLeft")return je(-1),V.preventDefault()},[k,te,je,qe]),Se=Vs(V=>{Jp(V.target,"input")&&x(()=>V.target.value)},[x]);Su(()=>(d(),()=>{g()}),[]);const Z=!m&&h.length>0,ie=(a||r.length>0)&&!Z;return Pt`
|
|
172
|
+
<${f_}
|
|
173
173
|
onClose=${t}
|
|
174
|
-
onKeyup=${
|
|
175
|
-
onKeydown=${
|
|
174
|
+
onKeyup=${Se}
|
|
175
|
+
onKeydown=${He}
|
|
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
|
+
${ie&&Pt`
|
|
183
|
+
<${aL}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
|
-
selectedEntry=${
|
|
187
|
-
setSelectedEntry=${
|
|
186
|
+
selectedEntry=${k}
|
|
187
|
+
setSelectedEntry=${$}
|
|
188
188
|
title=${a}
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
|
-
${
|
|
192
|
-
<${
|
|
191
|
+
${Z&&Pt`
|
|
192
|
+
<${oL}
|
|
193
193
|
navigationStack=${h}
|
|
194
194
|
setNavigationStack=${y}
|
|
195
195
|
/>
|
|
@@ -208,8 +208,8 @@
|
|
|
208
208
|
role="combobox"
|
|
209
209
|
aria-label="${a||"Search"}"
|
|
210
210
|
aria-expanded="true"
|
|
211
|
-
aria-controls=${
|
|
212
|
-
aria-activedescendant=${
|
|
211
|
+
aria-controls=${X}
|
|
212
|
+
aria-activedescendant=${oe||void 0}
|
|
213
213
|
aria-autocomplete="list"
|
|
214
214
|
/>
|
|
215
215
|
</div>
|
|
@@ -217,30 +217,30 @@
|
|
|
217
217
|
|
|
218
218
|
${m&&Pt`
|
|
219
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
220
|
-
${
|
|
220
|
+
${E.length} ${E.length===1?"result":"results"} found
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
225
|
-
groupedEntries=${
|
|
226
|
-
selectedEntry=${
|
|
227
|
-
setSelectedEntry=${
|
|
228
|
-
keyboardSelection=${
|
|
229
|
-
onAction=${
|
|
230
|
-
idPrefix=${
|
|
231
|
-
id=${
|
|
224
|
+
<${uL}
|
|
225
|
+
groupedEntries=${P}
|
|
226
|
+
selectedEntry=${k}
|
|
227
|
+
setSelectedEntry=${$}
|
|
228
|
+
keyboardSelection=${L}
|
|
229
|
+
onAction=${qe}
|
|
230
|
+
idPrefix=${z}
|
|
231
|
+
id=${X}
|
|
232
232
|
ariaLabel=${a||"Results"}
|
|
233
233
|
tabIndex=${w?-1:0}
|
|
234
|
-
ariaActivedescendant=${w?void 0:
|
|
234
|
+
ariaActivedescendant=${w?void 0:oe||void 0}
|
|
235
235
|
/>
|
|
236
236
|
|
|
237
|
-
${
|
|
237
|
+
${k&&k.documentationRef&&Pt`
|
|
238
238
|
<div class="djs-popup-footer">
|
|
239
239
|
<a
|
|
240
240
|
class="djs-popup-footer-docs"
|
|
241
|
-
href=${
|
|
242
|
-
onClick=${
|
|
243
|
-
aria-label=${
|
|
241
|
+
href=${k.documentationRef}
|
|
242
|
+
onClick=${V=>V.stopPropagation()}
|
|
243
|
+
aria-label=${k.label?`Open entry documentation for ${k.label}`:"Open entry documentation"}
|
|
244
244
|
target="_blank"
|
|
245
245
|
rel="noopener"
|
|
246
246
|
>
|
|
@@ -254,14 +254,14 @@
|
|
|
254
254
|
`}
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
|
-
${u&&
|
|
257
|
+
${u&&E.length===0&&Pt`
|
|
258
258
|
<div class="djs-popup-no-results">${yn(u)?u(C):u}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${f_}>
|
|
261
|
+
`}function f_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Ru();return bh(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),bh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Su(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!go(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),Pt`
|
|
262
262
|
<div
|
|
263
|
-
class=${
|
|
264
|
-
style=${
|
|
263
|
+
class=${Mu("djs-popup",r)}
|
|
264
|
+
style=${hL(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function hL(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:un(t)?n:void 0,maxWidth:un(t)?"unset":void 0,"transform-origin":"top left"}}function mL(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function gL(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function yL(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 vL="data-id",d_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],bL=1e3;function Ut(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=un(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()})}Ut.$inject=["config.popupMenu","eventBus","canvas","search"],Ut.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=h_(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);Xw(Pt`
|
|
273
|
+
<${dL}
|
|
274
274
|
onClose=${f=>this.close(f)}
|
|
275
275
|
onSelect=${(f,d,g)=>this.trigger(f,d,g)}
|
|
276
276
|
position=${c}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},Ut.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()},Ut.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()},Ut.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)}},Ut.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ut.prototype.reset=function(){const e=this._current.container;
|
|
287
|
+
`,this._current.container)},Ut.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()},Ut.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()},Ut.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)}},Ut.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ut.prototype.reset=function(){const e=this._current.container;Xw(null,e),Ui(e)},Ut.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Ut.prototype._onOpened=function(){this._emit("opened")},Ut.prototype._onClosed=function(){this._emit("closed")},Ut.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Bt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Ut.prototype._bindAutoClose=function(){this._eventBus.once(d_,this.close,this)},Ut.prototype._unbindAutoClose=function(){this._eventBus.off(d_,this.close,this)},Ut.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),un(n)&&e<n&&(r=n),un(i)&&e>i&&(r=i)),r},Ut.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}},Ut.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},Ut.prototype.registerProvider=function(e,t,n){n||(n=t,t=bL),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Ut.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Ut.prototype._getEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuEntries){H(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Hi(o,["id"])});return}var r=i.getPopupMenuEntries(e);yn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},Ut.prototype._getHeaderEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;H(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Hi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);yn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},Ut.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>yn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Ut.prototype.isOpen=function(){return!!this._current},Ut.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=go(e.delegateTarget||e.target,".entry",!0),o=Nn(r,vL);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(yn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Ut.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 h_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=h_(r.entries,[...t,...m_(r.search)]):t.length&&(r.search=[...t,...m_(r.search)]),r})}function m_(e){return e?Ne(e)?e:[e]:[]}function xL(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=wL(o,r,i);return a?{item:o,tokens:a}:[]}).sort(_L(i))}function wL(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ne(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=x_(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):x_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function _L(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=EL(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=g_;continue}const s=SL(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=g_;continue}}return i}}function EL(e,t){return y_(t)-y_(e)}const g_=.5,Oa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function y_(e){const t=e.reduce((s,c)=>s+v_(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 v_(e){if(Ne(e))return Math.max(...e.map(v_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Oa.FULL:e.wordEnd?Oa.START_FULL_WORD:Oa.START_WORD_PART:e.wordStart?Oa.WORD_START:Oa.WORD_PART)*t:Oa.NO_MATCH*t}function b_(e=""){return Ne(e)?e.join(", "):e}function SL(e,t){return b_(e).localeCompare(b_(t))}function x_(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(RL),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(p-1)),C=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:C,start:d,end:g,all:h});const x=h?t:[u];for(const m of x)i[m.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function RL(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const w_={search:["value",xL]},_h={__depends__:[w_],__init__:["popupMenu"],popupMenu:["type",Ut]};var __={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>`},EL=900;function Da(e,t,n,i){e.registerProvider(EL,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Da.$inject=["contextPad","popupMenu","translate","canvas"],Da.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Da.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Da.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${x_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);U(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Da.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 SL=["left","center","right","top","middle","bottom"];function Ws(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ws.$inject=["popupMenu","alignElements","translate","rules"],Ws.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Ws.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ws.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return z(SL,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:x_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Cu(e){Ei.call(this,e)}Cu.$inject=["eventBus"],Ee(Cu,Ei),Cu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=nt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=qc(n),n.length<2?!1:n})};const RL={__depends__:[BD,kw,wh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Da],alignElementsMenuProvider:["type",Ws],bpmnAlignElements:["type",Cu]};function wr(e,t,n,i){le.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,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=op(Go(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Vo(s,function(p){return p.parent.id});z(u,function(p,f){$e(l)&&(p=p.filter(function(d){return Tt(l,Wo({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,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}wr.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(wr,le),wr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Be(rn(e)),o=Be(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),Xc(U({},o,a))},wr.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(CL(i,t)){var r=ML(Di(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},wr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},wr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},wr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function CL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function ML(e,t){var n="";return e=Be(e),t=Be(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 Mu(e){e.invoke(wr,this)}Mu.$inject=["injector"],Ee(Mu,wr),Mu.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Us(e){Ei.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Us.$inject=["eventBus"],Ee(Us,Ei),Us.prototype.canResize=function(e,t){return!1};function Au(e,t){Us.call(this,e),this._modeling=t}Ee(Au,Us),Au.$inject=["eventBus","modeling"],Au.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||Qe(i)){n=!1;return}}),n};const AL={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Mu],bpmnAutoResizeProvider:["type",Au]};function La(e,t,n){this._canvas=n,this._opts=U({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()})}La.$inject=["config.autoScroll","eventBus","canvas"],La.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++)PL(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 PL(e,t,n){return t<e&&e<n}La.prototype.stopScroll=function(){clearTimeout(this._scrolling)},La.prototype.setOptions=function(e){this._opts=U({},this._opts,e)},La.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=_o(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const TL={__depends__:[mr],__init__:["autoScroll"],autoScroll:["type",La]};var w_="djs-bendpoint",__="djs-segment-dragger";function kL(e,t){var n=_o(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 _h(e,t,n){var i=kL(e,n),r=Nf(t,i);return r}function Eh(e,t){var n=Oe("g");st(n).add(w_),Ge(e,n);var i=Oe("circle");Se(i,{cx:0,cy:0,r:4}),st(i).add("djs-visual"),Ge(n,i);var r=Oe("circle");return Se(r,{cx:0,cy:0,r:10}),st(r).add("djs-hit"),Ge(n,r),t&&st(n).add(t),n}function OL(e,t,n,i){var r=Oe("g");Ge(e,r);var o=18,a=6,s=11,c=LL(t,n,i),l=a+s,u=Oe("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),st(u).add("djs-visual"),Ge(r,u);var p=Oe("rect");return Se(p,{x:-c/2,y:-l/2,width:c,height:l}),st(p).add("djs-hit"),Ge(r,p),Fy(r,i==="v"?90:0),r}function E_(e,t,n){var i=Oe("g"),r=ff(t,n),o=lr(t,n);return Ge(e,i),OL(i,t,n,o),st(i).add(__),st(i).add(o==="h"?"horizontal":"vertical"),kn(i,r.x,r.y),i}function Sh(e){return Math.abs(Math.round(e*2/3))}function DL(e,t){var n=IL(e,t);return Gf(e,n)}function LL(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Sh(n==="h"?i:r)}function IL(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=Rv(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function S_(e,t,n,i,r){function o(m,v,w){var S=m.index,k=m.point,O,N,T,D,j,ee;return S<=0||m.bendpoint?!1:(O=v[S-1],N=v[S],T=ff(O,N),D=lr(O,N),j=Math.abs(k.x-T.x),ee=Math.abs(k.y-T.y),D&&j<=w&&ee<=w)}function a(m,v){var w=m.waypoints,S,k,O,N;return v.index<=0||v.bendpoint||(S={start:w[v.index-1],end:w[v.index]},k=lr(S.start,S.end),!k)?null:(k==="h"?O=S.end.x-S.start.x:O=S.end.y-S.start.y,N=Sh(O)/2,N)}function s(m,v){var w=v.waypoints,S=_h(t,w,m),k;if(S){k=a(v,S);var O;if(o(S,w,k)?O=r.start(m,v,S.index):O=i.start(m,v,S.index,!S.bendpoint),O!==!1)return!0}}function c(m,v,w){ze.bind(m,v,function(S){n.triggerMouseEvent(v,S,w),S.stopPropagation()})}function l(m,v){var w=t.getLayer("overlays"),S=Rt('.djs-bendpoints[data-element-id="'+js(m.id)+'"]',w);return!S&&v&&(S=Oe("g"),Se(S,{"data-element-id":m.id}),st(S).add("djs-bendpoints"),Ge(w,S),c(S,"mousedown",m),c(S,"click",m),c(S,"dblclick",m)),S}function u(m,v){return Rt('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function p(m,v){v.waypoints.forEach(function(w,S){var k=Eh(m);Ge(m,k),kn(k,w.x,w.y)}),Eh(m,"floating")}function f(m,v){for(var w=v.waypoints,S,k,O,N=1;N<w.length;N++)S=w[N-1],k=w[N],lr(S,k)&&(O=E_(m,S,k),Se(O,{"data-segment-idx":N}),c(O,"mousemove",v))}function d(m){z(Gc("."+w_,m),function(v){fn(v)})}function g(m){z(Gc("."+__,m),function(v){fn(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),p(v,m),f(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),f(v,m),p(v,m))}function C(m,v){var w=Rt(".floating",m),S=v.point;w&&(kn(w,S.x,S.y),st(w).add("positioned"))}function x(m,v,w){var S=u(v.index,m),k=w[v.index-1],O=w[v.index],N=v.point,T=ff(k,O),D=lr(k,O),j,ee;S&&(j=BL(S),ee={x:N.x-T.x,y:N.y-T.y},D==="v"&&(ee={x:ee.y,y:ee.x}),kn(j,ee.x,ee.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&fn(v)}),e.on("element.marker.update",function(m){var v=m.element,w;v.waypoints&&(w=h(v),m.add?st(w).add(m.marker):st(w).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,w=v.waypoints,S,k;if(w){if(S=l(v,!0),k=_h(t,w,m.originalEvent),!k)return;C(S,k),k.bendpoint||x(S,k,w)}}),e.on("element.mousedown",function(m){if(Hr(m)){var v=m.originalEvent,w=m.element;if(w.waypoints)return s(v,w)}}),e.on("selection.changed",function(m){var v=m.newSelection,w=v[0];w&&w.waypoints&&h(w)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var w=l(v);if(w){var S=Rt(".floating",w);S&&st(S).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,w=m.newId;if(v.waypoints){var S=l(v);S&&Se(S,{"data-element-id":w})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}S_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function BL(e){return Rt(".djs-visual",e)}var R_=Math.round,To="reconnectStart",ko="reconnectEnd",qs="updateWaypoints";function Rh(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=To:!l&&c===d.length-1?g=ko:g=qs;var h=g===qs?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:p,target:f});if(y===!1&&(y=r.allowed(h,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===qs?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===To?p:l,target:f===ko?p:u}),d){s.source=f===To?p:l,s.target=f===ko?p:u;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===ko?p:u,target:f===To?p:l})),d&&(s.source=f===ko?p:u,s.target=f===To?p:l)}}),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!==qs&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,y=s.hints||{},C={x:R_(a.x),y:R_(a.y)};if(!c)return!1;h===qs?(p?f.splice(l,0,C):f[l]=C,y.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,GM(f),y)):(h===To?(y.docking="source",Pu(s)&&(y.docking="target",y.newWaypoints=f.reverse())):h===ko&&(y.docking="target",Pu(s)&&(y.docking="source",y.newWaypoints=f.reverse())),o.reconnect(u,d,g,C,y))},this)}Rh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Rh.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 Pu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===To)return t&&i&&t===i&&n!==i;if(r===ko)return t&&n&&t===n&&n!==i}var NL="reconnectStart",$L="reconnectEnd",C_="updateWaypoints",Ys="connect-ok",Tu="connect-not-ok",M_="connect-hover",A_="djs-updating",P_="djs-dragging",T_=1100;function k_(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,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=Eh(i.getLayer("overlays"));st(f).add("djs-dragging"),i.addMarker(c,P_),i.addMarker(c,A_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,M_),l===C_)return;s?(i.removeMarker(c,Tu),i.addMarker(c,Ys)):s===!1&&(i.removeMarker(c,Ys),i.addMarker(c,Tu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],T_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,M_),i.removeMarker(s,c?Ys:Tu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),y={x:o.x,y:o.y},C=a.hints||{},x={};r&&(C.connectionStart&&(x.connectionStart=C.connectionStart),C.connectionEnd&&(x.connectionEnd=C.connectionEnd),p===NL?Pu(a)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||d,x.target=g):p===$L?Pu(a)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=y),p===C_&&(h=e.cropWaypoints(f,h)),x.waypoints=h,r.drawPreview(a,s,x)),kn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],T_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,fn(c),i.removeMarker(s,A_),i.removeMarker(s,P_),l&&(i.removeMarker(l,Ys),i.removeMarker(l,u?Ys:Tu)),r&&r.cleanUp(a)})}k_.$inject=["bendpointMove","injector","eventBus","canvas"];var O_="connect-hover",D_="djs-updating";function L_(e,t,n){return Ch(e,t,e[t]+n)}function Ch(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function FL(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 Ch(t,i,s)}function I_(e){return e==="x"?"y":"x"}function B_(e,t,n){var i,r;return e.original?e.original:(i=Fe(t),r=I_(n),Ch(e,r,i[r]))}function N_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),y=d-1,C=d,x=f.waypoints,m=x[y],v=x[C],w=_h(n,x,p),S,k,O;if(S=lr(m,v),!!S)return k=S==="v"?"x":"y",y===0&&(m=B_(m,f.source,k)),C===x.length-1&&(v=B_(v,f.target,k)),w?O=w.point:O={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:C,segmentStart:m,segmentEnd:v,axis:k,dragPosition:O},i.init(p,O,"connectionSegment.move",{cursor:k==="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 l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,y=g[h],C=p.segmentEndIndex+f,x=g[C],m=I_(p.axis),v=FL(d,y,x,m);kn(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,y){return pf(p[y-1],p[y+1],h)?(d=y<=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=E_(g,f.segmentStart,f.segmentEnd),st(f.draggerGfx).add("djs-dragging"),n.addMarker(d,D_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,y=f.segmentStart,C=f.segmentEnd,x=f.axis,m=f.originalWaypoints.slice(),v=L_(y,x,p["d"+x]),w=L_(C,x,p["d"+x]),S=m.length,k=0;m[g]=v,m[h]=w;var O,N;g<2&&(O=Tn(d.source,v),g===1?O==="intersect"&&(m.shift(),m[0]=v,k--):O!=="intersect"&&(m.unshift(y),k++)),h>S-3&&(N=Tn(d.target,w),h===S-2?N==="intersect"&&(m.pop(),m[m.length-1]=w):N!=="intersect"&&m.push(C)),f.newWaypoints=d.waypoints=s(d,m),l(f,k,p),f.newSegmentStartIndex=g+k,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,O_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,O_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&fn(f.draggerGfx),n.removeMarker(d,D_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var y=u(g,h),C=y.waypoints,x=s(d,C),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+m}};o.updateWaypoints(d,x,v)})}N_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var jL=Math.abs,$_=Math.round;function HL(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],jL(r-e)<=n)return r}function F_(e){return{x:e.x,y:e.y}}function j_(e){return{x:e.x+e.width,y:e.y+e.height}}function Mi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:$_(e.x+e.width/2),y:$_(e.y+e.height/2)}}function Ia(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function cn(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 H_(e){return e.children||[]}var zL=Math.abs,z_=Math.round,Mh=10;function G_(e){function t(o,a){if($e(o)){for(var s=o.length;s--;)if(zL(o[s]-a)<=Mh)return o[s]}else{o=+o;var c=a%o;if(c<Mh)return a-c;if(c>o-Mh)return a-c+o}return a}function n(o,a){if(o.waypoints)return DL(a,o);if(o.width)return{x:z_(o.width/2+o.x),y:z_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;U(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&cn(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&cn(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.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);!Mt(s)||!c||!c.x||!c.y||(cn(o,"x",c.x),cn(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,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;U(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(u)!==-1)&&cn(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&cn(o,"y",d)}})}G_.$inject=["eventBus"];const GL={__depends__:[mr,Qi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",S_],bendpointMove:["type",Rh],bendpointMovePreview:["type",k_],connectionSegmentMove:["type",N_],bendpointSnapping:["type",G_]};function V_(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,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!zo(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!zo(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Ah(s)?u:l,connectionEnd:Ah(s)?l:u};gn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){gn(c)||(l=c,c=Fe(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}V_.$inject=["eventBus","dragging","modeling","rules"];function Ah(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var VL=1100,WL=900,W_="connect-ok",U_="connect-not-ok";function q_(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;Ah(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",WL,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?W_:U_)}),t.on(["connect.out","connect.cleanup"],VL,function(r){var o=r.hover;o&&(n.removeMarker(o,W_),n.removeMarker(o,U_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}q_.$inject=["injector","eventBus","canvas"];const Ph={__depends__:[Si,Qi,mr],__init__:["connectPreview"],connect:["type",V_],connectPreview:["type",q_]};var UL="djs-dragger";function _r(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)}_r.$inject=["injector","canvas","graphicsFactory","elementFactory"],_r.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,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Vc(i),r||(r=e.getConnection=qL(function(h,y,C){return g.getConnection(h,y,C)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Fe(o):c,a?Fe(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},_r.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Fe(n),o=t.connectionEnd||Fe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ge(e,s)},_r.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&&cs(o,s,!0)||e,t=i&&cs(a,s,!1)||t,[e,t]},_r.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&fn(e.connectionPreviewGfx)},_r.prototype.getConnection=function(e){var t=YL(e);return this._elementFactory.createConnection(t)},_r.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Se(e,{pointerEvents:"none"}),st(e).add(UL),Ge(this._canvas.getActiveLayer(),e),e},_r.prototype.createNoopConnection=function(e,t){return rs([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function qL(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 YL(e){return gn(e)?e:{}}const KL={__init__:["connectionPreview"],connectionPreview:["type",_r]},ku="complex-preview";class Y_{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(ku);n.filter(s=>!XL(s)).forEach(s=>{let c;Mt(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(bo(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(bo(c),s),kn(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 l=this._previewSupport.addDragger(s,a);Mt(s)?kn(l,c.x,c.y):kn(l,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 l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape(bo(l),s,{width:c.width,height:c.height}),kn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Vc(this._canvas.getLayer(ku)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(ku)}hide(){this._canvas.hideLayer(ku)}}Y_.$inject=["canvas","graphicsFactory","previewSupport"];function XL(e){return e.hidden}const ZL={__depends__:[Sa],__init__:["complexPreview"],complexPreview:["type",Y_]},K_=Math.round;function Ou(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Ou.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,l=o.createShape(U({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;U(l,{x:u.x-K_(l.width/2),y:u.y-K_(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!zo(d))})},Ou.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Ou.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const QL={__depends__:[iu,ZL,Zd],__init__:["appendPreview"],appendPreview:["type",Ou]};var X_=Math.min,Z_=Math.max;function Th(e){e.preventDefault()}function Ks(e){e.stopPropagation()}function JL(e){return e.nodeType===Node.TEXT_NODE}function eI(e){return[].slice.call(e)}function Bi(e){this.container=e.container,this.parent=Bt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Un(this.autoResize,this),this.handlePaste=Un(this.handlePaste,this)}Bi.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=Di(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);U(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 l=Di(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return U(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&U(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,ze.bind(a,"keydown",this.keyHandler),ze.bind(a,"mousedown",Ks),ze.bind(a,"paste",r.handlePaste),ze.bind(a,"focusout",this.focusoutHandler),i.autoResize&&ze.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Bi.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)}},Bi.prototype.insertText=function(e){e=tI(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Bi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=eI(a.childNodes),c,l;if(JL(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=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&&Ui(g)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Bi.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})}},Bi.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=Bt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Th(g),Ks(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,ze.bind(document,"mousemove",f),ze.bind(document,"mouseup",d)},f=function(g){Th(g),Ks(g);var h=X_(Z_(l+g.clientX-s,i),o),y=X_(Z_(u+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Th(g),Ks(g),ze.unbind(document,"mousemove",f,!1),ze.unbind(document,"mouseup",d,!1)};ze.bind(n,"mousedown",p)}U(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)},Bi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ze.unbind(t,"keydown",this.keyHandler),ze.unbind(t,"mousedown",Ks),ze.unbind(t,"input",this.autoResize),ze.unbind(t,"paste",this.handlePaste),ze.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Ui(n)),Ui(e)},Bi.prototype.getValue=function(){return this.content.innerText.trim()},Bi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Bi.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 tI(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function oi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Bi({container:t.getContainer(),keyHandler:Un(this._handleKey,this),resizeHandler:Un(this._handleResize,this),focusoutHandler:Un(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}oi.$inject=["eventBus","canvas"],oi.prototype.registerProvider=function(e){this._providers.push(e)},oi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},oi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},oi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},oi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},oi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},oi.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()}},oi.prototype.getValue=function(){return this._textbox.getValue()},oi.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()},oi.prototype._handleResize=function(e){this._fire("resize",e)},oi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},oi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Tt(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 Q_={__depends__:[Dl],__init__:["directEditing"],directEditing:["type",oi]};function nI(e){return function(t){var n=t.target,i=pe(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===at(e);return!o||!a||!s||!c}}const iI={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 ce(e,t={}){var n=iI[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var rI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing"),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-start"),ce("timer-start"),ce("conditional-start"),ce("signal-start")],oI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing"),ce("none-end-event",{actionName:"replace-with-none-end"})],aI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-intermediate-catch"),ce("message-intermediate-throw"),ce("timer-intermediate-catch"),ce("escalation-intermediate-throw"),ce("conditional-intermediate-catch"),ce("link-intermediate-catch"),ce("link-intermediate-throw"),ce("compensation-intermediate-throw"),ce("signal-intermediate-catch"),ce("signal-intermediate-throw")],sI=[ce("none-start-event",{actionName:"replace-with-none-start"}),ce("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ce("none-end-event",{actionName:"replace-with-none-end"}),ce("message-end"),ce("escalation-end"),ce("error-end"),ce("cancel-end"),ce("compensation-end"),ce("signal-end"),ce("terminate-end")],cI=[ce("exclusive-gateway"),ce("parallel-gateway"),ce("inclusive-gateway"),ce("complex-gateway"),ce("event-based-gateway")],lI=[ce("transaction"),ce("event-subprocess"),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ce("collapsed-subprocess")],uI=[ce("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ce("transaction"),ce("event-subprocess"),ce("collapsed-ad-hoc-subprocess")],J_=[ce("transaction"),ce("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ce("event-subprocess")],pI=J_,e0=[ce("task"),ce("user-task"),ce("service-task"),ce("send-task"),ce("receive-task"),ce("manual-task"),ce("rule-task"),ce("script-task"),ce("call-activity"),ce("collapsed-subprocess"),ce("expanded-subprocess"),ce("collapsed-ad-hoc-subprocess"),ce("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],fI=[ce("data-store-reference")],dI=[ce("data-object-reference")],hI=[ce("message-boundary"),ce("timer-boundary"),ce("escalation-boundary"),ce("conditional-boundary"),ce("error-boundary"),ce("cancel-boundary"),ce("signal-boundary"),ce("compensation-boundary"),ce("non-interrupting-message-boundary"),ce("non-interrupting-timer-boundary"),ce("non-interrupting-escalation-boundary"),ce("non-interrupting-conditional-boundary"),ce("non-interrupting-signal-boundary")],mI=[ce("message-start"),ce("timer-start"),ce("conditional-start"),ce("signal-start"),ce("error-start"),ce("escalation-start"),ce("compensation-start"),ce("non-interrupting-message-start"),ce("non-interrupting-timer-start"),ce("non-interrupting-conditional-start"),ce("non-interrupting-signal-start"),ce("non-interrupting-escalation-start")],gI=[{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"}],yI=[ce("expanded-pool"),ce("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],vI={"bpmn:MessageEventDefinition":[ce("message-start"),ce("message-intermediate-catch"),ce("message-intermediate-throw"),ce("message-end")],"bpmn:TimerEventDefinition":[ce("timer-start"),ce("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ce("conditional-start"),ce("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ce("signal-start"),ce("signal-intermediate-catch"),ce("signal-intermediate-throw"),ce("signal-end")],"bpmn:ErrorEventDefinition":[ce("error-start"),ce("error-end")],"bpmn:EscalationEventDefinition":[ce("escalation-start"),ce("escalation-intermediate-throw"),ce("escalation-end")],"bpmn:CompensateEventDefinition":[ce("compensation-start"),ce("compensation-intermediate-throw"),ce("compensation-end")]};const t0={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},CL=900;function Da(e,t,n,i){e.registerProvider(CL,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Da.$inject=["contextPad","popupMenu","translate","canvas"],Da.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},Da.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Da.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${__.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);q(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Da.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 ML=["left","center","right","top","middle","bottom"];function Ws(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ws.$inject=["popupMenu","alignElements","translate","rules"],Ws.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},Ws.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ws.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return H(ML,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:__[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Au(e){Ei.call(this,e)}Au.$inject=["eventBus"],Re(Au,Ei),Au.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=it(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Kc(n),n.length<2?!1:n})};const AL={__depends__:[FD,Dw,_h],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Da],alignElementsMenuProvider:["type",Ws],bpmnAlignElements:["type",Au]};function wr(e,t,n,i){pe.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,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=sp(Go(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Vo(s,function(p){return p.parent.id});H(u,function(p,f){Ne(l)&&(p=p.filter(function(d){return Tt(l,Wo({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,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}wr.$inject=["eventBus","elementRegistry","modeling","rules"],Re(wr,pe),wr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ie(rn(e)),o=Ie(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),Qc(q({},o,a))},wr.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(PL(i,t)){var r=TL(Di(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},wr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},wr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},wr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function PL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function TL(e,t){var n="";return e=Ie(e),t=Ie(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 Pu(e){e.invoke(wr,this)}Pu.$inject=["injector"],Re(Pu,wr),Pu.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Us(e){Ei.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Us.$inject=["eventBus"],Re(Us,Ei),Us.prototype.canResize=function(e,t){return!1};function Tu(e,t){Us.call(this,e),this._modeling=t}Re(Tu,Us),Tu.$inject=["eventBus","modeling"],Tu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return H(e,function(i){if(M(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const kL={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Pu],bpmnAutoResizeProvider:["type",Tu]};function La(e,t,n){this._canvas=n,this._opts=q({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()})}La.$inject=["config.autoScroll","eventBus","canvas"],La.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++)OL(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 OL(e,t,n){return t<e&&e<n}La.prototype.stopScroll=function(){clearTimeout(this._scrolling)},La.prototype.setOptions=function(e){this._opts=q({},this._opts,e)},La.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=_o(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const DL={__depends__:[mr],__init__:["autoScroll"],autoScroll:["type",La]};var E_="djs-bendpoint",S_="djs-segment-dragger";function LL(e,t){var n=_o(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 Eh(e,t,n){var i=LL(e,n),r=$f(t,i);return r}function Sh(e,t){var n=Oe("g");st(n).add(E_),Ve(e,n);var i=Oe("circle");Ce(i,{cx:0,cy:0,r:4}),st(i).add("djs-visual"),Ve(n,i);var r=Oe("circle");return Ce(r,{cx:0,cy:0,r:10}),st(r).add("djs-hit"),Ve(n,r),t&&st(n).add(t),n}function IL(e,t,n,i){var r=Oe("g");Ve(e,r);var o=18,a=6,s=11,c=NL(t,n,i),l=a+s,u=Oe("rect");Ce(u,{x:-o/2,y:-a/2,width:o,height:a}),st(u).add("djs-visual"),Ve(r,u);var p=Oe("rect");return Ce(p,{x:-c/2,y:-l/2,width:c,height:l}),st(p).add("djs-hit"),Ve(r,p),Hy(r,i==="v"?90:0),r}function R_(e,t,n){var i=Oe("g"),r=df(t,n),o=lr(t,n);return Ve(e,i),IL(i,t,n,o),st(i).add(S_),st(i).add(o==="h"?"horizontal":"vertical"),kn(i,r.x,r.y),i}function Rh(e){return Math.abs(Math.round(e*2/3))}function BL(e,t){var n=$L(e,t);return Vf(e,n)}function NL(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Rh(n==="h"?i:r)}function $L(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=Mv(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function C_(e,t,n,i,r){function o(m,v,w){var E=m.index,P=m.point,k,$,N,L,z,X;return E<=0||m.bendpoint?!1:(k=v[E-1],$=v[E],N=df(k,$),L=lr(k,$),z=Math.abs(P.x-N.x),X=Math.abs(P.y-N.y),L&&z<=w&&X<=w)}function a(m,v){var w=m.waypoints,E,P,k,$;return v.index<=0||v.bendpoint||(E={start:w[v.index-1],end:w[v.index]},P=lr(E.start,E.end),!P)?null:(P==="h"?k=E.end.x-E.start.x:k=E.end.y-E.start.y,$=Rh(k)/2,$)}function s(m,v){var w=v.waypoints,E=Eh(t,w,m),P;if(E){P=a(v,E);var k;if(o(E,w,P)?k=r.start(m,v,E.index):k=i.start(m,v,E.index,!E.bendpoint),k!==!1)return!0}}function c(m,v,w){Ge.bind(m,v,function(E){n.triggerMouseEvent(v,E,w),E.stopPropagation()})}function l(m,v){var w=t.getLayer("overlays"),E=Rt('.djs-bendpoints[data-element-id="'+js(m.id)+'"]',w);return!E&&v&&(E=Oe("g"),Ce(E,{"data-element-id":m.id}),st(E).add("djs-bendpoints"),Ve(w,E),c(E,"mousedown",m),c(E,"click",m),c(E,"dblclick",m)),E}function u(m,v){return Rt('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function p(m,v){v.waypoints.forEach(function(w,E){var P=Sh(m);Ve(m,P),kn(P,w.x,w.y)}),Sh(m,"floating")}function f(m,v){for(var w=v.waypoints,E,P,k,$=1;$<w.length;$++)E=w[$-1],P=w[$],lr(E,P)&&(k=R_(m,E,P),Ce(k,{"data-segment-idx":$}),c(k,"mousemove",v))}function d(m){H(Wc("."+E_,m),function(v){fn(v)})}function g(m){H(Wc("."+S_,m),function(v){fn(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),p(v,m),f(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),f(v,m),p(v,m))}function C(m,v){var w=Rt(".floating",m),E=v.point;w&&(kn(w,E.x,E.y),st(w).add("positioned"))}function x(m,v,w){var E=u(v.index,m),P=w[v.index-1],k=w[v.index],$=v.point,N=df(P,k),L=lr(P,k),z,X;E&&(z=FL(E),X={x:$.x-N.x,y:$.y-N.y},L==="v"&&(X={x:X.y,y:X.x}),kn(z,X.x,X.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&fn(v)}),e.on("element.marker.update",function(m){var v=m.element,w;v.waypoints&&(w=h(v),m.add?st(w).add(m.marker):st(w).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,w=v.waypoints,E,P;if(w){if(E=l(v,!0),P=Eh(t,w,m.originalEvent),!P)return;C(E,P),P.bendpoint||x(E,P,w)}}),e.on("element.mousedown",function(m){if(Hr(m)){var v=m.originalEvent,w=m.element;if(w.waypoints)return s(v,w)}}),e.on("selection.changed",function(m){var v=m.newSelection,w=v[0];w&&w.waypoints&&h(w)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var w=l(v);if(w){var E=Rt(".floating",w);E&&st(E).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,w=m.newId;if(v.waypoints){var E=l(v);E&&Ce(E,{"data-element-id":w})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}C_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function FL(e){return Rt(".djs-visual",e)}var M_=Math.round,To="reconnectStart",ko="reconnectEnd",qs="updateWaypoints";function Ch(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=To:!l&&c===d.length-1?g=ko:g=qs;var h=g===qs?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:p,target:f});if(y===!1&&(y=r.allowed(h,{connection:s,source:f,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===qs?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:f===To?p:l,target:f===ko?p:u}),d){s.source=f===To?p:l,s.target=f===ko?p:u;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:f===ko?p:u,target:f===To?p:l})),d&&(s.source=f===ko?p:u,s.target=f===To?p:l)}}),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!==qs&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,y=s.hints||{},C={x:M_(a.x),y:M_(a.y)};if(!c)return!1;h===qs?(p?f.splice(l,0,C):f[l]=C,y.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),o.updateWaypoints(u,UM(f),y)):(h===To?(y.docking="source",ku(s)&&(y.docking="target",y.newWaypoints=f.reverse())):h===ko&&(y.docking="target",ku(s)&&(y.docking="source",y.newWaypoints=f.reverse())),o.reconnect(u,d,g,C,y))},this)}Ch.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Ch.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 ku(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===To)return t&&i&&t===i&&n!==i;if(r===ko)return t&&n&&t===n&&n!==i}var jL="reconnectStart",HL="reconnectEnd",A_="updateWaypoints",Ys="connect-ok",Ou="connect-not-ok",P_="connect-hover",T_="djs-updating",k_="djs-dragging",O_=1100;function D_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=Sh(i.getLayer("overlays"));st(f).add("djs-dragging"),i.addMarker(c,k_),i.addMarker(c,T_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,P_),l===A_)return;s?(i.removeMarker(c,Ou),i.addMarker(c,Ys)):s===!1&&(i.removeMarker(c,Ys),i.addMarker(c,Ou))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],O_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,P_),i.removeMarker(s,c?Ys:Ou))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),y={x:o.x,y:o.y},C=a.hints||{},x={};r&&(C.connectionStart&&(x.connectionStart=C.connectionStart),C.connectionEnd&&(x.connectionEnd=C.connectionEnd),p===jL?ku(a)?(x.connectionEnd=x.connectionEnd||y,x.source=g,x.target=u||d,h=h.reverse()):(x.connectionStart=x.connectionStart||y,x.source=u||d,x.target=g):p===HL?ku(a)?(x.connectionStart=x.connectionStart||y,x.source=u||g,x.target=d,h=h.reverse()):(x.connectionEnd=x.connectionEnd||y,x.source=d,x.target=u||g):(x.noCropping=!0,x.noLayout=!0,h[c]=y),p===A_&&(h=e.cropWaypoints(f,h)),x.waypoints=h,r.drawPreview(a,s,x)),kn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],O_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,fn(c),i.removeMarker(s,T_),i.removeMarker(s,k_),l&&(i.removeMarker(l,Ys),i.removeMarker(l,u?Ys:Ou)),r&&r.cleanUp(a)})}D_.$inject=["bendpointMove","injector","eventBus","canvas"];var L_="connect-hover",I_="djs-updating";function B_(e,t,n){return Mh(e,t,e[t]+n)}function Mh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function zL(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 Mh(t,i,s)}function N_(e){return e==="x"?"y":"x"}function $_(e,t,n){var i,r;return e.original?e.original:(i=$e(t),r=N_(n),Mh(e,r,i[r]))}function F_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),y=d-1,C=d,x=f.waypoints,m=x[y],v=x[C],w=Eh(n,x,p),E,P,k;if(E=lr(m,v),!!E)return P=E==="v"?"x":"y",y===0&&(m=$_(m,f.source,P)),C===x.length-1&&(v=$_(v,f.target,P)),w?k=w.point:k={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:f,segmentStartIndex:y,segmentEndIndex:C,segmentStart:m,segmentEnd:v,axis:P,dragPosition:k},i.init(p,k,"connectionSegment.move",{cursor:P==="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 l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,y=g[h],C=p.segmentEndIndex+f,x=g[C],m=N_(p.axis),v=zL(d,y,x,m);kn(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,y){return ff(p[y-1],p[y+1],h)?(d=y<=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=R_(g,f.segmentStart,f.segmentEnd),st(f.draggerGfx).add("djs-dragging"),n.addMarker(d,I_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,y=f.segmentStart,C=f.segmentEnd,x=f.axis,m=f.originalWaypoints.slice(),v=B_(y,x,p["d"+x]),w=B_(C,x,p["d"+x]),E=m.length,P=0;m[g]=v,m[h]=w;var k,$;g<2&&(k=Tn(d.source,v),g===1?k==="intersect"&&(m.shift(),m[0]=v,P--):k!=="intersect"&&(m.unshift(y),P++)),h>E-3&&($=Tn(d.target,w),h===E-2?$==="intersect"&&(m.pop(),m[m.length-1]=w):$!=="intersect"&&m.push(C)),f.newWaypoints=d.waypoints=s(d,m),l(f,P,p),f.newSegmentStartIndex=g+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,L_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,L_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&fn(f.draggerGfx),n.removeMarker(d,I_)}),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(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var y=u(g,h),C=y.waypoints,x=s(d,C),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+m}};o.updateWaypoints(d,x,v)})}F_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var GL=Math.abs,j_=Math.round;function VL(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],GL(r-e)<=n)return r}function H_(e){return{x:e.x,y:e.y}}function z_(e){return{x:e.x+e.width,y:e.y+e.height}}function Mi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:j_(e.x+e.width/2),y:j_(e.y+e.height/2)}}function Ia(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function cn(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function G_(e){return e.children||[]}var WL=Math.abs,V_=Math.round,Ah=10;function W_(e){function t(o,a){if(Ne(o)){for(var s=o.length;s--;)if(WL(o[s]-a)<=Ah)return o[s]}else{o=+o;var c=a%o;if(c<Ah)return a-c;if(c>o-Ah)return a-c+o}return a}function n(o,a){if(o.waypoints)return BL(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,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},H(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,f=c-u;q(o,{dx:o.dx-p,dy:o.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&cn(o,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&cn(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},H(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.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);!Mt(s)||!c||!c.x||!c.y||(cn(o,"x",c.x),cn(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,l=c&&n(c,o),u=o.x,p=o.y,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;q(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(u)!==-1)&&cn(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&cn(o,"y",d)}})}W_.$inject=["eventBus"];const UL={__depends__:[mr,Qi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",C_],bendpointMove:["type",Ch],bendpointMovePreview:["type",D_],connectionSegmentMove:["type",F_],bendpointSnapping:["type",W_]};function U_(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,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!zo(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!zo(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Ph(s)?u:l,connectionEnd:Ph(s)?l:u};gn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){gn(c)||(l=c,c=$e(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}U_.$inject=["eventBus","dragging","modeling","rules"];function Ph(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var qL=1100,YL=900,q_="connect-ok",Y_="connect-not-ok";function K_(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,l=o.start,u=o.startPosition,p=o.target,f=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},g=f,h=d;Ph(o)&&(g=d,h=f),i.drawPreview(o,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",YL,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?q_:Y_)}),t.on(["connect.out","connect.cleanup"],qL,function(r){var o=r.hover;o&&(n.removeMarker(o,q_),n.removeMarker(o,Y_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}K_.$inject=["injector","eventBus","canvas"];const Th={__depends__:[Si,Qi,mr],__init__:["connectPreview"],connect:["type",U_],connectPreview:["type",K_]};var KL="djs-dragger";function _r(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)}_r.$inject=["injector","canvas","graphicsFactory","elementFactory"],_r.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,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Uc(i),r||(r=e.getConnection=XL(function(h,y,C){return g.getConnection(h,y,C)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?$e(o):c,a?$e(a):l]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},_r.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||$e(n),o=t.connectionEnd||$e(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ve(e,s)},_r.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&&cs(o,s,!0)||e,t=i&&cs(a,s,!1)||t,[e,t]},_r.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&fn(e.connectionPreviewGfx)},_r.prototype.getConnection=function(e){var t=ZL(e);return this._elementFactory.createConnection(t)},_r.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Ce(e,{pointerEvents:"none"}),st(e).add(KL),Ve(this._canvas.getActiveLayer(),e),e},_r.prototype.createNoopConnection=function(e,t){return rs([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function XL(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 ZL(e){return gn(e)?e:{}}const QL={__init__:["connectionPreview"],connectionPreview:["type",_r]},Du="complex-preview";class X_{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(Du);n.filter(s=>!JL(s)).forEach(s=>{let c;Mt(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(bo(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(bo(c),s),kn(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 l=this._previewSupport.addDragger(s,a);Mt(s)?kn(l,c.x,c.y):kn(l,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 l=this._graphicsFactory._createContainer("shape",Oe("g"));this._graphicsFactory.drawShape(bo(l),s,{width:c.width,height:c.height}),kn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Uc(this._canvas.getLayer(Du)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Du)}hide(){this._canvas.hideLayer(Du)}}X_.$inject=["canvas","graphicsFactory","previewSupport"];function JL(e){return e.hidden}const eI={__depends__:[Sa],__init__:["complexPreview"],complexPreview:["type",X_]},Z_=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,l=o.createShape(q({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;q(l,{x:u.x-Z_(l.width/2),y:u.y-Z_(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=r.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!zo(d))})},Lu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Lu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const tI={__depends__:[ou,eI,Qd],__init__:["appendPreview"],appendPreview:["type",Lu]};var Q_=Math.min,J_=Math.max;function kh(e){e.preventDefault()}function Ks(e){e.stopPropagation()}function nI(e){return e.nodeType===Node.TEXT_NODE}function iI(e){return[].slice.call(e)}function Bi(e){this.container=e.container,this.parent=Bt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Un(this.autoResize,this),this.handlePaste=Un(this.handlePaste,this)}Bi.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=Di(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);q(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 l=Di(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return q(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&q(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ge.bind(a,"keydown",this.keyHandler),Ge.bind(a,"mousedown",Ks),Ge.bind(a,"paste",r.handlePaste),Ge.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ge.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Bi.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)}},Bi.prototype.insertText=function(e){e=rI(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Bi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=iI(a.childNodes),c,l;if(nI(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,l=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&&Ui(g)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Bi.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})}},Bi.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=Bt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){kh(g),Ks(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ge.bind(document,"mousemove",f),Ge.bind(document,"mouseup",d)},f=function(g){kh(g),Ks(g);var h=Q_(J_(l+g.clientX-s,i),o),y=Q_(J_(u+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){kh(g),Ks(g),Ge.unbind(document,"mousemove",f,!1),Ge.unbind(document,"mouseup",d,!1)};Ge.bind(n,"mousedown",p)}q(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)},Bi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ge.unbind(t,"keydown",this.keyHandler),Ge.unbind(t,"mousedown",Ks),Ge.unbind(t,"input",this.autoResize),Ge.unbind(t,"paste",this.handlePaste),Ge.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Ui(n)),Ui(e)},Bi.prototype.getValue=function(){return this.content.innerText.trim()},Bi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Bi.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 rI(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function oi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Bi({container:t.getContainer(),keyHandler:Un(this._handleKey,this),resizeHandler:Un(this._handleResize,this),focusoutHandler:Un(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}oi.$inject=["eventBus","canvas"],oi.prototype.registerProvider=function(e){this._providers.push(e)},oi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},oi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},oi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},oi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},oi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},oi.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()}},oi.prototype.getValue=function(){return this._textbox.getValue()},oi.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()},oi.prototype._handleResize=function(e){this._fire("resize",e)},oi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},oi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Tt(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 e0={__depends__:[Il],__init__:["directEditing"],directEditing:["type",oi]};function oI(e){return function(t){var n=t.target,i=de(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===at(e);return!o||!a||!s||!c}}const aI={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 ue(e,t={}){var n=aI[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var sI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start")],cI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"})],lI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("timer-intermediate-catch"),ue("escalation-intermediate-throw"),ue("conditional-intermediate-catch"),ue("link-intermediate-catch"),ue("link-intermediate-throw"),ue("compensation-intermediate-throw"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw")],uI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-end"),ue("escalation-end"),ue("error-end"),ue("cancel-end"),ue("compensation-end"),ue("signal-end"),ue("terminate-end")],pI=[ue("exclusive-gateway"),ue("parallel-gateway"),ue("inclusive-gateway"),ue("complex-gateway"),ue("event-based-gateway")],fI=[ue("transaction"),ue("event-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("collapsed-subprocess")],dI=[ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("transaction"),ue("event-subprocess"),ue("collapsed-ad-hoc-subprocess")],t0=[ue("transaction"),ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("event-subprocess")],hI=t0,n0=[ue("task"),ue("user-task"),ue("service-task"),ue("send-task"),ue("receive-task"),ue("manual-task"),ue("rule-task"),ue("script-task"),ue("call-activity"),ue("collapsed-subprocess"),ue("expanded-subprocess"),ue("collapsed-ad-hoc-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],mI=[ue("data-store-reference")],gI=[ue("data-object-reference")],yI=[ue("message-boundary"),ue("timer-boundary"),ue("escalation-boundary"),ue("conditional-boundary"),ue("error-boundary"),ue("cancel-boundary"),ue("signal-boundary"),ue("compensation-boundary"),ue("non-interrupting-message-boundary"),ue("non-interrupting-timer-boundary"),ue("non-interrupting-escalation-boundary"),ue("non-interrupting-conditional-boundary"),ue("non-interrupting-signal-boundary")],vI=[ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start"),ue("error-start"),ue("escalation-start"),ue("compensation-start"),ue("non-interrupting-message-start"),ue("non-interrupting-timer-start"),ue("non-interrupting-conditional-start"),ue("non-interrupting-signal-start"),ue("non-interrupting-escalation-start")],bI=[{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"}],xI=[ue("expanded-pool"),ue("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],wI={"bpmn:MessageEventDefinition":[ue("message-start"),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("message-end")],"bpmn:TimerEventDefinition":[ue("timer-start"),ue("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ue("conditional-start"),ue("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ue("signal-start"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw"),ue("signal-end")],"bpmn:ErrorEventDefinition":[ue("error-start"),ue("error-end")],"bpmn:EscalationEventDefinition":[ue("escalation-start"),ue("escalation-intermediate-throw"),ue("escalation-end")],"bpmn:CompensateEventDefinition":[ue("compensation-start"),ue("compensation-intermediate-throw"),ue("compensation-end")]};const i0={"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 Ai(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()}Ai.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Ai.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Ai.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if($e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=nI(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,fI):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,dI):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=vI[r]||[],!Fn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=nt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(o=nt(rI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Participant")?(o=nt(yI,function(c){return at(e)!==c.target.isExpanded}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&Fn(t.$parent)?(o=nt(mI.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&!Fn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(o=nt(oI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:EndEvent")?(o=nt(sI.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):M(t,"bpmn:BoundaryEvent")?(o=nt(hI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(o=nt(aI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Gateway")?(o=nt(cI,a),this._createEntries(e,o)):M(t,"bpmn:Transaction")?(o=nt(J_,a),this._createEntries(e,o)):Fn(t)&&at(e)?(o=nt(pI,a),this._createEntries(e,o)):M(t,"bpmn:AdHocSubProcess")&&at(e)?(o=nt(uI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&at(e)?(o=nt(lI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&!at(e)?(o=nt(e0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,gI):M(t,"bpmn:FlowNode")?(o=nt(e0,a),this._createEntries(e,o)):{})},Ai.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!Fn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),jv(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ai.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Ai.prototype._createSequenceFlowEntries=function(e,t){var n=pe(e),i={},r=this._modeling,o=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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&&M(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:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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},Ai.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}},Ai.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=pe(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"}}}},Ai.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}}},Ai.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Ai.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=pe(e),i=this,r=Hv(e),o=M(e,"bpmn:BoundaryEvent")?t0["intermediate-event-non-interrupting"]:t0["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 bI={__depends__:[wh,sx,iu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ai]};function Xs(e,t,n,i,r,o,a,s,c,l,u,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=l,this._rules=u,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(!(!ws(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Xs.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Xs.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&U(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Xs.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return $e(t)?lo(e,n=>t.includes(n)):t},Xs.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,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&U(u,g()),u;var p=e.businessObject;function f(m,v){r.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,w=t.getPad(m).html,S=w.getBoundingClientRect(),k={x:S.left,y:S.bottom+v};return k}function y(m,v,w,S){function k(T,D){var j=i.createShape(U({type:m},S));o.start(T,j,{source:D})}var O=s?function(T,D){var j=i.createShape(U({type:m},S));s.append(D,j)}:k,N=s?function(T,D){return l.create(D,m,S),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:w,action:{dragstart:k,click:O,hover:N}}}function C(m){return function(v,w){n.splitLane(w,m),t.open(w,!0)}}if(et(p,["bpmn:Lane","bpmn:Participant"])&&at(e)){var x=Fr(e);U(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),x.length<2&&((xn(e)?e.height>=120:e.width>=120)&&U(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:C(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&U(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:C(3)}}})),U(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?U(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):n0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?U(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!n0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Fn(p)&&U(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||U(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(m,v){var w=U(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),et(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{"append.text-annotation":y("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}}}),M(p,"bpmn:TextAnnotation")&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),et(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&U(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&U(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&U(u,g()),u};function n0(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return z(o,function(a){a.$type===n&&(r=!0)}),i&&r}const xI={__depends__:[QL,Q_,kw,Si,Ph,Il,bI],__init__:["contextPadProvider"],contextPadProvider:["type",Xs]};var wI={horizontal:["x","width"],vertical:["y","height"]},i0=5;function Er(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return $e(i)?i:i?n:[]})}Er.$inject=["modeling","rules"],Er.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Er.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},Er.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(z(t,function(o){r=o(r,n,i)}),r):e},Er.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=ji(e,i);return z(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},Er.prototype._setOrientation=function(e){var t=wI[e];this._axis=t[0],this._dimension=t[1]},Er.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)},Er.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+i0,max:t+n-i0}};const _I={__init__:["distributeElements"],distributeElements:["type",Er]};function Du(e){Ei.call(this,e)}Du.$inject=["eventBus"],Ee(Du,Ei),Du.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=nt(t,function(n){var i=et(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=qc(t),t.length<3?!1:t})};var r0={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function Ai(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()}Ai.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Ai.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Ai.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ne(e)||!n.allowed("shape.replace",{element:e}))return{};var a=oI(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,mI):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,gI):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=wI[r]||[],!Fn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=it(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(o=it(sI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Participant")?(o=it(xI,function(c){return at(e)!==c.target.isExpanded}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&Fn(t.$parent)?(o=it(vI.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:StartEvent")&&!Fn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(o=it(cI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:EndEvent")?(o=it(uI.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):M(t,"bpmn:BoundaryEvent")?(o=it(yI,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(o=it(lI.concat(i),a),this._createEntries(e,o)):M(t,"bpmn:Gateway")?(o=it(pI,a),this._createEntries(e,o)):M(t,"bpmn:Transaction")?(o=it(t0,a),this._createEntries(e,o)):Fn(t)&&at(e)?(o=it(hI,a),this._createEntries(e,o)):M(t,"bpmn:AdHocSubProcess")&&at(e)?(o=it(dI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&at(e)?(o=it(fI,a),this._createEntries(e,o)):M(t,"bpmn:SubProcess")&&!at(e)?(o=it(n0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,bI):M(t,"bpmn:FlowNode")?(o=it(n0,a),this._createEntries(e,o)):{})},Ai.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!Fn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),zv(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Ai.prototype._createEntries=function(e,t){var n={},i=this;return H(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Ai.prototype._createSequenceFlowEntries=function(e,t){var n=de(e),i={},r=this._modeling,o=this._moddle,a=this;return H(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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&&M(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:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(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},Ai.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}},Ai.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=de(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"}}}},Ai.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}}},Ai.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Ai.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=de(e),i=this,r=Gv(e),o=M(e,"bpmn:BoundaryEvent")?i0["intermediate-event-non-interrupting"]:i0["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 _I={__depends__:[_h,lx,ou],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ai]};function Xs(e,t,n,i,r,o,a,s,c,l,u,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=l,this._rules=u,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(!(!ws(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Xs.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Xs.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&q(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Xs.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ne(t)?lo(e,n=>t.includes(n)):t},Xs.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,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&q(u,g()),u;var p=e.businessObject;function f(m,v){r.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,w=t.getPad(m).html,E=w.getBoundingClientRect(),P={x:E.left,y:E.bottom+v};return P}function y(m,v,w,E){function P(N,L){var z=i.createShape(q({type:m},E));o.start(N,z,{source:L})}var k=s?function(N,L){var z=i.createShape(q({type:m},E));s.append(L,z)}:P,$=s?function(N,L){return l.create(L,m,E),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:w,action:{dragstart:P,click:k,hover:$}}}function C(m){return function(v,w){n.splitLane(w,m),t.open(w,!0)}}if(tt(p,["bpmn:Lane","bpmn:Participant"])&&at(e)){var x=Fr(e);q(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),x.length<2&&((xn(e)?e.height>=120:e.width>=120)&&q(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:C(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&q(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:C(3)}}})),q(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?q(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):r0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?q(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!r0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Fn(p)&&q(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||q(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(m,v){var w=q(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&q(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&q(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),tt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(u,{"append.text-annotation":y("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}}}),M(p,"bpmn:TextAnnotation")&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),tt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&q(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&q(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&q(u,g()),u};function r0(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return H(o,function(a){a.$type===n&&(r=!0)}),i&&r}const EI={__depends__:[tI,e0,Dw,Si,Th,Nl,_I],__init__:["contextPadProvider"],contextPadProvider:["type",Xs]};var SI={horizontal:["x","width"],vertical:["y","height"]},o0=5;function Er(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ne(i)?i:i?n:[]})}Er.$inject=["modeling","rules"],Er.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Er.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},Er.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(H(t,function(o){r=o(r,n,i)}),r):e},Er.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=ji(e,i);return H(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},Er.prototype._setOrientation=function(e){var t=SI[e];this._axis=t[0],this._dimension=t[1]},Er.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)},Er.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+o0,max:t+n-o0}};const RI={__init__:["distributeElements"],distributeElements:["type",Er]};function Iu(e){Ei.call(this,e)}Iu.$inject=["eventBus"],Re(Iu,Ei),Iu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=it(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Kc(t),t.length<3?!1:t})};var a0={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>`},EI=900;function Zs(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",EI,this)}Zs.$inject=["popupMenu","distributeElements","translate","rules"],Zs.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&U(t,this._getEntries(e)),t},Zs.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Zs.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:r0.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:r0.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const SI={__depends__:[wh,_I],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Du],distributeElementsMenuProvider:["type",Zs]};var o0="is not a registered action",RI="is already registered";function Pi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Pi.$inject=["eventBus","injector"],Pi.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),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=$e(p)?p:u;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&($e(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Pi.prototype.trigger=function(e,t){if(!this._actions[e])throw kh(e,o0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Pi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,r){n._registerAction(r,i)})},Pi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw kh(e,RI);this._actions[e]=t},Pi.prototype.unregister=function(e){if(!this.isRegistered(e))throw kh(e,o0);this._actions[e]=void 0},Pi.prototype.getActions=function(){return Object.keys(this._actions)},Pi.prototype.isRegistered=function(e){return!!this._actions[e]};function kh(e,t){return new Error(e+" "+t)}const CI={__init__:["editorActions"],editorActions:["type",Pi]};function Lu(e){e.invoke(Pi,this)}Ee(Lu,Pi),Lu.$inject=["injector"],Lu.prototype._registerDefaultActions=function(e){Pi.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),l=e.get("alignElements",!1),u=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(y){return y!==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(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],C=g.type;h.length&&(y=nt(h,function(x){return!M(x,"bpmn:Lane")}),l.trigger(y,C))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;M(g,"bpmn:Collaboration")?y=n.filter(function(C){return M(C.parent,"bpmn:Collaboration")}):y=n.filter(function(C){return C!==g&&!M(C.parent,"bpmn:SubProcess")}),h=rn(y),f.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const MI={__depends__:[CI],editorActions:["type",Lu]};function a0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;et(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}a0.$inject=["eventBus"];function Oo(e,t){le.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;Kn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Oo.$inject=["eventBus","gridSnapping","modeling"],Ee(Oo,le),Oo.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},Oo.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},Oo.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),U(e,o),e},Oo.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),U(e,o),e};var AI=2e3;function s0(e,t){e.on(["spaceTool.move","spaceTool.end"],AI,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)}})}s0.$inject=["eventBus","gridSnapping"];const PI={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Oo],gridSnappingSpaceToolBehavior:["type",s0]};var Iu=10;function Oh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var TI=1200,kI=800;function Qr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",kI,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"],TI,function(o){var a=o.originalEvent;if(!(!r.active||a&&ti(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=DI(o,l,e);p&&(u.offset=p);var f=OI(o,l);f&&U(u,f),Ia(o,l)||r.snapEvent(o,l,u)})}})}Qr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);cn(e,t,i)},Qr.prototype.getGridSpacing=function(){return Iu},Qr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Oh(e,Iu);var i,r;return t&&t.min&&(i=t.min,He(i)&&(i=Oh(i+n,Iu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,He(r)&&(r=Oh(r+n,Iu,"floor"),e=Math.min(e,r))),e-=n,e},Qr.prototype.isActive=function(){return this.active},Qr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Qr.prototype.toggleActive=function(){this.setActive(!this.active)},Qr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function OI(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&&(Bu(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,l=r.max;return c&&(Bu(t)?l0(s)?a.x.max=c.left:a.x.min=c.right:c0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Bu(t)?l0(s)?a.x.min=l.left:a.x.max=l.right:c0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function DI(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&He(s[t])||(s||(s=o.snapOffset={}),He(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Bu(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 Bu(e){return e==="x"}function c0(e){return e.indexOf("n")!==-1}function l0(e){return e.indexOf("w")!==-1}const LI={__depends__:[PI],__init__:["gridSnapping"],gridSnapping:["type",Qr]};var II=2e3;function u0(e,t,n){e.on("autoPlace",II,function(i){var r=i.source,o=Fe(r),a=i.shape,s=Jx(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(BI(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}u0.$inject=["eventBus","gridSnapping","elementRegistry"];function BI(e){return e==="x"}var NI=1750;function p0(e,t,n){t.on(["create.start","shape.move.start"],NI,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!M(o,"bpmn:Participant")||!M(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}))}})}p0.$inject=["canvas","eventBus","gridSnapping"];var $I=3e3;function Nu(e,t,n){le.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],$I,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||FI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Nu.$inject=["eventBus","gridSnapping","modeling"],Ee(Nu,le),Nu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=zI(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function FI(e){return e.length>3}function jI(e){return e==="h"}function HI(e){return e==="v"}function zI(e,t,n){var i=lr(t,n),r={};return jI(i)&&(r.y=e.snapValue(t.y)),HI(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=U({},t,r),n=U({},n,r)),[t,n]}const GI={__depends__:[LI,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",u0],gridSnappingParticipantBehavior:["type",p0],gridSnappingLayoutConnectionBehavior:["type",Nu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",a0]};var VI=30,f0=30;function Qs(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(M(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(M(r,"bpmn:Participant"))return at(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(M(r,"bpmn:SubProcess"))return at(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Qs.$inject=["eventBus","interactionEvents"],Qs.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Qs.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=xn(e)?{width:VI,height:e.height}:{width:e.width,height:f0};return this._interactionEvents.createBoxHit(t,"all",n),!0},Qs.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:f0}),!0};const WI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Qs]};function $u(e){e.invoke(Aa,this)}Ee($u,Aa),$u.$inject=["injector"],$u.prototype.registerBindings=function(e,t){Aa.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 UI={__depends__:[ah],__init__:["keyboardBindings"],keyboardBindings:["type",$u]};var qI={moveSpeed:1,moveSpeedAccelerated:10},YI=1500,d0="left",h0="up",m0="right",g0="down",KI={ArrowLeft:d0,Left:d0,ArrowUp:h0,Up:h0,ArrowRight:m0,Right:m0,ArrowDown:g0,Down:g0},XI={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 y0(e,t,n,i,r){var o=this;this._config=U({},qI,e||{}),t.addListener(YI,function(a){var s=a.keyEvent,c=KI[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=XI[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}y0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const ZI={__depends__:[ah,Si],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",y0]};var v0=10;function Js(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=NP(u,p,l),c.newBounds=FP(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Be(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Ry(p),!QI(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}Js.prototype.canResize=function(e){var t=this._rules,n=Di(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Js.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=U({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,b0(t,o),"resize",{autoActivate:!0,cursor:JI(o),data:{shape:t,context:r}})},Js.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:v0,height:v0},r=fv(t,e.childrenBoxPadding),jP(n,t,i,r)},Js.$inject=["eventBus","rules","modeling","dragging"];function QI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function b0(e,t){var n=Fe(e),i=Be(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 JI(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 x0="djs-resizing",w0="resize-not-ok",eB=500;function _0(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,x0)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?st(c).remove(w0):st(c).add(w0)}function r(o){var a=o.shape,s=o.frame;s&&fn(o.frame),t.removeMarker(a,x0)}e.on("resize.move",eB,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}_0.$inject=["eventBus","canvas","previewSupport"];var Fu=-6,ju=8,Hu=20,ec="djs-resizer",tB=["n","w","s","e","nw","ne","se","sw"];function Jr(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&&z(a,Un(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Jr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Hr(o)&&i.activate(o,e,n)}ze.bind(t,"mousedown",r),ze.bind(t,"touchstart",r)},Jr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=nB(i),a=Oe("g");st(a).add(ec),st(a).add(ec+"-"+e.id),st(a).add(ec+"-"+i),Ge(r,a);var s=Oe("rect");Se(s,{x:-ju/2+o.x,y:-ju/2+o.y,width:ju,height:ju}),st(s).add(ec+"-visual"),Ge(a,s);var c=Oe("rect");return Se(c,{x:-Hu/2+o.x,y:-Hu/2+o.y,width:Hu,height:Hu}),st(c).add(ec+"-hit"),Ge(a,c),Jc(a,t,n),a},Jr.prototype.createResizer=function(e,t){var n=b0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Jr.prototype.addResizer=function(e){var t=this;Mt(e)||z(tB,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Jr.prototype.removeResizers=function(){var e=this._getResizersParent();Vc(e)},Jr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Jr.$inject=["eventBus","canvas","selection","resize"];function nB(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Fu:e.indexOf("w")!==-1&&(t.x=Fu),e.indexOf("s")!==-1?t.y=-Fu:e.indexOf("n")!==-1&&(t.y=Fu),t}const E0={__depends__:[Qi,mr,Sa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Js],resizePreview:["type",_0],resizeHandles:["type",Jr]};var iB=2e3;function tc(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"],iB,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 l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||et(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}tc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],tc.prototype.activate=function(e){var t=mi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);U(n,i);var r={},o=n.style||{};return U(o,{backgroundColor:null,border:null}),(et(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||S0(e))&&U(r,{centerVertically:!0}),Nr(e)&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(U(r,{resizable:!0,autoResize:!0}),U(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),U(n,{options:r,style:o}),n}},tc.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(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||aB(e)){var g=xn(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};U(o,h),U(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(oB(e)){var y=xn(e),C=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};U(o,C),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(et(e,["bpmn:Task","bpmn:CallActivity"])||S0(e))&&(U(o,{width:i.width,height:i.height}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),rB(e)&&(U(o,{width:i.width,x:i.x}),U(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,m=i.width+2*x;if(n.labelTarget&&(U(o,{width:m,height:i.height+2*x,x:i.x-x,y:i.y-x}),U(d,{fontSize:l+"px",lineHeight:u})),Nr(n)&&!nl(n)&&!Qe(n)){var v=gf(e),w=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),S=l,k=xo.width*a+2*x;U(o,{width:k,height:S+2*x,x:w.x-k/2,y:w.y-S/2-x}),U(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(U(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),U(d,{textAlign:"left",paddingTop:pa*a+"px",paddingBottom:pa*a+"px",paddingLeft:pa*a+"px",paddingRight:pa*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},tc.prototype.update=function(e,t,n,i){var r,o;M(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}),sB(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function S0(e){return M(e,"bpmn:SubProcess")&&!at(e)}function rB(e){return M(e,"bpmn:SubProcess")&&at(e)}function oB(e){return M(e,"bpmn:Participant")&&!at(e)}function aB(e){return M(e,"bpmn:Participant")&&at(e)}function sB(e){return!e||!e.trim()}var R0="djs-element-hidden",C0="djs-label-hidden";function M0(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,M(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Oe("path");Se(p,{d:u,strokeWidth:2,stroke:cB(o)}),Ge(s,p),Ge(r,s),kn(s,o.x,o.y)}M(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,R0):(M(o,"bpmn:Task")||M(o,"bpmn:CallActivity")||M(o,"bpmn:SubProcess")||M(o,"bpmn:Participant")||M(o,"bpmn:Lane"))&&t.addMarker(o,C0)}),e.on("directEditing.resize",function(c){if(M(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Se(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,R0),t.removeMarker(o,C0)),o=void 0,a=void 0,s&&(fn(s),s=void 0)})}M0.$inject=["eventBus","canvas","pathMap"];function cB(e,t){var n=ut(e);return n.get("stroke")||t||"black"}const lB={__depends__:[Ld,E0,Q_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",tc],labelEditingPreview:["type",M0]};var uB=500,pB=1e3;function tr(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){FM(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){z(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],uB,function(o){var a=o.element,s=o.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}tr.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ge(t,n),this.updateOutline(e,n)),n},tr.prototype._createOutlineGfx=function(){var e=Oe("rect");return Se(e,U({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},tr.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},tr.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(r){n=n||r.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},tr.prototype.updateConnectionOutline=function(e,t){var n=rn(t);Se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},tr.prototype.registerProvider=function(e,t){t||(t=e,e=pB),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},tr.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},tr.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){yn(i.getOutline)&&(t=t||i.getOutline(e))}),t},tr.$inject=["eventBus","styles","elementRegistry"];var zu=6;function Dh(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)})}Dh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Vc(t);var n=e.length>1,i=this._canvas.getContainer();if(st(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=fB(rn(e)),o=Oe("rect");Se(o,U({rx:3},r)),st(o).add("djs-selection-outline"),Ge(t,o)}},Dh.$inject=["eventBus","canvas","selection"];function fB(e){return{x:e.x-zu,y:e.y-zu,width:e.width+zu*2,height:e.height+zu*2}}const Lh={__depends__:[Si],__init__:["outline","multiSelectionOutline"],outline:["type",tr],multiSelectionOutline:["type",Dh]},A0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],P0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},dB=15,Gu=2;function T0(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=>et(g,A0));if(f.length===1){const g=f[0];Qe(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Qe),h=f.find(y=>{var C;return(C=y.labels)==null?void 0:C.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!et(p,A0)||!u(p)||(Qe(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=rs([Fe(f),Fe(p)],P0),g=d.getAttribute("d"),y=r.isSelected(p)?c(p):l(p),C=cs(y,g);if(!C)return;const m=r.isSelected(f)?c(f):l(f),v=cs(m,g)||Fe(f);vs(v,C)<dB||(cf(d,[v,C]),Ge(o,d))}function s(){Gc(`.${P0.class}`,o).forEach(fn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+eo(f,"x")-Gu,y:p.y+eo(f,"y")-Gu,width:eo(f,"width")+Gu*2,height:eo(f,"height")+Gu*2};return vf(d,eo(f,"rx"))}if(f.cx){const d=eo(f,"r"),g={x:p.x+eo(f,"cx")-d,y:p.y+eo(f,"cy")-d,width:d*2,height:d*2};return Ky(g)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}T0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function eo(e,t){return parseFloat(Se(e,t)||0)}const hB={__depends__:[Si,Lh],__init__:["labelLink"],labelLink:["type",T0]};var mB=new Ea("tt");function gB(e){var t=Bt('<div class="djs-tooltip-container" />');return Hn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function yB(e,t,n){Hn(e,{left:t+"px",top:n+"px"})}function Ih(e,t){e.style.display=t===!1?"none":""}var k0="djs-tooltip",Bh="."+k0;function Yn(e,t){this._eventBus=e,this._canvas=t,this._ids=mB,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=gB(t.getContainer());var n=this;Qn.bind(this._tooltipRoot,Bh,"mousedown",function(i){i.stopPropagation()}),Qn.bind(this._tooltipRoot,Bh,"mouseover",function(i){n.trigger("mouseover",i)}),Qn.bind(this._tooltipRoot,Bh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Yn.$inject=["eventBus","canvas"],Yn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=U({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Yn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Nn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Yn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Yn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Yn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Yn.prototype.remove=function(e){var t=this.get(e);t&&(Ui(t.html),Ui(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Yn.prototype.show=function(){Ih(this._tooltipRoot)},Yn.prototype.hide=function(){Ih(this._tooltipRoot,!1)},Yn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Yn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Kn(n)&&(n=Bt(n)),i=Bt('<div data-tooltip-id="'+t+'" class="'+k0+'">'),Hn(i,{position:"absolute"}),i.appendChild(n),e.type&&Ht(i).add("djs-tooltip-"+e.type),e.className&&Ht(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Yn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;yB(n,t.x,t.y)},Yn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Ih(i,r))})},Yn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const vB={__init__:["tooltips"],tooltips:["type",Yn]};var bB="flow elements must be children of pools/participants",xB="Data object must be placed within a pool/participant.";function O0(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;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(r,n(bB)):M(a,"bpmn:DataObjectReference")&&i(r,n(xB)))})}O0.$inject=["eventBus","tooltips","translate"];const wB={__depends__:[vB],__init__:["modelingFeedback"],modelingFeedback:["type",O0]};var _B=500,EB=1250,SB=1500,Vu=Math.round;function RB(e){return{x:e.x+Vu(e.width/2),y:e.y+Vu(e.height/2)}}function D0(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",SB,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=CB(u),U(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",EB,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",_B,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Vu(l.x),l.y=Vu(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Hr(s)){var c=ba(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(gn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!st(s.target).has("djs-hit-no-move")){var p=RB(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}D0.$inject=["eventBus","dragging","modeling","selection","rules"];function CB(e){var t=Vo(e,"id");return nt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var L0=499,Nh="djs-dragging",I0="drop-ok",B0="drop-not-ok",N0="new-parent",$0="attach-ok";function F0(e,t,n,i){function r(c){var l=o(c),u=MB(l);return u}function o(c){var l=os(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[$0,I0,B0,N0].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,Nh),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",L0,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=Oe("g");Se(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ge(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=op([p,o(u)]):p=o(u),z(p,function(h){t.addMarker(h,Nh)}),l.allDraggedElements=p,l.differentParents=AB(u)}),e.on("shape.move.move",L0,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,$0):l.canExecute&&f&&p.id!==f.id?a(p,N0):a(p,l.canExecute?I0:B0)),kn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,Nh)}),p&&fn(p)}),this.makeDraggable=s}F0.$inject=["eventBus","canvas","styles","previewSupport"];function MB(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=nt(e,function(i){return Mt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function AB(e){return p1(Vo(e,function(t){return t.parent&&t.parent.id}))!==1}const PB={__depends__:[Dl,Si,Lh,Qi,mr,Sa],__init__:["move","movePreview"],move:["type",D0],movePreview:["type",F0]};var j0=".djs-palette-toggle",H0=".entry",TB=j0+", "+H0,$h="djs-palette-",kB="shown",Fh="open",z0="two-column",OB=1e3;function ln(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()})}ln.$inject=["eventBus","canvas"],ln.prototype.registerProvider=function(e,t){t||(t=e,e=OB),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},ln.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(LB,{})},ln.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},ln.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Bt(ln.HTML_MARKUP);n.appendChild(i),Ht(n).add($h+kB),Qn.bind(i,TB,"click",function(r){var o=r.delegateTarget;if(Qp(o,j0))return e.toggle();e.trigger("click",r)}),ze.bind(i,"mousedown",function(r){r.stopPropagation()}),Qn.bind(i,H0,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},ln.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},ln.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Ht(n),a=Ht(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(z0,r),a.toggle($h+z0,r),"open"in e&&(o.toggle(Fh,e.open),a.toggle($h+Fh,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},ln.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Hc(e),z(t,function(n,i){var r=n.group||"default",o=Rt("[data-group="+js(r)+"]",e);o||(o=Bt('<div class="group"></div>'),Nn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Bt(a);if(o.appendChild(s),!n.separator&&(Nn(s,"data-action",i),n.title&&Nn(s,"title",n.title),n.className&&DB(s,n.className),n.imageUrl)){var c=Bt("<img>");Nn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},ln.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Nn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},ln.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(yn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},ln.prototype._layoutChanged=function(){this._toggleState({})},ln.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},ln.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},ln.prototype.open=function(){this._toggleState({open:!0})},ln.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ln.prototype.isActiveTool=function(e){return e&&this._activeTool===e},ln.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Rt(".djs-palette-entries",this._container),this._toolsContainer=Rt("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Ht(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},ln.prototype.isOpen=function(){return Ht(this._container).has(Fh)},ln.prototype._getParentContainer=function(){return this._canvas.getContainer()},ln.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function DB(e,t){var n=Ht(e),i=$e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function LB(e,t){var n=t.getPaletteEntries();return yn(n)?n(e):(z(n,function(i,r){e[r]=i}),e)}const IB={__init__:["palette"],palette:["type",ln]};var G0="crosshair",V0="selected",BB="djs-dragging-active-lasso";function to(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=Oe("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ge(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Se(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 y of h)g.has(y)||t.removeMarker(y,V0);for(const y of g)h.has(y)||t.addMarker(y,V0)}},remove:function(p){this.update(p),p.frame&&fn(p.frame),l(!1)}};function l(p){st(t.getContainer()).toggle(BB,p)}function u(p){var f=i.getAll();return new Set(Go(aa(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=W0(p),f.add=Cl(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=W0(p),g=u(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(Cl(p))return s.activateLasso(p.originalEvent),!0})}to.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],to.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:G0,data:{context:{}},keepSelection:!0})},to.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:G0,data:{context:{}},keepSelection:!0})},to.prototype._select=function(e){this._selection.select(e)},to.prototype.select=function(e,t,n=[]){var i=Go(aa(e,t));this._select([...n,...i])},to.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},to.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function W0(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 NB={__depends__:[Nl,Ss],__init__:["lassoTool"],lassoTool:["type",to]};var jh=1500,U0="grab";function Ba(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",jh,function(c){if(ws(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(jh,function(c){if(!(!q0(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(jh,function(c){!q0(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!ws(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ba.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ba.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:U0,data:{context:n||{}}})},Ba.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:U0,data:{context:{reactivate:n}}})},Ba.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ba.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function q0(e){return dn("Space",e)}const $B={__depends__:[Nl,Ss],__init__:["handTool"],handTool:["type",Ba]};var Y0="connect-ok",K0="connect-not-ok";function Na(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 l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?Y0:K0))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?Y0:K0)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}Na.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Na.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Na.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Na.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Na.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const FB={__depends__:[Ph,Qi,mr,Nl,Ss],globalConnect:["type",Na]};function Hh(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)}Hh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Hh.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 y(C){var x=n.createShape(U({type:p},h));t.start(C,x)}return{group:f,className:d,title:g,action:{dragstart:y,click:y}}}function l(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 u(p){t.start(p,n.createParticipantShape())}return U(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:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const jB={__depends__:[IB,Il,dx,NB,$B,FB,hs],__init__:["paletteProvider"],paletteProvider:["type",Hh]};var HB=250;function zh(e,t,n,i,r){le.call(this,e);function o(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);U(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Rt('[data-element-id="'+js(f.id)+'"]',s.dragGroup);g&&Se(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=Rt('[data-element-id="'+js(u)+'"]',s.dragGroup);p&&Se(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",HB,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}zh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(zh,le);const zB={__depends__:[Sa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",zh]};var GB=1250,Gh=40,VB=20,WB=10,X0=20,Z0=["x","y"],UB=Math.abs;function Q0(e){e.on(["connect.hover","connect.move","connect.end"],GB,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&ti(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&qB(t,o,ZB(o)),o&&XB(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Mi(r),et(o,["bpmn:Event","bpmn:Gateway"])&&J0(t,Mi(o)),et(o,["bpmn:Task","bpmn:SubProcess"])&&YB(t,o),M(a,"bpmn:BoundaryEvent")&&s===a.host&&KB(t)):eE(i,"bpmn:MessageFlow")?(M(r,"bpmn:Event")&&(n.connectionStart=Mi(r)),M(o,"bpmn:Event")&&J0(t,Mi(o))):n.connectionStart=n.initialConnectionStart)})}Q0.$inject=["eventBus"];function qB(e,t,n){Z0.forEach(function(i){var r=tE(i,t);e[i]<t[i]+n?cn(e,i,t[i]+n):e[i]>t[i]+r-n&&cn(e,i,t[i]+r-n)})}function YB(e,t){var n=Mi(t);Z0.forEach(function(i){QB(e,t,i)&&cn(e,i,n[i])})}function KB(e){var t=e.context,n=t.source,i=t.target;if(!JB(t)){var r=Mi(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],l;UB(c-r[s])<Gh&&(c>r[s]?l=r[s]+Gh:l=r[s]-Gh,cn(e,s,l))})}}function J0(e,t){cn(e,"x",t.x),cn(e,"y",t.y)}function eE(e,t){return e&&e.type===t}function XB(e,t){return Rr(t,function(n){return eE(e,n)})}function tE(e,t){return e==="x"?t.width:t.height}function ZB(e){return M(e,"bpmn:Task")?WB:VB}function QB(e,t,n){return e[n]>t[n]+X0&&e[n]<t[n]+tE(n,t)-X0}function JB(e){var t=e.hover,n=e.source;return t&&n&&t===n}function no(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}no.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},no.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},no.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},no.prototype.getSnapLocations=function(){return this._snapLocations},no.prototype.setSnapLocations=function(e){this._snapLocations=e},no.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&&HL(e[n],r[n],i)},Wu.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(r){t.add(i,r)})})};var eN=1250;function nr(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"],eN,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&ti(r.originalEvent))&&!(Ia(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}nr.$inject=["elementRegistry","eventBus","snapping"],nr.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new no);var o;t.get(i.id)?o=Mi(i,e):o={x:e.x+Mi(i).x,y:e.y+Mi(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}),Qe(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},nr.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(r){if(Qe(r)){Qe(t)&&e.add("mid",Mi(r));return}if(Mt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);z(o,function(a){e.add("mid",a)});return}e.add("mid",Mi(r))}),!He(t.x)||!He(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Mi(t)),e},nr.prototype.getSnapTargets=function(e,t){return H_(t).filter(function(n){return!tN(n)})};function tN(e){return!!e.hidden}var nE=1500;function $a(e,t){t.invoke(nr,this),e.on(["create.move","create.end"],nE,oN),e.on(["create.move","create.end","shape.move.move","shape.move.end"],nE,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Ia(n)&&nN(n,o)})}Ee($a,nr),$a.$inject=["eventBus","injector"],$a.prototype.initSnap=function(e){var t=nr.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",rE(o,i,e))}),z(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",rE(o,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},$a.prototype.addSnapTargetPoints=function(e,t,n){nr.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(o){(rN(o)||iN([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",F_(o)),e.add("bottom-right",j_(o)))});var r=this._elementRegistry;return z(t.incoming,function(o){if(r.get(t.id)){iE(i,o.source)||e.add("mid",Fe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),z(t.outgoing,function(o){if(r.get(t.id)){iE(i,o.target)||e.add("mid",Fe(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},$a.prototype.getSnapTargets=function(e,t){return nr.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function nN(e,t){var n=Be(t),i=lb(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Fe(o),/top/.test(i)?cn(e,"y",n.top-a.y):/bottom/.test(i)&&cn(e,"y",n.bottom-a.y),/left/.test(i)?cn(e,"x",n.left-a.x):/right/.test(i)&&cn(e,"x",n.right-a.x)}function iN(e,t){return e.every(function(n){return M(n,t)})}function rN(e){return M(e,"bpmn:SubProcess")&&at(e)?!0:M(e,"bpmn:Participant")}function oN(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)&&cn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&cn(e,"y",e.y)}}function iE(e,t){return e.indexOf(t)!==-1}function rE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var aN=1250;function nc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],aN,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&ti(i.originalEvent))&&!Ia(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),lN(s)&&cn(i,"x",i.x),uN(s)&&cn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}nc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new no);var o=oE(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},nc.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return z(r,function(o){e.add("corner",j_(o)),e.add("corner",F_(o))}),e.add("corner",oE(t,i)),e},nc.$inject=["eventBus","snapping"],nc.prototype.getSnapTargets=function(e,t){return H_(t).filter(function(n){return!sN(n,e)&&!Mt(n)&&!cN(n)&&!Qe(n)})};function oE(e,t){var n=Fe(e),i=Be(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 sN(e,t){return e.host===t}function cN(e){return!!e.hidden}function lN(e){return e==="n"||e==="s"}function uN(e){return e==="e"||e==="w"}var pN=7,fN=1e3;function io(e){this._canvas=e,this._asyncHide=sp(Un(this.hide,this),fN)}io.$inject=["canvas"],io.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Ia(e,"x"),y:Ia(e,"y")};z(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,pN),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),z(["x","y"],function(a){var s=o[a];gn(s)&&cn(e,a,s.originValue)})},io.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Se(n,{d:"M0,0 L0,0"}),st(n).add("djs-snap-line"),Ge(t,n),{update:function(i){He(i)?e==="horizontal"?Se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Se(n,{display:"none"})}}},io.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},io.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},io.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},io.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const dN={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",nr],resizeSnapping:["type",nc],snapping:["type",io]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Q0],createMoveSnapping:["type",$a]};var aE=300;function Ve(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=Rt(Ve.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(Ve.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ve.$inject=["canvas","eventBus","selection","translate"],Ve.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Qn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ve.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ve.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ve.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ve.INPUT_SELECTOR,"keydown",function(n){dn("ArrowUp",n)&&n.preventDefault(),dn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ve.INPUT_SELECTOR,"keyup",function(n){if(dn("Escape",n))return e.close();if(dn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(dn("ArrowUp",n))return e._scrollToDirection(!0);if(dn("ArrowDown",n))return e._scrollToDirection();dn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ve.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Qn.unbind(e.el,e.type,e.listener)})},Ve.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=Rt(Ve.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ve.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ve.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)}},Ve.prototype._clearResults=function(){Hc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ve.prototype._getCurrentResult=function(){return Rt(Ve.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ve.prototype._createResultNode=function(e,t){var n=Bt(Ve.RESULT_HTML);return e.primaryTokens.length>0&&sE(n,e.primaryTokens,Ve.RESULT_PRIMARY_HTML),sE(n,e.secondaryTokens,Ve.RESULT_SECONDARY_HTML),Nn(n,Ve.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ve.prototype.registerProvider=function(e){this._searchProvider=e},Ve.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Ht(this._canvas.getContainer()).add("djs-search-open"),Ht(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ve.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Ht(this._canvas.getContainer()).remove("djs-search-open"),Ht(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ve.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ve.prototype.isOpen=function(){return this._open},Ve.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ht(t).remove(Ve.RESULT_SELECTED_CLASS);var n=Nn(e,Ve.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ht(e).add(Ve.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:aE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ve.prototype._select=function(e){var t=Nn(e,Ve.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:aE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ve.prototype._getBoxHtml=function(){const e=Bt(Ve.BOX_HTML),t=Rt(Ve.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function sE(e,t,n){var i=hN(t),r=Bt(n);r.innerHTML=i,e.appendChild(r)}function hN(e){var t="";return e.forEach(function(n){var i=mw(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ve.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ve.CONTAINER_SELECTOR=".djs-search-container",Ve.INPUT_SELECTOR=".djs-search-input input",Ve.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ve.RESULT_SELECTOR=".djs-search-result",Ve.RESULT_SELECTED_CLASS="djs-search-result-selected",Ve.RESULT_SELECTED_SELECTOR="."+Ve.RESULT_SELECTED_CLASS,Ve.RESULT_ID_ATTRIBUTE="data-result-id",Ve.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ve.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},CI=900;function Zs(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",CI,this)}Zs.$inject=["popupMenu","distributeElements","translate","rules"],Zs.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&q(t,this._getEntries(e)),t},Zs.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Zs.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:a0.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:a0.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const MI={__depends__:[_h,RI],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Iu],distributeElementsMenuProvider:["type",Zs]};var s0="is not a registered action",AI="is already registered";function Pi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Pi.$inject=["eventBus","injector"],Pi.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),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var f=Ne(p)?p:u;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),f;p!==!1&&(Ne(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Pi.prototype.trigger=function(e,t){if(!this._actions[e])throw Oh(e,s0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Pi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);H(e,function(i,r){n._registerAction(r,i)})},Pi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Oh(e,AI);this._actions[e]=t},Pi.prototype.unregister=function(e){if(!this.isRegistered(e))throw Oh(e,s0);this._actions[e]=void 0},Pi.prototype.getActions=function(){return Object.keys(this._actions)},Pi.prototype.isRegistered=function(e){return!!this._actions[e]};function Oh(e,t){return new Error(e+" "+t)}const PI={__init__:["editorActions"],editorActions:["type",Pi]};function Bu(e){e.invoke(Pi,this)}Re(Bu,Pi),Bu.$inject=["injector"],Bu.prototype._registerDefaultActions=function(e){Pi.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),l=e.get("alignElements",!1),u=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(y){return y!==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(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],C=g.type;h.length&&(y=it(h,function(x){return!M(x,"bpmn:Lane")}),l.trigger(y,C))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;M(g,"bpmn:Collaboration")?y=n.filter(function(C){return M(C.parent,"bpmn:Collaboration")}):y=n.filter(function(C){return C!==g&&!M(C.parent,"bpmn:SubProcess")}),h=rn(y),f.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const TI={__depends__:[PI],editorActions:["type",Bu]};function c0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}c0.$inject=["eventBus"];function Oo(e,t){pe.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;Kn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Oo.$inject=["eventBus","gridSnapping","modeling"],Re(Oo,pe),Oo.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},Oo.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},Oo.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),q(e,o),e},Oo.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),q(e,o),e};var kI=2e3;function l0(e,t){e.on(["spaceTool.move","spaceTool.end"],kI,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)}})}l0.$inject=["eventBus","gridSnapping"];const OI={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Oo],gridSnappingSpaceToolBehavior:["type",l0]};var Nu=10;function Dh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var DI=1200,LI=800;function Qr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",LI,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"],DI,function(o){var a=o.originalEvent;if(!(!r.active||a&&ti(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=BI(o,l,e);p&&(u.offset=p);var f=II(o,l);f&&q(u,f),Ia(o,l)||r.snapEvent(o,l,u)})}})}Qr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);cn(e,t,i)},Qr.prototype.getGridSpacing=function(){return Nu},Qr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Dh(e,Nu);var i,r;return t&&t.min&&(i=t.min,ze(i)&&(i=Dh(i+n,Nu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ze(r)&&(r=Dh(r+n,Nu,"floor"),e=Math.min(e,r))),e-=n,e},Qr.prototype.isActive=function(){return this.active},Qr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Qr.prototype.toggleActive=function(){this.setActive(!this.active)},Qr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function II(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&&($u(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,l=r.max;return c&&($u(t)?p0(s)?a.x.max=c.left:a.x.min=c.right:u0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&($u(t)?p0(s)?a.x.min=l.left:a.x.max=l.right:u0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function BI(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ze(s[t])||(s||(s=o.snapOffset={}),ze(s[t])||(s[t]=0),!r)||(n.get(r.id)||($u(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 $u(e){return e==="x"}function u0(e){return e.indexOf("n")!==-1}function p0(e){return e.indexOf("w")!==-1}const NI={__depends__:[OI],__init__:["gridSnapping"],gridSnapping:["type",Qr]};var $I=2e3;function f0(e,t,n){e.on("autoPlace",$I,function(i){var r=i.source,o=$e(r),a=i.shape,s=tw(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],M(a,"bpmn:TextAnnotation")&&(FI(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}f0.$inject=["eventBus","gridSnapping","elementRegistry"];function FI(e){return e==="x"}var jI=1750;function d0(e,t,n){t.on(["create.start","shape.move.start"],jI,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!M(o,"bpmn:Participant")||!M(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}))}})}d0.$inject=["canvas","eventBus","gridSnapping"];var HI=3e3;function Fu(e,t,n){pe.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],HI,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||zI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Fu.$inject=["eventBus","gridSnapping","modeling"],Re(Fu,pe),Fu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=WI(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function zI(e){return e.length>3}function GI(e){return e==="h"}function VI(e){return e==="v"}function WI(e,t,n){var i=lr(t,n),r={};return GI(i)&&(r.y=e.snapValue(t.y)),VI(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=q({},t,r),n=q({},n,r)),[t,n]}const UI={__depends__:[NI,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",f0],gridSnappingParticipantBehavior:["type",d0],gridSnappingLayoutConnectionBehavior:["type",Fu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",c0]};var qI=30,h0=30;function Qs(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(M(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(M(r,"bpmn:Participant"))return at(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(M(r,"bpmn:SubProcess"))return at(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Qs.$inject=["eventBus","interactionEvents"],Qs.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Qs.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=xn(e)?{width:qI,height:e.height}:{width:e.width,height:h0};return this._interactionEvents.createBoxHit(t,"all",n),!0},Qs.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:h0}),!0};const YI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Qs]};function ju(e){e.invoke(Aa,this)}Re(ju,Aa),ju.$inject=["injector"],ju.prototype.registerBindings=function(e,t){Aa.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 KI={__depends__:[sh],__init__:["keyboardBindings"],keyboardBindings:["type",ju]};var XI={moveSpeed:1,moveSpeedAccelerated:10},ZI=1500,m0="left",g0="up",y0="right",v0="down",QI={ArrowLeft:m0,Left:m0,ArrowUp:g0,Up:g0,ArrowRight:y0,Right:y0,ArrowDown:v0,Down:v0},JI={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 b0(e,t,n,i,r){var o=this;this._config=q({},XI,e||{}),t.addListener(ZI,function(a){var s=a.keyEvent,c=QI[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=JI[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}b0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const eB={__depends__:[sh,Si],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",b0]};var x0=10;function Js(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=jP(u,p,l),c.newBounds=zP(d,f),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:Ie(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=My(p),!tB(l,p))return;n.resizeShape(l,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}Js.prototype.canResize=function(e){var t=this._rules,n=Di(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Js.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=q({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,w0(t,o),"resize",{autoActivate:!0,cursor:nB(o),data:{shape:t,context:r}})},Js.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:x0,height:x0},r=hv(t,e.childrenBoxPadding),GP(n,t,i,r)},Js.$inject=["eventBus","rules","modeling","dragging"];function tB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function w0(e,t){var n=$e(e),i=Ie(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 nB(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 _0="djs-resizing",E0="resize-not-ok",iB=500;function S0(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,_0)),s.width>5&&Ce(c,{x:s.x,width:s.width}),s.height>5&&Ce(c,{y:s.y,height:s.height}),o.canExecute?st(c).remove(E0):st(c).add(E0)}function r(o){var a=o.shape,s=o.frame;s&&fn(o.frame),t.removeMarker(a,_0)}e.on("resize.move",iB,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}S0.$inject=["eventBus","canvas","previewSupport"];var Hu=-6,zu=8,Gu=20,ec="djs-resizer",rB=["n","w","s","e","nw","ne","se","sw"];function Jr(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&&H(a,Un(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Jr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Hr(o)&&i.activate(o,e,n)}Ge.bind(t,"mousedown",r),Ge.bind(t,"touchstart",r)},Jr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=oB(i),a=Oe("g");st(a).add(ec),st(a).add(ec+"-"+e.id),st(a).add(ec+"-"+i),Ve(r,a);var s=Oe("rect");Ce(s,{x:-zu/2+o.x,y:-zu/2+o.y,width:zu,height:zu}),st(s).add(ec+"-visual"),Ve(a,s);var c=Oe("rect");return Ce(c,{x:-Gu/2+o.x,y:-Gu/2+o.y,width:Gu,height:Gu}),st(c).add(ec+"-hit"),Ve(a,c),tl(a,t,n),a},Jr.prototype.createResizer=function(e,t){var n=w0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Jr.prototype.addResizer=function(e){var t=this;Mt(e)||H(rB,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Jr.prototype.removeResizers=function(){var e=this._getResizersParent();Uc(e)},Jr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Jr.$inject=["eventBus","canvas","selection","resize"];function oB(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Hu:e.indexOf("w")!==-1&&(t.x=Hu),e.indexOf("s")!==-1?t.y=-Hu:e.indexOf("n")!==-1&&(t.y=Hu),t}const R0={__depends__:[Qi,mr,Sa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Js],resizePreview:["type",S0],resizeHandles:["type",Jr]};var aB=2e3;function tc(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"],aB,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 l=c.context,u=l.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}tc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],tc.prototype.activate=function(e){var t=mi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);q(n,i);var r={},o=n.style||{};return q(o,{backgroundColor:null,border:null}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||C0(e))&&q(r,{centerVertically:!0}),Nr(e)&&(q(r,{resizable:!0,autoResize:!0}),q(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(q(r,{resizable:!0,autoResize:!0}),q(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),q(n,{options:r,style:o}),n}},tc.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(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||lB(e)){var g=xn(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};q(o,h),q(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(cB(e)){var y=xn(e),C=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};q(o,C),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||C0(e))&&(q(o,{width:i.width,height:i.height}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),sB(e)&&(q(o,{width:i.width,x:i.x}),q(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,m=i.width+2*x;if(n.labelTarget&&(q(o,{width:m,height:i.height+2*x,x:i.x-x,y:i.y-x}),q(d,{fontSize:l+"px",lineHeight:u})),Nr(n)&&!rl(n)&&!Je(n)){var v=yf(e),w=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),E=l,P=xo.width*a+2*x;q(o,{width:P,height:E+2*x,x:w.x-P/2,y:w.y-E/2-x}),q(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(q(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),q(d,{textAlign:"left",paddingTop:pa*a+"px",paddingBottom:pa*a+"px",paddingLeft:pa*a+"px",paddingRight:pa*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},tc.prototype.update=function(e,t,n,i){var r,o;M(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}),uB(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function C0(e){return M(e,"bpmn:SubProcess")&&!at(e)}function sB(e){return M(e,"bpmn:SubProcess")&&at(e)}function cB(e){return M(e,"bpmn:Participant")&&!at(e)}function lB(e){return M(e,"bpmn:Participant")&&at(e)}function uB(e){return!e||!e.trim()}var M0="djs-element-hidden",A0="djs-label-hidden";function P0(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,M(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Oe("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Oe("path");Ce(p,{d:u,strokeWidth:2,stroke:pB(o)}),Ve(s,p),Ve(r,s),kn(s,o.x,o.y)}M(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,M0):(M(o,"bpmn:Task")||M(o,"bpmn:CallActivity")||M(o,"bpmn:SubProcess")||M(o,"bpmn:Participant")||M(o,"bpmn:Lane"))&&t.addMarker(o,A0)}),e.on("directEditing.resize",function(c){if(M(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(o.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Ce(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,M0),t.removeMarker(o,A0)),o=void 0,a=void 0,s&&(fn(s),s=void 0)})}P0.$inject=["eventBus","canvas","pathMap"];function pB(e,t){var n=ut(e);return n.get("stroke")||t||"black"}const fB={__depends__:[Id,R0,e0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",tc],labelEditingPreview:["type",P0]};var dB=500,hB=1e3;function tr(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){zM(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){H(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],dB,function(o){var a=o.element,s=o.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}tr.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ve(t,n),this.updateOutline(e,n)),n},tr.prototype._createOutlineGfx=function(){var e=Oe("rect");return Ce(e,q({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},tr.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},tr.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&H(i,function(r){n=n||r.updateOutline(t,e)}),n||Ce(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},tr.prototype.updateConnectionOutline=function(e,t){var n=rn(t);Ce(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},tr.prototype.registerProvider=function(e,t){t||(t=e,e=hB),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},tr.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},tr.prototype.getOutline=function(e){var t,n=this._getProviders();return H(n,function(i){yn(i.getOutline)&&(t=t||i.getOutline(e))}),t},tr.$inject=["eventBus","styles","elementRegistry"];var Vu=6;function Lh(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)})}Lh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Uc(t);var n=e.length>1,i=this._canvas.getContainer();if(st(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=mB(rn(e)),o=Oe("rect");Ce(o,q({rx:3},r)),st(o).add("djs-selection-outline"),Ve(t,o)}},Lh.$inject=["eventBus","canvas","selection"];function mB(e){return{x:e.x-Vu,y:e.y-Vu,width:e.width+Vu*2,height:e.height+Vu*2}}const Ih={__depends__:[Si],__init__:["outline","multiSelectionOutline"],outline:["type",tr],multiSelectionOutline:["type",Lh]},T0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],k0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},gB=15,Wu=2;function O0(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=>tt(g,T0));if(f.length===1){const g=f[0];Je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Je),h=f.find(y=>{var C;return(C=y.labels)==null?void 0:C.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!tt(p,T0)||!u(p)||(Je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=rs([$e(f),$e(p)],k0),g=d.getAttribute("d"),y=r.isSelected(p)?c(p):l(p),C=cs(y,g);if(!C)return;const m=r.isSelected(f)?c(f):l(f),v=cs(m,g)||$e(f);vs(v,C)<gB||(lf(d,[v,C]),Ve(o,d))}function s(){Wc(`.${k0.class}`,o).forEach(fn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+eo(f,"x")-Wu,y:p.y+eo(f,"y")-Wu,width:eo(f,"width")+Wu*2,height:eo(f,"height")+Wu*2};return bf(d,eo(f,"rx"))}if(f.cx){const d=eo(f,"r"),g={x:p.x+eo(f,"cx")-d,y:p.y+eo(f,"cy")-d,width:d*2,height:d*2};return Zy(g)}}function l(p){return n.getShapePath(p)}function u(p){return r.isSelected(p)}}O0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function eo(e,t){return parseFloat(Ce(e,t)||0)}const yB={__depends__:[Si,Ih],__init__:["labelLink"],labelLink:["type",O0]};var vB=new Ea("tt");function bB(e){var t=Bt('<div class="djs-tooltip-container" />');return Hn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function xB(e,t,n){Hn(e,{left:t+"px",top:n+"px"})}function Bh(e,t){e.style.display=t===!1?"none":""}var D0="djs-tooltip",Nh="."+D0;function Yn(e,t){this._eventBus=e,this._canvas=t,this._ids=vB,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=bB(t.getContainer());var n=this;Qn.bind(this._tooltipRoot,Nh,"mousedown",function(i){i.stopPropagation()}),Qn.bind(this._tooltipRoot,Nh,"mouseover",function(i){n.trigger("mouseover",i)}),Qn.bind(this._tooltipRoot,Nh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Yn.$inject=["eventBus","canvas"],Yn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=q({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Yn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Nn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Yn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Yn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Yn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Yn.prototype.remove=function(e){var t=this.get(e);t&&(Ui(t.html),Ui(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Yn.prototype.show=function(){Bh(this._tooltipRoot)},Yn.prototype.hide=function(){Bh(this._tooltipRoot,!1)},Yn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Yn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Kn(n)&&(n=Bt(n)),i=Bt('<div data-tooltip-id="'+t+'" class="'+D0+'">'),Hn(i,{position:"absolute"}),i.appendChild(n),e.type&&Ht(i).add("djs-tooltip-"+e.type),e.className&&Ht(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Yn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;xB(n,t.x,t.y)},Yn.prototype._updateTooltipVisibilty=function(e){H(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Bh(i,r))})},Yn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const wB={__init__:["tooltips"],tooltips:["type",Yn]};var _B="flow elements must be children of pools/participants",EB="Data object must be placed within a pool/participant.";function L0(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;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(r,n(_B)):M(a,"bpmn:DataObjectReference")&&i(r,n(EB)))})}L0.$inject=["eventBus","tooltips","translate"];const SB={__depends__:[wB],__init__:["modelingFeedback"],modelingFeedback:["type",L0]};var RB=500,CB=1250,MB=1500,Uu=Math.round;function AB(e){return{x:e.x+Uu(e.width/2),y:e.y+Uu(e.height/2)}}function I0(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",MB,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=PB(u),q(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",CB,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",RB,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Uu(l.x),l.y=Uu(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Hr(s)){var c=ba(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(gn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!st(s.target).has("djs-hit-no-move")){var p=AB(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}I0.$inject=["eventBus","dragging","modeling","selection","rules"];function PB(e){var t=Vo(e,"id");return it(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var B0=499,$h="djs-dragging",N0="drop-ok",$0="drop-not-ok",F0="new-parent",j0="attach-ok";function H0(e,t,n,i){function r(c){var l=o(c),u=TB(l);return u}function o(c){var l=os(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[j0,N0,$0,F0].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,$h),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",B0,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=r(u);if(!l.dragGroup){var d=Oe("g");Ce(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ve(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=sp([p,o(u)]):p=o(u),H(p,function(h){t.addMarker(h,$h)}),l.allDraggedElements=p,l.differentParents=kB(u)}),e.on("shape.move.move",B0,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,j0):l.canExecute&&f&&p.id!==f.id?a(p,F0):a(p,l.canExecute?N0:$0)),kn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;H(u,function(f){t.removeMarker(f,$h)}),p&&fn(p)}),this.makeDraggable=s}H0.$inject=["eventBus","canvas","styles","previewSupport"];function TB(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=it(e,function(i){return Mt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function kB(e){return d1(Vo(e,function(t){return t.parent&&t.parent.id}))!==1}const OB={__depends__:[Il,Si,Ih,Qi,mr,Sa],__init__:["move","movePreview"],move:["type",I0],movePreview:["type",H0]};var z0=".djs-palette-toggle",G0=".entry",DB=z0+", "+G0,Fh="djs-palette-",LB="shown",jh="open",V0="two-column",IB=1e3;function ln(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()})}ln.$inject=["eventBus","canvas"],ln.prototype.registerProvider=function(e,t){t||(t=e,e=IB),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},ln.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(NB,{})},ln.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},ln.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Bt(ln.HTML_MARKUP);n.appendChild(i),Ht(n).add(Fh+LB),Qn.bind(i,DB,"click",function(r){var o=r.delegateTarget;if(Jp(o,z0))return e.toggle();e.trigger("click",r)}),Ge.bind(i,"mousedown",function(r){r.stopPropagation()}),Qn.bind(i,G0,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},ln.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},ln.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Ht(n),a=Ht(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(V0,r),a.toggle(Fh+V0,r),"open"in e&&(o.toggle(jh,e.open),a.toggle(Fh+jh,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},ln.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Gc(e),H(t,function(n,i){var r=n.group||"default",o=Rt("[data-group="+js(r)+"]",e);o||(o=Bt('<div class="group"></div>'),Nn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Bt(a);if(o.appendChild(s),!n.separator&&(Nn(s,"data-action",i),n.title&&Nn(s,"title",n.title),n.className&&BB(s,n.className),n.imageUrl)){var c=Bt("<img>");Nn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},ln.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Nn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},ln.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(yn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},ln.prototype._layoutChanged=function(){this._toggleState({})},ln.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},ln.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},ln.prototype.open=function(){this._toggleState({open:!0})},ln.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ln.prototype.isActiveTool=function(e){return e&&this._activeTool===e},ln.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Rt(".djs-palette-entries",this._container),this._toolsContainer=Rt("[data-group=tools]",t)),n=this._toolsContainer,H(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Ht(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},ln.prototype.isOpen=function(){return Ht(this._container).has(jh)},ln.prototype._getParentContainer=function(){return this._canvas.getContainer()},ln.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function BB(e,t){var n=Ht(e),i=Ne(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function NB(e,t){var n=t.getPaletteEntries();return yn(n)?n(e):(H(n,function(i,r){e[r]=i}),e)}const $B={__init__:["palette"],palette:["type",ln]};var W0="crosshair",U0="selected",FB="djs-dragging-active-lasso";function to(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=Oe("rect");Ce(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ve(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Ce(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 y of h)g.has(y)||t.removeMarker(y,U0);for(const y of g)h.has(y)||t.addMarker(y,U0)}},remove:function(p){this.update(p),p.frame&&fn(p.frame),l(!1)}};function l(p){st(t.getContainer()).toggle(FB,p)}function u(p){var f=i.getAll();return new Set(Go(aa(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=q0(p),f.add=Al(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=q0(p),g=u(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(Al(p))return s.activateLasso(p.originalEvent),!0})}to.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],to.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:W0,data:{context:{}},keepSelection:!0})},to.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:W0,data:{context:{}},keepSelection:!0})},to.prototype._select=function(e){this._selection.select(e)},to.prototype.select=function(e,t,n=[]){var i=Go(aa(e,t));this._select([...n,...i])},to.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},to.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function q0(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 jB={__depends__:[Fl,Ss],__init__:["lassoTool"],lassoTool:["type",to]};var Hh=1500,Y0="grab";function Ba(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",Hh,function(c){if(ws(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Hh,function(c){if(!(!K0(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Hh,function(c){!K0(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!ws(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ba.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ba.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Y0,data:{context:n||{}}})},Ba.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Y0,data:{context:{reactivate:n}}})},Ba.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ba.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function K0(e){return dn("Space",e)}const HB={__depends__:[Fl,Ss],__init__:["handTool"],handTool:["type",Ba]};var X0="connect-ok",Z0="connect-not-ok";function Na(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 l=c.context,u=c.hover,p=l.canStartConnect=s.canStartConnect(u);p!==null&&(l.startTarget=u,i.addMarker(u,p?X0:Z0))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?X0:Z0)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}Na.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Na.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Na.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Na.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Na.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const zB={__depends__:[Th,Qi,mr,Fl,Ss],globalConnect:["type",Na]};function zh(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)}zh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],zh.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 y(C){var x=n.createShape(q({type:p},h));t.start(C,x)}return{group:f,className:d,title:g,action:{dragstart:y,click:y}}}function l(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 u(p){t.start(p,n.createParticipantShape())}return q(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:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const GB={__depends__:[$B,Nl,mx,jB,HB,zB,hs],__init__:["paletteProvider"],paletteProvider:["type",zh]};var VB=250;function Gh(e,t,n,i,r){pe.call(this,e);function o(s){var c=s.canExecute.replacements;H(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);q(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Rt('[data-element-id="'+js(f.id)+'"]',s.dragGroup);g&&Ce(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;H(c,function(l,u){var p=Rt('[data-element-id="'+js(u)+'"]',s.dragGroup);p&&Ce(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",VB,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}Gh.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Re(Gh,pe);const WB={__depends__:[Sa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Gh]};var UB=1250,Vh=40,qB=20,YB=10,Q0=20,J0=["x","y"],KB=Math.abs;function eE(e){e.on(["connect.hover","connect.move","connect.end"],UB,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&ti(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&XB(t,o,eN(o)),o&&JB(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Mi(r),tt(o,["bpmn:Event","bpmn:Gateway"])&&tE(t,Mi(o)),tt(o,["bpmn:Task","bpmn:SubProcess"])&&ZB(t,o),M(a,"bpmn:BoundaryEvent")&&s===a.host&&QB(t)):nE(i,"bpmn:MessageFlow")?(M(r,"bpmn:Event")&&(n.connectionStart=Mi(r)),M(o,"bpmn:Event")&&tE(t,Mi(o))):n.connectionStart=n.initialConnectionStart)})}eE.$inject=["eventBus"];function XB(e,t,n){J0.forEach(function(i){var r=iE(i,t);e[i]<t[i]+n?cn(e,i,t[i]+n):e[i]>t[i]+r-n&&cn(e,i,t[i]+r-n)})}function ZB(e,t){var n=Mi(t);J0.forEach(function(i){tN(e,t,i)&&cn(e,i,n[i])})}function QB(e){var t=e.context,n=t.source,i=t.target;if(!nN(t)){var r=Mi(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],l;KB(c-r[s])<Vh&&(c>r[s]?l=r[s]+Vh:l=r[s]-Vh,cn(e,s,l))})}}function tE(e,t){cn(e,"x",t.x),cn(e,"y",t.y)}function nE(e,t){return e&&e.type===t}function JB(e,t){return Rr(t,function(n){return nE(e,n)})}function iE(e,t){return e==="x"?t.width:t.height}function eN(e){return M(e,"bpmn:Task")?YB:qB}function tN(e,t,n){return e[n]>t[n]+Q0&&e[n]<t[n]+iE(n,t)-Q0}function nN(e){var t=e.hover,n=e.source;return t&&n&&t===n}function no(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}no.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},no.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},no.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},no.prototype.getSnapLocations=function(){return this._snapLocations},no.prototype.setSnapLocations=function(e){this._snapLocations=e},no.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new qu,n.initDefaults(this._defaultSnaps)),n};function qu(){this._snapValues={}}qu.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)},qu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&VL(e[n],r[n],i)},qu.prototype.initDefaults=function(e){var t=this;H(e||{},function(n,i){H(n,function(r){t.add(i,r)})})};var iN=1250;function nr(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"],iN,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&ti(r.originalEvent))&&!(Ia(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}nr.$inject=["elementRegistry","eventBus","snapping"],nr.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new no);var o;t.get(i.id)?o=Mi(i,e):o={x:e.x+Mi(i).x,y:e.y+Mi(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}),Je(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},nr.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return H(i,function(r){if(Je(r)){Je(t)&&e.add("mid",Mi(r));return}if(Mt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);H(o,function(a){e.add("mid",a)});return}e.add("mid",Mi(r))}),!ze(t.x)||!ze(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Mi(t)),e},nr.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!rN(n)})};function rN(e){return!!e.hidden}var rE=1500;function $a(e,t){t.invoke(nr,this),e.on(["create.move","create.end"],rE,cN),e.on(["create.move","create.end","shape.move.move","shape.move.end"],rE,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Ia(n)&&oN(n,o)})}Re($a,nr),$a.$inject=["eventBus","injector"],$a.prototype.initSnap=function(e){var t=nr.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return H(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",aE(o,i,e))}),H(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",aE(o,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},$a.prototype.addSnapTargetPoints=function(e,t,n){nr.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);H(i,function(o){(sN(o)||aN([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",H_(o)),e.add("bottom-right",z_(o)))});var r=this._elementRegistry;return H(t.incoming,function(o){if(r.get(t.id)){oE(i,o.source)||e.add("mid",$e(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),H(t.outgoing,function(o){if(r.get(t.id)){oE(i,o.target)||e.add("mid",$e(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},$a.prototype.getSnapTargets=function(e,t){return nr.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function oN(e,t){var n=Ie(t),i=pb(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=$e(o),/top/.test(i)?cn(e,"y",n.top-a.y):/bottom/.test(i)&&cn(e,"y",n.bottom-a.y),/left/.test(i)?cn(e,"x",n.left-a.x):/right/.test(i)&&cn(e,"x",n.right-a.x)}function aN(e,t){return e.every(function(n){return M(n,t)})}function sN(e){return M(e,"bpmn:SubProcess")&&at(e)?!0:M(e,"bpmn:Participant")}function cN(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)&&cn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&cn(e,"y",e.y)}}function oE(e,t){return e.indexOf(t)!==-1}function aE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var lN=1250;function nc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],lN,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&ti(i.originalEvent))&&!Ia(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),fN(s)&&cn(i,"x",i.x),dN(s)&&cn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}nc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new no);var o=sE(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},nc.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return H(r,function(o){e.add("corner",z_(o)),e.add("corner",H_(o))}),e.add("corner",sE(t,i)),e},nc.$inject=["eventBus","snapping"],nc.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!uN(n,e)&&!Mt(n)&&!pN(n)&&!Je(n)})};function sE(e,t){var n=$e(e),i=Ie(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 uN(e,t){return e.host===t}function pN(e){return!!e.hidden}function fN(e){return e==="n"||e==="s"}function dN(e){return e==="e"||e==="w"}var hN=7,mN=1e3;function io(e){this._canvas=e,this._asyncHide=lp(Un(this.hide,this),mN)}io.$inject=["canvas"],io.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Ia(e,"x"),y:Ia(e,"y")};H(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(H(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,hN),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),H(["x","y"],function(a){var s=o[a];gn(s)&&cn(e,a,s.originValue)})},io.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Ce(n,{d:"M0,0 L0,0"}),st(n).add("djs-snap-line"),Ve(t,n),{update:function(i){ze(i)?e==="horizontal"?Ce(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Ce(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Ce(n,{display:"none"})}}},io.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},io.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},io.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},io.prototype.hide=function(){H(this._snapLines,function(e){e.update()})};const gN={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",nr],resizeSnapping:["type",nc],snapping:["type",io]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",eE],createMoveSnapping:["type",$a]};var cE=300;function We(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=Rt(We.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(We.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}We.$inject=["canvas","eventBus","selection","translate"],We.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Qn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,We.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,We.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,We.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,We.INPUT_SELECTOR,"keydown",function(n){dn("ArrowUp",n)&&n.preventDefault(),dn("ArrowDown",n)&&n.preventDefault()}),t(this._container,We.INPUT_SELECTOR,"keyup",function(n){if(dn("Escape",n))return e.close();if(dn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(dn("ArrowUp",n))return e._scrollToDirection(!0);if(dn("ArrowDown",n))return e._scrollToDirection();dn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},We.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Qn.unbind(e.el,e.type,e.listener)})},We.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=Rt(We.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},We.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},We.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)}},We.prototype._clearResults=function(){Gc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},We.prototype._getCurrentResult=function(){return Rt(We.RESULT_SELECTED_SELECTOR,this._resultsContainer)},We.prototype._createResultNode=function(e,t){var n=Bt(We.RESULT_HTML);return e.primaryTokens.length>0&&lE(n,e.primaryTokens,We.RESULT_PRIMARY_HTML),lE(n,e.secondaryTokens,We.RESULT_SECONDARY_HTML),Nn(n,We.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},We.prototype.registerProvider=function(e){this._searchProvider=e},We.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Ht(this._canvas.getContainer()).add("djs-search-open"),Ht(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},We.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Ht(this._canvas.getContainer()).remove("djs-search-open"),Ht(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},We.prototype.toggle=function(){this.isOpen()?this.close():this.open()},We.prototype.isOpen=function(){return this._open},We.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ht(t).remove(We.RESULT_SELECTED_CLASS);var n=Nn(e,We.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ht(e).add(We.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:cE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},We.prototype._select=function(e){var t=Nn(e,We.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:cE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},We.prototype._getBoxHtml=function(){const e=Bt(We.BOX_HTML),t=Rt(We.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function lE(e,t,n){var i=yN(t),r=Bt(n);r.innerHTML=i,e.appendChild(r)}function yN(e){var t="";return e.forEach(function(n){var i=yw(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+We.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}We.CONTAINER_SELECTOR=".djs-search-container",We.INPUT_SELECTOR=".djs-search-input input",We.RESULTS_CONTAINER_SELECTOR=".djs-search-results",We.RESULT_SELECTOR=".djs-search-result",We.RESULT_SELECTED_CLASS="djs-search-result-selected",We.RESULT_SELECTED_SELECTOR="."+We.RESULT_SELECTED_CLASS,We.RESULT_ID_ATTRIBUTE="data-result-id",We.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",We.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>`,Ve.RESULT_HTML='<div class="djs-search-result"></div>',Ve.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ve.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const mN={__depends__:[hs,su,Si],searchPad:["type",Ve]};function Vh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Vh.$inject=["elementRegistry","searchPad","canvas","search"],Vh.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Qe(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:mi(i),id:i.id})),e,{keys:["label","id"]}).map(gN)};function gN(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const yN={__depends__:[mN,b_],__init__:["bpmnSearch"],bpmnSearch:["type",Vh]},vN="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",bN="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",xN={width:36,height:50},wN={width:50,height:50};function cE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Ti=5;function Uu(e,t){this._styles=t,e.registerProvider(this)}Uu.$inject=["outline","styles"],Uu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(IA(e))return n=Oe("rect"),Se(n,U({x:-Ti,y:-Ti,rx:4,width:e.width+Ti*2,height:e.height+Ti*2},t)),n;if(!Qe(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),U(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,U({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):et(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Se(n,U({x:-Ti,y:-Ti,rx:14,width:e.width+Ti*2,height:e.height+Ti*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Ti+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),Se(n,U({cx:e.width/2,cy:e.height/2,r:e.width/2+Ti},t))):M(e,"bpmn:DataObjectReference")&&lE(e,"bpmn:DataObjectReference")?n=cE(vN,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&lE(e,"bpmn:DataStoreReference")&&(n=cE(bN,{x:-6,y:-6},t)),n},Uu.prototype.updateOutline=function(e,t){if(!Qe(e))return et(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+Ti*2,height:e.height+Ti*2}),!0):!!et(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function lE(e,t){var n;return t==="bpmn:DataObjectReference"?n=xN:t==="bpmn:DataStoreReference"&&(n=wN),e.width===n.width&&e.height===n.height}const _N={__depends__:[Lh],__init__:["outlineProvider"],outlineProvider:["type",Uu]};var EN='<?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 ir(e){la.call(this,e)}Ee(ir,la),ir.Viewer=Xr,ir.NavigatedViewer=Hs,ir.prototype.createDiagram=function(){return this.importXML(EN)},ir.prototype._interactionModules=[_w,Sw,Mw],ir.prototype._modelingModules=[RL,iu,TL,AL,GL,Ph,KL,xI,nx,Il,SI,MI,GI,WI,UI,ZI,lB,hB,Zd,wB,PB,jB,zB,E0,dN,yN,_N],ir.prototype._modules=[].concat(Xr.prototype._modules,ir.prototype._interactionModules,ir.prototype._modelingModules);const SN=he.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=he.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Ap(u);return r("imported",p),{warnings:p}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return he.onMounted(async()=>{a=new ir({container:o.value,moddleExtensions:_c,additionalModules:[fw]}),i.xml&&await s(i.xml),r("ready")}),he.watch(()=>i.xml,l=>{l&&a&&s(l)}),he.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(he.openBlock(),he.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),Wh=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},RN=Wh(SN,[["__scopeId","data-v-07ee17c9"]]),CN=["title","aria-expanded"],MN=["title","onClick"],AN={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},PN={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},TN={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},kN={key:0,class:"bwl-validation__body"},ON={key:0,class:"bwl-validation__empty"},DN={key:1,class:"bwl-validation__empty"},LN={key:2,class:"bwl-validation__list"},IN=["onClick"],BN={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},NN={class:"bwl-validation__msg"},$N=["title"],FN=Wh(he.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=he.computed(()=>aw(n.issues.value,n.describeElement)),r=he.computed(()=>sw(i.value)),o=g=>Ma(g,n.changeScope.value),a=he.computed(()=>ih(i.value,n.changeScope.value)),s=he.ref({error:!0,warning:!0,info:!0}),c=he.computed(()=>cw(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=he.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(he.openBlock(),he.createElementBlock("section",{class:he.normalizeClass(["bwl-validation",{"is-open":l.value}])},[he.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[he.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(he.openBlock(),he.createElementBlock("svg",{class:he.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[he.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=he.createElementVNode("span",null,"검증",-1))],8,CN),he.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=he.withModifiers(()=>{},["stop"]))},[(he.openBlock(),he.createElementBlock(he.Fragment,null,he.renderList(u,y=>he.createElementVNode("button",{key:y,type:"button",class:he.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:C=>f(y)},[(he.openBlock(),he.createElementBlock("svg",AN,[h[4]||(h[4]=he.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(he.openBlock(),he.createElementBlock("path",PN)):(he.openBlock(),he.createElementBlock("path",TN))])),he.createElementVNode("span",null,he.toDisplayString(r.value[y]),1)],10,MN)),64))])]),l.value?(he.openBlock(),he.createElementBlock("div",kN,[i.value.length===0?(he.openBlock(),he.createElementBlock("p",ON,"발견된 문제가 없습니다.")):c.value.length===0?(he.openBlock(),he.createElementBlock("p",DN," 선택한 심각도에 해당하는 항목이 없습니다. ")):(he.openBlock(),he.createElementBlock("ul",LN,[(he.openBlock(!0),he.createElementBlock(he.Fragment,null,he.renderList(c.value,y=>(he.openBlock(),he.createElementBlock("li",{key:y.key,class:he.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:C=>d(y)},[h[5]||(h[5]=he.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(he.openBlock(),he.createElementBlock("span",BN,"이번 변경")):he.createCommentVNode("",!0),he.createElementVNode("span",NN,he.toDisplayString(y.message),1),he.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},he.toDisplayString(y.category),9,$N)],10,IN))),128))]))])):he.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),jN={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},HN=["aria-checked","title","data-locale","onClick"],zN={class:"bwl-locale__label"},GN={key:0,class:"bwl-locale__badge"},VN=Wh(he.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(o){try{return new Intl.DisplayNames([o],{type:"language"}).of(o)??o}catch{return o}}const r=he.computed(()=>{const o=n.i18n.value;return o?o.locales.map(a=>{const s=o.counts[a]??{untranslated:0,reviewRequested:0},c=a===o.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===o.displayLocale,design:a===o.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(o,a)=>r.value.length?(he.openBlock(),he.createElementBlock("div",jN,[(he.openBlock(!0),he.createElementBlock(he.Fragment,null,he.renderList(r.value,s=>(he.openBlock(),he.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:he.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>he.unref(n).setDisplayLocale(s.locale)},[he.createElementVNode("span",zN,he.toDisplayString(s.label),1),s.pending>0?(he.openBlock(),he.createElementBlock("span",GN,he.toDisplayString(s.pending),1)):he.createCommentVNode("",!0)],10,HN))),128))])):he.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);Z.ADDABLE_FLOW_NODE_TYPES=lc,Z.APPLY_BPMN_OPS_SCHEMA=L1,Z.BPMN_EVENT_DEFINITION_TYPES=pc,Z.BPMN_MODDLE_EXTENSIONS=_c,Z.BWL_MODDLE_SCHEMA=om,Z.BWL_NS=rm,Z.BWL_PREFIX=np,Z.BWL_REVIEW_REQUEST_TYPE=dc,Z.BWL_SIDES=ip,Z.BpmnDisplayLocaleSwitcher=VN,Z.BpmnModelerView=RN,Z.BpmnValidationPanel=FN,Z.EDITOR=PC,Z.FLOW_LABEL_INDENT=Fm,Z.GROUP_BORDER_MIN_RUN=Pp,Z.GROUP_BORDER_NEAR=Jo,Z.HEADLESS_BPMN_MODULES=nw,Z.HEADLESS_TEXT_METRICS=Zo,Z.I18N_NS=g1,Z.I18N_PREFIX=um,Z.I18N_REVIEW_REQUESTED_CLASS=uw,Z.I18N_TRANSLATION_TYPE=Uo,Z.I18N_UNTRANSLATED_CLASS=lw,Z.I18nDisplay=rh,Z.I18nDisplayModule=fw,Z.IR_EVENT_DEFINITIONS=uc,Z.IR_FLOW_NODE_TYPES=so,Z.IR_TEXT_LOCALES=fc,Z.LABEL_FORK_MARGIN=Op,Z.LABEL_SHAPE_MIN_DEPTH=Zm,Z.SET_TRANSLATIONS_COMMAND=pp,Z.SEVERITY_ORDER=nh,Z.SYMBOLIC_OP_KINDS=pm,Z.SYMBOLIC_OP_SCHEMA=fm,Z.SetTranslationsHandler=fp,Z.TranslationCommands=hp,Z.TranslationCommandsModule=mp,Z.UNDO_EPISODE_COMMAND=rp,Z.UPDATE_TRANSLATION_COMMAND=gc,Z.UpdateTranslationHandler=up,Z.applyBpmnOpBatch=qg,Z.applyBpmnOps=Fg,Z.applyLocaleBackfill=IC,Z.approximateTextWidth=Qo,Z.auditBpmnGeometry=eg,Z.auditBpmnGeometryXml=TR,Z.auditBpmnSemantics=Yp,Z.auditBpmnSemanticsXml=xC,Z.auditGeometry=ht,Z.auditTargetsOf=fi,Z.axisSegmentsOf=vn,Z.blackBoxNameRect=Tp,Z.buildBpmnOpBatch=AC,Z.buildRegistryIndex=ng,Z.containerBoundarySegments=na,Z.countBySeverity=sw,Z.createBpmnEditorController=TC,Z.createBpmnModdle=km,Z.createHeadlessBpmnModeler=tD,Z.crossedShapesOf=bn,Z.crossingCost=pi,Z.describeProcess=Gg,Z.describeProcessXml=hC,Z.diffBpmnElements=Ug,Z.diffBpmnElementsXml=CC,Z.documentLocalesOf=Ua,Z.edgeCrossCount=Qa,Z.edgeCrossingPairsOf=Ac,Z.edgeCrossingStatsOf=Um,Z.executeAsUndoEpisode=sm,Z.followMovedEdgeLabels=Eg,Z.forwardThreePointCandidates=Tc,Z.geometryFindingKey=pt,Z.inferScriptLocale=Xp,Z.installHeadlessBpmnDom=Dm,Z.irEventDefinitionOf=tp,Z.isAddableFlowNodeType=nm,Z.isChangeScopeMixed=ih,Z.isEdgeOverlapFinding=kp,Z.isInChangeScope=Ma,Z.isIrEventDefinition=im,Z.isIrFlowNodeType=tm,Z.isIrTextLocale=a1,Z.labelRectsOf=mo,Z.labelShapeDepth=Qm,Z.labelSlot=uo,Z.lineCrossesLabel=Gi,Z.lineThroughLabel=Hm,Z.lineThroughShapeLabel=Xm,Z.loadBpmnXml=Xo,Z.localeTextsOf=lp,Z.lowerOps=Ng,Z.oppositeOverlapCount=gR,Z.oppositeOverlapOf=$m,Z.planBackEdgeBoundaryClearance=pg,Z.planCrossPoolRoute=cg,Z.planEdgeRepair=Bp,Z.planLabelLineClearance=Hp,Z.planLabelPlacement=xg,Z.planLocaleBackfill=LC,Z.planMiddleSegmentShifts=rg,Z.planOppositeOverlapRepair=dg,Z.planSegmentDetours=Pc,Z.planShapeLabelClearance=Cg,Z.redockIntroducedDetachedEndpoints=Ag,Z.repairIntroducedBoundaryHugging=fg,Z.repairIntroducedCrossings=Np,Z.repairIntroducedEdgeCrossings=ag,Z.repairIntroducedFakeMerges=mg,Z.repairIntroducedLabelLines=Sg,Z.repairIntroducedOppositeOverlaps=bg,Z.repairIntroducedShapeLabelLines=Mg,Z.repairIntroducedSharedSegmentLabels=Rg,Z.rerouteIntroducedCrossPoolEdges=lg,Z.resolverServicesOf=Dg,Z.reviewRequestValuesOf=dp,Z.reviewRequestsOf=Cr,Z.rootLangOf=cp,Z.saveBpmnXml=rR,Z.sceneCrossingCost=Wm,Z.sceneFromDefinitions=Jm,Z.sceneFromRegistry=We,Z.segmentShapeClearance=Za,Z.shapesUnderLabel=Ja,Z.sharedSegmentUnderLabel=Mc,Z.sharedSpansOf=Cc,Z.sortPanelIssues=cw,Z.toPanelIssues=aw,Z.touchedElements=MC,Z.translationLocale=In,Z.translationsOf=qo,Z.unreadableOverlapCount=ui,Z.unreadableOverlapOf=ea,Z.validateOps=Og,Z.warningMessages=Ap,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})}));
|
|
343
|
+
</div>`,We.RESULT_HTML='<div class="djs-search-result"></div>',We.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',We.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const vN={__depends__:[hs,lu,Si],searchPad:["type",We]};function Wh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Wh.$inject=["elementRegistry","searchPad","canvas","search"],Wh.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:mi(i),id:i.id})),e,{keys:["label","id"]}).map(bN)};function bN(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const xN={__depends__:[vN,w_],__init__:["bpmnSearch"],bpmnSearch:["type",Wh]},wN="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",_N="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",EN={width:36,height:50},SN={width:50,height:50};function uE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Ti=5;function Yu(e,t){this._styles=t,e.registerProvider(this)}Yu.$inject=["outline","styles"],Yu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if($A(e))return n=Oe("rect"),Ce(n,q({x:-Ti,y:-Ti,rx:4,width:e.width+Ti*2,height:e.height+Ti*2},t)),n;if(!Je(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),q(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Ce(n,q({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Ce(n,q({x:-Ti,y:-Ti,rx:14,width:e.width+Ti*2,height:e.height+Ti*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),Ce(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Ti+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),Ce(n,q({cx:e.width/2,cy:e.height/2,r:e.width/2+Ti},t))):M(e,"bpmn:DataObjectReference")&&pE(e,"bpmn:DataObjectReference")?n=uE(wN,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&pE(e,"bpmn:DataStoreReference")&&(n=uE(_N,{x:-6,y:-6},t)),n},Yu.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(Ce(t,{width:e.width+Ti*2,height:e.height+Ti*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function pE(e,t){var n;return t==="bpmn:DataObjectReference"?n=EN:t==="bpmn:DataStoreReference"&&(n=SN),e.width===n.width&&e.height===n.height}const RN={__depends__:[Ih],__init__:["outlineProvider"],outlineProvider:["type",Yu]};var CN='<?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 ir(e){la.call(this,e)}Re(ir,la),ir.Viewer=Xr,ir.NavigatedViewer=Hs,ir.prototype.createDiagram=function(){return this.importXML(CN)},ir.prototype._interactionModules=[Sw,Cw,Pw],ir.prototype._modelingModules=[AL,ou,DL,kL,UL,Th,QL,EI,rx,Nl,MI,TI,UI,YI,KI,eB,fB,yB,Qd,SB,OB,GB,WB,R0,gN,xN,RN],ir.prototype._modules=[].concat(Xr.prototype._modules,ir.prototype._interactionModules,ir.prototype._modelingModules);const MN=ge.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ge.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Tp(u);return r("imported",p),{warnings:p}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return ge.onMounted(async()=>{a=new ir({container:o.value,moddleExtensions:_c,additionalModules:[hw]}),i.xml&&await s(i.xml),r("ready")}),ge.watch(()=>i.xml,l=>{l&&a&&s(l)}),ge.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ge.openBlock(),ge.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),Uh=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},AN=Uh(MN,[["__scopeId","data-v-07ee17c9"]]),PN=["title","aria-expanded"],TN=["title","onClick"],kN={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},ON={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},DN={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},LN={key:0,class:"bwl-validation__body"},IN={key:0,class:"bwl-validation__empty"},BN={key:1,class:"bwl-validation__empty"},NN={key:2,class:"bwl-validation__list"},$N=["onClick"],FN={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},jN={class:"bwl-validation__msg"},HN=["title"],zN=Uh(ge.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ge.computed(()=>cw(n.issues.value,n.describeElement)),r=ge.computed(()=>lw(i.value)),o=g=>Ma(g,n.changeScope.value),a=ge.computed(()=>rh(i.value,n.changeScope.value)),s=ge.ref({error:!0,warning:!0,info:!0}),c=ge.computed(()=>uw(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=ge.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(ge.openBlock(),ge.createElementBlock("section",{class:ge.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ge.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[ge.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ge.openBlock(),ge.createElementBlock("svg",{class:ge.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ge.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ge.createElementVNode("span",null,"검증",-1))],8,PN),ge.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ge.withModifiers(()=>{},["stop"]))},[(ge.openBlock(),ge.createElementBlock(ge.Fragment,null,ge.renderList(u,y=>ge.createElementVNode("button",{key:y,type:"button",class:ge.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:C=>f(y)},[(ge.openBlock(),ge.createElementBlock("svg",kN,[h[4]||(h[4]=ge.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(ge.openBlock(),ge.createElementBlock("path",ON)):(ge.openBlock(),ge.createElementBlock("path",DN))])),ge.createElementVNode("span",null,ge.toDisplayString(r.value[y]),1)],10,TN)),64))])]),l.value?(ge.openBlock(),ge.createElementBlock("div",LN,[i.value.length===0?(ge.openBlock(),ge.createElementBlock("p",IN,"발견된 문제가 없습니다.")):c.value.length===0?(ge.openBlock(),ge.createElementBlock("p",BN," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ge.openBlock(),ge.createElementBlock("ul",NN,[(ge.openBlock(!0),ge.createElementBlock(ge.Fragment,null,ge.renderList(c.value,y=>(ge.openBlock(),ge.createElementBlock("li",{key:y.key,class:ge.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:C=>d(y)},[h[5]||(h[5]=ge.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(ge.openBlock(),ge.createElementBlock("span",FN,"이번 변경")):ge.createCommentVNode("",!0),ge.createElementVNode("span",jN,ge.toDisplayString(y.message),1),ge.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},ge.toDisplayString(y.category),9,HN)],10,$N))),128))]))])):ge.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),GN={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},VN=["aria-checked","title","data-locale","onClick"],WN={class:"bwl-locale__label"},UN={key:0,class:"bwl-locale__badge"},qN=Uh(ge.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(o){try{return new Intl.DisplayNames([o],{type:"language"}).of(o)??o}catch{return o}}const r=ge.computed(()=>{const o=n.i18n.value;return o?o.locales.map(a=>{const s=o.counts[a]??{untranslated:0,reviewRequested:0},c=a===o.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===o.displayLocale,design:a===o.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(o,a)=>r.value.length?(ge.openBlock(),ge.createElementBlock("div",GN,[(ge.openBlock(!0),ge.createElementBlock(ge.Fragment,null,ge.renderList(r.value,s=>(ge.openBlock(),ge.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:ge.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>ge.unref(n).setDisplayLocale(s.locale)},[ge.createElementVNode("span",WN,ge.toDisplayString(s.label),1),s.pending>0?(ge.openBlock(),ge.createElementBlock("span",UN,ge.toDisplayString(s.pending),1)):ge.createCommentVNode("",!0)],10,VN))),128))])):ge.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);Q.ADDABLE_FLOW_NODE_TYPES=lc,Q.APPLY_BPMN_OPS_SCHEMA=B1,Q.BPMN_EVENT_DEFINITION_TYPES=pc,Q.BPMN_MODDLE_EXTENSIONS=_c,Q.BWL_MODDLE_SCHEMA=am,Q.BWL_NS=om,Q.BWL_PREFIX=rp,Q.BWL_REVIEW_REQUEST_TYPE=dc,Q.BWL_SIDES=op,Q.BpmnDisplayLocaleSwitcher=qN,Q.BpmnModelerView=AN,Q.BpmnValidationPanel=zN,Q.EDITOR=OC,Q.FLOW_LABEL_INDENT=jm,Q.GROUP_BORDER_MIN_RUN=kp,Q.GROUP_BORDER_NEAR=Jo,Q.HEADLESS_BPMN_MODULES=rw,Q.HEADLESS_TEXT_METRICS=Zo,Q.I18N_NS=v1,Q.I18N_PREFIX=pm,Q.I18N_REVIEW_REQUESTED_CLASS=fw,Q.I18N_TRANSLATION_TYPE=Uo,Q.I18N_UNTRANSLATED_CLASS=pw,Q.I18nDisplay=oh,Q.I18nDisplayModule=hw,Q.IR_EVENT_DEFINITIONS=uc,Q.IR_FLOW_NODE_TYPES=so,Q.IR_TEXT_LOCALES=fc,Q.LABEL_FORK_MARGIN=Lp,Q.LABEL_SHAPE_MIN_DEPTH=Qm,Q.SET_TRANSLATIONS_COMMAND=dp,Q.SEVERITY_ORDER=ih,Q.SYMBOLIC_OP_KINDS=fm,Q.SYMBOLIC_OP_SCHEMA=dm,Q.SetTranslationsHandler=hp,Q.TranslationCommands=gp,Q.TranslationCommandsModule=yp,Q.UNDO_EPISODE_COMMAND=ap,Q.UPDATE_TRANSLATION_COMMAND=gc,Q.UpdateTranslationHandler=fp,Q.applyBpmnOpBatch=Kg,Q.applyBpmnOps=Hg,Q.applyLocaleBackfill=$C,Q.approximateTextWidth=Qo,Q.auditBpmnGeometry=tg,Q.auditBpmnGeometryXml=OR,Q.auditBpmnSemantics=Kp,Q.auditBpmnSemanticsXml=EC,Q.auditGeometry=ht,Q.auditTargetsOf=fi,Q.axisSegmentsOf=vn,Q.blackBoxNameRect=Op,Q.buildBpmnOpBatch=kC,Q.buildRegistryIndex=ig,Q.containerBoundarySegments=na,Q.countBySeverity=lw,Q.createBpmnEditorController=DC,Q.createBpmnModdle=Om,Q.createHeadlessBpmnModeler=rD,Q.crossedShapesOf=bn,Q.crossingCost=pi,Q.describeProcess=Wg,Q.describeProcessXml=yC,Q.diffBpmnElements=Yg,Q.diffBpmnElementsXml=PC,Q.documentLocalesOf=Ua,Q.edgeCrossCount=Qa,Q.edgeCrossingPairsOf=Ac,Q.edgeCrossingStatsOf=qm,Q.executeAsUndoEpisode=cm,Q.followMovedEdgeLabels=Sg,Q.forwardThreePointCandidates=Tc,Q.geometryFindingKey=pt,Q.inferScriptLocale=Zp,Q.installHeadlessBpmnDom=Lm,Q.irEventDefinitionOf=ip,Q.isAddableFlowNodeType=im,Q.isChangeScopeMixed=rh,Q.isEdgeOverlapFinding=Dp,Q.isInChangeScope=Ma,Q.isIrEventDefinition=rm,Q.isIrFlowNodeType=nm,Q.isIrTextLocale=c1,Q.labelRectsOf=mo,Q.labelShapeDepth=Jm,Q.labelSlot=uo,Q.lineCrossesLabel=Gi,Q.lineThroughLabel=zm,Q.lineThroughShapeLabel=Zm,Q.loadBpmnXml=Xo,Q.localeTextsOf=pp,Q.lowerOps=Fg,Q.oppositeOverlapCount=vR,Q.oppositeOverlapOf=Fm,Q.planBackEdgeBoundaryClearance=fg,Q.planCrossPoolRoute=lg,Q.planEdgeRepair=$p,Q.planLabelLineClearance=Gp,Q.planLabelPlacement=wg,Q.planLocaleBackfill=NC,Q.planMiddleSegmentShifts=og,Q.planOppositeOverlapRepair=hg,Q.planSegmentDetours=Pc,Q.planShapeLabelClearance=Mg,Q.redockIntroducedDetachedEndpoints=Pg,Q.repairIntroducedBoundaryHugging=dg,Q.repairIntroducedCrossings=Fp,Q.repairIntroducedEdgeCrossings=sg,Q.repairIntroducedFakeMerges=gg,Q.repairIntroducedLabelLines=Rg,Q.repairIntroducedOppositeOverlaps=xg,Q.repairIntroducedShapeLabelLines=Ag,Q.repairIntroducedSharedSegmentLabels=Cg,Q.rerouteIntroducedCrossPoolEdges=ug,Q.resolverServicesOf=Lg,Q.reviewRequestValuesOf=mp,Q.reviewRequestsOf=Cr,Q.rootLangOf=up,Q.saveBpmnXml=aR,Q.sceneCrossingCost=Um,Q.sceneFromDefinitions=eg,Q.sceneFromRegistry=Ue,Q.segmentShapeClearance=Za,Q.shapesUnderLabel=Ja,Q.sharedSegmentUnderLabel=Mc,Q.sharedSpansOf=Cc,Q.sortPanelIssues=uw,Q.toPanelIssues=cw,Q.touchedElements=TC,Q.translationLocale=In,Q.translationsOf=qo,Q.unreadableOverlapCount=ui,Q.unreadableOverlapOf=ea,Q.validateOps=Dg,Q.warningMessages=Tp,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|