@g1cloud/bpmn-modeler-next 5.0.0-beta.67 → 5.0.0-beta.69
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/annotationSize.d.ts +12 -0
- package/dist/agent/resolver/lower.d.ts +3 -0
- package/dist/bpmn-modeler.js +4868 -4768
- package/dist/bpmn-modeler.umd.cjs +34 -35
- package/dist/command/annotationExactResize.d.ts +30 -0
- package/dist/headless/dom.d.ts +2 -0
- package/dist/headless/modeler.d.ts +4 -0
- package/dist/view/headlessReplay.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
(function(ce,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Se):(ce=typeof globalThis<"u"?globalThis:ce||self,Se(ce.BpmnModeler={},ce.Vue))})(this,(function(ce,Se){"use strict";var $F=Object.defineProperty;var FF=(ce,Se,Mr)=>Se in ce?$F(ce,Se,{enumerable:!0,configurable:!0,writable:!0,value:Mr}):ce[Se]=Mr;var mn=(ce,Se,Mr)=>FF(ce,typeof Se!="symbol"?Se+"":Se,Mr);const Mr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Dc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function rm(e){return Mr.includes(e)}function am(e){return Dc.includes(e)}const Lc=["timer"],Ic={timer:"bpmn:TimerEventDefinition"};function sm(e){return typeof e=="string"&&Lc.includes(e)}function Ip(e){if(e.length===1)return Lc.find(t=>Ic[t]===e[0])}const Bc=["ko","en","ja","zh"];function cR(e){return typeof e=="string"&&Bc.includes(e)}const cm="http://g1project.net/spec/bpmn/bwl/1.0",Bp="bwl",Np=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Nc="bwl:ReviewRequest",lm={name:"bwl-hints",uri:cm,prefix:Bp,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"}]}]},$p="bwl.undoEpisode",um=new WeakSet;function lR(e){um.has(e)||(e.register($p,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),um.add(e))}function pm(e,t){lR(e);const n={run:t};if(e.execute($p,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function dm(e){return e._stackIdx+1}function fm(e,t){const{_stack:n,_stackIdx:i}=e;if(i<t)return 0;const o=n[t].id;for(let r=t;r<=i;r++)n[r].id=o;return i-t+1}function Fp(e){return Array.prototype.concat.apply([],e)}const cs=Object.prototype.toString,uR=Object.prototype.hasOwnProperty;function Ar(e){return e===void 0}function yn(e){return e!==void 0}function la(e){return e==null}function Je(e){return cs.call(e)==="[object Array]"}function vn(e){return cs.call(e)==="[object Object]"}function Qe(e){return cs.call(e)==="[object Number]"}function En(e){const t=cs.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ni(e){return cs.call(e)==="[object String]"}function pR(e){if(!Je(e))throw new Error("must supply array")}function ii(e,t){return!la(e)&&uR.call(e,t)}function Bt(e,t){const n=Fc(t);let i;return V(e,function(o,r){if(n(o,r))return i=o,!1}),i}function hm(e,t){const n=Fc(t);let i=Je(e)?-1:void 0;return V(e,function(o,r){if(n(o,r))return i=r,!1}),i}function lt(e,t){const n=Fc(t);let i=[];return V(e,function(o,r){n(o,r)&&i.push(o)}),i}function V(e,t){let n,i;if(Ar(e))return;const o=Je(e)?mR:gR;for(let r in e)if(ii(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function dR(e,t){if(Ar(e))return[];pR(e);const n=Fc(t);return e.filter(function(i,o){return!n(i,o)})}function oi(e,t,n){return V(e,function(i,o){n=t(n,i,o)}),n}function Bo(e,t){return!!oi(e,function(n,i,o){return n&&t(i,o)},!0)}function No(e,t){return!!Bt(e,t)}function Hn(e,t){let n=[];return V(e,function(i,o){n.push(t(i,o))}),n}function $c(e){return e&&Object.keys(e)||[]}function fR(e){return $c(e).length}function ua(e){return Hn(e,t=>t)}function pa(e,t,n={}){return t=jp(t),V(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function gm(e,...t){e=jp(e);let n={};return V(t,o=>pa(o,e,n)),Hn(n,function(o,r){return o[0]})}const hR=gm;function Yi(e,t){t=jp(t);let n=[];return V(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Hn(n,i=>i.v)}function da(e){return function(t){return Bo(e,function(n,i){return t[i]===n})}}function jp(e){return En(e)?e:t=>t[e]}function Fc(e){return En(e)?e:t=>t===e}function gR(e){return e}function mR(e){return Number(e)}function Hp(e,t){let n,i,o,r;function a(p){let d=Date.now(),f=p?0:r+t-d;if(f>0)return s(f);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Zn(e,t){return e.bind(t)}function Y(e,...t){return Object.assign(e,...t)}function yR(e,t,n){let i=e;return V(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];yn(a)&&la(s)&&(s=i[o]=isNaN(+a)?{}:[]),Ar(a)?Ar(n)?delete i[o]:i[o]=n:i=s}),e}function $i(e,t){let n={},i=Object(e);return V(t,function(o){o in i&&(n[o]=e[o])}),n}function Ki(e,t){let n={},i=Object(e);return V(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=Ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function st(e,t){return No(t,function(n){return A(e,n)})}function Ee(e){return e&&e.businessObject||e}function gt(e){return e&&e.di}const vR="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",mm="i18n",Pr="i18n:Translation";function Tr(e){if(e){if(A(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(A(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function $o(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,Pr)})}function Mn(e){return e.get("xml:lang")}function Fo(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,Nc)})}function ls(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function zp(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 Gp(e,t,n){const i=Tr(e);if(!i)return{};const o=i.target[i.key]??"",r=$o(e).filter(u=>Mn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Mn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ls(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(d=>Mn(d)===u&&a(d));p&&(l[u]=a(p))}return l}const jc="bwl.updateTranslation";class Vp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:o,locales:r,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=Tr(c),u=[];t.undo=u;const p=$o(c).filter(P=>Mn(P)),d=s??(l?l.target[l.key]??"":""),f=a??o,h=(P=>{if(!P)return[];const F=p.filter(z=>z.body===P).map(Mn);return F.length?F:[f]})(d),y=s!==void 0&&d&&!h.includes(t.locale)?h[0]:t.locale,w=P=>{var F;return((F=p.find(z=>Mn(z)===P&&z.body))==null?void 0:F.body)??(h.includes(P)?d:"")},m=P=>Fo(c).some(F=>F.locale===P),v=w(y);if(v===i)return[];const b=!!v&&!m(y),E=b?r.filter(P=>P!==y&&w(P)&&!m(P)):[],C=()=>{let P=c.extensionElements;return P||(P=this.moddle.create("bpmn:ExtensionElements",{values:[]}),P.$parent=c,c.extensionElements=P,u.push(()=>delete c.extensionElements)),P.get("values")},I=(P,F)=>{const z=C();let G=z.find(ne=>{var re;return((re=ne.$instanceOf)==null?void 0:re.call(ne,Pr))&&Mn(ne)===P});if(G){const ne=G.body;G.body=F,u.push(()=>G.body=ne)}else G=this.moddle.create(Pr,{body:F}),G.set("xml:lang",P),G.$parent=c.extensionElements,z.push(G),u.push(()=>z.splice(z.indexOf(G),1))},k=P=>{const F=C(),z=F.indexOf(P);F.splice(z,1),u.push(()=>F.splice(z,0,P))};if(s===void 0){if(y===o&&l){if(d&&!p.some(F=>F.body===d)){const F=a&&a!==o?a:void 0;F&&I(F,d)}const P=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{P?l.target[l.key]=d:delete l.target[l.key]})}I(y,i)}else(p.some(P=>Mn(P)===y)||!d&&y!==f)&&I(y,i);if(!b)for(const P of Fo(c).filter(F=>F.locale===y))k(P);for(const P of E){const F=C(),z=this.moddle.create(Nc,{locale:P,sourceLocale:y,previous:v});z.$parent=c.extensionElements,F.push(z),u.push(()=>F.splice(F.indexOf(z),1))}for(const P of Fo(c).filter(F=>F.sourceLocale===y&&(F.previous??"")===i))k(P);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):[]}}mn(Vp,"$inject",["moddle"]);const Wp="bwl.setTranslations",xR=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Up{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:o=[],designLocale:r,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!Tr(l))return[];const p=()=>{let w=l.extensionElements;return w||(w=this.moddle.create("bpmn:ExtensionElements",{values:[]}),w.$parent=l,l.extensionElements=w,u.push(()=>delete l.extensionElements)),w.get("values")},d=w=>{const m=p(),v=m.indexOf(w);v<0||(m.splice(v,1),u.push(()=>m.splice(v,0,w)))},f=w=>$o(l).find(m=>Mn(m)===w);if(i===null)for(const w of a){const m=f(w);m&&d(m)}else if(i)for(const w of a){const m=i[w];if(m===void 0)continue;const v=f(w);if(v){if(v.body===m)continue;const C=v.body;v.body=m,u.push(()=>v.body=C);continue}if(w===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(Pr,{body:m});E.set("xml:lang",w),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(w=>!o.includes(w.locale)&&!(i&&i[w.locale]!==void 0&&i[w.locale]!==c.texts[w.locale])&&!(i&&w.sourceLocale&&i[w.sourceLocale]===w.previous))];for(const w of Fo(l)){const m=h.findIndex(v=>xR(w,v));m>=0?h.splice(m,1):d(w)}for(const w of h){const m=p(),v=this.moddle.create(Nc,{locale:w.locale,...w.sourceLocale?{sourceLocale:w.sourceLocale}:{},previous:w.previous});v.$parent=l.extensionElements,m.push(v),u.push(()=>m.splice(m.indexOf(v),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):[]}}mn(Up,"$inject",["moddle"]);function qp(e){return Fo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Yp{constructor(t){t.registerHandler(jc,Vp),t.registerHandler(Wp,Up)}}mn(Yp,"$inject",["commandStack"]);const Kp={__init__:["translationCommands"],translationCommands:["type",Yp]},ym=["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"],bR={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},wR={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Bc.map(e=>[e,{type:"string"}])),additionalProperties:!1},_R={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},ER={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},SR={type:"string",enum:[...Lc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},RR={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Dc]},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},CR={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},MR={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},AR={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},PR={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},TR={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},kR={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},OR={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},DR={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},LR={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Np]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Tn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const IR={"participant.add":Tn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Tn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Tn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":Tn("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:[...Dc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Tn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Tn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},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":Tn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Tn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Tn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Tn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Tn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Tn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Tn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Tn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":Tn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Tn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":Tn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Bc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Tn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},vm={anyOf:ym.map(e=>IR[e])},BR={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:_R,irParticipant:ER,irNode:RR,irFlowCondition:CR,irSequenceFlow:MR,irMessageFlow:AR,irDataStore:PR,irDataAssociation:TR,irTextAnnotation:kR,irAssociation:OR,irGroup:DR,bwlPlacement:LR,eventDefinition:SR,localeTexts:wR,nullableString:bR,symbolicOp:vm}};function Xp(){}Xp.prototype.get=function(e){return this.$model.properties.get(this,e)},Xp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function xm(e,t){this.model=e,this.properties=t}xm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Xp.prototype);V(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),V(a,Zn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var NR=Y(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),bm=Y(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 Zp(e,t){var n=bm[e];return n?n(t):t}function Jp(e){return!!NR[e]}function wm(e){return!!bm[e]}function zn(e,t){var n=e.split(/:/),i,o;if(n.length===1)i=e,o=t;else if(n.length===2)i=n[1],o=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(o?o+":":"")+i,{name:e,prefix:o,localName:i}}function mi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}mi.prototype.build=function(){return $i(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},mi.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)},mi.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=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=o.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");o.splice(s,1),this.addProperty(t,n?void 0:s,a),r[i.name]=r[i.localName]=t},mi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=zn(o[0],i),a=zn(o[1],r.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},mi.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},mi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},mi.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},mi.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},mi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},mi.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")},mi.prototype.hasProperty=function(e){return this.propertiesByName[e]},mi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(V(e.properties,Zn(function(r){r=Y({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function jo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,V(e,Zn(this.registerPackage,this))}jo.prototype.getPackage=function(e){return this.packageMap[e]},jo.prototype.getPackages=function(){return this.packages},jo.prototype.registerPackage=function(e){e=Y({},e);var t=this.packageMap;_m(t,e,"prefix"),_m(t,e,"uri"),V(e.types,Zn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},jo.prototype.registerType=function(e,t){e=Y({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Y({},e.meta||{})});var n=zn(e.name,t.prefix),i=n.name,o=Object.create(null);V(e.properties,Zn(function(r){var a=zn(r.name,n.prefix),s=a.name;Jp(r.type)||(r.type=zn(r.type,a.prefix).name),Y(r,{ns:a,name:s}),o[s]=r},this)),Y(e,{ns:n,name:i,propertiesByName:o}),V(e.extends,Zn(function(r){var a=zn(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},jo.prototype.mapTypes=function(e,t,n){var i=Jp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=zn(c,Jp(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");V(i.superClass,n?a:s),t(i,!n),V(i.traits,a)},jo.prototype.getEffectiveDescriptor=function(e){var t=zn(e),n=new mi(t);this.mapTypes(t,function(o,r){n.addTrait(o,r)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},jo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function _m(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function kr(e){this.model=e}kr.prototype.set=function(e,t,n){if(!ni(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;$R(n)?i?delete e[o]:delete e.$attrs[Qp(t)]:i?o in e?e[o]=n:Em(e,i,n):e.$attrs[Qp(t)]=n},kr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Qp(t)];var i=n.name;return!e[i]&&n.isMany&&Em(e,n,[]),e[i]},kr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=Y({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},kr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},kr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},kr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(typeof o<"u"){const r=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw r;typeof console<"u"&&console.warn(r)}return null};function $R(e){return typeof e>"u"}function Em(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Qp(e){return e.replace(/^:/,"")}function bi(e,t={}){this.properties=new kr(this),this.factory=new xm(this,this.properties),this.registry=new jo(e,this.properties),this.typeCache=Object.create(null),this.config=t}bi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},bi.prototype.getType=function(e){var t=this.typeCache,n=ni(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},bi.prototype.createAny=function(e,t,n){var i=zn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){yR(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),V(n,function(a,s){vn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},bi.prototype.getPackage=function(e){return this.registry.getPackage(e)},bi.prototype.getPackages=function(){return this.registry.getPackages()},bi.prototype.getElementDescriptor=function(e){return e.$descriptor},bi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},bi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},bi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Sm=String.fromCharCode,FR=Object.prototype.hasOwnProperty,jR=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,us={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(us).forEach(function(e){us[e.toUpperCase()]=us[e]});function HR(e,t,n,i){return i?FR.call(us,i)?us[i]:"&"+i+";":Sm(t||parseInt(n,16))}function Or(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(jR,HR):e}var Rm="non-whitespace outside of root node";function Ho(e){return new Error(e)}function zR(e){return"missing namespace for prefix <"+e+">"}function Hc(e){return{get:e,enumerable:!0}}function GR(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Cm=Symbol("nameCache");function ed(e){return e+"$uri"}function VR(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[ed(i)]=n;return t}function zc(){return{line:0,column:0}}function WR(e){throw e}function Mm(e){if(!this)return new Mm(e);var t=e&&e.proxy,n,i,o,r,a=WR,s,c,l,u,p=zc,d=!1,f=!1,g="",h=!1,y=!1,w=null,m=!1,v,b,E,C;function I(z){z instanceof Error||(z=Ho(z)),w=z,a(z,p)}function k(z){s&&(z instanceof Error||(z=Ho(z)),s(z,p))}this.on=function(z,G){if(typeof G!="function")throw Ho("required args <name, cb>");switch(z){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw Ho("unsupported event: "+z)}return this},this.ns=function(z){if(typeof z>"u"&&(z={}),typeof z!="object")throw Ho("required args <nsMap={}>");var G=Object.create(null),ne;for(ne in z)G[ne]=z[ne];return y=!0,C=G,this};function P(){v=y?[]:null,b=y?VR(C):null,E=[],p=zc,m=!1,w=null,f=!1,g=""}this.parse=function(z){if(typeof z!="string")throw Ho("required args <xml=string>");if(d)throw Ho("parse during stream; call end() first");return P(),F(z),p=zc,m=!1,w},this.write=function(z){if(typeof z!="string")throw Ho("required args <xml=string>");return d||(P(),d=!0),w||(g=F(g+z,!0)||""),this},this.end=function(){return d||P(),d=!1,w||F(g),g="",p=zc,m=!1,w},this.stop=function(){m=!0};function F(z,G=!1){var ne=null,re=null,K,xe=0,de=!1,we=!1,he=0,W=0,le,q,ee,me,Re,ze,$,M,R,U="",X=0,pe;function Ne(St,tn){var Rn=St.indexOf(":");if(Rn===-1)return St;var Fn=b[St.substring(0,Rn)];return Fn?tn===Fn?St.substr(Rn+1):Fn+St.substr(Rn):(k(zR(St.substring(0,Rn))),null)}function Ke(){if(pe!==null)return pe;var St,tn,Rn=y&&b.xmlns,Fn=y&&h?[]:null,Nt=X,nn=U,on=nn.length,Wi,hi,xi,Un,gn,br={},es=new Set,ti,xt,At;e:for(;Nt<on;Nt++)if(ti=!1,xt=nn.charCodeAt(Nt),!(xt===32||xt<14&&xt>8)){for((xt<65||xt>122||xt>90&&xt<97)&&xt!==95&&xt!==58&&(k("illegal first char attribute name"),ti=!0),At=Nt+1;At<on;At++)if(xt=nn.charCodeAt(At),!(xt>96&&xt<123||xt>64&&xt<91||xt>47&&xt<59||xt===46||xt===45||xt===95)){if(xt===32||xt<14&&xt>8){k("missing attribute value"),Nt=At;continue e}if(xt===61)break;k("illegal attribute name char"),ti=!0}if(gn=nn.substring(Nt,At),gn==="xmlns:xmlns"&&(k("illegal declaration of xmlns"),ti=!0),xt=nn.charCodeAt(At+1),xt===34)At=nn.indexOf('"',Nt=At+2),At===-1&&(At=nn.indexOf("'",Nt),At!==-1&&(k("attribute value quote missmatch"),ti=!0));else if(xt===39)At=nn.indexOf("'",Nt=At+2),At===-1&&(At=nn.indexOf('"',Nt),At!==-1&&(k("attribute value quote missmatch"),ti=!0));else for(k("missing attribute value quotes"),ti=!0,At=At+1;At<on&&(xt=nn.charCodeAt(At+1),!(xt===32||xt<14&&xt>8));At++);for(At===-1&&(k("missing closing quotes"),At=on,ti=!0),ti||(xi=nn.substring(Nt,At)),Nt=At;At+1<on&&(xt=nn.charCodeAt(At+1),!(xt===32||xt<14&&xt>8));At++)Nt===At&&(k("illegal character after attribute end"),ti=!0);if(Nt=At+1,ti)continue e;if(es.has(gn)){k("attribute <"+gn+"> already defined");continue}if(es.add(gn),!y){br[gn]=xi;continue}if(h){if(hi=gn==="xmlns"?"xmlns":gn.charCodeAt(0)===120&&gn.substr(0,6)==="xmlns:"?gn.substr(6):null,hi!==null){if(St=Or(xi),tn=ed(hi),Un=C[St],!Un){if(hi==="xmlns"||tn in b&&b[tn]!==St)do Un="ns"+xe++;while(typeof b[Un]<"u");else Un=hi;C[St]=Un}b[hi]!==Un&&(Wi||(b=GR(b),Wi=!0),b[hi]=Un,hi==="xmlns"&&(b[ed(Un)]=St,Rn=Un),b[tn]=St),br[gn]=xi;continue}Fn.push(gn,xi);continue}gn=Ne(gn,Rn),gn!==null&&(br[gn]=xi)}if(h)for(Nt=0,on=Fn.length;Nt<on;Nt++)gn=Ne(Fn[Nt++],Rn),xi=Fn[Nt],gn!==null&&(br[gn]=xi);return pe=br}function ht(){for(var St=/(\r\n|\r|\n)/g,tn=0,Rn=0,Fn=0,Nt=W,nn,on;he>=Fn&&(nn=St.exec(z),!(!nn||(Nt=nn[0].length+nn.index,Nt>he)));)tn+=1,Fn=Nt;return he==-1?(Rn=Nt,on=z.substring(W)):W===0?on=z.substring(W,he):(Rn=he-Fn,on=W==-1?z.substring(he):z.substring(he,W+1)),{data:on,line:tn,column:Rn}}for(p=ht,t&&(R=Object.create({},{name:Hc(function(){return $}),originalName:Hc(function(){return M}),attrs:Hc(Ke),ns:Hc(function(){return b})}));W!==-1;){if(z.charCodeAt(W)===60?he=W:he=z.indexOf("<",W),he===-1){if(G)return z.substring(W);if(E.length)return I("unexpected end of file");if(!f)return I("missing start tag");W<z.length&&z.substring(W).trim()&&k(Rm);return}if(f||(f=!0),W!==he){if(E.length){if(n&&(n(z.substring(W,he),Or,p),m))return}else if(z.substring(W,he).trim()&&(k(Rm),m))return}if(me=z.charCodeAt(he+1),me===33){if(ee=z.charCodeAt(he+2),ee===91&&z.substr(he+3,6)==="CDATA["){if(W=z.indexOf("]]>",he),W===-1)return G?z.substring(he):I("unclosed cdata");if(r&&(r(z.substring(he+9,W),p),m))return;W+=3;continue}if(ee===45&&z.charCodeAt(he+3)===45){if(W=z.indexOf("-->",he),W===-1)return G?z.substring(he):I("unclosed comment");if(c&&(c(z.substring(he+4,W),Or,p),m))return;W+=3;continue}}if(me===63){if(W=z.indexOf("?>",he),W===-1)return G?z.substring(he):I("unclosed question");if(l&&(l(z.substring(he,W+2),p),m))return;W+=2;continue}for(le=he+1;;le++){if(Re=z.charCodeAt(le),isNaN(Re))return G?z.substring(he):(W=-1,I("unclosed tag"));if(Re===34)ee=z.indexOf('"',le+1),le=ee!==-1?ee:le;else if(Re===39)ee=z.indexOf("'",le+1),le=ee!==-1?ee:le;else if(Re===62){W=le;break}}if(me===33){if(u&&(u(z.substring(he,W+1),Or,p),m))return;W+=1;continue}if(pe={},me===47){if(de=!1,we=!0,!E.length)return I("missing open tag");if(le=$=E.pop(),ee=he+2+le.length,z.substring(he+2,ee)!==le)return I("closing tag mismatch");for(;ee<W;ee++)if(me=z.charCodeAt(ee),!(me===32||me>8&&me<14))return I("close tag")}else{if(z.charCodeAt(W-1)===47?(le=$=z.substring(he+1,W-1),de=!0,we=!0):(le=$=z.substring(he+1,W),de=!0,we=!1),!(me>96&&me<123||me>64&&me<91||me===95||me===58))return I("illegal first char nodeName");for(ee=1,q=le.length;ee<q;ee++)if(me=le.charCodeAt(ee),!(me>96&&me<123||me>64&&me<91||me>47&&me<59||me===45||me===95||me==46)){if(me===32||me<14&&me>8){$=le.substring(0,ee),pe=null;break}return I("invalid nodeName")}we||E.push($)}if(y){K=b,de&&(we||v.push(K),pe===null&&(h=le.indexOf("xmlns",ee)!==-1)&&(X=ee,U=le,Ke(),h=!1)),M=$,re!==b&&(ne=b[Cm],ne===void 0&&(ne=b[Cm]=Object.create(null)),re=b);var kt=ne[$];if(kt!==void 0)$=kt;else{if(me=$.indexOf(":"),me!==-1){if(ze=b[$.substring(0,me)],!ze)return I("missing namespace on <"+M+">");$=$.substr(me+1)}else ze=b.xmlns;ze&&($=ze+":"+$),ne[M]=$}}if(de&&(X=ee,U=le,i&&(t?i(R,Or,we,p):i($,Ke,Or,we,p),m)))return;if(we){if(o&&(o(t?R:$,Or,de,p),m))return;y&&(de?b=K:b=v.pop())}W+=1}}}function Am(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var td={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Pm="property";function Tm(e){return e.xml&&e.xml.serialize}function UR(e){const t=Tm(e);return t!==Pm&&(t||null)}function qR(e){return e.charAt(0).toUpperCase()+e.slice(1)}function km(e,t){return Am(t)?e.prefix+":"+qR(e.localName):e.name}function YR(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&i.indexOf(o)===0?e.prefix+":"+i.slice(o.length):n}function KR(e,t,n){const i=zn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=zn(o);var a=n.getPackage(r.prefix);return YR(r,a)}function zo(e){return new Error(e)}function yo(e){return e.$descriptor}function XR(e){Y(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw zo("expected element");var n=this.elementsById,i=yo(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw zo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ps(){}ps.prototype.handleEnd=function(){},ps.prototype.handleText=function(){},ps.prototype.handleNode=function(){};function nd(){}nd.prototype=Object.create(ps.prototype),nd.prototype.handleNode=function(){return this};function fa(){}fa.prototype=Object.create(ps.prototype),fa.prototype.handleText=function(e){this.body=(this.body||"")+e};function ds(e,t){this.property=e,this.context=t}ds.prototype=Object.create(fa.prototype),ds.prototype.handleNode=function(e){if(this.element)throw zo("expected no sub nodes");return this.element=this.createReference(e),this},ds.prototype.handleEnd=function(){this.element.id=this.body},ds.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function id(e,t){this.element=t,this.propertyDesc=e}id.prototype=Object.create(fa.prototype),id.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Zp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Gc(){}Gc.prototype=Object.create(fa.prototype),Gc.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 qn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}qn.prototype=Object.create(Gc.prototype),qn.prototype.addReference=function(e){this.context.addReference(e)},qn.prototype.handleText=function(e){var t=this.element,n=yo(t),i=n.bodyProperty;if(!i)throw zo("unexpected body text <"+e+">");fa.prototype.handleText.call(this,e)},qn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=yo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Zp(i.type,e),t.set(i.name,e))},qn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=yo(n),o=this.context,r=new n({}),a=this.model,s;return V(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),V(p,function(d){o.addReference({element:r,property:u.ns.name,id:d})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Zp(u.type,c):l==="xmlns"?l=":"+l:(s=zn(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},qn.prototype.getPropertyForNode=function(e){var t=e.name,n=zn(t),i=this.type,o=this.model,r=yo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=UR(s);if(l){const u=e.attributes[l];if(u){const p=KR(u,e.ns,o),d=o.getType(p);return Y({},s,{effectiveType:yo(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=km(n,c),u=o.getType(l);if(s=Bt(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return Y({},s,{effectiveType:yo(u).name})}else if(s=Bt(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw zo("unrecognized element <"+n.name+">")},qn.prototype.toString=function(){return"ElementDescriptor["+yo(this.type).name+"]"},qn.prototype.valueHandler=function(e,t){return new id(e,t)},qn.prototype.referenceHandler=function(e){return new ds(e,this.context)},qn.prototype.handler=function(e){return e==="Element"?new ha(this.model,e,this.context):new qn(this.model,e,this.context)},qn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,wm(n))return this.valueHandler(t,i);t.isReference?o=this.referenceHandler(t).handleNode(e):o=this.handler(n).handleNode(e);var r=o.element;return r!==void 0&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(Y(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function od(e,t,n){qn.call(this,e,t,n)}od.prototype=Object.create(qn.prototype),od.prototype.createElement=function(e){var t=e.name,n=zn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&km(n,r)||t;if(!o.hasType(a))throw zo("unexpected element <"+e.originalName+">");return qn.prototype.createElement.call(this,e)};function ha(e,t,n){this.model=e,this.context=n}ha.prototype=Object.create(Gc.prototype),ha.prototype.createElement=function(e){var t=e.name,n=zn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ha.prototype.handleChild=function(e){var t=new ha(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},ha.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function rd(e){e instanceof bi&&(e={model:e}),Y(this,{lax:!1},e)}rd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof qn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new XR(Y({},t,{rootHandler:i})),s=new Mm({proxy:!0}),c=ZR();i.context=a,c.push(i);function l(E,C,I){var k=C(),P=k.line,F=k.column,z=k.data;z.charAt(0)==="<"&&z.indexOf(" ")!==-1&&(z=z.slice(0,z.indexOf(" "))+">");var G="unparsable content "+(z?z+" ":"")+`detected
|
|
2
|
-
line: `+
|
|
1
|
+
(function(ce,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Se):(ce=typeof globalThis<"u"?globalThis:ce||self,Se(ce.BpmnModeler={},ce.Vue))})(this,(function(ce,Se){"use strict";var i6=Object.defineProperty;var o6=(ce,Se,Mr)=>Se in ce?i6(ce,Se,{enumerable:!0,configurable:!0,writable:!0,value:Mr}):ce[Se]=Mr;var sn=(ce,Se,Mr)=>o6(ce,typeof Se!="symbol"?Se+"":Se,Mr);const Mr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Lc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function sm(e){return Mr.includes(e)}function cm(e){return Lc.includes(e)}const Ic=["timer"],Bc={timer:"bpmn:TimerEventDefinition"};function lm(e){return typeof e=="string"&&Ic.includes(e)}function Ip(e){if(e.length===1)return Ic.find(t=>Bc[t]===e[0])}const Nc=["ko","en","ja","zh"];function xR(e){return typeof e=="string"&&Nc.includes(e)}const um="http://g1project.net/spec/bpmn/bwl/1.0",Bp="bwl",Np=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],$c="bwl:ReviewRequest",pm={name:"bwl-hints",uri:um,prefix:Bp,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"}]}]},$p="bwl.undoEpisode",dm=new WeakSet;function bR(e){dm.has(e)||(e.register($p,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),dm.add(e))}function fm(e,t){bR(e);const n={run:t};if(e.execute($p,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function hm(e){return e._stackIdx+1}function gm(e,t){const{_stack:n,_stackIdx:i}=e;if(i<t)return 0;const o=n[t].id;for(let r=t;r<=i;r++)n[r].id=o;return i-t+1}function Fp(e){return Array.prototype.concat.apply([],e)}const cs=Object.prototype.toString,wR=Object.prototype.hasOwnProperty;function Ar(e){return e===void 0}function yn(e){return e!==void 0}function la(e){return e==null}function Je(e){return cs.call(e)==="[object Array]"}function vn(e){return cs.call(e)==="[object Object]"}function Qe(e){return cs.call(e)==="[object Number]"}function En(e){const t=cs.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ni(e){return cs.call(e)==="[object String]"}function _R(e){if(!Je(e))throw new Error("must supply array")}function ii(e,t){return!la(e)&&wR.call(e,t)}function Bt(e,t){const n=jc(t);let i;return V(e,function(o,r){if(n(o,r))return i=o,!1}),i}function mm(e,t){const n=jc(t);let i=Je(e)?-1:void 0;return V(e,function(o,r){if(n(o,r))return i=r,!1}),i}function lt(e,t){const n=jc(t);let i=[];return V(e,function(o,r){n(o,r)&&i.push(o)}),i}function V(e,t){let n,i;if(Ar(e))return;const o=Je(e)?MR:CR;for(let r in e)if(ii(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function ER(e,t){if(Ar(e))return[];_R(e);const n=jc(t);return e.filter(function(i,o){return!n(i,o)})}function oi(e,t,n){return V(e,function(i,o){n=t(n,i,o)}),n}function Bo(e,t){return!!oi(e,function(n,i,o){return n&&t(i,o)},!0)}function No(e,t){return!!Bt(e,t)}function Hn(e,t){let n=[];return V(e,function(i,o){n.push(t(i,o))}),n}function Fc(e){return e&&Object.keys(e)||[]}function SR(e){return Fc(e).length}function ua(e){return Hn(e,t=>t)}function pa(e,t,n={}){return t=jp(t),V(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function ym(e,...t){e=jp(e);let n={};return V(t,o=>pa(o,e,n)),Hn(n,function(o,r){return o[0]})}const RR=ym;function Yi(e,t){t=jp(t);let n=[];return V(e,function(i,o){let r=t(i,o),a={d:r,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(r<c){n.splice(s,0,a);return}}n.push(a)}),Hn(n,i=>i.v)}function da(e){return function(t){return Bo(e,function(n,i){return t[i]===n})}}function jp(e){return En(e)?e:t=>t[e]}function jc(e){return En(e)?e:t=>t===e}function CR(e){return e}function MR(e){return Number(e)}function Hp(e,t){let n,i,o,r;function a(p){let d=Date.now(),f=p?0:r+t-d;if(f>0)return s(f);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Zn(e,t){return e.bind(t)}function Y(e,...t){return Object.assign(e,...t)}function AR(e,t,n){let i=e;return V(t,function(o,r){if(typeof o!="number"&&typeof o!="string")throw new Error("illegal key type: "+typeof o+". Key should be of type number or string.");if(o==="constructor")throw new Error("illegal key: constructor");if(o==="__proto__")throw new Error("illegal key: __proto__");let a=t[r+1],s=i[o];yn(a)&&la(s)&&(s=i[o]=isNaN(+a)?{}:[]),Ar(a)?Ar(n)?delete i[o]:i[o]=n:i=s}),e}function $i(e,t){let n={},i=Object(e);return V(t,function(o){o in i&&(n[o]=e[o])}),n}function Ki(e,t){let n={},i=Object(e);return V(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=Ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function st(e,t){return No(t,function(n){return A(e,n)})}function Ee(e){return e&&e.businessObject||e}function gt(e){return e&&e.di}const TR="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",vm="i18n",Tr="i18n:Translation";function Pr(e){if(e){if(A(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(A(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function $o(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,Tr)})}function Mn(e){return e.get("xml:lang")}function Fo(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,$c)})}function ls(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function zp(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 Gp(e,t,n){const i=Pr(e);if(!i)return{};const o=i.target[i.key]??"",r=$o(e).filter(u=>Mn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Mn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ls(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(d=>Mn(d)===u&&a(d));p&&(l[u]=a(p))}return l}const Hc="bwl.updateTranslation";class Vp{constructor(t){this.moddle=t}execute(t){const{element:n,text:i,designLocale:o,locales:r,rootLang:a,nameChangedFrom:s}=t,c=n.businessObject,l=Pr(c),u=[];t.undo=u;const p=$o(c).filter(T=>Mn(T)),d=s??(l?l.target[l.key]??"":""),f=a??o,h=(T=>{if(!T)return[];const F=p.filter(z=>z.body===T).map(Mn);return F.length?F:[f]})(d),y=s!==void 0&&d&&!h.includes(t.locale)?h[0]:t.locale,_=T=>{var F;return((F=p.find(z=>Mn(z)===T&&z.body))==null?void 0:F.body)??(h.includes(T)?d:"")},m=T=>Fo(c).some(F=>F.locale===T),v=_(y);if(v===i)return[];const b=!!v&&!m(y),E=b?r.filter(T=>T!==y&&_(T)&&!m(T)):[],C=()=>{let T=c.extensionElements;return T||(T=this.moddle.create("bpmn:ExtensionElements",{values:[]}),T.$parent=c,c.extensionElements=T,u.push(()=>delete c.extensionElements)),T.get("values")},I=(T,F)=>{const z=C();let G=z.find(ne=>{var re;return((re=ne.$instanceOf)==null?void 0:re.call(ne,Tr))&&Mn(ne)===T});if(G){const ne=G.body;G.body=F,u.push(()=>G.body=ne)}else G=this.moddle.create(Tr,{body:F}),G.set("xml:lang",T),G.$parent=c.extensionElements,z.push(G),u.push(()=>z.splice(z.indexOf(G),1))},k=T=>{const F=C(),z=F.indexOf(T);F.splice(z,1),u.push(()=>F.splice(z,0,T))};if(s===void 0){if(y===o&&l){if(d&&!p.some(F=>F.body===d)){const F=a&&a!==o?a:void 0;F&&I(F,d)}const T=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{T?l.target[l.key]=d:delete l.target[l.key]})}I(y,i)}else(p.some(T=>Mn(T)===y)||!d&&y!==f)&&I(y,i);if(!b)for(const T of Fo(c).filter(F=>F.locale===y))k(T);for(const T of E){const F=C(),z=this.moddle.create($c,{locale:T,sourceLocale:y,previous:v});z.$parent=c.extensionElements,F.push(z),u.push(()=>F.splice(F.indexOf(z),1))}for(const T of Fo(c).filter(F=>F.sourceLocale===y&&(F.previous??"")===i))k(T);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):[]}}sn(Vp,"$inject",["moddle"]);const Wp="bwl.setTranslations",PR=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Up{constructor(t){this.moddle=t}execute(t){const{element:n,texts:i,confirm:o=[],designLocale:r,locales:a,rootLang:s,before:c}=t,l=n.businessObject,u=[];if(t.undo=u,!Pr(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},d=_=>{const m=p(),v=m.indexOf(_);v<0||(m.splice(v,1),u.push(()=>m.splice(v,0,_)))},f=_=>$o(l).find(m=>Mn(m)===_);if(i===null)for(const _ of a){const m=f(_);m&&d(m)}else if(i)for(const _ of a){const m=i[_];if(m===void 0)continue;const v=f(_);if(v){if(v.body===m)continue;const C=v.body;v.body=m,u.push(()=>v.body=C);continue}if(_===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(Tr,{body:m});E.set("xml:lang",_),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const h=[...i===null?[]:c.requests.filter(_=>!o.includes(_.locale)&&!(i&&i[_.locale]!==void 0&&i[_.locale]!==c.texts[_.locale])&&!(i&&_.sourceLocale&&i[_.sourceLocale]===_.previous))];for(const _ of Fo(l)){const m=h.findIndex(v=>PR(_,v));m>=0?h.splice(m,1):d(_)}for(const _ of h){const m=p(),v=this.moddle.create($c,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});v.$parent=l.extensionElements,m.push(v),u.push(()=>m.splice(m.indexOf(v),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):[]}}sn(Up,"$inject",["moddle"]);function qp(e){return Fo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Yp{constructor(t){t.registerHandler(Hc,Vp),t.registerHandler(Wp,Up)}}sn(Yp,"$inject",["commandStack"]);const Kp={__init__:["translationCommands"],translationCommands:["type",Yp]},xm=["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"],kR={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},OR={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Nc.map(e=>[e,{type:"string"}])),additionalProperties:!1},DR={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},LR={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},IR={type:"string",enum:[...Ic],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},BR={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},NR={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},$R={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},FR={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},jR={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},HR={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},zR={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},GR={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},VR={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},WR={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Np]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Pn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const UR={"participant.add":Pn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Pn("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":Pn("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":Pn("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":Pn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Pn("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":Pn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Pn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Pn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Pn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Pn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Pn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Pn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Pn("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":Pn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Pn("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":Pn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Nc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Pn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},bm={anyOf:xm.map(e=>UR[e])},qR={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:DR,irParticipant:LR,irNode:BR,irFlowCondition:NR,irSequenceFlow:$R,irMessageFlow:FR,irDataStore:jR,irDataAssociation:HR,irTextAnnotation:zR,irAssociation:GR,irGroup:VR,bwlPlacement:WR,eventDefinition:IR,localeTexts:OR,nullableString:kR,symbolicOp:bm}};function Xp(){}Xp.prototype.get=function(e){return this.$model.properties.get(this,e)},Xp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function wm(e,t){this.model=e,this.properties=t}wm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Xp.prototype);V(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var o=e.ns.name;function r(a){n.define(this,"$type",{value:o,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),V(a,Zn(function(s,c){this.set(c,s)},this))}return r.prototype=i,r.hasType=i.$instanceOf=this.model.hasType,n.defineModel(r,t),n.defineDescriptor(r,e),r};var YR=Y(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),_m=Y(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 Zp(e,t){var n=_m[e];return n?n(t):t}function Jp(e){return!!YR[e]}function Em(e){return!!_m[e]}function zn(e,t){var n=e.split(/:/),i,o;if(n.length===1)i=e,o=t;else if(n.length===2)i=n[1],o=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(o?o+":":"")+i,{name:e,prefix:o,localName:i}}function mi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}mi.prototype.build=function(){return $i(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},mi.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)},mi.prototype.replaceProperty=function(e,t,n){var i=e.ns,o=this.properties,r=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=o.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");o.splice(s,1),this.addProperty(t,n?void 0:s,a),r[i.name]=r[i.localName]=t},mi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=zn(o[0],i),a=zn(o[1],r.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},mi.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},mi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},mi.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},mi.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},mi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},mi.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")},mi.prototype.hasProperty=function(e){return this.propertiesByName[e]},mi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(V(e.properties,Zn(function(r){r=Y({},r,{name:r.ns.localName,inherited:t}),Object.defineProperty(r,"definedBy",{value:e});var a=r.replaces,s=r.redefines;a||s?this.redefineProperty(r,a||s,a):(r.isBody&&this.setBodyProperty(r),r.isId&&this.setIdProperty(r),this.addProperty(r))},this)),i.push(e),n[o]=e)};function jo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,V(e,Zn(this.registerPackage,this))}jo.prototype.getPackage=function(e){return this.packageMap[e]},jo.prototype.getPackages=function(){return this.packages},jo.prototype.registerPackage=function(e){e=Y({},e);var t=this.packageMap;Sm(t,e,"prefix"),Sm(t,e,"uri"),V(e.types,Zn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},jo.prototype.registerType=function(e,t){e=Y({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Y({},e.meta||{})});var n=zn(e.name,t.prefix),i=n.name,o=Object.create(null);V(e.properties,Zn(function(r){var a=zn(r.name,n.prefix),s=a.name;Jp(r.type)||(r.type=zn(r.type,a.prefix).name),Y(r,{ns:a,name:s}),o[s]=r},this)),Y(e,{ns:n,name:i,propertiesByName:o}),V(e.extends,Zn(function(r){var a=zn(r,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},jo.prototype.mapTypes=function(e,t,n){var i=Jp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=zn(c,Jp(c)?"":e.prefix);o.mapTypes(u,t,l)}function a(c){return r(c,!0)}function s(c){return r(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");V(i.superClass,n?a:s),t(i,!n),V(i.traits,a)},jo.prototype.getEffectiveDescriptor=function(e){var t=zn(e),n=new mi(t);this.mapTypes(t,function(o,r){n.addTrait(o,r)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},jo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Sm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function kr(e){this.model=e}kr.prototype.set=function(e,t,n){if(!ni(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;KR(n)?i?delete e[o]:delete e.$attrs[Qp(t)]:i?o in e?e[o]=n:Rm(e,i,n):e.$attrs[Qp(t)]=n},kr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Qp(t)];var i=n.name;return!e[i]&&n.isMany&&Rm(e,n,[]),e[i]},kr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=Y({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},kr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},kr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},kr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const o=n.config.strict;if(typeof o<"u"){const r=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(o)throw r;typeof console<"u"&&console.warn(r)}return null};function KR(e){return typeof e>"u"}function Rm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Qp(e){return e.replace(/^:/,"")}function bi(e,t={}){this.properties=new kr(this),this.factory=new wm(this,this.properties),this.registry=new jo(e,this.properties),this.typeCache=Object.create(null),this.config=t}bi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},bi.prototype.getType=function(e){var t=this.typeCache,n=ni(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},bi.prototype.createAny=function(e,t,n){var i=zn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){AR(this,[a],s)}},r={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(o,r),this.properties.defineModel(o,this),this.properties.define(o,"get",{enumerable:!1,writable:!0}),this.properties.define(o,"set",{enumerable:!1,writable:!0}),this.properties.define(o,"$parent",{enumerable:!1,writable:!0}),this.properties.define(o,"$instanceOf",{enumerable:!1,writable:!0}),V(n,function(a,s){vn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},bi.prototype.getPackage=function(e){return this.registry.getPackage(e)},bi.prototype.getPackages=function(){return this.registry.getPackages()},bi.prototype.getElementDescriptor=function(e){return e.$descriptor},bi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},bi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},bi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Cm=String.fromCharCode,XR=Object.prototype.hasOwnProperty,ZR=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,us={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(us).forEach(function(e){us[e.toUpperCase()]=us[e]});function JR(e,t,n,i){return i?XR.call(us,i)?us[i]:"&"+i+";":Cm(t||parseInt(n,16))}function Or(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(ZR,JR):e}var Mm="non-whitespace outside of root node";function Ho(e){return new Error(e)}function QR(e){return"missing namespace for prefix <"+e+">"}function zc(e){return{get:e,enumerable:!0}}function eC(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Am=Symbol("nameCache");function ed(e){return e+"$uri"}function tC(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[ed(i)]=n;return t}function Gc(){return{line:0,column:0}}function nC(e){throw e}function Tm(e){if(!this)return new Tm(e);var t=e&&e.proxy,n,i,o,r,a=nC,s,c,l,u,p=Gc,d=!1,f=!1,g="",h=!1,y=!1,_=null,m=!1,v,b,E,C;function I(z){z instanceof Error||(z=Ho(z)),_=z,a(z,p)}function k(z){s&&(z instanceof Error||(z=Ho(z)),s(z,p))}this.on=function(z,G){if(typeof G!="function")throw Ho("required args <name, cb>");switch(z){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":o=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":r=G;break;case"attention":u=G;break;case"question":l=G;break;case"comment":c=G;break;default:throw Ho("unsupported event: "+z)}return this},this.ns=function(z){if(typeof z>"u"&&(z={}),typeof z!="object")throw Ho("required args <nsMap={}>");var G=Object.create(null),ne;for(ne in z)G[ne]=z[ne];return y=!0,C=G,this};function T(){v=y?[]:null,b=y?tC(C):null,E=[],p=Gc,m=!1,_=null,f=!1,g=""}this.parse=function(z){if(typeof z!="string")throw Ho("required args <xml=string>");if(d)throw Ho("parse during stream; call end() first");return T(),F(z),p=Gc,m=!1,_},this.write=function(z){if(typeof z!="string")throw Ho("required args <xml=string>");return d||(T(),d=!0),_||(g=F(g+z,!0)||""),this},this.end=function(){return d||T(),d=!1,_||F(g),g="",p=Gc,m=!1,_},this.stop=function(){m=!0};function F(z,G=!1){var ne=null,re=null,K,xe=0,de=!1,we=!1,he=0,W=0,le,q,ee,me,Re,ze,$,M,R,U="",X=0,pe;function Ne(St,tn){var Rn=St.indexOf(":");if(Rn===-1)return St;var Fn=b[St.substring(0,Rn)];return Fn?tn===Fn?St.substr(Rn+1):Fn+St.substr(Rn):(k(QR(St.substring(0,Rn))),null)}function Ke(){if(pe!==null)return pe;var St,tn,Rn=y&&b.xmlns,Fn=y&&h?[]:null,Nt=X,nn=U,on=nn.length,Wi,hi,xi,Un,mn,br={},es=new Set,ti,xt,At;e:for(;Nt<on;Nt++)if(ti=!1,xt=nn.charCodeAt(Nt),!(xt===32||xt<14&&xt>8)){for((xt<65||xt>122||xt>90&&xt<97)&&xt!==95&&xt!==58&&(k("illegal first char attribute name"),ti=!0),At=Nt+1;At<on;At++)if(xt=nn.charCodeAt(At),!(xt>96&&xt<123||xt>64&&xt<91||xt>47&&xt<59||xt===46||xt===45||xt===95)){if(xt===32||xt<14&&xt>8){k("missing attribute value"),Nt=At;continue e}if(xt===61)break;k("illegal attribute name char"),ti=!0}if(mn=nn.substring(Nt,At),mn==="xmlns:xmlns"&&(k("illegal declaration of xmlns"),ti=!0),xt=nn.charCodeAt(At+1),xt===34)At=nn.indexOf('"',Nt=At+2),At===-1&&(At=nn.indexOf("'",Nt),At!==-1&&(k("attribute value quote missmatch"),ti=!0));else if(xt===39)At=nn.indexOf("'",Nt=At+2),At===-1&&(At=nn.indexOf('"',Nt),At!==-1&&(k("attribute value quote missmatch"),ti=!0));else for(k("missing attribute value quotes"),ti=!0,At=At+1;At<on&&(xt=nn.charCodeAt(At+1),!(xt===32||xt<14&&xt>8));At++);for(At===-1&&(k("missing closing quotes"),At=on,ti=!0),ti||(xi=nn.substring(Nt,At)),Nt=At;At+1<on&&(xt=nn.charCodeAt(At+1),!(xt===32||xt<14&&xt>8));At++)Nt===At&&(k("illegal character after attribute end"),ti=!0);if(Nt=At+1,ti)continue e;if(es.has(mn)){k("attribute <"+mn+"> already defined");continue}if(es.add(mn),!y){br[mn]=xi;continue}if(h){if(hi=mn==="xmlns"?"xmlns":mn.charCodeAt(0)===120&&mn.substr(0,6)==="xmlns:"?mn.substr(6):null,hi!==null){if(St=Or(xi),tn=ed(hi),Un=C[St],!Un){if(hi==="xmlns"||tn in b&&b[tn]!==St)do Un="ns"+xe++;while(typeof b[Un]<"u");else Un=hi;C[St]=Un}b[hi]!==Un&&(Wi||(b=eC(b),Wi=!0),b[hi]=Un,hi==="xmlns"&&(b[ed(Un)]=St,Rn=Un),b[tn]=St),br[mn]=xi;continue}Fn.push(mn,xi);continue}mn=Ne(mn,Rn),mn!==null&&(br[mn]=xi)}if(h)for(Nt=0,on=Fn.length;Nt<on;Nt++)mn=Ne(Fn[Nt++],Rn),xi=Fn[Nt],mn!==null&&(br[mn]=xi);return pe=br}function ht(){for(var St=/(\r\n|\r|\n)/g,tn=0,Rn=0,Fn=0,Nt=W,nn,on;he>=Fn&&(nn=St.exec(z),!(!nn||(Nt=nn[0].length+nn.index,Nt>he)));)tn+=1,Fn=Nt;return he==-1?(Rn=Nt,on=z.substring(W)):W===0?on=z.substring(W,he):(Rn=he-Fn,on=W==-1?z.substring(he):z.substring(he,W+1)),{data:on,line:tn,column:Rn}}for(p=ht,t&&(R=Object.create({},{name:zc(function(){return $}),originalName:zc(function(){return M}),attrs:zc(Ke),ns:zc(function(){return b})}));W!==-1;){if(z.charCodeAt(W)===60?he=W:he=z.indexOf("<",W),he===-1){if(G)return z.substring(W);if(E.length)return I("unexpected end of file");if(!f)return I("missing start tag");W<z.length&&z.substring(W).trim()&&k(Mm);return}if(f||(f=!0),W!==he){if(E.length){if(n&&(n(z.substring(W,he),Or,p),m))return}else if(z.substring(W,he).trim()&&(k(Mm),m))return}if(me=z.charCodeAt(he+1),me===33){if(ee=z.charCodeAt(he+2),ee===91&&z.substr(he+3,6)==="CDATA["){if(W=z.indexOf("]]>",he),W===-1)return G?z.substring(he):I("unclosed cdata");if(r&&(r(z.substring(he+9,W),p),m))return;W+=3;continue}if(ee===45&&z.charCodeAt(he+3)===45){if(W=z.indexOf("-->",he),W===-1)return G?z.substring(he):I("unclosed comment");if(c&&(c(z.substring(he+4,W),Or,p),m))return;W+=3;continue}}if(me===63){if(W=z.indexOf("?>",he),W===-1)return G?z.substring(he):I("unclosed question");if(l&&(l(z.substring(he,W+2),p),m))return;W+=2;continue}for(le=he+1;;le++){if(Re=z.charCodeAt(le),isNaN(Re))return G?z.substring(he):(W=-1,I("unclosed tag"));if(Re===34)ee=z.indexOf('"',le+1),le=ee!==-1?ee:le;else if(Re===39)ee=z.indexOf("'",le+1),le=ee!==-1?ee:le;else if(Re===62){W=le;break}}if(me===33){if(u&&(u(z.substring(he,W+1),Or,p),m))return;W+=1;continue}if(pe={},me===47){if(de=!1,we=!0,!E.length)return I("missing open tag");if(le=$=E.pop(),ee=he+2+le.length,z.substring(he+2,ee)!==le)return I("closing tag mismatch");for(;ee<W;ee++)if(me=z.charCodeAt(ee),!(me===32||me>8&&me<14))return I("close tag")}else{if(z.charCodeAt(W-1)===47?(le=$=z.substring(he+1,W-1),de=!0,we=!0):(le=$=z.substring(he+1,W),de=!0,we=!1),!(me>96&&me<123||me>64&&me<91||me===95||me===58))return I("illegal first char nodeName");for(ee=1,q=le.length;ee<q;ee++)if(me=le.charCodeAt(ee),!(me>96&&me<123||me>64&&me<91||me>47&&me<59||me===45||me===95||me==46)){if(me===32||me<14&&me>8){$=le.substring(0,ee),pe=null;break}return I("invalid nodeName")}we||E.push($)}if(y){K=b,de&&(we||v.push(K),pe===null&&(h=le.indexOf("xmlns",ee)!==-1)&&(X=ee,U=le,Ke(),h=!1)),M=$,re!==b&&(ne=b[Am],ne===void 0&&(ne=b[Am]=Object.create(null)),re=b);var kt=ne[$];if(kt!==void 0)$=kt;else{if(me=$.indexOf(":"),me!==-1){if(ze=b[$.substring(0,me)],!ze)return I("missing namespace on <"+M+">");$=$.substr(me+1)}else ze=b.xmlns;ze&&($=ze+":"+$),ne[M]=$}}if(de&&(X=ee,U=le,i&&(t?i(R,Or,we,p):i($,Ke,Or,we,p),m)))return;if(we){if(o&&(o(t?R:$,Or,de,p),m))return;y&&(de?b=K:b=v.pop())}W+=1}}}function Pm(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var td={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},km="property";function Om(e){return e.xml&&e.xml.serialize}function iC(e){const t=Om(e);return t!==km&&(t||null)}function oC(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Dm(e,t){return Pm(t)?e.prefix+":"+oC(e.localName):e.name}function rC(e,t){var n=e.name,i=e.localName,o=t&&t.xml&&t.xml.typePrefix;return o&&i.indexOf(o)===0?e.prefix+":"+i.slice(o.length):n}function aC(e,t,n){const i=zn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=zn(o);var a=n.getPackage(r.prefix);return rC(r,a)}function zo(e){return new Error(e)}function yo(e){return e.$descriptor}function sC(e){Y(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw zo("expected element");var n=this.elementsById,i=yo(t),o=i.idProperty,r;if(o&&(r=t.get(o.name),r)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(r))throw new Error("illegal ID <"+r+">");if(n[r])throw zo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ps(){}ps.prototype.handleEnd=function(){},ps.prototype.handleText=function(){},ps.prototype.handleNode=function(){};function nd(){}nd.prototype=Object.create(ps.prototype),nd.prototype.handleNode=function(){return this};function fa(){}fa.prototype=Object.create(ps.prototype),fa.prototype.handleText=function(e){this.body=(this.body||"")+e};function ds(e,t){this.property=e,this.context=t}ds.prototype=Object.create(fa.prototype),ds.prototype.handleNode=function(e){if(this.element)throw zo("expected no sub nodes");return this.element=this.createReference(e),this},ds.prototype.handleEnd=function(){this.element.id=this.body},ds.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function id(e,t){this.element=t,this.propertyDesc=e}id.prototype=Object.create(fa.prototype),id.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Zp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Vc(){}Vc.prototype=Object.create(fa.prototype),Vc.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 qn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}qn.prototype=Object.create(Vc.prototype),qn.prototype.addReference=function(e){this.context.addReference(e)},qn.prototype.handleText=function(e){var t=this.element,n=yo(t),i=n.bodyProperty;if(!i)throw zo("unexpected body text <"+e+">");fa.prototype.handleText.call(this,e)},qn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=yo(t),i=n.bodyProperty;i&&e!==void 0&&(e=Zp(i.type,e),t.set(i.name,e))},qn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=yo(n),o=this.context,r=new n({}),a=this.model,s;return V(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),V(p,function(d){o.addReference({element:r,property:u.ns.name,id:d})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Zp(u.type,c):l==="xmlns"?l=":"+l:(s=zn(l,i.ns.prefix),a.getPackage(s.prefix)&&o.addWarning({message:"unknown attribute <"+l+">",element:r,property:l,value:c})),r.set(l,c))}),r},qn.prototype.getPropertyForNode=function(e){var t=e.name,n=zn(t),i=this.type,o=this.model,r=yo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=iC(s);if(l){const u=e.attributes[l];if(u){const p=aC(u,e.ns,o),d=o.getType(p);return Y({},s,{effectiveType:yo(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Dm(n,c),u=o.getType(l);if(s=Bt(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return Y({},s,{effectiveType:yo(u).name})}else if(s=Bt(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw zo("unrecognized element <"+n.name+">")},qn.prototype.toString=function(){return"ElementDescriptor["+yo(this.type).name+"]"},qn.prototype.valueHandler=function(e,t){return new id(e,t)},qn.prototype.referenceHandler=function(e){return new ds(e,this.context)},qn.prototype.handler=function(e){return e==="Element"?new ha(this.model,e,this.context):new qn(this.model,e,this.context)},qn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Em(n))return this.valueHandler(t,i);t.isReference?o=this.referenceHandler(t).handleNode(e):o=this.handler(n).handleNode(e);var r=o.element;return r!==void 0&&(t.isMany?i.get(t.name).push(r):i.set(t.name,r),t.isReference?(Y(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function od(e,t,n){qn.call(this,e,t,n)}od.prototype=Object.create(qn.prototype),od.prototype.createElement=function(e){var t=e.name,n=zn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Dm(n,r)||t;if(!o.hasType(a))throw zo("unexpected element <"+e.originalName+">");return qn.prototype.createElement.call(this,e)};function ha(e,t,n){this.model=e,this.context=n}ha.prototype=Object.create(Vc.prototype),ha.prototype.createElement=function(e){var t=e.name,n=zn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ha.prototype.handleChild=function(e){var t=new ha(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,o;return i!==void 0&&(o=n.$children=n.$children||[],o.push(i),i.$parent=n),t},ha.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function rd(e){e instanceof bi&&(e={model:e}),Y(this,{lax:!1},e)}rd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof qn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var o=this.model,r=this.lax,a=new sC(Y({},t,{rootHandler:i})),s=new Tm({proxy:!0}),c=cC();i.context=a,c.push(i);function l(E,C,I){var k=C(),T=k.line,F=k.column,z=k.data;z.charAt(0)==="<"&&z.indexOf(" ")!==-1&&(z=z.slice(0,z.indexOf(" "))+">");var G="unparsable content "+(z?z+" ":"")+`detected
|
|
2
|
+
line: `+T+`
|
|
3
3
|
column: `+F+`
|
|
4
|
-
nested error: `+E.message;if(I)return a.addWarning({message:G,error:E}),!0;throw zo(G)}function u(E,C){return l(E,C,!0)}function p(){var E=a.elementsById,C=a.references,I,k;for(I=0;k=C[I];I++){var
|
|
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 hC(e){e=Y({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new dC,r=new fC(o,e.format);e.preamble&&r.append(JR);var a=new Gt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(gC(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function gC(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in td)n[i]=td[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Wc(e,t){bi.call(this,e,t)}Wc.prototype=Object.create(bi.prototype),Wc.prototype.fromXML=function(e,t,n){ni(t)||(n=t,t="bpmn:Definitions");var i=new rd(Y({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Wc.prototype.toXML=function(e,t){var n=new hC(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var mC="BPMN20",yC="http://www.omg.org/spec/BPMN/20100524/MODEL",vC="bpmn",xC=[],bC=[{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"}]}],wC=[{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"}]}],_C={tagAlias:"lowerCase",typePrefix:"t"},EC={name:mC,uri:yC,prefix:vC,associations:xC,types:bC,enumerations:wC,xml:_C},SC="BPMNDI",RC="http://www.omg.org/spec/BPMN/20100524/DI",CC="bpmndi",MC=[{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"]}],AC=[{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"}]}],PC=[],TC={name:SC,uri:RC,prefix:CC,types:MC,enumerations:AC,associations:PC},kC="DC",OC="http://www.omg.org/spec/DD/20100524/DC",DC="dc",LC=[{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}]}],IC=[],BC={name:kC,uri:OC,prefix:DC,types:LC,associations:IC},NC="DI",$C="http://www.omg.org/spec/DD/20100524/DI",FC="di",jC=[{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"}]}],HC=[],zC={tagAlias:"lowerCase"},GC={name:NC,uri:$C,prefix:FC,types:jC,associations:HC,xml:zC},VC="bpmn.io colors for BPMN",WC="http://bpmn.io/schema/bpmn/biocolor/1.0",UC="bioc",qC=[{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"}]}],YC=[],KC=[],XC={name:VC,uri:WC,prefix:UC,types:qC,enumerations:YC,associations:KC},ZC="BPMN in Color",JC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",QC="color",eM=[{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"}]}],tM=[],nM=[],iM={name:ZC,uri:JC,prefix:QC,types:eM,enumerations:tM,associations:nM};const oM={bpmn:EC,bpmndi:TC,dc:BC,di:GC,bioc:XC,color:iM};function Bm(e,t){const n=Y({},oM,e);return new Wc(n,t)}const rM={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"}},fs={[mm]:rM,[Bp]:lm};function Nm(){return Bm(fs)}const $m=Nm();async function ga(e){const{rootElement:t,warnings:n}=await $m.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function aM(e){const{xml:t}=await $m.toXML(e,{format:!0});return t}function cd(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Zi={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},sM=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function cM(e){const t=Zi;return sM.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 Lr(e,t){let n=0;for(const i of e)n+=t*cM(i);return n}function Fm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&lM(e),uM(e),pM(e),dM(e)}function lM(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(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Lr(o,r),fontBoundingBoxAscent:r*Zi.ascentEm,fontBoundingBoxDescent:r*Zi.descentEm,actualBoundingBoxAscent:r*Zi.ascentEm,actualBoundingBoxDescent:r*Zi.descentEm}}};t.getContext=()=>n}function uM(e){if(e.SVGMatrix)return;class t{constructor(){mn(this,"a",1);mn(this,"b",0);mn(this,"c",0);mn(this,"d",1);mn(this,"e",0);mn(this,"f",0)}static of(i,o,r,a,s,c){return Object.assign(new t,{a:i,b:o,c:r,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,o){return this.multiply(t.of(1,0,0,1,i,o))}scale(i,o=i){return this.multiply(t.of(i,0,0,o,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 pM(e){var r;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),d=Math.sin(u);a.a=p,a.b=d,a.c=-d,a.d=p,a.e=c-p*c+d*l,a.f=l-d*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.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 o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"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 dM(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:Lr(n,12),height:14}})}const Uc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),fM=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),hM=1,qc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),gM=2;function ct(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 jm=20,Yc=5,Hm=3,mM=8,ma=15,ld=50,zm=12,yM=zm*1.2;function ud(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Lr(r,zm))),o=n.length*yM;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Gm=1;function sn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Ir(e,t){let n=null;const i=e.type!==t.type,r=!!(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 sn(e))for(const s of sn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Gm)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":r?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=jm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function pd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Vm(e,t){const n=Ir(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function vM(e,t){let n=0;for(const i of t)i.id!==e.id&&Vm(e,i)&&n++;return n}function Jn(e,t){let n=0;for(const i of t)i.id!==e.id&&Ir(e,i)&&n++;return n}const Wm=15,Um=20;function xM(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Um||t.at>n[1]+Um)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],o=Math.max(i[0],t.lo),r=Math.min(i[1],t.hi);return r>o?[o,r]:null}const dd=20;function Kc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Gm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<jm||n.push([o-dd,r+dd])}return n}function Xc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of sn(e)){const r=xM(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Kc(o,sn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const bM=10,wM=1,_M=(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 EM(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const d=(f,g)=>{if(g===0)return f<=0;const h=f/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 d(o-e.x,c)&&d(e.x-a,-c)&&d(r-e.y,l)&&d(e.y-s,-l)&&p>u}function fd(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 SM=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ya=1;function Fi(e,t){const n=e.x+ya,i=e.x+e.width-ya,o=e.y+ya,r=e.y+e.height-ya;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function va(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 qm(e,t){const n=e.label;if(!n)return null;if(sn(e).some(i=>Fi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(sn(i).some(o=>Fi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(va(i).some(o=>Fi(n,o)))return i.id;return null}function Tt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(EM(e.waypoints[r],e.waypoints[r+1],o,gM)){i.push(o);break}}return i}const hs=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},RM=(e,t,n,i)=>Km(e,t,n,i)?0:Math.min(hs(e,n,i),hs(t,n,i),hs(n,e,t),hs(i,e,t)),Ym=(e,t)=>{let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const r=t[i],a=t[o];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n};function Go(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,hs({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+a}];if(Ym(e,s)||Ym(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,RM(e,t,s[l],s[(l+1)%s.length]));return c}function Km(e,t,n,i){const o=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),r=o(n,i,e),a=o(n,i,t),s=o(e,t,n),c=o(e,t,i);return r*a<0&&s*c<0}const hd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Xm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(Km(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function gs(e,t){let n=0;for(const i of t)i.id===e.id||hd(e,i)||Xm(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id===e.id||hd(e,i)||gs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Zm(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)gs(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function Ji(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(gs(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function wi(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(hd(n[i],n[o])&&Xm(n[i],n[o])){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function Jm(e){const t=Ji(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=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"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:CM(e)}}function CM(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.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(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!qc.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function ey(e){var n;const t=(n=zt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=zt(i);if((o==null?void 0:o.$type)!=="bwl:Members"||typeof o.refs!="string")continue;const r=o.refs.split(/\s+/).filter(Boolean);return r.length?r:void 0}}const ty=e=>e?{members:e}:{},kn=e=>e.shapes.filter(t=>!t.container);function MM(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 o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function AM(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 o=e.x+e.width/2,r=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&o>=a.x&&o<=a.x+a.width&&r>=a.y&&r<=a.y+a.height)}function ny(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(sn(i).some(o=>Fi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(va(i).some(o=>Fi(n,o)))return i.id;return null}function Vo(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 iy=3;function oy(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 o=/Event$/.test(t.type);if(!o&&!/Gateway$/.test(t.type))return Math.min(n,i);const r=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(r,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(o)return Math.max(0,t.width/2-Math.hypot(s-r,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-r)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ms(e,t){const n=[];for(const i of t.shapes){if(i.container||qc.has(i.type))continue;const o=oy(e,i);o>=iy&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function gd(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function ut(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of Tt(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const o=e.shapes.filter(m=>m.container&&fM.has(m.type));if(o.length){const m=(v,b)=>{const E=e.shapes.find(C=>C.id===b);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 b of Tt(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>m(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.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[b,E]of v){if(!b)continue;const C=e.shapes.find(F=>F.id===b);if(!C||C.container)continue;const I=Math.max(C.x-E.x,E.x-(C.x+C.width),0),k=Math.max(C.y-E.y,E.y-(C.y+C.height),0),P=Math.hypot(I,k);P>bM&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:b,distance:Math.round(P)})}}for(const m of gd(e.shapes))n.push({kind:"pool-overlap",...m});const r=i.filter(m=>!m.attached);for(let m=0;m<r.length;m++)for(let v=m+1;v<r.length;v++){const b=r[m],E=r[v];if(!fd(b,E,hM))continue;const C=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:C,identical:SM(b,E)})}const a=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const b=a[m],E=a[v],C=Math.min(b.x+b.width,E.x+E.width)-Math.max(b.x,E.x),I=Math.min(b.y+b.height,E.y+E.height)-Math.max(b.y,E.y);if(C<=Yc||I<=Yc)continue;const k=b.id<E.id?[b.id,E.id]:[E.id,b.id],P=new Set(E.members);if(b.members.some(z=>P.has(z))){const z=Qm(e,a,{x:Math.max(b.x,E.x),y:Math.max(b.y,E.y),right:Math.min(b.x+b.width,E.x+E.width),bottom:Math.min(b.y+b.height,E.y+E.height)});z.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:k,shapes:z});continue}const F=b.x<=E.x&&b.y<=E.y&&b.x+b.width>=E.x+E.width&&b.y+b.height>=E.y+E.height?b.id:E.x<=b.x&&E.y<=b.y&&E.x+E.width>=b.x+b.width&&E.y+E.height>=b.y+b.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:k,...F?{container:F}:{}})}const s=new Set(a.flatMap(m=>[...m.members])),c=m=>e.shapes.filter(v=>!v.container&&!qc.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 a){const v=c(m);if(!v.length)continue;const b=new Set(m.members),E=v.filter(C=>!b.has(C.id));E.some(C=>s.has(C.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:E.map(C=>C.id).sort()}))}for(const m of a){const v=new Set(c(m).map(P=>P.id)),b=new Set(m.members),E=new Set([...v].filter(P=>!b.has(P)&&s.has(P)));if(!E.size)continue;let C=!1,I=!1,k=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const F=E.has(P.source),z=E.has(P.target);!F&&z&&!v.has(P.source)?C=!0:F&&!z&&!v.has(P.target)?I=!0:F&&z&&(k=!0)}C&&I&&k&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...E].sort()})}const l=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<l.length;m++)for(let v=m+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[m],l[v],l[b]],C={x:Math.max(...E.map(P=>P.x)),y:Math.max(...E.map(P=>P.y)),right:Math.min(...E.map(P=>P.x+P.width)),bottom:Math.min(...E.map(P=>P.y+P.height))};if(C.right-C.x<=Yc||C.bottom-C.y<=Yc)continue;const I=Qm(e,[],C);if(!I.length)continue;const k=E.map(P=>P.id).sort();n.push({kind:"group-stack-unreadable",groups:k,shapes:I})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||qc.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["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,C,I,k,P]of b){const F=I==="h"?v.x:v.y,z=I==="h"?v.x+v.width:v.y+v.height;if(!(F<P&&k<z))continue;const G=I==="h"?v.y:v.x,ne=I==="h"?v.y+v.height:v.x+v.width;if(!(G<C&&C<ne))continue;const re=Math.min(C-G,ne-C);re<mM||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:E,depth:re})}}const u=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(u.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 b=sn(v);if(b.length)for(const E of u){const C=E.x+E.width,I=E.y+E.height,k=v.endpoints.some(F=>{const z=m.get(F);return!!z&&E.x<z.x&&z.x<C&&E.y<z.y&&z.y<I});let P=null;for(const F of b){const[z,G,ne]=F.axis==="v"?[E.y,I,[["left",E.x],["right",C]]]:[E.x,C,[["top",E.y],["bottom",I]]],re=Math.min(F.hi,G)-Math.max(F.lo,z);if(re<ld)continue;const K=F.axis==="v"?E.x<F.at&&F.at<C:E.y<F.at&&F.at<I;if(!(K&&k))for(const[xe,de]of ne){const we=Math.abs(F.at-de);we<=ma&&(!P||we<P.distance)&&(P={side:xe,inside:K,distance:we,length:re})}}P&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:P.side,inside:P.inside,distance:Math.round(P.distance),length:Math.round(P.length)})}}}const p=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 p){const b=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,C=[["top",m.y,v.y,b],["bottom",m.y+m.height,v.y+v.height,b],["left",m.x,v.x,E],["right",m.x+m.width,v.x+v.width,E]];for(const[I,k,P,F]of C)F&&Math.abs(k-P)<=Hm&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:I})}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 b=d[m],E=d[v],C=b.x<E.x+E.width&&E.x<b.x+b.width,I=b.y<E.y+E.height&&E.y<b.y+b.height,k=[["x",b.x+b.width,E.x,I],["x",E.x+E.width,b.x,I],["y",b.y+b.height,E.y,C],["y",E.y+E.height,b.y,C]];for(const[P,F,z,G]of k)if(G&&Math.abs(F-z)<=Hm){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:P});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const b=e.edges[m],E=e.edges[v],C=Ir(b,E);if(!C)continue;const I=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:I,axis:C.axis,length:Math.round(C.length)})}for(const m of e.edges){if(!m.label)continue;const v=Xc(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=qm(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:b}of ms(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(b)})}const f=new Set(i.map(m=>m.id)),g=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...g.filter(v=>!f.has(v.id))]){if(!m.label)continue;const v=ny(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const h=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of g)for(const{owner:v,rect:b}of Vo(e))v===m.id||h.has(v)||fd(m.label,b,ya)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const y=Vo(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of y)v!==m.id&&fd(m,b,ya)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const w=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??MM(m,e,w);if(!v)continue;const b=w.get(v);!b||!b.container||_M(b,m,wM)||m.type==="bpmn:TextAnnotation"&&!AM(m,b,e)||n.push({kind:"shape-outside-container",shape:m.id,container:b.id})}return n.sort((m,v)=>ct(m).localeCompare(ct(v)))}const zt=e=>typeof e=="object"&&e!==null?e:void 0,Qt=e=>typeof e=="number"?e:0,vo=e=>{const t=zt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function PM(e){const t=zt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=vo(r);a&&n.push(a)}}return n}function TM(e){const t=zt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:vo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:vo(t.targetRef);return n&&i?{source:n,target:i}:{}}function kM(e,t){const n=zt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=vo(n);return o?t.get(o):void 0}if(Uc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return vo(n)}function ry(e){var a,s,c,l,u;const t=[],n=[],i=((a=zt(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=zt(e))==null?void 0:s.rootElements)??[]){const d=zt(p);if((d==null?void 0:d.$type)==="bpmn:Collaboration")for(const f of d.participants??[]){const g=zt(f),h=vo(g),y=vo(g==null?void 0:g.processRef);h&&y?o.set(y,h):h&&r.add(h)}}for(const p of i){const d=zt((c=zt(p))==null?void 0:c.plane),f=(d==null?void 0:d.planeElement)??[];for(const g of f){const h=zt(g);if(!h)continue;const y=zt(h.bpmnElement),w=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!w)continue;const m=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",v=zt(h.bounds);if(v){const E=h.isExpanded===!1&&m!=="bpmn:Participant",C=zt((l=zt(h.label))==null?void 0:l.bounds),I={id:w,type:m,x:Qt(v.x),y:Qt(v.y),width:Qt(v.width),height:Qt(v.height),container:Uc.has(m)&&!E,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:kM(y,o)}:{},...C?{label:{x:Qt(C.x),y:Qt(C.y),width:Qt(C.width),height:Qt(C.height)}}:{},...m==="bpmn:Group"?ty(ey(y)):{}},k=h.isHorizontal!==!1,P=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(w)&&k&&P&&(I.label=ud(I,P)),t.push(I);continue}const b=h.waypoint;if(Array.isArray(b)){const E=zt((u=zt(h.label))==null?void 0:u.bounds);n.push({id:w,type:m,waypoints:b.map(C=>{var I,k;return{x:Qt((I=zt(C))==null?void 0:I.x),y:Qt((k=zt(C))==null?void 0:k.y)}}),endpoints:PM(y),...TM(y),...E?{label:{x:Qt(E.x),y:Qt(E.y),width:Qt(E.width),height:Qt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function ay(e){return ut(ry(e),{includeObservationOnly:!0})}async function OM(e){const{definitions:t,warnings:n}=await ga(e);return{findings:ay(t),warnings:n}}function Ve(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const h=zt(r.label),y=vo(r.source),w=vo(r.target);n.push({id:r.id,type:a,waypoints:s.map(m=>({x:Qt(m.x),y:Qt(m.y)})),endpoints:[y,w].filter(m=>!!m),...y&&w?{source:y,target:w}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Qt(h.y),width:Qt(h.width),height:Qt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=zt(r.businessObject),l=zt(r.label);let u=zt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=zt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",d=u&&Uc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,f={id:r.id,type:a,x:r.x,y:r.y,width:Qt(r.width),height:Qt(r.height),container:Uc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...d!==void 0?{parent:d}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Qt(l.y),width:Qt(l.width),height:Qt(l.height)}}:{},...a==="bpmn:Group"?ty(ey(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=zt(r.di))==null?void 0:i.isHorizontal)!==!1&&(f.label=ud(f,g)),t.push(f)}return{shapes:t,edges:n}}const DM={"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 LM(e,t){const n=DM[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function sy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function cy(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 LM(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&sy(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?sy(i):void 0},endpointsOf:n=>{var o,r;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(o=i.source)==null?void 0:o.id,target:(r=i.target)==null?void 0:r.id}},eventDefinitionOf:n=>{var r;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const o=(((r=i.businessObject)==null?void 0:r.eventDefinitions)??[]).map(a=>a.$type);return Ip(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Fo(i.businessObject).map(o=>o.locale)}}}const Br=20,IM=4,We=(e,t)=>Math.abs(e-t)<.5,BM=15;function md(e,t,n){let i=1/0;for(const o of t)if(!n.includes(o.id))for(let r=1;r<e.length;r++)i=Math.min(i,Go(e[r-1],e[r],o));return i}function NM(e,t,n=BM){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=We(i.x,o.x)&&!We(i.y,o.y),a=We(i.y,o.y)&&!We(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=w=>{const m=w?t.find(v=>v.id===w):void 0;return m?r?[m.x+10,m.x+m.width-10]:[m.y+10,m.y+m.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),g=Math.min(u,d);if(!(g>=f))return[];const h=r?i.x:i.y,y=[];for(let w=5;w<=400;w+=5)for(const m of[-1,1]){const v=h+m*w;if(v<f||v>g)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Tt({...e,waypoints:b},t).length||md(b,t,s)<n||y.push(b)}return y}function yd(e,t,n,i){const o=e.edges.filter(d=>d.id!==t.id),r={...t,waypoints:n},a={...t,waypoints:[...i]};if(Gn(r,o)>Gn(a,o)||Jn(r,o)>Jn(a,o))return!1;const s=`L|${t.id}|${t.id}`,c=d=>ut({...e,edges:e.edges.map(f=>f.id===t.id?{...f,waypoints:d}:f)}).filter(f=>ct(f)!==s),l=c(n),u=`"${t.id}"`;if(l.some(d=>JSON.stringify(d).includes(u)))return!1;const p=new Set(c([...i]).map(ct));return l.every(d=>p.has(ct(d)))}function ly(e,t,n,i){for(const o of NM(t,n))if(yd(e,t,o,i))return o;return null}const $M=120;function uy(e,t,n,i,o){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return[];const r=t.find(c=>c.id===e.endpoints[0]),a=t.find(c=>c.id===e.endpoints[1]);if(!r||!a)return[];if(a.x<r.x+r.width)return[];if(Math.min(r.y+r.height,a.y+a.height)-Math.max(r.y,a.y)<10)return[];const s=[];for(const[c,l]of[[0,0],[0,-25],[0,25],[-25,0],[25,0]])for(let u=Br;u<=$M;u+=5)for(const p of["top","bottom"]){const d=p==="top"?r.y:r.y+r.height,f=p==="top"?a.y:a.y+a.height,g=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,h=r.x+r.width/2+c,y=a.x+a.width/2+l,w=[{x:h,y:d},{x:h,y:g},{x:y,y:g},{x:y,y:f}];if(!tl(w,i)||Tt({...e,waypoints:w},t).length||Tt({...e,endpoints:[],waypoints:w},[r,a]).length||md(w,t,e.endpoints)<Br)continue;const m=Cd(w,n);(o===void 0?m<Rd:m>=Rd||m<o)||s.push(w)}return s}function py(e,t,n,i,o){const r=e.shapes.filter(c=>c.type==="bpmn:Participant"||c.type==="bpmn:Lane"),a=dy(e,t,i,uy(t,n,r,o));if(a)return a;const s=Math.max(Cd(i,r),Br);return dy(e,t,i,uy(t,n,r,o,s))}function dy(e,t,n,i){const o=new Map;for(const c of i){const l=c[1].y<c[0].y?"top":"bottom";if(!o.has(l)&&(yd(e,t,c,n)&&o.set(l,c),o.size===2))break}const r=e.edges.filter(c=>c.id!==t.id);let a=null,s=1/0;for(const c of["top","bottom"]){const l=o.get(c);if(!l)continue;const u=Gn({...t,waypoints:l},r);u<s&&(a=l,s=u)}return a}function Zc(e,t,n,i=Br){if(We(e.y,t.y)&&!We(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))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(We(e.x,t.x)&&!We(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))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 fy(e,t,n,i=Br){if(n.length<2)return null;if(We(e.y,t.y)&&!We(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(f=>f.x))-i,s=Math.max(...n.map(f=>f.x+f.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(f=>f.y))-i,p=Math.max(...n.map(f=>f.y+f.height))+i,d=f=>[{x:c,y:e.y},{x:c,y:f},{x:l,y:f},{x:l,y:e.y}];return[d(u),d(p)]}if(We(e.x,t.x)&&!We(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(f=>f.y))-i,s=Math.max(...n.map(f=>f.y+f.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(f=>f.x))-i,p=Math.max(...n.map(f=>f.x+f.width))+i,d=f=>[{x:e.x,y:c},{x:f,y:c},{x:f,y:l},{x:e.x,y:l}];return[d(u),d(p)]}return null}function hy(e,t,n=Br){if(e.length!==4)return null;const[i,o,r,a]=e;if(We(i.y,o.y)&&We(o.x,r.x)&&We(r.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(We(i.x,o.x)&&We(o.y,r.y)&&We(r.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 Jc(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 o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const Qc=30,FM=[0,-25,25,-40,40];function jM(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(d=>d.id===e.endpoints[0]),i=t.find(d=>d.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+Qc:s-Qc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return FM.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Tt({...e,endpoints:[],waypoints:d},[n]).length===0)}const vd=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],xa=(e,t,n)=>Tt({...e,waypoints:t},n).length;function el(e,t,n,i){let o=[...e.waypoints],r=xa(e,o,t);if(r===0)return null;let a=!1;for(const p of Jc(e,t))if(xa(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(sn),c=p=>sn({...e,waypoints:p}).some(d=>Kc(d,s).length>0),l=jM(e,t).filter(p=>xa(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(d=>d.x>=n.x&&d.x<=n.x+n.width&&d.y>=n.y&&d.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(f=>f.id===e.endpoints[0]),d=t.find(f=>f.id===e.endpoints[1]);if(p&&d&&We(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(We(f[0].y,f[1].y)&&!We(f[0].x,f[1].x)){const g=t.filter(m=>!e.endpoints.includes(m.id)&&Tt({...e,waypoints:f},[m]).length>0),h=g.length>=2?fy(f[0],f[1],g):null,w=(h?h.map(m=>[f[0],...m,f[1]]):g.length===1?(Zc(f[0],f[1],g[0])??[]).map(m=>[f[0],...m,f[1]]):g.length===0?[f]:[]).filter(m=>xa(e,m,t)===0&&m.length<=o.length).sort((m,v)=>Number(u(v))-Number(u(m)));if(w.length)return w.find(m=>!c(m))??w[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],g=t.filter(w=>!e.endpoints.includes(w.id)&&Tt({...e,waypoints:[d,f]},[w]).length>0);if(g.length<2)continue;const h=fy(d,f,g);if(!h)continue;const y=h.map(w=>vd(o,p,w)).filter(w=>xa(e,w,t)===0).sort((w,m)=>Number(u(m))-Number(u(w)));if(y.length)return y.find(w=>!c(w))??y[0]}for(let p=0;p<IM&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const g=o[f],h=o[f+1];for(const y of t){if(e.endpoints.includes(y.id)||Tt({...e,waypoints:[g,h]},[y]).length===0)continue;const w=Zc(g,h,y),m=w?w.map(b=>vd(o,f,b)):hy(o,y)??[];if(!m.length)continue;const v=[...m].sort((b,E)=>Number(u(E))-Number(u(b)));for(const b of v){const E=xa(e,b,t);if(E<r){o=b,r=E,d=!0,a=!0;break}}if(d)break}}if(!d)break}return a&&r===0?o:null}function xd(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=kn(r),s=new Set,c=ut(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ct(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=r.edges.find(d=>d.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const d=i.get(u);if(!d)continue;const f=d.parent,g=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,h=Tt(p,a);if(!n&&h.length&&h.every(C=>C.type==="bpmn:TextAnnotation")){s.add(u);continue}let y=el(p,a,g,r.edges);const w=ly(r,p,a,y??p.waypoints);w&&(y=w);const m=py(r,p,a,y??p.waypoints,g);if(m&&Gn({...p,waypoints:m},r.edges.filter(C=>C.id!==u))===0&&(y=m),!y){h.some(C=>C.type==="bpmn:TextAnnotation")&&s.add(u);continue}const v=r.edges.filter(C=>C.id!==u),b=Jn(p,v);Jn({...p,waypoints:y},v)>b||o.updateWaypoints(d,y)}return s}function HM(e,t,n,i){var f,g;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=h=>{const y=Ve(r);return[...Ji(y),...wi(y)].filter(([w,m])=>w===h||m===h).length},c=(h,y)=>h.kind==="label-over-line"||h.kind==="label-over-shape"||h.kind==="label-on-shared-segment"?h.edge===y:h.kind==="annotation-over-label"||h.kind==="pool-name-over-label"?h.label===y:!1,l=h=>new Set(ut(Ve(r)).filter(y=>!c(y,h)).map(ct)),u=(h,y)=>Math.abs(h-y)<=1,p=(h,y,w,m,v)=>{const b=kn(Ve(r));for(let E=0;E+3<h.length;E++){const[C,I,k,P]=[h[E],h[E+1],h[E+2],h[E+3]],F=u(C.y,P.y)&&u(C.x,I.x)&&u(k.x,P.x)&&u(I.y,k.y)&&Math.abs(I.y-C.y)>=5,z=u(C.x,P.x)&&u(C.y,I.y)&&u(k.y,P.y)&&u(I.x,k.x)&&Math.abs(I.x-C.x)>=5;if(!F&&!z)continue;const G={waypoints:[C,P],endpoints:w};if(Tt(G,[y]).length&&!Tt(G,b).length)return E}return-1},d=(h,y)=>[...h.slice(0,y+1),...h.slice(y+3)].filter((w,m,v)=>m===0||m===v.length-1||!(u(v[m-1].x,w.x)&&u(v[m+1].x,w.x)||u(v[m-1].y,w.y)&&u(v[m+1].y,w.y)));for(const h of t){const y=r.get(h.id);if(!y)continue;const w=new Set([...y.incoming??[],...y.outgoing??[]].map(b=>b.id)),m={...h,type:y.type,container:!1,attached:!1},v=r.getAll().filter(b=>{var E;return(b.type==="bpmn:SequenceFlow"||b.type==="bpmn:MessageFlow")&&n.has(b.id)&&!i.has(b.id)&&!w.has(b.id)&&(((E=b.waypoints)==null?void 0:E.length)??0)>=4}).sort((b,E)=>b.id.localeCompare(E.id));for(const b of v){const E=[(f=b.source)==null?void 0:f.id,(g=b.target)==null?void 0:g.id].filter(C=>!!C);for(;;){const C=b.waypoints.map(K=>({x:K.x,y:K.y})),I=p(C,m,E,b.id,b.type);if(I<0)break;const k=b.label,P=k&&{x:k.x,y:k.y},F=l(b.id),z=s(b.id);if(a.updateWaypoints(b,d(C,I)),k&&P){const K={x:P.x+k.width/2,y:P.y+k.height/2},xe=(we,he)=>{const W=he.x-we.x,le=he.y-we.y,q=W*W+le*le,ee=q===0?0:Math.max(0,Math.min(1,((K.x-we.x)*W+(K.y-we.y)*le)/q));return Math.hypot(K.x-(we.x+ee*W),K.y-(we.y+ee*le))};let de=0;for(let we=1;we+1<C.length;we++)xe(C[we],C[we+1])<xe(C[de],C[de+1])&&(de=we);(de<I||de>I+2)&&(k.x!==P.x||k.y!==P.y)&&a.moveElements([k],{x:P.x-k.x,y:P.y-k.y})}const G=l(b.id),ne=[...G].filter(K=>!F.has(K)).length,re=[...F].filter(K=>!G.has(K)).length;if(ne<=re&&s(b.id)<=z){o.add(b.id);continue}a.updateWaypoints(b,C),k&&P&&(k.x!==P.x||k.y!==P.y)&&a.moveElements([k],{x:P.x-k.x,y:P.y-k.y});break}}}return o}const zM=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,o.x)-1,y:Math.min(i.y,o.y)-1,width:Math.max(2,Math.abs(o.x-i.x)+2),height:Math.max(2,Math.abs(o.y-i.y)+2),container:!1,attached:!1})}return t};function ys(e){const t=e.parent;return t&&typeof t.x=="number"&&typeof t.width=="number"?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0}const tl=(e,t)=>!t||e.every(n=>n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height),bd=(e,t)=>gs(e,[t])>0;function gy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=kn(r);let s=r;const c=new Set(ut(r).map(ct));for(const[l,u]of Ji(r))if(!t.has(`${l}|${u}`))for(const[p,d]of[[l,u],[u,l]]){if(n.has(p))continue;const f=s.edges.find(I=>I.id===p),g=s.edges.find(I=>I.id===d);if(!f||!g)continue;const h=i.get(p);if(!h)continue;const y=ys(h),w=zM(g),m=[...Jc(f,a)??[]],v=el(f,[...a,...w],y,r.edges);v&&m.push(v);for(let I=0;I+1<f.waypoints.length;I++)for(const k of w)for(const P of Zc(f.waypoints[I],f.waypoints[I+1],k)??[])m.push(vd(f.waypoints,I,P));const b=s.edges.filter(I=>I.id!==p),E=I=>({...s,edges:s.edges.map(k=>k.id===p?{...k,waypoints:I}:k)}),C=m.find(I=>{const k={...f,waypoints:I};return bd(k,g)||!tl(I,y)||b.some(P=>P.id!==d&&!bd(f,P)&&bd(k,P))?!1:ut(E(I)).every(P=>c.has(ct(P)))});if(C){o.updateWaypoints(h,C),s=E(C);break}}}const GM=["top","bottom","left","right"],my={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},vs=20,VM=20;function WM(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&We(e.y,t.y)&&o.push("top"),n&&We(e.y,t.y+t.height)&&o.push("bottom"),i&&We(e.x,t.x)&&o.push("left"),i&&We(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const UM=(e,t)=>t==="top"?{x:e.x+e.width/2,y:e.y}:t==="bottom"?{x:e.x+e.width/2,y:e.y+e.height}:t==="left"?{x:e.x,y:e.y+e.height/2}:{x:e.x+e.width,y:e.y+e.height/2};function yy(e,t,n,i){const o=my[t],r=my[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],g=r[p];if(We(e[d],n[d]))return f===-g&&f*(n[p]-e[p])>=vs?[e,n]:null;let h;if(f===-g){const w=e[p]+f*vs,m=n[p]-f*vs;if(f*(m-w)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=f>0?Math.max(e[p],n[p])+Qc:Math.min(e[p],n[p])-Qc;const y=(w,m)=>a?{x:m,y:w}:{x:w,y:m};return[e,y(h,e[d]),y(h,n[d]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=vs&&u>=vs?[e,c,n]:null}function qM(e,t,n){const i=e.waypoints;if(i.length<2||!e.source||!e.target||e.source===e.target)return[];const o=e.source===t.id,r=n.get(o?e.target:e.source),a=o?i[i.length-1]:i[0],s=r?WM(a,r):null;if(!s)return[];const c=[];for(const l of GM){const u=UM(t,l),p=o?yy(u,l,a,s):yy(a,s,u,l);p&&c.push(p)}return c}const vy=e=>e.slice(1).reduce((t,n,i)=>t+Math.abs(n.x-e[i].x)+Math.abs(n.y-e[i].y),0);function YM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ut(r).map(ct));let c=r;for(const[l,u]of wi(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(P=>P.id===l),d=c.edges.find(P=>P.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!wi({edges:[p,d]}).length)continue;const f=p.endpoints.find(P=>d.endpoints.includes(P)),g=f?a.get(f):void 0;if(!g||g.container)continue;const h=i.get(l),y=i.get(u);if(!h||!y)continue;const w=P=>n.has(P.id)?[P.waypoints]:[P.waypoints,...qM(P,g,a)],m=P=>P.length-2,v=w(p).flatMap(P=>w(d).map(F=>({pa:P,pb:F}))).filter(({pa:P,pb:F})=>P!==p.waypoints||F!==d.waypoints).map(P=>({...P,cost:vy(P.pa)+vy(P.pb)+VM*(m(P.pa)+m(P.pb))})).sort((P,F)=>P.cost-F.cost),b=ys(h),E=ys(y),C=wi(c).length,I=new Set(Ji(c).map(([P,F])=>`${P}|${F}`)),k=v.find(({pa:P,pb:F})=>{const z={...p,waypoints:P},G={...d,waypoints:F};if(wi({edges:[z,G]}).length||Ir(z,G)||!tl(P,b)||!tl(F,E))return!1;const ne={...c,edges:c.edges.map(re=>re.id===l?z:re.id===u?G:re)};return wi(ne).length>=C||Ji(ne).some(([re,K])=>!I.has(`${re}|${K}`))?!1:ut(ne).every(re=>s.has(ct(re)))});k&&(k.pa!==p.waypoints&&o.updateWaypoints(h,k.pa),k.pb!==d.waypoints&&o.updateWaypoints(y,k.pb),c={...c,edges:c.edges.map(P=>P.id===l?{...p,waypoints:k.pa}:P.id===u?{...d,waypoints:k.pb}:P)})}}const KM=40,XM=20;function ZM(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ve(i),p=wi(u);return{keys:new Set(ut(u).map(ct)),crossings:Ji(u).length,shared:p.length,mine:p.filter(([d,f])=>d===l||f===l).length}},a=(l,u)=>{const p=Ve(i),d=p.edges.find(f=>f.id===l);return d?new Set(Tt({...d,waypoints:u},kn(p)).map(f=>f.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,d=s(u)?u:s(p)?p:void 0;if(!d)continue;const f=d===u?p:u;if(!f||f.type==="bpmn:Participant")continue;const g=f.x+f.width/2;if(g>=d.x+10&&g<=d.x+d.width-10)continue;const h=g>d.x+d.width,y=d.y>f.y,w=y?f.y+f.height:f.y,m=y?d.y:d.y+d.height,v=Math.round((w+m)/2),b=F=>d===u?[...F].reverse():F,E=(l.waypoints??[]).map(F=>({x:F.x,y:F.y})),C=r(l.id),I=a(l.id,E)??new Set,k=h?d.x+d.width:d.x,P=d.x+d.width/2;for(let F=Math.min(KM,d.width/4);h?k-F>P:k+F<P;F+=XM){const z=Math.round(h?k-F:k+F),G=b([{x:g,y:w},{x:g,y:v},{x:z,y:v},{x:z,y:m}]),ne=a(l.id,G);if(!ne||[...ne].some(K=>!I.has(K)))continue;o.updateWaypoints(l,G);const re=r(l.id);if(re.crossings<=C.crossings&&re.shared<=C.shared&&re.mine<=C.mine&&[...re.keys].every(K=>C.keys.has(K)))break;o.updateWaypoints(l,E)}}}const JM=10;function xy(e,t){if(e.parent){const o=t.find(r=>r.id===e.parent);if(o)return o}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(o=>n>=o.x&&n<=o.x+o.width&&i>=o.y&&i<=o.y+o.height)}function by(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(re=>re.type==="bpmn:Participant"&&re.container),i=t.shapes.find(re=>re.id===e.endpoints[0]),o=t.shapes.find(re=>re.id===e.endpoints[1]);if(!i||!o)return null;const r=xy(i,n),a=xy(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(re=>re.id!==r.id&&re.id!==a.id&&re.y>=c.y+c.height&&re.y+re.height<=l.y).sort((re,K)=>re.y-K.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,g=(d.y+d.height+l.y)/2,h=s?f:g,y=s?g:f,w=e.waypoints[0],m=e.waypoints[e.waypoints.length-1],v=kn(t),b=t.edges.filter(re=>re.id!==e.id),E=Gn(e,b),C=Tt(e,v).length;if(E===0&&C===0||C===0&&e.waypoints.length===2)return null;const I=Math.min(...u.map(re=>re.x)),k=Math.max(...u.map(re=>re.x+re.width)),P=(w.x+m.x)/2,F=re=>re.filter((K,xe)=>xe===0||!(We(K.x,re[xe-1].x)&&We(K.y,re[xe-1].y)));let z,G;for(let re=I;re<=k;re+=JM){const K=F([w,{x:w.x,y:h},{x:re,y:h},{x:re,y},{x:m.x,y},m]),xe={...e,waypoints:K};if(Tt(xe,v).length>0)continue;const de=Gn(xe,b),we=Math.abs(re-P);(!z||de<z.cross||de===z.cross&&we<z.detour)&&(z={pts:K,cross:de,detour:we}),md(K,v,e.endpoints)>=Br&&(!G||de<G.cross||de===G.cross&&we<G.detour)&&(G={pts:K,cross:de,detour:we})}G&&z&&G!==z&&yd(t,e,G.pts,z.pts)&&(z=G);const ne=z&&(C>0?z.cross<=E:z.cross<E)?z.pts:null;if(C>0){const re=ly(t,e,v,ne??e.waypoints);if(re)return re}return ne}const QM=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function eA(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ve(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=kn(a);for(const p of t.edges){if(!QM.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const d=i.get(p.id);if(!(d!=null&&d.waypoints)||((l=d.source)==null?void 0:l.id)!==p.source||((u=d.target)==null?void 0:u.id)!==p.target)continue;const f=r.get(p.source),g=r.get(p.target),h=s.get(p.source),y=s.get(p.target);if(!f||!g||!h||!y||!We(f.width,h.width)||!We(f.height,h.height)||!We(g.width,y.width)||!We(g.height,y.height))continue;const w=h.x-f.x,m=h.y-f.y;if(We(w,0)&&We(m,0)||!We(y.x-g.x,w)||!We(y.y-g.y,m))continue;const v=p.waypoints.map(C=>({x:C.x+w,y:C.y+m})),b=d.waypoints.map(C=>({x:C.x,y:C.y}));b.length===v.length&&b.every((C,I)=>We(C.x,v[I].x)&&We(C.y,v[I].y))||b.length===2&&(We(b[0].x,b[1].x)||We(b[0].y,b[1].y))&&Tt({...p,waypoints:b},c).length===0||Tt({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function wy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ve(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=by(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const wd=20,_y=10,ji=10,_d=40,tA=6,nA=40,Ey=50;function iA(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=tA})}function Ed(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(We(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function oA(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function Sd(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=_y;o<=n-t;o+=_y)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function rA(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,d=t.x+t.width/2,f=(K,xe)=>xe>K.x+ji&&xe<K.x+K.width-ji,g=(K,xe)=>K.width<=2*_d?K.x+K.width/2:Math.min(Math.max(xe,K.x+_d),K.x+K.width-_d),h=Math.max(e.x,t.x)+ji,y=Math.min(e.x+e.width,t.x+t.width)-ji;if(h<=y){const K=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((h+y)/2);r.push([{x:K,y:l},{x:K,y:u}])}const w=s?g(t,p):d,m=a?g(e,d):p;if(!a&&!f(e,w)){const K=w<e.x?e.x:e.x+e.width;for(const xe of Sd(e.y+e.height/2,e.y+ji,e.y+e.height-ji))r.push([{x:K,y:xe},{x:w,y:xe},{x:w,y:u}])}if(!s&&!f(t,m)){const K=m<t.x?t.x:t.x+t.width;for(const xe of Sd(t.y+t.height/2,t.y+ji,t.y+t.height-ji))r.push([{x:m,y:l},{x:m,y:xe},{x:K,y:xe}])}const v=(K,xe)=>{if(Math.abs(xe-K)<2*ji)return[];const de=Math.min(K,xe)+ji,we=Math.max(K,xe)-ji;return Sd(Math.round((K+xe)/2),de,we)};if(!a&&n)for(const K of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:K},{x:w,y:K},{x:w,y:u}]);if(!s&&i)for(const K of v(u,c?i.y:i.y+i.height))r.push([{x:m,y:l},{x:m,y:K},{x:d,y:K},{x:d,y:u}]);const b=Math.min(m,w),E=Math.max(m,w),C=[];for(const[K,xe]of o.filter(de=>de.x<E&&de.x+de.width>b).map(de=>[de.y,de.y+de.height]).sort((de,we)=>de[0]-we[0])){const de=C[C.length-1];de&&K<=de[1]?de[1]=Math.max(de[1],xe):C.push([K,xe])}const I=[];for(let K=1;K<C.length;K++)C[K][0]-C[K-1][1]>=nA&&I.push(Math.round((C[K-1][1]+C[K][0])/2));C.length&&I.push(C[0][0]-Ey,C[C.length-1][1]+Ey);const k=(K,xe)=>xe<K.y?K.y:xe>K.y+K.height?K.y+K.height:void 0,P=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(K=>!!K)),F=e.y+e.height/2,z=t.y+t.height/2,G=z>F?1:-1,ne=(K,xe,de)=>o.some(we=>!P.has(we.id)&&we.x<K&&K<we.x+we.width&&we.y<Math.max(xe,de)-1&&we.y+we.height>Math.min(xe,de)+1),re=[];for(const K of I){const xe=k(e,K),de=k(t,K);xe===void 0||de===void 0||(K-F)*G<0&&ne(m,xe,K)||(K-z)*G>0&&ne(w,de,K)||re.push({pts:[{x:m,y:xe},{x:m,y:K},{x:w,y:K},{x:w,y:de}],len:Math.abs(K-xe)+(E-b)+Math.abs(de-K)})}return{inPools:r,outside:re.sort((K,xe)=>K.len-xe.len).map(K=>K.pts)}}function aA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(f=>[f.id,f.waypoints])),a=n.shapes.filter(f=>f.type==="bpmn:Participant"),s=f=>{let g=f;for(;g&&g.type!=="bpmn:Participant";)g=g.parent;return g==null?void 0:g.id},c=()=>{const f=Ve(i);return{keys:new Set(ut(f).map(ct)),crossings:Ji(f).length,shared:wi(f).length}},l=(f,g)=>f.length===g.length&&f.every((h,y)=>We(h.x,g[y].x)&&We(h.y,g[y].y)),u=f=>{const g=f.source,h=f.target;if(!g||!h)return"skip";const y=Ve(i),w=new Map(y.shapes.map(W=>[W.id,W])),m=s(g),v=s(h),b=new Set([m,v].filter(W=>!!W)),E=y.shapes.filter(W=>W.type==="bpmn:Participant"),C=(f.waypoints??[]).map(W=>({x:W.x,y:W.y})),I=Ed(C,b,E);if(I<wd)return"skip";if(t.has(f.id)){const W=r.get(f.id);if(W&&l(W,C)||I-(W?Ed(W,b,a):0)<wd)return"skip"}const k=w.get(g.id),P=w.get(h.id),F=y.edges.find(W=>W.id===f.id);if(!k||!P||!F)return"skip";const z=kn(y),G=new Set(Tt(F,z).map(W=>W.id)),ne=Vo(y).filter(W=>W.owner!==f.id&&W.owner!==k.id&&W.owner!==P.id),re=[...y.shapes.filter(W=>!W.container&&W.id!==k.id&&W.id!==P.id),...ne.map(W=>W.rect)],K=W=>sn({...F,waypoints:W}).some(le=>iA(le,re)),xe=rA(k,P,m?w.get(m):void 0,v?w.get(v):void 0,E),de=W=>W.map((le,q)=>({pts:le,i:q,key:le.length*2+(K(le)?1:0)})).sort((le,q)=>le.key-q.key||le.i-q.i).map(le=>le.pts),we=[...de(xe.inPools),...de(xe.outside)],he=c();for(const W of we){if(Ed(W,b,E)>=wd)continue;const le={...F,waypoints:W};if(Tt(le,z).some(me=>!G.has(me.id))||sn(le).some(me=>oA(me,y.shapes)||ne.some(Re=>Fi(Re.rect,me))))continue;o.updateWaypoints(f,W);const ee=c();if(ee.crossings<=he.crossings&&ee.shared<=he.shared&&[...ee.keys].every(me=>he.keys.has(me)))return"fixed";o.updateWaypoints(f,C)}return"stuck"},p=i.getAll().filter(f=>f.type==="bpmn:MessageFlow"),d=[];for(const f of p)u(f)==="stuck"&&d.push(f);for(const f of d)u(f)}const Hi=[25,-25,40,-40],ba=35;function sA(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-ba:Math.max(e.y+e.height,t.y+t.height)+ba,p=lA(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,cA]];for(const[f,g]of d)for(const h of[0,...Hi])if(!(Math.abs(h)>=e.width/2-5))for(const y of[0,...Hi]){if(Math.abs(y)>=t.width/2-5)continue;const w=i+h,m=o+y,v=[{x:w,y:c},{x:w,y:f},{x:m,y:f},{x:m,y:l}];g&&Tt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:g+Math.abs(y)+Math.abs(h)})}}return r}const cA=45,nl=20;function lA(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(y=>y.container&&(y.type==="bpmn:Lane"||y.type==="bpmn:Participant")&&r>=y.x&&r<=y.x+y.width&&e.y>=y.y&&e.y+e.height<=y.y+y.height).sort((y,w)=>y.width*y.height-w.width*w.height)[0];if(!u)return null;const p=o.filter(y=>!y.container&&y.id!==e.id&&y.id!==t.id),d=p.filter(y=>y.x<c&&y.x+y.width>s&&(n?y.y<l&&y.y+y.height>i:y.y+y.height>l&&y.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(y=>y.label?[y.label]:[])].filter(y=>y.x<c&&y.x+y.width>s);if(n){let y=Math.min(...d.map(m=>m.y));for(let m=!0;m;){m=!1;for(const v of f)v.y<y&&v.y<l&&v.y+v.height>y-nl&&(y=v.y,m=!0)}const w=Math.max(u.y,...f.filter(m=>m.y+m.height<=y).map(m=>m.y+m.height));return y-w>=nl?Math.round((y+w)/2):null}let g=Math.max(...d.map(y=>y.y+y.height));for(let y=!0;y;){y=!1;for(const w of f)w.y+w.height>g&&w.y+w.height>l&&w.y<g+nl&&(g=w.y+w.height,y=!0)}const h=Math.min(u.y+u.height,...f.filter(y=>y.y>=g).map(y=>y.y));return h-g>=nl?Math.round((g+h)/2):null}function il(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return sA(n,i,[...t.values()]);const r=i.x+i.width/2,a=n.x+n.width/2,s=o<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-ba:n.y+n.height+ba,p=[];for(const m of[0,...Hi]){if(Math.abs(m)>=i.width/2-5)continue;const v=r+m;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(m)});for(const b of[0,...Hi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(m)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const m of[0,...Hi]){if(Math.abs(m)>=n.width/2-5)continue;const v=a+m;p.push({pts:[{x:v,y:g},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(m)})}const h=60,y=s?i.y+i.height:i.y,w=s?i.y+i.height+ba:i.y-ba;for(const m of[0,...Hi]){if(Math.abs(m)>=i.width/2-5)continue;const v=r+m;for(const b of[0,...Hi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:g},{x:E,y:w},{x:v,y:w},{x:v,y}],cost:h+Math.abs(m)+Math.abs(b)})}}return p}const Rd=30;function Sy(e,t){return Cd(e,t)<Rd}function Cd(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=We(o.y,r.y)&&!We(o.x,r.x),s=We(o.x,r.x)&&!We(o.y,r.y);if(!(!a&&!s))for(const c of t)if(a){const l=Math.min(o.x,r.x);if(Math.max(o.x,r.x)<=c.x||l>=c.x+c.width)continue;n=Math.min(n,Math.abs(o.y-c.y),Math.abs(o.y-(c.y+c.height)))}else{const l=Math.min(o.y,r.y);if(Math.max(o.y,r.y)<=c.y||l>=c.y+c.height)continue;n=Math.min(n,Math.abs(o.x-c.x),Math.abs(o.x-(c.x+c.width)))}}return n}const ol=40;function uA(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-ol,a=o.x+o.width+ol,s=o.y-ol,c=o.y+o.height+ol;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],d={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},f={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(d.x<a&&f.x>r&&d.y<c&&f.y>s){i++;break}}}return i}function Ry(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),o=kn(t),r=t.edges.filter(C=>C.id!==e.id),a=Jn(e,r),s=Gn(e,r),c=C=>uA(C,t.shapes,e.endpoints)+(Sy(C,n)?1:0),l=c(e.waypoints),u=C=>{if(!C)return;const I=C.x+C.width/2,k=C.y+C.height/2;return n.find(P=>P.type==="bpmn:Lane"&&I>=P.x&&I<=P.x+P.width&&k>=P.y&&k<=P.y+P.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,g=C=>{if(!f||!d)return!1;for(let I=1;I<C.length-2;I++){const k=C[I],P=C[I+1];if(We(k.y,P.y)&&!We(k.x,P.x)&&k.y>d.y&&k.y<d.y+d.height)return!0}return!1},h=g(e.waypoints),w=(C=>{if(!C)return;const I=C.x+C.width/2,k=C.y+C.height/2;return n.filter(P=>P.type==="bpmn:Participant"&&I>=P.x&&I<=P.x+P.width&&k>=P.y&&k<=P.y+P.height).sort((P,F)=>P.width*P.height-F.width*F.height)[0]})(i.get(e.endpoints[0]??"")),m=C=>{if(!w)return 0;let I=0;for(let k=1;k<C.length-1;k++){const P=C[k];(P.x<w.x||P.x>w.x+w.width||P.y<w.y||P.y>w.y+w.height)&&I++}return I},v=m(e.waypoints);if(!Sy(e.waypoints,n)&&!(f&&!h)&&v===0)return null;const b=C=>C.reduce((I,k,P)=>P?I+Math.abs(k.x-C[P-1].x)+Math.abs(k.y-C[P-1].y):0,0);let E;for(const{pts:C,cost:I}of il(e,i)){const k={...e,waypoints:C};if(Tt(k,o).length>0)continue;const P=Jn(k,r);if(P>a)continue;const F=m(C);if(F>v)continue;const z=F<v&&P===0;if(!z&&Gn(k,r)>s)continue;const G=c(C),ne=g(C);if(!z&&!(ne&&!h)&&G>=l)continue;const K=ne?0:1,xe=b(C);(!E||F<E.out||F===E.out&&(K<E.lane||K===E.lane&&(P<E.opp||P===E.opp&&(G<E.sc||G===E.sc&&(I<E.cost||I===E.cost&&xe<E.len)))))&&(E={pts:C,out:F,sc:G,lane:K,opp:P,cost:I,len:xe})}return(E==null?void 0:E.pts)??null}function pA(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,o=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),r=o.filter(p=>p.endpoints[1]===i),a=o.filter(p=>p.endpoints[0]===i);if(r.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 dA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(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 r){const s=Ve(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=kn(s),u=s.edges.filter(y=>y.id!==a),p=Tt(c,l).length,d=Jn(c,u),f=Gn(c,u),g=n.has(a)?new Set(ut(s).map(ct)):null;if(c.waypoints.length>4){const y=i.get(a),w=y?py(s,c,l,c.waypoints,ys(y)):null;if(y&&w&&w.length<c.waypoints.length){o.updateWaypoints(y,w);continue}}const h=Jc(c,s.shapes);h.length===2&&pA(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const w={...c,waypoints:y};if(Tt(w,l).length>p||Jn(w,u)>d||Gn(w,u)>f)continue;if(g){const v=new Set(ut({...s,edges:s.edges.map(C=>C.id===a?w:C)}).map(ct)),b=[...v].filter(C=>!g.has(C)).length,E=[...g].filter(C=>!v.has(C)).length;if(b>E)continue}const m=i.get(a);m&&o.updateWaypoints(m,y);break}}}function Cy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ve(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Ry(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Md(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=We(n[0].x,n[1].x)&&!We(n[0].y,n[1].y),s=We(n[n.length-1].x,n[n.length-2].x)&&!We(n[n.length-1].y,n[n.length-2].y);for(const c of Hi){if(a&&o&&Math.abs(c)<o.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&&r&&Math.abs(c)<r.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}const My=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function fA(e,t,n){const i=e.waypoints;if(i.length<2||!My(e.type))return[];const o=i[0],r=i[1],a=We(o.y,r.y)&&!We(o.x,r.x),s=We(o.x,r.x)&&!We(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(g=>{if(!My(g.type)||g.type===e.type||g.waypoints.length<2)return!1;const h=g.waypoints[0],y=g.waypoints[1];return!We(h.x,o.x)||!We(h.y,o.y)?!1:a?We(h.y,y.y)&&Math.sign(y.x-h.x)===c:We(h.x,y.x)&&Math.sign(y.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(g,h)=>a?h>g.y+5&&h<g.y+g.height-5:h>g.x+5&&h<g.x+g.width-5,f=[];for(const g of Hi){const h=(a?o.y:o.x)+g;if(!d(u,h)||i.length===2&&(!p||!d(p,h)))continue;const y=i.map(w=>({...w}));for(const w of[y[0],y[1]])a?w.y=h:w.x=h;f.push({pts:y,cost:Math.abs(g)})}return f}function hA(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 o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)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,d=a?n.x+n.width:n.x,f=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,y=[];for(const w of[0,...Hi])Math.abs(w)<i.width/2-5&&y.push({pts:[{x:d,y:l},{x:u+w,y:l},{x:u+w,y:h}],cost:Math.abs(w)}),Math.abs(w)<i.height/2-5&&y.push({pts:[{x:c,y:f},{x:c,y:p+w},{x:g,y:p+w}],cost:Math.abs(w)});return y}const gA=[[1/2,0],[1/3,25],[2/3,25]],Ay=20;function mA(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 o=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of gA){const d=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:d,y:o},{x:d,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+Ay<=i.x&&s(n.x+n.width,i.x),i.x+i.width+Ay<=n.x&&s(n.x,i.x+i.width),a}function Ad(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 o=Math.max(n.x,i.x),r=Math.min(n.x+n.width,i.x+i.width);if(r-o<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=(o+r)/2,p=[];for(const d of[0,...Hi]){const f=u+d;f<=o||f>=r||p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:Math.abs(d)})}return p}function Py(e,t,n={}){const i=new Map(t.shapes.map(g=>[g.id,g])),o=kn(t),r=t.edges.filter(g=>g.id!==e.id),a=Jn(e,r);if(a===0)return null;const s=Gn(e,r);let c;const l=g=>g.reduce((h,y,w)=>w?h+Math.abs(y.x-g[w-1].x)+Math.abs(y.y-g[w-1].y):0,0),u=3,p=g=>{const h=g[0],y=g[g.length-1],w=Math.hypot(y.x-h.x,y.y-h.y);return w>=1&&l(g)/w>=u?1:0},d=p(e.waypoints),f=[...il(e,i),...Ad(e,i),...Md(e,i),...fA(e,r,i),...n.sideEntry?mA(e,i):[]];for(const{pts:g,cost:h}of f){const y={...e,waypoints:g};if(Tt(y,o).length>0)continue;const w=Jn(y,r),m=Gn(y,r),v=a-w+(d-p(g));if(w>=a||m-s>v)continue;const b=l(g);(!c||w<c.opposite||w===c.opposite&&(m<c.cross||m===c.cross&&(h<c.cost||h===c.cost&&b<c.len)))&&(c={pts:g,opposite:w,cross:m,cost:h,len:b})}return(c==null?void 0:c.pts)??null}function Ty(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Ir(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function yA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=kn(t),o=t.edges.filter(d=>d.id!==e.id),r=Ty(e,o);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,g,h)=>h?f+Math.abs(g.x-d[h-1].x)+Math.abs(g.y-d[h-1].y):0,0),l=2;let u;const p=[...il(e,n),...Ad(e,n),...hA(e,n),...Md(e,n)];for(const{pts:d,cost:f}of p){const g={...e,waypoints:d};if(Tt(g,i).length>0)continue;const h=Ty(g,o);if(h>=r)continue;const y=Jn(g,o);if(y-h>a-r)continue;const w=Gn(g,o);if(w-s>(r-h)*l)continue;const m=c(d);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&m<u.length))))&&(u={pts:d,fake:h,unreadable:y,cross:w,cost:f,length:m})}return(u==null?void 0:u.pts)??null}function ky(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ut(Ve(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)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=Ve(i),l=c.edges.find(d=>d.id===s);if(!l)continue;const u=yA(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Oy(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 Dy(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Ir(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:Oy(e,n)&&Oy(t,n)}function Ly(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Dy(e,o,n)&&i++;return i}function vA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=kn(t),o=t.edges.filter(d=>d.id!==e.id),r=Ly(e,o,n);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,g,h)=>h?f+Math.abs(g.x-d[h-1].x)+Math.abs(g.y-d[h-1].y):0,0),l=2;let u;const p=[...il(e,n),...Ad(e,n),...Md(e,n)];for(const{pts:d,cost:f}of p){const g={...e,waypoints:d};if(Tt(g,i).length>0)continue;const h=Ly(g,o,n);if(h>=r)continue;const y=Jn(g,o);if(y-h>a-r)continue;const w=Gn(g,o);if(w-s>(r-h)*l)continue;const m=c(d);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(w<u.cross||w===u.cross&&(f<u.cost||f===u.cost&&m<u.length))))&&(u={pts:d,chain:h,unreadable:y,cross:w,cost:f,length:m})}return(u==null?void 0:u.pts)??null}function xA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ut(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(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(d=>r.edges.find(f=>f.id===d));if(!(!u||!p||!Dy(u,p,a)))for(const d of l.edges)n.has(d)||c.add(d)}for(const l of[...c].sort()){const u=Ve(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const d=vA(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function Iy(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=Ve(o),c=ut(s).filter(d=>pd(d)&&!t.has(ct(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(pd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(g=>g.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const g=u(d)==="bpmn:SequenceFlow"?0:1,h=u(f)==="bpmn:SequenceFlow"?0:1;return g!==h?g-h:d.localeCompare(f)});for(const d of p){const f=Ve(o),g=f.edges.find(w=>w.id===d);if(!g)continue;const h=Py(g,f,{sideEntry:i.has(d)});if(!h)continue;const y=o.get(d);y&&(r.updateWaypoints(y,h),a.add(d))}return a}const bA=10,wA=(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 By(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Xc(e,i))return null;const o=kn(t),r=i.flatMap(sn);for(const a of sn(e)){let s=[[a.lo,a.hi]];for(const[f,g]of Kc(a,r))s=s.flatMap(([h,y])=>{const w=[];return f>h&&w.push([h,Math.min(y,f)]),g<y&&w.push([Math.max(h,g),y]),w.filter(([m,v])=>v>m)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,g])=>g-f>=c+bA*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Wm}:{x:a.at+On+n.width/2,y:u},d={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Xc({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&wA(d,f)))return d}return null}const On=8;function Pd(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=d=>{const f=d.axis==="h"?o:r,g=d.axis==="h"?r-d.at:o-d.at,h=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(g,h)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(sn),...t.shapes.filter(d=>d.container).flatMap(va)],l=d=>!c.some(f=>Fi(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+On,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+On,s.at-On-n.width])for(const f of p){const g=n.y+f;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:d,y:g};if(l(h))return h}else for(const d of[s.at-On-n.height,s.at+On])for(const f of p){const g=n.x+f;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:d};if(l(h))return h}return null}const Ny=30,_A=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const o=t[i],r=t[i+1],a=r.x-o.x,s=r.y-o.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-o.x)*a+(e.y-o.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(o.x+l*a),e.y-(o.y+l*s)))}return n},$y=(e,t)=>_A({x:e.x+e.width/2,y:e.y+e.height/2},t);function EA(e,t){const n=e.label;if(!n)return null;const i=sn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(sn),...t.shapes.filter(c=>c.container).flatMap(va)],r=Vo(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=>!o.some(l=>Fi(c,l))&&!ms(c,t).length&&!r.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+On,c.at-On-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+On,c.at-On-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 Fy(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=Ve(i),a=new Set(ut(r).map(ct));for(const[l,u]of t){const p=u.wps,d=i.get(l),f=d==null?void 0:d.label;if(!f||!(d!=null&&d.waypoints))continue;const g=d.waypoints[0].x-p[0].x,h=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((I,k)=>I.x-p[k].x===g&&I.y-p[k].y===h))){if(((s=d.source)==null?void 0:s.id)===u.source&&((c=d.target)==null?void 0:c.id)===u.target)continue;const I=r.edges.find(G=>G.id===l);if(!(I!=null&&I.label)||!ms(I.label,r).length&&!n.has(l))continue;let k={...I.label,x:u.label.x,y:u.label.y};if((ms(k,r).length||$y(k,I.waypoints)>Ny)&&(k=null),!k&&$y(I.label,I.waypoints)>Ny&&(k=EA(I,r)),!k)continue;const P=k;if(P.x===f.x&&P.y===f.y)continue;const F={...r,edges:r.edges.map(G=>G.id===l?{...G,label:P}:G)},z=ut(F);if(z.some(G=>!a.has(ct(G))))continue;o.moveElements([f],{x:P.x-f.x,y:P.y-f.y}),r=F,a=new Set(z.map(ct));continue}const w=u.label.x+g-f.x,m=u.label.y+h-f.y;if(w===0&&m===0)continue;const v=r.edges.find(I=>I.id===l);if(!(v!=null&&v.label))continue;const b={...v.label,x:v.label.x+w,y:v.label.y+m},E={...r,edges:r.edges.map(I=>I.id===l?{...I,label:b}:I)},C=ut(E);C.some(I=>!a.has(ct(I)))||(o.moveElements([f],{x:w,y:m}),r=E,a=new Set(C.map(ct)))}}function jy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Pd(a,r);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&o.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function Hy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=ut(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(d=>d.id===s.edge);if(!c)continue;const l=By(c,r);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&o.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function zy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(sn),...t.shapes.filter(d=>d.container).flatMap(va)],o=i.filter(d=>Fi(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=Vo(t).filter(d=>d.owner!==e.id).map(d=>d.rect),s=(d,f)=>d.x<f.x+f.width&&f.x<d.x+d.width&&d.y<f.y+f.height&&f.y<d.y+d.height,c=d=>!i.some(f=>Fi(d,f))&&!r.some(f=>s(d,f))&&!a.some(f=>s(d,f)),l=[];for(const d of o)d.axis==="h"?l.push({...n,y:d.at-On-n.height},{...n,y:d.at+On}):l.push({...n,x:d.at-On-n.width},{...n,x:d.at+On});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+On},{...n,x:u-n.width/2,y:e.y-On-n.height},{...n,x:e.x+e.width+On,y:p-n.height/2},{...n,x:e.x-On-n.width,y:p-n.height/2}),l.find(c)??null}function Gy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=zy(r,Ve(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function SA(e,t){const n=e.x,i=e.x+e.width,o=e.y,r=e.y+e.height;if(t.x<n||t.x>i||t.y<o||t.y>r)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,o),r))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-o,{x:t.x,y:o}],[r-t.y,{x:t.x,y:r}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function Vy(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(ut(o).map(ct));const a=[...new Set(ut(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.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 w=h?o.shapes.find(v=>v.id===h):void 0;if(!w)continue;const m=SA(w,l[y]);m.x===l[y].x&&m.y===l[y].y||(l[y]=m,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},f=ut(d);if(f.some(h=>!r.has(ct(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=d,r=new Set(f.map(ct)))}}const Td=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Wy(e,t){const n=(o,r,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>r?`${r}.${u}`:u;return{id:o,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((o,r)=>n(o.id,`participant.lanes[${r}]`,o))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((o,r)=>({...n(o.id,`lanes[${r}]`,o),omittedMeansRemove:(t==null?void 0:t.categoryOf(o.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 RA(e,t,n){const i=[],o=n?ls(n):[];return e.forEach((r,a)=>{if(r.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:r.id,field:"locale"});return}if(!o.includes(r.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:r.id,field:"locale",locale:r.locale,locales:o});return}t.categoryOf(r.id)!==void 0&&!t.reviewRequestLocalesOf(r.id).includes(r.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:r.id,locale:r.locale});return}for(const s of Wy(r,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:o});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:o});continue}if(!l)continue;if(!Td(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${f}`}),p=!1):o.includes(f)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:f,locales:o}),p=!1);if(!p)continue;const d=o.filter(f=>!(f in u));d.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:d})}}),i}function _i(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function CA(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:o}=n,r=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Td(c.map)){const l=c.map;return r(c.id).texts={...l},l[o]}if(c.plain===null||c.condition===null&&c.plain===void 0){r(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(r(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=r(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=Wy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=_i(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,g)=>_i(f,"name",a(p[g])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=_i(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,g)=>_i(f,"name",a(p[g])))),s.push(d);break}case"node.add":s.push({...c,node:_i(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:_i(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:_i(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:_i(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:_i(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:_i(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(_i(c,"text",a(l[0])));break;default:s.push(Td(l[0].map)?_i(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const MA=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Uy=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),qy={"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}]},xs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),rl=e=>typeof e=="string"&&e!=="";function AA(e){const t=[];function n(i,o,r,a){if(a===null){rl(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!xs(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)rl(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!xs(i)||!rl(i.kind)||!(i.kind in qy)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of qy[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const g of p.slice(0,-1)){if(!xs(d))break;d=d[g]}if(!xs(d))continue;const f=d[p[p.length-1]];if(!(f===void 0&&c.optional)&&!(f===null&&c.optional)){if(!l){n(o,c.path,f,c.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}f.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;xs(c)&&!rl(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,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:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!am(l)){t.push({kind:"node-type-unsupported",opIndex:o,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&&!sm(p)){t.push({kind:"payload-invalid",opIndex:o,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:o,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function Yy(e,t,n={}){const i=AA(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,y,w){if(!MA.test(y)){o.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:h,id:y});return}r.set(y,{...w,opIndex:h})}e.forEach((h,y)=>{var w;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(m=>m.id)});for(const m of h.participant.lanes??[])s(y,m.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 m of h.associations??[])m.id&&s(y,m.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"}),(w=h.association)!=null&&w.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(m=>m.id));for(const m of h.lanes)t.categoryOf(m.id)===void 0&&s(y,m.id,{category:"lane"})}break}});const c=h=>{var y;return((y=r.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=r.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,w,m){const v=c(y);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:w});return}if(m&&!m.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:y,role:w,expected:m.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),d=new Map;for(const h of e)h.kind==="node.add"?d.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&d.set(h.id,h.eventDefinition);const f=h=>d.has(h)?d.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var w,m;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=h.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,v,"participant",["participant"])===void 0)break;b!==void 0&&((((w=r.get(v))==null?void 0:w.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:y,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:C,condition:I}=h.flow,k=u(y,b,"source",["flowNode"]),P=u(y,E,"target",["flowNode"]);k&&P&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:y,id:v}),C!==void 0&&I!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=h.flow,C=u(y,b,"source",["flowNode","participant"]),I=u(y,E,"target",["flowNode","participant"]);if(C&&I){const k=l(b),P=l(E);k!==void 0&&k===P&&o.push({kind:"message-flow-same-pool",opIndex:y,id:v})}for(const k of[b,E])f(k)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:v,ref:k});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(C=>C===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(y,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=h.association,E=u(y,v,"source"),C=u(y,b,"target");if(E&&C){const I=new Set([E,C]);I.has("dataStore")&&I.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=h.association,C=u(y,b,"source"),I=u(y,E,"target");C&&I&&C!=="annotation"&&I!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:b}=h.association;if(v!==h.annotation.id&&b!==h.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const E=v===h.annotation.id?b:v;u(y,E,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const b=u(y,v,"member");b&&Uy.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),b=h.lanes.map(k=>k.id);for(const k of v)b.includes(k)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:k});for(const k of b)t.categoryOf(k)!==void 0&&!v.includes(k)&&o.push({kind:"id-duplicate",opIndex:y,id:k});const E=b.filter(k=>v.includes(k)),C=k=>E.every((P,F)=>P===k[F]),I=(((m=t.laneDeclarationOrderOf)==null?void 0:m.call(t,h.id))??v).filter(k=>v.includes(k));E.length===v.length&&!C(v)&&!C(I)&&o.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 v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,b=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),C=h.source??(E==null?void 0:E.source),I=h.target??(E==null?void 0:E.target);v&&b&&C!==void 0&&I!==void 0&&new Set([l(C),l(I),l(h.id)]).size>1&&o.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 v of h.members??[]){const b=u(y,v,"member");b&&Uy.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...RA(e,t,n.i18n)),o;function g(h,y,w){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const m=t.categoryOf(y);if(m===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(w&&m!==w){o.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:w,actual:m});return}return m}}function Ky(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 al(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const sl={"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]},Dn=10,PA=300,TA=160,Xy=20,kd=100,Zy=40,kA=10,OA=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function Jy(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;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&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const cl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function ll(e,t,n,i,o){const r=n,a=Jy(e,t,i),s=a??i,c=(ne,re,K=s)=>{const[xe,de]=sl[ne];let we={x:t.x+t.width/2+xe*(t.width/2+r.width/2+re),y:t.y+t.height/2+de*(t.height/2+r.height/2+re)};const he=K.x+Dn+r.width/2,W=K.x+K.width-Dn-r.width/2,le=K.y+Dn+r.height/2,q=K.y+K.height-Dn-r.height/2,ee={x:Math.min(W,Math.max(he,we.x)),y:Math.min(q,Math.max(le,we.y))};return(ee.x!==we.x||ee.y!==we.y)&&(we=Math.abs(ee.x-(t.x+t.width/2))<(t.width+r.width)/2+Dn&&Math.abs(ee.y-(t.y+t.height/2))<(t.height+r.height)/2+Dn?{x:t.x+t.width+Dn+r.width/2,y:ee.y}:ee),we},l=(i.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"&&ne.id!==o.selfId),u=Ve(e),p=ne=>{var K,xe;if(!o.selfId)return!1;const re=e.get(ne);return!!re&&(((K=re.source)==null?void 0:K.id)===o.selfId||((xe=re.target)==null?void 0:xe.id)===o.selfId)},d=u.edges.filter(ne=>!p(ne.id)).flatMap(sn),f=Vo(u).filter(ne=>ne.owner!==o.selfId).map(ne=>ne.rect),g=ne=>({x0:ne.x-r.width/2-Dn,x1:ne.x+r.width/2+Dn,y0:ne.y-r.height/2-Dn,y1:ne.y+r.height/2+Dn}),h=ne=>{const re=g(ne);return l.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},y=ne=>{const re=g(ne);return d.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},w=ne=>{const re=g(ne);return f.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},m=u.shapes.filter(ne=>ne.type==="bpmn:Group").flatMap(ne=>[{axis:"h",at:ne.y,lo:ne.x,hi:ne.x+ne.width},{axis:"h",at:ne.y+ne.height,lo:ne.x,hi:ne.x+ne.width},{axis:"v",at:ne.x,lo:ne.y,hi:ne.y+ne.height},{axis:"v",at:ne.x+ne.width,lo:ne.y,hi:ne.y+ne.height}]),v=ne=>{const re=g(ne);return m.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},b=ne=>h(ne)||y(ne)||w(ne)||v(ne),E=ne=>ne.x-r.width/2>=i.x&&ne.x+r.width/2<=i.x+i.width&&ne.y-r.height/2>=i.y&&ne.y+r.height/2<=i.y+i.height,C=ne=>E(ne)&&(!a||cl(ne,r,a));if(o.placement){const ne=he=>he.startsWith("top")?he.replace(/^top/,"bottom"):he.replace(/^bottom/,"top"),re=he=>he.endsWith("left")?he.replace(/left$/,"right"):he.replace(/right$/,"left"),K=o.placement.side,xe=[K,ne(K),re(K),ne(re(K)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],de=o.placement.offset??50;let we=c(K,de);if(b(we)||a&&!cl(we,r,a)){const he=(W,le)=>{const q=new Set;for(const ee of xe){if(q.has(ee))continue;q.add(ee);const me=c(ee,de,W);if(le(me)&&!b(me))return we=me,!0}return!1};!he(s,C)&&a&&he(i,E)}return we}const I=o.from,k=s.x+Dn+r.width/2,P=s.x+s.width-Dn-r.width/2,F=s.y+Dn+r.height/2,z=s.y+s.height-Dn-r.height/2;let G={x:Math.min(P,Math.max(k,I.x)),y:Math.min(z,Math.max(F,I.y))};if(b(G)){const ne=(t.width+r.width)/2+Dn,K=[{x:G.x+ne,y:G.y},{x:G.x-ne,y:G.y},{x:G.x,y:G.y-r.height-Dn},{x:G.x,y:G.y+r.height+Dn}].filter(C).find(xe=>!b(xe));K&&(G=K)}return G}function jt(e,t){return e.filter(n=>n.kind===t)}function Qy(e,t){const n=new Map,i=new Set(jt(e,"node.add").map(s=>s.node.id)),o=jt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&jt(e,"sequenceFlow.add").find(d=>d.flow.source===l&&d.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(d=>d!==u&&JSON.stringify(d).includes(p))||(a.add(c),n.set(s.id,u))}return n}class ev extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const tv=new WeakMap;function DA(e){return tv.get(e)??new Set}const nv=new WeakMap;function LA(e){return nv.get(e)??[]}function iv(e,t){var DS,LS,IS,BS,NS,$S,FS,jS,HS,zS,GS,VS,WS,US,qS,YS,KS,XS,ZS,JS,QS,eR,tR,nR,iR,oR,rR,aR,sR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;tv.set(t,u);const p=[];nv.set(t,p);const d=()=>a.getRootElement(),f=x=>r.get(x),g=x=>{const _=f(x);if(!_)throw new Error(`하강 참조 해소 실패: ${x}`);return _},h=x=>{let _=x.parent;for(;_;){if(_.type==="bpmn:Participant")return _;_=_.parent}},y=new Map;for(const x of r.filter(_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number"))y.set(x.id,{x:x.x,y:x.y});const w=jt(e,"participant.add"),m=jt(e,"node.add"),v=jt(e,"sequenceFlow.add"),b=jt(e,"messageFlow.add"),E=jt(e,"dataStore.add"),C=jt(e,"dataAssociation.add"),I=jt(e,"annotation.add"),k=jt(e,"group.add"),P=new Map(m.map(x=>[x.node.id,x])),F=Qy(e,x=>{var _,S;return(S=(_=f(x))==null?void 0:_.source)==null?void 0:S.id}),z=new Set([...F.values()].map(x=>x.flow.id)),G=v.filter(x=>!z.has(x.flow.id)),ne=new Set([...F.values()].map(x=>x.flow.target)),re=x=>jt(e,"sequenceFlow.update").filter(_=>_.target===x).length+(ne.has(x)?1:0),K=(x,_,S)=>{var L;const O=x.businessObject,B=(((L=O.extensionElements)==null?void 0:L.values)??[]).filter(D=>D.$type!==_),T=S?[...B,i.create(_,S)]:B;if(!T.length){O.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:T});T.forEach(D=>{D.$parent=N}),n.updateProperties(x,{extensionElements:N})},xe=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of jt(e,"element.remove")){const _=f(x.id);if(!_)continue;const S="waypoints"in _?[]:[..._.incoming??[],..._.outgoing??[]];n.removeElements([...S,_])}const de=x=>r.filter(_=>{var S;return _.type==="bpmn:Lane"&&((S=h(_))==null?void 0:S.id)===x}).sort((_,S)=>_.y-S.y),we=[];for(const x of jt(e,"participant.update")){const _=g(x.id);if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),!x.lanes)continue;const S=de(x.id);if(!S.length){n.splitLane(_,x.lanes.length),de(x.id).forEach((T,N)=>{const L=x.lanes[N];L&&n.updateProperties(T,{id:L.id,name:L.name})}),we.push({pool:x.id,lanes:new Set(x.lanes.map(T=>T.id))});continue}const O=new Set(S.map(T=>T.id)),B=x.lanes.reduce((T,N,L)=>O.has(N.id)?L:T,-1);x.lanes.forEach((T,N)=>{if(O.has(T.id)){n.updateProperties(g(T.id),{name:T.name});return}const L=N===B+1&&B>=0,D=N===0?n.addLane(de(x.id)[0],"top"):L?n.addLane(de(x.id).at(-1),"bottom"):n.addLane(g(x.lanes[N-1].id),"bottom");n.updateProperties(D,{id:T.id,name:T.name})})}const he=150,W=130,le=80,q=90,ee=180,me=30,Re=30,ze=10,$=300,M=5,R=(x,_,S,O,B)=>{const T=S-_.width/2,N=O-_.height/2;return(x.children??[]).find(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="bpmn:Lane"&&L.type!=="label"&&!(B!=null&&B.has(L.id))&&typeof L.x=="number"&&T<L.x+L.width+Re&&T+_.width+Re>L.x&&N<L.y+L.height&&N+_.height>L.y)},U=new Set;for(const x of w){U.add(`pool:${x.participant.id}`);for(const _ of x.participant.lanes??[])U.add(_.id)}const X=new Map;for(const x of m){const _=x.node.lane??`pool:${x.node.participant??""}`;let S=X.get(_);S||X.set(_,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const pe=new Map;for(const[x,_]of X){if(!U.has(x))continue;const S=[..._].sort((T,N)=>T-N),O=S.map((T,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),B=Math.min(...O);pe.set(x,new Map(S.map((T,N)=>[T,O[N]-B])))}{const x=new Map;for(const _ of w)(_.participant.lanes??[]).forEach((S,O)=>x.set(S.id,O));for(const[_,S]of pe){if(!x.has(_)||S.size<2)continue;const O=x.get(_),B=S.get(0)??0,T=new Set;for(const ie of m){if(ie.node.lane!==_||(ie.band??0)!==0||!ie.node.type.endsWith("Gateway"))continue;const ue={in:new Set,out:new Set,cross:new Set};for(const se of G){const oe=se.flow.source===ie.node.id;if(!oe&&se.flow.target!==ie.node.id)continue;const ve=P.get(oe?se.flow.target:se.flow.source);if(!ve||ve.node.participant!==ie.node.participant||!ve.node.lane)continue;let ye,te=!1;if(ve.node.lane!==_){const J=x.get(ve.node.lane);if(J===void 0)continue;ye=J>O?"down":"up",te=!0}else{const J=S.get(ve.band??0)??B;ye=J>B?"down":J<B?"up":void 0}ye&&(ue[oe?"out":"in"].add(ye),te&&ue.cross.add(ye))}for(const se of["up","down"])ue.in.has(se)&&ue.out.has(se)&&ue.cross.has(se)&&T.add(se)}if(T.size!==1)continue;const[N]=T,L=Math.max(...S.values()),D=N==="down"?L:0;if(B===D)continue;const H=[...S.entries()].filter(([ie])=>ie!==0).sort((ie,ue)=>ie[1]-ue[1]),j=[...Array(L+1).keys()].filter(ie=>ie!==D),Z=new Map([[0,D]]);H.forEach(([ie],ue)=>Z.set(ie,j[ue])),pe.set(_,Z)}}const Ne=x=>{var _;return(((_=X.get(x))==null?void 0:_.size)??0)>1},Ke=x=>x.band??(x.node.lane||!Ne(`pool:${x.node.participant??""}`)?void 0:0),ht=new Map,kt=x=>ht.get(x.node.id)??Ke(x),St=new Set,tn=new Set,Rn=new Set,Fn=new Set,Nt=new Set,nn=x=>I.some(_=>{var S,O;return(((S=_.placement)==null?void 0:S.anchor)??(_.association?_.association.source===_.annotation.id?_.association.target:_.association.source:void 0))===x&&((O=_.placement)==null?void 0:O.side.startsWith("bottom"))});{const x=new Map;for(const O of G)x.set(O.flow.target,(x.get(O.flow.target)??0)+1);const _=O=>{const B=[],T=new Set([O]),N=[O];for(;N.length;){const L=N.shift();B.push(L);for(const D of G)D.flow.source!==L||T.has(D.flow.target)||(x.get(D.flow.target)??0)!==1||(T.add(D.flow.target),N.push(D.flow.target))}return B},S=(O,B)=>{var T;return((T=pe.get(O))==null?void 0:T.get(B))??B};for(const O of m){if(!O.node.type.endsWith("Gateway"))continue;const B=O.node.lane??`pool:${O.node.participant??""}`,T=pe.get(B);if(!T||T.size<2)continue;const N=kt(O);if(N===void 0||S(B,N)!==S(B,0))continue;const L=S(B,N),D=G.filter(se=>se.flow.source===O.node.id).map(se=>P.get(se.flow.target)).filter(se=>!!se&&(se.node.lane??`pool:${se.node.participant??""}`)===B),H=D.filter(se=>{const oe=kt(se);return oe!==void 0&&S(B,oe)===L&&(x.get(se.node.id)??0)===1}),j=D.some(se=>{const oe=kt(se);return oe!==void 0&&S(B,oe)>L});if(H.length!==1||!j)continue;const Z=new Set(D.flatMap(se=>_(se.node.id)));if(!G.some(se=>se.flow.target===O.node.id&&Z.has(se.flow.source)))continue;const ue=new Map;for(const[se,oe]of T)ue.set(se,oe+1);ue.set(-1,0),pe.set(B,ue);for(const se of _(H[0].node.id))P.has(se)&&(ht.set(se,-1),tn.add(se));St.add(O.node.id)}}{const x=j=>j.node.lane??`pool:${j.node.participant??""}`,_=j=>kt(j)??0,S=new Map(w.map((j,Z)=>({id:j.participant.id,order:j.order??Number.POSITIVE_INFINITY,declared:Z})).sort((j,Z)=>j.order!==Z.order?j.order-Z.order:j.declared-Z.declared).map((j,Z)=>[j.id,Z])),O=j=>j===void 0?void 0:S.get(j)??-1,B=j=>{var ue;const Z=P.get(j);if(Z)return Z.node.participant;if(S.has(j))return j;const ie=f(j);if(ie)return ie.type==="bpmn:Participant"?ie.id:(ue=h(ie))==null?void 0:ue.id},T=new Map;for(const j of G)T.set(j.flow.target,(T.get(j.flow.target)??0)+1);const N=j=>{const Z=[j],ie=new Set([j.node.id]);for(let ue=0;ue<Z.length;ue++)for(const se of G){if(se.flow.source!==Z[ue].node.id||ie.has(se.flow.target)||(T.get(se.flow.target)??0)!==1)continue;const oe=P.get(se.flow.target);!oe||oe.node.participant!==j.node.participant||(ie.add(oe.node.id),Z.push(oe))}return Z},L=j=>{const Z=new Set(j.map(se=>se.node.id)),ie=O(j[0].node.participant);if(ie===void 0)return;const ue=new Set;for(const se of b){const oe=Z.has(se.flow.source)?se.flow.target:Z.has(se.flow.target)?se.flow.source:void 0;if(oe===void 0)continue;const ve=O(B(oe));ve===void 0||ve===ie||ue.add(ve<ie?"up":"down")}return ue.size===1?[...ue][0]:void 0},D=new Map;{const j=new Map;for(const oe of G){if(!P.has(oe.flow.source)||!P.has(oe.flow.target))continue;const ve=j.get(oe.flow.source)??[];ve.push(oe.flow.target),j.set(oe.flow.source,ve)}const Z=new Map,ie=[],ue=new Set,se=oe=>{Z.set(oe,"open");for(const ve of j.get(oe)??[]){const ye=Z.get(ve);ye==="open"?ue.add(`${oe}>${ve}`):ye||se(ve)}Z.set(oe,"done"),ie.push(oe)};for(const oe of m)Z.has(oe.node.id)||se(oe.node.id);for(const oe of ie.reverse()){const ve=D.get(oe)??0;D.set(oe,ve);for(const ye of j.get(oe)??[])!ue.has(`${oe}>${ye}`)&&(D.get(ye)??-1)<ve+1&&D.set(ye,ve+1)}}let H=-1e3;for(const j of m){if(!j.node.type.endsWith("Gateway"))continue;const Z=x(j),ie=pe.get(Z);if(!ie)continue;const ue=ie.get(_(j))??0,se=te=>(ie.get(_(te))??0)-ue,oe=G.filter(te=>te.flow.source===j.node.id).map(te=>P.get(te.flow.target)).filter(te=>!!te&&x(te)===Z&&(T.get(te.node.id)??0)===1&&!tn.has(te.node.id)).map(te=>{const J=N(te);return{root:te,subtree:J,dir:L(J)}});if(oe.some(te=>te.dir==="up")&&oe.some(te=>te.dir==="down"))continue;const ve=G.some(te=>{const J=te.flow.source===j.node.id?P.get(te.flow.target):void 0;return!!J&&x(J)===Z&&se(J)===0});let ye=!1;if(!ve){const te=G.filter(ge=>ge.flow.source===j.node.id).map(ge=>P.get(ge.flow.target)).filter(ge=>!!ge&&x(ge)===Z&&(!!ge.node.lane||Ke(ge)!==void 0)&&se(ge)<0),J=te.length?Math.max(...te.map(se)):void 0,ae=te.filter(ge=>se(ge)===J);if(!nn(j.node.id)&&ae.length===1&&(T.get(ae[0].node.id)??0)===1&&!St.has(j.node.id))continue;ye=!0}for(const te of oe){const J=te.dir;if(!J||oe.some(Me=>Me!==te&&Me.dir===J))continue;const ae=se(te.root);if(ae===0||(J==="up"?ae<0:ae>0)||G.some(Me=>{const ke=Me.flow.target===j.node.id?P.get(Me.flow.source):void 0;if(!ke||x(ke)!==Z)return!1;const Fe=se(ke);return J==="up"?Fe<0:Fe>0}))continue;const ge=[...ie].map(([Me,ke])=>({band:Me,rel:ke-ue})).filter(Me=>J==="up"?Me.rel<0:Me.rel>0).sort((Me,ke)=>Math.abs(ke.rel)-Math.abs(Me.rel));if(!ge.length&&J==="down")continue;const $e=_(te.root),Oe=te.subtree.filter(Me=>x(Me)===Z&&_(Me)===$e),Ze=new Set(te.subtree.map(Me=>Me.node.id)),Ae=Oe.map(Me=>D.get(Me.node.id)??0),Pe=Math.min(...Ae)-1,Ce=Math.max(...Ae)+1,Te=Me=>!m.some(ke=>{if(Ze.has(ke.node.id)||x(ke)!==Z||_(ke)!==Me)return!1;if(!Rn.has(Me))return!0;const Fe=D.get(ke.node.id)??0;return Fe>=Pe&&Fe<=Ce});let fe=ye?_(j):(DS=ge.find(Me=>Te(Me.band)))==null?void 0:DS.band;if(fe===void 0){if(fe=H--,Rn.add(fe),J==="up"){const Me=new Map;for(const[ke,Fe]of ie)Me.set(ke,Fe+1);Me.set(fe,0),pe.set(Z,Me)}else ie.set(fe,Math.max(...ie.values())+1);(LS=X.get(Z))==null||LS.add(fe)}for(const Me of Oe)ht.set(Me.node.id,fe)}}{const j=oe=>{const ve=G.find(ye=>ye.flow.target===oe.node.id);return ve?P.get(ve.flow.source):void 0},Z=oe=>{const ve=j(oe);if(!ve||!ve.node.type.endsWith("Gateway")||x(ve)!==x(oe))return!1;const ye=pe.get(x(ve));if(!ye)return!1;const te=ye.get(_(ve))??0,J=Oe=>x(Oe)===x(ve)?(ye.get(_(Oe))??0)-te:Number.NaN,ae=G.filter(Oe=>Oe.flow.source===ve.node.id).map(Oe=>P.get(Oe.flow.target)).filter(Oe=>!!Oe&&(!!Oe.node.lane||Ke(Oe)!==void 0));if(ae.some(Oe=>J(Oe)===0))return!1;const Q=ae.filter(Oe=>Oe.node.lane===ve.node.lane&&J(Oe)<0);if(!Q.length)return!1;const ge=Math.max(...Q.map(J)),$e=Q.filter(Oe=>J(Oe)===ge);return $e.length===1&&$e[0]===oe&&(T.get(oe.node.id)??0)===1&&!nn(ve.node.id)&&!St.has(ve.node.id)},ie=new Set;for(const oe of m){if(!oe.node.type.endsWith("Gateway")||nn(oe.node.id))continue;const ve=pe.get(x(oe));if(!ve)continue;const ye=ve.get(_(oe))??0;let te;for(const J of G){if(J.flow.source!==oe.node.id)continue;const ae=P.get(J.flow.target);if(!ae||x(ae)!==x(oe)||!ae.node.lane&&Ke(ae)===void 0)continue;const Q=ve.get(_(ae))??0;Q<=ye||(!te||Q>te.row?te={id:ae.node.id,row:Q,count:1}:Q===te.row&&te.count++)}te&&te.count===1&&(T.get(te.id)??0)===1&&ie.add(te.id)}const ue=new Set,se=[...m].sort((oe,ve)=>Number(ie.has(oe.node.id))-Number(ie.has(ve.node.id)));for(const oe of se){const ve=x(oe),ye=pe.get(ve);if(!ye)continue;const te=oe.node.id,J=b.filter(wt=>wt.flow.target===te);if(J.length!==1||!(T.get(te)??0)||!oe.node.lane&&Ke(oe)===void 0||tn.has(te)||Fn.has(te))continue;const ae=(IS=P.get(J[0].flow.source))==null?void 0:IS.node.participant;if(!ae||ae===oe.node.participant)continue;const Q=O(oe.node.participant),ge=O(ae);if(Q===void 0||ge===void 0||Q===ge)continue;const $e=ge<Q,Oe=ye.get(0)??0,Ze=(ye.get(_(oe))??Oe)-Oe;if(Ze===0||($e?Ze<0:Ze>0)||Z(oe))continue;let Ae;for(const[wt,an]of ye){if(Rn.has(wt))continue;const Yt=an-Oe;($e?Yt<0&&(!Ae||Yt<Ae.row):Yt>0&&(!Ae||Yt>Ae.row))&&(Ae={band:wt,row:Yt})}if(!Ae)continue;const Pe=_(oe),Ce=N(oe).filter(wt=>x(wt)===ve&&_(wt)===Pe&&!tn.has(wt.node.id)),Te=j(oe),fe=Te!=null&&Te.node.type.endsWith("Gateway")?`${Te.node.id}|${ve}|${Ae.band}`:void 0,Me=Ae,ke=!!fe&&ie.has(te)&&G.some(wt=>{if(wt.flow.source!==Te.node.id||wt.flow.target===te)return!1;const an=P.get(wt.flow.target);return!!an&&x(an)===ve&&!Ce.includes(an)&&_(an)===Me.band});let Fe=Ae.band;if(fe&&(ue.has(fe)||ke)){if(Fe=H--,Rn.add(Fe),$e){const wt=new Map;for(const[an,Yt]of ye)wt.set(an,Yt+1);wt.set(Fe,0),pe.set(ve,wt)}else ye.set(Fe,Math.max(...ye.values())+1);(BS=X.get(ve))==null||BS.add(Fe)}fe&&ue.add(fe);for(const wt of Ce)ht.set(wt.node.id,Fe),Fn.add(wt.node.id);$e&&ie.has(te)&&Nt.add(te)}}}const on=(x,_)=>{var S;return((S=pe.get(x))==null?void 0:S.get(_))??_},Wi=(x,_,S,O)=>{const B=x?f(x):_?f(_):void 0;if(!B)return!1;const T=x?B.y+Math.min(B.height/2,q):B.y+le;return Math.abs(T+on(x??`pool:${_??""}`,S)*he-O)<=he/2},hi=new Map;for(const[x,_]of X){let S=0;for(const O of _)S=Math.max(S,on(x,O));hi.set(x,S)}const xi=x=>ee+he*x,Un=(x,_,S,O)=>{const B=d().children.filter(T=>!("waypoints"in T&&T.waypoints)&&T.type!=="label"&&T.id!==_&&!(O!=null&&O.has(T.id))&&typeof T.y=="number"&&T.y>=x);B.length&&n.moveElements(B,{x:0,y:S})},gn=(x,_,S)=>{const O=x.type==="bpmn:Participant"?x:void 0;if(!O||O.children.some(L=>L.type==="bpmn:Lane"))return;const B=S+_.height/2+me-O.y;if(O.height>=B)return;const T=B-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:B}),Un(N,O.id,T)},br=(x,_)=>{const S=_-x.height;if(S<=0)return new Set;const O=h(x)??x,B=[],T=D=>{B.push(D);for(const H of D.children??[])T(H)};T(O);const N=x.y+x.height-10,L=l.calculateAdjustments(B,"y",S,N);return l.makeSpace(L.movingShapes,L.resizingShapes,{x:0,y:S},"s",N),new Set(L.movingShapes.map(D=>D.id))},es=(x,_,S)=>{if(x){const N=g(x),L=xi(_);if(N.height>=L)return;const D=L-N.height,H=h(N),j=H?H.y+H.height:N.y+N.height,Z=br(N,L);Un(j,H==null?void 0:H.id,D,Z);return}if(!S)return;const O=he*(_+1);if(S.height>=O)return;const B=O-S.height,T=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:O}),Un(T,S.id,B)},ti=new Map;for(const x of G)ti.set(x.flow.target,(ti.get(x.flow.target)??0)+1);const xt=x=>(ti.get(x)??0)<=1,At=new Set(m.map(x=>x.node.id).filter(x=>re(x)===1&&!G.some(_=>_.flow.target===x||_.flow.source===x&&P.has(_.flow.target)))),Gg=new Map,tS=(x,_)=>{if(!x)return;const S=f(x);if(!S||S.height>=xi(_))return;const O=S.y+S.height-10,B=h(S);if(B)return new Set((B.children??[]).filter(T=>T.type!=="bpmn:Lane"&&typeof T.y=="number"&&T.y>O).map(T=>T.id))},Sp=(x,_,S)=>{if(!x)return!0;const O=f(x);return O?S-_.height/2>=O.y&&S+_.height/2<=O.y+O.height:!0},eF=10,tF=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:_}of we){const S=f(x),O=de(x);if(!S||O.length<2)continue;const B=xi(0),T=eF,N=new Set(jt(e,"node.update").filter(Q=>Q.lane!==void 0&&_.has(Q.lane)).map(Q=>Q.id)),L=S.children??[],D=L.filter(Q=>!("waypoints"in Q&&Q.waypoints)&&Q.type!=="bpmn:Lane"&&Q.type!=="label"&&typeof Q.y=="number"),H=[];for(const Q of D){H.push([Q.y,Q.y+Q.height]);const ge=Q.label;ge&&H.push([ge.y,ge.y+ge.height])}for(const Q of L){const ge="waypoints"in Q&&Q.waypoints?Q.label:void 0;ge&&ge.y+ge.height>S.y&&ge.y<S.y+S.height&&H.push([ge.y,ge.y+ge.height])}for(const Q of d().children){if(Q.type!=="bpmn:TextAnnotation")continue;const ge=Q;ge.x<S.x+S.width&&ge.x+ge.width>S.x&&ge.y<S.y+S.height&&ge.y+ge.height>S.y&&H.push([ge.y,ge.y+ge.height])}H.sort((Q,ge)=>Q[0]-ge[0]);const j=S.y,Z=S.y+S.height,ie=[];let ue=j;for(const[Q,ge]of H)Q>ue&&ie.push([ue,Q]),ue=Math.max(ue,ge);const se=D.filter(Q=>tF.test(Q.type)&&!N.has(Q.id)),oe=(Q,ge)=>se.some($e=>$e.y+$e.height/2>=Q&&$e.y+$e.height/2<=ge),ve=Q=>H.some(([ge,$e])=>ge<Q-.5&&Q+.5<$e),ye=[];let te=j;for(const Q of O.slice(1).map(ge=>ge.y)){const ge=te+2*T,$e=!ve(Q)&&Q>=ge&&Q<=Z-2*T?[Q]:[];for(const[Ze,Ae]of ie){const Pe=Math.max(Ze+T,ge),Ce=Math.min(Ae-T,Z-2*T);Pe<=Ce&&$e.push(Math.min(Math.max(Q,Pe),Ce))}$e.push(Math.max(ue+T,ge));let Oe;for(const Ze of $e){const Ae=!oe(te,Ze)&&Ze-te<B?D.filter(Te=>Te.y>=Ze).length:0,Pe=Math.abs(Ze-Q),Ce=Oe?Math.abs(Oe.y-Q):0;(!Oe||Ae<Oe.cost||Ae===Oe.cost&&(Pe<Ce||Pe===Ce&&Ze>Oe.y))&&(Oe={y:Ze,cost:Ae})}ye.push(Oe.y),te=Oe.y}const J=ye[ye.length-1]+2*T-Z;J>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+J}),Un(Z,S.id,J));const ae=[j,...ye,S.y+S.height];O.forEach((Q,ge)=>{const $e=ae[ge],Oe=ae[ge+1]-$e;(Q.y!==$e||Q.height!==Oe)&&n.resizeShape(Q,{x:Q.x,y:$e,width:Q.width,height:Oe})});for(const Q of O){if(Q.height>=B||oe(Q.y,Q.y+Q.height))continue;const ge=B-Q.height,$e=S.y+S.height,Oe=br(Q,B);Un($e,S.id,ge,Oe)}}const Rp=w.map((x,_)=>({op:x,declared:_}));Rp.sort((x,_)=>{const S=x.op.order??Number.POSITIVE_INFINITY,O=_.op.order??Number.POSITIVE_INFINITY;return S!==O?S-O:x.declared-_.declared});let Rc=80;for(const x of r.getAll())x.parent===d()&&"height"in x&&typeof x.y=="number"&&(Rc=Math.max(Rc,x.y+x.height+60));const Vg=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===d()),nF=(()=>{if(!Vg.length)return;const x=Vg.filter(B=>!ov(B)),_=x.length?x:Vg,S=Math.min(..._.map(B=>B.x)),O=Math.max(..._.map(B=>B.x+B.width));return O>S?{x:S,width:O-S}:void 0})();for(const{op:x}of Rp){const _=x.participant,S=m.filter(oe=>oe.node.participant===_.id).length,O=((NS=_.lanes)==null?void 0:NS.length)??0,B=Math.max(1200,S*160+300),T=(_.lanes??[]).map(oe=>xi(hi.get(oe.id)??0)),N=T.reduce((oe,ve)=>oe+ve,0);O&&N<300&&(T[O-1]+=300-N);const L=Math.max(300,he*((hi.get(`pool:${_.id}`)??0)+1)),D=_.blackBox||S+O===0?120:O?Math.max(300,N):L,H=_.blackBox?nF:void 0,j=(H==null?void 0:H.x)??100,Z=(H==null?void 0:H.width)??B,ie=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:_.id,name:_.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},..._.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Z,height:D,isExpanded:!0}),ue=n.createShape(ie,{x:j+Z/2,y:Rc+D/2},d()),se=_.lanes??[];if(se.length&&n.splitLane(ue,se.length),se.length){const oe=r.filter(ve=>{var ye;return ve.type==="bpmn:Lane"&&((ye=h(ve))==null?void 0:ye.id)===_.id}).sort((ve,ye)=>ve.y-ye.y);if(oe.forEach((ve,ye)=>{const te=se[ye];te&&n.updateProperties(ve,{id:te.id,name:te.name})}),T.some(ve=>ve!==ue.height/O)){let ve=ue.y;oe.forEach((ye,te)=>{const J=T[te];n.resizeShape(ye,{x:ye.x,y:ve,width:ye.width,height:J}),ve+=J})}}Rc=ue.y+ue.height+60}const iF=x=>{var O;const _=P.get(x);if(_)return _.node.participant??"";const S=f(x);return S?S.type==="bpmn:Participant"?S.id:((O=h(S))==null?void 0:O.id)??"":""},Cc=new Map,nS=x=>{let _=Cc.get(x);return _||Cc.set(x,_={nodes:[],flows:[]}),_};for(const x of m)nS(x.node.participant??"").nodes.push(x);for(const x of G)nS(iF(x.flow.source)).flows.push(x);const Cp=x=>{var _;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((_=x.condition)==null?void 0:_.label)})},Wg=(x,_,S)=>o.createShape({type:al(x.type),...x.eventDefinition?{eventDefinitionType:Ic[x.eventDefinition]}:{},businessObject:i.create(al(x.type),{id:x.id,name:x.name,..._!==void 0?{"bwl:band":_}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),oF=[...Rp.map(({op:x})=>x.participant.id).filter(x=>Cc.has(x)),...[...Cc.keys()].filter(x=>!w.some(_=>_.participant.id===x))],Ug=x=>x.endsWith("Gateway");for(const x of oF){const _=Cc.get(x),S=x?g(x):void 0,O=S?S.x+150:250;let B=S?S.y+80:120;const T=(J,ae,Q)=>{if(J){const ge=g(J);return ge.y+Math.min(ge.height/2,q)+on(J,ae??0)*he}return ae!==void 0&&S?S.y+le+on(`pool:${x}`,ae)*he:Q},N=(J,ae,Q)=>{if(J){const ge=g(J);return ge.y+Math.min(ge.height/2,q)+ae*he}return S?S.y+le+ae*he:Q},L=J=>J.participant?g(J.participant):d(),D=(J,ae,Q,ge,$e,Oe,Ze,Ae)=>{const Pe=Q!==void 0||ge!==void 0,Ce=ke=>{const Fe=()=>es(Q,ke,S);Ae?Ae(Fe):Fe()},Te=on(Q??`pool:${x}`,ge??0);if((ge===void 0||Wi(Q,x,ge,Ze??Number.NaN))&&Ze!==void 0&&Sp(Q,ae,Ze)&&!R(J,ae,$e,Ze))return{x:$e,y:Ze};if(Pe)for(let ke=0;ke<4;ke++){const Fe=N(Q,Te+ke,Oe);if(!R(J,ae,$e,Fe,tS(Q,Te+ke)))return Ce(Te+ke),{x:$e,y:Fe}}const fe=T(Q,ge,Oe);Pe?Ce(Te):Ae?Ae(()=>gn(J,ae,ae.y+ae.height/2)):gn(J,ae,fe);let Me=$e;for(let ke=0;ke<64;ke++){const Fe=R(J,ae,Me,fe);if(!Fe)break;Me=Fe.x+Fe.width+W+ae.width/2}return{x:Me,y:fe}},H=(J,ae,Q)=>{const ge=r.getAll().filter(Oe=>{var Ze;return/Association$/.test(Oe.type)&&(((Ze=Oe.waypoints)==null?void 0:Ze.length)??0)>=2});if(!ge.length)return Q;const $e=Oe=>{const Ze={id:ae.id,type:ae.type,x:Oe-ae.width/2,y:Q.y-ae.height/2,width:ae.width,height:ae.height};return ge.some(Ae=>Ae.waypoints.some((Pe,Ce)=>!!Ae.waypoints[Ce+1]&&Go(Pe,Ae.waypoints[Ce+1],Ze)<=ze))};if(!$e(Q.x))return Q;for(let Oe=M;Oe<=$;Oe+=M){const Ze=Q.x+Oe;if(!$e(Ze)&&!R(J,ae,Ze,Q.y))return{x:Ze,y:Q.y}}return Q},j=new Set(_.flows.map(J=>J.flow.target)),Z=new Map,ie=J=>{if(J===void 0)return;const ae=r.get(J);if(!(!ae||typeof ae.x!="number"||typeof ae.width!="number"))return ae.x+ae.width+W},ue=J=>{if(re(J)>0)return;const ae=_.flows.filter(ge=>ge.flow.source===J);if(ae.length!==1)return;const Q=r.get(ae[0].flow.target);return Q&&typeof Q.y=="number"&&typeof Q.height=="number"?Q.y+Q.height/2:void 0};for(const J of _.nodes){if(j.has(J.node.id))continue;const ae=Wg(J.node,J.band,J.afterColumn),Q=Ke(J),ge=J.node.lane?`${J.node.lane}|${Q??""}`:Q!==void 0?`band:${Q}`:"",$e=L(J.node),Oe=Z.get(ge)??O,Ze=ie(J.afterColumn),Ae=Ze===void 0?Oe:Math.max(Oe,Ze);let Pe;const Ce=D($e,ae,J.node.lane,Q,Ae,B,ue(J.node.id),At.has(J.node.id)&&J.node.participant!==void 0?Te=>Pe=Te:void 0);if(Pe?n.createShape(ae,Ce,$e,{autoResize:!1}):n.createShape(ae,Ce,$e),Pe){const Te=J.node.lane?g(J.node.lane):$e;Gg.set(J.node.id,{container:Te,relCy:Ce.y-Te.y,grow:Pe})}Z.set(ge,Ce.x+ae.width+W),!J.node.lane&&Q===void 0&&(B+=160)}const se=new Set,oe=new Map,ve=new Map;if(x&&U.has(`pool:${x}`)){const J=new Map;for(const Ae of _.flows)J.set(Ae.flow.target,(J.get(Ae.flow.target)??0)+1);const ae=Ae=>T(Ae.node.lane,kt(Ae),Number.NaN),Q=new Set,ge=Ae=>{var Te;const Pe=(Te=P.get(Ae))==null?void 0:Te.node.participant;if(Pe)return f(Pe);const Ce=f(Ae);if(Ce)return Ce.type==="bpmn:Participant"?Ce:h(Ce)},$e=Ae=>{const Pe=[],Ce=new Set([Ae]),Te=[Ae];for(;Te.length;){const fe=Te.shift(),Me=P.get(fe);Me&&Pe.push(Me);for(const ke of _.flows)ke.flow.source!==fe||Ce.has(ke.flow.target)||(J.get(ke.flow.target)??0)!==1||(Ce.add(ke.flow.target),Te.push(ke.flow.target))}return Pe},Oe=Ae=>{if(!S)return;const Pe=new Set(Ae.map(fe=>fe.node.id));let Ce=!1,Te=!1;for(const fe of b){if(!Pe.has(fe.flow.source))continue;const Me=ge(fe.flow.target);!Me||Me.id===S.id||(Me.y<S.y?Ce=!0:Te=!0)}return Ce&&!Te?"up":Te&&!Ce?"down":void 0};for(const Ae of _.nodes){if(!Ug(Ae.node.type))continue;const Pe=T(Ae.node.lane,Ke(Ae),Number.NaN);if(Number.isNaN(Pe))continue;const Ce=[];for(const ke of _.flows){if(ke.flow.source!==Ae.node.id)continue;const Fe=P.get(ke.flow.target);if(!Fe||Fe.node.lane!==Ae.node.lane||(J.get(Fe.node.id)??0)!==1)continue;const wt=Ke(Fe);if(wt===void 0)continue;const an=T(Fe.node.lane,wt,Number.NaN);if(Number.isNaN(an))continue;const Yt=$e(Fe.node.id),Kt=Oe(Yt);Kt&&Ce.push({subtree:Yt,band:wt,row:an,dir:Kt})}if(!Ce.some(ke=>ke.dir==="up")||!Ce.some(ke=>ke.dir==="down")||!Ce.some(ke=>ke.dir==="up"&&Ce.some(Fe=>Fe.dir==="down"&&Fe.row<ke.row)))continue;const fe=[...Ce].sort((ke,Fe)=>ke.row-Fe.row);[...Ce.filter(ke=>ke.dir==="up"),...Ce.filter(ke=>ke.dir==="down")].sort((ke,Fe)=>ke.dir===Fe.dir?ke.row-Fe.row:ke.dir==="up"?-1:1).forEach((ke,Fe)=>{const wt=fe[Fe].band;if(wt!==ke.band){Q.add(Ae.node.id);for(const an of ke.subtree)Ke(an)===ke.band&&ht.set(an.node.id,wt)}})}const Ze=Ae=>{if(!S)return;const Pe=new Set(Ae.map(fe=>fe.node.id));let Ce=!1,Te=!1;for(const fe of b){if(!Pe.has(fe.flow.target))continue;const Me=ge(fe.flow.source);!Me||Me.id===S.id||(Me.y<S.y?Ce=!0:Te=!0)}return Ce&&!Te?"up":Te&&!Ce?"down":void 0};for(const Ae of _.nodes){if(!Ug(Ae.node.type))continue;const Pe=Ae.node.lane??`pool:${x}`,Ce=pe.get(Pe);if(!Ce||Ce.size<2)continue;const Te=Ce.get(0);if(Te===void 0)continue;const fe=Math.max(...Ce.values()),Me=Te===fe&&Te!==0?"down":void 0;if(!Me)continue;const ke=[];for(const Kt of _.flows){if(Kt.flow.source!==Ae.node.id)continue;const jn=P.get(Kt.flow.target);if(!jn||jn.node.lane!==Ae.node.lane||(J.get(jn.node.id)??0)!==1)continue;const _n=kt(jn);_n!==void 0&&ke.push({t:jn,subtree:$e(jn.node.id),band:_n})}const Fe=ke.find(Kt=>(Ce.get(Kt.band)??Kt.band)===Te);if(!Fe||Ze(Fe.subtree)===Me||Oe(Fe.subtree)===Me)continue;const wt=ke.find(Kt=>Kt!==Fe&&Ze(Kt.subtree)===Me);if(!wt)continue;const an=Fe.band,Yt=wt.band;for(const Kt of Fe.subtree)kt(Kt)===an&&ht.set(Kt.node.id,Yt);for(const Kt of wt.subtree)kt(Kt)===Yt&&ht.set(Kt.node.id,an);Q.add(Ae.node.id)}for(const Ae of _.nodes){if(!Ug(Ae.node.type))continue;const Pe=ae(Ae);if(Number.isNaN(Pe)||nn(Ae.node.id))continue;let Ce,Te=!1,fe;for(const Me of _.flows){if(Me.flow.source!==Ae.node.id)continue;const ke=P.get(Me.flow.target);if(!ke||!ke.node.lane&&Ke(ke)===void 0)continue;const Fe=ae(ke);Number.isNaN(Fe)||(Math.abs(Fe-Pe)<.5&&(Te=!0),Fe>Pe?!Ce||Fe>Ce.row?Ce={id:ke.node.id,row:Fe,count:1}:Fe===Ce.row&&Ce.count++:Fe<Pe&&ke.node.lane===Ae.node.lane&&!Fn.has(ke.node.id)&&(!fe||Fe>fe.row?fe={op:ke,row:Fe,count:1}:Fe===fe.row&&fe.count++))}Ce&&Ce.count===1&&(J.get(Ce.id)??0)===1&&!Q.has(Ae.node.id)&&se.add(Ce.id),!Te&&fe&&fe.count===1&&(J.get(fe.op.node.id)??0)===1&&!St.has(Ae.node.id)&&oe.set(fe.op.node.id,{lane:Ae.node.lane,band:kt(Ae)})}for(const Ae of Nt){const Pe=($S=_.flows.find(Ce=>Ce.flow.target===Ae))==null?void 0:$S.flow.source;Pe&&!Q.has(Pe)&&se.add(Ae)}}const ye=new Set;let te=0;for(;te++<_.nodes.length+2;){for(let Q=0;Q<_.nodes.length+_.flows.length+2;Q++){let ge=!1;for(const $e of _.flows){const Oe=$e.flow;if(ye.has(Oe.id))continue;const Ze=f(Oe.source);if(!Ze)continue;const Ae=f(Oe.target),Pe=P.get(Oe.target);if(!Ae&&Pe){const Ce=Wg(Pe.node,Pe.band),Te=kt(Pe);if(Pe.node.lane||Te!==void 0){const fe=L(Pe.node),Me=Ze,ke=Me.x+(ve.get(Oe.source)??0)+Me.width+W,Fe=oe.get(Oe.target),wt=D(fe,Ce,Fe?Fe.lane:Pe.node.lane,Fe?Fe.band:Te,se.has(Oe.target)?Me.x+Me.width/2:ke,Number.NaN,Fe||!xt(Oe.target)?void 0:Me.y+Me.height/2),an=P.has(Oe.source)?wt:H(fe,Ce,wt),Yt=n.createShape(Ce,an,fe);se.has(Oe.target)&&ve.set(Oe.target,ke-(Yt.x+Yt.width/2)),n.connect(Ze,Yt,{type:"bpmn:SequenceFlow",businessObject:Cp(Oe)})}else s.append(Ze,Ce,{connection:{type:"bpmn:SequenceFlow",businessObject:Cp(Oe)}})}else if(Ae)n.connect(Ze,Ae,{type:"bpmn:SequenceFlow",businessObject:Cp(Oe)});else continue;ye.add(Oe.id),ge=!0}if(!ge)break}const J=_.nodes.filter(Q=>!f(Q.node.id));if(!J.length)break;const ae=J[0];{const Q=Wg(ae.node,ae.band),ge=L(ae.node),$e=Ke(ae);n.createShape(Q,D(ge,Q,ae.node.lane,$e,O,B),ge),!ae.node.lane&&$e===void 0&&(B+=160)}}}const iS=new Map;for(const[x,_]of F){const S=f(x),O=f(_.flow.target);if(!(S!=null&&S.target)||!O)continue;const B=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};iS.set(x,{waypoints:S.waypoints.map(L=>({x:L.x,y:L.y})),label:B});const T=S.target,N=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(S,O,T,[N(O),N(T)]),n.layoutConnection(S,{waypoints:[]})}const oS=new Set;{const x=T=>T.endsWith("Task")||T==="bpmn:CallActivity"||T==="bpmn:SubProcess",_=T=>x(T)||T==="bpmn:EndEvent"||T==="bpmn:IntermediateThrowEvent"||T==="bpmn:IntermediateCatchEvent",S=T=>(T??[]).filter(N=>N.type==="bpmn:SequenceFlow"),O=jt(e,"sequenceFlow.update"),B=(T,N)=>{if(!T)return;const L=N.x+N.width/2,D=N.y+N.height/2;let H;const j=Z=>{for(const ie of Z.children??[])if(ie.type==="bpmn:Lane"){const ue=ie;L>=ue.x&&L<=ue.x+ue.width&&D>=ue.y&&D<=ue.y+ue.height&&(H=ue,j(ue))}};return j(T),H==null?void 0:H.id};for(const T of O){if(T.source===void 0&&T.target===void 0||F.has(T.id))continue;const N=f(T.id);if(!N)continue;const L=T.source!==void 0?f(T.source):N.source,D=T.target!==void 0?f(T.target):N.target;if(!L||!D||L.id===D.id||P.has(L.id)||P.has(D.id)||!x(L.type)||!_(D.type)||L.parent!==D.parent||S(D.incoming).some(te=>te.id!==N.id)||S(D.outgoing).some(te=>te.id!==N.id)||O.some(te=>te!==T&&(te.target===D.id||te.source===D.id))||D.x>=L.x+L.width)continue;const H=L.parent,j=h(L),Z=L.x+L.width+W,ie=L.y+L.height/2,ue=D.y+D.height/2,se=B(j,L)===B(j,D),oe=new Set([D.id]),ve=[se?ie:ue,ue].find(te=>!R(H,D,Z,te,oe));if(ve===void 0)continue;if(n.moveElements([D],{x:Z-(D.x+D.width/2),y:ve-ue}),j){const te=D.x+D.width+Dd-(j.x+j.width);te>0&&ul(n,j,j.width+te)}const ye=te=>({x:te.x+te.width/2,y:te.y+te.height/2});n.reconnect(N,L,D,[ye(L),ye(D)]),Math.abs(ye(L).y-ye(D).y)>1&&n.layoutConnection(N,{waypoints:[]}),oS.add(T.id)}}const wr=40,rF=10,Mp=x=>{const _=j=>j.kind==="label-over-line"||j.kind==="label-over-shape"||j.kind==="label-on-shared-segment"?j.edge===x.id:j.kind==="annotation-over-label"||j.kind==="pool-name-over-label"?j.label===x.id:!1,S=()=>new Map(ut(Ve(r)).filter(j=>!_(j)).map(j=>[ct(j),j])),O=S(),B=j=>[...j].filter(([Z])=>!O.has(Z)).map(([,Z])=>Z),T=j=>B(j).length<=[...O.keys()].filter(Z=>!j.has(Z)).length,N=x.waypoints.map(j=>({x:j.x,y:j.y})),L=x.label,D=L&&{x:L.x,y:L.y};n.layoutConnection(x,{waypoints:[]});const H=S();if(!T(H)){if(B(H).every(j=>j.kind==="edge-crosses-shape"&&j.edge===x.id)){const j=Ve(r),Z=j.edges.find(oe=>oe.id===x.id),ie=kn(j),ue=Z?Tt(Z,ie):[],se=Z&&ue.length&&!ue.every(oe=>oe.type==="bpmn:TextAnnotation")?el(Z,ie,ys(x),j.edges):null;if(se&&(n.updateWaypoints(x,se),T(S())))return}n.updateWaypoints(x,N),L&&D&&(L.x!==D.x||L.y!==D.y)&&n.moveElements([L],{x:D.x-L.x,y:D.y-L.y})}},qg=5,Ii=10,rS=200,Mc=new Set([...G.map(x=>x.flow.id),...b.map(x=>x.flow.id),...jt(e,"sequenceFlow.update").map(x=>x.id),...jt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),aF=(x,_,S,O,B,T)=>{const N=new Set(x.map(te=>te.id)),L=Math.min(...x.map(te=>te.x))+_-Ii,D=Math.max(...x.map(te=>te.x+te.width))+_+rS+Ii,H=Math.min(...x.map(te=>te.y+Math.min(0,...S)))-Ii,j=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...S)))+Ii,Z=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const J=te;return Mc.has(J.id)||!J.waypoints||J.waypoints.length<2||[J.source,J.target].some(Q=>!Q||N.has(Q.id)||Q.x>=O)?!1:J.waypoints.some((Q,ge)=>{const $e=J.waypoints[ge+1];return!!$e&&Math.max(Q.x,$e.x)>=L&&Math.min(Q.x,$e.x)<=D&&Math.max(Q.y,$e.y)>=H&&Math.min(Q.y,$e.y)<=j})});if(!Z.length)return 0;const ie=te=>{const J=new Map;for(const ae of x)for(const Q of S){const ge={id:ae.id,type:ae.type,x:ae.x+_+te,y:ae.y+Q,width:ae.width,height:ae.height};for(const $e of Z){let Oe=1/0;for(let Ae=0;Ae+1<$e.waypoints.length;Ae++)Oe=Math.min(Oe,Go($e.waypoints[Ae],$e.waypoints[Ae+1],ge));const Ze=`${$e.id}|${ae.id}`;J.set(Ze,Math.min(J.get(Ze)??1/0,Oe))}}return J},ue=[...ie(0)].filter(([,te])=>te<=qg).map(([te])=>te);if(!ue.length)return 0;let se=0;for(let te=1;te<=rS;te++){const J=ie(te);if([...J.values()].every(ae=>ae>qg)&&ue.every(ae=>(J.get(ae)??1/0)>=Ii)){se=te;break}}if(!se)return 0;const oe=Math.min(...x.map(te=>te.x))+_+se,ve=new Set(ue.map(te=>te.slice(0,te.indexOf("|"))));return Z.some(te=>te.type==="bpmn:SequenceFlow"&&ve.has(te.id)&&te.waypoints.some((J,ae)=>{const Q=te.waypoints[ae+1];if(!Q||Math.min(J.y,Q.y)>T||Math.max(J.y,Q.y)<T||J.y===Q.y)return!1;const ge=J.x+(T-J.y)*(Q.x-J.x)/(Q.y-J.y);return ge>B&&ge<oe}))?0:se},_r=(x,_=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],B=new Set([x]);for(let T=0;T<O.length;T++){const N=O[T].id;for(const L of G){const D=L.flow.target;if(L.flow.source!==N||B.has(D)||!P.has(D))continue;B.add(D);const H=f(D);H&&_(H)&&O.push(H)}}return O},sF=(x,_=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],B=new Set([x]);for(let T=0;T<O.length;T++){const N=O[T].id;for(const L of G){const D=L.flow.source;if(L.flow.target!==N||B.has(D)||!P.has(D))continue;B.add(D);const H=f(D);H&&_(H)&&O.push(H)}}return O},Bi=30,Ni=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",ts=(x,_)=>ul(n,x,_),ns=(x,_,S=!1)=>{const O=new Set(x.flatMap(D=>D.subtree.map(H=>H.id)));for(const D of x){const H=(D.pool.children??[]).filter(Ni).filter(Z=>!O.has(Z.id));if(D.subtree.some(Z=>H.some(ie=>Z.x+_<ie.x+ie.width+Bi&&Z.x+_+Z.width+Bi>ie.x&&Z.y<ie.y+ie.height&&Z.y+Z.height>ie.y)))return null}const B=x.map(D=>D.pool.width),T=S?r.filter(D=>Array.isArray(D.waypoints)).map(D=>({c:D,wps:D.waypoints.map(H=>({x:H.x,y:H.y}))})):[],N=r.filter(D=>D.type==="label").map(D=>({label:D,x:D.x,y:D.y}));n.moveElements(x.flatMap(D=>D.subtree),{x:_,y:0});const L=x.map(D=>{const j=Math.max(...D.subtree.map(Z=>Z.x+Z.width))+Dd-(D.pool.x+D.pool.width);return j>0&&ts(D.pool,D.pool.width+j),j});return()=>{n.moveElements(x.flatMap(D=>D.subtree),{x:-_,y:0}),x.forEach((D,H)=>{L[H]>0&&ts(D.pool,B[H])});for(const{c:D,wps:H}of T){const j=D.waypoints??[];j.length===H.length&&j.every((ie,ue)=>Math.abs(ie.x-H[ue].x)<=.5&&Math.abs(ie.y-H[ue].y)<=.5)||n.updateWaypoints(D,H.map(ie=>({x:ie.x,y:ie.y})))}for(let D=0;D<3;D++){let H=0;for(const j of N){const Z=j.x-j.label.x,ie=j.y-j.label.y;Math.abs(Z)<=.5&&Math.abs(ie)<=.5||(n.moveElements([j.label],{x:Z,y:ie}),H++)}if(!H)break}}},Yg=x=>{var B,T;const _=new Map,S=new Map;for(const N of r.getAll()){if(N.type!=="bpmn:Participant")continue;const L=N;(L.children??[]).length||(_.set(L.id,L),S.set(L.id,[]))}for(const N of r.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const L=N,D=(B=L.source)==null?void 0:B.id,H=(T=L.target)==null?void 0:T.id;D&&H&&S.has(D)&&S.get(D).push(H),D&&H&&S.has(H)&&S.get(H).push(D)}const O=[];for(const[N,L]of S)L.length&&L.every(D=>x.has(D))&&O.push(_.get(N));return O},aS=(x,_)=>{if(!x.length)return null;const S=new Set(x.map(j=>j.id)),O=r.getAll().filter(j=>j.type==="bpmn:Participant"&&!S.has(j.id)),B=Math.min(...O.filter(j=>(j.children??[]).length>0).map(j=>j.x)),T=new Set(x.filter(j=>Math.abs(j.x-B)<=2).map(j=>j.id));if(x.some(j=>{const Z=T.has(j.id)?j.x:j.x+_,ie=T.has(j.id)?j.width+_:j.width;return O.some(ue=>Z<ue.x+ue.width+Bi&&Z+ie+Bi>ue.x&&j.y<ue.y+ue.height&&j.y+j.height>ue.y)}))return null;const L=r.filter(j=>j.type==="label").map(j=>({label:j,x:j.x,y:j.y})),D=x.filter(j=>!T.has(j.id)),H=x.filter(j=>T.has(j.id)).map(j=>({pool:j,was:{x:j.x,y:j.y,width:j.width,height:j.height}}));D.length&&n.moveElements(D,{x:_,y:0});for(const{pool:j,was:Z}of H)n.resizeShape(j,{...Z,width:Z.width+_});return()=>{for(const{pool:j,was:Z}of H)n.resizeShape(j,Z);D.length&&n.moveElements(D,{x:-_,y:0});for(let j=0;j<3;j++){let Z=0;for(const ie of L){const ue=ie.x-ie.label.x,se=ie.y-ie.label.y;Math.abs(ue)<=.5&&Math.abs(se)<=.5||(n.moveElements([ie.label],{x:ue,y:se}),Z++)}if(!Z)break}}},sS=(x,_,S)=>{const O=S.x+S.width/2,B=_.y>S.y,T=B?S.y+S.height:S.y,N=B?_.y:_.y+_.height,L=x.source===_?[{x:O,y:N},{x:O,y:T}]:[{x:O,y:T},{x:O,y:N}],D=Ve(r),H={...D.edges.find(j=>j.id===x.id),waypoints:L};return Tt(H,kn(D)).length?!1:(n.updateWaypoints(x,L),!0)},cF=()=>{const x=r.filter(N=>N.type==="bpmn:Participant"),_=Math.min(...x.filter(N=>(N.children??[]).length>0).map(N=>N.x)),S=N=>w.some(L=>L.participant.id===N.id),O=N=>!!N&&N.type==="bpmn:Participant"&&!(N.children??[]).length&&Math.abs(N.x-_)<=2&&!S(N),B=N=>!!N&&N.type==="bpmn:Participant"&&(N.children??[]).length>0&&!S(N),T=new Set;for(const N of r.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const L=N;if((L.waypoints??[]).length!==2)continue;const D=[L.source,L.target].find(Z=>O(Z)||B(Z)),H=D===L.source?L.target:L.source;if(!D||!H||H.type==="bpmn:Participant")continue;const j=H.x+H.width/2;B(D)&&(j<D.x||j>D.x+D.width)||T.add(L.id)}return T},lF=x=>{var S;const _=new Map;for(const O of x){const B=r.get(O);if(!B||(B.waypoints??[]).length===2)continue;const T=((S=B.source)==null?void 0:S.type)==="bpmn:Participant"?B.source:B.target,N=T===B.source?B.target:B.source;if(N.x+N.width/2<=T.x+T.width)continue;const L=_.get(T.id)??{pool:T,msgs:[]};L.msgs.push({conn:B,other:N}),_.set(T.id,L)}for(const{pool:O,msgs:B}of _.values()){const T=Math.max(...B.map(({other:se})=>se.x+se.width/2))+kd;if(r.getAll().some(se=>{if(se.type!=="bpmn:Participant"||se.id===O.id)return!1;const oe=se;return O.x<oe.x+oe.width+Bi&&T+Bi>oe.x&&O.y<oe.y+oe.height&&O.y+O.height>oe.y}))continue;const L={x:O.x,y:O.y,width:O.width,height:O.height},D=[...O.incoming??[],...O.outgoing??[]],H=D.map(se=>({c:se,wps:(se.waypoints??[]).map(oe=>({x:oe.x,y:oe.y}))})),j=D.flatMap(se=>{const oe=se.label;return oe?[{label:oe,x:oe.x,y:oe.y}]:[]}),Z=Er();ts(O,T-O.x);const ie=B.filter(({conn:se,other:oe})=>sS(se,O,oe)).length,ue=Er();if(!(ie>0&&ue.messages>Z.messages&&ue.lines>=Z.lines)){ts(O,L.width);for(const{c:se,wps:oe}of H){const ve=se.waypoints??[];ve.length===oe.length&&ve.every((te,J)=>Math.abs(te.x-oe[J].x)<=.5&&Math.abs(te.y-oe[J].y)<=.5)||n.updateWaypoints(se,oe.map(te=>({x:te.x,y:te.y})))}for(let se=0;se<3;se++){let oe=0;for(const ve of j){const ye=ve.x-ve.label.x,te=ve.y-ve.label.y;Math.abs(ye)<=.5&&Math.abs(te)<=.5||(n.moveElements([ve.label],{x:ye,y:te}),oe++)}if(!oe)break}}}},cS=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:DataInputAssociation"&&_.type!=="bpmn:DataOutputAssociation")continue;const S=_.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},lS=()=>{let x=0;for(const _ of r.getAll()){if(_.type!=="bpmn:Association")continue;const S=_.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},uF=x=>{const _=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const O=S;if(x.has(O.id))continue;const T=[...O.incoming??[],...O.outgoing??[]].filter(D=>D.type==="bpmn:Association").map(D=>D.source===O?D.target:D.source);if(!T.length||T.some(D=>D===void 0))continue;const N=D=>{if(!("waypoints"in D&&D.waypoints))return[D.id];const H=D,j=[H.source,H.target];return j.some(Z=>!Z)?[]:j.map(Z=>Z.id)},L=T.flatMap(D=>N(D));L.length&&L.every(D=>x.has(D))&&_.push(O)}return _},uS=()=>ut(Ve(r)).filter(x=>x.kind==="edge-crosses-shape").length,pS=x=>{const _=(x.children??[]).filter(Ni);let S=0;for(let O=0;O<_.length;O++)for(let B=O+1;B<_.length;B++){const T=_[O],N=_[B];T.x<N.x+N.width&&T.x+T.width>N.x&&T.y<N.y+N.height&&T.y+T.height>N.y&&S++}return S},Er=()=>{const x=Ve(r),_=S=>S.length>=2&&(S.every(O=>Math.abs(O.x-S[0].x)<.01)||S.every(O=>Math.abs(O.y-S[0].y)<.01));return{messages:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length,lines:x.edges.filter(S=>_(S.waypoints)).length}},dS=x=>{const _=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const B=O;if(!B.waypoints||B.waypoints.length!==2)continue;const T=B.source,N=B.target;if(!T||!N)continue;const L=x.has(T.id);if(L===x.has(N.id))continue;const D=L?N:T,H=h(D);if(!H||x.has(D.id))continue;const j=_.get(H.id);j?D.x<j.minX&&(j.minX=D.x):_.set(H.id,{pool:H,minX:D.x})}const S=[];for(const{pool:O,minX:B}of _.values()){const T=(O.children??[]).filter(N=>Ni(N)&&!x.has(N.id)&&N.x>=B);T.length&&S.push({subtree:T,pool:O})}return S},pF=(x,_,S)=>{const O=new Map(_.map(N=>[N.pool.id,{subtree:[...N.subtree],pool:N.pool}])),B=new Set(x);for(const N of _)for(const L of N.subtree)B.add(L.id);let T=!1;for(;;){let N=0;for(const L of dS(B)){if(L.pool===S)continue;const D=O.get(L.pool.id);D?D.subtree.push(...L.subtree):O.set(L.pool.id,{subtree:[...L.subtree],pool:L.pool});for(const H of L.subtree)B.add(H.id);N+=L.subtree.length}if(!N)break;T=!0}return T?[...O.values()]:null},dF=(x,_)=>{const S=new Map;for(const B of r.getAll()){if(B.type!=="bpmn:DataInputAssociation"&&B.type!=="bpmn:DataOutputAssociation")continue;const T=B,N=T.waypoints;if(!N||N.length<2||!N.every(ue=>Math.abs(ue.x-N[0].x)<1))continue;const L=T.source,D=T.target;if(!L||!D)continue;const H=x.has(L.id);if(H===x.has(D.id))continue;const j=H?D:L,Z=h(j);if(!Z||Z===_||Z===h(H?L:D))continue;const ie=S.get(Z.id);ie?j.x<ie.minX&&(ie.minX=j.x):S.set(Z.id,{pool:Z,minX:j.x})}const O=[];for(const{pool:B,minX:T}of S.values()){const N=(B.children??[]).filter(L=>Ni(L)&&!x.has(L.id)&&L.x>=T);N.length&&O.push({subtree:N,pool:B})}return O},fS=x=>{const _=Ve(r),S=_.shapes.filter(B=>x.has(B.id)),O=new Set;for(const B of _.edges)if(!(B.type!=="bpmn:SequenceFlow"&&B.type!=="bpmn:MessageFlow"))for(const T of Tt(B,S))O.add(`${B.id}|${T.id}`);return O},Kg=new Map,fF=jt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const _=F.get(x.id);return _?[{id:x.id,target:_.flow.target,source:_.flow.source}]:[]});for(const x of fF){if(x.target===void 0)continue;const _=P.get(x.target);if(!_)continue;const S=f(x.target),O=f(x.id);if(!S||!O)continue;const B=x.source!==void 0?f(x.source):O.source,T=O.target;if(!B||!T||T.id===S.id)continue;const N=iS.get(O.id)??{waypoints:O.waypoints,label:O.label},L=N.waypoints&&N.waypoints.length>=3&&Math.abs(N.waypoints[0].x-N.waypoints[1].x)<1&&Math.abs(N.waypoints[0].y-N.waypoints[1].y)>1?{x:N.waypoints[0].x,y:N.waypoints[0].y}:void 0,D=L?N.waypoints[1].y:void 0,H=L&&N.label?{x:N.label.x,y:N.label.y}:void 0,j=H&&N.label&&Math.abs(H.y+N.label.height/2-D)<=he/5&&H.x+N.label.width>L.x?H.x+N.label.width+6:void 0,Z=(B.outgoing??[]).filter(De=>De.type==="bpmn:SequenceFlow"&&De.id!==O.id&&De.target&&!Mc.has(De.id)),ie=new Set(Z.map(De=>De.target.id)),ue=De=>{const Ct={type:"bpmn:Task",x:De.x+2,y:De.y+2,width:De.width-4,height:De.height-4};return Z.find(vt=>(vt.waypoints??[]).some((Xt,je)=>!!vt.waypoints[je+1]&&Go(Xt,vt.waypoints[je+1],Ct)===0))},se=_r(x.target),oe=new Set(se.map(De=>De.id)),ve=Gg.has(x.target)?{autoResize:!1}:void 0,ye=Math.min(...se.map(De=>De.x)),te=Math.max(...se.map(De=>De.x+De.width)),J=B.x+B.width,ae=T.x+T.width<=B.x,Q=(()=>{if(!ae)return;const De=h(S),Ct=((De==null?void 0:De.children)??[]).filter(Ge=>Ni(Ge)&&!oe.has(Ge.id)&&Ge.type!=="bpmn:Group"&&Ge.type!=="bpmn:Participant"),vt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Xt=r.getAll().filter(Ge=>{if(!vt.includes(Ge.type))return!1;const $t=Ge;return $t.id===O.id||Mc.has($t.id)||!$t.waypoints||$t.waypoints.length<2?!1:![$t.source,$t.target].some(Ot=>!Ot||oe.has(Ot.id))}),je=(Ge,$t)=>se.every(Ot=>{var ra;const _t={id:Ot.id,type:Ot.type,x:Ot.x+Ge,y:Ot.y+$t,width:Ot.width,height:Ot.height};return De&&(_t.x<De.x||_t.x+_t.width>De.x+De.width||_t.y<De.y||_t.y+_t.height>De.y+De.height)||!Sp((ra=P.get(Ot.id))==null?void 0:ra.node.lane,Ot,Ot.y+$t+Ot.height/2)||Ct.some(Xn=>_t.x<Xn.x+Xn.width+Ii&&_t.x+_t.width+Ii>Xn.x&&_t.y<Xn.y+Xn.height+Ii&&_t.y+_t.height+Ii>Xn.y)?!1:Xt.every(Xn=>{for(let go=0;go+1<Xn.waypoints.length;go++)if(Go(Xn.waypoints[go],Xn.waypoints[go+1],_t)<Ii)return!1;return!0})}),Xe=B.x+B.width/2,mt=B.y+B.height/2,it=N.waypoints??[],Pt=it.length>=2&&Math.abs(it[0].y-it[1].y)<1&&it[1].x<it[0].x;return[...D!==void 0?[{cx:Xe,cy:D}]:[],...Pt?[{cx:B.x-wr-S.width/2,cy:it[0].y}]:[],{cx:Xe,cy:mt+he},{cx:Xe,cy:mt-he}].find(Ge=>je(Ge.cx-(S.x+S.width/2),Ge.cy-(S.y+S.height/2)))})(),ge=ae&&!Q?J:T.x,$e=(()=>{var mt;if(L||ae)return 0;const De=N.label,Ct=((mt=O.businessObject)==null?void 0:mt.name)??"";if(!De||De.width==null||!Ct.trim())return 0;const vt=J+wr,Xt=B.y+B.height/2-S.height/2;if(Math.min(De.y+De.height,Xt+S.height)-Math.max(De.y,Xt)<3||De.x+De.width-vt<3)return 0;const Xe=De.x+De.width+rF-vt;return Xe<=S.width?Xe:0})();$e>0&&u.add(O.id);const Oe=S.y+S.height/2,Ze=aF(se,J+wr+$e-ye,[0,B.y+B.height/2-Oe,T.y+T.height/2-Oe],ge,J,B.y+B.height/2),Ae=J+wr+$e+Ze,Pe=(()=>{if(j===void 0)return 0;const De=J+wr,Ct=B.y+B.height/2-S.height/2,vt={x:De,y:Ct,width:te-ye,height:S.height},Xt=h(B);return((Xt==null?void 0:Xt.children)??[]).some(Xe=>Ni(Xe)&&!oe.has(Xe.id)&&Xe.id!==B.id&&Xe.id!==T.id&&Xe.type!=="bpmn:Group"&&Xe.type!=="bpmn:Participant"&&Xe.x<vt.x+vt.width&&Xe.x+Xe.width>vt.x&&Xe.y<vt.y+vt.height&&Xe.y+Xe.height>vt.y)||ue(vt)?Math.max(0,j-De):0})(),Ce=Q?0:te-ye+wr*2+Ze+Pe+$e-(ae?0:T.x-J);let Te=[];if(Ce>0){const De=h(S),Ct=(De==null?void 0:De.children)??[],vt=it=>it.type==="bpmn:Lane";Te=(()=>{const it=new Set;for(const qe of Ct)Ni(qe)&&!oe.has(qe.id)&&qe.id!==B.id&&qe.x>=ge&&it.add(qe.id);const Pt=[];for(const qe of Ct){if(qe.type!=="bpmn:DataStoreReference"&&qe.type!=="bpmn:DataObjectReference")continue;const Ge=qe,Ot=[...Ge.incoming??[],...Ge.outgoing??[]].filter(_t=>_t.type==="bpmn:DataInputAssociation"||_t.type==="bpmn:DataOutputAssociation").map(_t=>_t.source===Ge?_t.target:_t.source);Ot.length&&Ot.every(_t=>_t!==void 0&&it.has(_t.id))&&Pt.push(Ge)}return Pt})();const je=Ct.filter(it=>!("waypoints"in it&&it.waypoints)&&!vt(it)&&it.type!=="label"&&!oe.has(it.id)&&it.id!==B.id&&it.x>=ge),Xe=je.flatMap(it=>it.labels??[]),mt=De?[De,...Ct.filter(it=>vt(it))]:[];if(je.length){const it=new Set(je.map(rt=>rt.id)),Pt=dS(it),qe=Pt.length?pF(it,Pt,De):null,Ge=rt=>{const Et=new Set(it);for(const Ft of rt)for(const Io of Ft.subtree)Et.add(Io.id);return uF(Et)},$t=Ge(Pt),Ot=qe?Ge(qe):$t,_t=Yg(it),ra=new Set(it);for(const rt of Pt)for(const Et of rt.subtree)ra.add(Et.id);const Xn=Pt.length?Yg(ra):_t,go=(()=>{if(!qe)return[];const rt=new Set(it);for(const Et of qe)for(const Ft of Et.subtree)rt.add(Ft.id);return Yg(rt)})(),as=qe??Pt,aa=(()=>{const rt=new Set(it);for(const Et of as)for(const Ft of Et.subtree)rt.add(Ft.id);return dF(rt,De)})(),om=aa.length?Ge([...as,...aa]):$t,qi=new Set([...je,...mt].map(rt=>rt.id)),bt=Ct.filter(rt=>{const Et=rt.labelTarget;return rt.type==="label"&&!!Et&&"waypoints"in Et&&!!Et.source&&!!Et.target&&qi.has(Et.source.id)&&qi.has(Et.target.id)}),Cn=cF();n.createSpace([...je,...Xe,...bt],mt,{x:Ce,y:0},"e",ge-1);const Zt=(rt,Et,Ft)=>{const Io=Er(),Op=Ft?fS(Ft):null,Dp=ns(rt,Ce,!!Ft);if(!Dp)return!1;const kc=Et.length?aS(Et,Ce):null,Lp=Er(),Jt=!!Ft&&!!Op&&[...fS(Ft)].some(ca=>!Op.has(ca));return Lp.messages>Io.messages&&Lp.lines>=Io.lines&&!Jt?!0:(kc==null||kc(),Dp(),!1)},gi=aa.length>0&&Zt([...as,...aa],qe?go:Xn,new Set(aa.flatMap(rt=>rt.subtree.map(Et=>Et.id)))),sa=!gi&&qe?Zt(qe,go):!1;let mo=gi||sa;!mo&&Pt.length&&(mo=Zt(Pt,Xn));const ss=gi?om:sa?Ot:$t;if(!mo){for(const rt of Pt){const Et=Er(),Ft=ns([rt],Ce);if(!Ft)continue;const Io=Er();(Io.messages<=Et.messages||Io.lines<Et.lines)&&Ft()}if(_t.length){const rt=Er(),Et=aS(_t,Ce);if(Et){const Ft=Er();(Ft.messages<=rt.messages||Ft.lines<rt.lines)&&Et()}}}if(lF(Cn),ss.length){const rt=()=>new Set(ut(Ve(r)).map(Ft=>ct(Ft))),Et=Ft=>{const Io=lS(),Op=rt(),Dp=Ft.map(Jt=>({a:Jt,x:Jt.x,y:Jt.y})),kc=r.filter(Jt=>Jt.type==="label").map(Jt=>({label:Jt,x:Jt.x,y:Jt.y}));n.moveElements(Ft,{x:Ce,y:0});const Lp=[...rt()].filter(Jt=>!Op.has(Jt));if(lS()<Io&&Lp.length===0)return!0;for(const{a:Jt,x:ca,y:Oc}of Dp)(Jt.x!==ca||Jt.y!==Oc)&&n.moveElements([Jt],{x:ca-Jt.x,y:Oc-Jt.y});for(const Jt of kc){const ca=Jt.x-Jt.label.x,Oc=Jt.y-Jt.label.y;(ca!==0||Oc!==0)&&n.moveElements([Jt.label],{x:ca,y:Oc})}return!1};if(!Et(ss)&&ss.length>1)for(const Ft of ss)Et([Ft])}}}const fe=_.node.lane!==void 0?f(_.node.lane):_.node.participant!==void 0?f(_.node.participant):void 0,Me=De=>{if(!fe)return!0;const Ct=De.y+De.height/2;return Ct>=fe.y&&Ct<=fe.y+fe.height},ke=!Me(B)&&Me(T),Fe=De=>De.y+De.height/2,wt=()=>{const De=B.x+B.width,Ct=T.x,vt=Fe(T)-S.height/2,Xt=Fe(T)+S.height/2;return!r.getAll().some(je=>Ni(je)&&je.type!=="bpmn:Participant"&&je.type!=="bpmn:Group"&&je.type!=="bpmn:TextAnnotation"&&je.id!==B.id&&je.id!==T.id&&je.id!==S.id&&je.x<Ct&&je.x+je.width>De&&je.y<Xt&&je.y+je.height>vt)},an=!ke&&_.band!==void 0&&Me(T)&&!Wi(_.node.lane,_.node.participant,_.band,Fe(B))&&Wi(_.node.lane,_.node.participant,_.band,Fe(T))&&T.x>=B.x+B.width&&wt(),Yt=ke||an?T:B,Kt=Yt.y+Yt.height/2,jn=Kt-(S.y+S.height/2),_n=_.band!==void 0,kp=_n?[S]:se,im=(_.band===void 0||Wi(_.node.lane,_.node.participant,_.band,Kt))&&xt(x.target)&&kp.every(De=>{var Ct;return Sp((Ct=P.get(De.id))==null?void 0:Ct.node.lane,De,De.y+De.height/2+jn)}),NF=De=>Math.abs(De.y+De.height/2-(S.y+S.height/2))<=he/2;if(im&&_n){const De=Math.abs(jn)<=he/2?se.filter(je=>je.id!==S.id&&NF(je)):[],Ct=S.y+S.height/2,Xt=_.band!==void 0&&!Wi(_.node.lane,_.node.participant,_.band,Ct)?se.filter(je=>{var Xe,mt;return je.id!==S.id&&!De.includes(je)&&((Xe=P.get(je.id))==null?void 0:Xe.band)===_.band&&((mt=P.get(je.id))==null?void 0:mt.node.lane)===_.node.lane&&(Math.abs(je.y+je.height/2-Ct)<=he/2||Wi(_.node.lane,_.node.participant,_.band,je.y+je.height/2))}).map(je=>({t:je,dy:Kt-(je.y+je.height/2)})).filter(({dy:je})=>je!==0):[];if(n.moveElements(se,{x:Ae-ye,y:0},void 0,ve),n.moveElements([S],{x:0,y:jn},void 0,ve),De.length){const je=()=>new Set(ut(Ve(r)).map(Ge=>ct(Ge))),Xe=je(),mt=r.filter(Ge=>Ge.type==="label").map(Ge=>({label:Ge,x:Ge.x,y:Ge.y}));n.moveElements(De,{x:0,y:jn});const it=je(),Pt=[...it].filter(Ge=>!Xe.has(Ge)).length,qe=[...Xe].filter(Ge=>!it.has(Ge)).length;if(Pt>qe){n.moveElements(De,{x:0,y:-jn});for(const Ge of mt){const $t=Ge.x-Ge.label.x,Ot=Ge.y-Ge.label.y;($t!==0||Ot!==0)&&n.moveElements([Ge.label],{x:$t,y:Ot})}}}if(Xt.length){const je=new Set(se.map(Xe=>Xe.id));for(const{t:Xe,dy:mt}of Xt)R(Xe.parent,Xe,Xe.x+Xe.width/2,Xe.y+Xe.height/2+mt,je)||n.moveElements([Xe],{x:0,y:mt})}}else n.moveElements(se,{x:Ae-ye,y:im?jn:0},void 0,ve);const Ui=h(S);if(!im&&_.node.lane===void 0&&_.band!==void 0&&Ui){const De=Ui.y+le+on(`pool:${_.node.participant??""}`,_.band)*he,Ct=De-(S.y+S.height/2);Ct!==0&&!R(Ui,S,S.x+S.width/2,De,oe)&&n.moveElements([S],{x:0,y:Ct},void 0,ve)}if(Q)n.moveElements(se,{x:Q.cx-(S.x+S.width/2),y:Q.cy-(S.y+S.height/2)},void 0,ve);else if(Ui){const De=(Ui.children??[]).filter(je=>Ni(je)&&!oe.has(je.id)&&je.type!=="bpmn:Group"&&je.type!=="bpmn:Participant"),Ct=(je,Xe,mt,it,Pt)=>je.x+Xe<Pt.x+Pt.width+it&&je.x+Xe+je.width+it>Pt.x&&je.y+mt<Pt.y+Pt.height+it&&je.y+mt+je.height+it>Pt.y,vt=De.find(je=>Ct(S,0,0,0,je)),Xt=vt?void 0:ue(S);if(vt||Xt){const je=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Xe=r.getAll().filter(bt=>{if(!je.includes(bt.type))return!1;const Cn=bt;return Mc.has(Cn.id)||!Cn.waypoints||Cn.waypoints.length<2?!1:![Cn.source,Cn.target].some(Zt=>!Zt||oe.has(Zt.id))}),mt=(bt,Cn,Zt)=>{var gi;return Sp((gi=P.get(bt.id))==null?void 0:gi.node.lane,bt,bt.y+Zt+bt.height/2)&&bt.x+Cn>=Ui.x&&bt.x+Cn+bt.width<=Ui.x+Ui.width&&bt.y+Zt>=Ui.y&&bt.y+Zt+bt.height<=Ui.y+Ui.height},it=(bt,Cn)=>se.every(Zt=>mt(Zt,bt,Cn)&&!De.some(gi=>Ct(Zt,bt,Cn,Ii,gi))&&Xe.every(gi=>{const sa={id:Zt.id,type:Zt.type,x:Zt.x+bt,y:Zt.y+Cn,width:Zt.width,height:Zt.height};for(let mo=0;mo+1<gi.waypoints.length;mo++)if(Go(gi.waypoints[mo],gi.waypoints[mo+1],sa)<Ii)return!1;return!0})),Pt=S.y+S.height/2,qe=[D,T.y+T.height/2].filter(bt=>bt!==void 0&&Math.abs(bt-Pt)>=1),Ge=vt&&ie.has(vt.id)?vt:Xt==null?void 0:Xt.target,$t=Ge?Ge.x-S.x:0,Ot=Math.max(...se.map(bt=>bt.x+bt.width)),_t=[...$t!==0?[$t]:[],...Ze!==0?[-Ze]:[],0],ra=j===void 0?[]:_t.map(bt=>Math.max(bt,j-S.x)),Xn=bt=>Ot+bt+wr<=T.x,go=[...new Set([...ra,..._t])].filter(Xn),as=vt&&ie.has(vt.id)?[vt.x+vt.width+wr-S.x]:[],aa=j===void 0?[]:as.map(bt=>Math.max(bt,j-S.x)),om=[...new Set([...aa,...as])].filter(bt=>Xn(bt)&&!go.includes(bt));let qi;for(const bt of[go,om]){for(const Cn of qe){for(const Zt of bt)if(it(Zt,Cn-Pt)){qi={dx:Zt,dy:Cn-Pt};break}if(qi)break}if(qi)break}if(qi){const bt=rt=>{const Et=rt;return[Et.edge,Et.other,...Array.isArray(Et.edges)?Et.edges:[]].some(Ft=>typeof Ft=="string"&&Mc.has(Ft))},Cn=()=>new Set(ut(Ve(r)).filter(rt=>!bt(rt)).map(rt=>ct(rt))),Zt=Cn(),gi=r.filter(rt=>rt.type==="label").map(rt=>({label:rt,x:rt.x,y:rt.y}));n.moveElements(se,{x:qi.dx,y:qi.dy},void 0,ve);const sa=Cn(),mo=[...sa].filter(rt=>!Zt.has(rt)).length,ss=[...Zt].filter(rt=>!sa.has(rt)).length;if(mo>ss){n.moveElements(se,{x:-qi.dx,y:-qi.dy},void 0,ve);for(const rt of gi){const Et=rt.x-rt.label.x,Ft=rt.y-rt.label.y;(Et!==0||Ft!==0)&&n.moveElements([rt.label],{x:Et,y:Ft})}}else L&&Kg.set(O.id,{exit:L,channelY:D,label:H})}}}{const De=new Set(se.map(Xe=>Xe.id)),Ct=new Set(G.map(Xe=>Xe.flow.id)),vt=20,Xt=Xe=>{const mt=Xe.source,it=Xe.target,Pt=Math.min(mt.x,it.x)-vt,qe=Math.max(mt.x+mt.width,it.x+it.width)+vt,Ge=Math.min(mt.y,it.y)-vt,$t=Math.max(mt.y+mt.height,it.y+it.height)+vt;return Xe.waypoints.some(Ot=>Ot.x<Pt||Ot.x>qe||Ot.y<Ge||Ot.y>$t)},je=new Map;for(const Xe of se)for(const mt of[...Xe.incoming??[],...Xe.outgoing??[]])(F.has(mt.id)||mt.id!==x.id&&Ct.has(mt.id))&&!(De.has(mt.source.id)&&De.has(mt.target.id))&&je.set(mt.id,mt);for(const Xe of je.values())Xt(Xe)&&Mp(Xe)}const ho=Te.length?h(Te[0]):void 0;if(ho){const De={assoc:cS(),overlaps:pS(ho),crosses:uS()},Ct=Te.map(qe=>({st:qe,x:qe.x})),vt=r.filter(qe=>qe.type==="label").map(qe=>({label:qe,x:qe.x,y:qe.y})),Xt=Math.min(...Te.flatMap(qe=>[...qe.incoming??[],...qe.outgoing??[]].filter(Ge=>Ge.type==="bpmn:DataInputAssociation"||Ge.type==="bpmn:DataOutputAssociation").map(Ge=>(Ge.source===qe?Ge.target:Ge.source).x))),je=new Set(Te.map(qe=>qe.id)),Xe=(ho.children??[]).filter(Ni).filter(qe=>!je.has(qe.id));let mt=Xt;for(const qe of[...Te].sort((Ge,$t)=>Ge.x-$t.x)){let Ge=mt;for(let $t=0;$t<100;$t++){const Ot=Xe.find(_t=>Ge<_t.x+_t.width+Bi&&Ge+qe.width+Bi>_t.x&&qe.y<_t.y+_t.height&&qe.y+qe.height>_t.y);if(!Ot)break;Ge=Ot.x+Ot.width+Bi}Ge!==qe.x&&n.moveElements([qe],{x:Ge-qe.x,y:0}),mt=Ge+qe.width+Bi}const it=mt+150-(ho.x+ho.width);it>0&&ts(ho,ho.width+it);const Pt={assoc:cS(),overlaps:pS(ho),crosses:uS()};if(Pt.assoc>=De.assoc||Pt.overlaps>De.overlaps||Pt.crosses>De.crosses){for(const{st:qe,x:Ge}of Ct)qe.x!==Ge&&n.moveElements([qe],{x:Ge-qe.x,y:0});it>0&&ts(ho,ho.width-it);for(const qe of vt){const Ge=qe.x-qe.label.x,$t=qe.y-qe.label.y;(Ge!==0||$t!==0)&&n.moveElements([qe.label],{x:Ge,y:$t})}}}}for(const[x,_]of Gg){const S=f(x);if(!S)continue;const O=_.container,B=Math.abs(S.y+S.height/2-O.y-_.relCy)>=.5,T=S.label,N=Math.min(S.y,T&&!T.hidden?T.y:S.y),L=Math.max(S.y+S.height,T&&!T.hidden?T.y+T.height:0);if(B&&N>=O.y&&L<=O.y+O.height)continue;const D=S.y;_.grow(),S.y!==D&&n.moveElements([S],{x:0,y:D-S.y},void 0,{autoResize:!1})}const hS=(x,_)=>{const S=_.target===x,O=g(_.source),B=g(_.target),T=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,B,_.id?{type:T,businessObject:i.create(T,{id:_.id})}:{type:T})},gS=x=>{for(const _ of w){if(!_.participant.blackBox)continue;const S=f(_.participant.id);if(!S)continue;const O=[];for(const T of b){const N=T.flow.source===_.participant.id?T.flow.target:T.flow.target===_.participant.id?T.flow.source:void 0,L=N?f(N):void 0;L&&typeof L.x=="number"&&L.type!=="bpmn:Participant"&&O.push(L)}if(!O.length)continue;if(!x&&_.order===void 0){const T=(()=>{var L;const N=new Map;for(const D of O){const H=h(D);if(!H)continue;const j=N.get(H.id);j?j.n+=1:N.set(H.id,{shape:H,n:1})}return(L=[...N.values()].sort((D,H)=>H.n-D.n)[0])==null?void 0:L.shape})();if(T){const N=H=>H.reduce((j,Z)=>j+Z,0)/H.length,L=N(O.map(H=>H.y+H.height/2))<T.y+T.height/2,D=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==_.participant.id&&H.id!==T.id).filter(H=>L?H.y+H.height<=T.y+5:H.y>=T.y+T.height-5);if(D.length){const H=[...D.reduce((ae,Q)=>ae.set(Q.y,(ae.get(Q.y)??0)+1),new Map)].sort((ae,Q)=>Q[1]-ae[1]||(L?Q[0]-ae[0]:ae[0]-Q[0]))[0][0],j=Math.min(S.width,PA),Z=TA,ie=O.map(ae=>ae.x+ae.width/2),ue=Math.round(N(ie)-j/2),se=Math.max(...ie)+kd,oe=ae=>({x:ae,width:Math.max(j,se-ae)}),ve=D.filter(ae=>Math.min(ae.y+ae.height,H+Z)-Math.max(ae.y,H)>0),ye=ae=>{const Q=oe(ae);return ve.some(ge=>ge.x<Q.x+Q.width&&Q.x<ge.x+ge.width)},te=ae=>{const Q=oe(ae);return ie.filter(ge=>ge>=Q.x+10&&ge<=Q.x+Q.width-10).length},J=(()=>{if(!ye(ue))return ue;const ae=te(ue);return ve.flatMap(Q=>[Q.x+Q.width+Xy,Q.x-Xy-j]).map(Q=>Math.round(Q)).filter(Q=>!ye(Q)&&te(Q)>=ae).sort((Q,ge)=>Math.abs(Q-ue)-Math.abs(ge-ue))[0]??ue})();if(J!==S.x||H!==S.y||j!==S.width||Z!==S.height){const ae=()=>new Set(ut(Ve(r)).map(Ae=>ct(Ae))),Q=ae(),ge={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:J,y:H,width:j,height:Z});const $e=ae(),Oe=[...$e].filter(Ae=>!Q.has(Ae)).length,Ze=[...Q].filter(Ae=>!$e.has(Ae)).length;Oe>Ze&&n.resizeShape(S,ge)}}}}const B=Math.max(...O.map(T=>T.x+T.width/2))+kd;if(B>S.x+S.width&&n.resizeShape(S,{x:S.x,y:S.y,width:B-S.x,height:S.height}),!!x)for(const T of b){const N=f(T.flow.id),L=T.flow.source===_.participant.id?T.flow.target:T.flow.target===_.participant.id?T.flow.source:void 0,D=L?f(L):void 0;if(!N||!D||D.type==="bpmn:Participant")continue;const H=D.x+D.width/2;H<S.x+10||H>S.x+S.width-10||sS(N,S,D)}}};gS(!1);for(const x of b){const _=x.flow;n.connect(g(_.source),g(_.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:_.id,name:_.name})})}{const S=new Set([...G.map(D=>D.flow.id),...b.map(D=>D.flow.id)].filter(D=>!!D)),O=r.filter(D=>!!D.waypoints),B=(D,H)=>Math.abs(H.x-D.x)<2?"L":Math.abs(H.x-(D.x+D.width))<2?"R":Math.abs(H.y-D.y)<2?"T":Math.abs(H.y-(D.y+D.height))<2?"B":void 0,T=new Map,N=(D,H,j)=>{if(!D||!H||typeof D.x!="number")return;const Z=B(D,H);if(!Z)return;let ie=T.get(D.id);ie||T.set(D.id,ie=new Map),ie.set(Z,[...ie.get(Z)??[],j])};for(const D of O){const H=D.waypoints;!H||H.length<2||(N(D.source,H[0],{id:D.id,dir:"out"}),N(D.target,H[H.length-1],{id:D.id,dir:"in"}))}const L=new Set;for(const[D,H]of T){const j=f(D);if(!j||typeof j.x!="number")continue;const Z=te=>{var ae;const J=(ae=f(te.id))==null?void 0:ae.source;return!!J&&typeof J.x=="number"&&J.x+J.width/2>j.x+j.width/2};if(![...H.values()].some(te=>te.length>=3&&te.some(J=>J.dir==="out")&&te.some(J=>J.dir==="in"&&S.has(J.id)&&Z(J))))continue;const ue=h(j);if(!ue||L.has(ue.id)||(ue.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const se=(FS=H.get("T"))!=null&&FS.length?(jS=H.get("B"))!=null&&jS.length?void 0:"B":"T";if(!se||(se==="T"?j.y-ue.y:ue.y+ue.height-(j.y+j.height))>=he)continue;const ve=(ue.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),ye=ue.y+ue.height;n.resizeShape(ue,{x:ue.x,y:ue.y,width:ue.width,height:ue.height+he}),Un(ye,ue.id,he),se==="T"&&ve.length&&n.moveElements(ve,{x:0,y:he}),L.add(ue.id)}}const Xg=20,mS=4,hF=3,gF=2,mF=2,yF=[10,30,80],na=()=>{const x=Ve(r);return{bad:ut(x).filter(_=>_.kind==="edge-crosses-shape"||_.kind==="edge-overlap-opposite"||_.kind==="edge-overlap-mixed").length,crossings:Zm(x),straight:x.edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.waypoints.length===2).length}},Sr=x=>{const _=Ve(r),S=_.edges.find(O=>O.id===x);return S?Tt(S,kn(_)).length:0},Ac=x=>Sr(x)>0,is=x=>Ve(r).edges.filter(_=>_.type==="bpmn:MessageFlow"&&_.id!==x&&_.waypoints.length===2).length,yS=(x,_,S)=>ns([{subtree:x,pool:_}],S),vS=(x,_)=>_.bad>x.bad||_.crossings>x.crossings&&_.straight<=x.straight&&_.bad>=x.bad,os=(x,_)=>vS(x,_)||_.straight<x.straight,Rr=(x,_,S=()=>!0,O=vS,B=!1)=>{const T=na(),N=ns(x,_,B);if(!N)return!1;const L=na();return O(T,L)||!S()?(N(),!1):!0},vF=(x,_,S,O=()=>!0)=>Rr([{subtree:x,pool:_}],S,O),ia=x=>{var _;return!!((_=P.get(x))!=null&&_.node.participant)},rs=new Map;for(const x of b){if(!ia(x.flow.target))continue;const _=rs.get(x.flow.target)??[];_.push(x),rs.set(x.flow.target,_)}const Pc=[...rs.keys()],Zg=new Set(G.map(x=>x.flow.target)),xS=x=>Rp.findIndex(({op:_})=>_.participant.id===x);Pc.sort((x,_)=>{var B,T;const S=Zg.has(x)?1:0,O=Zg.has(_)?1:0;return S!==O?S-O:xS((B=P.get(x))==null?void 0:B.node.participant)-xS((T=P.get(_))==null?void 0:T.node.participant)});const Cr=x=>x.x+x.width/2,xF=x=>{const _=new Map;for(const B of r.getAll()){const T=B;if(!T.waypoints||!T.source||!T.target)continue;(_.get(T.source.id)??_.set(T.source.id,[]).get(T.source.id)).push(T.target.id)}const S=new Set([x]),O=[x];for(let B=0;B<O.length;B++)for(const T of _.get(O[B])??[])S.has(T)||(S.add(T),O.push(T));return S},bF=(x,_)=>{const S=xF(_);let O;for(const B of r.getAll()){const T=B;if(T.type!=="bpmn:MessageFlow"||!T.source||!T.target||T.target.id!==x||S.has(T.source.id))continue;const N=T.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const L=Cr(N);(O===void 0||L>O)&&(O=L)}return O},Jg=(x,_)=>{const S=f(x.flow.source);if(S)return S.type==="bpmn:Participant"?bF(S.id,_):Cr(S)},bS=x=>{let _;for(const S of rs.get(x)??[]){const O=Jg(S,x);O!==void 0&&(!_||O>_.cx)&&(_={op:S,cx:O})}return _==null?void 0:_.op},wF=x=>{const _=bS(x),S=f(x),O=_?Jg(_,x):void 0;return S&&O!==void 0?O-Cr(S):void 0},_F=x=>{const _=wF(x);return _!==void 0&&Math.abs(_)<Xg},Ap=(x,_,S,O,B)=>{var T;for(let N=!0;N;){N=!1;for(const L of b){if(L.flow.id===S)continue;const D=_.has(L.flow.source),H=_.has(L.flow.target);if(D===H||O(D?L.flow.source:L.flow.target))continue;const j=D?L.flow.target:L.flow.source;if(B(j)||!ia(j))continue;const Z=f(L.flow.id);if(!(Z!=null&&Z.waypoints)||Z.waypoints.length!==2)continue;const ie=f(j),ue=(T=P.get(j))==null?void 0:T.node.participant;if(!ie||!ue)continue;const se=_r(j,oe=>oe.x>=ie.x).filter(oe=>!_.has(oe.id));if(!(!se.length||se.some(oe=>B(oe.id)))){for(const oe of se)_.add(oe.id);x.set(ue,[...x.get(ue)??[],...se]),N=!0}}}return[...x].map(([N,L])=>({subtree:L,pool:g(N)}))},wS=(x,_,S,O,B)=>Ap(new Map([[_,[...x]]]),new Set(x.map(T=>T.id)),O,T=>T===S,T=>T===B),Qg=x=>{const _=bS(x);if(!_)return null;const S=f(x),O=f(_.flow.source),B=Jg(_,x);if(!S||!O||B===void 0)return null;const T=B-Cr(S);if(T>=Xg){const N=P.get(x).node.participant,L=_r(x,D=>D.x>=S.x);return{groups:wS(L,N,x,_.flow.id,_.flow.source),dx:T}}if(-T>=Xg&&ia(_.flow.source)){const N=P.get(_.flow.source).node.participant,L=_r(_.flow.source,D=>D.x>=O.x&&!_F(D.id));return{groups:wS(L,N,_.flow.source,_.flow.id,x),dx:-T}}return null},_S=()=>Pc.map(x=>({id:x,plan:Qg(x)})).filter(x=>!!x.plan).sort((x,_)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))-Math.min(..._.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))).map(x=>x.id);for(let x=0;x<3;x++){const _=na(),S=[];for(const B of _S()){const T=Qg(B);if(!T)continue;const N=ns(T.groups,T.dx);N&&S.push(N)}if(!S.length)break;if(!os(_,na()))continue;for(const B of S.reverse())B();let O=!1;for(const B of _S()){const T=Qg(B);T&&Rr(T.groups,T.dx,()=>!0,os)&&(O=!0)}if(!O)break}for(const x of Pc){if(Zg.has(x))continue;const _=P.get(x);if(!_||_.node.lane!==void 0)continue;const S=Ke(_);if(S===void 0)continue;const O=f(x),B=O?h(O):void 0;if(!O||!B)continue;const T=B.y+le+on(`pool:${_.node.participant??""}`,S)*he,N=T-(O.y+O.height/2);N!==0&&!R(B,O,O.x+O.width/2,T)&&n.moveElements([O],{x:0,y:N})}const Pp=()=>{const x=r.filter(O=>O.type==="bpmn:Participant"),_=new Map(x.map(O=>[O.id,O]));let S=0;for(const{pools:[O,B]}of gd(x)){const T=_.get(O),N=_.get(B);S+=(Math.min(T.x+T.width,N.x+N.width)-Math.max(T.x,N.x))*(Math.min(T.y+T.height,N.y+N.height)-Math.max(T.y,N.y))}return S},em=new Set,ES=new Set;for(let x=0,_=!0;_&&x<hF;x++){_=!1;for(const S of Pc.flatMap(O=>rs.get(O)??[])){if(em.has(S.flow.id)||!Ac(S.flow.id))continue;const O=f(S.flow.target);if(!O)continue;const B=g(P.get(S.flow.target).node.participant),T=_r(S.flow.target,j=>j.x>=O.x),N=O.width+W,L=Sr(S.flow.id),D=is(S.flow.id),H=Pp();for(let j=1;j<=mS;j++){const Z=()=>Sr(S.flow.id)>=L||Pp()>H?!1:is(S.flow.id)>=D?!0:(ES.add(S.flow.id),!1);if(vF(T,B,N*j,Z)){em.add(S.flow.id),_=!0;break}}}}const SS=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const _=x.source,S=x.target;return!!_&&!!S&&S.x+S.width<_.x}).length;for(const x of Pc.flatMap(_=>rs.get(_)??[])){if(em.has(x.flow.id)||!ES.has(x.flow.id)||!Ac(x.flow.id))continue;const _=f(x.flow.target);if(!_)continue;const S=g(P.get(x.flow.target).node.participant),O=_r(x.flow.target,ie=>ie.x>=_.x),B=new Set(O.map(ie=>ie.id)),T=new Map;for(const ie of r.filter(ue=>ue.type==="bpmn:MessageFlow")){if(((HS=ie.waypoints)==null?void 0:HS.length)!==2||!ie.source||!ie.target)continue;const ue=B.has(ie.source.id);if(ue===B.has(ie.target.id))continue;const se=ue?ie.target:ie.source,oe=(zS=P.get(se.id))==null?void 0:zS.node.participant;!oe||T.has(se.id)||T.set(se.id,{subtree:[se],pool:g(oe)})}if(!T.size)continue;const N=_.width+W,L=Sr(x.flow.id),D=is(x.flow.id),H=Pp(),j=SS(),Z=()=>Sr(x.flow.id)<L&&is(x.flow.id)>=D&&Pp()<=H&&SS()<=j;for(let ie=1;ie<=gF&&!Rr([{subtree:O,pool:S},...T.values()],N*ie,Z);ie++);}const tm=b.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),RS=new Set(tm.map(x=>x.id));for(const x of r.filter(_=>_.type==="bpmn:MessageFlow"))RS.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&tm.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of tm){if(!Ac(x.id))continue;const _=f(x.source),S=f(x.target);if(!_||!S)continue;let O,B,T;if(x.preexisting){const[L,D]=_.type==="bpmn:Participant"?[S,_]:[_,S];if(O=Cr(L),O<D.x||O>D.x+D.width)continue;[B,T]=L.y<D.y?[L.y+L.height,D.y]:[D.y+D.height,L.y]}else{if(_.type==="bpmn:Participant"||S.type==="bpmn:Participant"||(O=_.x+_.width/2,Math.abs(O-(S.x+S.width/2))>15))continue;[B,T]=_.y<S.y?[_.y+_.height,S.y]:[S.y+S.height,_.y]}const N=[...P.values()].map(L=>f(L.node.id)).filter(L=>!!L&&L.id!==_.id&&L.id!==S.id).filter(L=>L.x<=O&&O<=L.x+L.width&&L.y+L.height>B&&L.y<T).sort((L,D)=>L.x-D.x);for(const L of N){const D=(GS=P.get(L.id))==null?void 0:GS.node.participant,H=D?f(D):void 0;if(!D||!H)continue;const j=[...P.values()].filter(J=>J.node.participant===D).map(J=>J.node.id),Z=J=>J.map(ae=>f(ae)).filter(ae=>!!ae),ue=[sF(L.id,J=>{var ae;return((ae=P.get(J.id))==null?void 0:ae.node.participant)===D}),Z(j)].filter(J=>J.length).map(J=>[{subtree:J,pool:H}]);if(x.preexisting){const J=Z(j);J.length&&ue.push(Ap(new Map([[D,[...J]]]),new Set(J.map(ae=>ae.id)),x.id,()=>!1,ae=>ae===_.id||ae===S.id))}const se=L.width+W,oe=Sr(x.id),ve=is(x.id),ye=()=>Sr(x.id)<oe&&is(x.id)>=ve;let te=!1;for(const J of ue){for(let ae=1;ae<=mS;ae++)if(Rr(J,se*ae,ye)){te=!0;break}if(te)break}if(!Ac(x.id))break}}const Tp=()=>{var _;const x=new Set;for(const S of ut(Ve(r)))S.kind!=="edge-crosses-shape"||RS.has(S.edge)||((_=f(S.edge))==null?void 0:_.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},EF=(x,_)=>na().bad>=x&&[...Tp()].some(S=>!_.has(S)),CS=x=>{var _,S;return Sr(x)===0&&((S=(_=f(x))==null?void 0:_.waypoints)==null?void 0:S.length)===2},SF=(x,_,S)=>{const O=new Set(x.flatMap(T=>T.subtree.map(N=>N.id))),B=[...Tp()].filter(T=>!S.has(T)).map(T=>T.split(">")[1]);return[...new Set(B)].filter(T=>O.has(T)&&T!==_.source&&T!==_.target)},RF=(x,_,S,O,B)=>{const T=x.map(H=>({...H,subtree:H.subtree.filter(j=>!B.includes(j.id))})).filter(H=>H.subtree.length),N=new Set(T.flatMap(H=>H.subtree.map(j=>j.id))),L=()=>B.every(H=>{const j=f(H);return!!j&&G.filter(Z=>Z.flow.target===H&&N.has(Z.flow.source)).every(Z=>{const ie=f(Z.flow.source);return!!ie&&ie.x+ie.width<=j.x})});return Rr(T,_,()=>CS(S.id)&&[...Tp()].every(H=>O.has(H))&&L(),os,!0)};for(const x of b){if(!Ac(x.flow.id))continue;const _=f(x.flow.id);if(((VS=_==null?void 0:_.waypoints)==null?void 0:VS.length)!==2)continue;const S=f(x.flow.source),O=f(x.flow.target);if(!S||!O||S.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!ia(x.flow.source)||!ia(x.flow.target)||Math.abs(Cr(S)-Cr(O))>mF)continue;const B=Cr(S),T=_.waypoints.map(oe=>oe.y),[N,L]=[Math.min(...T),Math.max(...T)],D=kn(Ve(r)).filter(oe=>oe.id!==S.id&&oe.id!==O.id&&oe.x<B&&B<oe.x+oe.width&&N<oe.y+oe.height&&oe.y<L);if(!D.length)continue;const H=(WS=P.get(x.flow.source))==null?void 0:WS.node.participant,j=(US=P.get(x.flow.target))==null?void 0:US.node.participant;if(!H||!j)continue;const Z=new Map;for(const[oe,ve,ye]of[[x.flow.source,S,H],[x.flow.target,O,j]]){const te=Z.get(ye)??[],J=_r(oe,ae=>ae.x>=ve.x).filter(ae=>!te.some(Q=>Q.id===ae.id));Z.set(ye,[...te,...J])}const ie=new Set([...Z.values()].flat().map(oe=>oe.id)),ue=Ap(Z,ie,x.flow.id,oe=>oe===x.flow.source||oe===x.flow.target,()=>!1),se=Math.max(...D.map(oe=>oe.x+oe.width));for(const oe of yF){const ve=se+oe-B;if(ve<=0)continue;const ye=na().bad,te=Tp();let J=[],ae=!0;const Q=()=>!CS(x.flow.id)||ae&&(J=SF(ue,x.flow,te),J.length)?!1:!EF(ye,te);if(Rr(ue,ve,Q,os))break;if(J.length&&(RF(ue,ve,x.flow,te,J)||(ae=!1,Rr(ue,ve,Q,os))))break}}{const x=T=>T.y+T.height/2,_=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const T=Ve(r),N=new Set(ut(T).flatMap(H=>H.kind==="edge-crosses-shape"?[`${H.edge}|${H.shape}`]:[])),L=T.shapes.filter(H=>!H.container&&_.test(H.type)),D=new Set;for(const H of T.edges){if(H.type!=="bpmn:SequenceFlow"&&H.type!=="bpmn:MessageFlow")continue;const j=new Set(H.endpoints);for(const Z of[H.waypoints[0],H.waypoints[H.waypoints.length-1]])for(const ie of L)ie.x-4<=Z.x&&Z.x<=ie.x+ie.width+4&&ie.y-4<=Z.y&&Z.y<=ie.y+ie.height+4&&j.add(ie.id);for(const Z of L)if(!(j.has(Z.id)||N.has(`${H.id}|${Z.id}`))){for(let ie=0;ie+1<H.waypoints.length;ie++)if(Go(H.waypoints[ie],H.waypoints[ie+1],Z)<=qg){D.add(`${H.id}|${Z.id}`);break}}}return D},O=()=>({...na(),grazes:S()}),B=[];for(const T of P.keys()){if(!ia(T))continue;const N=G.filter(H=>H.flow.target===T);if(N.length!==1)continue;const L=f(N[0].flow.source),D=f(T);!L||!D||!P.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=W+1||B.push({id:T,pred:L,node:D})}B.sort((T,N)=>T.node.x-N.node.x);for(const{id:T}of B){const N=P.get(T),L=f(T),D=f(G.find(J=>J.flow.target===T).flow.source);if(!L||!D)continue;const H=L.x-(D.x+D.width);if(H<=W+1)continue;const j=g(N.node.participant),Z=_r(T,J=>J.x>=L.x),ie=-(H-W),ue=(J,ae)=>ae.bad>J.bad||ae.crossings>=J.crossings||ae.straight<J.straight||[...ae.grazes].some(Q=>!J.grazes.has(Q)),se=Ap(new Map([[N.node.participant,[...Z]]]),new Set(Z.map(J=>J.id)),"",()=>!1,()=>!1),oe=se.some(J=>J.pool!==j)||se.reduce((J,ae)=>J+ae.subtree.length,0)>Z.length,ve=O(),ye=yS(Z,j,ie);if(!ye)continue;const te=O();if(oe&&!ue(ve,te)){ye();const J=ns(se,ie);if(J){const ae=O();if(!ue(ve,ae)&&ae.bad<=te.bad&&ae.crossings<=te.crossings)continue;J()}yS(Z,j,ie);continue}ue(ve,te)&&ye()}}gS(!0);const CF=10,MF=400,AF=x=>[...x.incoming??[],...x.outgoing??[]].filter(_=>_.type==="bpmn:DataInputAssociation"||_.type==="bpmn:DataOutputAssociation").map(_=>_.source===x?_.target:_.source).filter(_=>!!_&&typeof _.y=="number"),PF=r.filter(x=>x.type==="bpmn:DataStoreReference"&&y.has(x.id)),TF=(x,_)=>{const S=x.x+x.width/2,O=x.y+x.height/2;let B;for(const T of PF){if((h(T)??d())!==_||T.y<x.y+x.height)continue;const N=Math.abs(T.x+T.width/2-S);N>MF||N<T.width||!AF(T).some(D=>D.height===x.height&&Math.abs(D.y+D.height/2-O)<=CF&&T.y>=D.y+D.height)||(!B||N<B.dx||N===B.dx&&T.id<B.id)&&(B={dx:N,id:T.id,cy:T.y+T.height/2})}return B==null?void 0:B.cy};for(const x of E){const _=x.associations??[],S=_.map(T=>T.source===x.dataStore.id?T.target:T.source).map(f).find(Boolean),O=S?h(S)??d():d(),B=S?{x:S.x+S.width/2,y:TF(S,O)??S.y+S.height+110}:{x:200,y:Rc+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},B,O);for(const T of _)hS(x.dataStore.id,T)}for(const x of C){const S=g(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;hS(S,x.association)}let MS=0;const oa=10,AS=40,kF=(x,_)=>{const S=_.map(D=>h(D)).filter(D=>!!D);for(const D of S){const H=oa,j=D.y,Z=D.y+D.height,ie=D.x,ue=D.x+D.width;if(Math.abs(x.y-j)<H){const se=j+H-x.y;x.y+=se,x.height-=se}if(Math.abs(x.y+x.height-Z)<H&&(x.height=Z-H-x.y),Math.abs(x.x-ie)<H){const se=ie+H-x.x;x.x+=se,x.width-=se}Math.abs(x.x+x.width-ue)<H&&(x.width=ue-H-x.x)}if(!S.length)return;const O=Math.min(...S.map(D=>D.y)),B=Math.max(...S.map(D=>D.y+D.height)),T=O-x.y,N=x.y+x.height-B,L=AS-oa;if(T>0!=N>0)if(T>0&&T<L){const D=T+oa;x.y+=D,x.height-=D}else N>0&&N<L&&(x.height-=N+oa)},OF=(x,_)=>{const S=oa,O=30,B=r.filter(T=>T.type==="bpmn:Group"&&T.id!==_);for(const T of B){const N=T.x,L=T.x+T.width,D=T.y,H=T.y+T.height,j=x.y<H&&D<x.y+x.height,Z=x.x<L&&N<x.x+x.width;if(j){if(Math.abs(x.x-L)<S){const ie=Math.min(L+S-x.x,O);ie>0&&x.width-ie>0&&(x.x+=ie,x.width-=ie)}if(Math.abs(x.x+x.width-N)<S){const ie=Math.min(x.x+x.width-(N-S),O);ie>0&&x.width-ie>0&&(x.width-=ie)}}if(Z){if(Math.abs(x.y-H)<S){const ie=Math.min(H+S-x.y,O);ie>0&&x.height-ie>0&&(x.y+=ie,x.height-=ie)}if(Math.abs(x.y+x.height-D)<S){const ie=Math.min(x.y+x.height-(D-S),O);ie>0&&x.height-ie>0&&(x.height-=ie)}}}},nm=(x,_)=>{const S=AS,O=Math.min(...x.map(D=>D.x))-S,B=Math.min(...x.map(D=>D.y))-S,T=Math.max(...x.map(D=>D.x+D.width))+S,N=Math.max(...x.map(D=>D.y+D.height))+S,L={x:O,y:B,width:T-O,height:N-B};return kF(L,x),OF(L,_),L};for(const x of k){const _=(x.group.members??[]).map(f).filter(B=>!!B);let S;_.length?S=nm(_,x.group.id):(S={x:300+MS*350,y:40,width:300,height:200},MS++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:S.width,height:S.height},{x:S.x+S.width/2,y:S.y+S.height/2},d());x.group.name&&n.updateLabel(O,x.group.name),(qS=x.group.members)!=null&&qS.length&&K(O,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(B=>!!B.waypoints),_=new Map,S=(B,T)=>{!B||!T||(_.has(B)||_.set(B,new Set),_.get(B).add(T))};for(const B of x){const T=(YS=B.source)==null?void 0:YS.id,N=(KS=B.target)==null?void 0:KS.id;S(T,N),((XS=B.type)!=null&&XS.includes("DataOutputAssociation")||(ZS=B.type)!=null&&ZS.includes("DataInputAssociation")||B.type==="bpmn:Association")&&S(N,T)}const O=r.filter(B=>B.type==="bpmn:Group");for(const B of O){const N=(((JS=B.businessObject.extensionElements)==null?void 0:JS.values)??[]).find(ye=>ye.$type==="bwl:Members"),L=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!L.length)continue;const D=new Set(L),H=[...L];for(;H.length;){const ye=H.shift();for(const te of _.get(ye)??[])D.has(te)||(D.add(te),H.push(te))}const j=B.x,Z=B.x+B.width,ie=B.y,ue=B.y+B.height,se=ye=>G.filter(te=>te.flow.target===ye).length,oe=ye=>{var J;const te=((J=f(ye))==null?void 0:J.type)??"";if(te==="bpmn:StartEvent"&&se(ye)===0)return!1;if(te.endsWith("Gateway")){const ae=G.filter(Q=>Q.flow.target===ye).map(Q=>Q.flow.source);if(ae.length&&ae.every(Q=>{var ge;return((ge=f(Q))==null?void 0:ge.type)==="bpmn:StartEvent"&&se(Q)===0}))return!1}return!0},ve=r.filter(ye=>Ni(ye)).filter(ye=>ye.type!=="bpmn:Group"&&ye.type!=="bpmn:Participant"&&ye.type!=="bpmn:TextAnnotation"&&!D.has(ye.id)&&ia(ye.id)&&oe(ye.id)&&ye.x<Z&&ye.x+ye.width>j&&ye.y<ue&&ye.y+ye.height>ie);if(ve.length)for(const ye of[-1,1]){const te=ve.filter(Pe=>(Pe.x+Pe.width-j<=Z-Pe.x?-1:1)===ye);if(!te.length)continue;const J=[];for(const Pe of te){const Ce=J.find(Te=>Te.some(fe=>Pe.y<fe.y+fe.height&&Pe.y+Pe.height>fe.y));Ce?Ce.push(Pe):J.push([Pe])}const ae=new Map;for(const Pe of J){let Ce=ye<0?j-oa:Z+oa;for(const Te of[...Pe].sort((fe,Me)=>ye<0?Me.x-fe.x:fe.x-Me.x)){const fe=ye<0?Math.min(Te.x,Ce-Te.width):Math.max(Te.x,Ce);Ce=ye<0?fe-Bi:fe+Te.width+Bi,fe!==Te.x&&Math.sign(fe-Te.x)===ye&&ae.set(Te.id,fe-Te.x)}}const Q=new Map,ge=Pe=>Q.get(Pe)===Pe||!Q.get(Pe)?Pe:ge(Q.get(Pe));for(const Pe of te)Q.set(Pe.id,Pe.id);for(const Pe of b){const Ce=ae.has(Pe.flow.source)?Pe.flow.source:void 0,Te=ae.has(Pe.flow.target)?Pe.flow.target:void 0;if(!Ce||!Te)continue;const fe=f(Pe.flow.id);((QS=fe==null?void 0:fe.waypoints)==null?void 0:QS.length)===2&&Q.set(ge(Ce),ge(Te))}const $e=new Map;for(const Pe of te){if(!ae.has(Pe.id))continue;const Ce=ge(Pe.id);$e.set(Ce,[...$e.get(Ce)??[],Pe])}const Oe=[...$e.values()].sort((Pe,Ce)=>ye<0?Math.min(...Pe.map(Te=>Te.x))-Math.min(...Ce.map(Te=>Te.x)):Math.max(...Ce.map(Te=>Te.x))-Math.max(...Pe.map(Te=>Te.x))),Ze=[];let Ae=!0;for(const Pe of Oe){const Ce=Pe.map(Me=>ae.get(Me.id)??0).reduce((Me,ke)=>Math.abs(ke)>Math.abs(Me)?ke:Me,0),Te=new Map;let fe=!0;for(const Me of Pe){const ke=h(Me);if(!ke){fe=!1;break}Te.has(ke.id)||Te.set(ke.id,{subtree:[],pool:ke}),Te.get(ke.id).subtree.push(Me)}fe&&Rr([...Te.values()],Ce,()=>!0,os)?Ze.push({shapes:Pe,dx:Ce}):Ae=!1}if(!Ae)for(const Pe of Ze.reverse())n.moveElements(Pe.shapes,{x:-Pe.dx,y:0})}}}{const x=new Set([...k.map(_=>_.group.id),...jt(e,"group.update").map(_=>_.id)]);for(const _ of r.filter(S=>S.type==="bpmn:Group")){if(x.has(_.id))continue;const O=(((eR=_.businessObject.extensionElements)==null?void 0:eR.values)??[]).find(L=>L.$type==="bwl:Members"),B=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(L=>!!L);!B.length||!B.some(L=>{const D=y.get(L.id);return!D||D.x!==L.x||D.y!==L.y})||!B.some(L=>L.x<_.x||L.y<_.y||L.x+L.width>_.x+_.width||L.y+L.height>_.y+_.height)||n.resizeShape(_,nm(B,_.id))}}{const _=new Map(Vo(Ve(r)).map(L=>[L.owner,L.rect])),S=r.filter(L=>!!L.waypoints),O=new Map,B=(L,D)=>{!L||!D||(O.has(L)||O.set(L,new Set),O.get(L).add(D))};for(const L of S){const D=(tR=L.source)==null?void 0:tR.id,H=(nR=L.target)==null?void 0:nR.id;B(D,H),((iR=L.type)!=null&&iR.includes("DataOutputAssociation")||(oR=L.type)!=null&&oR.includes("DataInputAssociation")||L.type==="bpmn:Association")&&B(H,D)}const T=L=>G.filter(D=>D.flow.target===L).length,N=L=>{var H;const D=((H=f(L))==null?void 0:H.type)??"";if(D==="bpmn:StartEvent"&&T(L)===0)return!1;if(D.endsWith("Gateway")){const j=G.filter(Z=>Z.flow.target===L).map(Z=>Z.flow.source);if(j.length&&j.every(Z=>{var ie;return((ie=f(Z))==null?void 0:ie.type)==="bpmn:StartEvent"&&T(Z)===0}))return!1}return!0};for(const L of r.filter(D=>D.type==="bpmn:Group")){const H=(((rR=L.businessObject.extensionElements)==null?void 0:rR.values)??[]).find(fe=>fe.$type==="bwl:Members"),j=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const Z=j.map(f).filter(fe=>!!fe);if(!Z.length||!(k.some(fe=>fe.group.id===L.id)||jt(e,"group.update").some(fe=>fe.id===L.id)||Z.some(fe=>{const Me=y.get(fe.id);return!Me||Me.x!==fe.x||Me.y!==fe.y})))continue;const ue=new Set(j),se=[...j];for(;se.length;){const fe=se.shift();for(const Me of O.get(fe)??[])ue.has(Me)||(ue.add(Me),se.push(Me))}const oe=L.x,ve=L.x+L.width,ye=L.y,te=L.y+L.height,J=fe=>{const Me=_.get(fe.id),ke={x:fe.x,y:fe.y,width:fe.width,height:fe.height};return Me?[ke,{x:Me.x,y:Me.y,width:Me.width,height:Me.height}]:[ke]},ae=Z.flatMap(J),Q=Math.min(...ae.map(fe=>fe.x)),ge=Math.max(...ae.map(fe=>fe.x+fe.width)),$e=Math.min(...ae.map(fe=>fe.y)),Oe=Math.max(...ae.map(fe=>fe.y+fe.height)),Ze={L:Q-oe,R:ve-ge,T:$e-ye,B:te-Oe},Ae=new Set(j),Pe=fe=>fe.x>=oe&&fe.x+fe.width<=ve&&fe.y>=ye&&fe.y+fe.height<=te,Ce=r.filter(fe=>Ni(fe)).filter(fe=>fe.type!=="bpmn:Group"&&fe.type!=="bpmn:Participant"&&fe.type!=="bpmn:TextAnnotation"&&!Ae.has(fe.id)&&(!ue.has(fe.id)||!Pe(fe))&&N(fe.id)&&fe.x<ve&&fe.x+fe.width>oe&&fe.y<te&&fe.y+fe.height>ye);if(!Ce.length)continue;const Te={L:0,R:0,T:0,B:0};for(const fe of Ce){const Me=J(fe),ke=Math.min(...Me.map(_n=>_n.x)),Fe=Math.max(...Me.map(_n=>_n.x+_n.width)),wt=Math.min(...Me.map(_n=>_n.y)),an=Math.max(...Me.map(_n=>_n.y+_n.height)),Yt={L:Fe-oe,R:ve-ke,T:an-ye,B:te-wt},Kt=["L","R","T","B"].filter(_n=>Yt[_n]<=Ze[_n]+.001);if(!Kt.length)continue;const jn=Kt.reduce((_n,kp)=>Yt[kp]<Yt[_n]?kp:_n,Kt[0]);Te[jn]=Math.max(Te[jn],Math.min(Yt[jn]+10,Ze[jn]))}!Te.L&&!Te.R&&!Te.T&&!Te.B||n.resizeShape(L,{x:L.x+Te.L,y:L.y+Te.T,width:L.width-Te.L-Te.R,height:L.height-Te.T-Te.B})}}const PS=x=>{const _=x.waypoints;if(_!=null&&_.length){const O=_[Math.floor((_.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let Tc=0;const TS=12,kS=14,DF=15,LF=300,IF=x=>{const _=x.split(`
|
|
7
|
-
`),S=Math.max(..._.map(T=>Lr(T,TS))),O=Math.max(100,Math.min(LF,Math.ceil(S)+kS)),B=_.reduce((T,N)=>T+Math.max(1,Math.ceil((Lr(N,TS)+kS)/O)),0);return{width:O,height:Math.max(30,B*DF+10)}};for(const x of I){const _=x.association,S=((aR=x.placement)==null?void 0:aR.anchor)??(_?_.source===x.annotation.id?_.target:_.source:void 0),O=S?f(S):void 0,B=O?PS(O):void 0,T=IF(x.annotation.text??"");let N;if(B&&x.placement){const[j,Z]=sl[x.placement.side],ie=x.placement.offset??50;N={x:B.x+B.width/2+j*(B.width/2+T.width/2+ie),y:B.y+B.height/2+Z*(B.height/2+T.height/2+ie)}}else B?(N={x:B.x+B.width/2+180+Tc%3*260,y:B.y-110-Tc%2*95},Tc++):(N={x:300+Tc*260,y:60},Tc++);const L=O?h(O)??d():d(),D=L;B&&typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant"&&(N=ll(r,B,T,D,x.placement?{placement:x.placement}:{from:N}));const H=n.createShape({type:"bpmn:TextAnnotation",width:T.width,height:T.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},N,L);if(_){const j=Z=>Z===x.annotation.id?H:g(Z);n.connect(j(_.source),j(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}x.placement&&K(H,"bwl:Placement",xe(x.placement))}for(const x of jt(e,"association.add")){const _=x.association;n.connect(g(_.source),g(_.target),_.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:_.id})}:{type:"bpmn:Association"})}const BF=(x,_,S,O)=>{const B=x.parent;if(!B)return O;const T=x.x+x.width/2,N=new Set([x.id]);if(!R(B,x,T,O,N))return O;const L=_?_.y+Math.min(_.height/2,q):S?S.y+le:void 0;if(L===void 0)return O;const D=Math.floor((O-L)/he+1e-6);for(let H=1;H<=3;H++){const j=D+H,Z=L+j*he,ie=tS(_==null?void 0:_.id,j);if(!R(B,x,T,Z,ie?new Set([...N,...ie]):N))return es(_==null?void 0:_.id,j,S),Z}return O},OS=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of jt(e,"node.update")){let _=g(x.id);if(x.type&&al(x.type)!==_.type){const S=_.x+_.width/2,O=_.y+_.height/2,B=OS();_=c.replaceElement(_,{type:al(x.type),...x.eventDefinition?{eventDefinitionType:Ic[x.eventDefinition]}:{}});const T=OS(),N=[...B].filter(H=>H!==x.id&&!T.has(H));if(N.length)throw new ev({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:N});const L=Math.round(S-(_.x+_.width/2)),D=Math.round(O-(_.y+_.height/2));if(L!==0||D!==0){n.moveShape(_,{x:L,y:D});for(const H of[..._.incoming??[],..._.outgoing??[]])Mp(H)}}if(x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(_,{"bwl:band":x.band});const S=_.y+_.height/2,O=h(_),B=x.lane?g(x.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&S>=N.y&&S<=N.y+N.height);x.band!==void 0&&es(B==null?void 0:B.id,x.band,O);const T=B?B.y+(x.band===void 0?B.height/2:Math.min(B.height/2,q)+on(B.id,x.band)*he):x.band!==void 0&&O?O.y+le+on(`pool:${O.id}`,x.band)*he:void 0;if(T!==void 0){const N=BF(_,B,O,T),L=N===T?T-S:N-(_.y+_.height/2);L!==0&&(p.push({id:_.id,x:_.x,y:_.y,width:_.width,height:_.height}),n.moveElements([_],{x:0,y:L}))}}}for(const x of jt(e,"sequenceFlow.update")){const _=g(x.id),S=F.get(x.id);if(S){const O=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),B=g(S.flow.source),T=g(S.flow.target),N=n.connect(B,T,{type:"bpmn:SequenceFlow",businessObject:Cp(S.flow)}),L=Kg.get(x.id),D=T.y+T.height/2;L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1?n.updateWaypoints(N,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]):(n.reconnect(N,B,T,[O(B),O(T)]),Math.abs(D-(B.y+B.height/2))>1&&Mp(N))}else if((x.source!==void 0||x.target!==void 0)&&!oS.has(x.id)){const O=_,B=x.source!==void 0?g(x.source):O.source,T=x.target!==void 0?g(x.target):O.target,N=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(O,B,T,[N(B),N(T)]);const L=Kg.get(O.id),D=T.y+T.height/2;if(L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1){n.updateWaypoints(O,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]);const H=O.label;if(H&&L.label){const Z=Math.abs(L.label.y+H.height/2-L.channelY)<=he/5&&L.label.x+H.width>L.exit.x,ie=L.exit.x+6,ue=T.x-6-H.width,se=Z?ue>=ie?{x:Math.max(ie,Math.min(L.label.x,ue)),y:L.label.y+(D-L.channelY)}:void 0:L.label;se&&(se.x!==H.x||se.y!==H.y)&&n.moveElements([H],{x:se.x-H.x,y:se.y-H.y})}}else Math.abs(D-(B.y+B.height/2))>1&&Mp(O)}x.name!==void 0&&n.updateProperties(_,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(_,{name:((sR=x.condition)==null?void 0:sR.label)??void 0})}for(const x of jt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(g(x.id),{name:x.name??void 0});for(const x of jt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(g(x.id),{name:x.name??void 0});for(const x of jt(e,"annotation.update")){const _=g(x.id);if(x.text!==void 0&&n.updateProperties(_,{text:x.text}),x.placement===null)K(_,"bwl:Placement",null);else if(x.placement){const S=g(x.placement.anchor),O=PS(S),B=h(S)??d(),T=typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant",[N,L]=sl[x.placement.side],D=x.placement.offset??50,H={x:O.x+O.width/2+N*(O.width/2+_.width/2+D),y:O.y+O.height/2+L*(O.height/2+_.height/2+D)},j=T?ll(r,O,{width:_.width,height:_.height},B,{placement:x.placement,selfId:x.id}):H;n.moveElements([_],{x:j.x-(_.x+_.width/2),y:j.y-(_.y+_.height/2)}),K(_,"bwl:Placement",xe(x.placement))}}for(const x of jt(e,"group.update")){const _=g(x.id);if(x.name!==void 0&&n.updateLabel(_,x.name??""),x.members){const S=x.members.map(f).filter(O=>!!O);S.length&&n.resizeShape(_,nm(S,x.id)),K(_,"bwl:Members",{refs:x.members.join(" ")})}}}function Od(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 IA(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(f=>f.type==="bpmn:Association");if(!a.length)return 0;const s=f=>f.map(g=>g.original?{x:g.x,y:g.y,original:{x:g.original.x,y:g.original.y}}:{x:g.x,y:g.y}),c=(f,g)=>f.length===g.length&&f.every((h,y)=>{var w,m,v,b;return h.x===g[y].x&&h.y===g[y].y&&((w=h.original)==null?void 0:w.x)===((m=g[y].original)==null?void 0:m.x)&&((v=h.original)==null?void 0:v.y)===((b=g[y].original)==null?void 0:b.y)}),l=a.map(f=>s(f.waypoints)),u=new Set(a.map(f=>f.id));r.moveElements([t],{x:n,y:i});const p=Ve(o),d=[...Ji(p),...wi(p)].filter(([f,g])=>u.has(f)!==u.has(g)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,g)=>{c(f.waypoints,l[g])||r.updateWaypoints(f,l[g])}),d}function BA(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=d=>ut(d).filter(f=>!t.has(ct(f))),a=d=>{var f;return((f=i.get(d))==null?void 0:f.type)==="bpmn:TextAnnotation"},s=Ve(i),c=r(s),l=[...new Set(c.flatMap(Od))].filter(d=>n.has(d)&&a(d));if(l.length)for(const d of l){const f=i.get(d);if(!f||typeof f.x!="number"||typeof f.width!="number")continue;let g=f.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const xe=f.x+f.width/2,de=f.y+f.height/2;h=i.getAll().find(we=>{if(we.type!=="bpmn:Participant")return!1;const he=we;return typeof he.x=="number"&&typeof he.width=="number"&&xe>=he.x&&xe<=he.x+he.width&&de>=he.y&&de<=he.y+he.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const w=(((u=f.businessObject.extensionElements)==null?void 0:u.values)??[]).find(xe=>xe.$type==="bwl:Placement"),m=[...f.incoming??[],...f.outgoing??[]].find(xe=>xe.type==="bpmn:Association"),v=(w!=null&&w.anchor?i.get(w.anchor):void 0)??(m?((p=m.source)==null?void 0:p.id)===d?m.target:m.source:void 0);if(!v)continue;const b=v.waypoints,E=b!=null&&b.length?{x:b[Math.floor((b.length-1)/2)].x,y:b[Math.floor((b.length-1)/2)].y,width:0,height:0}:{x:v.x,y:v.y,width:v.width,height:v.height},C={width:f.width,height:f.height},I={x:f.x+f.width/2,y:f.y+f.height/2},k=w==null?void 0:w.side,P=Jy(i,E,h),F=[];if(k&&k in sl&&F.push(ll(i,E,C,h,{placement:{side:k,offset:(w==null?void 0:w.offset)??null},selfId:d})),P&&!cl(I,C,P))for(const xe of OA)F.push(ll(i,E,C,h,{placement:{side:xe,offset:null},selfId:d}));for(const[xe,de]of[[-1,0],[1,0],[0,-1],[0,1]])for(let we=1;we<=kA;we++)F.push({x:I.x+xe*Zy*we,y:I.y+de*Zy*we});const z={...s,edges:s.edges.filter(xe=>xe.id!==(m==null?void 0:m.id))},G=r(z),ne=G.filter(xe=>Od(xe).includes(d)).length;if(!ne)continue;let re,K=!1;for(const xe of F){const de=xe.x-I.x,we=xe.y-I.y;if(!de&&!we||xe.x-C.width/2<h.x||xe.x+C.width/2>h.x+h.width||xe.y-C.height/2<h.y||xe.y+C.height/2>h.y+h.height||P&&!cl(xe,C,P))continue;const he={...z,shapes:z.shapes.map(ee=>ee.id===d?{...ee,x:ee.x+de,y:ee.y+we}:ee)},W=r(he),le=W.filter(ee=>Od(ee).includes(d)).length;if(le>=ne||W.length>G.length)continue;const q=Math.abs(de)+Math.abs(we);if(K||((!re||le<re.mine||le===re.mine&&(W.length<re.all||W.length===re.all&&q<re.dist))&&(re={x:xe.x,y:xe.y,mine:le,all:W.length,dist:q}),re.mine===0&&re.all<G.length&&(K=!0)),le===0&&W.length<G.length&&IA(e,f,de,we)===0){re={x:xe.x,y:xe.y,mine:le,all:W.length,dist:q};break}}re&&o.moveElements([f],{x:re.x-I.x,y:re.y-I.y})}}const NA=60;function ul(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.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 r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function $A(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=w=>ut(w).filter(m=>!t.has(ct(m))),a=w=>w.filter(m=>m.kind==="pool-overlap"),s=new Map(n.shapes.map(w=>[w.id,w])),c=(w,m)=>m.x>=w.x&&m.y>=w.y&&m.x+m.width<=w.x+w.width&&m.y+m.height<=w.y+w.height,l=w=>{if(!s.get(w))return[w];const v=new Set,b=new Set([w]);for(let C=0;C<4;C++){let I=!1;for(const k of n.shapes)k.type!=="bpmn:Group"||v.has(k.id)||[...b].some(P=>{const F=s.get(P);return F&&c(k,F)})&&(v.add(k.id),I=!0);for(const k of n.shapes)k.type!=="bpmn:Participant"||b.has(k.id)||[...v].some(P=>{const F=s.get(P);return F&&c(F,k)})&&(b.add(k.id),I=!0);if(!I)break}const E=n.shapes.filter(C=>!C.parent&&!b.has(C.id)&&!v.has(C.id)&&C.type!=="bpmn:Group"&&C.type!=="bpmn:Participant").filter(C=>[...v].some(I=>{const k=s.get(I);return k&&c(k,C)})).map(C=>C.id);return[...b,...v,...E]},u=r(Ve(i)),p=a(u).length;if(!p)return;const d=u.length,f=[];let g=0,h=p,y=d;for(let w=0;w<6;w++){const m=Ve(i),v=a(r(m));if(!v.length)break;const b=new Map(m.shapes.map(P=>[P.id,P]));let E=null;for(const P of v){if(P.kind!=="pool-overlap")continue;const[F,z]=P.pools,G=b.get(F),ne=b.get(z);if(!G||!ne)continue;const[re,K]=G.x<=ne.x?[G,ne]:[ne,G];if(P.contained)continue;const xe=s.get(re.id),de=s.get(K.id),we=xe&&de?Math.max(de.x-(xe.x+xe.width),0):NA,he=re.x+re.width+we-K.x;if(he<=0)continue;const W=l(K.id).filter(le=>i.get(le));W.length&&(!E||he>E.dx)&&(E={movers:W,dx:he})}if(!E)break;const C=E.movers.map(P=>i.get(P)).filter(P=>!!P&&typeof P.x=="number");if(!C.length)break;o.moveElements(C,{x:E.dx,y:0}),f.push({els:C,dx:E.dx});const I=r(Ve(i)),k=a(I).length;k<p&&I.length<=d&&(k<h||k===h&&I.length<y||g===0)&&(g=f.length,h=k,y=I.length)}for(const{els:w,dx:m}of f.slice(g).reverse())o.moveElements(w,{x:-m,y:0})}const bs=.5,Dd=150;function FA(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of jA(n))i.length<n.length&&i.some(r=>ov(e.elementRegistry.get(r.id)))||HA(e,i)}function jA(e){const t=[...e].sort((i,o)=>i.x+i.width-(o.x+o.width)),n=[];for(const i of t){const o=n[n.length-1],r=o==null?void 0:o[o.length-1];o&&r&&i.x+i.width-(r.x+r.width)<=bs?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function ov(e){var i,o,r;const t=(i=e==null?void 0:e.businessObject)==null?void 0:i.processRef;if(!t)return!0;const n=(t.laneSets??[]).reduce((a,s)=>{var c;return a+(((c=s.lanes)==null?void 0:c.length)??0)},0);return(((o=t.flowElements)==null?void 0:o.length)??0)+n+(((r=t.artifacts)==null?void 0:r.length)??0)===0}function HA(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(m=>m.x+m.width),r=Math.max(...o);if(r-Math.min(...o)>bs)return;const a=t.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(a.length<2)return;const s=new Map(t.map(m=>[m.id,m.x]));if(a.some(m=>Math.abs(m.x-s.get(m.id))>bs))return;const c=a.map(m=>m.x+m.width);if(Math.max(...c)-Math.min(...c)<=bs)return;const l=m=>m.x+m.width,u=m=>!!m&&typeof m.width=="number",p=m=>{const v={shapes:[],edges:[],lanes:[]},b=E=>{for(const C of E.children??[]){if("waypoints"in C&&C.waypoints){v.edges.push(C);continue}C.type!=="label"&&(C.type==="bpmn:Lane"?v.lanes.push(C):v.shapes.push(C),b(C))}};return b(m),v},d=new Map(a.map(m=>[m.id,p(m)]));let f=r;for(const m of a){const{shapes:v}=d.get(m.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+Dd))}const g=a.filter(m=>Math.abs(l(m)-f)>bs);if(!g.length)return;for(const m of g){const v=l(m),{shapes:b,edges:E,lanes:C}=d.get(m.id);if([...b.flatMap(P=>[l(P),...u(P.label)?[l(P.label)]:[]]),...E.flatMap(P=>[...P.waypoints.map(F=>F.x),...u(P.label)?[l(P.label)]:[]])].some(P=>P>f)||[...(m.incoming??[]).map(P=>P.waypoints[P.waypoints.length-1]),...(m.outgoing??[]).map(P=>P.waypoints[0])].some(P=>!P||P.x>f||Math.abs(P.x-v)<1))return;if(f>v){const P={x:v,y:m.y,width:f-v,height:m.height},F=new Set([m.id,...b.map(G=>G.id),...E.map(G=>G.id),...C.map(G=>G.id)]);if(n.getAll().some(G=>{var K;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const ne=G.type==="label"?(K=G.labelTarget)==null?void 0:K.id:G.id;if(!ne||F.has(ne)||F.has(G.id))return!1;const re=G;return re.x<P.x+P.width&&re.x+re.width>P.x&&re.y<P.y+P.height&&re.y+re.height>P.y}))return}}const h=()=>new Set(ut(Ve(n)).map(ct)),y=h(),w=g.map(m=>m.width);for(const m of g)ul(i,m,f-m.x,{layout:!1});[...h()].every(m=>y.has(m))||g.forEach((m,v)=>ul(i,m,w[v],{layout:!1}))}function zA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ut(l).filter(u=>!t.has(ct(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(C=>C.id!==l.id&&C.type!=="bpmn:Group"&&a(l,C));if(!p.length)continue;const d=p.map(C=>i.get(C.id)).filter(C=>!!C&&typeof C.x=="number");if(d.length!==p.length)continue;const f=s(p),g=s(d),h=g.l+(l.x-f.l),y=g.t+(l.y-f.t),w=g.r+(l.x+l.width-f.r),m=g.b+(l.y+l.height-f.b),v={x:h,y,width:w-h,height:m-y};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const b=r(Ve(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(Ve(i)).length>b&&o.resizeShape(u,E)}}const pl=20,dl=10;function GA(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(ut(f,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ct)),s=Ve(o),c=ut(s,{includeObservationOnly:!0}).filter(f=>f.kind==="edge-along-group-boundary"&&!t.has(ct(f)));if(!c.length)return;const l=new Map(n.shapes.map(f=>[f.id,f])),u=new Map;for(const f of c)u.set(f.group,[...u.get(f.group)??[],f]);for(const[f,g]of u){const h=s.shapes.find(ze=>ze.id===f);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(f);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 m=h.members.map(ze=>o.get(ze)).filter(ze=>!!ze&&typeof ze.x=="number");if(!m.length)continue;const v=Math.min(...m.map(ze=>ze.x)),b=Math.min(...m.map(ze=>ze.y)),E=Math.max(...m.map(ze=>ze.x+ze.width)),C=Math.max(...m.map(ze=>ze.y+ze.height)),I=h.x,k=h.y,P=h.x+h.width,F=h.y+h.height;let z=I,G=k,ne=P,re=F;for(const ze of g){const $=s.edges.find(R=>R.id===ze.edge);if(!$)continue;const M=$.endpoints.some(R=>{const U=s.shapes.find(Ne=>Ne.id===R);if(!U||U.container)return!1;const X=U.x+U.width/2,pe=U.y+U.height/2;return I<X&&X<P&&k<pe&&pe<F});for(const R of sn($)){const U=R.axis==="v"?[k,F]:[I,P];Math.min(R.hi,U[1])-Math.max(R.lo,U[0])<ld||(R.axis==="v"?I<R.at&&R.at<P:k<R.at&&R.at<F)&&M||(R.axis==="v"?(Math.abs(R.at-I)<=ma&&(z=Math.max(z,R.at+pl)),Math.abs(R.at-P)<=ma&&(ne=Math.min(ne,R.at-pl))):(Math.abs(R.at-k)<=ma&&(G=Math.max(G,R.at+pl)),Math.abs(R.at-F)<=ma&&(re=Math.min(re,R.at-pl))))}}if(z>v-dl&&(z=I),G>b-dl&&(G=k),ne<E+dl&&(ne=P),re<C+dl&&(re=F),z===I&&G===k&&ne===P&&re===F)continue;const K=o.get(f),xe={x:K.x,y:K.y,width:K.width,height:K.height},de=Ve(o),we=new Set(ut(de).map(ct)),he=a(de);r.resizeShape(K,{x:z,y:G,width:ne-z,height:re-G});let W=Ve(o),le=ut(W).filter(ze=>!we.has(ct(ze)));const q=[];if(le.length>0&&le.every(ze=>ze.kind==="label-over-line"&&!i.has(ze.edge)&&W.edges.some($=>$.id===ze.edge))){for(const ze of le){if(ze.kind!=="label-over-line")continue;const $=W.edges.find(pe=>pe.id===ze.edge),M=$&&Pd($,W),R=(d=o.get(ze.edge))==null?void 0:d.label;if(!M||!R)continue;const U=M.x-R.x,X=M.y-R.y;r.moveElements([R],{x:U,y:X}),q.push({label:R,dx:U,dy:X})}W=Ve(o),le=ut(W).filter(ze=>!we.has(ct(ze)))}const me=a(W),Re=[...me].some(ze=>!he.has(ze));if(le.length||Re||me.size>=he.size){for(const ze of q.reverse())r.moveElements([ze.label],{x:-ze.dx,y:-ze.dy});r.resizeShape(K,xe)}}}function VA(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=zp((o==null?void 0:o.$parent)??o),a=ls(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:Gp(u,i,r),requests:qp(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,...r?{rootLang:r}:{},before:s.get(l)}]:[]})}}function Ld(e,t,n={}){var K,xe;const{i18n:i,lower:o=iv}=n,r=Ky(e),a=cy(r.elementRegistry),s=Yy(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0},sharedEndpointCrossings:{before:0,after:0,pairs:[]}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=CA(t,a,i),u=i&&l.writes.size?VA(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ve(r.elementRegistry),d=new Set(ut(p).map(ct)),f=new Set(ut(p,{includeObservationOnly:!0}).map(ct)),g=new Set(Qy(l.ops,de=>{var we,he;return(he=(we=r.elementRegistry.get(de))==null?void 0:we.source)==null?void 0:he.id}).keys()),h=new Set(p.edges.map(de=>de.id).filter(de=>!g.has(de))),y=new Set(t.flatMap(de=>de.kind==="sequenceFlow.update"&&(de.source!==void 0||de.target!==void 0)?[de.id]:[])),w=()=>new Set(p.edges.filter(de=>{var he;const we=(he=r.elementRegistry.get(de.id))==null?void 0:he.waypoints;return we?!(we.length===de.waypoints.length&&de.waypoints.every((W,le)=>Math.round(W.x)===Math.round(we[le].x)&&Math.round(W.y)===Math.round(we[le].y))):!1}).map(de=>de.id)),m=(de,we)=>new Set([...de].filter(he=>!we.has(he))),v=new Set(p.shapes.map(de=>de.id)),b=Ji(p),E=b.length,C=new Set(b.map(([de,we])=>`${de}|${we}`)),I=wi(p),k=new Set(I.map(([de,we])=>`${de}|${we}`)),P=new Map;for(const de of r.elementRegistry.filter(we=>"waypoints"in we&&!!we.waypoints))de.label&&P.set(de.id,{wps:de.waypoints.map(we=>({x:we.x,y:we.y})),label:{x:de.label.x,y:de.label.y},source:(K=de.source)==null?void 0:K.id,target:(xe=de.target)==null?void 0:xe.id});const F=e.get("commandStack");try{pm(F,()=>{o(l.ops,r);for(const le of(u==null?void 0:u.contexts())??[])F.execute(Wp,le);$A(r,d,p),FA(r,p),zA(r,d,p),eA(r,p,y),ZM(r,h,v),wy(r,h);const de=xd(r,d),we=HM(r,LA(r),h,y);gy(r,C,h);const he=w(),W=Iy(r,d,m(h,he),he);Cy(r,h),dA(r,h,y),ky(r,d,h),xA(r,d,h),YM(r,k,h),aA(r,h,p),Hy(r,d,m(h,w())),jy(r,h,new Set([...y,...W,...we])),Gy(r,v),BA(r,d,v),xd(r,d,de),GA(r,f,p,h),Vy(r,d),Fy(r,P,DA(r))})}catch(de){return{ok:!1,issues:[de instanceof ev?de.issue:{kind:"lower-failed",message:de instanceof Error?de.message:String(de)}],findings:[],stats:c}}const z=Ve(r.elementRegistry),G=ut(z,{includeObservationOnly:!0}).filter(de=>!f.has(ct(de))),ne=Jm(z),re=wi(z);return{ok:!0,issues:[],findings:G,stats:{edgeCrossings:{before:E,after:ne.pairs.length,pairs:ne.pairs,solidPairs:ne.solidPairs,dashedPairs:ne.dashedPairs,mixedPairs:ne.mixedPairs,crossPoolMessages:ne.crossPoolMessages},sharedEndpointCrossings:{before:I.length,after:re.length,pairs:re}}}}function WA(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function rv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function av(e,t){const n=rv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function sv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function UA(e){return typeof e=="string"&&Np.includes(e)}function zi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function cv(e,t={}){const n=e.rootElements??[],i=n.find(W=>W.$type==="bpmn:Collaboration"),o=new Map(n.filter(W=>W.$type==="bpmn:Process").map(W=>[W.id,W])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},d=[],f=[],g=[],h=[],y=[],w=[],m=[],v=new Map,b=new Set,E=new Set,C=W=>{W&&b.add(W)},I=W=>{b.add(W),E.add(W)},k=W=>{const le=sv(W,"bwl:Placement");if(!le)return;const q=typeof le.anchor=="string"?le.anchor:void 0;if(!q||!UA(le.side))return;const ee=typeof le.offset=="number"?le.offset:void 0;y.push({owner:W.id,anchor:q,side:le.side,...ee!==void 0?{offset:ee}:{}})},P=W=>{const le=sv(W,"bwl:Members"),q=typeof(le==null?void 0:le.refs)=="string"?le.refs.split(/\s+/).filter(Boolean):[];q.length&&m.push({owner:W.id,refs:q})},F=W=>{var le;for(const q of W)switch(C(q.id),q.$type){case"bpmn:TextAnnotation":I(q.id),v.set(q.id,q),c.push({id:q.id,text:typeof q.text=="string"?q.text:""}),k(q);break;case"bpmn:Association":g.push({id:q.id,type:q.$type,source:zi(q.sourceRef),target:zi(q.targetRef)});break;case"bpmn:Group":{I(q.id),v.set(q.id,q);const ee=(le=q.categoryValueRef)==null?void 0:le.value;l.push({id:q.id,...typeof ee=="string"&&ee?{name:ee}:{}}),P(q);break}default:u.push({id:q.id,type:q.$type,reason:"type-outside-mvp"})}},z=W=>{for(const le of W.flowElements??[])C(le.id),u.push({id:le.id,type:le.$type,reason:"inside-container"}),(le.flowElements??[]).length&&z(le);for(const le of W.artifacts??[])C(le.id),u.push({id:le.id,type:le.$type,reason:"inside-container"})},G=(W,le)=>{const q=W.flowElements??[],ee=(W.laneSets??[]).flatMap(Re=>Re.lanes??[]),me=new Map;for(const Re of ee){C(Re.id),v.set(Re.id,Re);for(const ze of Re.flowNodeRef??[]){const $=zi(ze);$&&me.set($,Re.id)}}for(const Re of q){if(C(Re.id),v.set(Re.id,Re),Re.$type==="bpmn:SequenceFlow"){d.push({id:Re.id,source:zi(Re.sourceRef),target:zi(Re.targetRef),...typeof Re.name=="string"&&Re.name?{name:Re.name}:{}});continue}if(Re.$type==="bpmn:DataStoreReference"){I(Re.id),s.push({id:Re.id,...Re.name?{name:Re.name}:{}});continue}const ze=WA(Re.$type),$=ze==="intermediateCatchEvent"?Ip((Re.eventDefinitions??[]).map(X=>X.$type)):void 0;if(!rm(ze)||ze==="intermediateCatchEvent"&&!$){u.push({id:Re.id,type:Re.$type,reason:"type-outside-mvp"});continue}I(Re.id);const M=ze==="boundaryEvent"?zi(Re.attachedToRef):void 0;a.push({id:Re.id,type:ze,...Re.name?{name:Re.name}:{},...le?{participant:le}:{},...me.has(Re.id)?{lane:me.get(Re.id)}:{},...M?{attachedTo:M}:{},...$?{eventDefinition:$}:{}}),ze==="subProcess"&&z(Re);const R=av(Re,"bwl:band");R!==void 0&&(p.bands[Re.id]=R);const U=rv(Re,"bwl:afterColumn");typeof U=="string"&&U!==""&&w.push([Re.id,U]);for(const X of Re.dataOutputAssociations??[])C(X.id),h.push({id:X.id,type:X.$type,source:Re.id,target:zi(X.targetRef)});for(const X of Re.dataInputAssociations??[])C(X.id),h.push({id:X.id,type:X.$type,source:zi((X.sourceRef??[])[0]),target:Re.id})}F(W.artifacts??[])};if(i){const W=new Set;for(const le of i.participants??[]){I(le.id),v.set(le.id,le);const q=zi(le.processRef);q&&W.add(q);const ee=q?o.get(q):void 0,me=((ee==null?void 0:ee.laneSets)??[]).flatMap(M=>M.lanes??[]),Re=me.map(M=>({id:M.id,...M.name?{name:M.name}:{}}));for(const M of Re)I(M.id);const ze=!ee||(ee.flowElements??[]).length===0&&me.length===0&&(ee.artifacts??[]).length===0;r.push({id:le.id,...le.name?{name:le.name}:{},...ze?{blackBox:!0}:{},...Re.length?{lanes:Re}:{}});const $=av(le,"bwl:poolOrder");$!==void 0&&(p.poolOrders[le.id]=$),ee&&G(ee,le.id)}for(const le of i.messageFlows??[])C(le.id),v.set(le.id,le),f.push({id:le.id,source:zi(le.sourceRef),target:zi(le.targetRef),...typeof le.name=="string"&&le.name?{name:le.name}:{}});F(i.artifacts??[]);for(const[le,q]of o)!W.has(le)&&(q.flowElements??[]).length>0&&u.push({id:le,type:q.$type,reason:"unreachable-process"})}else for(const W of o.values())G(W);const ne=[],re=[],K=[],xe=[],de=(W,le)=>!!W&&!!le&&E.has(W)&&E.has(le);for(const W of d){if(!de(W.source,W.target)){u.push({id:W.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}ne.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of f){if(!de(W.source,W.target)){u.push({id:W.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}re.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of h){if(!de(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}xe.push({...W.id?{id:W.id}:{},source:W.source,target:W.target}),W.id&&E.add(W.id)}for(const W of g){if(!de(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}K.push({...W.id?{id:W.id}:{},source:W.source,target:W.target})}const we=new Map(l.map(W=>[W.id,W]));for(const{owner:W,refs:le}of m){const q=le.filter(me=>b.has(me)),ee=we.get(W);ee&&q.length&&(ee.members=q)}for(const W of y)b.has(W.anchor)&&(p.placements[W.owner]={anchor:W.anchor,side:W.side,...W.offset!==void 0?{offset:W.offset}:{}});for(const[W,le]of w)b.has(le)&&(p.afterColumns[W]=le);const he={...r.length?{participants:r}:{},nodes:a,sequenceFlows:ne,...re.length?{messageFlows:re}:{},...s.length?{dataStores:s}:{},...xe.length?{dataAssociations:xe}:{},...c.length?{annotations:c}:{},...K.length?{associations:K}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:he,hints:p,omitted:u,i18n:qA(he,v,e,t.i18n)}:{definition:he,hints:p,omitted:u}}function qA(e,t,n,i){const o=zp(n),r=ls(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Gp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of qp(u))r.includes(d.locale)&&a.push({id:c.id,...d})};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:r.slice(1),reviewRequests:a}}async function YA(e,t={}){const{definitions:n,warnings:i}=await ga(e);return{...cv(n,t),warnings:i}}const KA=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Id(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function XA(e){return Id(e.processRef)!==void 0}function ZA(e){const t=new Set,n=o=>{const r=Id(o);r&&t.add(r)},i=o=>{for(const r of o.flowElements??[]){n(r.sourceRef),n(r.targetRef),r.attachedToRef&&(n(r.attachedToRef),t.add(r.id));for(const a of r.dataOutputAssociations??[])t.add(r.id),n(a.targetRef);for(const a of r.dataInputAssociations??[]){t.add(r.id);for(const s of a.sourceRef??[])n(s)}(r.flowElements??[]).length&&i(r)}for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)};for(const o of e.rootElements??[])if(o.$type==="bpmn:Process")i(o);else if(o.$type==="bpmn:Collaboration"){for(const r of o.messageFlows??[])n(r.sourceRef),n(r.targetRef);for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)}return t}function JA(e){const t=[],n=i=>{for(const o of i.flowElements??[])KA.has(o.$type)&&t.push(o),(o.flowElements??[]).length&&n(o)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function QA(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 Bd(e){const t=[],n=e.rootElements??[],i=ZA(e);for(const r of JA(e))i.has(r.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[r.id],params:{type:r.$type}});const o=n.find(r=>r.$type==="bpmn:Collaboration");if(o){const r=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of o.participants??[])XA(s)&&QA(r.get(Id(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 eP(e){const{definitions:t,warnings:n}=await ga(e);return{issues:Bd(t),warnings:n}}const tP=.5,nP=8,iP=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),wa=e=>typeof e=="number"?e:Number(e??NaN),fl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function oP(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 r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${fl(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${fl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(fl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function rP(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},o=a=>{const s=a;return s?[wa(s.x),wa(s.y),wa(s.width),wa(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=fl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(d=>[wa(d.x),wa(d.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function lv(e){const t=rP(e),n=new Map,i=new Set,o=r=>{if(Array.isArray(r))return r.forEach(o);if(!r||typeof r!="object"||i.has(r))return;i.add(r);const a=r,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:")&&!iP.has(s)&&n.set(c,{type:s,props:oP(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")&&o(l)};return o(e),n}function uv(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function pv(e,t,n={}){const i=n.moveTolerance??tP,o=lv(e),r=lv(t),a=[],s=[],c=[];for(const[l,u]of r){const p=o.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||uv(p.geometry,u.geometry,i)||uv(p.label,u.label,n.labelTolerance??nP))&&c.push(l)}for(const l of o.keys())r.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function aP(e,t,n={}){const[i,o]=await Promise.all([ga(e),ga(t)]);return{...pv(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function sP(e){return new Set([...e.added,...e.modified])}function dv(e){return e.get("moddle").ids}function fv(e,t,n){const i=Object.prototype.hasOwnProperty.call(e,"nextPrefixed"),o=e.nextPrefixed;e.nextPrefixed=t;try{return n()}finally{i?e.nextPrefixed=o:delete e.nextPrefixed}}function hv(e,t){const n=dv(e),i=n.nextPrefixed,o=[];return{value:fv(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function gv(e,t,n){const i=dv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:fv(i,function(l,u){const p=t[r++];return p!==void 0&&p.startsWith(l)&&!this.assigned(p)?(this.claim(p,u),a++,p):(s++,o.call(this,l,u))},n),fed:a,missed:s,remaining:Math.max(0,t.length-r)}}function cP(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function mv(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>Ld(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?hv(e,r):{value:r(),generatedIds:void 0};if(!a.ok)return{status:"rejected",issues:a.issues};const{xml:c}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:c??"",findings:a.findings,stats:a.stats,...s?{generatedIds:s}:{}}}const ws=()=>typeof performance>"u"?Date.now():performance.now();function lP(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class Nd extends Error{constructor(t,n){super(n),this.reason=t}}async function yv(e,t,{expectedXml:n,i18n:i}){const o=ws(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(ws()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(ws()-o)};const a=e.get("commandStack"),s=dm(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=gv(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const g=Ld(e,d.ops,{...i?{i18n:i}:{}});if(!g.ok)throw new Nd("rejected",`배치 ${f+1}/${t.length} — ${lP(g.issues)}`)})});if(p.missed||p.remaining)throw new Nd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof Nd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=fm(a,s);if(!l)try{const{xml:p}=await e.saveXML({format:!0});p!==n&&(l={reason:"xml"})}catch(p){l={reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}return l?(u&&a.undo(),{status:"diverged",...l,ms:Math.round(ws()-o)}):{status:"replayed",ms:Math.round(ws()-o)}}const uP=new Set(["lasso","lasso.selection","hand","hand.move"]),vv=1e4,pP="bwl-edit-locked",xv=new WeakMap;function dP(e){const t=xv.get(e);if(t)return t;const n=e.get("eventBus"),i=e.get("dragging",!1);let o=!1,r=!1;n.on("drag.init",vv,()=>{var s;if(o)return uP.has((s=i==null?void 0:i.context())==null?void 0:s.prefix)?void 0:!1}),n.on(["contextPad.open.allowed","contextPad.trigger","palette.trigger","element.dblclick"],vv,()=>o?!1:void 0);const a={get locked(){return o},set(s){var l,u,p;if(s===o)return;o=s,e.get("canvas").getContainer().classList.toggle(pP,s);const c=e.get("keyboard",!1);s?(i==null||i.cancel(),(l=e.get("contextPad",!1))==null||l.close(),(u=e.get("popupMenu",!1))==null||u.close(),(p=e.get("directEditing",!1))==null||p.complete(),r=!!(c!=null&&c.getBinding()),c==null||c.unbind()):r&&(c.bind(),r=!1)}};return xv.set(e,a),a}const fP=Symbol("bpmn-editor"),$d={geometry:[],semantic:[]};function hP(){const e=Se.ref(!1),t=Se.ref(!0),n=Se.ref(!1),i=Se.shallowRef($d),o=Se.shallowRef(void 0),r=Se.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=$d;return}const m=ut(Ve(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:m,semantic:v?Bd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const m=p();if(!m||!a){r.value=void 0;return}const v=m.locales(),b={};for(const E of v)b[E]={untranslated:m.untranslatedCount(E),reviewRequested:m.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:m.getDisplayLocale()??a.designLocale,counts:b}}function f(){const m=p();m&&(m.configure(a),a&&s&&(s=m.setDisplayLocale(s)))}const g=()=>{l||(e.value=!0,u())};function h(m,v){dP(m).set(!v)}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function w(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(m){a=m,f(),d()},setDisplayLocale(m){var b;s=m;const v=(b=p())==null?void 0:b.setDisplayLocale(m);v&&(s=v),d()},setChangeScope(m){o.value=m===void 0?void 0:new Set(m)},requestFocus(m){if(!c)return;const v=c.get("elementRegistry").get(m);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(m){const v=c==null?void 0:c.get("elementRegistry").get(m),b=v==null?void 0:v.businessObject;if(!b)return;const E=typeof b.name=="string"&&b.name.trim()!==""?b.name:b.text;return{name:typeof E=="string"&&E.trim()!==""?E.trim():void 0,type:typeof b.$type=="string"?b.$type:""}},attach(m){c&&this.detach(),c=m,c.get("eventBus").on("commandStack.changed",g),t.value||h(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",g),c&&!t.value&&h(c,!0),c=void 0,i.value=$d,o.value=void 0,r.value=void 0},setEditable(m){t.value=m,c&&h(c,m)},async applyAgentBatch(m,v){const b=y();n.value=!0;try{const E=await mv(b,m,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(m,v){const b=y(),E=e.value;n.value=!0,l=!0;try{const C=await yv(b,m,{expectedXml:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return e.value=C.status==="replayed"?!1:E,C}finally{l=!1,n.value=!1,u()}},async importXml(m){const{warnings:v}=await y().importXML(m);return e.value=!1,o.value=void 0,u(),{warnings:cd(v)}},async saveXml(){const{xml:m}=await y().saveXML({format:!0});return e.value=!1,m??""},undo:()=>{var m;return(m=w())==null?void 0:m.undo()},redo:()=>{var m;return(m=w())==null?void 0:m.redo()},canUndo:()=>{var m;return((m=w())==null?void 0:m.canUndo())??!1},canRedo:()=>{var m;return((m=w())==null?void 0:m.canRedo())??!1}}}const gP=new RegExp("\\p{Script=Hangul}","u"),mP=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,yP=new RegExp("\\p{Script=Han}","u");function hl(e){const t=gP.test(e),n=mP.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:yP.test(e)?"han":"other"}}function bv(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 wv(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=Tr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:$o(a).filter(l=>Mn(l))})}return n}const _s=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function vP(e,t={}){const n=bv(e),i=wv(e);let o;const r={},a=[],s=[],c=[];for(const h of i){const y=h.trs.filter(w=>(w.body??"")===h.name).map(Mn);if(y.length){const w=[...y].sort().join("+");r[w]=(r[w]??0)+1,o=o?new Set([...o].filter(m=>y.includes(m))):new Set(y)}else h.trs.some(w=>w.body)?a.push(_s(h)):c.push({e:h,inference:hl(h.name)});for(const w of h.trs){const m=Mn(w),v=w.body??"",b=hl(v);b.locale&&b.locale!==m?s.push({..._s(h),locale:m,script:b.script}):m==="ko"&&b.script==="han"&&h.trs.some(E=>E!==w&&E.body===v)&&s.push({..._s(h),locale:m,script:"han"})}}const l=new Set(c.map(h=>h.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const h=l.size===1?[...l][0]:void 0;h&&o.has(h)?[u,p]=[h,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const d=n??u,f=[],g=[];for(const{e:h,inference:y}of c)y.locale?y.locale!==d&&f.push({..._s(h),locale:y.locale}):g.push({..._s(h),script:y.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:g,drift:a,matchedBy:r,scriptMismatch:s}}function xP(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!bv(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(wv(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(d=>d.body))continue;const l=c.trs.find(d=>Mn(d)===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(Pr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function _v(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const Fd=e=>Mn(e)||void 0,Ev=e=>e.body??"";function Sv(e){const t=new Map;for(const n of _v(e)){const i=$o(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Fd(o),body:Ev(o)}))})}return t}const Rv=e=>JSON.stringify(e.map(t=>t.body).sort());class bP{constructor(){mn(this,"byId",new Map);mn(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};Cv(this.byId,o,a),Cv(this.byBodies,Rv(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Rv(t))??[]}}function Cv(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function wP(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function jd(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function _P(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const EP=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function SP(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Sv(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=wP(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(y=>y.doc===t.doc&&jd(y.state,c)).sort((y,w)=>w.version-y.version).slice(0,1).map(y=>y.state)],["lineage",t.index.sameId(a).filter(y=>y.doc!==t.doc&&jd(y.state,c)).map(y=>y.state)],["bodies",t.index.sameBodies(s.cells).filter(y=>!(y.doc===t.doc&&y.id===a)&&jd(y.state,c)).map(y=>y.state)]].find(([,y])=>y.length);if(!p){if(!r(s))continue;for(const[y,w]of c)for(let m=0;m<w;m++)n.unresolved.push({...l,body:y,script:hl(y).script});continue}const[d,f]=p,g=f.map(y=>_P(s,y,c));if(g.some(y=>y.overflow)||new Set(g.map(EP)).size>1){n.ambiguous.push({...l,source:d});continue}const[h]=g;for(const y of h.stale)n.stale.push({...l,...y});h.cells.length&&n.restores.push({...l,source:d,cells:h.cells})}return n}function RP(e,t){if(!t.restores.length)return 0;const n=new Map(_v(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=$o(r),s=new Set(a.map(Fd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Fd(p)&&Ev(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Be(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function CP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Hd={exports:{}},Mv;function MP(){if(Mv)return Hd.exports;Mv=1;var e=Hd.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),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,t/o))/Math.log(n)*o;for(var r=i-Math.floor(i),a="",o=0;o<Math.floor(i);o++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(r){var c=Math.pow(n,r),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 o=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(r,c));return r[c]=a,c},r=o.hats={};return o.get=function(a){return o.hats[a]},o.set=function(a,s){return o.hats[a]=s,o},o.bits=t||128,o.base=n||16,o},Hd.exports}var AP=MP(),PP=CP(AP);function Qi(e){if(!(this instanceof Qi))return new Qi(e);e=e||[128,36,1],this._seed=e.length?PP.rack(e[0],e[1],e[2]):e}Qi.prototype.next=function(e){return this._seed(e||!0)},Qi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Qi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Qi.prototype.assigned=function(e){return this._seed.get(e)||!1},Qi.prototype.unclaim=function(e){delete this._seed.hats[e]},Qi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const xn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};xn.td=xn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],xn.option=xn.optgroup=[1,'<select multiple="multiple">',"</select>"],xn.thead=xn.tbody=xn.colgroup=xn.caption=xn.tfoot=[1,"<table>","</table>"],xn.polyline=xn.ellipse=xn.polygon=xn.circle=xn.text=xn.line=xn.path=xn.rect=xn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ht(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[o,r,a]=Object.hasOwn(xn,i)?xn[i]:xn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)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 TP(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 o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Yn(e,...t){const n=e.style;return V(t,function(i){i&&V(i,function(o,r){n[r]=o})}),e}function An(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const kP=Object.prototype.toString;function Mt(e){return new Wo(e)}function Wo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Wo.prototype.add=function(e){return this.list.add(e),this},Wo.prototype.remove=function(e){return kP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Wo.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},Wo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Wo.prototype.array=function(){return Array.from(this.list)},Wo.prototype.has=Wo.prototype.contains=function(e){return this.list.contains(e)};function gl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Nr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function OP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ml={},Av;function DP(){if(Av)return ml;Av=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ml.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},ml.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},ml}var Pv=DP(),LP=OP(Pv),Ue=TP({__proto__:null,default:LP},[Pv]),Tv=["focus","blur"];function IP(e,t,n,i,o){return Tv.indexOf(n)!==-1&&(o=!0),Ue.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Nr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function BP(e,t,n,i){return Tv.indexOf(t)!==-1&&(i=!0),Ue.unbind(e,t,n,i)}var ri={bind:IP,unbind:BP};function zd(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function Es(e,t){return t=t||document,t.querySelectorAll(e)}function eo(e){e.parentNode&&e.parentNode.removeChild(e)}function NP(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function $P(e,t){return t.appendChild(NP(e,t))}function nt(e,t){return $P(t,e),e}var Gd=2,kv={"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":Gd,"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":Gd,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function FP(e,t){return kv[t]?e.style[t]:e.getAttributeNS(null,t)}function Ov(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=kv[i];o?(o===Gd&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function jP(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Ov(e,o,t[o])}function Le(e,t,n){if(typeof t=="string")if(n!==void 0)Ov(e,t,n);else return FP(e,t);else jP(e,t);return e}const HP=Object.prototype.toString;function dt(e){return new Uo(e)}function Uo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Uo.prototype.add=function(e){return this.list.add(e),this},Uo.prototype.remove=function(e){return HP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Uo.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},Uo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Uo.prototype.array=function(){return Array.from(this.list)},Uo.prototype.has=Uo.prototype.contains=function(e){return this.list.contains(e)};function Ss(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Vd(e){return e.cloneNode(!0)}var Wd={svg:"http://www.w3.org/2000/svg"},Dv='<svg xmlns="'+Wd.svg+'"';function zP(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Wd.svg)===-1&&(e=Dv+e.substring(4)):(e=Dv+">"+e+"</svg>",t=!0);var n=GP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function GP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function He(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=zP(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Wd.svg,e),t&&Le(n,t),n}var Ud=null;function Lv(){return Ud===null&&(Ud=He("svg")),Ud}function Iv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function VP(e,t,n,i,o,r){var a=Lv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Iv(a,e);case 6:return Iv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function Rs(e){return Lv().createSVGTransform()}var Bv=/([&<>]{1})/g,WP=/([&<>\n\r"]{1})/g,UP={"&":"&","<":"<",">":">",'"':"'"};function qd(e,t){function n(i,o){return UP[o]||o}return e.replace(t,n)}function Nv(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(qd(e.textContent,Bv));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(o=e.attributes,n=0,i=o.length;n<i;++n)r=o.item(n),t.push(" ",r.name,'="',qd(r.value,WP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Nv(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",qd(e.nodeValue,Bv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function qP(e){for(var t=e.firstChild,n=[];t;)Nv(t,n),t=t.nextSibling;return n.join("")}function $v(e,t){return qP(e)}function cn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function YP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function KP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(YP(e,i))}function Cs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),KP(n,t)),n.consolidate()}const XP=/^class[ {]/;function ZP(e){return XP.test(e.toString())}function Yd(e){return Array.isArray(e)}function Kd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yl(...e){e.length===1&&Yd(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const JP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,QP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,eT=/\/\*([^*]*)\*\//m;function tT(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(ZP(e)?JP:QP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(eT);return(o&&o[1]||i).trim()})||[]}function Fv(e,t){const n=t||{get:function(v,b){if(i.push(v),b===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const b=i.join(" -> ");return i.length=0,new Error(b?`${v} (Resolving: ${b})`:v)};function c(v,b){if(!o[v]&&v.includes(".")){const E=v.split(".");let C=c(E.shift());for(;E.length;)C=C[E.shift()];return C}if(Kd(r,v))return r[v];if(Kd(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,b)}function l(v,b){if(typeof b>"u"&&(b={}),typeof v!="function")if(Yd(v))v=yl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const C=(v.$inject||tT(v)).map(I=>Kd(b,I)?b[I]:c(I));return{fn:v,dependencies:C}}function u(v){const{fn:b,dependencies:E}=l(v),C=Function.prototype.bind.call(b,null,...E);return new C}function p(v,b,E){const{fn:C,dependencies:I}=l(v,E);return C.apply(b,I)}function d(v){return yl(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),C=Object.create(null),I=[],k=[],P=[];let F,z,G,ne;for(let re in o)F=o[re],b.indexOf(re)!==-1&&(F[2]==="private"?(z=I.indexOf(F[3]),z===-1?(G=F[3].createChild([],b),ne=d(G),I.push(F[3]),k.push(G),P.push(ne),E[re]=[ne,re,"private",G]):E[re]=[P[z],re,"private",k[z]]):E[re]=[F[2],F[1]],C[re]=!0),(F[2]==="factory"||F[2]==="type")&&F[1].$scope&&b.forEach(K=>{F[1].$scope.indexOf(K)!==-1&&(E[re]=[F[2],F[1]],C[K]=!0)});b.forEach(re=>{if(!C[re])throw new Error('No provider for "'+re+'". Cannot use provider from the parent!')}),v.unshift(E)}return new Fv(v,a)}const g={factory:p,type:u,value:function(v){return v}};function h(v,b){const E=v.__init__||[];return function(){E.forEach(C=>{typeof C=="string"?b.get(C):b.invoke(C)})}}function y(v){const b=v.__exports__;if(b){const E=v.__modules__,C=Object.keys(v).reduce((z,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(z[G]=v[G]),z),Object.create(null)),I=(E||[]).concat(C),k=f(I),P=yl(function(z){return k.get(z)});b.forEach(function(z){o[z]=[P,z,"private",k]});const F=(v.__init__||[]).slice();return F.unshift(function(){k.init()}),v=Object.assign({},v,{__init__:F}),h(v,k)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const C=v[E];if(C[2]==="private"){o[E]=C;return}const I=C[0],k=C[1];o[E]=[g[I],nT(I,k),I]}),h(v,a)}function w(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(w,v),v.indexOf(b)!==-1)?v:v.concat(b)}function m(v){const b=v.reduce(w,[]).map(y);let E=!1;return function(){E||(E=!0,b.forEach(C=>C()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=f,this.init=m(e)}function nT(e,t){return e!=="value"&&Yd(t)&&(t=yl(t.slice())),t}var iT=1e3;function xo(e,t){var n=this;t=t||iT,e.on(["render.shape","render.connection"],t,function(i,o){var r=i.type,a=o.element,s=o.gfx,c=o.attrs;if(n.canRender(a))return r==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,o){if(n.canRender(o))return i.type==="render.getShapePath"?n.getShapePath(o):n.getConnectionPath(o)})}xo.prototype.canRender=function(e){},xo.prototype.drawShape=function(e,t){},xo.prototype.drawConnection=function(e,t){},xo.prototype.getShapePath=function(e){},xo.prototype.getConnectionPath=function(e){};function $r(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function oT(e){return["M",e.x,e.y]}function Xd(e){return["L",e.x,e.y]}function rT(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function aT(e,t){const n=e.length,i=[oT(e[0])];for(let o=1;o<n;o++){const r=e[o-1],a=e[o],s=e[o+1];if(!s||!t){i.push(Xd(a));continue}const c=Math.min(t,Zd(a.x-r.x,a.y-r.y),Zd(s.x-a.x,s.y-a.y));if(!c){i.push(Xd(a));continue}const l=vl(a,r,c),u=vl(a,r,c*.5),p=vl(a,s,c),d=vl(a,s,c*.5);i.push(Xd(l)),i.push(rT(u,d,p))}return i}function vl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Zd(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Zd(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ms(e,t,n){Qe(t)&&(n=t,t=null),t||(t={});const i=He("path",t);return Qe(n)&&(i.dataset.cornerRadius=String(n)),Jd(i,e)}function Jd(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Le(e,{d:$r(aT(t,n))}),e}function xl(e){var t=new Set(e);return lt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Fr(e,t,n){n=n||0,Je(e)||(e=[e]),V(e,function(i,o){var r=t(i,o,n);Je(r)&&r.length&&Fr(r,t,n+1)})}function Qd(e,t,n){var i=new Set,o=new Set;return Fr(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function As(e,t){return Qd(e)}function sT(e,t,n){Ar(t)&&(t=!0),vn(t)&&(n=t,t=!0),n=n||{};var i=Ps(n.allShapes),o=Ps(n.allConnections),r=Ps(n.enclosedElements),a=Ps(n.enclosedConnections),s=Ps(n.topLevel,t&&pa(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]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,V(u.incoming,c),V(u.outgoing,c),u.children}return Fr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function ln(e,t){t=!!t,Je(e)||(e=[e]);var n,i,o,r;return V(e,function(a){var s=a;a.waypoints&&!t&&(s=ln(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>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function _a(e,t){var n={};return V(e,function(i){var o=i;o.waypoints&&(o=ln(o)),!Qe(t.y)&&o.x>t.x&&(n[i.id]=i),!Qe(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Qe(t.width)&&Qe(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Qe(t.width)||!Qe(t.height))&&(n[i.id]=i)}),n}function jv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Hv(e){return!!(e&&e.isFrame)}function Ps(e,t){return Y({},e||{},t||{})}var cT=1;function qo(e,t){xo.call(this,e,cT),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})}Be(qo,xo),qo.prototype.canRender=function(){return!0},qo.prototype.drawShape=function(t,n,i){var o=He("rect");return Le(o,{x:0,y:0,width:n.width||0,height:n.height||0}),Hv(n)?Le(o,Y({},this.FRAME_STYLE,i||{})):Le(o,Y({},this.SHAPE_STYLE,i||{})),nt(t,o),o},qo.prototype.drawConnection=function(t,n,i){var o=Ms(n.waypoints,Y({},this.CONNECTION_STYLE,i||{}));return nt(t,o),o},qo.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return $r(a)},qo.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return $r(r)},qo.$inject=["eventBus","styles"];function lT(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return Y(r,{class:n})},this.style=function(n,i){!Je(n)&&!i&&(i=n,n=[]);var o=oi(n,function(r,a){return Y(r,e[a]||{})},{});return i?Y(o,i):o},this.computeStyle=function(n,i,o){return Je(i)||(o=i,i=[]),t.style(i||[],Y({},o,n||{}))}}const uT={__init__:["defaultRenderer"],defaultRenderer:["type",qo],styles:["type",lT]};function en(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function rn(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 ef(e,t){return!e||!t?-1:e.indexOf(t)}function Ts(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function tf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=Ts(e,t);return Math.abs(o/r)<=i}var pT=2;function bo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(dT(o,n))return r;return!1}function dT(e,t){const n=t[0];return Bo(t,function(i){return Math.abs(n[e]-i[e])<=pT})}function zv(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 nf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var fT=/,?([a-z]),?/gi,Gv=parseFloat,un=Math,Yo=un.PI,to=un.min,no=un.max,Vv=un.pow,Ko=un.abs,hT=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,gT=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Wv=Array.isArray||function(e){return e instanceof Array};function mT(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yT(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 vT(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),o=t.cache=t.cache||{},r=t.count=t.count||[];return mT(o,i)?(yT(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function xT(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(hT,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(gT,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=rf,n}function bT(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 wT(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 of(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 rf(){return this.join(",").replace(fT,"$1")}function _T(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=rf,t}function Uv(e,t,n,i,o,r,a,s,c){var l=1-c,u=Vv(l,3),p=Vv(l,2),d=c*c,f=d*c,g=u*e+p*3*c*n+l*3*c*c*o+f*a,h=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:bl(g),y:bl(h)}}function qv(e){var t=AT(...e);return of(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Xo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function ET(e,t){return e=of(e),t=of(t),Xo(t,e.x,e.y)||Xo(t,e.x2,e.y)||Xo(t,e.x,e.y2)||Xo(t,e.x2,e.y2)||Xo(e,t.x,t.y)||Xo(e,t.x2,t.y)||Xo(e,t.x,t.y2)||Xo(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 Yv(e,t,n,i,o){var r=-3*t+9*n-9*i+3*o,a=e*r+6*t-12*n+6*i;return e*a-3*t+3*n}function Kv(e,t,n,i,o,r,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],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,g=0;g<u;g++){var h=l*p[g]+l,y=Yv(h,e,n,o,a),w=Yv(h,t,i,r,s),m=y*y+w*w;f+=d[g]*un.sqrt(m)}return l*f}function ST(e,t,n,i,o,r,a,s){if(!(no(e,n)<to(o,a)||to(e,n)>no(o,a)||no(t,i)<to(r,s)||to(t,i)>no(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=bl(c/u),d=bl(l/u),f=+p.toFixed(2),g=+d.toFixed(2);if(!(f<+to(e,n).toFixed(2)||f>+no(e,n).toFixed(2)||f<+to(o,a).toFixed(2)||f>+no(o,a).toFixed(2)||g<+to(t,i).toFixed(2)||g>+no(t,i).toFixed(2)||g<+to(r,s).toFixed(2)||g>+no(r,s).toFixed(2)))return{x:p,y:d}}}}function bl(e){return Math.round(e*1e11)/1e11}function RT(e,t,n){var i=qv(e),o=qv(t);if(!ET(i,o))return[];var r=Kv(...e),a=Kv(...t),s=Zv(e)?1:~~(r/5)||1,c=Zv(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,g;for(f=0;f<s+1;f++){var h=Uv(...e,f/s);l[f]={x:h.x,y:h.y,t:f/s}}for(f=0;f<c+1;f++)h=Uv(...t,f/c),u[f]={x:h.x,y:h.y,t:f/c};for(f=0;f<s;f++)for(g=0;g<c;g++){var y=l[f],w=l[f+1],m=u[g],v=u[g+1],b=Ko(w.x-y.x)<.01?"y":"x",E=Ko(v.x-m.x)<.01?"y":"x",C=ST(y.x,y.y,w.x,w.y,m.x,m.y,v.x,v.y),I;if(C){if(I=C.x.toFixed(9)+"#"+C.y.toFixed(9),p[I])continue;p[I]=!0;var k=y.t+Ko((C[b]-y[b])/(w[b]-y[b]))*(w.t-y.t),P=m.t+Ko((C[E]-m[E])/(v[E]-m[E]))*(v.t-m.t);k>=0&&k<=1&&P>=0&&P<=1&&d.push({x:C.x,y:C.y,t1:k,t2:P})}}return d}function Xv(e,t,n){e=ex(e),t=ex(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],o=c=y[2];else{y[0]=="C"?(p=[i,o,...y.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var w=0,m=t.length;w<m;w++){var v=t[w];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(d=[r,a,...v.slice(1)],r=d[6],a=d[7]):(d=[r,a,r,a,l,u,l,u],r=l,a=u);var b=RT(p,d);{for(var E=0,C=b.length;E<C;E++)b[E].segment1=g,b[E].segment2=w,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function CT(e){return Wv(e)&&Wv(e[0])}function MT(e){if(bT(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=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":o=+l[1]+n,r=+l[2]+i;default:for(var d=1,f=l.length;d<f;d++)c[d]=+l[d]+(d%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=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=rf,t}function Zv(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function wl(e,t,n,i){return[e,t,n,i,n,i]}function Jv(e,t,n,i,o,r){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*o+s*n,a*r+s*i,o,r]}function Qv(e,t,n,i,o,r,a,s,c,l){var u=Yo*120/180,p=Yo/180*(+o||0),d=[],f,g=vT(function($,M,R){var U=$*un.cos(R)-M*un.sin(R),X=$*un.sin(R)+M*un.cos(R);return{x:U,y:X}});if(l)I=l[0],k=l[1],E=l[2],C=l[3];else{f=g(e,t,-p),e=f.x,t=f.y,f=g(s,c,-p),s=f.x,c=f.y;var h=(e-s)/2,y=(t-c)/2,w=h*h/(n*n)+y*y/(i*i);w>1&&(w=un.sqrt(w),n=w*n,i=w*i);var m=n*n,v=i*i,b=(r==a?-1:1)*un.sqrt(Ko((m*v-m*y*y-v*h*h)/(m*y*y+v*h*h))),E=b*n*y/i+(e+s)/2,C=b*-i*h/n+(t+c)/2,I=un.asin(((t-C)/i).toFixed(9)),k=un.asin(((c-C)/i).toFixed(9));I=e<E?Yo-I:I,k=s<E?Yo-k:k,I<0&&(I=Yo*2+I),k<0&&(k=Yo*2+k),a&&I>k&&(I=I-Yo*2),!a&&k>I&&(k=k-Yo*2)}var P=k-I;if(Ko(P)>u){var F=k,z=s,G=c;k=I+u*(a&&k>I?1:-1),s=E+n*un.cos(k),c=C+i*un.sin(k),d=Qv(s,c,n,i,o,0,a,z,G,[k,F,E,C])}P=k-I;var ne=un.cos(I),re=un.sin(I),K=un.cos(k),xe=un.sin(k),de=un.tan(P/4),we=4/3*n*de,he=4/3*i*de,W=[e,t],le=[e+we*re,t-he*ne],q=[s+we*xe,c-he*K],ee=[s,c];if(le[0]=2*W[0]-le[0],le[1]=2*W[1]-le[1],l)return[le,q,ee].concat(d);d=[le,q,ee].concat(d).join().split(",");for(var me=[],Re=0,ze=d.length;Re<ze;Re++)me[Re]=Re%2?g(d[Re-1],d[Re],p).y:g(d[Re],d[Re+1],p).x;return me}function AT(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,g,h,y,w,m=0;m<2;++m){if(m==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,d=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,d=3*i-3*t),Ko(u)<1e-12){if(Ko(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}y=p*p-4*d*u,w=un.sqrt(y),!(y<0)&&(g=(-p+w)/(2*u),0<g&&g<1&&c.push(g),h=(-p-w)/(2*u),0<h&&h<1&&c.push(h))}for(var v=c.length,b=v,E;v--;)f=c[v],E=1-f,l[0][v]=E*E*E*e+3*E*E*f*n+3*E*f*f*o+f*f*f*a,l[1][v]=E*E*E*t+3*E*E*f*i+3*E*f*f*r+f*f*f*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:to(...l[0]),y0:to(...l[1]),x1:no(...l[0]),y1:no(...l[1])}}function ex(e){if(CT(e)||(e=xT(e)),wT(e))return e;for(var t=_T(MT(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,g){var h,y;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C",...Qv(f.x,f.y,...d.slice(1))];break;case"S":g=="C"||g=="S"?(h=f.x*2-f.bx,y=f.y*2-f.by):(h=f.x,y=f.y),d=["C",h,y,...d.slice(1)];break;case"T":g=="Q"||g=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C",...Jv(f.x,f.y,f.qx,f.qy,d[1],d[2])];break;case"Q":f.qx=d[1],f.qy=d[2],d=["C",...Jv(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...wl(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...wl(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...wl(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...wl(f.x,f.y,f.X,f.Y)];break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var g=d[f];g.length;)r[f]="A",d.splice(f++,0,["C",...g.splice(0,6)]);d.splice(f,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=Gv(u[p-4])||n.x,n.by=Gv(u[p-3])||n.y}return t}function Dt(e){return vn(e)&&ii(e,"waypoints")}function at(e){return vn(e)&&ii(e,"labelTarget")}function PT(e){return vn(e)&&la(e.parent)}function tx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function wo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ye(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function _l(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function TT(e){return wo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function kT(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var d=t[p-1];if(d){var f=l[l.length-1],g=f&&f.endLength||0,h=LT(d,u);l.push({start:d,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-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 et(e){return Dt(e)?kT(e):TT(e)}function Ln(e,t,n){n=n||0,vn(n)||(n={x:n,y:n});var i=Ye(e),o=Ye(t),r=i.bottom+n.y<=o.top,a=i.left-n.x>=o.right,s=i.top-n.y>=o.bottom,c=i.right+n.x<=o.left,l=r?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function ks(e,t,n){var i=OT(e,t);return i.length===1||i.length===2&&Ts(i[0],i[1])<1?wo(i[0]):i.length>1?(i=Yi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),wo(i[n?0:i.length-1])):null}function OT(e,t){return Xv(e,t)}function DT(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ts(n,o)===0||tf(i,o,n)?e.splice(t,1):t++;return e}function LT(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function El(e,t){return Math.round(e*t)/t}function nx(e){return Qe(e)?e+"px":e}function IT(e){for(;e.parent;)e=e.parent;return e}function BT(e){e=Y({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Yn(n,{position:"relative",overflow:"hidden",width:nx(e.width),height:nx(e.height)}),t.appendChild(n),n}function ix(e,t,n){const i=He("g");dt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const NT="base",ox=0,$T=1,FT={shape:["x","y","width","height"],connection:["waypoints"]};function tt(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||{})}tt.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],tt.prototype._init=function(e){const t=this._eventBus,n=this._container=BT(e),i=this._svg=He("svg");Le(i,{width:"100%",height:"100%"}),An(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{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")}),nt(n,i);const o=this._viewport=ix(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Hp(this._viewboxChanged,300)),this._restoreFocus=Hp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),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)},tt.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},tt.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},tt.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=jv(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},tt.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},tt.prototype.restoreFocus=function(){this._restoreFocus()},tt.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},tt.prototype.isFocused=function(){return this._focused},tt.prototype.getDefaultLayer=function(){return this.getLayer(NT,ox)},tt.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},tt.prototype._getChildIndex=function(e){return oi(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},tt.prototype._createLayer=function(e,t){typeof t>"u"&&(t=$T);const n=this._getChildIndex(t);return{group:ix(this._viewport,"layer-"+e,n),index:t,visible:!0}},tt.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,o=t.index;if(t.visible)return i;const r=this._getChildIndex(o);return n.insertBefore(i,n.childNodes[r]||null),t.visible=!0,i},tt.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&&(cn(n),t.visible=!1),n},tt.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],cn(t.group))},tt.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},tt.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(IT(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},tt.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},tt.prototype._findPlaneForRoot=function(e){return Bt(this._planes,function(t){return t.rootElement===e})},tt.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},tt.prototype._resolveElements=function(e){return Je(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},tt.prototype.getContainer=function(){return this._container},tt.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&&(V([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),dt(o).add(t)):(e.markers.delete(t),dt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},tt.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},tt.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},tt.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},tt.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},tt.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},tt.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,ox);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},tt.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},tt.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},tt.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)},tt.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})},tt.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})},tt.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=FT[e];if(!Bo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},tt.prototype._setParent=function(e,t,n){rn(t.children,e,n),e.parent=t},tt.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const o=this._eventBus,r=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=r.create(e,t,i);return this._elementRegistry.add(t,a),r.update(e,t,a),o.fire(e+".added",{element:t,gfx:a}),t},tt.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},tt.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},tt.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e),!!e)return o.fire(t+".remove",{element:e}),i.remove(e),en(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},tt.prototype.removeShape=function(e){return this._removeElement(e,"shape")},tt.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},tt.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},tt.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},tt.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},tt.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,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);Cs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Cs(t),o=a?a.matrix:VP(),s=El(o.a,1e3),c=El(-o.e||0,1e3),l=El(-o.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},tt.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=Y({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),rx(t,n)}),{x:n.e,y:n.f}},tt.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(g=>g!=o);if(!r.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=ln(r),s=Ye(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 d=Ye(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-d.right),h=Math.min(0,s.left-d.left),y=Math.max(0,s.bottom-d.bottom),w=Math.min(0,s.top-d.top);u=g||h,p=y||w}this.scroll({dx:-u*l,dy:-p*l})},tt.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)}),El(i.a,1e3)};function rx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}tt.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let o,r;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?r={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(o=Math.min(1,n.width/i.width,n.height/i.height),r={x:i.x+(e?i.width/2-n.width/o/2:0),y:i.y+(e?i.height/2-n.height/o/2:0),width:n.width/o,height:n.height/o}),this.viewbox(r),this.viewbox(!1).scale},tt.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=Y(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),rx(this._viewport,u),u},tt.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},tt.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,o=n.y*t.scale-t.y*t.scale,r=n.width*t.scale,a=n.height*t.scale;return{x:i,y:o,width:r,height:a}},tt.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ea="data-element-id";function yi(e){this._elements={},this._eventBus=e}yi.$inject=["eventBus"],yi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Le(t,Ea,i),n&&Le(n,Ea,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},yi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Le(i.gfx,Ea,""),i.secondaryGfx&&Le(i.secondaryGfx,Ea,""),delete t[n])},yi.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)},yi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Le(t,Ea,i),t},yi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Le(e,Ea);var n=this._elements[t];return n&&n.element},yi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},yi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},yi.prototype.getAll=function(){return this.filter(function(e){return e})},yi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},yi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},yi.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 jT(e,t,n,i){var o=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var a=this.indexOf(r);return a!==-1&&(this.splice(a,1),t.unset(r,o,i)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,a){var s=this.indexOf(r);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,r),s===-1&&t.set(r,o,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function HT(e){return e.__refs_collection===!0}function zT(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ax(e,t,n){var i=jT(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(o){e.set(o,t.inverse,n)})}function GT(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function Ei(e,t){if(!(this instanceof Ei))return new Ei(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ei.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?ax(this,t,e):GT(this,t,e)},Ei.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return HT(n)||ax(this,t,e),n},Ei.prototype.ensureBound=function(e,t){zT(e,t)||this.bind(e,t)},Ei.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ei.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var af=new Ei({name:"children",enumerable:!0,collection:!0},{name:"parent"}),sx=new Ei({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),cx=new Ei({name:"attachers",collection:!0},{name:"host"}),lx=new Ei({name:"outgoing",collection:!0},{name:"source"}),ux=new Ei({name:"incoming",collection:!0},{name:"target"});function Sa(){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)}}),af.bind(this,"parent"),sx.bind(this,"labels"),lx.bind(this,"outgoing"),ux.bind(this,"incoming")}function Os(){Sa.call(this),af.bind(this,"children"),cx.bind(this,"host"),cx.bind(this,"attachers")}Be(Os,Sa);function px(){Sa.call(this),af.bind(this,"children")}Be(px,Os);function dx(){Os.call(this),sx.bind(this,"labelTarget")}Be(dx,Os);function fx(){Sa.call(this),lx.bind(this,"source"),ux.bind(this,"target")}Be(fx,Sa);var VT={connection:fx,shape:Os,label:dx,root:px};function WT(e,t){var n=VT[e];if(!n)throw new Error("unknown type: <"+e+">");return Y(new n,t)}function UT(e){return e instanceof Sa}function _o(){this._uid=12}_o.prototype.createRoot=function(e){return this.create("root",e)},_o.prototype.createLabel=function(e){return this.create("label",e)},_o.prototype.createShape=function(e){return this.create("shape",e)},_o.prototype.createConnection=function(e){return this.create("connection",e)},_o.prototype.create=function(e,t){return t=Y({},t||{}),t.id||(t.id=e+"_"+this._uid++),WT(e,t)};var Sl="__fn",hx=1e3,qT=Array.prototype.slice;function ai(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ai.prototype.on=function(e,t,n,i){if(e=Je(e)?e:[e],En(t)&&(i=n,n=t,t=hx),!Qe(t))throw new Error("priority must be a number");var o=n;i&&(o=Zn(n,i),o[Sl]=n[Sl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ai.prototype.once=function(e,t,n,i){var o=this;if(En(t)&&(i=n,n=t,t=hx),!Qe(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var a=n.apply(i,arguments);return o.off(e,r),a}r[Sl]=n,this.on(e,t,r)},ai.prototype.off=function(e,t){e=Je(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ai.prototype.createEvent=function(e){var t=new Ds;return t.init(e),t},ai.prototype.fire=function(e,t){var n,i,o,r;if(r=qT.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 Ds?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},ai.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ai.prototype._destroy=function(){this._listeners={}},ai.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ai.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=YT(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(o){if(!this.handleError(o))throw console.error("unhandled error in event listener",o),o}return i},ai.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},ai.prototype._getListeners=function(e){return this._listeners[e]},ai.prototype._setListeners=function(e,t){this._listeners[e]=t},ai.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,o,r;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,r=n.callback,(r===t||r[Sl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Ds(){}Ds.prototype.stopPropagation=function(){this.cancelBubble=!0},Ds.prototype.preventDefault=function(){this.defaultPrevented=!0},Ds.prototype.init=function(e){Y(this,e||{})};function YT(e,t){return e.apply(null,t)}function Zo(e){return e.childNodes[0]}function KT(e){return e.parentNode.childNodes[1]}function Rl(e,t,n,i,o){var r=Rs();r.setTranslate(t,n);var a=Rs();a.setRotate(i||0,0,0);var s=Rs();s.setScale(1,1),Cs(e,[r,a,s])}function In(e,t,n){var i=Rs();i.setTranslate(t,n),Cs(e,i)}function gx(e,t){var n=Rs();n.setRotate(t,0,0),Cs(e,n)}function vi(e,t){this._eventBus=e,this._elementRegistry=t}vi.$inject=["eventBus","elementRegistry"],vi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=KT(t),n||(n=He("g"),dt(n).add("djs-children"),nt(t.parentNode,n))):n=t,n},vi.prototype._clear=function(e){var t=Zo(e);return gl(t),t},vi.prototype._createContainer=function(e,t,n,i){var o=He("g");dt(o).add("djs-group"),typeof n<"u"?XT(o,t,t.childNodes[n]):nt(t,o);var r=He("g");dt(r).add("djs-element"),dt(r).add("djs-"+e),i&&dt(r).add("djs-frame"),nt(o,r);var a=He("g");return dt(a).add("djs-visual"),nt(r,a),r},vi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Hv(t))},vi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=oi(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),V(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;V(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},vi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},vi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},vi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},vi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},vi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),In(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Le(n,"display","none"):Le(n,"display","block")}},vi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);cn(t.parentNode)};function XT(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const ZT={__depends__:[uT],__init__:["canvas"],canvas:["type",tt],elementRegistry:["type",yi],elementFactory:["type",_o],eventBus:["type",ai],graphicsFactory:["type",vi]};function JT(e){var t=new Fv(e);return t.init(),t}function QT(e){e=e||{};var t={config:["value",e]},n=[t,ZT].concat(e.modules||[]);return JT(n)}function Jo(e,t){this._injector=t||QT(e),this.get("eventBus").fire("diagram.init")}Jo.prototype.get=function(e,t){return this._injector.get(e,t)},Jo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Jo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Jo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Vn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Qn(e,t){return e.$instanceOf(t)}function ek(e){return Bt(e.rootElements,function(t){return Qn(t,"bpmn:Process")||Qn(t,"bpmn:Collaboration")})}function tk(e){var t={},n=[],i={};function o(q,ee){return function(me){q(me,ee)}}function r(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,ee){var me=q.gfx;if(me)throw new Error(`already rendered ${Vn(q)}`);return e.element(q,i[q.id],ee)}function c(q,ee){return e.root(q,i[q.id],ee)}function l(q,ee){try{var me=i[q.id]&&s(q,ee);return r(q),me}catch(Re){u(Re.message,{element:q,error:Re}),console.error(`failed to import ${Vn(q)}`,Re)}}function u(q,ee){e.error(q,ee)}var p=this.registerDi=function(ee){var me=ee.bpmnElement;me?i[me.id]?u(`multiple DI elements defined for ${Vn(me)}`,{element:me}):i[me.id]=ee:u(`no bpmnElement referenced in ${Vn(ee)}`,{element:ee})};function d(q){f(q.plane)}function f(q){p(q),V(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(ee,me){var Re=ee.diagrams;if(me&&Re.indexOf(me)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!me&&Re&&Re.length&&(me=Re[0]),!me)throw new Error("no diagram to display");i={},d(me);var ze=me.plane;if(!ze)throw new Error(`no plane for ${Vn(me)}`);var $=ze.bpmnElement;if(!$)if($=ek(ee),$)u(`correcting missing bpmnElement on ${Vn(ze)} to ${Vn($)}`),ze.bpmnElement=$,p(ze);else throw new Error("no process or collaboration to display");var M=c($,ze);if(Qn($,"bpmn:Process")||Qn($,"bpmn:SubProcess"))y($,M);else if(Qn($,"bpmn:Collaboration"))W($,M),w(ee.rootElements,M);else throw new Error(`unsupported bpmnElement for ${Vn(ze)}: ${Vn($)}`);h(n)};var h=this.handleDeferred=function(){for(var ee;n.length;)ee=n.shift(),ee()};function y(q,ee){de(q,ee),P(q.ioSpecification,ee),k(q.artifacts,ee),r(q)}function w(q,ee){var me=lt(q,function(Re){return!a(Re)&&Qn(Re,"bpmn:Process")&&Re.laneSets});me.forEach(o(y,ee))}function m(q,ee){l(q,ee)}function v(q,ee){V(q,o(m,ee))}function b(q,ee){l(q,ee)}function E(q,ee){l(q,ee)}function C(q,ee){l(q,ee)}function I(q,ee){l(q,ee)}function k(q,ee){V(q,function(me){Qn(me,"bpmn:Association")?n.push(function(){I(me,ee)}):I(me,ee)})}function P(q,ee){q&&(V(q.dataInputs,o(E,ee)),V(q.dataOutputs,o(C,ee)))}var F=this.handleSubProcess=function(ee,me){de(ee,me),k(ee.artifacts,me)};function z(q,ee){var me=l(q,ee);Qn(q,"bpmn:SubProcess")&&F(q,me||ee),Qn(q,"bpmn:Activity")&&P(q.ioSpecification,ee),n.push(function(){V(q.dataInputAssociations,o(b,ee)),V(q.dataOutputAssociations,o(b,ee))})}function G(q,ee){l(q,ee)}function ne(q,ee){l(q,ee)}function re(q,ee){n.push(function(){var me=l(q,ee);q.childLaneSet&&K(q.childLaneSet,me||ee),le(q)})}function K(q,ee){V(q.lanes,o(re,ee))}function xe(q,ee){V(q,o(K,ee))}function de(q,ee){we(q.flowElements,ee),q.laneSets&&xe(q.laneSets,ee)}function we(q,ee){V(q,function(me){Qn(me,"bpmn:SequenceFlow")?n.push(function(){G(me,ee)}):Qn(me,"bpmn:BoundaryEvent")?n.unshift(function(){z(me,ee)}):Qn(me,"bpmn:FlowNode")?z(me,ee):Qn(me,"bpmn:DataObject")||(Qn(me,"bpmn:DataStoreReference")||Qn(me,"bpmn:DataObjectReference")?ne(me,ee):u(`unrecognized flowElement ${Vn(me)} in context ${Vn(ee&&ee.businessObject)}`,{element:me,context:ee}))})}function he(q,ee){var me=l(q,ee),Re=q.processRef;Re&&y(Re,me||ee)}function W(q,ee){V(q.participants,o(he,ee)),n.push(function(){v(q.messageFlows,ee)}),k(q.artifacts,ee)}function le(q){V(q.flowNodeRef,function(ee){var me=ee.get("lanes");me&&me.push(q)})}}function mx(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,w){return i.add(h,y,w)},error:function(h,y){s.push({message:h,context:y})}},d=new tk(p);u=u||l.diagrams&&l.diagrams[0];var f=nk(l,u);if(!f)throw new Error("no diagram to display");V(f,function(h){d.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(g+"_plane")||r.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function nk(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=ik(n));var o;A(i,"bpmn:Collaboration")?o=i:o=Bt(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return Bt(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Hn(o.participants,function(l){return l.processRef}),r.push(o));var a=yx(r),s=[t],c=[n];return V(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 yx(e){var t=[];return V(e,function(n){n&&(t.push(n),t=t.concat(yx(n.flowElements)))}),t}function ik(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var ok='<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>',vx=ok,xx={verticalAlign:"middle"},bx={color:"#404040"},rk={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},ak={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},sk={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"},ck='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+vx+'</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>',io;function lk(){io=Ht(ck),Yn(io,rk),Yn(Rt("svg",io),xx),Yn(Rt(".backdrop",io),ak),Yn(Rt(".notice",io),sk),Yn(Rt(".link",io),bx,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function uk(){io||(lk(),ri.bind(io,".backdrop","click",function(e){document.body.removeChild(io)})),document.body.appendChild(io)}const Cl=5,wx="djs-outline-hidden";function Vt(e){e=Y({},dk,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),hk(this._container)}Be(Vt,Jo),Vt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(d){throw this._emit("import.parse.complete",{error:d}),d}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),Ml(s,r),s=pk(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Vt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Vt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw Ml(r,[]),r}if(typeof t=="string"&&(i=fk(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw Ml(r,[]),r}try{this.clear()}catch(r){throw Ml(r,[]),r}const{warnings:o}=await mx(this,n,i);return{warnings:o}},Vt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Vt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Rt(":scope > defs",i._svg),a=$v(o),s=r?"<defs>"+$v(r)+"</defs>":"",c=i.getContainer();Mt(c).add(wx);let l;try{l=o.getBBox()}finally{Mt(c).remove(wx)}const u=l.x-Cl,p=l.y-Cl,d=l.width+Cl*2,f=l.height+Cl*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+E.message;if(I)return a.addWarning({message:G,error:E}),!0;throw zo(G)}function u(E,C){return l(E,C,!0)}function p(){var E=a.elementsById,C=a.references,I,k;for(I=0;k=C[I];I++){var T=k.element,F=E[k.id],z=yo(T).propertiesByName[k.property];if(F||a.addWarning({message:"unresolved reference <"+k.id+">",element:k.element,property:k.property,value:k.id}),z.isMany){var G=T.get(z.name),ne=G.indexOf(k);ne===-1&&(ne=G.length),F?G[ne]=F:G.splice(ne,1)}else T.set(z.name,F)}}function d(){c.pop().handleEnd()}var f=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(E){if(f.test(E)){var C=g.exec(E),I=C&&C[1];!I||h.test(I)||a.addWarning({message:"unsupported document encoding <"+I+">, falling back to UTF-8"})}}function _(E,C){var I=c.peek();try{c.push(I.handleNode(E))}catch(k){l(k,C,r)&&c.push(new nd)}}function m(E,C){try{c.peek().handleText(E)}catch(I){u(I,C)}}function v(E,C){E.trim()&&m(E,C)}var b=o.getPackages().reduce(function(E,C){return E[C.uri]=C.prefix,E},Object.entries(td).reduce(function(E,[C,I]){return E[I]=C,E},o.config&&o.config.nsMap||{}));return s.ns(b).on("openTag",function(E,C,I,k){var T=E.attrs||{},F=Object.keys(T).reduce(function(G,ne){var re=C(T[ne]);return G[ne]=re,G},{}),z={name:E.name,originalName:E.originalName,attributes:F,ns:E.ns};_(z,k)}).on("question",y).on("closeTag",d).on("cdata",m).on("text",function(E,C,I){v(C(E),I)}).on("error",l).on("warn",u),new Promise(function(E,C){var I;try{s.parse(e),p()}catch(G){I=G}var k=i.element;!I&&!k&&(I=zo("failed to parse document as <"+i.type.$descriptor.name+">"));var T=a.warnings,F=a.references,z=a.elementsById;return I?(I.warnings=T,C(I)):E({rootElement:k,elementsById:z,references:F,warnings:T})})},rd.prototype.handler=function(e){return new od(this.model,e)};function cC(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var lC=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,uC=/<|>|'|"|&|\n\r|\n/g,Lm=/<|>|&/g;function Xi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Xi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Xi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Xi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Xi.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)},Xi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Xi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Xi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Xi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Xi.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 pC(e){return e.charAt(0).toLowerCase()+e.slice(1)}function dC(e,t){return Pm(t)?pC(e):e}function Im(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Bm(e){return ni(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function fC(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 hC(e,t){return t.isGeneric?Y({localName:t.ns.localName},e):Y({localName:dC(t.ns.localName,t.$pkg)},e)}function gC(e,t){return Y({localName:t.ns.localName},e)}function mC(e){var t=e.$descriptor;return lt(t.properties,function(n){var i=n.name;if(n.isVirtual||!ii(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var yC={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},vC={"<":"lt",">":"gt","&":"amp"};function Nm(e,t,n){return e=ni(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function xC(e){return Nm(e,uC,yC)}function bC(e){return Nm(e,Lm,vC)}function wC(e){return lt(e,function(t){return t.isAttr})}function _C(e){return lt(e,function(t){return!t.isAttr})}function ad(e){this.tagName=e}ad.prototype.build=function(e){return this.element=e,this},ad.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Dr(){}Dr.prototype.serializeValue=Dr.prototype.serializeTo=function(e){e.append(this.escape?bC(this.value):this.value)},Dr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Lm)!==-1&&(this.escape=!0),this};function sd(e){this.tagName=e}Im(sd,Dr),sd.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Gt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Gt.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,o,r=t.isGeneric;return r?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),r?this.parseGenericContainments(e):(o=mC(e),this.parseAttributes(wC(o)),this.parseContainments(_C(o))),this.parseGenericAttributes(e,i),this},Gt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return hC(t,e)},Gt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return gC(t,e)},Gt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Gt.prototype.nsAttributeName=function(e){var t;if(ni(e)?t=zn(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}:Y({localName:t.localName},n)},Gt.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}))},Gt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Dr().build({type:"String"},t));var n=e.$children;n&&V(n,i=>{this.body.push(new Gt(this).build(i))})},Gt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=zn(t),r;if(o.prefix==="xmlns"&&(r={prefix:o.localName,uri:n}),!o.prefix&&o.localName==="xmlns"&&(r={uri:n}),!r)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(r,!0,!0);else{var a=this.logNamespaceUsed(r,!0);this.getNamespaces().logUsed(a)}},Gt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return V(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Gt.prototype.parseGenericAttributes=function(e,t){var n=this;V(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(o){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,o)}})},Gt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;V(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Dr().build(o,r[0]));else if(Em(o.type))V(r,function(l){n.push(new sd(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)V(r,function(l){n.push(new ad(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Om(o);V(r,function(l){var u;c?c===km?u=new Gt(t,o):u=new Wc(t,o,c):u=new Gt(t),n.push(u.build(l))})}})},Gt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Xi(i):t=i),t},Gt.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),o=e.uri,r=e.prefix,a=i.byUri(o);return(!a||n)&&i.add(e,t),i.mapPrefix(r,o),e},Gt.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,o=e.uri,r,a,s;if(!i&&!o)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),o=o||s||n.uriByPrefix(i),!o)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(o),!e&&!i&&(e=this.logNamespace({uri:o},s===o,!0)),!e){for(r=i,a=1;n.uriByPrefix(r);)r=i+"_"+a++;e=this.logNamespace({prefix:r,uri:o},s===o)}return i&&n.mapPrefix(i,o),e},Gt.prototype.parseAttributes=function(e){var t=this,n=this.element;V(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];V(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Gt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Bm(e)},Gt.prototype.addAttribute=function(e,t){var n=this.attrs;ni(t)&&(t=xC(t));var i=mm(n,function(r){return r.name.localName===e.localName&&r.name.uri===e.uri&&r.name.prefix===e.prefix}),o={name:e,value:t};i!==-1?n.splice(i,1,o):n.push(o)},Gt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=fC(n).concat(t)),V(t,function(i){e.append(" ").append(Bm(i.name)).append('="').append(i.value).append('"')})},Gt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Dr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),V(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Wc(e,t,n){Gt.call(this,e,t),this.serialization=n}Im(Wc,Gt),Wc.prototype.parseNsAttributes=function(e){var t=Gt.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 o=e.$model.getPackage(i.uri),r=o.xml&&o.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+r+n.ns.localName),t},Wc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function EC(){this.value="",this.write=function(e){this.value+=e}}function SC(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 RC(e){e=Y({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new EC,r=new SC(o,e.format);e.preamble&&r.append(lC);var a=new Gt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(CC(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function CC(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in td)n[i]=td[i];for(const i in t){const o=t[i];n[o]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Uc(e,t){bi.call(this,e,t)}Uc.prototype=Object.create(bi.prototype),Uc.prototype.fromXML=function(e,t,n){ni(t)||(n=t,t="bpmn:Definitions");var i=new rd(Y({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Uc.prototype.toXML=function(e,t){var n=new RC(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var MC="BPMN20",AC="http://www.omg.org/spec/BPMN/20100524/MODEL",TC="bpmn",PC=[],kC=[{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"}]}],OC=[{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"}]}],DC={tagAlias:"lowerCase",typePrefix:"t"},LC={name:MC,uri:AC,prefix:TC,associations:PC,types:kC,enumerations:OC,xml:DC},IC="BPMNDI",BC="http://www.omg.org/spec/BPMN/20100524/DI",NC="bpmndi",$C=[{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"]}],FC=[{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"}]}],jC=[],HC={name:IC,uri:BC,prefix:NC,types:$C,enumerations:FC,associations:jC},zC="DC",GC="http://www.omg.org/spec/DD/20100524/DC",VC="dc",WC=[{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}]}],UC=[],qC={name:zC,uri:GC,prefix:VC,types:WC,associations:UC},YC="DI",KC="http://www.omg.org/spec/DD/20100524/DI",XC="di",ZC=[{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"}]}],JC=[],QC={tagAlias:"lowerCase"},eM={name:YC,uri:KC,prefix:XC,types:ZC,associations:JC,xml:QC},tM="bpmn.io colors for BPMN",nM="http://bpmn.io/schema/bpmn/biocolor/1.0",iM="bioc",oM=[{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"}]}],rM=[],aM=[],sM={name:tM,uri:nM,prefix:iM,types:oM,enumerations:rM,associations:aM},cM="BPMN in Color",lM="http://www.omg.org/spec/BPMN/non-normative/color/1.0",uM="color",pM=[{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"}]}],dM=[],fM=[],hM={name:cM,uri:lM,prefix:uM,types:pM,enumerations:dM,associations:fM};const gM={bpmn:LC,bpmndi:HC,dc:qC,di:eM,bioc:sM,color:hM};function $m(e,t){const n=Y({},gM,e);return new Uc(n,t)}const mM={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"}},fs={[vm]:mM,[Bp]:pm};function Fm(){return $m(fs)}const jm=Fm();async function ga(e){const{rootElement:t,warnings:n}=await jm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function yM(e){const{xml:t}=await jm.toXML(e,{format:!0});return t}function cd(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Zi={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Hm=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function vM(e){return Hm.test(e)}function xM(e){const t=Zi;return Hm.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 Lr(e,t){let n=0;for(const i of e)n+=t*xM(i);return n}function zm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&bM(e),wM(e),_M(e),EM(e)}function bM(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(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:Lr(o,r),fontBoundingBoxAscent:r*Zi.ascentEm,fontBoundingBoxDescent:r*Zi.descentEm,actualBoundingBoxAscent:r*Zi.ascentEm,actualBoundingBoxDescent:r*Zi.descentEm}}};t.getContext=()=>n}function wM(e){if(e.SVGMatrix)return;class t{constructor(){sn(this,"a",1);sn(this,"b",0);sn(this,"c",0);sn(this,"d",1);sn(this,"e",0);sn(this,"f",0)}static of(i,o,r,a,s,c){return Object.assign(new t,{a:i,b:o,c:r,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,o){return this.multiply(t.of(1,0,0,1,i,o))}scale(i,o=i){return this.multiply(t.of(i,0,0,o,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 _M(e){var r;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),d=Math.sin(u);a.a=p,a.b=d,a.c=-d,a.d=p,a.e=c-p*c+d*l,a.f=l-d*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.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 o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"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 EM(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:Lr(n,12),height:14}})}const qc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),SM=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),RM=1,Yc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),CM=2;function ct(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 Gm=20,Kc=5,Vm=3,MM=8,ma=15,ld=50,Wm=12,AM=Wm*1.2;function ud(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Lr(r,Wm))),o=n.length*AM;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Um=1;function cn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];Math.abs(i.y-o.y)<.5&&Math.abs(i.x-o.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,o.x),hi:Math.max(i.x,o.x),dir:o.x>i.x?1:-1}):Math.abs(i.x-o.x)<.5&&Math.abs(i.y-o.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,o.y),hi:Math.max(i.y,o.y),dir:o.y>i.y?1:-1})}return t}function Ir(e,t){let n=null;const i=e.type!==t.type,r=!!(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 cn(e))for(const s of cn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Um)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":r?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Gm&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function pd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function qm(e,t){const n=Ir(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function TM(e,t){let n=0;for(const i of t)i.id!==e.id&&qm(e,i)&&n++;return n}function Jn(e,t){let n=0;for(const i of t)i.id!==e.id&&Ir(e,i)&&n++;return n}const Ym=15,Km=20;function PM(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Km||t.at>n[1]+Km)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],o=Math.max(i[0],t.lo),r=Math.min(i[1],t.hi);return r>o?[o,r]:null}const dd=20;function Xc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Um)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<Gm||n.push([o-dd,r+dd])}return n}function Zc(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of cn(e)){const r=PM(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Xc(o,cn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const kM=10,OM=1,DM=(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 LM(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const d=(f,g)=>{if(g===0)return f<=0;const h=f/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 d(o-e.x,c)&&d(e.x-a,-c)&&d(r-e.y,l)&&d(e.y-s,-l)&&p>u}function fd(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 IM=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ya=1;function Fi(e,t){const n=e.x+ya,i=e.x+e.width-ya,o=e.y+ya,r=e.y+e.height-ya;return t.axis==="h"?t.at>o&&t.at<r&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<r&&t.hi>o}function va(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 Xm(e,t){const n=e.label;if(!n)return null;if(cn(e).some(i=>Fi(n,i)))return e.id;for(const i of[...t.edges].filter(o=>o.id!==e.id).sort((o,r)=>o.id.localeCompare(r.id)))if(cn(i).some(o=>Fi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(va(i).some(o=>Fi(n,o)))return i.id;return null}function Pt(e,t){const n=new Set(e.endpoints),i=[];for(const o of t)if(!n.has(o.id)){for(let r=0;r+1<e.waypoints.length;r++)if(LM(e.waypoints[r],e.waypoints[r+1],o,CM)){i.push(o);break}}return i}const hs=(e,t,n)=>{const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*o))},BM=(e,t,n,i)=>Jm(e,t,n,i)?0:Math.min(hs(e,n,i),hs(t,n,i),hs(n,e,t),hs(i,e,t)),Zm=(e,t)=>{let n=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const r=t[i],a=t[o];r.y>e.y!=a.y>e.y&&e.x<(a.x-r.x)*(e.y-r.y)/(a.y-r.y)+r.x&&(n=!n)}return n};function Go(e,t,n){const{x:i,y:o,width:r,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(r,a)/2;return Math.max(0,hs({x:i+r/2,y:o+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+r/2,y:o},{x:i+r,y:o+a/2},{x:i+r/2,y:o+a},{x:i,y:o+a/2}]:[{x:i,y:o},{x:i+r,y:o},{x:i+r,y:o+a},{x:i,y:o+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,BM(e,t,s[l],s[(l+1)%s.length]));return c}function Jm(e,t,n,i){const o=(l,u,p)=>(u.x-l.x)*(p.y-l.y)-(u.y-l.y)*(p.x-l.x),r=o(n,i,e),a=o(n,i,t),s=o(e,t,n),c=o(e,t,i);return r*a<0&&s*c<0}const hd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Qm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(Jm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function gs(e,t){let n=0;for(const i of t)i.id===e.id||hd(e,i)||Qm(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id===e.id||hd(e,i)||gs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function ey(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)gs(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function Ji(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(gs(n[i],[n[o]])>0){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function wi(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(hd(n[i],n[o])&&Qm(n[i],n[o])){const r=n[i].id,a=n[o].id;t.push(r<a?[r,a]:[a,r])}return t.sort((i,o)=>`${i[0]}|${i[1]}`.localeCompare(`${o[0]}|${o[1]}`))}function ty(e){const t=Ji(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let o=0,r=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"?o++:u==="dashed"&&p==="dashed"&&r++}return{pairs:t,solidPairs:o,dashedPairs:r,mixedPairs:t.length-o-r,crossPoolMessages:NM(e)}}function NM(e){const t=e.shapes.filter(o=>o.type==="bpmn:Participant");if(t.length<3)return 0;const n=o=>{const r=e.shapes.find(a=>a.id===o);if(r)return t.find(a=>r.x>=a.x&&r.y>=a.y&&r.x+r.width<=a.x+a.width&&r.y+r.height<=a.y+a.height)};let i=0;for(const o of e.edges){if(o.type!=="bpmn:MessageFlow"||o.endpoints.length<2)continue;const r=n(o.endpoints[0]),a=n(o.endpoints[1]);if(!r||!a||r.id===a.id)continue;const s=Math.min(r.y,a.y),c=Math.max(r.y+r.height,a.y+a.height);t.some(l=>l.id!==r.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function ny(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Yc.has(o.type)&&!i.has(o.id)&&o.x>=n.x&&o.y>=n.y&&o.x+o.width<=n.right&&o.y+o.height<=n.bottom).map(o=>o.id).sort()}function iy(e){var n;const t=(n=zt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=zt(i);if((o==null?void 0:o.$type)!=="bwl:Members"||typeof o.refs!="string")continue;const r=o.refs.split(/\s+/).filter(Boolean);return r.length?r:void 0}}const oy=e=>e?{members:e}:{},kn=e=>e.shapes.filter(t=>!t.container);function $M(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 o=i.endpoints.find(a=>a!==e.id),r=o?n.get(o):void 0;if(r&&r.type!=="bpmn:Group"){if(r.container)return r.id;if(r.parent)return r.parent}}}function FM(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 o=e.x+e.width/2,r=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&o>=a.x&&o<=a.x+a.width&&r>=a.y&&r<=a.y+a.height)}function ry(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((o,r)=>o.id.localeCompare(r.id)))if(cn(i).some(o=>Fi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(va(i).some(o=>Fi(n,o)))return i.id;return null}function Vo(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 ay=3;function sy(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 o=/Event$/.test(t.type);if(!o&&!/Gateway$/.test(t.type))return Math.min(n,i);const r=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(r,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(o)return Math.max(0,t.width/2-Math.hypot(s-r,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-r)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ms(e,t){const n=[];for(const i of t.shapes){if(i.container||Yc.has(i.type))continue;const o=sy(e,i);o>=ay&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function gd(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function ut(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of Pt(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const o=e.shapes.filter(m=>m.container&&SM.has(m.type));if(o.length){const m=(v,b)=>{const E=e.shapes.find(C=>C.id===b);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 b of Pt(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>m(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.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[b,E]of v){if(!b)continue;const C=e.shapes.find(F=>F.id===b);if(!C||C.container)continue;const I=Math.max(C.x-E.x,E.x-(C.x+C.width),0),k=Math.max(C.y-E.y,E.y-(C.y+C.height),0),T=Math.hypot(I,k);T>kM&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:b,distance:Math.round(T)})}}for(const m of gd(e.shapes))n.push({kind:"pool-overlap",...m});const r=i.filter(m=>!m.attached);for(let m=0;m<r.length;m++)for(let v=m+1;v<r.length;v++){const b=r[m],E=r[v];if(!fd(b,E,RM))continue;const C=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:C,identical:IM(b,E)})}const a=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const b=a[m],E=a[v],C=Math.min(b.x+b.width,E.x+E.width)-Math.max(b.x,E.x),I=Math.min(b.y+b.height,E.y+E.height)-Math.max(b.y,E.y);if(C<=Kc||I<=Kc)continue;const k=b.id<E.id?[b.id,E.id]:[E.id,b.id],T=new Set(E.members);if(b.members.some(z=>T.has(z))){const z=ny(e,a,{x:Math.max(b.x,E.x),y:Math.max(b.y,E.y),right:Math.min(b.x+b.width,E.x+E.width),bottom:Math.min(b.y+b.height,E.y+E.height)});z.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:k,shapes:z});continue}const F=b.x<=E.x&&b.y<=E.y&&b.x+b.width>=E.x+E.width&&b.y+b.height>=E.y+E.height?b.id:E.x<=b.x&&E.y<=b.y&&E.x+E.width>=b.x+b.width&&E.y+E.height>=b.y+b.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:k,...F?{container:F}:{}})}const s=new Set(a.flatMap(m=>[...m.members])),c=m=>e.shapes.filter(v=>!v.container&&!Yc.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 a){const v=c(m);if(!v.length)continue;const b=new Set(m.members),E=v.filter(C=>!b.has(C.id));E.some(C=>s.has(C.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:E.map(C=>C.id).sort()}))}for(const m of a){const v=new Set(c(m).map(T=>T.id)),b=new Set(m.members),E=new Set([...v].filter(T=>!b.has(T)&&s.has(T)));if(!E.size)continue;let C=!1,I=!1,k=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const F=E.has(T.source),z=E.has(T.target);!F&&z&&!v.has(T.source)?C=!0:F&&!z&&!v.has(T.target)?I=!0:F&&z&&(k=!0)}C&&I&&k&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...E].sort()})}const l=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<l.length;m++)for(let v=m+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[m],l[v],l[b]],C={x:Math.max(...E.map(T=>T.x)),y:Math.max(...E.map(T=>T.y)),right:Math.min(...E.map(T=>T.x+T.width)),bottom:Math.min(...E.map(T=>T.y+T.height))};if(C.right-C.x<=Kc||C.bottom-C.y<=Kc)continue;const I=ny(e,[],C);if(!I.length)continue;const k=E.map(T=>T.id).sort();n.push({kind:"group-stack-unreadable",groups:k,shapes:I})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Yc.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["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,C,I,k,T]of b){const F=I==="h"?v.x:v.y,z=I==="h"?v.x+v.width:v.y+v.height;if(!(F<T&&k<z))continue;const G=I==="h"?v.y:v.x,ne=I==="h"?v.y+v.height:v.x+v.width;if(!(G<C&&C<ne))continue;const re=Math.min(C-G,ne-C);re<MM||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:E,depth:re})}}const u=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(u.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 b=cn(v);if(b.length)for(const E of u){const C=E.x+E.width,I=E.y+E.height,k=v.endpoints.some(F=>{const z=m.get(F);return!!z&&E.x<z.x&&z.x<C&&E.y<z.y&&z.y<I});let T=null;for(const F of b){const[z,G,ne]=F.axis==="v"?[E.y,I,[["left",E.x],["right",C]]]:[E.x,C,[["top",E.y],["bottom",I]]],re=Math.min(F.hi,G)-Math.max(F.lo,z);if(re<ld)continue;const K=F.axis==="v"?E.x<F.at&&F.at<C:E.y<F.at&&F.at<I;if(!(K&&k))for(const[xe,de]of ne){const we=Math.abs(F.at-de);we<=ma&&(!T||we<T.distance)&&(T={side:xe,inside:K,distance:we,length:re})}}T&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:T.side,inside:T.inside,distance:Math.round(T.distance),length:Math.round(T.length)})}}}const p=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 p){const b=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,C=[["top",m.y,v.y,b],["bottom",m.y+m.height,v.y+v.height,b],["left",m.x,v.x,E],["right",m.x+m.width,v.x+v.width,E]];for(const[I,k,T,F]of C)F&&Math.abs(k-T)<=Vm&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:I})}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 b=d[m],E=d[v],C=b.x<E.x+E.width&&E.x<b.x+b.width,I=b.y<E.y+E.height&&E.y<b.y+b.height,k=[["x",b.x+b.width,E.x,I],["x",E.x+E.width,b.x,I],["y",b.y+b.height,E.y,C],["y",E.y+E.height,b.y,C]];for(const[T,F,z,G]of k)if(G&&Math.abs(F-z)<=Vm){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:T});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const b=e.edges[m],E=e.edges[v],C=Ir(b,E);if(!C)continue;const I=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:I,axis:C.axis,length:Math.round(C.length)})}for(const m of e.edges){if(!m.label)continue;const v=Zc(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=Xm(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:b}of ms(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(b)})}const f=new Set(i.map(m=>m.id)),g=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...g.filter(v=>!f.has(v.id))]){if(!m.label)continue;const v=ry(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const h=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of g)for(const{owner:v,rect:b}of Vo(e))v===m.id||h.has(v)||fd(m.label,b,ya)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const y=Vo(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of y)v!==m.id&&fd(m,b,ya)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const _=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??$M(m,e,_);if(!v)continue;const b=_.get(v);!b||!b.container||DM(b,m,OM)||m.type==="bpmn:TextAnnotation"&&!FM(m,b,e)||n.push({kind:"shape-outside-container",shape:m.id,container:b.id})}return n.sort((m,v)=>ct(m).localeCompare(ct(v)))}const zt=e=>typeof e=="object"&&e!==null?e:void 0,Qt=e=>typeof e=="number"?e:0,vo=e=>{const t=zt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function jM(e){const t=zt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const o=t[i];for(const r of Array.isArray(o)?o:[o]){const a=vo(r);a&&n.push(a)}}return n}function HM(e){const t=zt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:vo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:vo(t.targetRef);return n&&i?{source:n,target:i}:{}}function zM(e,t){const n=zt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=vo(n);return o?t.get(o):void 0}if(qc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return vo(n)}function cy(e){var a,s,c,l,u;const t=[],n=[],i=((a=zt(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=zt(e))==null?void 0:s.rootElements)??[]){const d=zt(p);if((d==null?void 0:d.$type)==="bpmn:Collaboration")for(const f of d.participants??[]){const g=zt(f),h=vo(g),y=vo(g==null?void 0:g.processRef);h&&y?o.set(y,h):h&&r.add(h)}}for(const p of i){const d=zt((c=zt(p))==null?void 0:c.plane),f=(d==null?void 0:d.planeElement)??[];for(const g of f){const h=zt(g);if(!h)continue;const y=zt(h.bpmnElement),_=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!_)continue;const m=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",v=zt(h.bounds);if(v){const E=h.isExpanded===!1&&m!=="bpmn:Participant",C=zt((l=zt(h.label))==null?void 0:l.bounds),I={id:_,type:m,x:Qt(v.x),y:Qt(v.y),width:Qt(v.width),height:Qt(v.height),container:qc.has(m)&&!E,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:zM(y,o)}:{},...C?{label:{x:Qt(C.x),y:Qt(C.y),width:Qt(C.width),height:Qt(C.height)}}:{},...m==="bpmn:Group"?oy(iy(y)):{}},k=h.isHorizontal!==!1,T=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(_)&&k&&T&&(I.label=ud(I,T)),t.push(I);continue}const b=h.waypoint;if(Array.isArray(b)){const E=zt((u=zt(h.label))==null?void 0:u.bounds);n.push({id:_,type:m,waypoints:b.map(C=>{var I,k;return{x:Qt((I=zt(C))==null?void 0:I.x),y:Qt((k=zt(C))==null?void 0:k.y)}}),endpoints:jM(y),...HM(y),...E?{label:{x:Qt(E.x),y:Qt(E.y),width:Qt(E.width),height:Qt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function ly(e){return ut(cy(e),{includeObservationOnly:!0})}async function GM(e){const{definitions:t,warnings:n}=await ga(e);return{findings:ly(t),warnings:n}}function Ve(e){var i;const t=[],n=[];for(const o of e.getAll()){const r=o;if(r.type==="label"||r.labelTarget)continue;const a=typeof r.type=="string"?r.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=r.waypoints;if(s){const h=zt(r.label),y=vo(r.source),_=vo(r.target);n.push({id:r.id,type:a,waypoints:s.map(m=>({x:Qt(m.x),y:Qt(m.y)})),endpoints:[y,_].filter(m=>!!m),...y&&_?{source:y,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Qt(h.y),width:Qt(h.width),height:Qt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=zt(r.businessObject),l=zt(r.label);let u=zt(r.parent);for(;u&&u.type==="bpmn:Lane";)u=zt(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",d=u&&qc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,f={id:r.id,type:a,x:r.x,y:r.y,width:Qt(r.width),height:Qt(r.height),container:qc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...d!==void 0?{parent:d}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Qt(l.y),width:Qt(l.width),height:Qt(l.height)}}:{},...a==="bpmn:Group"?oy(iy(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=zt(r.di))==null?void 0:i.isHorizontal)!==!1&&(f.label=ud(f,g)),t.push(f)}return{shapes:t,edges:n}}const VM={"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 WM(e,t){const n=VM[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function uy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function py(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 WM(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&uy(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?uy(i):void 0},endpointsOf:n=>{var o,r;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(o=i.source)==null?void 0:o.id,target:(r=i.target)==null?void 0:r.id}},eventDefinitionOf:n=>{var r;const i=e.get(n);if(!i||i.type!=="bpmn:IntermediateCatchEvent")return;const o=(((r=i.businessObject)==null?void 0:r.eventDefinitions)??[]).map(a=>a.$type);return Ip(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Fo(i.businessObject).map(o=>o.locale)}}}const Br=20,UM=4,We=(e,t)=>Math.abs(e-t)<.5,qM=15;function md(e,t,n){let i=1/0;for(const o of t)if(!n.includes(o.id))for(let r=1;r<e.length;r++)i=Math.min(i,Go(e[r-1],e[r],o));return i}function YM(e,t,n=qM){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=We(i.x,o.x)&&!We(i.y,o.y),a=We(i.y,o.y)&&!We(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=_=>{const m=_?t.find(v=>v.id===_):void 0;return m?r?[m.x+10,m.x+m.width-10]:[m.y+10,m.y+m.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),g=Math.min(u,d);if(!(g>=f))return[];const h=r?i.x:i.y,y=[];for(let _=5;_<=400;_+=5)for(const m of[-1,1]){const v=h+m*_;if(v<f||v>g)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Pt({...e,waypoints:b},t).length||md(b,t,s)<n||y.push(b)}return y}function yd(e,t,n,i){const o=e.edges.filter(d=>d.id!==t.id),r={...t,waypoints:n},a={...t,waypoints:[...i]};if(Gn(r,o)>Gn(a,o)||Jn(r,o)>Jn(a,o))return!1;const s=`L|${t.id}|${t.id}`,c=d=>ut({...e,edges:e.edges.map(f=>f.id===t.id?{...f,waypoints:d}:f)}).filter(f=>ct(f)!==s),l=c(n),u=`"${t.id}"`;if(l.some(d=>JSON.stringify(d).includes(u)))return!1;const p=new Set(c([...i]).map(ct));return l.every(d=>p.has(ct(d)))}function dy(e,t,n,i){for(const o of YM(t,n))if(yd(e,t,o,i))return o;return null}const KM=120;function fy(e,t,n,i,o){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return[];const r=t.find(c=>c.id===e.endpoints[0]),a=t.find(c=>c.id===e.endpoints[1]);if(!r||!a)return[];if(a.x<r.x+r.width)return[];if(Math.min(r.y+r.height,a.y+a.height)-Math.max(r.y,a.y)<10)return[];const s=[];for(const[c,l]of[[0,0],[0,-25],[0,25],[-25,0],[25,0]])for(let u=Br;u<=KM;u+=5)for(const p of["top","bottom"]){const d=p==="top"?r.y:r.y+r.height,f=p==="top"?a.y:a.y+a.height,g=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,h=r.x+r.width/2+c,y=a.x+a.width/2+l,_=[{x:h,y:d},{x:h,y:g},{x:y,y:g},{x:y,y:f}];if(!nl(_,i)||Pt({...e,waypoints:_},t).length||Pt({...e,endpoints:[],waypoints:_},[r,a]).length||md(_,t,e.endpoints)<Br)continue;const m=Cd(_,n);(o===void 0?m<Rd:m>=Rd||m<o)||s.push(_)}return s}function hy(e,t,n,i,o){const r=e.shapes.filter(c=>c.type==="bpmn:Participant"||c.type==="bpmn:Lane"),a=gy(e,t,i,fy(t,n,r,o));if(a)return a;const s=Math.max(Cd(i,r),Br);return gy(e,t,i,fy(t,n,r,o,s))}function gy(e,t,n,i){const o=new Map;for(const c of i){const l=c[1].y<c[0].y?"top":"bottom";if(!o.has(l)&&(yd(e,t,c,n)&&o.set(l,c),o.size===2))break}const r=e.edges.filter(c=>c.id!==t.id);let a=null,s=1/0;for(const c of["top","bottom"]){const l=o.get(c);if(!l)continue;const u=Gn({...t,waypoints:l},r);u<s&&(a=l,s=u)}return a}function Jc(e,t,n,i=Br){if(We(e.y,t.y)&&!We(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x);if(!(o<n.x-i&&n.x+n.width+i<r))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(We(e.x,t.x)&&!We(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y);if(!(o<n.y-i&&n.y+n.height+i<r))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 my(e,t,n,i=Br){if(n.length<2)return null;if(We(e.y,t.y)&&!We(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(f=>f.x))-i,s=Math.max(...n.map(f=>f.x+f.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(f=>f.y))-i,p=Math.max(...n.map(f=>f.y+f.height))+i,d=f=>[{x:c,y:e.y},{x:c,y:f},{x:l,y:f},{x:l,y:e.y}];return[d(u),d(p)]}if(We(e.x,t.x)&&!We(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(f=>f.y))-i,s=Math.max(...n.map(f=>f.y+f.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(f=>f.x))-i,p=Math.max(...n.map(f=>f.x+f.width))+i,d=f=>[{x:e.x,y:c},{x:f,y:c},{x:f,y:l},{x:e.x,y:l}];return[d(u),d(p)]}return null}function yy(e,t,n=Br){if(e.length!==4)return null;const[i,o,r,a]=e;if(We(i.y,o.y)&&We(o.x,r.x)&&We(r.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(We(i.x,o.x)&&We(o.y,r.y)&&We(r.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 Qc(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 o=n.y+n.height/2,r=i.y+i.height/2;if(o>=i.y&&o<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=o>r,l=[{x:n.x+n.width,y:o},{x:a,y:o},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:r},{x:i.x,y:r}];return[l,u]}const el=30,XM=[0,-25,25,-40,40];function ZM(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(d=>d.id===e.endpoints[0]),i=t.find(d=>d.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+el:s-el,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return XM.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Pt({...e,endpoints:[],waypoints:d},[n]).length===0)}const vd=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],xa=(e,t,n)=>Pt({...e,waypoints:t},n).length;function tl(e,t,n,i){let o=[...e.waypoints],r=xa(e,o,t);if(r===0)return null;let a=!1;for(const p of Qc(e,t))if(xa(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(cn),c=p=>cn({...e,waypoints:p}).some(d=>Xc(d,s).length>0),l=ZM(e,t).filter(p=>xa(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(d=>d.x>=n.x&&d.x<=n.x+n.width&&d.y>=n.y&&d.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(f=>f.id===e.endpoints[0]),d=t.find(f=>f.id===e.endpoints[1]);if(p&&d&&We(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(We(f[0].y,f[1].y)&&!We(f[0].x,f[1].x)){const g=t.filter(m=>!e.endpoints.includes(m.id)&&Pt({...e,waypoints:f},[m]).length>0),h=g.length>=2?my(f[0],f[1],g):null,_=(h?h.map(m=>[f[0],...m,f[1]]):g.length===1?(Jc(f[0],f[1],g[0])??[]).map(m=>[f[0],...m,f[1]]):g.length===0?[f]:[]).filter(m=>xa(e,m,t)===0&&m.length<=o.length).sort((m,v)=>Number(u(v))-Number(u(m)));if(_.length)return _.find(m=>!c(m))??_[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&Pt({...e,waypoints:[d,f]},[_]).length>0);if(g.length<2)continue;const h=my(d,f,g);if(!h)continue;const y=h.map(_=>vd(o,p,_)).filter(_=>xa(e,_,t)===0).sort((_,m)=>Number(u(m))-Number(u(_)));if(y.length)return y.find(_=>!c(_))??y[0]}for(let p=0;p<UM&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const g=o[f],h=o[f+1];for(const y of t){if(e.endpoints.includes(y.id)||Pt({...e,waypoints:[g,h]},[y]).length===0)continue;const _=Jc(g,h,y),m=_?_.map(b=>vd(o,f,b)):yy(o,y)??[];if(!m.length)continue;const v=[...m].sort((b,E)=>Number(u(E))-Number(u(b)));for(const b of v){const E=xa(e,b,t);if(E<r){o=b,r=E,d=!0,a=!0;break}}if(d)break}}if(!d)break}return a&&r===0?o:null}function xd(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=kn(r),s=new Set,c=ut(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(ct(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=r.edges.find(d=>d.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const d=i.get(u);if(!d)continue;const f=d.parent,g=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,h=Pt(p,a);if(!n&&h.length&&h.every(C=>C.type==="bpmn:TextAnnotation")){s.add(u);continue}let y=tl(p,a,g,r.edges);const _=dy(r,p,a,y??p.waypoints);_&&(y=_);const m=hy(r,p,a,y??p.waypoints,g);if(m&&Gn({...p,waypoints:m},r.edges.filter(C=>C.id!==u))===0&&(y=m),!y){h.some(C=>C.type==="bpmn:TextAnnotation")&&s.add(u);continue}const v=r.edges.filter(C=>C.id!==u),b=Jn(p,v);Jn({...p,waypoints:y},v)>b||o.updateWaypoints(d,y)}return s}function JM(e,t,n,i){var f,g;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=h=>{const y=Ve(r);return[...Ji(y),...wi(y)].filter(([_,m])=>_===h||m===h).length},c=(h,y)=>h.kind==="label-over-line"||h.kind==="label-over-shape"||h.kind==="label-on-shared-segment"?h.edge===y:h.kind==="annotation-over-label"||h.kind==="pool-name-over-label"?h.label===y:!1,l=h=>new Set(ut(Ve(r)).filter(y=>!c(y,h)).map(ct)),u=(h,y)=>Math.abs(h-y)<=1,p=(h,y,_,m,v)=>{const b=kn(Ve(r));for(let E=0;E+3<h.length;E++){const[C,I,k,T]=[h[E],h[E+1],h[E+2],h[E+3]],F=u(C.y,T.y)&&u(C.x,I.x)&&u(k.x,T.x)&&u(I.y,k.y)&&Math.abs(I.y-C.y)>=5,z=u(C.x,T.x)&&u(C.y,I.y)&&u(k.y,T.y)&&u(I.x,k.x)&&Math.abs(I.x-C.x)>=5;if(!F&&!z)continue;const G={waypoints:[C,T],endpoints:_};if(Pt(G,[y]).length&&!Pt(G,b).length)return E}return-1},d=(h,y)=>[...h.slice(0,y+1),...h.slice(y+3)].filter((_,m,v)=>m===0||m===v.length-1||!(u(v[m-1].x,_.x)&&u(v[m+1].x,_.x)||u(v[m-1].y,_.y)&&u(v[m+1].y,_.y)));for(const h of t){const y=r.get(h.id);if(!y)continue;const _=new Set([...y.incoming??[],...y.outgoing??[]].map(b=>b.id)),m={...h,type:y.type,container:!1,attached:!1},v=r.getAll().filter(b=>{var E;return(b.type==="bpmn:SequenceFlow"||b.type==="bpmn:MessageFlow")&&n.has(b.id)&&!i.has(b.id)&&!_.has(b.id)&&(((E=b.waypoints)==null?void 0:E.length)??0)>=4}).sort((b,E)=>b.id.localeCompare(E.id));for(const b of v){const E=[(f=b.source)==null?void 0:f.id,(g=b.target)==null?void 0:g.id].filter(C=>!!C);for(;;){const C=b.waypoints.map(K=>({x:K.x,y:K.y})),I=p(C,m,E,b.id,b.type);if(I<0)break;const k=b.label,T=k&&{x:k.x,y:k.y},F=l(b.id),z=s(b.id);if(a.updateWaypoints(b,d(C,I)),k&&T){const K={x:T.x+k.width/2,y:T.y+k.height/2},xe=(we,he)=>{const W=he.x-we.x,le=he.y-we.y,q=W*W+le*le,ee=q===0?0:Math.max(0,Math.min(1,((K.x-we.x)*W+(K.y-we.y)*le)/q));return Math.hypot(K.x-(we.x+ee*W),K.y-(we.y+ee*le))};let de=0;for(let we=1;we+1<C.length;we++)xe(C[we],C[we+1])<xe(C[de],C[de+1])&&(de=we);(de<I||de>I+2)&&(k.x!==T.x||k.y!==T.y)&&a.moveElements([k],{x:T.x-k.x,y:T.y-k.y})}const G=l(b.id),ne=[...G].filter(K=>!F.has(K)).length,re=[...F].filter(K=>!G.has(K)).length;if(ne<=re&&s(b.id)<=z){o.add(b.id);continue}a.updateWaypoints(b,C),k&&T&&(k.x!==T.x||k.y!==T.y)&&a.moveElements([k],{x:T.x-k.x,y:T.y-k.y});break}}}return o}const QM=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],o=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,o.x)-1,y:Math.min(i.y,o.y)-1,width:Math.max(2,Math.abs(o.x-i.x)+2),height:Math.max(2,Math.abs(o.y-i.y)+2),container:!1,attached:!1})}return t};function ys(e){const t=e.parent;return t&&typeof t.x=="number"&&typeof t.width=="number"?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0}const nl=(e,t)=>!t||e.every(n=>n.x>=t.x&&n.x<=t.x+t.width&&n.y>=t.y&&n.y<=t.y+t.height),bd=(e,t)=>gs(e,[t])>0;function vy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=kn(r);let s=r;const c=new Set(ut(r).map(ct));for(const[l,u]of Ji(r))if(!t.has(`${l}|${u}`))for(const[p,d]of[[l,u],[u,l]]){if(n.has(p))continue;const f=s.edges.find(I=>I.id===p),g=s.edges.find(I=>I.id===d);if(!f||!g)continue;const h=i.get(p);if(!h)continue;const y=ys(h),_=QM(g),m=[...Qc(f,a)??[]],v=tl(f,[...a,..._],y,r.edges);v&&m.push(v);for(let I=0;I+1<f.waypoints.length;I++)for(const k of _)for(const T of Jc(f.waypoints[I],f.waypoints[I+1],k)??[])m.push(vd(f.waypoints,I,T));const b=s.edges.filter(I=>I.id!==p),E=I=>({...s,edges:s.edges.map(k=>k.id===p?{...k,waypoints:I}:k)}),C=m.find(I=>{const k={...f,waypoints:I};return bd(k,g)||!nl(I,y)||b.some(T=>T.id!==d&&!bd(f,T)&&bd(k,T))?!1:ut(E(I)).every(T=>c.has(ct(T)))});if(C){o.updateWaypoints(h,C),s=E(C);break}}}const eA=["top","bottom","left","right"],xy={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},vs=20,tA=20;function nA(e,t){const n=e.x>=t.x-.5&&e.x<=t.x+t.width+.5,i=e.y>=t.y-.5&&e.y<=t.y+t.height+.5,o=[];return n&&We(e.y,t.y)&&o.push("top"),n&&We(e.y,t.y+t.height)&&o.push("bottom"),i&&We(e.x,t.x)&&o.push("left"),i&&We(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const iA=(e,t)=>t==="top"?{x:e.x+e.width/2,y:e.y}:t==="bottom"?{x:e.x+e.width/2,y:e.y+e.height}:t==="left"?{x:e.x,y:e.y+e.height/2}:{x:e.x+e.width,y:e.y+e.height/2};function by(e,t,n,i){const o=xy[t],r=xy[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],g=r[p];if(We(e[d],n[d]))return f===-g&&f*(n[p]-e[p])>=vs?[e,n]:null;let h;if(f===-g){const _=e[p]+f*vs,m=n[p]-f*vs;if(f*(m-_)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=f>0?Math.max(e[p],n[p])+el:Math.min(e[p],n[p])-el;const y=(_,m)=>a?{x:m,y:_}:{x:_,y:m};return[e,y(h,e[d]),y(h,n[d]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=vs&&u>=vs?[e,c,n]:null}function oA(e,t,n){const i=e.waypoints;if(i.length<2||!e.source||!e.target||e.source===e.target)return[];const o=e.source===t.id,r=n.get(o?e.target:e.source),a=o?i[i.length-1]:i[0],s=r?nA(a,r):null;if(!s)return[];const c=[];for(const l of eA){const u=iA(t,l),p=o?by(u,l,a,s):by(a,s,u,l);p&&c.push(p)}return c}const wy=e=>e.slice(1).reduce((t,n,i)=>t+Math.abs(n.x-e[i].x)+Math.abs(n.y-e[i].y),0);function rA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ut(r).map(ct));let c=r;for(const[l,u]of wi(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(T=>T.id===l),d=c.edges.find(T=>T.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!wi({edges:[p,d]}).length)continue;const f=p.endpoints.find(T=>d.endpoints.includes(T)),g=f?a.get(f):void 0;if(!g||g.container)continue;const h=i.get(l),y=i.get(u);if(!h||!y)continue;const _=T=>n.has(T.id)?[T.waypoints]:[T.waypoints,...oA(T,g,a)],m=T=>T.length-2,v=_(p).flatMap(T=>_(d).map(F=>({pa:T,pb:F}))).filter(({pa:T,pb:F})=>T!==p.waypoints||F!==d.waypoints).map(T=>({...T,cost:wy(T.pa)+wy(T.pb)+tA*(m(T.pa)+m(T.pb))})).sort((T,F)=>T.cost-F.cost),b=ys(h),E=ys(y),C=wi(c).length,I=new Set(Ji(c).map(([T,F])=>`${T}|${F}`)),k=v.find(({pa:T,pb:F})=>{const z={...p,waypoints:T},G={...d,waypoints:F};if(wi({edges:[z,G]}).length||Ir(z,G)||!nl(T,b)||!nl(F,E))return!1;const ne={...c,edges:c.edges.map(re=>re.id===l?z:re.id===u?G:re)};return wi(ne).length>=C||Ji(ne).some(([re,K])=>!I.has(`${re}|${K}`))?!1:ut(ne).every(re=>s.has(ct(re)))});k&&(k.pa!==p.waypoints&&o.updateWaypoints(h,k.pa),k.pb!==d.waypoints&&o.updateWaypoints(y,k.pb),c={...c,edges:c.edges.map(T=>T.id===l?{...p,waypoints:k.pa}:T.id===u?{...d,waypoints:k.pb}:T)})}}const aA=40,sA=20;function cA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=Ve(i),p=wi(u);return{keys:new Set(ut(u).map(ct)),crossings:Ji(u).length,shared:p.length,mine:p.filter(([d,f])=>d===l||f===l).length}},a=(l,u)=>{const p=Ve(i),d=p.edges.find(f=>f.id===l);return d?new Set(Pt({...d,waypoints:u},kn(p)).map(f=>f.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,d=s(u)?u:s(p)?p:void 0;if(!d)continue;const f=d===u?p:u;if(!f||f.type==="bpmn:Participant")continue;const g=f.x+f.width/2;if(g>=d.x+10&&g<=d.x+d.width-10)continue;const h=g>d.x+d.width,y=d.y>f.y,_=y?f.y+f.height:f.y,m=y?d.y:d.y+d.height,v=Math.round((_+m)/2),b=F=>d===u?[...F].reverse():F,E=(l.waypoints??[]).map(F=>({x:F.x,y:F.y})),C=r(l.id),I=a(l.id,E)??new Set,k=h?d.x+d.width:d.x,T=d.x+d.width/2;for(let F=Math.min(aA,d.width/4);h?k-F>T:k+F<T;F+=sA){const z=Math.round(h?k-F:k+F),G=b([{x:g,y:_},{x:g,y:v},{x:z,y:v},{x:z,y:m}]),ne=a(l.id,G);if(!ne||[...ne].some(K=>!I.has(K)))continue;o.updateWaypoints(l,G);const re=r(l.id);if(re.crossings<=C.crossings&&re.shared<=C.shared&&re.mine<=C.mine&&[...re.keys].every(K=>C.keys.has(K)))break;o.updateWaypoints(l,E)}}}const lA=10;function _y(e,t){if(e.parent){const o=t.find(r=>r.id===e.parent);if(o)return o}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(o=>n>=o.x&&n<=o.x+o.width&&i>=o.y&&i<=o.y+o.height)}function Ey(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(re=>re.type==="bpmn:Participant"&&re.container),i=t.shapes.find(re=>re.id===e.endpoints[0]),o=t.shapes.find(re=>re.id===e.endpoints[1]);if(!i||!o)return null;const r=_y(i,n),a=_y(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(re=>re.id!==r.id&&re.id!==a.id&&re.y>=c.y+c.height&&re.y+re.height<=l.y).sort((re,K)=>re.y-K.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,g=(d.y+d.height+l.y)/2,h=s?f:g,y=s?g:f,_=e.waypoints[0],m=e.waypoints[e.waypoints.length-1],v=kn(t),b=t.edges.filter(re=>re.id!==e.id),E=Gn(e,b),C=Pt(e,v).length;if(E===0&&C===0||C===0&&e.waypoints.length===2)return null;const I=Math.min(...u.map(re=>re.x)),k=Math.max(...u.map(re=>re.x+re.width)),T=(_.x+m.x)/2,F=re=>re.filter((K,xe)=>xe===0||!(We(K.x,re[xe-1].x)&&We(K.y,re[xe-1].y)));let z,G;for(let re=I;re<=k;re+=lA){const K=F([_,{x:_.x,y:h},{x:re,y:h},{x:re,y},{x:m.x,y},m]),xe={...e,waypoints:K};if(Pt(xe,v).length>0)continue;const de=Gn(xe,b),we=Math.abs(re-T);(!z||de<z.cross||de===z.cross&&we<z.detour)&&(z={pts:K,cross:de,detour:we}),md(K,v,e.endpoints)>=Br&&(!G||de<G.cross||de===G.cross&&we<G.detour)&&(G={pts:K,cross:de,detour:we})}G&&z&&G!==z&&yd(t,e,G.pts,z.pts)&&(z=G);const ne=z&&(C>0?z.cross<=E:z.cross<E)?z.pts:null;if(C>0){const re=dy(t,e,v,ne??e.waypoints);if(re)return re}return ne}const uA=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function pA(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=Ve(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=kn(a);for(const p of t.edges){if(!uA.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const d=i.get(p.id);if(!(d!=null&&d.waypoints)||((l=d.source)==null?void 0:l.id)!==p.source||((u=d.target)==null?void 0:u.id)!==p.target)continue;const f=r.get(p.source),g=r.get(p.target),h=s.get(p.source),y=s.get(p.target);if(!f||!g||!h||!y||!We(f.width,h.width)||!We(f.height,h.height)||!We(g.width,y.width)||!We(g.height,y.height))continue;const _=h.x-f.x,m=h.y-f.y;if(We(_,0)&&We(m,0)||!We(y.x-g.x,_)||!We(y.y-g.y,m))continue;const v=p.waypoints.map(C=>({x:C.x+_,y:C.y+m})),b=d.waypoints.map(C=>({x:C.x,y:C.y}));b.length===v.length&&b.every((C,I)=>We(C.x,v[I].x)&&We(C.y,v[I].y))||b.length===2&&(We(b[0].x,b[1].x)||We(b[0].y,b[1].y))&&Pt({...p,waypoints:b},c).length===0||Pt({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function Sy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=Ve(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Ey(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const wd=20,Ry=10,ji=10,_d=40,dA=6,fA=40,Cy=50;function hA(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=dA})}function Ed(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(We(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function gA(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function Sd(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=Ry;o<=n-t;o+=Ry)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function mA(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,d=t.x+t.width/2,f=(K,xe)=>xe>K.x+ji&&xe<K.x+K.width-ji,g=(K,xe)=>K.width<=2*_d?K.x+K.width/2:Math.min(Math.max(xe,K.x+_d),K.x+K.width-_d),h=Math.max(e.x,t.x)+ji,y=Math.min(e.x+e.width,t.x+t.width)-ji;if(h<=y){const K=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((h+y)/2);r.push([{x:K,y:l},{x:K,y:u}])}const _=s?g(t,p):d,m=a?g(e,d):p;if(!a&&!f(e,_)){const K=_<e.x?e.x:e.x+e.width;for(const xe of Sd(e.y+e.height/2,e.y+ji,e.y+e.height-ji))r.push([{x:K,y:xe},{x:_,y:xe},{x:_,y:u}])}if(!s&&!f(t,m)){const K=m<t.x?t.x:t.x+t.width;for(const xe of Sd(t.y+t.height/2,t.y+ji,t.y+t.height-ji))r.push([{x:m,y:l},{x:m,y:xe},{x:K,y:xe}])}const v=(K,xe)=>{if(Math.abs(xe-K)<2*ji)return[];const de=Math.min(K,xe)+ji,we=Math.max(K,xe)-ji;return Sd(Math.round((K+xe)/2),de,we)};if(!a&&n)for(const K of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:K},{x:_,y:K},{x:_,y:u}]);if(!s&&i)for(const K of v(u,c?i.y:i.y+i.height))r.push([{x:m,y:l},{x:m,y:K},{x:d,y:K},{x:d,y:u}]);const b=Math.min(m,_),E=Math.max(m,_),C=[];for(const[K,xe]of o.filter(de=>de.x<E&&de.x+de.width>b).map(de=>[de.y,de.y+de.height]).sort((de,we)=>de[0]-we[0])){const de=C[C.length-1];de&&K<=de[1]?de[1]=Math.max(de[1],xe):C.push([K,xe])}const I=[];for(let K=1;K<C.length;K++)C[K][0]-C[K-1][1]>=fA&&I.push(Math.round((C[K-1][1]+C[K][0])/2));C.length&&I.push(C[0][0]-Cy,C[C.length-1][1]+Cy);const k=(K,xe)=>xe<K.y?K.y:xe>K.y+K.height?K.y+K.height:void 0,T=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(K=>!!K)),F=e.y+e.height/2,z=t.y+t.height/2,G=z>F?1:-1,ne=(K,xe,de)=>o.some(we=>!T.has(we.id)&&we.x<K&&K<we.x+we.width&&we.y<Math.max(xe,de)-1&&we.y+we.height>Math.min(xe,de)+1),re=[];for(const K of I){const xe=k(e,K),de=k(t,K);xe===void 0||de===void 0||(K-F)*G<0&&ne(m,xe,K)||(K-z)*G>0&&ne(_,de,K)||re.push({pts:[{x:m,y:xe},{x:m,y:K},{x:_,y:K},{x:_,y:de}],len:Math.abs(K-xe)+(E-b)+Math.abs(de-K)})}return{inPools:r,outside:re.sort((K,xe)=>K.len-xe.len).map(K=>K.pts)}}function yA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(f=>[f.id,f.waypoints])),a=n.shapes.filter(f=>f.type==="bpmn:Participant"),s=f=>{let g=f;for(;g&&g.type!=="bpmn:Participant";)g=g.parent;return g==null?void 0:g.id},c=()=>{const f=Ve(i);return{keys:new Set(ut(f).map(ct)),crossings:Ji(f).length,shared:wi(f).length}},l=(f,g)=>f.length===g.length&&f.every((h,y)=>We(h.x,g[y].x)&&We(h.y,g[y].y)),u=f=>{const g=f.source,h=f.target;if(!g||!h)return"skip";const y=Ve(i),_=new Map(y.shapes.map(W=>[W.id,W])),m=s(g),v=s(h),b=new Set([m,v].filter(W=>!!W)),E=y.shapes.filter(W=>W.type==="bpmn:Participant"),C=(f.waypoints??[]).map(W=>({x:W.x,y:W.y})),I=Ed(C,b,E);if(I<wd)return"skip";if(t.has(f.id)){const W=r.get(f.id);if(W&&l(W,C)||I-(W?Ed(W,b,a):0)<wd)return"skip"}const k=_.get(g.id),T=_.get(h.id),F=y.edges.find(W=>W.id===f.id);if(!k||!T||!F)return"skip";const z=kn(y),G=new Set(Pt(F,z).map(W=>W.id)),ne=Vo(y).filter(W=>W.owner!==f.id&&W.owner!==k.id&&W.owner!==T.id),re=[...y.shapes.filter(W=>!W.container&&W.id!==k.id&&W.id!==T.id),...ne.map(W=>W.rect)],K=W=>cn({...F,waypoints:W}).some(le=>hA(le,re)),xe=mA(k,T,m?_.get(m):void 0,v?_.get(v):void 0,E),de=W=>W.map((le,q)=>({pts:le,i:q,key:le.length*2+(K(le)?1:0)})).sort((le,q)=>le.key-q.key||le.i-q.i).map(le=>le.pts),we=[...de(xe.inPools),...de(xe.outside)],he=c();for(const W of we){if(Ed(W,b,E)>=wd)continue;const le={...F,waypoints:W};if(Pt(le,z).some(me=>!G.has(me.id))||cn(le).some(me=>gA(me,y.shapes)||ne.some(Re=>Fi(Re.rect,me))))continue;o.updateWaypoints(f,W);const ee=c();if(ee.crossings<=he.crossings&&ee.shared<=he.shared&&[...ee.keys].every(me=>he.keys.has(me)))return"fixed";o.updateWaypoints(f,C)}return"stuck"},p=i.getAll().filter(f=>f.type==="bpmn:MessageFlow"),d=[];for(const f of p)u(f)==="stuck"&&d.push(f);for(const f of d)u(f)}const Hi=[25,-25,40,-40],ba=35;function vA(e,t,n=[]){const i=e.x+e.width/2,o=t.x+t.width/2,r=[],a=n.filter(s=>!s.container&&s.id!==e.id&&s.id!==t.id&&s.label).map(s=>({...s.label,id:`${s.id}:label`,type:"label",container:!1,attached:!1}));for(const s of[!0,!1]){const c=s?e.y:e.y+e.height,l=s?t.y:t.y+t.height,u=s?Math.min(e.y,t.y)-ba:Math.max(e.y+e.height,t.y+t.height)+ba,p=bA(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,xA]];for(const[f,g]of d)for(const h of[0,...Hi])if(!(Math.abs(h)>=e.width/2-5))for(const y of[0,...Hi]){if(Math.abs(y)>=t.width/2-5)continue;const _=i+h,m=o+y,v=[{x:_,y:c},{x:_,y:f},{x:m,y:f},{x:m,y:l}];g&&Pt({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:g+Math.abs(y)+Math.abs(h)})}}return r}const xA=45,il=20;function bA(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(y=>y.container&&(y.type==="bpmn:Lane"||y.type==="bpmn:Participant")&&r>=y.x&&r<=y.x+y.width&&e.y>=y.y&&e.y+e.height<=y.y+y.height).sort((y,_)=>y.width*y.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(y=>!y.container&&y.id!==e.id&&y.id!==t.id),d=p.filter(y=>y.x<c&&y.x+y.width>s&&(n?y.y<l&&y.y+y.height>i:y.y+y.height>l&&y.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(y=>y.label?[y.label]:[])].filter(y=>y.x<c&&y.x+y.width>s);if(n){let y=Math.min(...d.map(m=>m.y));for(let m=!0;m;){m=!1;for(const v of f)v.y<y&&v.y<l&&v.y+v.height>y-il&&(y=v.y,m=!0)}const _=Math.max(u.y,...f.filter(m=>m.y+m.height<=y).map(m=>m.y+m.height));return y-_>=il?Math.round((y+_)/2):null}let g=Math.max(...d.map(y=>y.y+y.height));for(let y=!0;y;){y=!1;for(const _ of f)_.y+_.height>g&&_.y+_.height>l&&_.y<g+il&&(g=_.y+_.height,y=!0)}const h=Math.min(u.y+u.height,...f.filter(y=>y.y>=g).map(y=>y.y));return h-g>=il?Math.round((g+h)/2):null}function ol(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const o=n.y+n.height/2;if(o>=i.y&&o<=i.y+i.height)return vA(n,i,[...t.values()]);const r=i.x+i.width/2,a=n.x+n.width/2,s=o<i.y,c=s?i.y:i.y+i.height,l=s?n.y:n.y+n.height,u=s?n.y-ba:n.y+n.height+ba,p=[];for(const m of[0,...Hi]){if(Math.abs(m)>=i.width/2-5)continue;const v=r+m;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(m)});for(const b of[0,...Hi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(m)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const m of[0,...Hi]){if(Math.abs(m)>=n.width/2-5)continue;const v=a+m;p.push({pts:[{x:v,y:g},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(m)})}const h=60,y=s?i.y+i.height:i.y,_=s?i.y+i.height+ba:i.y-ba;for(const m of[0,...Hi]){if(Math.abs(m)>=i.width/2-5)continue;const v=r+m;for(const b of[0,...Hi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:g},{x:E,y:_},{x:v,y:_},{x:v,y}],cost:h+Math.abs(m)+Math.abs(b)})}}return p}const Rd=30;function My(e,t){return Cd(e,t)<Rd}function Cd(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=We(o.y,r.y)&&!We(o.x,r.x),s=We(o.x,r.x)&&!We(o.y,r.y);if(!(!a&&!s))for(const c of t)if(a){const l=Math.min(o.x,r.x);if(Math.max(o.x,r.x)<=c.x||l>=c.x+c.width)continue;n=Math.min(n,Math.abs(o.y-c.y),Math.abs(o.y-(c.y+c.height)))}else{const l=Math.min(o.y,r.y);if(Math.max(o.y,r.y)<=c.y||l>=c.y+c.height)continue;n=Math.min(n,Math.abs(o.x-c.x),Math.abs(o.x-(c.x+c.width)))}}return n}const rl=40;function wA(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-rl,a=o.x+o.width+rl,s=o.y-rl,c=o.y+o.height+rl;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],d={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},f={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(d.x<a&&f.x>r&&d.y<c&&f.y>s){i++;break}}}return i}function Ay(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(C=>C.container),i=new Map(t.shapes.map(C=>[C.id,C])),o=kn(t),r=t.edges.filter(C=>C.id!==e.id),a=Jn(e,r),s=Gn(e,r),c=C=>wA(C,t.shapes,e.endpoints)+(My(C,n)?1:0),l=c(e.waypoints),u=C=>{if(!C)return;const I=C.x+C.width/2,k=C.y+C.height/2;return n.find(T=>T.type==="bpmn:Lane"&&I>=T.x&&I<=T.x+T.width&&k>=T.y&&k<=T.y+T.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,g=C=>{if(!f||!d)return!1;for(let I=1;I<C.length-2;I++){const k=C[I],T=C[I+1];if(We(k.y,T.y)&&!We(k.x,T.x)&&k.y>d.y&&k.y<d.y+d.height)return!0}return!1},h=g(e.waypoints),_=(C=>{if(!C)return;const I=C.x+C.width/2,k=C.y+C.height/2;return n.filter(T=>T.type==="bpmn:Participant"&&I>=T.x&&I<=T.x+T.width&&k>=T.y&&k<=T.y+T.height).sort((T,F)=>T.width*T.height-F.width*F.height)[0]})(i.get(e.endpoints[0]??"")),m=C=>{if(!_)return 0;let I=0;for(let k=1;k<C.length-1;k++){const T=C[k];(T.x<_.x||T.x>_.x+_.width||T.y<_.y||T.y>_.y+_.height)&&I++}return I},v=m(e.waypoints);if(!My(e.waypoints,n)&&!(f&&!h)&&v===0)return null;const b=C=>C.reduce((I,k,T)=>T?I+Math.abs(k.x-C[T-1].x)+Math.abs(k.y-C[T-1].y):0,0);let E;for(const{pts:C,cost:I}of ol(e,i)){const k={...e,waypoints:C};if(Pt(k,o).length>0)continue;const T=Jn(k,r);if(T>a)continue;const F=m(C);if(F>v)continue;const z=F<v&&T===0;if(!z&&Gn(k,r)>s)continue;const G=c(C),ne=g(C);if(!z&&!(ne&&!h)&&G>=l)continue;const K=ne?0:1,xe=b(C);(!E||F<E.out||F===E.out&&(K<E.lane||K===E.lane&&(T<E.opp||T===E.opp&&(G<E.sc||G===E.sc&&(I<E.cost||I===E.cost&&xe<E.len)))))&&(E={pts:C,out:F,sc:G,lane:K,opp:T,cost:I,len:xe})}return(E==null?void 0:E.pts)??null}function _A(e,t){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return!1;const[n,i]=e.endpoints,o=t.edges.filter(p=>p.type==="bpmn:SequenceFlow"&&p.endpoints.length===2),r=o.filter(p=>p.endpoints[1]===i),a=o.filter(p=>p.endpoints[0]===i);if(r.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 EA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(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 r){const s=Ve(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=kn(s),u=s.edges.filter(y=>y.id!==a),p=Pt(c,l).length,d=Jn(c,u),f=Gn(c,u),g=n.has(a)?new Set(ut(s).map(ct)):null;if(c.waypoints.length>4){const y=i.get(a),_=y?hy(s,c,l,c.waypoints,ys(y)):null;if(y&&_&&_.length<c.waypoints.length){o.updateWaypoints(y,_);continue}}const h=Qc(c,s.shapes);h.length===2&&_A(c,s)&&h.reverse();for(const y of h){if(y.length>=c.waypoints.length)continue;const _={...c,waypoints:y};if(Pt(_,l).length>p||Jn(_,u)>d||Gn(_,u)>f)continue;if(g){const v=new Set(ut({...s,edges:s.edges.map(C=>C.id===a?_:C)}).map(ct)),b=[...v].filter(C=>!g.has(C)).length,E=[...g].filter(C=>!v.has(C)).length;if(b>E)continue}const m=i.get(a);m&&o.updateWaypoints(m,y);break}}}function Ty(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=Ve(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Ay(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Md(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],o=t.get(e.endpoints[0]??""),r=t.get(e.endpoints[1]??""),a=We(n[0].x,n[1].x)&&!We(n[0].y,n[1].y),s=We(n[n.length-1].x,n[n.length-2].x)&&!We(n[n.length-1].y,n[n.length-2].y);for(const c of Hi){if(a&&o&&Math.abs(c)<o.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&&r&&Math.abs(c)<r.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}const Py=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function SA(e,t,n){const i=e.waypoints;if(i.length<2||!Py(e.type))return[];const o=i[0],r=i[1],a=We(o.y,r.y)&&!We(o.x,r.x),s=We(o.x,r.x)&&!We(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(g=>{if(!Py(g.type)||g.type===e.type||g.waypoints.length<2)return!1;const h=g.waypoints[0],y=g.waypoints[1];return!We(h.x,o.x)||!We(h.y,o.y)?!1:a?We(h.y,y.y)&&Math.sign(y.x-h.x)===c:We(h.x,y.x)&&Math.sign(y.y-h.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(g,h)=>a?h>g.y+5&&h<g.y+g.height-5:h>g.x+5&&h<g.x+g.width-5,f=[];for(const g of Hi){const h=(a?o.y:o.x)+g;if(!d(u,h)||i.length===2&&(!p||!d(p,h)))continue;const y=i.map(_=>({..._}));for(const _ of[y[0],y[1]])a?_.y=h:_.x=h;f.push({pts:y,cost:Math.abs(g)})}return f}function RA(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 o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)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,d=a?n.x+n.width:n.x,f=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,y=[];for(const _ of[0,...Hi])Math.abs(_)<i.width/2-5&&y.push({pts:[{x:d,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&y.push({pts:[{x:c,y:f},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return y}const CA=[[1/2,0],[1/3,25],[2/3,25]],ky=20;function MA(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 o=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of CA){const d=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:d,y:o},{x:d,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+ky<=i.x&&s(n.x+n.width,i.x),i.x+i.width+ky<=n.x&&s(n.x,i.x+i.width),a}function Ad(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 o=Math.max(n.x,i.x),r=Math.min(n.x+n.width,i.x+i.width);if(r-o<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=(o+r)/2,p=[];for(const d of[0,...Hi]){const f=u+d;f<=o||f>=r||p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:Math.abs(d)})}return p}function Oy(e,t,n={}){const i=new Map(t.shapes.map(g=>[g.id,g])),o=kn(t),r=t.edges.filter(g=>g.id!==e.id),a=Jn(e,r);if(a===0)return null;const s=Gn(e,r);let c;const l=g=>g.reduce((h,y,_)=>_?h+Math.abs(y.x-g[_-1].x)+Math.abs(y.y-g[_-1].y):0,0),u=3,p=g=>{const h=g[0],y=g[g.length-1],_=Math.hypot(y.x-h.x,y.y-h.y);return _>=1&&l(g)/_>=u?1:0},d=p(e.waypoints),f=[...ol(e,i),...Ad(e,i),...Md(e,i),...SA(e,r,i),...n.sideEntry?MA(e,i):[]];for(const{pts:g,cost:h}of f){const y={...e,waypoints:g};if(Pt(y,o).length>0)continue;const _=Jn(y,r),m=Gn(y,r),v=a-_+(d-p(g));if(_>=a||m-s>v)continue;const b=l(g);(!c||_<c.opposite||_===c.opposite&&(m<c.cross||m===c.cross&&(h<c.cost||h===c.cost&&b<c.len)))&&(c={pts:g,opposite:_,cross:m,cost:h,len:b})}return(c==null?void 0:c.pts)??null}function Dy(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=Ir(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function AA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=kn(t),o=t.edges.filter(d=>d.id!==e.id),r=Dy(e,o);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,g,h)=>h?f+Math.abs(g.x-d[h-1].x)+Math.abs(g.y-d[h-1].y):0,0),l=2;let u;const p=[...ol(e,n),...Ad(e,n),...RA(e,n),...Md(e,n)];for(const{pts:d,cost:f}of p){const g={...e,waypoints:d};if(Pt(g,i).length>0)continue;const h=Dy(g,o);if(h>=r)continue;const y=Jn(g,o);if(y-h>a-r)continue;const _=Gn(g,o);if(_-s>(r-h)*l)continue;const m=c(d);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&m<u.length))))&&(u={pts:d,fake:h,unreadable:y,cross:_,cost:f,length:m})}return(u==null?void 0:u.pts)??null}function Ly(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ut(Ve(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(ct(s)));if(!r.length)return;const a=new Set;for(const s of r)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=Ve(i),l=c.edges.find(d=>d.id===s);if(!l)continue;const u=AA(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Iy(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 By(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Ir(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,o]=e.endpoints,[r,a]=t.endpoints,s=[i,o].filter(u=>u&&(u===r||u===a)).length;return!(!!o&&o===r||!!a&&a===i)||s!==1?!1:Iy(e,n)&&Iy(t,n)}function Ny(e,t,n){let i=0;for(const o of t)o.id!==e.id&&By(e,o,n)&&i++;return i}function TA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=kn(t),o=t.edges.filter(d=>d.id!==e.id),r=Ny(e,o,n);if(r===0)return null;const a=Jn(e,o),s=Gn(e,o),c=d=>d.reduce((f,g,h)=>h?f+Math.abs(g.x-d[h-1].x)+Math.abs(g.y-d[h-1].y):0,0),l=2;let u;const p=[...ol(e,n),...Ad(e,n),...Md(e,n)];for(const{pts:d,cost:f}of p){const g={...e,waypoints:d};if(Pt(g,i).length>0)continue;const h=Ny(g,o,n);if(h>=r)continue;const y=Jn(g,o);if(y-h>a-r)continue;const _=Gn(g,o);if(_-s>(r-h)*l)continue;const m=c(d);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&m<u.length))))&&(u={pts:d,chain:h,unreadable:y,cross:_,cost:f,length:m})}return(u==null?void 0:u.pts)??null}function PA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ut(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(ct(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(d=>r.edges.find(f=>f.id===d));if(!(!u||!p||!By(u,p,a)))for(const d of l.edges)n.has(d)||c.add(d)}for(const l of[...c].sort()){const u=Ve(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const d=TA(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function $y(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=Ve(o),c=ut(s).filter(d=>pd(d)&&!t.has(ct(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(pd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(g=>g.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const g=u(d)==="bpmn:SequenceFlow"?0:1,h=u(f)==="bpmn:SequenceFlow"?0:1;return g!==h?g-h:d.localeCompare(f)});for(const d of p){const f=Ve(o),g=f.edges.find(_=>_.id===d);if(!g)continue;const h=Oy(g,f,{sideEntry:i.has(d)});if(!h)continue;const y=o.get(d);y&&(r.updateWaypoints(y,h),a.add(d))}return a}const kA=10,OA=(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 Fy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Zc(e,i))return null;const o=kn(t),r=i.flatMap(cn);for(const a of cn(e)){let s=[[a.lo,a.hi]];for(const[f,g]of Xc(a,r))s=s.flatMap(([h,y])=>{const _=[];return f>h&&_.push([h,Math.min(y,f)]),g<y&&_.push([Math.max(h,g),y]),_.filter(([m,v])=>v>m)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,g])=>g-f>=c+kA*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Ym}:{x:a.at+On+n.width/2,y:u},d={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Zc({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&OA(d,f)))return d}return null}const On=8;function Td(e,t){const n=e.label;if(!n)return null;const i=cn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=d=>{const f=d.axis==="h"?o:r,g=d.axis==="h"?r-d.at:o-d.at,h=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(g,h)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(cn),...t.shapes.filter(d=>d.container).flatMap(va)],l=d=>!c.some(f=>Fi(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+On,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+On,s.at-On-n.width])for(const f of p){const g=n.y+f;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:d,y:g};if(l(h))return h}else for(const d of[s.at-On-n.height,s.at+On])for(const f of p){const g=n.x+f;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:d};if(l(h))return h}return null}const jy=30,DA=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const o=t[i],r=t[i+1],a=r.x-o.x,s=r.y-o.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-o.x)*a+(e.y-o.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(o.x+l*a),e.y-(o.y+l*s)))}return n},Hy=(e,t)=>DA({x:e.x+e.width/2,y:e.y+e.height/2},t);function LA(e,t){const n=e.label;if(!n)return null;const i=cn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(cn),...t.shapes.filter(c=>c.container).flatMap(va)],r=Vo(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=>!o.some(l=>Fi(c,l))&&!ms(c,t).length&&!r.some(l=>a(c,l));for(const c of i){const l=(c.lo+c.hi)/2,u=c.axis==="h"?[c.at+On,c.at-On-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+On,c.at-On-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 zy(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=Ve(i),a=new Set(ut(r).map(ct));for(const[l,u]of t){const p=u.wps,d=i.get(l),f=d==null?void 0:d.label;if(!f||!(d!=null&&d.waypoints))continue;const g=d.waypoints[0].x-p[0].x,h=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((I,k)=>I.x-p[k].x===g&&I.y-p[k].y===h))){if(((s=d.source)==null?void 0:s.id)===u.source&&((c=d.target)==null?void 0:c.id)===u.target)continue;const I=r.edges.find(G=>G.id===l);if(!(I!=null&&I.label)||!ms(I.label,r).length&&!n.has(l))continue;let k={...I.label,x:u.label.x,y:u.label.y};if((ms(k,r).length||Hy(k,I.waypoints)>jy)&&(k=null),!k&&Hy(I.label,I.waypoints)>jy&&(k=LA(I,r)),!k)continue;const T=k;if(T.x===f.x&&T.y===f.y)continue;const F={...r,edges:r.edges.map(G=>G.id===l?{...G,label:T}:G)},z=ut(F);if(z.some(G=>!a.has(ct(G))))continue;o.moveElements([f],{x:T.x-f.x,y:T.y-f.y}),r=F,a=new Set(z.map(ct));continue}const _=u.label.x+g-f.x,m=u.label.y+h-f.y;if(_===0&&m===0)continue;const v=r.edges.find(I=>I.id===l);if(!(v!=null&&v.label))continue;const b={...v.label,x:v.label.x+_,y:v.label.y+m},E={...r,edges:r.edges.map(I=>I.id===l?{...I,label:b}:I)},C=ut(E);C.some(I=>!a.has(ct(I)))||(o.moveElements([f],{x:_,y:m}),r=E,a=new Set(C.map(ct)))}}function Gy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Td(a,r);if(!s)continue;const c=i.get(a.id),l=c==null?void 0:c.label;l&&o.moveElements([l],{x:s.x-l.x,y:s.y-l.y})}}function Vy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=ut(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ct(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(d=>d.id===s.edge);if(!c)continue;const l=Fy(c,r);if(!l)continue;const u=i.get(s.edge),p=u==null?void 0:u.label;p&&o.moveElements([p],{x:l.x-p.x,y:l.y-p.y})}}function Wy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(cn),...t.shapes.filter(d=>d.container).flatMap(va)],o=i.filter(d=>Fi(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=Vo(t).filter(d=>d.owner!==e.id).map(d=>d.rect),s=(d,f)=>d.x<f.x+f.width&&f.x<d.x+d.width&&d.y<f.y+f.height&&f.y<d.y+d.height,c=d=>!i.some(f=>Fi(d,f))&&!r.some(f=>s(d,f))&&!a.some(f=>s(d,f)),l=[];for(const d of o)d.axis==="h"?l.push({...n,y:d.at-On-n.height},{...n,y:d.at+On}):l.push({...n,x:d.at-On-n.width},{...n,x:d.at+On});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+On},{...n,x:u-n.width/2,y:e.y-On-n.height},{...n,x:e.x+e.width+On,y:p-n.height/2},{...n,x:e.x-On-n.width,y:p-n.height/2}),l.find(c)??null}function Uy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=Ve(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=Wy(r,Ve(n));if(!a)continue;const s=n.get(r.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function IA(e,t){const n=e.x,i=e.x+e.width,o=e.y,r=e.y+e.height;if(t.x<n||t.x>i||t.y<o||t.y>r)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,o),r))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-o,{x:t.x,y:o}],[r-t.y,{x:t.x,y:r}]].reduce((c,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function qy(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(ut(o).map(ct));const a=[...new Set(ut(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(ct(s))).map(s=>s.edge))].sort();for(const s of a){const c=o.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 _=h?o.shapes.find(v=>v.id===h):void 0;if(!_)continue;const m=IA(_,l[y]);m.x===l[y].x&&m.y===l[y].y||(l[y]=m,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},f=ut(d);if(f.some(h=>!r.has(ct(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=d,r=new Set(f.map(ct)))}}const Pd=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Yy(e,t){const n=(o,r,a,s="name")=>{const c=s==="text"?"texts":"names",l=u=>r?`${r}.${u}`:u;return{id:o,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((o,r)=>n(o.id,`participant.lanes[${r}]`,o))];case"participant.update":return[n(e.id,"",i),...(e.lanes??[]).map((o,r)=>({...n(o.id,`lanes[${r}]`,o),omittedMeansRemove:(t==null?void 0:t.categoryOf(o.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 BA(e,t,n){const i=[],o=n?ls(n):[];return e.forEach((r,a)=>{if(r.kind==="translation.confirm"){if(!n){i.push({kind:"locale-texts-not-enabled",opIndex:a,id:r.id,field:"locale"});return}if(!o.includes(r.locale)){i.push({kind:"locale-not-in-document",opIndex:a,id:r.id,field:"locale",locale:r.locale,locales:o});return}t.categoryOf(r.id)!==void 0&&!t.reviewRequestLocalesOf(r.id).includes(r.locale)&&i.push({kind:"review-request-missing",opIndex:a,id:r.id,locale:r.locale});return}for(const s of Yy(r,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:o});continue}if(s.condition!==void 0&&s.condition!==null){i.push({kind:"locale-texts-required",opIndex:a,id:s.id,field:s.conditionField,locales:o});continue}if(!l)continue;if(!Pd(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${f}`}),p=!1):o.includes(f)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:f,locales:o}),p=!1);if(!p)continue;const d=o.filter(f=>!(f in u));d.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:d})}}),i}function _i(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function NA(e,t,n){const i=new Map;if(!n)return{ops:[...e],writes:i};const{designLocale:o}=n,r=c=>{let l=i.get(c);return l||i.set(c,l={}),l},a=c=>{if(Pd(c.map)){const l=c.map;return r(c.id).texts={...l},l[o]}if(c.plain===null||c.condition===null&&c.plain===void 0){r(c.id).texts=null;return}c.plain===void 0&&c.omittedMeansRemove&&(r(c.id).texts=null)},s=[];for(const c of e){if(c.kind==="translation.confirm"){const u=r(c.id);u.confirm=[...u.confirm??[],c.locale];continue}const l=Yy(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=_i(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,g)=>_i(f,"name",a(p[g])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=_i(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,g)=>_i(f,"name",a(p[g])))),s.push(d);break}case"node.add":s.push({...c,node:_i(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:_i(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:_i(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:_i(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:_i(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:_i(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(_i(c,"text",a(l[0])));break;default:s.push(Pd(l[0].map)?_i(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const $A=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Ky=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Xy={"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}]},xs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),al=e=>typeof e=="string"&&e!=="";function FA(e){const t=[];function n(i,o,r,a){if(a===null){al(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!xs(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)al(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!xs(i)||!al(i.kind)||!(i.kind in Xy)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of Xy[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const g of p.slice(0,-1)){if(!xs(d))break;d=d[g]}if(!xs(d))continue;const f=d[p[p.length-1]];if(!(f===void 0&&c.optional)&&!(f===null&&c.optional)){if(!l){n(o,c.path,f,c.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}f.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;xs(c)&&!al(c.text)&&c.texts===void 0&&t.push({kind:"payload-invalid",opIndex:o,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:o,field:"band"});const l=i.kind==="node.add"?(r=i.node)==null?void 0:r.type:i.type,u=(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"";if(typeof l=="string"&&!cm(l)){t.push({kind:"node-type-unsupported",opIndex:o,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&&!lm(p)){t.push({kind:"payload-invalid",opIndex:o,field:i.kind==="node.add"?"node.eventDefinition":"eventDefinition"});return}l==="intermediateCatchEvent"!==(p!==void 0)&&t.push({kind:"event-definition-mismatch",opIndex:o,id:u,...typeof l=="string"?{type:l}:{},...p!==void 0?{eventDefinition:p}:{}})}}),t}function Zy(e,t,n={}){const i=FA(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,y,_){if(!$A.test(y)){o.push({kind:"id-invalid",opIndex:h,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:h,id:y});return}r.set(y,{..._,opIndex:h})}e.forEach((h,y)=>{var _;switch(h.kind){case"participant.add":s(y,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(m=>m.id)});for(const m of h.participant.lanes??[])s(y,m.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 m of h.associations??[])m.id&&s(y,m.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"}),(_=h.association)!=null&&_.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(m=>m.id));for(const m of h.lanes)t.categoryOf(m.id)===void 0&&s(y,m.id,{category:"lane"})}break}});const c=h=>{var y;return((y=r.get(h))==null?void 0:y.category)??t.categoryOf(h)},l=h=>{const y=r.get(h);return y?y.category==="participant"?h:y.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,y,_,m){const v=c(y);if(v===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:_});return}if(m&&!m.includes(v)){o.push({kind:"ref-category",opIndex:h,ref:y,role:_,expected:m.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),d=new Map;for(const h of e)h.kind==="node.add"?d.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&d.set(h.id,h.eventDefinition);const f=h=>d.has(h)?d.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,y)=>{var _,m;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=h.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:h.node.id});break}if(u(y,v,"participant",["participant"])===void 0)break;b!==void 0&&((((_=r.get(v))==null?void 0:_.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:y,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:C,condition:I}=h.flow,k=u(y,b,"source",["flowNode"]),T=u(y,E,"target",["flowNode"]);k&&T&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:y,id:v}),C!==void 0&&I!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=h.flow,C=u(y,b,"source",["flowNode","participant"]),I=u(y,E,"target",["flowNode","participant"]);if(C&&I){const k=l(b),T=l(E);k!==void 0&&k===T&&o.push({kind:"message-flow-same-pool",opIndex:y,id:v})}for(const k of[b,E])f(k)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:v,ref:k});break}case"dataStore.add":{for(const v of h.associations??[]){if([v.source,v.target].filter(C=>C===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:v.source,target:v.target});continue}const E=v.source===h.dataStore.id?v.target:v.source;u(y,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=h.association,E=u(y,v,"source"),C=u(y,b,"target");if(E&&C){const I=new Set([E,C]);I.has("dataStore")&&I.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=h.association,C=u(y,b,"source"),I=u(y,E,"target");C&&I&&C!=="annotation"&&I!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(h.association){const{source:v,target:b}=h.association;if(v!==h.annotation.id&&b!==h.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:h.annotation.id});else{const E=v===h.annotation.id?b:v;u(y,E,"association")}}h.placement&&u(y,h.placement.anchor,"anchor");break}case"group.add":{for(const v of h.group.members??[]){const b=u(y,v,"member");b&&Ky.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(g(y,h.id,"participant")===void 0)break;if(h.lanes){const v=t.lanesOf(h.id),b=h.lanes.map(k=>k.id);for(const k of v)b.includes(k)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:h.id,lane:k});for(const k of b)t.categoryOf(k)!==void 0&&!v.includes(k)&&o.push({kind:"id-duplicate",opIndex:y,id:k});const E=b.filter(k=>v.includes(k)),C=k=>E.every((T,F)=>T===k[F]),I=(((m=t.laneDeclarationOrderOf)==null?void 0:m.call(t,h.id))??v).filter(k=>v.includes(k));E.length===v.length&&!C(v)&&!C(I)&&o.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 v=t.participantOf(h.id);(v?a.get(v)??t.lanesOf(v):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:h.lane,participant:v??""})}break}case"sequenceFlow.update":{if(g(y,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:h.id}),h.source!==void 0||h.target!==void 0){const v=h.source===void 0||u(y,h.source,"source",["flowNode"])!==void 0,b=h.target===void 0||u(y,h.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(h.id),C=h.source??(E==null?void 0:E.source),I=h.target??(E==null?void 0:E.target);v&&b&&C!==void 0&&I!==void 0&&new Set([l(C),l(I),l(h.id)]).size>1&&o.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 v of h.members??[]){const b=u(y,v,"member");b&&Ky.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":g(y,h.id);break;case"element.remove":{g(y,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...BA(e,t,n.i18n)),o;function g(h,y,_){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:h,id:y});return}const m=t.categoryOf(y);if(m===void 0){o.push({kind:"ref-missing",opIndex:h,ref:y,role:"target"});return}if(_&&m!==_){o.push({kind:"ref-category",opIndex:h,ref:y,role:"target",expected:_,actual:m});return}return m}}const kd=12,Jy=14,jA=15,HA=100,zA=300,GA=30,VA=/[㐀-鿿]/,WA=1.1;function Qy(e){let t=0;for(const n of e)VA.test(n)?t+=kd:vM(n)?t+=Lr(n,kd):t+=Lr(n,kd)*WA;return t}const ev="";function UA(e,t){const n=e.split(/(\s|-|)/g),i=[];let o=0,r;if(n.length>1)for(;r=n.shift();)if(r.length+o<t)i.push(r),o+=r.length;else{(r==="-"||r===ev)&&i.pop();break}return i[i.length-1]===ev&&(i[i.length-1]="-"),i.join("")}function qA(e,t,n){const i=Math.max(e.length*(n/t),1);return UA(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const tv=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function YA(e,t,n=Qy){const i=e.split(/?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=tv(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=qA(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function nv(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/?\r?\n/).map(a=>tv(a,Qy)))),i=Math.max(HA,Math.min(zA,Math.floor(n)+1+Jy)),o=Math.max(...t.map(r=>YA(r,i-Jy).length));return{width:i,height:Math.max(GA,o*jA+10)}}const iv="bwlExactAnnotationBounds",KA=500;class ov{constructor(t){t.on("commandStack.shape.resize.preExecute",KA,({context:n})=>{var o,r;const i=(o=n==null?void 0:n.hints)==null?void 0:o[iv];!i||((r=n.shape)==null?void 0:r.type)!=="bpmn:TextAnnotation"||(n.newBounds={x:i.x,y:i.y,width:i.width,height:i.height})})}}sn(ov,"$inject",["eventBus"]);const rv={__init__:["annotationExactResize"],annotationExactResize:["type",ov]};function av(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 sl(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const cl={"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]},Dn=10,XA=300,ZA=160,sv=20,Od=100,cv=40,JA=10,QA=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function lv(e,t,n){if(!(t.width>0))return;const i=t.x+t.width/2,o=t.y+t.height/2;let r;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&&o>=s.y&&o<=s.y+s.height&&(!r||s.width*s.height<r.width*r.height)&&(r=s)}return r?{x:n.x,width:n.width,y:r.y,height:r.height}:void 0}const ll=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function ul(e,t,n,i,o){const r=n,a=lv(e,t,i),s=a??i,c=(ne,re,K=s)=>{const[xe,de]=cl[ne];let we={x:t.x+t.width/2+xe*(t.width/2+r.width/2+re),y:t.y+t.height/2+de*(t.height/2+r.height/2+re)};const he=K.x+Dn+r.width/2,W=K.x+K.width-Dn-r.width/2,le=K.y+Dn+r.height/2,q=K.y+K.height-Dn-r.height/2,ee={x:Math.min(W,Math.max(he,we.x)),y:Math.min(q,Math.max(le,we.y))};return(ee.x!==we.x||ee.y!==we.y)&&(we=Math.abs(ee.x-(t.x+t.width/2))<(t.width+r.width)/2+Dn&&Math.abs(ee.y-(t.y+t.height/2))<(t.height+r.height)/2+Dn?{x:t.x+t.width+Dn+r.width/2,y:ee.y}:ee),we},l=(i.children??[]).filter(ne=>!("waypoints"in ne&&ne.waypoints)&&ne.type!=="bpmn:Lane"&&ne.type!=="label"&&typeof ne.x=="number"&&ne.id!==o.selfId),u=Ve(e),p=ne=>{var K,xe;if(!o.selfId)return!1;const re=e.get(ne);return!!re&&(((K=re.source)==null?void 0:K.id)===o.selfId||((xe=re.target)==null?void 0:xe.id)===o.selfId)},d=u.edges.filter(ne=>!p(ne.id)).flatMap(cn),f=Vo(u).filter(ne=>ne.owner!==o.selfId).map(ne=>ne.rect),g=ne=>({x0:ne.x-r.width/2-Dn,x1:ne.x+r.width/2+Dn,y0:ne.y-r.height/2-Dn,y1:ne.y+r.height/2+Dn}),h=ne=>{const re=g(ne);return l.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},y=ne=>{const re=g(ne);return d.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},_=ne=>{const re=g(ne);return f.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},m=u.shapes.filter(ne=>ne.type==="bpmn:Group").flatMap(ne=>[{axis:"h",at:ne.y,lo:ne.x,hi:ne.x+ne.width},{axis:"h",at:ne.y+ne.height,lo:ne.x,hi:ne.x+ne.width},{axis:"v",at:ne.x,lo:ne.y,hi:ne.y+ne.height},{axis:"v",at:ne.x+ne.width,lo:ne.y,hi:ne.y+ne.height}]),v=ne=>{const re=g(ne);return m.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},b=ne=>h(ne)||y(ne)||_(ne)||v(ne),E=ne=>ne.x-r.width/2>=i.x&&ne.x+r.width/2<=i.x+i.width&&ne.y-r.height/2>=i.y&&ne.y+r.height/2<=i.y+i.height,C=ne=>E(ne)&&(!a||ll(ne,r,a));if(o.placement){const ne=he=>he.startsWith("top")?he.replace(/^top/,"bottom"):he.replace(/^bottom/,"top"),re=he=>he.endsWith("left")?he.replace(/left$/,"right"):he.replace(/right$/,"left"),K=o.placement.side,xe=[K,ne(K),re(K),ne(re(K)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],de=o.placement.offset??50;let we=c(K,de);if(b(we)||a&&!ll(we,r,a)){const he=(W,le)=>{const q=new Set;for(const ee of xe){if(q.has(ee))continue;q.add(ee);const me=c(ee,de,W);if(le(me)&&!b(me))return we=me,!0}return!1};!he(s,C)&&a&&he(i,E)}return we}const I=o.from,k=s.x+Dn+r.width/2,T=s.x+s.width-Dn-r.width/2,F=s.y+Dn+r.height/2,z=s.y+s.height-Dn-r.height/2;let G={x:Math.min(T,Math.max(k,I.x)),y:Math.min(z,Math.max(F,I.y))};if(b(G)){const ne=(t.width+r.width)/2+Dn,K=[{x:G.x+ne,y:G.y},{x:G.x-ne,y:G.y},{x:G.x,y:G.y-r.height-Dn},{x:G.x,y:G.y+r.height+Dn}].filter(C).find(xe=>!b(xe));K&&(G=K)}return G}function jt(e,t){return e.filter(n=>n.kind===t)}function uv(e,t){const n=new Map,i=new Set(jt(e,"node.add").map(s=>s.node.id)),o=jt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&jt(e,"sequenceFlow.add").find(d=>d.flow.source===l&&d.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(d=>d!==u&&JSON.stringify(d).includes(p))||(a.add(c),n.set(s.id,u))}return n}class pv extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const dv=new WeakMap;function eT(e){return dv.get(e)??new Set}const fv=new WeakMap;function tT(e,t){fv.set(e,t)}const hv=new WeakMap;function nT(e){return hv.get(e)??[]}function gv(e,t){var VS,WS,US,qS,YS,KS,XS,ZS,JS,QS,eR,tR,nR,iR,oR,rR,aR,sR,cR,lR,uR,pR,dR,fR,hR,gR,mR,yR,vR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;dv.set(t,u);const p=[];hv.set(t,p);const d=()=>a.getRootElement(),f=x=>r.get(x),g=x=>{const w=f(x);if(!w)throw new Error(`하강 참조 해소 실패: ${x}`);return w},h=x=>{let w=x.parent;for(;w;){if(w.type==="bpmn:Participant")return w;w=w.parent}},y=new Map;for(const x of r.filter(w=>!("waypoints"in w&&w.waypoints)&&w.type!=="bpmn:Lane"&&w.type!=="label"&&typeof w.x=="number"))y.set(x.id,{x:x.x,y:x.y});const _=jt(e,"participant.add"),m=jt(e,"node.add"),v=jt(e,"sequenceFlow.add"),b=jt(e,"messageFlow.add"),E=jt(e,"dataStore.add"),C=jt(e,"dataAssociation.add"),I=jt(e,"annotation.add"),k=jt(e,"group.add"),T=new Map(m.map(x=>[x.node.id,x])),F=uv(e,x=>{var w,S;return(S=(w=f(x))==null?void 0:w.source)==null?void 0:S.id}),z=new Set([...F.values()].map(x=>x.flow.id)),G=v.filter(x=>!z.has(x.flow.id)),ne=new Set([...F.values()].map(x=>x.flow.target)),re=x=>jt(e,"sequenceFlow.update").filter(w=>w.target===x).length+(ne.has(x)?1:0),K=(x,w,S)=>{var L;const O=x.businessObject,B=(((L=O.extensionElements)==null?void 0:L.values)??[]).filter(D=>D.$type!==w),P=S?[...B,i.create(w,S)]:B;if(!P.length){O.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:P});P.forEach(D=>{D.$parent=N}),n.updateProperties(x,{extensionElements:N})},xe=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of jt(e,"element.remove")){const w=f(x.id);if(!w)continue;const S="waypoints"in w?[]:[...w.incoming??[],...w.outgoing??[]];n.removeElements([...S,w])}const de=x=>r.filter(w=>{var S;return w.type==="bpmn:Lane"&&((S=h(w))==null?void 0:S.id)===x}).sort((w,S)=>w.y-S.y),we=[];for(const x of jt(e,"participant.update")){const w=g(x.id);if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),!x.lanes)continue;const S=de(x.id);if(!S.length){n.splitLane(w,x.lanes.length),de(x.id).forEach((P,N)=>{const L=x.lanes[N];L&&n.updateProperties(P,{id:L.id,name:L.name})}),we.push({pool:x.id,lanes:new Set(x.lanes.map(P=>P.id))});continue}const O=new Set(S.map(P=>P.id)),B=x.lanes.reduce((P,N,L)=>O.has(N.id)?L:P,-1);x.lanes.forEach((P,N)=>{if(O.has(P.id)){n.updateProperties(g(P.id),{name:P.name});return}const L=N===B+1&&B>=0,D=N===0?n.addLane(de(x.id)[0],"top"):L?n.addLane(de(x.id).at(-1),"bottom"):n.addLane(g(x.lanes[N-1].id),"bottom");n.updateProperties(D,{id:P.id,name:P.name})})}const he=150,W=130,le=80,q=90,ee=180,me=30,Re=30,ze=10,$=300,M=5,R=(x,w,S,O,B)=>{const P=S-w.width/2,N=O-w.height/2;return(x.children??[]).find(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="bpmn:Lane"&&L.type!=="label"&&!(B!=null&&B.has(L.id))&&typeof L.x=="number"&&P<L.x+L.width+Re&&P+w.width+Re>L.x&&N<L.y+L.height&&N+w.height>L.y)},U=new Set;for(const x of _){U.add(`pool:${x.participant.id}`);for(const w of x.participant.lanes??[])U.add(w.id)}const X=new Map;for(const x of m){const w=x.node.lane??`pool:${x.node.participant??""}`;let S=X.get(w);S||X.set(w,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const pe=new Map;for(const[x,w]of X){if(!U.has(x))continue;const S=[...w].sort((P,N)=>P-N),O=S.map((P,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),B=Math.min(...O);pe.set(x,new Map(S.map((P,N)=>[P,O[N]-B])))}{const x=new Map;for(const w of _)(w.participant.lanes??[]).forEach((S,O)=>x.set(S.id,O));for(const[w,S]of pe){if(!x.has(w)||S.size<2)continue;const O=x.get(w),B=S.get(0)??0,P=new Set;for(const ie of m){if(ie.node.lane!==w||(ie.band??0)!==0||!ie.node.type.endsWith("Gateway"))continue;const ue={in:new Set,out:new Set,cross:new Set};for(const se of G){const oe=se.flow.source===ie.node.id;if(!oe&&se.flow.target!==ie.node.id)continue;const ve=T.get(oe?se.flow.target:se.flow.source);if(!ve||ve.node.participant!==ie.node.participant||!ve.node.lane)continue;let ye,te=!1;if(ve.node.lane!==w){const J=x.get(ve.node.lane);if(J===void 0)continue;ye=J>O?"down":"up",te=!0}else{const J=S.get(ve.band??0)??B;ye=J>B?"down":J<B?"up":void 0}ye&&(ue[oe?"out":"in"].add(ye),te&&ue.cross.add(ye))}for(const se of["up","down"])ue.in.has(se)&&ue.out.has(se)&&ue.cross.has(se)&&P.add(se)}if(P.size!==1)continue;const[N]=P,L=Math.max(...S.values()),D=N==="down"?L:0;if(B===D)continue;const H=[...S.entries()].filter(([ie])=>ie!==0).sort((ie,ue)=>ie[1]-ue[1]),j=[...Array(L+1).keys()].filter(ie=>ie!==D),Z=new Map([[0,D]]);H.forEach(([ie],ue)=>Z.set(ie,j[ue])),pe.set(w,Z)}}const Ne=x=>{var w;return(((w=X.get(x))==null?void 0:w.size)??0)>1},Ke=x=>x.band??(x.node.lane||!Ne(`pool:${x.node.participant??""}`)?void 0:0),ht=new Map,kt=x=>ht.get(x.node.id)??Ke(x),St=new Set,tn=new Set,Rn=new Set,Fn=new Set,Nt=new Set,nn=x=>I.some(w=>{var S,O;return(((S=w.placement)==null?void 0:S.anchor)??(w.association?w.association.source===w.annotation.id?w.association.target:w.association.source:void 0))===x&&((O=w.placement)==null?void 0:O.side.startsWith("bottom"))});{const x=new Map;for(const O of G)x.set(O.flow.target,(x.get(O.flow.target)??0)+1);const w=O=>{const B=[],P=new Set([O]),N=[O];for(;N.length;){const L=N.shift();B.push(L);for(const D of G)D.flow.source!==L||P.has(D.flow.target)||(x.get(D.flow.target)??0)!==1||(P.add(D.flow.target),N.push(D.flow.target))}return B},S=(O,B)=>{var P;return((P=pe.get(O))==null?void 0:P.get(B))??B};for(const O of m){if(!O.node.type.endsWith("Gateway"))continue;const B=O.node.lane??`pool:${O.node.participant??""}`,P=pe.get(B);if(!P||P.size<2)continue;const N=kt(O);if(N===void 0||S(B,N)!==S(B,0))continue;const L=S(B,N),D=G.filter(se=>se.flow.source===O.node.id).map(se=>T.get(se.flow.target)).filter(se=>!!se&&(se.node.lane??`pool:${se.node.participant??""}`)===B),H=D.filter(se=>{const oe=kt(se);return oe!==void 0&&S(B,oe)===L&&(x.get(se.node.id)??0)===1}),j=D.some(se=>{const oe=kt(se);return oe!==void 0&&S(B,oe)>L});if(H.length!==1||!j)continue;const Z=new Set(D.flatMap(se=>w(se.node.id)));if(!G.some(se=>se.flow.target===O.node.id&&Z.has(se.flow.source)))continue;const ue=new Map;for(const[se,oe]of P)ue.set(se,oe+1);ue.set(-1,0),pe.set(B,ue);for(const se of w(H[0].node.id))T.has(se)&&(ht.set(se,-1),tn.add(se));St.add(O.node.id)}}{const x=j=>j.node.lane??`pool:${j.node.participant??""}`,w=j=>kt(j)??0,S=new Map(_.map((j,Z)=>({id:j.participant.id,order:j.order??Number.POSITIVE_INFINITY,declared:Z})).sort((j,Z)=>j.order!==Z.order?j.order-Z.order:j.declared-Z.declared).map((j,Z)=>[j.id,Z])),O=j=>j===void 0?void 0:S.get(j)??-1,B=j=>{var ue;const Z=T.get(j);if(Z)return Z.node.participant;if(S.has(j))return j;const ie=f(j);if(ie)return ie.type==="bpmn:Participant"?ie.id:(ue=h(ie))==null?void 0:ue.id},P=new Map;for(const j of G)P.set(j.flow.target,(P.get(j.flow.target)??0)+1);const N=j=>{const Z=[j],ie=new Set([j.node.id]);for(let ue=0;ue<Z.length;ue++)for(const se of G){if(se.flow.source!==Z[ue].node.id||ie.has(se.flow.target)||(P.get(se.flow.target)??0)!==1)continue;const oe=T.get(se.flow.target);!oe||oe.node.participant!==j.node.participant||(ie.add(oe.node.id),Z.push(oe))}return Z},L=j=>{const Z=new Set(j.map(se=>se.node.id)),ie=O(j[0].node.participant);if(ie===void 0)return;const ue=new Set;for(const se of b){const oe=Z.has(se.flow.source)?se.flow.target:Z.has(se.flow.target)?se.flow.source:void 0;if(oe===void 0)continue;const ve=O(B(oe));ve===void 0||ve===ie||ue.add(ve<ie?"up":"down")}return ue.size===1?[...ue][0]:void 0},D=new Map;{const j=new Map;for(const oe of G){if(!T.has(oe.flow.source)||!T.has(oe.flow.target))continue;const ve=j.get(oe.flow.source)??[];ve.push(oe.flow.target),j.set(oe.flow.source,ve)}const Z=new Map,ie=[],ue=new Set,se=oe=>{Z.set(oe,"open");for(const ve of j.get(oe)??[]){const ye=Z.get(ve);ye==="open"?ue.add(`${oe}>${ve}`):ye||se(ve)}Z.set(oe,"done"),ie.push(oe)};for(const oe of m)Z.has(oe.node.id)||se(oe.node.id);for(const oe of ie.reverse()){const ve=D.get(oe)??0;D.set(oe,ve);for(const ye of j.get(oe)??[])!ue.has(`${oe}>${ye}`)&&(D.get(ye)??-1)<ve+1&&D.set(ye,ve+1)}}let H=-1e3;for(const j of m){if(!j.node.type.endsWith("Gateway"))continue;const Z=x(j),ie=pe.get(Z);if(!ie)continue;const ue=ie.get(w(j))??0,se=te=>(ie.get(w(te))??0)-ue,oe=G.filter(te=>te.flow.source===j.node.id).map(te=>T.get(te.flow.target)).filter(te=>!!te&&x(te)===Z&&(P.get(te.node.id)??0)===1&&!tn.has(te.node.id)).map(te=>{const J=N(te);return{root:te,subtree:J,dir:L(J)}});if(oe.some(te=>te.dir==="up")&&oe.some(te=>te.dir==="down"))continue;const ve=G.some(te=>{const J=te.flow.source===j.node.id?T.get(te.flow.target):void 0;return!!J&&x(J)===Z&&se(J)===0});let ye=!1;if(!ve){const te=G.filter(ge=>ge.flow.source===j.node.id).map(ge=>T.get(ge.flow.target)).filter(ge=>!!ge&&x(ge)===Z&&(!!ge.node.lane||Ke(ge)!==void 0)&&se(ge)<0),J=te.length?Math.max(...te.map(se)):void 0,ae=te.filter(ge=>se(ge)===J);if(!nn(j.node.id)&&ae.length===1&&(P.get(ae[0].node.id)??0)===1&&!St.has(j.node.id))continue;ye=!0}for(const te of oe){const J=te.dir;if(!J||oe.some(Me=>Me!==te&&Me.dir===J))continue;const ae=se(te.root);if(ae===0||(J==="up"?ae<0:ae>0)||G.some(Me=>{const ke=Me.flow.target===j.node.id?T.get(Me.flow.source):void 0;if(!ke||x(ke)!==Z)return!1;const Fe=se(ke);return J==="up"?Fe<0:Fe>0}))continue;const ge=[...ie].map(([Me,ke])=>({band:Me,rel:ke-ue})).filter(Me=>J==="up"?Me.rel<0:Me.rel>0).sort((Me,ke)=>Math.abs(ke.rel)-Math.abs(Me.rel));if(!ge.length&&J==="down")continue;const $e=w(te.root),Oe=te.subtree.filter(Me=>x(Me)===Z&&w(Me)===$e),Ze=new Set(te.subtree.map(Me=>Me.node.id)),Ae=Oe.map(Me=>D.get(Me.node.id)??0),Te=Math.min(...Ae)-1,Ce=Math.max(...Ae)+1,Pe=Me=>!m.some(ke=>{if(Ze.has(ke.node.id)||x(ke)!==Z||w(ke)!==Me)return!1;if(!Rn.has(Me))return!0;const Fe=D.get(ke.node.id)??0;return Fe>=Te&&Fe<=Ce});let fe=ye?w(j):(VS=ge.find(Me=>Pe(Me.band)))==null?void 0:VS.band;if(fe===void 0){if(fe=H--,Rn.add(fe),J==="up"){const Me=new Map;for(const[ke,Fe]of ie)Me.set(ke,Fe+1);Me.set(fe,0),pe.set(Z,Me)}else ie.set(fe,Math.max(...ie.values())+1);(WS=X.get(Z))==null||WS.add(fe)}for(const Me of Oe)ht.set(Me.node.id,fe)}}{const j=oe=>{const ve=G.find(ye=>ye.flow.target===oe.node.id);return ve?T.get(ve.flow.source):void 0},Z=oe=>{const ve=j(oe);if(!ve||!ve.node.type.endsWith("Gateway")||x(ve)!==x(oe))return!1;const ye=pe.get(x(ve));if(!ye)return!1;const te=ye.get(w(ve))??0,J=Oe=>x(Oe)===x(ve)?(ye.get(w(Oe))??0)-te:Number.NaN,ae=G.filter(Oe=>Oe.flow.source===ve.node.id).map(Oe=>T.get(Oe.flow.target)).filter(Oe=>!!Oe&&(!!Oe.node.lane||Ke(Oe)!==void 0));if(ae.some(Oe=>J(Oe)===0))return!1;const Q=ae.filter(Oe=>Oe.node.lane===ve.node.lane&&J(Oe)<0);if(!Q.length)return!1;const ge=Math.max(...Q.map(J)),$e=Q.filter(Oe=>J(Oe)===ge);return $e.length===1&&$e[0]===oe&&(P.get(oe.node.id)??0)===1&&!nn(ve.node.id)&&!St.has(ve.node.id)},ie=new Set;for(const oe of m){if(!oe.node.type.endsWith("Gateway")||nn(oe.node.id))continue;const ve=pe.get(x(oe));if(!ve)continue;const ye=ve.get(w(oe))??0;let te;for(const J of G){if(J.flow.source!==oe.node.id)continue;const ae=T.get(J.flow.target);if(!ae||x(ae)!==x(oe)||!ae.node.lane&&Ke(ae)===void 0)continue;const Q=ve.get(w(ae))??0;Q<=ye||(!te||Q>te.row?te={id:ae.node.id,row:Q,count:1}:Q===te.row&&te.count++)}te&&te.count===1&&(P.get(te.id)??0)===1&&ie.add(te.id)}const ue=new Set,se=[...m].sort((oe,ve)=>Number(ie.has(oe.node.id))-Number(ie.has(ve.node.id)));for(const oe of se){const ve=x(oe),ye=pe.get(ve);if(!ye)continue;const te=oe.node.id,J=b.filter(wt=>wt.flow.target===te);if(J.length!==1||!(P.get(te)??0)||!oe.node.lane&&Ke(oe)===void 0||tn.has(te)||Fn.has(te))continue;const ae=(US=T.get(J[0].flow.source))==null?void 0:US.node.participant;if(!ae||ae===oe.node.participant)continue;const Q=O(oe.node.participant),ge=O(ae);if(Q===void 0||ge===void 0||Q===ge)continue;const $e=ge<Q,Oe=ye.get(0)??0,Ze=(ye.get(w(oe))??Oe)-Oe;if(Ze===0||($e?Ze<0:Ze>0)||Z(oe))continue;let Ae;for(const[wt,an]of ye){if(Rn.has(wt))continue;const Yt=an-Oe;($e?Yt<0&&(!Ae||Yt<Ae.row):Yt>0&&(!Ae||Yt>Ae.row))&&(Ae={band:wt,row:Yt})}if(!Ae)continue;const Te=w(oe),Ce=N(oe).filter(wt=>x(wt)===ve&&w(wt)===Te&&!tn.has(wt.node.id)),Pe=j(oe),fe=Pe!=null&&Pe.node.type.endsWith("Gateway")?`${Pe.node.id}|${ve}|${Ae.band}`:void 0,Me=Ae,ke=!!fe&&ie.has(te)&&G.some(wt=>{if(wt.flow.source!==Pe.node.id||wt.flow.target===te)return!1;const an=T.get(wt.flow.target);return!!an&&x(an)===ve&&!Ce.includes(an)&&w(an)===Me.band});let Fe=Ae.band;if(fe&&(ue.has(fe)||ke)){if(Fe=H--,Rn.add(Fe),$e){const wt=new Map;for(const[an,Yt]of ye)wt.set(an,Yt+1);wt.set(Fe,0),pe.set(ve,wt)}else ye.set(Fe,Math.max(...ye.values())+1);(qS=X.get(ve))==null||qS.add(Fe)}fe&&ue.add(fe);for(const wt of Ce)ht.set(wt.node.id,Fe),Fn.add(wt.node.id);$e&&ie.has(te)&&Nt.add(te)}}}const on=(x,w)=>{var S;return((S=pe.get(x))==null?void 0:S.get(w))??w},Wi=(x,w,S,O)=>{const B=x?f(x):w?f(w):void 0;if(!B)return!1;const P=x?B.y+Math.min(B.height/2,q):B.y+le;return Math.abs(P+on(x??`pool:${w??""}`,S)*he-O)<=he/2},hi=new Map;for(const[x,w]of X){let S=0;for(const O of w)S=Math.max(S,on(x,O));hi.set(x,S)}const xi=x=>ee+he*x,Un=(x,w,S,O)=>{const B=d().children.filter(P=>!("waypoints"in P&&P.waypoints)&&P.type!=="label"&&P.id!==w&&!(O!=null&&O.has(P.id))&&typeof P.y=="number"&&P.y>=x);B.length&&n.moveElements(B,{x:0,y:S})},mn=(x,w,S)=>{const O=x.type==="bpmn:Participant"?x:void 0;if(!O||O.children.some(L=>L.type==="bpmn:Lane"))return;const B=S+w.height/2+me-O.y;if(O.height>=B)return;const P=B-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:B}),Un(N,O.id,P)},br=(x,w)=>{const S=w-x.height;if(S<=0)return new Set;const O=h(x)??x,B=[],P=D=>{B.push(D);for(const H of D.children??[])P(H)};P(O);const N=x.y+x.height-10,L=l.calculateAdjustments(B,"y",S,N);return l.makeSpace(L.movingShapes,L.resizingShapes,{x:0,y:S},"s",N),new Set(L.movingShapes.map(D=>D.id))},es=(x,w,S)=>{if(x){const N=g(x),L=xi(w);if(N.height>=L)return;const D=L-N.height,H=h(N),j=H?H.y+H.height:N.y+N.height,Z=br(N,L);Un(j,H==null?void 0:H.id,D,Z);return}if(!S)return;const O=he*(w+1);if(S.height>=O)return;const B=O-S.height,P=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:O}),Un(P,S.id,B)},ti=new Map;for(const x of G)ti.set(x.flow.target,(ti.get(x.flow.target)??0)+1);const xt=x=>(ti.get(x)??0)<=1,At=new Set(m.map(x=>x.node.id).filter(x=>re(x)===1&&!G.some(w=>w.flow.target===x||w.flow.source===x&&T.has(w.flow.target)))),Vg=new Map,fS=(x,w)=>{if(!x)return;const S=f(x);if(!S||S.height>=xi(w))return;const O=S.y+S.height-10,B=h(S);if(B)return new Set((B.children??[]).filter(P=>P.type!=="bpmn:Lane"&&typeof P.y=="number"&&P.y>O).map(P=>P.id))},Sp=(x,w,S)=>{if(!x)return!0;const O=f(x);return O?S-w.height/2>=O.y&&S+w.height/2<=O.y+O.height:!0},_F=10,EF=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:w}of we){const S=f(x),O=de(x);if(!S||O.length<2)continue;const B=xi(0),P=_F,N=new Set(jt(e,"node.update").filter(Q=>Q.lane!==void 0&&w.has(Q.lane)).map(Q=>Q.id)),L=S.children??[],D=L.filter(Q=>!("waypoints"in Q&&Q.waypoints)&&Q.type!=="bpmn:Lane"&&Q.type!=="label"&&typeof Q.y=="number"),H=[];for(const Q of D){H.push([Q.y,Q.y+Q.height]);const ge=Q.label;ge&&H.push([ge.y,ge.y+ge.height])}for(const Q of L){const ge="waypoints"in Q&&Q.waypoints?Q.label:void 0;ge&&ge.y+ge.height>S.y&&ge.y<S.y+S.height&&H.push([ge.y,ge.y+ge.height])}for(const Q of d().children){if(Q.type!=="bpmn:TextAnnotation")continue;const ge=Q;ge.x<S.x+S.width&&ge.x+ge.width>S.x&&ge.y<S.y+S.height&&ge.y+ge.height>S.y&&H.push([ge.y,ge.y+ge.height])}H.sort((Q,ge)=>Q[0]-ge[0]);const j=S.y,Z=S.y+S.height,ie=[];let ue=j;for(const[Q,ge]of H)Q>ue&&ie.push([ue,Q]),ue=Math.max(ue,ge);const se=D.filter(Q=>EF.test(Q.type)&&!N.has(Q.id)),oe=(Q,ge)=>se.some($e=>$e.y+$e.height/2>=Q&&$e.y+$e.height/2<=ge),ve=Q=>H.some(([ge,$e])=>ge<Q-.5&&Q+.5<$e),ye=[];let te=j;for(const Q of O.slice(1).map(ge=>ge.y)){const ge=te+2*P,$e=!ve(Q)&&Q>=ge&&Q<=Z-2*P?[Q]:[];for(const[Ze,Ae]of ie){const Te=Math.max(Ze+P,ge),Ce=Math.min(Ae-P,Z-2*P);Te<=Ce&&$e.push(Math.min(Math.max(Q,Te),Ce))}$e.push(Math.max(ue+P,ge));let Oe;for(const Ze of $e){const Ae=!oe(te,Ze)&&Ze-te<B?D.filter(Pe=>Pe.y>=Ze).length:0,Te=Math.abs(Ze-Q),Ce=Oe?Math.abs(Oe.y-Q):0;(!Oe||Ae<Oe.cost||Ae===Oe.cost&&(Te<Ce||Te===Ce&&Ze>Oe.y))&&(Oe={y:Ze,cost:Ae})}ye.push(Oe.y),te=Oe.y}const J=ye[ye.length-1]+2*P-Z;J>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+J}),Un(Z,S.id,J));const ae=[j,...ye,S.y+S.height];O.forEach((Q,ge)=>{const $e=ae[ge],Oe=ae[ge+1]-$e;(Q.y!==$e||Q.height!==Oe)&&n.resizeShape(Q,{x:Q.x,y:$e,width:Q.width,height:Oe})});for(const Q of O){if(Q.height>=B||oe(Q.y,Q.y+Q.height))continue;const ge=B-Q.height,$e=S.y+S.height,Oe=br(Q,B);Un($e,S.id,ge,Oe)}}const Rp=_.map((x,w)=>({op:x,declared:w}));Rp.sort((x,w)=>{const S=x.op.order??Number.POSITIVE_INFINITY,O=w.op.order??Number.POSITIVE_INFINITY;return S!==O?S-O:x.declared-w.declared});let Cc=80;for(const x of r.getAll())x.parent===d()&&"height"in x&&typeof x.y=="number"&&(Cc=Math.max(Cc,x.y+x.height+60));const Wg=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===d()),SF=(()=>{if(!Wg.length)return;const x=Wg.filter(B=>!mv(B)),w=x.length?x:Wg,S=Math.min(...w.map(B=>B.x)),O=Math.max(...w.map(B=>B.x+B.width));return O>S?{x:S,width:O-S}:void 0})();for(const{op:x}of Rp){const w=x.participant,S=m.filter(oe=>oe.node.participant===w.id).length,O=((YS=w.lanes)==null?void 0:YS.length)??0,B=Math.max(1200,S*160+300),P=(w.lanes??[]).map(oe=>xi(hi.get(oe.id)??0)),N=P.reduce((oe,ve)=>oe+ve,0);O&&N<300&&(P[O-1]+=300-N);const L=Math.max(300,he*((hi.get(`pool:${w.id}`)??0)+1)),D=w.blackBox||S+O===0?120:O?Math.max(300,N):L,H=w.blackBox?SF:void 0,j=(H==null?void 0:H.x)??100,Z=(H==null?void 0:H.width)??B,ie=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:w.id,name:w.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...w.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Z,height:D,isExpanded:!0}),ue=n.createShape(ie,{x:j+Z/2,y:Cc+D/2},d()),se=w.lanes??[];if(se.length&&n.splitLane(ue,se.length),se.length){const oe=r.filter(ve=>{var ye;return ve.type==="bpmn:Lane"&&((ye=h(ve))==null?void 0:ye.id)===w.id}).sort((ve,ye)=>ve.y-ye.y);if(oe.forEach((ve,ye)=>{const te=se[ye];te&&n.updateProperties(ve,{id:te.id,name:te.name})}),P.some(ve=>ve!==ue.height/O)){let ve=ue.y;oe.forEach((ye,te)=>{const J=P[te];n.resizeShape(ye,{x:ye.x,y:ve,width:ye.width,height:J}),ve+=J})}}Cc=ue.y+ue.height+60}const RF=x=>{var O;const w=T.get(x);if(w)return w.node.participant??"";const S=f(x);return S?S.type==="bpmn:Participant"?S.id:((O=h(S))==null?void 0:O.id)??"":""},Mc=new Map,hS=x=>{let w=Mc.get(x);return w||Mc.set(x,w={nodes:[],flows:[]}),w};for(const x of m)hS(x.node.participant??"").nodes.push(x);for(const x of G)hS(RF(x.flow.source)).flows.push(x);const Cp=x=>{var w;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((w=x.condition)==null?void 0:w.label)})},Ug=(x,w,S)=>o.createShape({type:sl(x.type),...x.eventDefinition?{eventDefinitionType:Bc[x.eventDefinition]}:{},businessObject:i.create(sl(x.type),{id:x.id,name:x.name,...w!==void 0?{"bwl:band":w}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),CF=[...Rp.map(({op:x})=>x.participant.id).filter(x=>Mc.has(x)),...[...Mc.keys()].filter(x=>!_.some(w=>w.participant.id===x))],qg=x=>x.endsWith("Gateway");for(const x of CF){const w=Mc.get(x),S=x?g(x):void 0,O=S?S.x+150:250;let B=S?S.y+80:120;const P=(J,ae,Q)=>{if(J){const ge=g(J);return ge.y+Math.min(ge.height/2,q)+on(J,ae??0)*he}return ae!==void 0&&S?S.y+le+on(`pool:${x}`,ae)*he:Q},N=(J,ae,Q)=>{if(J){const ge=g(J);return ge.y+Math.min(ge.height/2,q)+ae*he}return S?S.y+le+ae*he:Q},L=J=>J.participant?g(J.participant):d(),D=(J,ae,Q,ge,$e,Oe,Ze,Ae)=>{const Te=Q!==void 0||ge!==void 0,Ce=ke=>{const Fe=()=>es(Q,ke,S);Ae?Ae(Fe):Fe()},Pe=on(Q??`pool:${x}`,ge??0);if((ge===void 0||Wi(Q,x,ge,Ze??Number.NaN))&&Ze!==void 0&&Sp(Q,ae,Ze)&&!R(J,ae,$e,Ze))return{x:$e,y:Ze};if(Te)for(let ke=0;ke<4;ke++){const Fe=N(Q,Pe+ke,Oe);if(!R(J,ae,$e,Fe,fS(Q,Pe+ke)))return Ce(Pe+ke),{x:$e,y:Fe}}const fe=P(Q,ge,Oe);Te?Ce(Pe):Ae?Ae(()=>mn(J,ae,ae.y+ae.height/2)):mn(J,ae,fe);let Me=$e;for(let ke=0;ke<64;ke++){const Fe=R(J,ae,Me,fe);if(!Fe)break;Me=Fe.x+Fe.width+W+ae.width/2}return{x:Me,y:fe}},H=(J,ae,Q)=>{const ge=r.getAll().filter(Oe=>{var Ze;return/Association$/.test(Oe.type)&&(((Ze=Oe.waypoints)==null?void 0:Ze.length)??0)>=2});if(!ge.length)return Q;const $e=Oe=>{const Ze={id:ae.id,type:ae.type,x:Oe-ae.width/2,y:Q.y-ae.height/2,width:ae.width,height:ae.height};return ge.some(Ae=>Ae.waypoints.some((Te,Ce)=>!!Ae.waypoints[Ce+1]&&Go(Te,Ae.waypoints[Ce+1],Ze)<=ze))};if(!$e(Q.x))return Q;for(let Oe=M;Oe<=$;Oe+=M){const Ze=Q.x+Oe;if(!$e(Ze)&&!R(J,ae,Ze,Q.y))return{x:Ze,y:Q.y}}return Q},j=new Set(w.flows.map(J=>J.flow.target)),Z=new Map,ie=J=>{if(J===void 0)return;const ae=r.get(J);if(!(!ae||typeof ae.x!="number"||typeof ae.width!="number"))return ae.x+ae.width+W},ue=J=>{if(re(J)>0)return;const ae=w.flows.filter(ge=>ge.flow.source===J);if(ae.length!==1)return;const Q=r.get(ae[0].flow.target);return Q&&typeof Q.y=="number"&&typeof Q.height=="number"?Q.y+Q.height/2:void 0};for(const J of w.nodes){if(j.has(J.node.id))continue;const ae=Ug(J.node,J.band,J.afterColumn),Q=Ke(J),ge=J.node.lane?`${J.node.lane}|${Q??""}`:Q!==void 0?`band:${Q}`:"",$e=L(J.node),Oe=Z.get(ge)??O,Ze=ie(J.afterColumn),Ae=Ze===void 0?Oe:Math.max(Oe,Ze);let Te;const Ce=D($e,ae,J.node.lane,Q,Ae,B,ue(J.node.id),At.has(J.node.id)&&J.node.participant!==void 0?Pe=>Te=Pe:void 0);if(Te?n.createShape(ae,Ce,$e,{autoResize:!1}):n.createShape(ae,Ce,$e),Te){const Pe=J.node.lane?g(J.node.lane):$e;Vg.set(J.node.id,{container:Pe,relCy:Ce.y-Pe.y,grow:Te})}Z.set(ge,Ce.x+ae.width+W),!J.node.lane&&Q===void 0&&(B+=160)}const se=new Set,oe=new Map,ve=new Map;if(x&&U.has(`pool:${x}`)){const J=new Map;for(const Ae of w.flows)J.set(Ae.flow.target,(J.get(Ae.flow.target)??0)+1);const ae=Ae=>P(Ae.node.lane,kt(Ae),Number.NaN),Q=new Set,ge=Ae=>{var Pe;const Te=(Pe=T.get(Ae))==null?void 0:Pe.node.participant;if(Te)return f(Te);const Ce=f(Ae);if(Ce)return Ce.type==="bpmn:Participant"?Ce:h(Ce)},$e=Ae=>{const Te=[],Ce=new Set([Ae]),Pe=[Ae];for(;Pe.length;){const fe=Pe.shift(),Me=T.get(fe);Me&&Te.push(Me);for(const ke of w.flows)ke.flow.source!==fe||Ce.has(ke.flow.target)||(J.get(ke.flow.target)??0)!==1||(Ce.add(ke.flow.target),Pe.push(ke.flow.target))}return Te},Oe=Ae=>{if(!S)return;const Te=new Set(Ae.map(fe=>fe.node.id));let Ce=!1,Pe=!1;for(const fe of b){if(!Te.has(fe.flow.source))continue;const Me=ge(fe.flow.target);!Me||Me.id===S.id||(Me.y<S.y?Ce=!0:Pe=!0)}return Ce&&!Pe?"up":Pe&&!Ce?"down":void 0};for(const Ae of w.nodes){if(!qg(Ae.node.type))continue;const Te=P(Ae.node.lane,Ke(Ae),Number.NaN);if(Number.isNaN(Te))continue;const Ce=[];for(const ke of w.flows){if(ke.flow.source!==Ae.node.id)continue;const Fe=T.get(ke.flow.target);if(!Fe||Fe.node.lane!==Ae.node.lane||(J.get(Fe.node.id)??0)!==1)continue;const wt=Ke(Fe);if(wt===void 0)continue;const an=P(Fe.node.lane,wt,Number.NaN);if(Number.isNaN(an))continue;const Yt=$e(Fe.node.id),Kt=Oe(Yt);Kt&&Ce.push({subtree:Yt,band:wt,row:an,dir:Kt})}if(!Ce.some(ke=>ke.dir==="up")||!Ce.some(ke=>ke.dir==="down")||!Ce.some(ke=>ke.dir==="up"&&Ce.some(Fe=>Fe.dir==="down"&&Fe.row<ke.row)))continue;const fe=[...Ce].sort((ke,Fe)=>ke.row-Fe.row);[...Ce.filter(ke=>ke.dir==="up"),...Ce.filter(ke=>ke.dir==="down")].sort((ke,Fe)=>ke.dir===Fe.dir?ke.row-Fe.row:ke.dir==="up"?-1:1).forEach((ke,Fe)=>{const wt=fe[Fe].band;if(wt!==ke.band){Q.add(Ae.node.id);for(const an of ke.subtree)Ke(an)===ke.band&&ht.set(an.node.id,wt)}})}const Ze=Ae=>{if(!S)return;const Te=new Set(Ae.map(fe=>fe.node.id));let Ce=!1,Pe=!1;for(const fe of b){if(!Te.has(fe.flow.target))continue;const Me=ge(fe.flow.source);!Me||Me.id===S.id||(Me.y<S.y?Ce=!0:Pe=!0)}return Ce&&!Pe?"up":Pe&&!Ce?"down":void 0};for(const Ae of w.nodes){if(!qg(Ae.node.type))continue;const Te=Ae.node.lane??`pool:${x}`,Ce=pe.get(Te);if(!Ce||Ce.size<2)continue;const Pe=Ce.get(0);if(Pe===void 0)continue;const fe=Math.max(...Ce.values()),Me=Pe===fe&&Pe!==0?"down":void 0;if(!Me)continue;const ke=[];for(const Kt of w.flows){if(Kt.flow.source!==Ae.node.id)continue;const jn=T.get(Kt.flow.target);if(!jn||jn.node.lane!==Ae.node.lane||(J.get(jn.node.id)??0)!==1)continue;const _n=kt(jn);_n!==void 0&&ke.push({t:jn,subtree:$e(jn.node.id),band:_n})}const Fe=ke.find(Kt=>(Ce.get(Kt.band)??Kt.band)===Pe);if(!Fe||Ze(Fe.subtree)===Me||Oe(Fe.subtree)===Me)continue;const wt=ke.find(Kt=>Kt!==Fe&&Ze(Kt.subtree)===Me);if(!wt)continue;const an=Fe.band,Yt=wt.band;for(const Kt of Fe.subtree)kt(Kt)===an&&ht.set(Kt.node.id,Yt);for(const Kt of wt.subtree)kt(Kt)===Yt&&ht.set(Kt.node.id,an);Q.add(Ae.node.id)}for(const Ae of w.nodes){if(!qg(Ae.node.type))continue;const Te=ae(Ae);if(Number.isNaN(Te)||nn(Ae.node.id))continue;let Ce,Pe=!1,fe;for(const Me of w.flows){if(Me.flow.source!==Ae.node.id)continue;const ke=T.get(Me.flow.target);if(!ke||!ke.node.lane&&Ke(ke)===void 0)continue;const Fe=ae(ke);Number.isNaN(Fe)||(Math.abs(Fe-Te)<.5&&(Pe=!0),Fe>Te?!Ce||Fe>Ce.row?Ce={id:ke.node.id,row:Fe,count:1}:Fe===Ce.row&&Ce.count++:Fe<Te&&ke.node.lane===Ae.node.lane&&!Fn.has(ke.node.id)&&(!fe||Fe>fe.row?fe={op:ke,row:Fe,count:1}:Fe===fe.row&&fe.count++))}Ce&&Ce.count===1&&(J.get(Ce.id)??0)===1&&!Q.has(Ae.node.id)&&se.add(Ce.id),!Pe&&fe&&fe.count===1&&(J.get(fe.op.node.id)??0)===1&&!St.has(Ae.node.id)&&oe.set(fe.op.node.id,{lane:Ae.node.lane,band:kt(Ae)})}for(const Ae of Nt){const Te=(KS=w.flows.find(Ce=>Ce.flow.target===Ae))==null?void 0:KS.flow.source;Te&&!Q.has(Te)&&se.add(Ae)}}const ye=new Set;let te=0;for(;te++<w.nodes.length+2;){for(let Q=0;Q<w.nodes.length+w.flows.length+2;Q++){let ge=!1;for(const $e of w.flows){const Oe=$e.flow;if(ye.has(Oe.id))continue;const Ze=f(Oe.source);if(!Ze)continue;const Ae=f(Oe.target),Te=T.get(Oe.target);if(!Ae&&Te){const Ce=Ug(Te.node,Te.band),Pe=kt(Te);if(Te.node.lane||Pe!==void 0){const fe=L(Te.node),Me=Ze,ke=Me.x+(ve.get(Oe.source)??0)+Me.width+W,Fe=oe.get(Oe.target),wt=D(fe,Ce,Fe?Fe.lane:Te.node.lane,Fe?Fe.band:Pe,se.has(Oe.target)?Me.x+Me.width/2:ke,Number.NaN,Fe||!xt(Oe.target)?void 0:Me.y+Me.height/2),an=T.has(Oe.source)?wt:H(fe,Ce,wt),Yt=n.createShape(Ce,an,fe);se.has(Oe.target)&&ve.set(Oe.target,ke-(Yt.x+Yt.width/2)),n.connect(Ze,Yt,{type:"bpmn:SequenceFlow",businessObject:Cp(Oe)})}else s.append(Ze,Ce,{connection:{type:"bpmn:SequenceFlow",businessObject:Cp(Oe)}})}else if(Ae)n.connect(Ze,Ae,{type:"bpmn:SequenceFlow",businessObject:Cp(Oe)});else continue;ye.add(Oe.id),ge=!0}if(!ge)break}const J=w.nodes.filter(Q=>!f(Q.node.id));if(!J.length)break;const ae=J[0];{const Q=Ug(ae.node,ae.band),ge=L(ae.node),$e=Ke(ae);n.createShape(Q,D(ge,Q,ae.node.lane,$e,O,B),ge),!ae.node.lane&&$e===void 0&&(B+=160)}}}const gS=new Map;for(const[x,w]of F){const S=f(x),O=f(w.flow.target);if(!(S!=null&&S.target)||!O)continue;const B=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};gS.set(x,{waypoints:S.waypoints.map(L=>({x:L.x,y:L.y})),label:B});const P=S.target,N=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(S,O,P,[N(O),N(P)]),n.layoutConnection(S,{waypoints:[]})}const mS=new Set;{const x=P=>P.endsWith("Task")||P==="bpmn:CallActivity"||P==="bpmn:SubProcess",w=P=>x(P)||P==="bpmn:EndEvent"||P==="bpmn:IntermediateThrowEvent"||P==="bpmn:IntermediateCatchEvent",S=P=>(P??[]).filter(N=>N.type==="bpmn:SequenceFlow"),O=jt(e,"sequenceFlow.update"),B=(P,N)=>{if(!P)return;const L=N.x+N.width/2,D=N.y+N.height/2;let H;const j=Z=>{for(const ie of Z.children??[])if(ie.type==="bpmn:Lane"){const ue=ie;L>=ue.x&&L<=ue.x+ue.width&&D>=ue.y&&D<=ue.y+ue.height&&(H=ue,j(ue))}};return j(P),H==null?void 0:H.id};for(const P of O){if(P.source===void 0&&P.target===void 0||F.has(P.id))continue;const N=f(P.id);if(!N)continue;const L=P.source!==void 0?f(P.source):N.source,D=P.target!==void 0?f(P.target):N.target;if(!L||!D||L.id===D.id||T.has(L.id)||T.has(D.id)||!x(L.type)||!w(D.type)||L.parent!==D.parent||S(D.incoming).some(te=>te.id!==N.id)||S(D.outgoing).some(te=>te.id!==N.id)||O.some(te=>te!==P&&(te.target===D.id||te.source===D.id))||D.x>=L.x+L.width)continue;const H=L.parent,j=h(L),Z=L.x+L.width+W,ie=L.y+L.height/2,ue=D.y+D.height/2,se=B(j,L)===B(j,D),oe=new Set([D.id]),ve=[se?ie:ue,ue].find(te=>!R(H,D,Z,te,oe));if(ve===void 0)continue;if(n.moveElements([D],{x:Z-(D.x+D.width/2),y:ve-ue}),j){const te=D.x+D.width+Ld-(j.x+j.width);te>0&&pl(n,j,j.width+te)}const ye=te=>({x:te.x+te.width/2,y:te.y+te.height/2});n.reconnect(N,L,D,[ye(L),ye(D)]),Math.abs(ye(L).y-ye(D).y)>1&&n.layoutConnection(N,{waypoints:[]}),mS.add(P.id)}}const wr=40,MF=10,Mp=x=>{const w=j=>j.kind==="label-over-line"||j.kind==="label-over-shape"||j.kind==="label-on-shared-segment"?j.edge===x.id:j.kind==="annotation-over-label"||j.kind==="pool-name-over-label"?j.label===x.id:!1,S=()=>new Map(ut(Ve(r)).filter(j=>!w(j)).map(j=>[ct(j),j])),O=S(),B=j=>[...j].filter(([Z])=>!O.has(Z)).map(([,Z])=>Z),P=j=>B(j).length<=[...O.keys()].filter(Z=>!j.has(Z)).length,N=x.waypoints.map(j=>({x:j.x,y:j.y})),L=x.label,D=L&&{x:L.x,y:L.y};n.layoutConnection(x,{waypoints:[]});const H=S();if(!P(H)){if(B(H).every(j=>j.kind==="edge-crosses-shape"&&j.edge===x.id)){const j=Ve(r),Z=j.edges.find(oe=>oe.id===x.id),ie=kn(j),ue=Z?Pt(Z,ie):[],se=Z&&ue.length&&!ue.every(oe=>oe.type==="bpmn:TextAnnotation")?tl(Z,ie,ys(x),j.edges):null;if(se&&(n.updateWaypoints(x,se),P(S())))return}n.updateWaypoints(x,N),L&&D&&(L.x!==D.x||L.y!==D.y)&&n.moveElements([L],{x:D.x-L.x,y:D.y-L.y})}},Yg=5,Ii=10,yS=200,Ac=new Set([...G.map(x=>x.flow.id),...b.map(x=>x.flow.id),...jt(e,"sequenceFlow.update").map(x=>x.id),...jt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),AF=(x,w,S,O,B,P)=>{const N=new Set(x.map(te=>te.id)),L=Math.min(...x.map(te=>te.x))+w-Ii,D=Math.max(...x.map(te=>te.x+te.width))+w+yS+Ii,H=Math.min(...x.map(te=>te.y+Math.min(0,...S)))-Ii,j=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...S)))+Ii,Z=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const J=te;return Ac.has(J.id)||!J.waypoints||J.waypoints.length<2||[J.source,J.target].some(Q=>!Q||N.has(Q.id)||Q.x>=O)?!1:J.waypoints.some((Q,ge)=>{const $e=J.waypoints[ge+1];return!!$e&&Math.max(Q.x,$e.x)>=L&&Math.min(Q.x,$e.x)<=D&&Math.max(Q.y,$e.y)>=H&&Math.min(Q.y,$e.y)<=j})});if(!Z.length)return 0;const ie=te=>{const J=new Map;for(const ae of x)for(const Q of S){const ge={id:ae.id,type:ae.type,x:ae.x+w+te,y:ae.y+Q,width:ae.width,height:ae.height};for(const $e of Z){let Oe=1/0;for(let Ae=0;Ae+1<$e.waypoints.length;Ae++)Oe=Math.min(Oe,Go($e.waypoints[Ae],$e.waypoints[Ae+1],ge));const Ze=`${$e.id}|${ae.id}`;J.set(Ze,Math.min(J.get(Ze)??1/0,Oe))}}return J},ue=[...ie(0)].filter(([,te])=>te<=Yg).map(([te])=>te);if(!ue.length)return 0;let se=0;for(let te=1;te<=yS;te++){const J=ie(te);if([...J.values()].every(ae=>ae>Yg)&&ue.every(ae=>(J.get(ae)??1/0)>=Ii)){se=te;break}}if(!se)return 0;const oe=Math.min(...x.map(te=>te.x))+w+se,ve=new Set(ue.map(te=>te.slice(0,te.indexOf("|"))));return Z.some(te=>te.type==="bpmn:SequenceFlow"&&ve.has(te.id)&&te.waypoints.some((J,ae)=>{const Q=te.waypoints[ae+1];if(!Q||Math.min(J.y,Q.y)>P||Math.max(J.y,Q.y)<P||J.y===Q.y)return!1;const ge=J.x+(P-J.y)*(Q.x-J.x)/(Q.y-J.y);return ge>B&&ge<oe}))?0:se},_r=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],B=new Set([x]);for(let P=0;P<O.length;P++){const N=O[P].id;for(const L of G){const D=L.flow.target;if(L.flow.source!==N||B.has(D)||!T.has(D))continue;B.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},TF=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],B=new Set([x]);for(let P=0;P<O.length;P++){const N=O[P].id;for(const L of G){const D=L.flow.source;if(L.flow.target!==N||B.has(D)||!T.has(D))continue;B.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},Bi=30,Ni=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",ts=(x,w)=>pl(n,x,w),ns=(x,w,S=!1)=>{const O=new Set(x.flatMap(D=>D.subtree.map(H=>H.id)));for(const D of x){const H=(D.pool.children??[]).filter(Ni).filter(Z=>!O.has(Z.id));if(D.subtree.some(Z=>H.some(ie=>Z.x+w<ie.x+ie.width+Bi&&Z.x+w+Z.width+Bi>ie.x&&Z.y<ie.y+ie.height&&Z.y+Z.height>ie.y)))return null}const B=x.map(D=>D.pool.width),P=S?r.filter(D=>Array.isArray(D.waypoints)).map(D=>({c:D,wps:D.waypoints.map(H=>({x:H.x,y:H.y}))})):[],N=r.filter(D=>D.type==="label").map(D=>({label:D,x:D.x,y:D.y}));n.moveElements(x.flatMap(D=>D.subtree),{x:w,y:0});const L=x.map(D=>{const j=Math.max(...D.subtree.map(Z=>Z.x+Z.width))+Ld-(D.pool.x+D.pool.width);return j>0&&ts(D.pool,D.pool.width+j),j});return()=>{n.moveElements(x.flatMap(D=>D.subtree),{x:-w,y:0}),x.forEach((D,H)=>{L[H]>0&&ts(D.pool,B[H])});for(const{c:D,wps:H}of P){const j=D.waypoints??[];j.length===H.length&&j.every((ie,ue)=>Math.abs(ie.x-H[ue].x)<=.5&&Math.abs(ie.y-H[ue].y)<=.5)||n.updateWaypoints(D,H.map(ie=>({x:ie.x,y:ie.y})))}for(let D=0;D<3;D++){let H=0;for(const j of N){const Z=j.x-j.label.x,ie=j.y-j.label.y;Math.abs(Z)<=.5&&Math.abs(ie)<=.5||(n.moveElements([j.label],{x:Z,y:ie}),H++)}if(!H)break}}},Kg=x=>{var B,P;const w=new Map,S=new Map;for(const N of r.getAll()){if(N.type!=="bpmn:Participant")continue;const L=N;(L.children??[]).length||(w.set(L.id,L),S.set(L.id,[]))}for(const N of r.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const L=N,D=(B=L.source)==null?void 0:B.id,H=(P=L.target)==null?void 0:P.id;D&&H&&S.has(D)&&S.get(D).push(H),D&&H&&S.has(H)&&S.get(H).push(D)}const O=[];for(const[N,L]of S)L.length&&L.every(D=>x.has(D))&&O.push(w.get(N));return O},vS=(x,w)=>{if(!x.length)return null;const S=new Set(x.map(j=>j.id)),O=r.getAll().filter(j=>j.type==="bpmn:Participant"&&!S.has(j.id)),B=Math.min(...O.filter(j=>(j.children??[]).length>0).map(j=>j.x)),P=new Set(x.filter(j=>Math.abs(j.x-B)<=2).map(j=>j.id));if(x.some(j=>{const Z=P.has(j.id)?j.x:j.x+w,ie=P.has(j.id)?j.width+w:j.width;return O.some(ue=>Z<ue.x+ue.width+Bi&&Z+ie+Bi>ue.x&&j.y<ue.y+ue.height&&j.y+j.height>ue.y)}))return null;const L=r.filter(j=>j.type==="label").map(j=>({label:j,x:j.x,y:j.y})),D=x.filter(j=>!P.has(j.id)),H=x.filter(j=>P.has(j.id)).map(j=>({pool:j,was:{x:j.x,y:j.y,width:j.width,height:j.height}}));D.length&&n.moveElements(D,{x:w,y:0});for(const{pool:j,was:Z}of H)n.resizeShape(j,{...Z,width:Z.width+w});return()=>{for(const{pool:j,was:Z}of H)n.resizeShape(j,Z);D.length&&n.moveElements(D,{x:-w,y:0});for(let j=0;j<3;j++){let Z=0;for(const ie of L){const ue=ie.x-ie.label.x,se=ie.y-ie.label.y;Math.abs(ue)<=.5&&Math.abs(se)<=.5||(n.moveElements([ie.label],{x:ue,y:se}),Z++)}if(!Z)break}}},xS=(x,w,S)=>{const O=S.x+S.width/2,B=w.y>S.y,P=B?S.y+S.height:S.y,N=B?w.y:w.y+w.height,L=x.source===w?[{x:O,y:N},{x:O,y:P}]:[{x:O,y:P},{x:O,y:N}],D=Ve(r),H={...D.edges.find(j=>j.id===x.id),waypoints:L};return Pt(H,kn(D)).length?!1:(n.updateWaypoints(x,L),!0)},PF=()=>{const x=r.filter(N=>N.type==="bpmn:Participant"),w=Math.min(...x.filter(N=>(N.children??[]).length>0).map(N=>N.x)),S=N=>_.some(L=>L.participant.id===N.id),O=N=>!!N&&N.type==="bpmn:Participant"&&!(N.children??[]).length&&Math.abs(N.x-w)<=2&&!S(N),B=N=>!!N&&N.type==="bpmn:Participant"&&(N.children??[]).length>0&&!S(N),P=new Set;for(const N of r.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const L=N;if((L.waypoints??[]).length!==2)continue;const D=[L.source,L.target].find(Z=>O(Z)||B(Z)),H=D===L.source?L.target:L.source;if(!D||!H||H.type==="bpmn:Participant")continue;const j=H.x+H.width/2;B(D)&&(j<D.x||j>D.x+D.width)||P.add(L.id)}return P},kF=x=>{var S;const w=new Map;for(const O of x){const B=r.get(O);if(!B||(B.waypoints??[]).length===2)continue;const P=((S=B.source)==null?void 0:S.type)==="bpmn:Participant"?B.source:B.target,N=P===B.source?B.target:B.source;if(N.x+N.width/2<=P.x+P.width)continue;const L=w.get(P.id)??{pool:P,msgs:[]};L.msgs.push({conn:B,other:N}),w.set(P.id,L)}for(const{pool:O,msgs:B}of w.values()){const P=Math.max(...B.map(({other:se})=>se.x+se.width/2))+Od;if(r.getAll().some(se=>{if(se.type!=="bpmn:Participant"||se.id===O.id)return!1;const oe=se;return O.x<oe.x+oe.width+Bi&&P+Bi>oe.x&&O.y<oe.y+oe.height&&O.y+O.height>oe.y}))continue;const L={x:O.x,y:O.y,width:O.width,height:O.height},D=[...O.incoming??[],...O.outgoing??[]],H=D.map(se=>({c:se,wps:(se.waypoints??[]).map(oe=>({x:oe.x,y:oe.y}))})),j=D.flatMap(se=>{const oe=se.label;return oe?[{label:oe,x:oe.x,y:oe.y}]:[]}),Z=Er();ts(O,P-O.x);const ie=B.filter(({conn:se,other:oe})=>xS(se,O,oe)).length,ue=Er();if(!(ie>0&&ue.messages>Z.messages&&ue.lines>=Z.lines)){ts(O,L.width);for(const{c:se,wps:oe}of H){const ve=se.waypoints??[];ve.length===oe.length&&ve.every((te,J)=>Math.abs(te.x-oe[J].x)<=.5&&Math.abs(te.y-oe[J].y)<=.5)||n.updateWaypoints(se,oe.map(te=>({x:te.x,y:te.y})))}for(let se=0;se<3;se++){let oe=0;for(const ve of j){const ye=ve.x-ve.label.x,te=ve.y-ve.label.y;Math.abs(ye)<=.5&&Math.abs(te)<=.5||(n.moveElements([ve.label],{x:ye,y:te}),oe++)}if(!oe)break}}}},bS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:DataInputAssociation"&&w.type!=="bpmn:DataOutputAssociation")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},wS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:Association")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},OF=x=>{const w=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const O=S;if(x.has(O.id))continue;const P=[...O.incoming??[],...O.outgoing??[]].filter(D=>D.type==="bpmn:Association").map(D=>D.source===O?D.target:D.source);if(!P.length||P.some(D=>D===void 0))continue;const N=D=>{if(!("waypoints"in D&&D.waypoints))return[D.id];const H=D,j=[H.source,H.target];return j.some(Z=>!Z)?[]:j.map(Z=>Z.id)},L=P.flatMap(D=>N(D));L.length&&L.every(D=>x.has(D))&&w.push(O)}return w},_S=()=>ut(Ve(r)).filter(x=>x.kind==="edge-crosses-shape").length,ES=x=>{const w=(x.children??[]).filter(Ni);let S=0;for(let O=0;O<w.length;O++)for(let B=O+1;B<w.length;B++){const P=w[O],N=w[B];P.x<N.x+N.width&&P.x+P.width>N.x&&P.y<N.y+N.height&&P.y+P.height>N.y&&S++}return S},Er=()=>{const x=Ve(r),w=S=>S.length>=2&&(S.every(O=>Math.abs(O.x-S[0].x)<.01)||S.every(O=>Math.abs(O.y-S[0].y)<.01));return{messages:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length,lines:x.edges.filter(S=>w(S.waypoints)).length}},SS=x=>{const w=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const B=O;if(!B.waypoints||B.waypoints.length!==2)continue;const P=B.source,N=B.target;if(!P||!N)continue;const L=x.has(P.id);if(L===x.has(N.id))continue;const D=L?N:P,H=h(D);if(!H||x.has(D.id))continue;const j=w.get(H.id);j?D.x<j.minX&&(j.minX=D.x):w.set(H.id,{pool:H,minX:D.x})}const S=[];for(const{pool:O,minX:B}of w.values()){const P=(O.children??[]).filter(N=>Ni(N)&&!x.has(N.id)&&N.x>=B);P.length&&S.push({subtree:P,pool:O})}return S},DF=(x,w,S)=>{const O=new Map(w.map(N=>[N.pool.id,{subtree:[...N.subtree],pool:N.pool}])),B=new Set(x);for(const N of w)for(const L of N.subtree)B.add(L.id);let P=!1;for(;;){let N=0;for(const L of SS(B)){if(L.pool===S)continue;const D=O.get(L.pool.id);D?D.subtree.push(...L.subtree):O.set(L.pool.id,{subtree:[...L.subtree],pool:L.pool});for(const H of L.subtree)B.add(H.id);N+=L.subtree.length}if(!N)break;P=!0}return P?[...O.values()]:null},LF=(x,w)=>{const S=new Map;for(const B of r.getAll()){if(B.type!=="bpmn:DataInputAssociation"&&B.type!=="bpmn:DataOutputAssociation")continue;const P=B,N=P.waypoints;if(!N||N.length<2||!N.every(ue=>Math.abs(ue.x-N[0].x)<1))continue;const L=P.source,D=P.target;if(!L||!D)continue;const H=x.has(L.id);if(H===x.has(D.id))continue;const j=H?D:L,Z=h(j);if(!Z||Z===w||Z===h(H?L:D))continue;const ie=S.get(Z.id);ie?j.x<ie.minX&&(ie.minX=j.x):S.set(Z.id,{pool:Z,minX:j.x})}const O=[];for(const{pool:B,minX:P}of S.values()){const N=(B.children??[]).filter(L=>Ni(L)&&!x.has(L.id)&&L.x>=P);N.length&&O.push({subtree:N,pool:B})}return O},RS=x=>{const w=Ve(r),S=w.shapes.filter(B=>x.has(B.id)),O=new Set;for(const B of w.edges)if(!(B.type!=="bpmn:SequenceFlow"&&B.type!=="bpmn:MessageFlow"))for(const P of Pt(B,S))O.add(`${B.id}|${P.id}`);return O},Xg=new Map,IF=jt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const w=F.get(x.id);return w?[{id:x.id,target:w.flow.target,source:w.flow.source}]:[]});for(const x of IF){if(x.target===void 0)continue;const w=T.get(x.target);if(!w)continue;const S=f(x.target),O=f(x.id);if(!S||!O)continue;const B=x.source!==void 0?f(x.source):O.source,P=O.target;if(!B||!P||P.id===S.id)continue;const N=gS.get(O.id)??{waypoints:O.waypoints,label:O.label},L=N.waypoints&&N.waypoints.length>=3&&Math.abs(N.waypoints[0].x-N.waypoints[1].x)<1&&Math.abs(N.waypoints[0].y-N.waypoints[1].y)>1?{x:N.waypoints[0].x,y:N.waypoints[0].y}:void 0,D=L?N.waypoints[1].y:void 0,H=L&&N.label?{x:N.label.x,y:N.label.y}:void 0,j=H&&N.label&&Math.abs(H.y+N.label.height/2-D)<=he/5&&H.x+N.label.width>L.x?H.x+N.label.width+6:void 0,Z=(B.outgoing??[]).filter(De=>De.type==="bpmn:SequenceFlow"&&De.id!==O.id&&De.target&&!Ac.has(De.id)),ie=new Set(Z.map(De=>De.target.id)),ue=De=>{const Ct={type:"bpmn:Task",x:De.x+2,y:De.y+2,width:De.width-4,height:De.height-4};return Z.find(vt=>(vt.waypoints??[]).some((Xt,je)=>!!vt.waypoints[je+1]&&Go(Xt,vt.waypoints[je+1],Ct)===0))},se=_r(x.target),oe=new Set(se.map(De=>De.id)),ve=Vg.has(x.target)?{autoResize:!1}:void 0,ye=Math.min(...se.map(De=>De.x)),te=Math.max(...se.map(De=>De.x+De.width)),J=B.x+B.width,ae=P.x+P.width<=B.x,Q=(()=>{if(!ae)return;const De=h(S),Ct=((De==null?void 0:De.children)??[]).filter(Ge=>Ni(Ge)&&!oe.has(Ge.id)&&Ge.type!=="bpmn:Group"&&Ge.type!=="bpmn:Participant"),vt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Xt=r.getAll().filter(Ge=>{if(!vt.includes(Ge.type))return!1;const $t=Ge;return $t.id===O.id||Ac.has($t.id)||!$t.waypoints||$t.waypoints.length<2?!1:![$t.source,$t.target].some(Ot=>!Ot||oe.has(Ot.id))}),je=(Ge,$t)=>se.every(Ot=>{var ra;const _t={id:Ot.id,type:Ot.type,x:Ot.x+Ge,y:Ot.y+$t,width:Ot.width,height:Ot.height};return De&&(_t.x<De.x||_t.x+_t.width>De.x+De.width||_t.y<De.y||_t.y+_t.height>De.y+De.height)||!Sp((ra=T.get(Ot.id))==null?void 0:ra.node.lane,Ot,Ot.y+$t+Ot.height/2)||Ct.some(Xn=>_t.x<Xn.x+Xn.width+Ii&&_t.x+_t.width+Ii>Xn.x&&_t.y<Xn.y+Xn.height+Ii&&_t.y+_t.height+Ii>Xn.y)?!1:Xt.every(Xn=>{for(let go=0;go+1<Xn.waypoints.length;go++)if(Go(Xn.waypoints[go],Xn.waypoints[go+1],_t)<Ii)return!1;return!0})}),Xe=B.x+B.width/2,mt=B.y+B.height/2,it=N.waypoints??[],Tt=it.length>=2&&Math.abs(it[0].y-it[1].y)<1&&it[1].x<it[0].x;return[...D!==void 0?[{cx:Xe,cy:D}]:[],...Tt?[{cx:B.x-wr-S.width/2,cy:it[0].y}]:[],{cx:Xe,cy:mt+he},{cx:Xe,cy:mt-he}].find(Ge=>je(Ge.cx-(S.x+S.width/2),Ge.cy-(S.y+S.height/2)))})(),ge=ae&&!Q?J:P.x,$e=(()=>{var mt;if(L||ae)return 0;const De=N.label,Ct=((mt=O.businessObject)==null?void 0:mt.name)??"";if(!De||De.width==null||!Ct.trim())return 0;const vt=J+wr,Xt=B.y+B.height/2-S.height/2;if(Math.min(De.y+De.height,Xt+S.height)-Math.max(De.y,Xt)<3||De.x+De.width-vt<3)return 0;const Xe=De.x+De.width+MF-vt;return Xe<=S.width?Xe:0})();$e>0&&u.add(O.id);const Oe=S.y+S.height/2,Ze=AF(se,J+wr+$e-ye,[0,B.y+B.height/2-Oe,P.y+P.height/2-Oe],ge,J,B.y+B.height/2),Ae=J+wr+$e+Ze,Te=(()=>{if(j===void 0)return 0;const De=J+wr,Ct=B.y+B.height/2-S.height/2,vt={x:De,y:Ct,width:te-ye,height:S.height},Xt=h(B);return((Xt==null?void 0:Xt.children)??[]).some(Xe=>Ni(Xe)&&!oe.has(Xe.id)&&Xe.id!==B.id&&Xe.id!==P.id&&Xe.type!=="bpmn:Group"&&Xe.type!=="bpmn:Participant"&&Xe.x<vt.x+vt.width&&Xe.x+Xe.width>vt.x&&Xe.y<vt.y+vt.height&&Xe.y+Xe.height>vt.y)||ue(vt)?Math.max(0,j-De):0})(),Ce=Q?0:te-ye+wr*2+Ze+Te+$e-(ae?0:P.x-J);let Pe=[];if(Ce>0){const De=h(S),Ct=(De==null?void 0:De.children)??[],vt=it=>it.type==="bpmn:Lane";Pe=(()=>{const it=new Set;for(const qe of Ct)Ni(qe)&&!oe.has(qe.id)&&qe.id!==B.id&&qe.x>=ge&&it.add(qe.id);const Tt=[];for(const qe of Ct){if(qe.type!=="bpmn:DataStoreReference"&&qe.type!=="bpmn:DataObjectReference")continue;const Ge=qe,Ot=[...Ge.incoming??[],...Ge.outgoing??[]].filter(_t=>_t.type==="bpmn:DataInputAssociation"||_t.type==="bpmn:DataOutputAssociation").map(_t=>_t.source===Ge?_t.target:_t.source);Ot.length&&Ot.every(_t=>_t!==void 0&&it.has(_t.id))&&Tt.push(Ge)}return Tt})();const je=Ct.filter(it=>!("waypoints"in it&&it.waypoints)&&!vt(it)&&it.type!=="label"&&!oe.has(it.id)&&it.id!==B.id&&it.x>=ge),Xe=je.flatMap(it=>it.labels??[]),mt=De?[De,...Ct.filter(it=>vt(it))]:[];if(je.length){const it=new Set(je.map(rt=>rt.id)),Tt=SS(it),qe=Tt.length?DF(it,Tt,De):null,Ge=rt=>{const Et=new Set(it);for(const Ft of rt)for(const Io of Ft.subtree)Et.add(Io.id);return OF(Et)},$t=Ge(Tt),Ot=qe?Ge(qe):$t,_t=Kg(it),ra=new Set(it);for(const rt of Tt)for(const Et of rt.subtree)ra.add(Et.id);const Xn=Tt.length?Kg(ra):_t,go=(()=>{if(!qe)return[];const rt=new Set(it);for(const Et of qe)for(const Ft of Et.subtree)rt.add(Ft.id);return Kg(rt)})(),as=qe??Tt,aa=(()=>{const rt=new Set(it);for(const Et of as)for(const Ft of Et.subtree)rt.add(Ft.id);return LF(rt,De)})(),am=aa.length?Ge([...as,...aa]):$t,qi=new Set([...je,...mt].map(rt=>rt.id)),bt=Ct.filter(rt=>{const Et=rt.labelTarget;return rt.type==="label"&&!!Et&&"waypoints"in Et&&!!Et.source&&!!Et.target&&qi.has(Et.source.id)&&qi.has(Et.target.id)}),Cn=PF();n.createSpace([...je,...Xe,...bt],mt,{x:Ce,y:0},"e",ge-1);const Zt=(rt,Et,Ft)=>{const Io=Er(),Op=Ft?RS(Ft):null,Dp=ns(rt,Ce,!!Ft);if(!Dp)return!1;const Oc=Et.length?vS(Et,Ce):null,Lp=Er(),Jt=!!Ft&&!!Op&&[...RS(Ft)].some(ca=>!Op.has(ca));return Lp.messages>Io.messages&&Lp.lines>=Io.lines&&!Jt?!0:(Oc==null||Oc(),Dp(),!1)},gi=aa.length>0&&Zt([...as,...aa],qe?go:Xn,new Set(aa.flatMap(rt=>rt.subtree.map(Et=>Et.id)))),sa=!gi&&qe?Zt(qe,go):!1;let mo=gi||sa;!mo&&Tt.length&&(mo=Zt(Tt,Xn));const ss=gi?am:sa?Ot:$t;if(!mo){for(const rt of Tt){const Et=Er(),Ft=ns([rt],Ce);if(!Ft)continue;const Io=Er();(Io.messages<=Et.messages||Io.lines<Et.lines)&&Ft()}if(_t.length){const rt=Er(),Et=vS(_t,Ce);if(Et){const Ft=Er();(Ft.messages<=rt.messages||Ft.lines<rt.lines)&&Et()}}}if(kF(Cn),ss.length){const rt=()=>new Set(ut(Ve(r)).map(Ft=>ct(Ft))),Et=Ft=>{const Io=wS(),Op=rt(),Dp=Ft.map(Jt=>({a:Jt,x:Jt.x,y:Jt.y})),Oc=r.filter(Jt=>Jt.type==="label").map(Jt=>({label:Jt,x:Jt.x,y:Jt.y}));n.moveElements(Ft,{x:Ce,y:0});const Lp=[...rt()].filter(Jt=>!Op.has(Jt));if(wS()<Io&&Lp.length===0)return!0;for(const{a:Jt,x:ca,y:Dc}of Dp)(Jt.x!==ca||Jt.y!==Dc)&&n.moveElements([Jt],{x:ca-Jt.x,y:Dc-Jt.y});for(const Jt of Oc){const ca=Jt.x-Jt.label.x,Dc=Jt.y-Jt.label.y;(ca!==0||Dc!==0)&&n.moveElements([Jt.label],{x:ca,y:Dc})}return!1};if(!Et(ss)&&ss.length>1)for(const Ft of ss)Et([Ft])}}}const fe=w.node.lane!==void 0?f(w.node.lane):w.node.participant!==void 0?f(w.node.participant):void 0,Me=De=>{if(!fe)return!0;const Ct=De.y+De.height/2;return Ct>=fe.y&&Ct<=fe.y+fe.height},ke=!Me(B)&&Me(P),Fe=De=>De.y+De.height/2,wt=()=>{const De=B.x+B.width,Ct=P.x,vt=Fe(P)-S.height/2,Xt=Fe(P)+S.height/2;return!r.getAll().some(je=>Ni(je)&&je.type!=="bpmn:Participant"&&je.type!=="bpmn:Group"&&je.type!=="bpmn:TextAnnotation"&&je.id!==B.id&&je.id!==P.id&&je.id!==S.id&&je.x<Ct&&je.x+je.width>De&&je.y<Xt&&je.y+je.height>vt)},an=!ke&&w.band!==void 0&&Me(P)&&!Wi(w.node.lane,w.node.participant,w.band,Fe(B))&&Wi(w.node.lane,w.node.participant,w.band,Fe(P))&&P.x>=B.x+B.width&&wt(),Yt=ke||an?P:B,Kt=Yt.y+Yt.height/2,jn=Kt-(S.y+S.height/2),_n=w.band!==void 0,kp=_n?[S]:se,rm=(w.band===void 0||Wi(w.node.lane,w.node.participant,w.band,Kt))&&xt(x.target)&&kp.every(De=>{var Ct;return Sp((Ct=T.get(De.id))==null?void 0:Ct.node.lane,De,De.y+De.height/2+jn)}),n6=De=>Math.abs(De.y+De.height/2-(S.y+S.height/2))<=he/2;if(rm&&_n){const De=Math.abs(jn)<=he/2?se.filter(je=>je.id!==S.id&&n6(je)):[],Ct=S.y+S.height/2,Xt=w.band!==void 0&&!Wi(w.node.lane,w.node.participant,w.band,Ct)?se.filter(je=>{var Xe,mt;return je.id!==S.id&&!De.includes(je)&&((Xe=T.get(je.id))==null?void 0:Xe.band)===w.band&&((mt=T.get(je.id))==null?void 0:mt.node.lane)===w.node.lane&&(Math.abs(je.y+je.height/2-Ct)<=he/2||Wi(w.node.lane,w.node.participant,w.band,je.y+je.height/2))}).map(je=>({t:je,dy:Kt-(je.y+je.height/2)})).filter(({dy:je})=>je!==0):[];if(n.moveElements(se,{x:Ae-ye,y:0},void 0,ve),n.moveElements([S],{x:0,y:jn},void 0,ve),De.length){const je=()=>new Set(ut(Ve(r)).map(Ge=>ct(Ge))),Xe=je(),mt=r.filter(Ge=>Ge.type==="label").map(Ge=>({label:Ge,x:Ge.x,y:Ge.y}));n.moveElements(De,{x:0,y:jn});const it=je(),Tt=[...it].filter(Ge=>!Xe.has(Ge)).length,qe=[...Xe].filter(Ge=>!it.has(Ge)).length;if(Tt>qe){n.moveElements(De,{x:0,y:-jn});for(const Ge of mt){const $t=Ge.x-Ge.label.x,Ot=Ge.y-Ge.label.y;($t!==0||Ot!==0)&&n.moveElements([Ge.label],{x:$t,y:Ot})}}}if(Xt.length){const je=new Set(se.map(Xe=>Xe.id));for(const{t:Xe,dy:mt}of Xt)R(Xe.parent,Xe,Xe.x+Xe.width/2,Xe.y+Xe.height/2+mt,je)||n.moveElements([Xe],{x:0,y:mt})}}else n.moveElements(se,{x:Ae-ye,y:rm?jn:0},void 0,ve);const Ui=h(S);if(!rm&&w.node.lane===void 0&&w.band!==void 0&&Ui){const De=Ui.y+le+on(`pool:${w.node.participant??""}`,w.band)*he,Ct=De-(S.y+S.height/2);Ct!==0&&!R(Ui,S,S.x+S.width/2,De,oe)&&n.moveElements([S],{x:0,y:Ct},void 0,ve)}if(Q)n.moveElements(se,{x:Q.cx-(S.x+S.width/2),y:Q.cy-(S.y+S.height/2)},void 0,ve);else if(Ui){const De=(Ui.children??[]).filter(je=>Ni(je)&&!oe.has(je.id)&&je.type!=="bpmn:Group"&&je.type!=="bpmn:Participant"),Ct=(je,Xe,mt,it,Tt)=>je.x+Xe<Tt.x+Tt.width+it&&je.x+Xe+je.width+it>Tt.x&&je.y+mt<Tt.y+Tt.height+it&&je.y+mt+je.height+it>Tt.y,vt=De.find(je=>Ct(S,0,0,0,je)),Xt=vt?void 0:ue(S);if(vt||Xt){const je=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Xe=r.getAll().filter(bt=>{if(!je.includes(bt.type))return!1;const Cn=bt;return Ac.has(Cn.id)||!Cn.waypoints||Cn.waypoints.length<2?!1:![Cn.source,Cn.target].some(Zt=>!Zt||oe.has(Zt.id))}),mt=(bt,Cn,Zt)=>{var gi;return Sp((gi=T.get(bt.id))==null?void 0:gi.node.lane,bt,bt.y+Zt+bt.height/2)&&bt.x+Cn>=Ui.x&&bt.x+Cn+bt.width<=Ui.x+Ui.width&&bt.y+Zt>=Ui.y&&bt.y+Zt+bt.height<=Ui.y+Ui.height},it=(bt,Cn)=>se.every(Zt=>mt(Zt,bt,Cn)&&!De.some(gi=>Ct(Zt,bt,Cn,Ii,gi))&&Xe.every(gi=>{const sa={id:Zt.id,type:Zt.type,x:Zt.x+bt,y:Zt.y+Cn,width:Zt.width,height:Zt.height};for(let mo=0;mo+1<gi.waypoints.length;mo++)if(Go(gi.waypoints[mo],gi.waypoints[mo+1],sa)<Ii)return!1;return!0})),Tt=S.y+S.height/2,qe=[D,P.y+P.height/2].filter(bt=>bt!==void 0&&Math.abs(bt-Tt)>=1),Ge=vt&&ie.has(vt.id)?vt:Xt==null?void 0:Xt.target,$t=Ge?Ge.x-S.x:0,Ot=Math.max(...se.map(bt=>bt.x+bt.width)),_t=[...$t!==0?[$t]:[],...Ze!==0?[-Ze]:[],0],ra=j===void 0?[]:_t.map(bt=>Math.max(bt,j-S.x)),Xn=bt=>Ot+bt+wr<=P.x,go=[...new Set([...ra,..._t])].filter(Xn),as=vt&&ie.has(vt.id)?[vt.x+vt.width+wr-S.x]:[],aa=j===void 0?[]:as.map(bt=>Math.max(bt,j-S.x)),am=[...new Set([...aa,...as])].filter(bt=>Xn(bt)&&!go.includes(bt));let qi;for(const bt of[go,am]){for(const Cn of qe){for(const Zt of bt)if(it(Zt,Cn-Tt)){qi={dx:Zt,dy:Cn-Tt};break}if(qi)break}if(qi)break}if(qi){const bt=rt=>{const Et=rt;return[Et.edge,Et.other,...Array.isArray(Et.edges)?Et.edges:[]].some(Ft=>typeof Ft=="string"&&Ac.has(Ft))},Cn=()=>new Set(ut(Ve(r)).filter(rt=>!bt(rt)).map(rt=>ct(rt))),Zt=Cn(),gi=r.filter(rt=>rt.type==="label").map(rt=>({label:rt,x:rt.x,y:rt.y}));n.moveElements(se,{x:qi.dx,y:qi.dy},void 0,ve);const sa=Cn(),mo=[...sa].filter(rt=>!Zt.has(rt)).length,ss=[...Zt].filter(rt=>!sa.has(rt)).length;if(mo>ss){n.moveElements(se,{x:-qi.dx,y:-qi.dy},void 0,ve);for(const rt of gi){const Et=rt.x-rt.label.x,Ft=rt.y-rt.label.y;(Et!==0||Ft!==0)&&n.moveElements([rt.label],{x:Et,y:Ft})}}else L&&Xg.set(O.id,{exit:L,channelY:D,label:H})}}}{const De=new Set(se.map(Xe=>Xe.id)),Ct=new Set(G.map(Xe=>Xe.flow.id)),vt=20,Xt=Xe=>{const mt=Xe.source,it=Xe.target,Tt=Math.min(mt.x,it.x)-vt,qe=Math.max(mt.x+mt.width,it.x+it.width)+vt,Ge=Math.min(mt.y,it.y)-vt,$t=Math.max(mt.y+mt.height,it.y+it.height)+vt;return Xe.waypoints.some(Ot=>Ot.x<Tt||Ot.x>qe||Ot.y<Ge||Ot.y>$t)},je=new Map;for(const Xe of se)for(const mt of[...Xe.incoming??[],...Xe.outgoing??[]])(F.has(mt.id)||mt.id!==x.id&&Ct.has(mt.id))&&!(De.has(mt.source.id)&&De.has(mt.target.id))&&je.set(mt.id,mt);for(const Xe of je.values())Xt(Xe)&&Mp(Xe)}const ho=Pe.length?h(Pe[0]):void 0;if(ho){const De={assoc:bS(),overlaps:ES(ho),crosses:_S()},Ct=Pe.map(qe=>({st:qe,x:qe.x})),vt=r.filter(qe=>qe.type==="label").map(qe=>({label:qe,x:qe.x,y:qe.y})),Xt=Math.min(...Pe.flatMap(qe=>[...qe.incoming??[],...qe.outgoing??[]].filter(Ge=>Ge.type==="bpmn:DataInputAssociation"||Ge.type==="bpmn:DataOutputAssociation").map(Ge=>(Ge.source===qe?Ge.target:Ge.source).x))),je=new Set(Pe.map(qe=>qe.id)),Xe=(ho.children??[]).filter(Ni).filter(qe=>!je.has(qe.id));let mt=Xt;for(const qe of[...Pe].sort((Ge,$t)=>Ge.x-$t.x)){let Ge=mt;for(let $t=0;$t<100;$t++){const Ot=Xe.find(_t=>Ge<_t.x+_t.width+Bi&&Ge+qe.width+Bi>_t.x&&qe.y<_t.y+_t.height&&qe.y+qe.height>_t.y);if(!Ot)break;Ge=Ot.x+Ot.width+Bi}Ge!==qe.x&&n.moveElements([qe],{x:Ge-qe.x,y:0}),mt=Ge+qe.width+Bi}const it=mt+150-(ho.x+ho.width);it>0&&ts(ho,ho.width+it);const Tt={assoc:bS(),overlaps:ES(ho),crosses:_S()};if(Tt.assoc>=De.assoc||Tt.overlaps>De.overlaps||Tt.crosses>De.crosses){for(const{st:qe,x:Ge}of Ct)qe.x!==Ge&&n.moveElements([qe],{x:Ge-qe.x,y:0});it>0&&ts(ho,ho.width-it);for(const qe of vt){const Ge=qe.x-qe.label.x,$t=qe.y-qe.label.y;(Ge!==0||$t!==0)&&n.moveElements([qe.label],{x:Ge,y:$t})}}}}for(const[x,w]of Vg){const S=f(x);if(!S)continue;const O=w.container,B=Math.abs(S.y+S.height/2-O.y-w.relCy)>=.5,P=S.label,N=Math.min(S.y,P&&!P.hidden?P.y:S.y),L=Math.max(S.y+S.height,P&&!P.hidden?P.y+P.height:0);if(B&&N>=O.y&&L<=O.y+O.height)continue;const D=S.y;w.grow(),S.y!==D&&n.moveElements([S],{x:0,y:D-S.y},void 0,{autoResize:!1})}const CS=(x,w)=>{const S=w.target===x,O=g(w.source),B=g(w.target),P=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,B,w.id?{type:P,businessObject:i.create(P,{id:w.id})}:{type:P})},MS=x=>{for(const w of _){if(!w.participant.blackBox)continue;const S=f(w.participant.id);if(!S)continue;const O=[];for(const P of b){const N=P.flow.source===w.participant.id?P.flow.target:P.flow.target===w.participant.id?P.flow.source:void 0,L=N?f(N):void 0;L&&typeof L.x=="number"&&L.type!=="bpmn:Participant"&&O.push(L)}if(!O.length)continue;if(!x&&w.order===void 0){const P=(()=>{var L;const N=new Map;for(const D of O){const H=h(D);if(!H)continue;const j=N.get(H.id);j?j.n+=1:N.set(H.id,{shape:H,n:1})}return(L=[...N.values()].sort((D,H)=>H.n-D.n)[0])==null?void 0:L.shape})();if(P){const N=H=>H.reduce((j,Z)=>j+Z,0)/H.length,L=N(O.map(H=>H.y+H.height/2))<P.y+P.height/2,D=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==w.participant.id&&H.id!==P.id).filter(H=>L?H.y+H.height<=P.y+5:H.y>=P.y+P.height-5);if(D.length){const H=[...D.reduce((ae,Q)=>ae.set(Q.y,(ae.get(Q.y)??0)+1),new Map)].sort((ae,Q)=>Q[1]-ae[1]||(L?Q[0]-ae[0]:ae[0]-Q[0]))[0][0],j=Math.min(S.width,XA),Z=ZA,ie=O.map(ae=>ae.x+ae.width/2),ue=Math.round(N(ie)-j/2),se=Math.max(...ie)+Od,oe=ae=>({x:ae,width:Math.max(j,se-ae)}),ve=D.filter(ae=>Math.min(ae.y+ae.height,H+Z)-Math.max(ae.y,H)>0),ye=ae=>{const Q=oe(ae);return ve.some(ge=>ge.x<Q.x+Q.width&&Q.x<ge.x+ge.width)},te=ae=>{const Q=oe(ae);return ie.filter(ge=>ge>=Q.x+10&&ge<=Q.x+Q.width-10).length},J=(()=>{if(!ye(ue))return ue;const ae=te(ue);return ve.flatMap(Q=>[Q.x+Q.width+sv,Q.x-sv-j]).map(Q=>Math.round(Q)).filter(Q=>!ye(Q)&&te(Q)>=ae).sort((Q,ge)=>Math.abs(Q-ue)-Math.abs(ge-ue))[0]??ue})();if(J!==S.x||H!==S.y||j!==S.width||Z!==S.height){const ae=()=>new Set(ut(Ve(r)).map(Ae=>ct(Ae))),Q=ae(),ge={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:J,y:H,width:j,height:Z});const $e=ae(),Oe=[...$e].filter(Ae=>!Q.has(Ae)).length,Ze=[...Q].filter(Ae=>!$e.has(Ae)).length;Oe>Ze&&n.resizeShape(S,ge)}}}}const B=Math.max(...O.map(P=>P.x+P.width/2))+Od;if(B>S.x+S.width&&n.resizeShape(S,{x:S.x,y:S.y,width:B-S.x,height:S.height}),!!x)for(const P of b){const N=f(P.flow.id),L=P.flow.source===w.participant.id?P.flow.target:P.flow.target===w.participant.id?P.flow.source:void 0,D=L?f(L):void 0;if(!N||!D||D.type==="bpmn:Participant")continue;const H=D.x+D.width/2;H<S.x+10||H>S.x+S.width-10||xS(N,S,D)}}};MS(!1);for(const x of b){const w=x.flow;n.connect(g(w.source),g(w.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:w.id,name:w.name})})}{const S=new Set([...G.map(D=>D.flow.id),...b.map(D=>D.flow.id)].filter(D=>!!D)),O=r.filter(D=>!!D.waypoints),B=(D,H)=>Math.abs(H.x-D.x)<2?"L":Math.abs(H.x-(D.x+D.width))<2?"R":Math.abs(H.y-D.y)<2?"T":Math.abs(H.y-(D.y+D.height))<2?"B":void 0,P=new Map,N=(D,H,j)=>{if(!D||!H||typeof D.x!="number")return;const Z=B(D,H);if(!Z)return;let ie=P.get(D.id);ie||P.set(D.id,ie=new Map),ie.set(Z,[...ie.get(Z)??[],j])};for(const D of O){const H=D.waypoints;!H||H.length<2||(N(D.source,H[0],{id:D.id,dir:"out"}),N(D.target,H[H.length-1],{id:D.id,dir:"in"}))}const L=new Set;for(const[D,H]of P){const j=f(D);if(!j||typeof j.x!="number")continue;const Z=te=>{var ae;const J=(ae=f(te.id))==null?void 0:ae.source;return!!J&&typeof J.x=="number"&&J.x+J.width/2>j.x+j.width/2};if(![...H.values()].some(te=>te.length>=3&&te.some(J=>J.dir==="out")&&te.some(J=>J.dir==="in"&&S.has(J.id)&&Z(J))))continue;const ue=h(j);if(!ue||L.has(ue.id)||(ue.children??[]).some(te=>te.type==="bpmn:Lane"))continue;const se=(XS=H.get("T"))!=null&&XS.length?(ZS=H.get("B"))!=null&&ZS.length?void 0:"B":"T";if(!se||(se==="T"?j.y-ue.y:ue.y+ue.height-(j.y+j.height))>=he)continue;const ve=(ue.children??[]).filter(te=>!("waypoints"in te&&te.waypoints)&&te.type!=="label"&&typeof te.x=="number"),ye=ue.y+ue.height;n.resizeShape(ue,{x:ue.x,y:ue.y,width:ue.width,height:ue.height+he}),Un(ye,ue.id,he),se==="T"&&ve.length&&n.moveElements(ve,{x:0,y:he}),L.add(ue.id)}}const Zg=20,AS=4,BF=3,NF=2,$F=2,FF=[10,30,80],na=()=>{const x=Ve(r);return{bad:ut(x).filter(w=>w.kind==="edge-crosses-shape"||w.kind==="edge-overlap-opposite"||w.kind==="edge-overlap-mixed").length,crossings:ey(x),straight:x.edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.waypoints.length===2).length}},Sr=x=>{const w=Ve(r),S=w.edges.find(O=>O.id===x);return S?Pt(S,kn(w)).length:0},Tc=x=>Sr(x)>0,is=x=>Ve(r).edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.id!==x&&w.waypoints.length===2).length,TS=(x,w,S)=>ns([{subtree:x,pool:w}],S),PS=(x,w)=>w.bad>x.bad||w.crossings>x.crossings&&w.straight<=x.straight&&w.bad>=x.bad,os=(x,w)=>PS(x,w)||w.straight<x.straight,Rr=(x,w,S=()=>!0,O=PS,B=!1)=>{const P=na(),N=ns(x,w,B);if(!N)return!1;const L=na();return O(P,L)||!S()?(N(),!1):!0},jF=(x,w,S,O=()=>!0)=>Rr([{subtree:x,pool:w}],S,O),ia=x=>{var w;return!!((w=T.get(x))!=null&&w.node.participant)},rs=new Map;for(const x of b){if(!ia(x.flow.target))continue;const w=rs.get(x.flow.target)??[];w.push(x),rs.set(x.flow.target,w)}const Pc=[...rs.keys()],Jg=new Set(G.map(x=>x.flow.target)),kS=x=>Rp.findIndex(({op:w})=>w.participant.id===x);Pc.sort((x,w)=>{var B,P;const S=Jg.has(x)?1:0,O=Jg.has(w)?1:0;return S!==O?S-O:kS((B=T.get(x))==null?void 0:B.node.participant)-kS((P=T.get(w))==null?void 0:P.node.participant)});const Cr=x=>x.x+x.width/2,HF=x=>{const w=new Map;for(const B of r.getAll()){const P=B;if(!P.waypoints||!P.source||!P.target)continue;(w.get(P.source.id)??w.set(P.source.id,[]).get(P.source.id)).push(P.target.id)}const S=new Set([x]),O=[x];for(let B=0;B<O.length;B++)for(const P of w.get(O[B])??[])S.has(P)||(S.add(P),O.push(P));return S},zF=(x,w)=>{const S=HF(w);let O;for(const B of r.getAll()){const P=B;if(P.type!=="bpmn:MessageFlow"||!P.source||!P.target||P.target.id!==x||S.has(P.source.id))continue;const N=P.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const L=Cr(N);(O===void 0||L>O)&&(O=L)}return O},Qg=(x,w)=>{const S=f(x.flow.source);if(S)return S.type==="bpmn:Participant"?zF(S.id,w):Cr(S)},OS=x=>{let w;for(const S of rs.get(x)??[]){const O=Qg(S,x);O!==void 0&&(!w||O>w.cx)&&(w={op:S,cx:O})}return w==null?void 0:w.op},GF=x=>{const w=OS(x),S=f(x),O=w?Qg(w,x):void 0;return S&&O!==void 0?O-Cr(S):void 0},VF=x=>{const w=GF(x);return w!==void 0&&Math.abs(w)<Zg},Ap=(x,w,S,O,B)=>{var P;for(let N=!0;N;){N=!1;for(const L of b){if(L.flow.id===S)continue;const D=w.has(L.flow.source),H=w.has(L.flow.target);if(D===H||O(D?L.flow.source:L.flow.target))continue;const j=D?L.flow.target:L.flow.source;if(B(j)||!ia(j))continue;const Z=f(L.flow.id);if(!(Z!=null&&Z.waypoints)||Z.waypoints.length!==2)continue;const ie=f(j),ue=(P=T.get(j))==null?void 0:P.node.participant;if(!ie||!ue)continue;const se=_r(j,oe=>oe.x>=ie.x).filter(oe=>!w.has(oe.id));if(!(!se.length||se.some(oe=>B(oe.id)))){for(const oe of se)w.add(oe.id);x.set(ue,[...x.get(ue)??[],...se]),N=!0}}}return[...x].map(([N,L])=>({subtree:L,pool:g(N)}))},DS=(x,w,S,O,B)=>Ap(new Map([[w,[...x]]]),new Set(x.map(P=>P.id)),O,P=>P===S,P=>P===B),em=x=>{const w=OS(x);if(!w)return null;const S=f(x),O=f(w.flow.source),B=Qg(w,x);if(!S||!O||B===void 0)return null;const P=B-Cr(S);if(P>=Zg){const N=T.get(x).node.participant,L=_r(x,D=>D.x>=S.x);return{groups:DS(L,N,x,w.flow.id,w.flow.source),dx:P}}if(-P>=Zg&&ia(w.flow.source)){const N=T.get(w.flow.source).node.participant,L=_r(w.flow.source,D=>D.x>=O.x&&!VF(D.id));return{groups:DS(L,N,w.flow.source,w.flow.id,x),dx:-P}}return null},LS=()=>Pc.map(x=>({id:x,plan:em(x)})).filter(x=>!!x.plan).sort((x,w)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))-Math.min(...w.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))).map(x=>x.id);for(let x=0;x<3;x++){const w=na(),S=[];for(const B of LS()){const P=em(B);if(!P)continue;const N=ns(P.groups,P.dx);N&&S.push(N)}if(!S.length)break;if(!os(w,na()))continue;for(const B of S.reverse())B();let O=!1;for(const B of LS()){const P=em(B);P&&Rr(P.groups,P.dx,()=>!0,os)&&(O=!0)}if(!O)break}for(const x of Pc){if(Jg.has(x))continue;const w=T.get(x);if(!w||w.node.lane!==void 0)continue;const S=Ke(w);if(S===void 0)continue;const O=f(x),B=O?h(O):void 0;if(!O||!B)continue;const P=B.y+le+on(`pool:${w.node.participant??""}`,S)*he,N=P-(O.y+O.height/2);N!==0&&!R(B,O,O.x+O.width/2,P)&&n.moveElements([O],{x:0,y:N})}const Tp=()=>{const x=r.filter(O=>O.type==="bpmn:Participant"),w=new Map(x.map(O=>[O.id,O]));let S=0;for(const{pools:[O,B]}of gd(x)){const P=w.get(O),N=w.get(B);S+=(Math.min(P.x+P.width,N.x+N.width)-Math.max(P.x,N.x))*(Math.min(P.y+P.height,N.y+N.height)-Math.max(P.y,N.y))}return S},tm=new Set,IS=new Set;for(let x=0,w=!0;w&&x<BF;x++){w=!1;for(const S of Pc.flatMap(O=>rs.get(O)??[])){if(tm.has(S.flow.id)||!Tc(S.flow.id))continue;const O=f(S.flow.target);if(!O)continue;const B=g(T.get(S.flow.target).node.participant),P=_r(S.flow.target,j=>j.x>=O.x),N=O.width+W,L=Sr(S.flow.id),D=is(S.flow.id),H=Tp();for(let j=1;j<=AS;j++){const Z=()=>Sr(S.flow.id)>=L||Tp()>H?!1:is(S.flow.id)>=D?!0:(IS.add(S.flow.id),!1);if(jF(P,B,N*j,Z)){tm.add(S.flow.id),w=!0;break}}}}const BS=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const w=x.source,S=x.target;return!!w&&!!S&&S.x+S.width<w.x}).length;for(const x of Pc.flatMap(w=>rs.get(w)??[])){if(tm.has(x.flow.id)||!IS.has(x.flow.id)||!Tc(x.flow.id))continue;const w=f(x.flow.target);if(!w)continue;const S=g(T.get(x.flow.target).node.participant),O=_r(x.flow.target,ie=>ie.x>=w.x),B=new Set(O.map(ie=>ie.id)),P=new Map;for(const ie of r.filter(ue=>ue.type==="bpmn:MessageFlow")){if(((JS=ie.waypoints)==null?void 0:JS.length)!==2||!ie.source||!ie.target)continue;const ue=B.has(ie.source.id);if(ue===B.has(ie.target.id))continue;const se=ue?ie.target:ie.source,oe=(QS=T.get(se.id))==null?void 0:QS.node.participant;!oe||P.has(se.id)||P.set(se.id,{subtree:[se],pool:g(oe)})}if(!P.size)continue;const N=w.width+W,L=Sr(x.flow.id),D=is(x.flow.id),H=Tp(),j=BS(),Z=()=>Sr(x.flow.id)<L&&is(x.flow.id)>=D&&Tp()<=H&&BS()<=j;for(let ie=1;ie<=NF&&!Rr([{subtree:O,pool:S},...P.values()],N*ie,Z);ie++);}const nm=b.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),NS=new Set(nm.map(x=>x.id));for(const x of r.filter(w=>w.type==="bpmn:MessageFlow"))NS.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&nm.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of nm){if(!Tc(x.id))continue;const w=f(x.source),S=f(x.target);if(!w||!S)continue;let O,B,P;if(x.preexisting){const[L,D]=w.type==="bpmn:Participant"?[S,w]:[w,S];if(O=Cr(L),O<D.x||O>D.x+D.width)continue;[B,P]=L.y<D.y?[L.y+L.height,D.y]:[D.y+D.height,L.y]}else{if(w.type==="bpmn:Participant"||S.type==="bpmn:Participant"||(O=w.x+w.width/2,Math.abs(O-(S.x+S.width/2))>15))continue;[B,P]=w.y<S.y?[w.y+w.height,S.y]:[S.y+S.height,w.y]}const N=[...T.values()].map(L=>f(L.node.id)).filter(L=>!!L&&L.id!==w.id&&L.id!==S.id).filter(L=>L.x<=O&&O<=L.x+L.width&&L.y+L.height>B&&L.y<P).sort((L,D)=>L.x-D.x);for(const L of N){const D=(eR=T.get(L.id))==null?void 0:eR.node.participant,H=D?f(D):void 0;if(!D||!H)continue;const j=[...T.values()].filter(J=>J.node.participant===D).map(J=>J.node.id),Z=J=>J.map(ae=>f(ae)).filter(ae=>!!ae),ue=[TF(L.id,J=>{var ae;return((ae=T.get(J.id))==null?void 0:ae.node.participant)===D}),Z(j)].filter(J=>J.length).map(J=>[{subtree:J,pool:H}]);if(x.preexisting){const J=Z(j);J.length&&ue.push(Ap(new Map([[D,[...J]]]),new Set(J.map(ae=>ae.id)),x.id,()=>!1,ae=>ae===w.id||ae===S.id))}const se=L.width+W,oe=Sr(x.id),ve=is(x.id),ye=()=>Sr(x.id)<oe&&is(x.id)>=ve;let te=!1;for(const J of ue){for(let ae=1;ae<=AS;ae++)if(Rr(J,se*ae,ye)){te=!0;break}if(te)break}if(!Tc(x.id))break}}const Pp=()=>{var w;const x=new Set;for(const S of ut(Ve(r)))S.kind!=="edge-crosses-shape"||NS.has(S.edge)||((w=f(S.edge))==null?void 0:w.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},WF=(x,w)=>na().bad>=x&&[...Pp()].some(S=>!w.has(S)),$S=x=>{var w,S;return Sr(x)===0&&((S=(w=f(x))==null?void 0:w.waypoints)==null?void 0:S.length)===2},UF=(x,w,S)=>{const O=new Set(x.flatMap(P=>P.subtree.map(N=>N.id))),B=[...Pp()].filter(P=>!S.has(P)).map(P=>P.split(">")[1]);return[...new Set(B)].filter(P=>O.has(P)&&P!==w.source&&P!==w.target)},qF=(x,w,S,O,B)=>{const P=x.map(H=>({...H,subtree:H.subtree.filter(j=>!B.includes(j.id))})).filter(H=>H.subtree.length),N=new Set(P.flatMap(H=>H.subtree.map(j=>j.id))),L=()=>B.every(H=>{const j=f(H);return!!j&&G.filter(Z=>Z.flow.target===H&&N.has(Z.flow.source)).every(Z=>{const ie=f(Z.flow.source);return!!ie&&ie.x+ie.width<=j.x})});return Rr(P,w,()=>$S(S.id)&&[...Pp()].every(H=>O.has(H))&&L(),os,!0)};for(const x of b){if(!Tc(x.flow.id))continue;const w=f(x.flow.id);if(((tR=w==null?void 0:w.waypoints)==null?void 0:tR.length)!==2)continue;const S=f(x.flow.source),O=f(x.flow.target);if(!S||!O||S.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!ia(x.flow.source)||!ia(x.flow.target)||Math.abs(Cr(S)-Cr(O))>$F)continue;const B=Cr(S),P=w.waypoints.map(oe=>oe.y),[N,L]=[Math.min(...P),Math.max(...P)],D=kn(Ve(r)).filter(oe=>oe.id!==S.id&&oe.id!==O.id&&oe.x<B&&B<oe.x+oe.width&&N<oe.y+oe.height&&oe.y<L);if(!D.length)continue;const H=(nR=T.get(x.flow.source))==null?void 0:nR.node.participant,j=(iR=T.get(x.flow.target))==null?void 0:iR.node.participant;if(!H||!j)continue;const Z=new Map;for(const[oe,ve,ye]of[[x.flow.source,S,H],[x.flow.target,O,j]]){const te=Z.get(ye)??[],J=_r(oe,ae=>ae.x>=ve.x).filter(ae=>!te.some(Q=>Q.id===ae.id));Z.set(ye,[...te,...J])}const ie=new Set([...Z.values()].flat().map(oe=>oe.id)),ue=Ap(Z,ie,x.flow.id,oe=>oe===x.flow.source||oe===x.flow.target,()=>!1),se=Math.max(...D.map(oe=>oe.x+oe.width));for(const oe of FF){const ve=se+oe-B;if(ve<=0)continue;const ye=na().bad,te=Pp();let J=[],ae=!0;const Q=()=>!$S(x.flow.id)||ae&&(J=UF(ue,x.flow,te),J.length)?!1:!WF(ye,te);if(Rr(ue,ve,Q,os))break;if(J.length&&(qF(ue,ve,x.flow,te,J)||(ae=!1,Rr(ue,ve,Q,os))))break}}{const x=P=>P.y+P.height/2,w=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const P=Ve(r),N=new Set(ut(P).flatMap(H=>H.kind==="edge-crosses-shape"?[`${H.edge}|${H.shape}`]:[])),L=P.shapes.filter(H=>!H.container&&w.test(H.type)),D=new Set;for(const H of P.edges){if(H.type!=="bpmn:SequenceFlow"&&H.type!=="bpmn:MessageFlow")continue;const j=new Set(H.endpoints);for(const Z of[H.waypoints[0],H.waypoints[H.waypoints.length-1]])for(const ie of L)ie.x-4<=Z.x&&Z.x<=ie.x+ie.width+4&&ie.y-4<=Z.y&&Z.y<=ie.y+ie.height+4&&j.add(ie.id);for(const Z of L)if(!(j.has(Z.id)||N.has(`${H.id}|${Z.id}`))){for(let ie=0;ie+1<H.waypoints.length;ie++)if(Go(H.waypoints[ie],H.waypoints[ie+1],Z)<=Yg){D.add(`${H.id}|${Z.id}`);break}}}return D},O=()=>({...na(),grazes:S()}),B=[];for(const P of T.keys()){if(!ia(P))continue;const N=G.filter(H=>H.flow.target===P);if(N.length!==1)continue;const L=f(N[0].flow.source),D=f(P);!L||!D||!T.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=W+1||B.push({id:P,pred:L,node:D})}B.sort((P,N)=>P.node.x-N.node.x);for(const{id:P}of B){const N=T.get(P),L=f(P),D=f(G.find(J=>J.flow.target===P).flow.source);if(!L||!D)continue;const H=L.x-(D.x+D.width);if(H<=W+1)continue;const j=g(N.node.participant),Z=_r(P,J=>J.x>=L.x),ie=-(H-W),ue=(J,ae)=>ae.bad>J.bad||ae.crossings>=J.crossings||ae.straight<J.straight||[...ae.grazes].some(Q=>!J.grazes.has(Q)),se=Ap(new Map([[N.node.participant,[...Z]]]),new Set(Z.map(J=>J.id)),"",()=>!1,()=>!1),oe=se.some(J=>J.pool!==j)||se.reduce((J,ae)=>J+ae.subtree.length,0)>Z.length,ve=O(),ye=TS(Z,j,ie);if(!ye)continue;const te=O();if(oe&&!ue(ve,te)){ye();const J=ns(se,ie);if(J){const ae=O();if(!ue(ve,ae)&&ae.bad<=te.bad&&ae.crossings<=te.crossings)continue;J()}TS(Z,j,ie);continue}ue(ve,te)&&ye()}}MS(!0);const YF=10,KF=400,XF=x=>[...x.incoming??[],...x.outgoing??[]].filter(w=>w.type==="bpmn:DataInputAssociation"||w.type==="bpmn:DataOutputAssociation").map(w=>w.source===x?w.target:w.source).filter(w=>!!w&&typeof w.y=="number"),ZF=r.filter(x=>x.type==="bpmn:DataStoreReference"&&y.has(x.id)),JF=(x,w)=>{const S=x.x+x.width/2,O=x.y+x.height/2;let B;for(const P of ZF){if((h(P)??d())!==w||P.y<x.y+x.height)continue;const N=Math.abs(P.x+P.width/2-S);N>KF||N<P.width||!XF(P).some(D=>D.height===x.height&&Math.abs(D.y+D.height/2-O)<=YF&&P.y>=D.y+D.height)||(!B||N<B.dx||N===B.dx&&P.id<B.id)&&(B={dx:N,id:P.id,cy:P.y+P.height/2})}return B==null?void 0:B.cy};for(const x of E){const w=x.associations??[],S=w.map(P=>P.source===x.dataStore.id?P.target:P.source).map(f).find(Boolean),O=S?h(S)??d():d(),B=S?{x:S.x+S.width/2,y:JF(S,O)??S.y+S.height+110}:{x:200,y:Cc+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},B,O);for(const P of w)CS(x.dataStore.id,P)}for(const x of C){const S=g(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;CS(S,x.association)}let FS=0;const oa=10,jS=40,QF=(x,w)=>{const S=w.map(D=>h(D)).filter(D=>!!D);for(const D of S){const H=oa,j=D.y,Z=D.y+D.height,ie=D.x,ue=D.x+D.width;if(Math.abs(x.y-j)<H){const se=j+H-x.y;x.y+=se,x.height-=se}if(Math.abs(x.y+x.height-Z)<H&&(x.height=Z-H-x.y),Math.abs(x.x-ie)<H){const se=ie+H-x.x;x.x+=se,x.width-=se}Math.abs(x.x+x.width-ue)<H&&(x.width=ue-H-x.x)}if(!S.length)return;const O=Math.min(...S.map(D=>D.y)),B=Math.max(...S.map(D=>D.y+D.height)),P=O-x.y,N=x.y+x.height-B,L=jS-oa;if(P>0!=N>0)if(P>0&&P<L){const D=P+oa;x.y+=D,x.height-=D}else N>0&&N<L&&(x.height-=N+oa)},e6=(x,w)=>{const S=oa,O=30,B=r.filter(P=>P.type==="bpmn:Group"&&P.id!==w);for(const P of B){const N=P.x,L=P.x+P.width,D=P.y,H=P.y+P.height,j=x.y<H&&D<x.y+x.height,Z=x.x<L&&N<x.x+x.width;if(j){if(Math.abs(x.x-L)<S){const ie=Math.min(L+S-x.x,O);ie>0&&x.width-ie>0&&(x.x+=ie,x.width-=ie)}if(Math.abs(x.x+x.width-N)<S){const ie=Math.min(x.x+x.width-(N-S),O);ie>0&&x.width-ie>0&&(x.width-=ie)}}if(Z){if(Math.abs(x.y-H)<S){const ie=Math.min(H+S-x.y,O);ie>0&&x.height-ie>0&&(x.y+=ie,x.height-=ie)}if(Math.abs(x.y+x.height-D)<S){const ie=Math.min(x.y+x.height-(D-S),O);ie>0&&x.height-ie>0&&(x.height-=ie)}}}},im=(x,w)=>{const S=jS,O=Math.min(...x.map(D=>D.x))-S,B=Math.min(...x.map(D=>D.y))-S,P=Math.max(...x.map(D=>D.x+D.width))+S,N=Math.max(...x.map(D=>D.y+D.height))+S,L={x:O,y:B,width:P-O,height:N-B};return QF(L,x),e6(L,w),L};for(const x of k){const w=(x.group.members??[]).map(f).filter(B=>!!B);let S;w.length?S=im(w,x.group.id):(S={x:300+FS*350,y:40,width:300,height:200},FS++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:S.width,height:S.height},{x:S.x+S.width/2,y:S.y+S.height/2},d());x.group.name&&n.updateLabel(O,x.group.name),(oR=x.group.members)!=null&&oR.length&&K(O,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(B=>!!B.waypoints),w=new Map,S=(B,P)=>{!B||!P||(w.has(B)||w.set(B,new Set),w.get(B).add(P))};for(const B of x){const P=(rR=B.source)==null?void 0:rR.id,N=(aR=B.target)==null?void 0:aR.id;S(P,N),((sR=B.type)!=null&&sR.includes("DataOutputAssociation")||(cR=B.type)!=null&&cR.includes("DataInputAssociation")||B.type==="bpmn:Association")&&S(N,P)}const O=r.filter(B=>B.type==="bpmn:Group");for(const B of O){const N=(((lR=B.businessObject.extensionElements)==null?void 0:lR.values)??[]).find(ye=>ye.$type==="bwl:Members"),L=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!L.length)continue;const D=new Set(L),H=[...L];for(;H.length;){const ye=H.shift();for(const te of w.get(ye)??[])D.has(te)||(D.add(te),H.push(te))}const j=B.x,Z=B.x+B.width,ie=B.y,ue=B.y+B.height,se=ye=>G.filter(te=>te.flow.target===ye).length,oe=ye=>{var J;const te=((J=f(ye))==null?void 0:J.type)??"";if(te==="bpmn:StartEvent"&&se(ye)===0)return!1;if(te.endsWith("Gateway")){const ae=G.filter(Q=>Q.flow.target===ye).map(Q=>Q.flow.source);if(ae.length&&ae.every(Q=>{var ge;return((ge=f(Q))==null?void 0:ge.type)==="bpmn:StartEvent"&&se(Q)===0}))return!1}return!0},ve=r.filter(ye=>Ni(ye)).filter(ye=>ye.type!=="bpmn:Group"&&ye.type!=="bpmn:Participant"&&ye.type!=="bpmn:TextAnnotation"&&!D.has(ye.id)&&ia(ye.id)&&oe(ye.id)&&ye.x<Z&&ye.x+ye.width>j&&ye.y<ue&&ye.y+ye.height>ie);if(ve.length)for(const ye of[-1,1]){const te=ve.filter(Te=>(Te.x+Te.width-j<=Z-Te.x?-1:1)===ye);if(!te.length)continue;const J=[];for(const Te of te){const Ce=J.find(Pe=>Pe.some(fe=>Te.y<fe.y+fe.height&&Te.y+Te.height>fe.y));Ce?Ce.push(Te):J.push([Te])}const ae=new Map;for(const Te of J){let Ce=ye<0?j-oa:Z+oa;for(const Pe of[...Te].sort((fe,Me)=>ye<0?Me.x-fe.x:fe.x-Me.x)){const fe=ye<0?Math.min(Pe.x,Ce-Pe.width):Math.max(Pe.x,Ce);Ce=ye<0?fe-Bi:fe+Pe.width+Bi,fe!==Pe.x&&Math.sign(fe-Pe.x)===ye&&ae.set(Pe.id,fe-Pe.x)}}const Q=new Map,ge=Te=>Q.get(Te)===Te||!Q.get(Te)?Te:ge(Q.get(Te));for(const Te of te)Q.set(Te.id,Te.id);for(const Te of b){const Ce=ae.has(Te.flow.source)?Te.flow.source:void 0,Pe=ae.has(Te.flow.target)?Te.flow.target:void 0;if(!Ce||!Pe)continue;const fe=f(Te.flow.id);((uR=fe==null?void 0:fe.waypoints)==null?void 0:uR.length)===2&&Q.set(ge(Ce),ge(Pe))}const $e=new Map;for(const Te of te){if(!ae.has(Te.id))continue;const Ce=ge(Te.id);$e.set(Ce,[...$e.get(Ce)??[],Te])}const Oe=[...$e.values()].sort((Te,Ce)=>ye<0?Math.min(...Te.map(Pe=>Pe.x))-Math.min(...Ce.map(Pe=>Pe.x)):Math.max(...Ce.map(Pe=>Pe.x))-Math.max(...Te.map(Pe=>Pe.x))),Ze=[];let Ae=!0;for(const Te of Oe){const Ce=Te.map(Me=>ae.get(Me.id)??0).reduce((Me,ke)=>Math.abs(ke)>Math.abs(Me)?ke:Me,0),Pe=new Map;let fe=!0;for(const Me of Te){const ke=h(Me);if(!ke){fe=!1;break}Pe.has(ke.id)||Pe.set(ke.id,{subtree:[],pool:ke}),Pe.get(ke.id).subtree.push(Me)}fe&&Rr([...Pe.values()],Ce,()=>!0,os)?Ze.push({shapes:Te,dx:Ce}):Ae=!1}if(!Ae)for(const Te of Ze.reverse())n.moveElements(Te.shapes,{x:-Te.dx,y:0})}}}{const x=new Set([...k.map(w=>w.group.id),...jt(e,"group.update").map(w=>w.id)]);for(const w of r.filter(S=>S.type==="bpmn:Group")){if(x.has(w.id))continue;const O=(((pR=w.businessObject.extensionElements)==null?void 0:pR.values)??[]).find(L=>L.$type==="bwl:Members"),B=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(L=>!!L);!B.length||!B.some(L=>{const D=y.get(L.id);return!D||D.x!==L.x||D.y!==L.y})||!B.some(L=>L.x<w.x||L.y<w.y||L.x+L.width>w.x+w.width||L.y+L.height>w.y+w.height)||n.resizeShape(w,im(B,w.id))}}{const w=new Map(Vo(Ve(r)).map(L=>[L.owner,L.rect])),S=r.filter(L=>!!L.waypoints),O=new Map,B=(L,D)=>{!L||!D||(O.has(L)||O.set(L,new Set),O.get(L).add(D))};for(const L of S){const D=(dR=L.source)==null?void 0:dR.id,H=(fR=L.target)==null?void 0:fR.id;B(D,H),((hR=L.type)!=null&&hR.includes("DataOutputAssociation")||(gR=L.type)!=null&&gR.includes("DataInputAssociation")||L.type==="bpmn:Association")&&B(H,D)}const P=L=>G.filter(D=>D.flow.target===L).length,N=L=>{var H;const D=((H=f(L))==null?void 0:H.type)??"";if(D==="bpmn:StartEvent"&&P(L)===0)return!1;if(D.endsWith("Gateway")){const j=G.filter(Z=>Z.flow.target===L).map(Z=>Z.flow.source);if(j.length&&j.every(Z=>{var ie;return((ie=f(Z))==null?void 0:ie.type)==="bpmn:StartEvent"&&P(Z)===0}))return!1}return!0};for(const L of r.filter(D=>D.type==="bpmn:Group")){const H=(((mR=L.businessObject.extensionElements)==null?void 0:mR.values)??[]).find(fe=>fe.$type==="bwl:Members"),j=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const Z=j.map(f).filter(fe=>!!fe);if(!Z.length||!(k.some(fe=>fe.group.id===L.id)||jt(e,"group.update").some(fe=>fe.id===L.id)||Z.some(fe=>{const Me=y.get(fe.id);return!Me||Me.x!==fe.x||Me.y!==fe.y})))continue;const ue=new Set(j),se=[...j];for(;se.length;){const fe=se.shift();for(const Me of O.get(fe)??[])ue.has(Me)||(ue.add(Me),se.push(Me))}const oe=L.x,ve=L.x+L.width,ye=L.y,te=L.y+L.height,J=fe=>{const Me=w.get(fe.id),ke={x:fe.x,y:fe.y,width:fe.width,height:fe.height};return Me?[ke,{x:Me.x,y:Me.y,width:Me.width,height:Me.height}]:[ke]},ae=Z.flatMap(J),Q=Math.min(...ae.map(fe=>fe.x)),ge=Math.max(...ae.map(fe=>fe.x+fe.width)),$e=Math.min(...ae.map(fe=>fe.y)),Oe=Math.max(...ae.map(fe=>fe.y+fe.height)),Ze={L:Q-oe,R:ve-ge,T:$e-ye,B:te-Oe},Ae=new Set(j),Te=fe=>fe.x>=oe&&fe.x+fe.width<=ve&&fe.y>=ye&&fe.y+fe.height<=te,Ce=r.filter(fe=>Ni(fe)).filter(fe=>fe.type!=="bpmn:Group"&&fe.type!=="bpmn:Participant"&&fe.type!=="bpmn:TextAnnotation"&&!Ae.has(fe.id)&&(!ue.has(fe.id)||!Te(fe))&&N(fe.id)&&fe.x<ve&&fe.x+fe.width>oe&&fe.y<te&&fe.y+fe.height>ye);if(!Ce.length)continue;const Pe={L:0,R:0,T:0,B:0};for(const fe of Ce){const Me=J(fe),ke=Math.min(...Me.map(_n=>_n.x)),Fe=Math.max(...Me.map(_n=>_n.x+_n.width)),wt=Math.min(...Me.map(_n=>_n.y)),an=Math.max(...Me.map(_n=>_n.y+_n.height)),Yt={L:Fe-oe,R:ve-ke,T:an-ye,B:te-wt},Kt=["L","R","T","B"].filter(_n=>Yt[_n]<=Ze[_n]+.001);if(!Kt.length)continue;const jn=Kt.reduce((_n,kp)=>Yt[kp]<Yt[_n]?kp:_n,Kt[0]);Pe[jn]=Math.max(Pe[jn],Math.min(Yt[jn]+10,Ze[jn]))}!Pe.L&&!Pe.R&&!Pe.T&&!Pe.B||n.resizeShape(L,{x:L.x+Pe.L,y:L.y+Pe.T,width:L.width-Pe.L-Pe.R,height:L.height-Pe.T-Pe.B})}}const HS=x=>{const w=x.waypoints;if(w!=null&&w.length){const O=w[Math.floor((w.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let kc=0;const om=fv.get(t),zS=(x,w)=>{var O;const S=(O=om==null?void 0:om.get(x))==null?void 0:O.texts;return S?[...new Set([w,...Object.values(S)])]:[w]};for(const x of I){const w=x.association,S=((yR=x.placement)==null?void 0:yR.anchor)??(w?w.source===x.annotation.id?w.target:w.source:void 0),O=S?f(S):void 0,B=O?HS(O):void 0,P=nv(zS(x.annotation.id,x.annotation.text??""));let N;if(B&&x.placement){const[j,Z]=cl[x.placement.side],ie=x.placement.offset??50;N={x:B.x+B.width/2+j*(B.width/2+P.width/2+ie),y:B.y+B.height/2+Z*(B.height/2+P.height/2+ie)}}else B?(N={x:B.x+B.width/2+180+kc%3*260,y:B.y-110-kc%2*95},kc++):(N={x:300+kc*260,y:60},kc++);const L=O?h(O)??d():d(),D=L;B&&typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant"&&(N=ul(r,B,P,D,x.placement?{placement:x.placement}:{from:N}));const H=n.createShape({type:"bpmn:TextAnnotation",width:P.width,height:P.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},N,L);if(w){const j=Z=>Z===x.annotation.id?H:g(Z);n.connect(j(w.source),j(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}x.placement&&K(H,"bwl:Placement",xe(x.placement))}for(const x of jt(e,"association.add")){const w=x.association;n.connect(g(w.source),g(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}const t6=(x,w,S,O)=>{const B=x.parent;if(!B)return O;const P=x.x+x.width/2,N=new Set([x.id]);if(!R(B,x,P,O,N))return O;const L=w?w.y+Math.min(w.height/2,q):S?S.y+le:void 0;if(L===void 0)return O;const D=Math.floor((O-L)/he+1e-6);for(let H=1;H<=3;H++){const j=D+H,Z=L+j*he,ie=fS(w==null?void 0:w.id,j);if(!R(B,x,P,Z,ie?new Set([...N,...ie]):N))return es(w==null?void 0:w.id,j,S),Z}return O},GS=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of jt(e,"node.update")){let w=g(x.id);if(x.type&&sl(x.type)!==w.type){const S=w.x+w.width/2,O=w.y+w.height/2,B=GS();w=c.replaceElement(w,{type:sl(x.type),...x.eventDefinition?{eventDefinitionType:Bc[x.eventDefinition]}:{}});const P=GS(),N=[...B].filter(H=>H!==x.id&&!P.has(H));if(N.length)throw new pv({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:N});const L=Math.round(S-(w.x+w.width/2)),D=Math.round(O-(w.y+w.height/2));if(L!==0||D!==0){n.moveShape(w,{x:L,y:D});for(const H of[...w.incoming??[],...w.outgoing??[]])Mp(H)}}if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(w,{"bwl:band":x.band});const S=w.y+w.height/2,O=h(w),B=x.lane?g(x.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&S>=N.y&&S<=N.y+N.height);x.band!==void 0&&es(B==null?void 0:B.id,x.band,O);const P=B?B.y+(x.band===void 0?B.height/2:Math.min(B.height/2,q)+on(B.id,x.band)*he):x.band!==void 0&&O?O.y+le+on(`pool:${O.id}`,x.band)*he:void 0;if(P!==void 0){const N=t6(w,B,O,P),L=N===P?P-S:N-(w.y+w.height/2);L!==0&&(p.push({id:w.id,x:w.x,y:w.y,width:w.width,height:w.height}),n.moveElements([w],{x:0,y:L}))}}}for(const x of jt(e,"sequenceFlow.update")){const w=g(x.id),S=F.get(x.id);if(S){const O=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),B=g(S.flow.source),P=g(S.flow.target),N=n.connect(B,P,{type:"bpmn:SequenceFlow",businessObject:Cp(S.flow)}),L=Xg.get(x.id),D=P.y+P.height/2;L&&P.x>L.exit.x&&Math.abs(D-L.exit.y)>1?n.updateWaypoints(N,[L.exit,{x:L.exit.x,y:D},{x:P.x,y:D}]):(n.reconnect(N,B,P,[O(B),O(P)]),Math.abs(D-(B.y+B.height/2))>1&&Mp(N))}else if((x.source!==void 0||x.target!==void 0)&&!mS.has(x.id)){const O=w,B=x.source!==void 0?g(x.source):O.source,P=x.target!==void 0?g(x.target):O.target,N=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(O,B,P,[N(B),N(P)]);const L=Xg.get(O.id),D=P.y+P.height/2;if(L&&P.x>L.exit.x&&Math.abs(D-L.exit.y)>1){n.updateWaypoints(O,[L.exit,{x:L.exit.x,y:D},{x:P.x,y:D}]);const H=O.label;if(H&&L.label){const Z=Math.abs(L.label.y+H.height/2-L.channelY)<=he/5&&L.label.x+H.width>L.exit.x,ie=L.exit.x+6,ue=P.x-6-H.width,se=Z?ue>=ie?{x:Math.max(ie,Math.min(L.label.x,ue)),y:L.label.y+(D-L.channelY)}:void 0:L.label;se&&(se.x!==H.x||se.y!==H.y)&&n.moveElements([H],{x:se.x-H.x,y:se.y-H.y})}}else Math.abs(D-(B.y+B.height/2))>1&&Mp(O)}x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(w,{name:((vR=x.condition)==null?void 0:vR.label)??void 0})}for(const x of jt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(g(x.id),{name:x.name??void 0});for(const x of jt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(g(x.id),{name:x.name??void 0});for(const x of jt(e,"annotation.update")){const w=g(x.id);if(x.text!==void 0){n.updateProperties(w,{text:x.text});const S=nv(zS(x.id,x.text));if(S.width!==w.width||S.height!==w.height){const O={x:w.x,y:w.y,width:S.width,height:S.height};n.resizeShape(w,O,void 0,{[iv]:O})}}if(x.placement===null)K(w,"bwl:Placement",null);else if(x.placement){const S=g(x.placement.anchor),O=HS(S),B=h(S)??d(),P=typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant",[N,L]=cl[x.placement.side],D=x.placement.offset??50,H={x:O.x+O.width/2+N*(O.width/2+w.width/2+D),y:O.y+O.height/2+L*(O.height/2+w.height/2+D)},j=P?ul(r,O,{width:w.width,height:w.height},B,{placement:x.placement,selfId:x.id}):H;n.moveElements([w],{x:j.x-(w.x+w.width/2),y:j.y-(w.y+w.height/2)}),K(w,"bwl:Placement",xe(x.placement))}}for(const x of jt(e,"group.update")){const w=g(x.id);if(x.name!==void 0&&n.updateLabel(w,x.name??""),x.members){const S=x.members.map(f).filter(O=>!!O);S.length&&n.resizeShape(w,im(S,x.id)),K(w,"bwl:Members",{refs:x.members.join(" ")})}}}function Dd(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 iT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(f=>f.type==="bpmn:Association");if(!a.length)return 0;const s=f=>f.map(g=>g.original?{x:g.x,y:g.y,original:{x:g.original.x,y:g.original.y}}:{x:g.x,y:g.y}),c=(f,g)=>f.length===g.length&&f.every((h,y)=>{var _,m,v,b;return h.x===g[y].x&&h.y===g[y].y&&((_=h.original)==null?void 0:_.x)===((m=g[y].original)==null?void 0:m.x)&&((v=h.original)==null?void 0:v.y)===((b=g[y].original)==null?void 0:b.y)}),l=a.map(f=>s(f.waypoints)),u=new Set(a.map(f=>f.id));r.moveElements([t],{x:n,y:i});const p=Ve(o),d=[...Ji(p),...wi(p)].filter(([f,g])=>u.has(f)!==u.has(g)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,g)=>{c(f.waypoints,l[g])||r.updateWaypoints(f,l[g])}),d}function oT(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=d=>ut(d).filter(f=>!t.has(ct(f))),a=d=>{var f;return((f=i.get(d))==null?void 0:f.type)==="bpmn:TextAnnotation"},s=Ve(i),c=r(s),l=[...new Set(c.flatMap(Dd))].filter(d=>n.has(d)&&a(d));if(l.length)for(const d of l){const f=i.get(d);if(!f||typeof f.x!="number"||typeof f.width!="number")continue;let g=f.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const xe=f.x+f.width/2,de=f.y+f.height/2;h=i.getAll().find(we=>{if(we.type!=="bpmn:Participant")return!1;const he=we;return typeof he.x=="number"&&typeof he.width=="number"&&xe>=he.x&&xe<=he.x+he.width&&de>=he.y&&de<=he.y+he.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=f.businessObject.extensionElements)==null?void 0:u.values)??[]).find(xe=>xe.$type==="bwl:Placement"),m=[...f.incoming??[],...f.outgoing??[]].find(xe=>xe.type==="bpmn:Association"),v=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(m?((p=m.source)==null?void 0:p.id)===d?m.target:m.source:void 0);if(!v)continue;const b=v.waypoints,E=b!=null&&b.length?{x:b[Math.floor((b.length-1)/2)].x,y:b[Math.floor((b.length-1)/2)].y,width:0,height:0}:{x:v.x,y:v.y,width:v.width,height:v.height},C={width:f.width,height:f.height},I={x:f.x+f.width/2,y:f.y+f.height/2},k=_==null?void 0:_.side,T=lv(i,E,h),F=[];if(k&&k in cl&&F.push(ul(i,E,C,h,{placement:{side:k,offset:(_==null?void 0:_.offset)??null},selfId:d})),T&&!ll(I,C,T))for(const xe of QA)F.push(ul(i,E,C,h,{placement:{side:xe,offset:null},selfId:d}));for(const[xe,de]of[[-1,0],[1,0],[0,-1],[0,1]])for(let we=1;we<=JA;we++)F.push({x:I.x+xe*cv*we,y:I.y+de*cv*we});const z={...s,edges:s.edges.filter(xe=>xe.id!==(m==null?void 0:m.id))},G=r(z),ne=G.filter(xe=>Dd(xe).includes(d)).length;if(!ne)continue;let re,K=!1;for(const xe of F){const de=xe.x-I.x,we=xe.y-I.y;if(!de&&!we||xe.x-C.width/2<h.x||xe.x+C.width/2>h.x+h.width||xe.y-C.height/2<h.y||xe.y+C.height/2>h.y+h.height||T&&!ll(xe,C,T))continue;const he={...z,shapes:z.shapes.map(ee=>ee.id===d?{...ee,x:ee.x+de,y:ee.y+we}:ee)},W=r(he),le=W.filter(ee=>Dd(ee).includes(d)).length;if(le>=ne||W.length>G.length)continue;const q=Math.abs(de)+Math.abs(we);if(K||((!re||le<re.mine||le===re.mine&&(W.length<re.all||W.length===re.all&&q<re.dist))&&(re={x:xe.x,y:xe.y,mine:le,all:W.length,dist:q}),re.mine===0&&re.all<G.length&&(K=!0)),le===0&&W.length<G.length&&iT(e,f,de,we)===0){re={x:xe.x,y:xe.y,mine:le,all:W.length,dist:q};break}}re&&o.moveElements([f],{x:re.x-I.x,y:re.y-I.y})}}const rT=60;function pl(e,t,n,i){const o=t.x+t.width,r=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(r.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 r)Math.abs(c.x+c.width-o)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function aT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=_=>ut(_).filter(m=>!t.has(ct(m))),a=_=>_.filter(m=>m.kind==="pool-overlap"),s=new Map(n.shapes.map(_=>[_.id,_])),c=(_,m)=>m.x>=_.x&&m.y>=_.y&&m.x+m.width<=_.x+_.width&&m.y+m.height<=_.y+_.height,l=_=>{if(!s.get(_))return[_];const v=new Set,b=new Set([_]);for(let C=0;C<4;C++){let I=!1;for(const k of n.shapes)k.type!=="bpmn:Group"||v.has(k.id)||[...b].some(T=>{const F=s.get(T);return F&&c(k,F)})&&(v.add(k.id),I=!0);for(const k of n.shapes)k.type!=="bpmn:Participant"||b.has(k.id)||[...v].some(T=>{const F=s.get(T);return F&&c(F,k)})&&(b.add(k.id),I=!0);if(!I)break}const E=n.shapes.filter(C=>!C.parent&&!b.has(C.id)&&!v.has(C.id)&&C.type!=="bpmn:Group"&&C.type!=="bpmn:Participant").filter(C=>[...v].some(I=>{const k=s.get(I);return k&&c(k,C)})).map(C=>C.id);return[...b,...v,...E]},u=r(Ve(i)),p=a(u).length;if(!p)return;const d=u.length,f=[];let g=0,h=p,y=d;for(let _=0;_<6;_++){const m=Ve(i),v=a(r(m));if(!v.length)break;const b=new Map(m.shapes.map(T=>[T.id,T]));let E=null;for(const T of v){if(T.kind!=="pool-overlap")continue;const[F,z]=T.pools,G=b.get(F),ne=b.get(z);if(!G||!ne)continue;const[re,K]=G.x<=ne.x?[G,ne]:[ne,G];if(T.contained)continue;const xe=s.get(re.id),de=s.get(K.id),we=xe&&de?Math.max(de.x-(xe.x+xe.width),0):rT,he=re.x+re.width+we-K.x;if(he<=0)continue;const W=l(K.id).filter(le=>i.get(le));W.length&&(!E||he>E.dx)&&(E={movers:W,dx:he})}if(!E)break;const C=E.movers.map(T=>i.get(T)).filter(T=>!!T&&typeof T.x=="number");if(!C.length)break;o.moveElements(C,{x:E.dx,y:0}),f.push({els:C,dx:E.dx});const I=r(Ve(i)),k=a(I).length;k<p&&I.length<=d&&(k<h||k===h&&I.length<y||g===0)&&(g=f.length,h=k,y=I.length)}for(const{els:_,dx:m}of f.slice(g).reverse())o.moveElements(_,{x:-m,y:0})}const bs=.5,Ld=150;function sT(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of cT(n))i.length<n.length&&i.some(r=>mv(e.elementRegistry.get(r.id)))||lT(e,i)}function cT(e){const t=[...e].sort((i,o)=>i.x+i.width-(o.x+o.width)),n=[];for(const i of t){const o=n[n.length-1],r=o==null?void 0:o[o.length-1];o&&r&&i.x+i.width-(r.x+r.width)<=bs?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function mv(e){var i,o,r;const t=(i=e==null?void 0:e.businessObject)==null?void 0:i.processRef;if(!t)return!0;const n=(t.laneSets??[]).reduce((a,s)=>{var c;return a+(((c=s.lanes)==null?void 0:c.length)??0)},0);return(((o=t.flowElements)==null?void 0:o.length)??0)+n+(((r=t.artifacts)==null?void 0:r.length)??0)===0}function lT(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(m=>m.x+m.width),r=Math.max(...o);if(r-Math.min(...o)>bs)return;const a=t.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(a.length<2)return;const s=new Map(t.map(m=>[m.id,m.x]));if(a.some(m=>Math.abs(m.x-s.get(m.id))>bs))return;const c=a.map(m=>m.x+m.width);if(Math.max(...c)-Math.min(...c)<=bs)return;const l=m=>m.x+m.width,u=m=>!!m&&typeof m.width=="number",p=m=>{const v={shapes:[],edges:[],lanes:[]},b=E=>{for(const C of E.children??[]){if("waypoints"in C&&C.waypoints){v.edges.push(C);continue}C.type!=="label"&&(C.type==="bpmn:Lane"?v.lanes.push(C):v.shapes.push(C),b(C))}};return b(m),v},d=new Map(a.map(m=>[m.id,p(m)]));let f=r;for(const m of a){const{shapes:v}=d.get(m.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+Ld))}const g=a.filter(m=>Math.abs(l(m)-f)>bs);if(!g.length)return;for(const m of g){const v=l(m),{shapes:b,edges:E,lanes:C}=d.get(m.id);if([...b.flatMap(T=>[l(T),...u(T.label)?[l(T.label)]:[]]),...E.flatMap(T=>[...T.waypoints.map(F=>F.x),...u(T.label)?[l(T.label)]:[]])].some(T=>T>f)||[...(m.incoming??[]).map(T=>T.waypoints[T.waypoints.length-1]),...(m.outgoing??[]).map(T=>T.waypoints[0])].some(T=>!T||T.x>f||Math.abs(T.x-v)<1))return;if(f>v){const T={x:v,y:m.y,width:f-v,height:m.height},F=new Set([m.id,...b.map(G=>G.id),...E.map(G=>G.id),...C.map(G=>G.id)]);if(n.getAll().some(G=>{var K;if("waypoints"in G&&G.waypoints||G.type==="bpmn:Group"||!u(G))return!1;const ne=G.type==="label"?(K=G.labelTarget)==null?void 0:K.id:G.id;if(!ne||F.has(ne)||F.has(G.id))return!1;const re=G;return re.x<T.x+T.width&&re.x+re.width>T.x&&re.y<T.y+T.height&&re.y+re.height>T.y}))return}}const h=()=>new Set(ut(Ve(n)).map(ct)),y=h(),_=g.map(m=>m.width);for(const m of g)pl(i,m,f-m.x,{layout:!1});[...h()].every(m=>y.has(m))||g.forEach((m,v)=>pl(i,m,_[v],{layout:!1}))}function uT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ut(l).filter(u=>!t.has(ct(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(C=>C.id!==l.id&&C.type!=="bpmn:Group"&&a(l,C));if(!p.length)continue;const d=p.map(C=>i.get(C.id)).filter(C=>!!C&&typeof C.x=="number");if(d.length!==p.length)continue;const f=s(p),g=s(d),h=g.l+(l.x-f.l),y=g.t+(l.y-f.t),_=g.r+(l.x+l.width-f.r),m=g.b+(l.y+l.height-f.b),v={x:h,y,width:_-h,height:m-y};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const b=r(Ve(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(Ve(i)).length>b&&o.resizeShape(u,E)}}const dl=20,fl=10;function pT(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(ut(f,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(ct)),s=Ve(o),c=ut(s,{includeObservationOnly:!0}).filter(f=>f.kind==="edge-along-group-boundary"&&!t.has(ct(f)));if(!c.length)return;const l=new Map(n.shapes.map(f=>[f.id,f])),u=new Map;for(const f of c)u.set(f.group,[...u.get(f.group)??[],f]);for(const[f,g]of u){const h=s.shapes.find(ze=>ze.id===f);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const y=l.get(f);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 m=h.members.map(ze=>o.get(ze)).filter(ze=>!!ze&&typeof ze.x=="number");if(!m.length)continue;const v=Math.min(...m.map(ze=>ze.x)),b=Math.min(...m.map(ze=>ze.y)),E=Math.max(...m.map(ze=>ze.x+ze.width)),C=Math.max(...m.map(ze=>ze.y+ze.height)),I=h.x,k=h.y,T=h.x+h.width,F=h.y+h.height;let z=I,G=k,ne=T,re=F;for(const ze of g){const $=s.edges.find(R=>R.id===ze.edge);if(!$)continue;const M=$.endpoints.some(R=>{const U=s.shapes.find(Ne=>Ne.id===R);if(!U||U.container)return!1;const X=U.x+U.width/2,pe=U.y+U.height/2;return I<X&&X<T&&k<pe&&pe<F});for(const R of cn($)){const U=R.axis==="v"?[k,F]:[I,T];Math.min(R.hi,U[1])-Math.max(R.lo,U[0])<ld||(R.axis==="v"?I<R.at&&R.at<T:k<R.at&&R.at<F)&&M||(R.axis==="v"?(Math.abs(R.at-I)<=ma&&(z=Math.max(z,R.at+dl)),Math.abs(R.at-T)<=ma&&(ne=Math.min(ne,R.at-dl))):(Math.abs(R.at-k)<=ma&&(G=Math.max(G,R.at+dl)),Math.abs(R.at-F)<=ma&&(re=Math.min(re,R.at-dl))))}}if(z>v-fl&&(z=I),G>b-fl&&(G=k),ne<E+fl&&(ne=T),re<C+fl&&(re=F),z===I&&G===k&&ne===T&&re===F)continue;const K=o.get(f),xe={x:K.x,y:K.y,width:K.width,height:K.height},de=Ve(o),we=new Set(ut(de).map(ct)),he=a(de);r.resizeShape(K,{x:z,y:G,width:ne-z,height:re-G});let W=Ve(o),le=ut(W).filter(ze=>!we.has(ct(ze)));const q=[];if(le.length>0&&le.every(ze=>ze.kind==="label-over-line"&&!i.has(ze.edge)&&W.edges.some($=>$.id===ze.edge))){for(const ze of le){if(ze.kind!=="label-over-line")continue;const $=W.edges.find(pe=>pe.id===ze.edge),M=$&&Td($,W),R=(d=o.get(ze.edge))==null?void 0:d.label;if(!M||!R)continue;const U=M.x-R.x,X=M.y-R.y;r.moveElements([R],{x:U,y:X}),q.push({label:R,dx:U,dy:X})}W=Ve(o),le=ut(W).filter(ze=>!we.has(ct(ze)))}const me=a(W),Re=[...me].some(ze=>!he.has(ze));if(le.length||Re||me.size>=he.size){for(const ze of q.reverse())r.moveElements([ze.label],{x:-ze.dx,y:-ze.dy});r.resizeShape(K,xe)}}}function dT(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=zp((o==null?void 0:o.$parent)??o),a=ls(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:Gp(u,i,r),requests:qp(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,...r?{rootLang:r}:{},before:s.get(l)}]:[]})}}function Id(e,t,n={}){var K,xe;const{i18n:i,lower:o=gv}=n,r=av(e),a=py(r.elementRegistry),s=Zy(t,a,{i18n:i}),c={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0},sharedEndpointCrossings:{before:0,after:0,pairs:[]}};if(s.length)return{ok:!1,issues:s,findings:[],stats:c};const l=NA(t,a,i),u=i&&l.writes.size?dT(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ve(r.elementRegistry),d=new Set(ut(p).map(ct)),f=new Set(ut(p,{includeObservationOnly:!0}).map(ct)),g=new Set(uv(l.ops,de=>{var we,he;return(he=(we=r.elementRegistry.get(de))==null?void 0:we.source)==null?void 0:he.id}).keys()),h=new Set(p.edges.map(de=>de.id).filter(de=>!g.has(de))),y=new Set(t.flatMap(de=>de.kind==="sequenceFlow.update"&&(de.source!==void 0||de.target!==void 0)?[de.id]:[])),_=()=>new Set(p.edges.filter(de=>{var he;const we=(he=r.elementRegistry.get(de.id))==null?void 0:he.waypoints;return we?!(we.length===de.waypoints.length&&de.waypoints.every((W,le)=>Math.round(W.x)===Math.round(we[le].x)&&Math.round(W.y)===Math.round(we[le].y))):!1}).map(de=>de.id)),m=(de,we)=>new Set([...de].filter(he=>!we.has(he))),v=new Set(p.shapes.map(de=>de.id)),b=Ji(p),E=b.length,C=new Set(b.map(([de,we])=>`${de}|${we}`)),I=wi(p),k=new Set(I.map(([de,we])=>`${de}|${we}`)),T=new Map;for(const de of r.elementRegistry.filter(we=>"waypoints"in we&&!!we.waypoints))de.label&&T.set(de.id,{wps:de.waypoints.map(we=>({x:we.x,y:we.y})),label:{x:de.label.x,y:de.label.y},source:(K=de.source)==null?void 0:K.id,target:(xe=de.target)==null?void 0:xe.id});const F=e.get("commandStack");try{tT(r,l.writes),fm(F,()=>{o(l.ops,r);for(const le of(u==null?void 0:u.contexts())??[])F.execute(Wp,le);aT(r,d,p),sT(r,p),uT(r,d,p),pA(r,p,y),cA(r,h,v),Sy(r,h);const de=xd(r,d),we=JM(r,nT(r),h,y);vy(r,C,h);const he=_(),W=$y(r,d,m(h,he),he);Ty(r,h),EA(r,h,y),Ly(r,d,h),PA(r,d,h),rA(r,k,h),yA(r,h,p),Vy(r,d,m(h,_())),Gy(r,h,new Set([...y,...W,...we])),Uy(r,v),oT(r,d,v),xd(r,d,de),pT(r,f,p,h),qy(r,d),zy(r,T,eT(r))})}catch(de){return{ok:!1,issues:[de instanceof pv?de.issue:{kind:"lower-failed",message:de instanceof Error?de.message:String(de)}],findings:[],stats:c}}const z=Ve(r.elementRegistry),G=ut(z,{includeObservationOnly:!0}).filter(de=>!f.has(ct(de))),ne=ty(z),re=wi(z);return{ok:!0,issues:[],findings:G,stats:{edgeCrossings:{before:E,after:ne.pairs.length,pairs:ne.pairs,solidPairs:ne.solidPairs,dashedPairs:ne.dashedPairs,mixedPairs:ne.mixedPairs,crossPoolMessages:ne.crossPoolMessages},sharedEndpointCrossings:{before:I.length,after:re.length,pairs:re}}}}function fT(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function yv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function vv(e,t){const n=yv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function xv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function hT(e){return typeof e=="string"&&Np.includes(e)}function zi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function bv(e,t={}){const n=e.rootElements??[],i=n.find(W=>W.$type==="bpmn:Collaboration"),o=new Map(n.filter(W=>W.$type==="bpmn:Process").map(W=>[W.id,W])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},d=[],f=[],g=[],h=[],y=[],_=[],m=[],v=new Map,b=new Set,E=new Set,C=W=>{W&&b.add(W)},I=W=>{b.add(W),E.add(W)},k=W=>{const le=xv(W,"bwl:Placement");if(!le)return;const q=typeof le.anchor=="string"?le.anchor:void 0;if(!q||!hT(le.side))return;const ee=typeof le.offset=="number"?le.offset:void 0;y.push({owner:W.id,anchor:q,side:le.side,...ee!==void 0?{offset:ee}:{}})},T=W=>{const le=xv(W,"bwl:Members"),q=typeof(le==null?void 0:le.refs)=="string"?le.refs.split(/\s+/).filter(Boolean):[];q.length&&m.push({owner:W.id,refs:q})},F=W=>{var le;for(const q of W)switch(C(q.id),q.$type){case"bpmn:TextAnnotation":I(q.id),v.set(q.id,q),c.push({id:q.id,text:typeof q.text=="string"?q.text:""}),k(q);break;case"bpmn:Association":g.push({id:q.id,type:q.$type,source:zi(q.sourceRef),target:zi(q.targetRef)});break;case"bpmn:Group":{I(q.id),v.set(q.id,q);const ee=(le=q.categoryValueRef)==null?void 0:le.value;l.push({id:q.id,...typeof ee=="string"&&ee?{name:ee}:{}}),T(q);break}default:u.push({id:q.id,type:q.$type,reason:"type-outside-mvp"})}},z=W=>{for(const le of W.flowElements??[])C(le.id),u.push({id:le.id,type:le.$type,reason:"inside-container"}),(le.flowElements??[]).length&&z(le);for(const le of W.artifacts??[])C(le.id),u.push({id:le.id,type:le.$type,reason:"inside-container"})},G=(W,le)=>{const q=W.flowElements??[],ee=(W.laneSets??[]).flatMap(Re=>Re.lanes??[]),me=new Map;for(const Re of ee){C(Re.id),v.set(Re.id,Re);for(const ze of Re.flowNodeRef??[]){const $=zi(ze);$&&me.set($,Re.id)}}for(const Re of q){if(C(Re.id),v.set(Re.id,Re),Re.$type==="bpmn:SequenceFlow"){d.push({id:Re.id,source:zi(Re.sourceRef),target:zi(Re.targetRef),...typeof Re.name=="string"&&Re.name?{name:Re.name}:{}});continue}if(Re.$type==="bpmn:DataStoreReference"){I(Re.id),s.push({id:Re.id,...Re.name?{name:Re.name}:{}});continue}const ze=fT(Re.$type),$=ze==="intermediateCatchEvent"?Ip((Re.eventDefinitions??[]).map(X=>X.$type)):void 0;if(!sm(ze)||ze==="intermediateCatchEvent"&&!$){u.push({id:Re.id,type:Re.$type,reason:"type-outside-mvp"});continue}I(Re.id);const M=ze==="boundaryEvent"?zi(Re.attachedToRef):void 0;a.push({id:Re.id,type:ze,...Re.name?{name:Re.name}:{},...le?{participant:le}:{},...me.has(Re.id)?{lane:me.get(Re.id)}:{},...M?{attachedTo:M}:{},...$?{eventDefinition:$}:{}}),ze==="subProcess"&&z(Re);const R=vv(Re,"bwl:band");R!==void 0&&(p.bands[Re.id]=R);const U=yv(Re,"bwl:afterColumn");typeof U=="string"&&U!==""&&_.push([Re.id,U]);for(const X of Re.dataOutputAssociations??[])C(X.id),h.push({id:X.id,type:X.$type,source:Re.id,target:zi(X.targetRef)});for(const X of Re.dataInputAssociations??[])C(X.id),h.push({id:X.id,type:X.$type,source:zi((X.sourceRef??[])[0]),target:Re.id})}F(W.artifacts??[])};if(i){const W=new Set;for(const le of i.participants??[]){I(le.id),v.set(le.id,le);const q=zi(le.processRef);q&&W.add(q);const ee=q?o.get(q):void 0,me=((ee==null?void 0:ee.laneSets)??[]).flatMap(M=>M.lanes??[]),Re=me.map(M=>({id:M.id,...M.name?{name:M.name}:{}}));for(const M of Re)I(M.id);const ze=!ee||(ee.flowElements??[]).length===0&&me.length===0&&(ee.artifacts??[]).length===0;r.push({id:le.id,...le.name?{name:le.name}:{},...ze?{blackBox:!0}:{},...Re.length?{lanes:Re}:{}});const $=vv(le,"bwl:poolOrder");$!==void 0&&(p.poolOrders[le.id]=$),ee&&G(ee,le.id)}for(const le of i.messageFlows??[])C(le.id),v.set(le.id,le),f.push({id:le.id,source:zi(le.sourceRef),target:zi(le.targetRef),...typeof le.name=="string"&&le.name?{name:le.name}:{}});F(i.artifacts??[]);for(const[le,q]of o)!W.has(le)&&(q.flowElements??[]).length>0&&u.push({id:le,type:q.$type,reason:"unreachable-process"})}else for(const W of o.values())G(W);const ne=[],re=[],K=[],xe=[],de=(W,le)=>!!W&&!!le&&E.has(W)&&E.has(le);for(const W of d){if(!de(W.source,W.target)){u.push({id:W.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}ne.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of f){if(!de(W.source,W.target)){u.push({id:W.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}re.push({id:W.id,source:W.source,target:W.target,...W.name?{name:W.name}:{}}),E.add(W.id)}for(const W of h){if(!de(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}xe.push({...W.id?{id:W.id}:{},source:W.source,target:W.target}),W.id&&E.add(W.id)}for(const W of g){if(!de(W.source,W.target)){u.push({id:W.id??"",type:W.type,reason:"endpoint-outside-mvp"});continue}K.push({...W.id?{id:W.id}:{},source:W.source,target:W.target})}const we=new Map(l.map(W=>[W.id,W]));for(const{owner:W,refs:le}of m){const q=le.filter(me=>b.has(me)),ee=we.get(W);ee&&q.length&&(ee.members=q)}for(const W of y)b.has(W.anchor)&&(p.placements[W.owner]={anchor:W.anchor,side:W.side,...W.offset!==void 0?{offset:W.offset}:{}});for(const[W,le]of _)b.has(le)&&(p.afterColumns[W]=le);const he={...r.length?{participants:r}:{},nodes:a,sequenceFlows:ne,...re.length?{messageFlows:re}:{},...s.length?{dataStores:s}:{},...xe.length?{dataAssociations:xe}:{},...c.length?{annotations:c}:{},...K.length?{associations:K}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:he,hints:p,omitted:u,i18n:gT(he,v,e,t.i18n)}:{definition:he,hints:p,omitted:u}}function gT(e,t,n,i){const o=zp(n),r=ls(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Gp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of qp(u))r.includes(d.locale)&&a.push({id:c.id,...d})};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:r.slice(1),reviewRequests:a}}async function mT(e,t={}){const{definitions:n,warnings:i}=await ga(e);return{...bv(n,t),warnings:i}}const yT=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Bd(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function vT(e){return Bd(e.processRef)!==void 0}function xT(e){const t=new Set,n=o=>{const r=Bd(o);r&&t.add(r)},i=o=>{for(const r of o.flowElements??[]){n(r.sourceRef),n(r.targetRef),r.attachedToRef&&(n(r.attachedToRef),t.add(r.id));for(const a of r.dataOutputAssociations??[])t.add(r.id),n(a.targetRef);for(const a of r.dataInputAssociations??[]){t.add(r.id);for(const s of a.sourceRef??[])n(s)}(r.flowElements??[]).length&&i(r)}for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)};for(const o of e.rootElements??[])if(o.$type==="bpmn:Process")i(o);else if(o.$type==="bpmn:Collaboration"){for(const r of o.messageFlows??[])n(r.sourceRef),n(r.targetRef);for(const r of o.artifacts??[])n(r.sourceRef),n(r.targetRef)}return t}function bT(e){const t=[],n=i=>{for(const o of i.flowElements??[])yT.has(o.$type)&&t.push(o),(o.flowElements??[]).length&&n(o)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function wT(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 Nd(e){const t=[],n=e.rootElements??[],i=xT(e);for(const r of bT(e))i.has(r.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[r.id],params:{type:r.$type}});const o=n.find(r=>r.$type==="bpmn:Collaboration");if(o){const r=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of o.participants??[])vT(s)&&wT(r.get(Bd(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 _T(e){const{definitions:t,warnings:n}=await ga(e);return{issues:Nd(t),warnings:n}}const ET=.5,ST=8,RT=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),wa=e=>typeof e=="number"?e:Number(e??NaN),hl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function CT(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 r of["sourceRef","targetRef","attachedToRef","processRef","default"])t[r]!==void 0&&n.push(`${r}=${hl(t[r])}`);if(String(e.$type)==="bpmn:Group"){const r=t.categoryValueRef,a=Array.isArray(r)?r:r==null?[]:[r];n.push(`cat=[${a.map(s=>`${hl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(hl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function MT(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},o=a=>{const s=a;return s?[wa(s.x),wa(s.y),wa(s.width),wa(s.height)]:[]},r=a=>{if(Array.isArray(a))return a.forEach(r);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=hl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(d=>[wa(d.x),wa(d.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function wv(e){const t=MT(e),n=new Map,i=new Set,o=r=>{if(Array.isArray(r))return r.forEach(o);if(!r||typeof r!="object"||i.has(r))return;i.add(r);const a=r,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:")&&!RT.has(s)&&n.set(c,{type:s,props:CT(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")&&o(l)};return o(e),n}function _v(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function Ev(e,t,n={}){const i=n.moveTolerance??ET,o=wv(e),r=wv(t),a=[],s=[],c=[];for(const[l,u]of r){const p=o.get(l);if(!p){a.push(l);continue}(p.type!==u.type||p.props!==u.props||_v(p.geometry,u.geometry,i)||_v(p.label,u.label,n.labelTolerance??ST))&&c.push(l)}for(const l of o.keys())r.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function AT(e,t,n={}){const[i,o]=await Promise.all([ga(e),ga(t)]);return{...Ev(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function TT(e){return new Set([...e.added,...e.modified])}function Sv(e){return e.get("moddle").ids}function Rv(e,t,n){const i=Object.prototype.hasOwnProperty.call(e,"nextPrefixed"),o=e.nextPrefixed;e.nextPrefixed=t;try{return n()}finally{i?e.nextPrefixed=o:delete e.nextPrefixed}}function Cv(e,t){const n=Sv(e),i=n.nextPrefixed,o=[];return{value:Rv(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function Mv(e,t,n){const i=Sv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:Rv(i,function(l,u){const p=t[r++];return p!==void 0&&p.startsWith(l)&&!this.assigned(p)?(this.claim(p,u),a++,p):(s++,o.call(this,l,u))},n),fed:a,missed:s,remaining:Math.max(0,t.length-r)}}function PT(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Av(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>Id(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?Cv(e,r):{value:r(),generatedIds:void 0};if(!a.ok)return{status:"rejected",issues:a.issues};const{xml:c}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:c??"",findings:a.findings,stats:a.stats,...s?{generatedIds:s}:{}}}const ws=()=>typeof performance>"u"?Date.now():performance.now();function kT(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class $d extends Error{constructor(t,n){super(n),this.reason=t}}async function Tv(e,t,{expectedXml:n,i18n:i}){const o=ws(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(ws()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(ws()-o)};const a=e.get("commandStack"),s=hm(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=Mv(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const g=Id(e,d.ops,{...i?{i18n:i}:{}});if(!g.ok)throw new $d("rejected",`배치 ${f+1}/${t.length} — ${kT(g.issues)}`)})});if(p.missed||p.remaining)throw new $d("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof $d?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=gm(a,s);if(!l)try{const{xml:p}=await e.saveXML({format:!0});p!==n&&(l={reason:"xml"})}catch(p){l={reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}return l?(u&&a.undo(),{status:"diverged",...l,ms:Math.round(ws()-o)}):{status:"replayed",ms:Math.round(ws()-o)}}const OT=new Set(["lasso","lasso.selection","hand","hand.move"]),Pv=1e4,DT="bwl-edit-locked",kv=new WeakMap;function LT(e){const t=kv.get(e);if(t)return t;const n=e.get("eventBus"),i=e.get("dragging",!1);let o=!1,r=!1;n.on("drag.init",Pv,()=>{var s;if(o)return OT.has((s=i==null?void 0:i.context())==null?void 0:s.prefix)?void 0:!1}),n.on(["contextPad.open.allowed","contextPad.trigger","palette.trigger","element.dblclick"],Pv,()=>o?!1:void 0);const a={get locked(){return o},set(s){var l,u,p;if(s===o)return;o=s,e.get("canvas").getContainer().classList.toggle(DT,s);const c=e.get("keyboard",!1);s?(i==null||i.cancel(),(l=e.get("contextPad",!1))==null||l.close(),(u=e.get("popupMenu",!1))==null||u.close(),(p=e.get("directEditing",!1))==null||p.complete(),r=!!(c!=null&&c.getBinding()),c==null||c.unbind()):r&&(c.bind(),r=!1)}};return kv.set(e,a),a}const IT=Symbol("bpmn-editor"),Fd={geometry:[],semantic:[]};function BT(){const e=Se.ref(!1),t=Se.ref(!0),n=Se.ref(!1),i=Se.shallowRef(Fd),o=Se.shallowRef(void 0),r=Se.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=Fd;return}const m=ut(Ve(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:m,semantic:v?Nd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const m=p();if(!m||!a){r.value=void 0;return}const v=m.locales(),b={};for(const E of v)b[E]={untranslated:m.untranslatedCount(E),reviewRequested:m.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:m.getDisplayLocale()??a.designLocale,counts:b}}function f(){const m=p();m&&(m.configure(a),a&&s&&(s=m.setDisplayLocale(s)))}const g=()=>{l||(e.value=!0,u())};function h(m,v){LT(m).set(!v)}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function _(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(m){a=m,f(),d()},setDisplayLocale(m){var b;s=m;const v=(b=p())==null?void 0:b.setDisplayLocale(m);v&&(s=v),d()},setChangeScope(m){o.value=m===void 0?void 0:new Set(m)},requestFocus(m){if(!c)return;const v=c.get("elementRegistry").get(m);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(m){const v=c==null?void 0:c.get("elementRegistry").get(m),b=v==null?void 0:v.businessObject;if(!b)return;const E=typeof b.name=="string"&&b.name.trim()!==""?b.name:b.text;return{name:typeof E=="string"&&E.trim()!==""?E.trim():void 0,type:typeof b.$type=="string"?b.$type:""}},attach(m){c&&this.detach(),c=m,c.get("eventBus").on("commandStack.changed",g),t.value||h(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",g),c&&!t.value&&h(c,!0),c=void 0,i.value=Fd,o.value=void 0,r.value=void 0},setEditable(m){t.value=m,c&&h(c,m)},async applyAgentBatch(m,v){const b=y();n.value=!0;try{const E=await Av(b,m,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(m,v){const b=y(),E=e.value;n.value=!0,l=!0;try{const C=await Tv(b,m,{expectedXml:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return e.value=C.status==="replayed"?!1:E,C}finally{l=!1,n.value=!1,u()}},async importXml(m){const{warnings:v}=await y().importXML(m);return e.value=!1,o.value=void 0,u(),{warnings:cd(v)}},async saveXml(){const{xml:m}=await y().saveXML({format:!0});return e.value=!1,m??""},undo:()=>{var m;return(m=_())==null?void 0:m.undo()},redo:()=>{var m;return(m=_())==null?void 0:m.redo()},canUndo:()=>{var m;return((m=_())==null?void 0:m.canUndo())??!1},canRedo:()=>{var m;return((m=_())==null?void 0:m.canRedo())??!1}}}const NT=new RegExp("\\p{Script=Hangul}","u"),$T=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,FT=new RegExp("\\p{Script=Han}","u");function gl(e){const t=NT.test(e),n=$T.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:FT.test(e)?"han":"other"}}function Ov(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 Dv(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;if(!a||t.has(a))continue;t.add(a);const s=Pr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:$o(a).filter(l=>Mn(l))})}return n}const _s=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function jT(e,t={}){const n=Ov(e),i=Dv(e);let o;const r={},a=[],s=[],c=[];for(const h of i){const y=h.trs.filter(_=>(_.body??"")===h.name).map(Mn);if(y.length){const _=[...y].sort().join("+");r[_]=(r[_]??0)+1,o=o?new Set([...o].filter(m=>y.includes(m))):new Set(y)}else h.trs.some(_=>_.body)?a.push(_s(h)):c.push({e:h,inference:gl(h.name)});for(const _ of h.trs){const m=Mn(_),v=_.body??"",b=gl(v);b.locale&&b.locale!==m?s.push({..._s(h),locale:m,script:b.script}):m==="ko"&&b.script==="han"&&h.trs.some(E=>E!==_&&E.body===v)&&s.push({..._s(h),locale:m,script:"han"})}}const l=new Set(c.map(h=>h.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const h=l.size===1?[...l][0]:void 0;h&&o.has(h)?[u,p]=[h,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const d=n??u,f=[],g=[];for(const{e:h,inference:y}of c)y.locale?y.locale!==d&&f.push({..._s(h),locale:y.locale}):g.push({..._s(h),script:y.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:g,drift:a,matchedBy:r,scriptMismatch:s}}function HT(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Ov(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(Dv(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(d=>d.body))continue;const l=c.trs.find(d=>Mn(d)===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(Tr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Lv(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const jd=e=>Mn(e)||void 0,Iv=e=>e.body??"";function Bv(e){const t=new Map;for(const n of Lv(e)){const i=$o(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:jd(o),body:Iv(o)}))})}return t}const Nv=e=>JSON.stringify(e.map(t=>t.body).sort());class zT{constructor(){sn(this,"byId",new Map);sn(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};$v(this.byId,o,a),$v(this.byBodies,Nv(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Nv(t))??[]}}function $v(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function GT(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function Hd(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function VT(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const WT=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function UT(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Bv(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=GT(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(y=>y.doc===t.doc&&Hd(y.state,c)).sort((y,_)=>_.version-y.version).slice(0,1).map(y=>y.state)],["lineage",t.index.sameId(a).filter(y=>y.doc!==t.doc&&Hd(y.state,c)).map(y=>y.state)],["bodies",t.index.sameBodies(s.cells).filter(y=>!(y.doc===t.doc&&y.id===a)&&Hd(y.state,c)).map(y=>y.state)]].find(([,y])=>y.length);if(!p){if(!r(s))continue;for(const[y,_]of c)for(let m=0;m<_;m++)n.unresolved.push({...l,body:y,script:gl(y).script});continue}const[d,f]=p,g=f.map(y=>VT(s,y,c));if(g.some(y=>y.overflow)||new Set(g.map(WT)).size>1){n.ambiguous.push({...l,source:d});continue}const[h]=g;for(const y of h.stale)n.stale.push({...l,...y});h.cells.length&&n.restores.push({...l,source:d,cells:h.cells})}return n}function qT(e,t){if(!t.restores.length)return 0;const n=new Map(Lv(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=$o(r),s=new Set(a.map(jd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!jd(p)&&Iv(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Be(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function YT(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zd={exports:{}},Fv;function KT(){if(Fv)return zd.exports;Fv=1;var e=zd.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),o=2;i===1/0;o*=2)i=Math.log(Math.pow(2,t/o))/Math.log(n)*o;for(var r=i-Math.floor(i),a="",o=0;o<Math.floor(i);o++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(r){var c=Math.pow(n,r),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 o=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(r,c));return r[c]=a,c},r=o.hats={};return o.get=function(a){return o.hats[a]},o.set=function(a,s){return o.hats[a]=s,o},o.bits=t||128,o.base=n||16,o},zd.exports}var XT=KT(),ZT=YT(XT);function Qi(e){if(!(this instanceof Qi))return new Qi(e);e=e||[128,36,1],this._seed=e.length?ZT.rack(e[0],e[1],e[2]):e}Qi.prototype.next=function(e){return this._seed(e||!0)},Qi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Qi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Qi.prototype.assigned=function(e){return this._seed.get(e)||!1},Qi.prototype.unclaim=function(e){delete this._seed.hats[e]},Qi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const xn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};xn.td=xn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],xn.option=xn.optgroup=[1,'<select multiple="multiple">',"</select>"],xn.thead=xn.tbody=xn.colgroup=xn.caption=xn.tfoot=[1,"<table>","</table>"],xn.polyline=xn.ellipse=xn.polygon=xn.circle=xn.text=xn.line=xn.path=xn.rect=xn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ht(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[o,r,a]=Object.hasOwn(xn,i)?xn[i]:xn._default,s=t.createElement("div");for(s.innerHTML=r+e+a;o--;)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 JT(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 o=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function Yn(e,...t){const n=e.style;return V(t,function(i){i&&V(i,function(o,r){n[r]=o})}),e}function An(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const QT=Object.prototype.toString;function Mt(e){return new Wo(e)}function Wo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Wo.prototype.add=function(e){return this.list.add(e),this},Wo.prototype.remove=function(e){return QT.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Wo.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},Wo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Wo.prototype.array=function(){return Array.from(this.list)},Wo.prototype.has=Wo.prototype.contains=function(e){return this.list.contains(e)};function ml(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Nr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function eP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var yl={},jv;function tP(){if(jv)return yl;jv=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return yl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},yl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},yl}var Hv=tP(),nP=eP(Hv),Ue=JT({__proto__:null,default:nP},[Hv]),zv=["focus","blur"];function iP(e,t,n,i,o){return zv.indexOf(n)!==-1&&(o=!0),Ue.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Nr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function oP(e,t,n,i){return zv.indexOf(t)!==-1&&(i=!0),Ue.unbind(e,t,n,i)}var ri={bind:iP,unbind:oP};function Gd(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function Es(e,t){return t=t||document,t.querySelectorAll(e)}function eo(e){e.parentNode&&e.parentNode.removeChild(e)}function rP(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function aP(e,t){return t.appendChild(rP(e,t))}function nt(e,t){return aP(t,e),e}var Vd=2,Gv={"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":Vd,"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":Vd,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function sP(e,t){return Gv[t]?e.style[t]:e.getAttributeNS(null,t)}function Vv(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Gv[i];o?(o===Vd&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function cP(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Vv(e,o,t[o])}function Le(e,t,n){if(typeof t=="string")if(n!==void 0)Vv(e,t,n);else return sP(e,t);else cP(e,t);return e}const lP=Object.prototype.toString;function dt(e){return new Uo(e)}function Uo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Uo.prototype.add=function(e){return this.list.add(e),this},Uo.prototype.remove=function(e){return lP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Uo.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},Uo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Uo.prototype.array=function(){return Array.from(this.list)},Uo.prototype.has=Uo.prototype.contains=function(e){return this.list.contains(e)};function Ss(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Wd(e){return e.cloneNode(!0)}var Ud={svg:"http://www.w3.org/2000/svg"},Wv='<svg xmlns="'+Ud.svg+'"';function uP(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Ud.svg)===-1&&(e=Wv+e.substring(4)):(e=Wv+">"+e+"</svg>",t=!0);var n=pP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function pP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function He(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=uP(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ud.svg,e),t&&Le(n,t),n}var qd=null;function Uv(){return qd===null&&(qd=He("svg")),qd}function qv(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function dP(e,t,n,i,o,r){var a=Uv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return qv(a,e);case 6:return qv(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function Rs(e){return Uv().createSVGTransform()}var Yv=/([&<>]{1})/g,fP=/([&<>\n\r"]{1})/g,hP={"&":"&","<":"<",">":">",'"':"'"};function Yd(e,t){function n(i,o){return hP[o]||o}return e.replace(t,n)}function Kv(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Yd(e.textContent,Yv));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(o=e.attributes,n=0,i=o.length;n<i;++n)r=o.item(n),t.push(" ",r.name,'="',Yd(r.value,fP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Kv(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Yd(e.nodeValue,Yv),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function gP(e){for(var t=e.firstChild,n=[];t;)Kv(t,n),t=t.nextSibling;return n.join("")}function Xv(e,t){return gP(e)}function ln(e){var t=e.parentNode;return t&&t.removeChild(e),e}function mP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function yP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(mP(e,i))}function Cs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),yP(n,t)),n.consolidate()}const vP=/^class[ {]/;function xP(e){return vP.test(e.toString())}function Kd(e){return Array.isArray(e)}function Xd(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vl(...e){e.length===1&&Kd(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const bP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,wP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,_P=/\/\*([^*]*)\*\//m;function EP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(xP(e)?bP:wP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(_P);return(o&&o[1]||i).trim()})||[]}function Zv(e,t){const n=t||{get:function(v,b){if(i.push(v),b===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const b=i.join(" -> ");return i.length=0,new Error(b?`${v} (Resolving: ${b})`:v)};function c(v,b){if(!o[v]&&v.includes(".")){const E=v.split(".");let C=c(E.shift());for(;E.length;)C=C[E.shift()];return C}if(Xd(r,v))return r[v];if(Xd(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,b)}function l(v,b){if(typeof b>"u"&&(b={}),typeof v!="function")if(Kd(v))v=vl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const C=(v.$inject||EP(v)).map(I=>Xd(b,I)?b[I]:c(I));return{fn:v,dependencies:C}}function u(v){const{fn:b,dependencies:E}=l(v),C=Function.prototype.bind.call(b,null,...E);return new C}function p(v,b,E){const{fn:C,dependencies:I}=l(v,E);return C.apply(b,I)}function d(v){return vl(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),C=Object.create(null),I=[],k=[],T=[];let F,z,G,ne;for(let re in o)F=o[re],b.indexOf(re)!==-1&&(F[2]==="private"?(z=I.indexOf(F[3]),z===-1?(G=F[3].createChild([],b),ne=d(G),I.push(F[3]),k.push(G),T.push(ne),E[re]=[ne,re,"private",G]):E[re]=[T[z],re,"private",k[z]]):E[re]=[F[2],F[1]],C[re]=!0),(F[2]==="factory"||F[2]==="type")&&F[1].$scope&&b.forEach(K=>{F[1].$scope.indexOf(K)!==-1&&(E[re]=[F[2],F[1]],C[K]=!0)});b.forEach(re=>{if(!C[re])throw new Error('No provider for "'+re+'". Cannot use provider from the parent!')}),v.unshift(E)}return new Zv(v,a)}const g={factory:p,type:u,value:function(v){return v}};function h(v,b){const E=v.__init__||[];return function(){E.forEach(C=>{typeof C=="string"?b.get(C):b.invoke(C)})}}function y(v){const b=v.__exports__;if(b){const E=v.__modules__,C=Object.keys(v).reduce((z,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&(z[G]=v[G]),z),Object.create(null)),I=(E||[]).concat(C),k=f(I),T=vl(function(z){return k.get(z)});b.forEach(function(z){o[z]=[T,z,"private",k]});const F=(v.__init__||[]).slice();return F.unshift(function(){k.init()}),v=Object.assign({},v,{__init__:F}),h(v,k)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const C=v[E];if(C[2]==="private"){o[E]=C;return}const I=C[0],k=C[1];o[E]=[g[I],SP(I,k),I]}),h(v,a)}function _(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(_,v),v.indexOf(b)!==-1)?v:v.concat(b)}function m(v){const b=v.reduce(_,[]).map(y);let E=!1;return function(){E||(E=!0,b.forEach(C=>C()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=f,this.init=m(e)}function SP(e,t){return e!=="value"&&Kd(t)&&(t=vl(t.slice())),t}var RP=1e3;function xo(e,t){var n=this;t=t||RP,e.on(["render.shape","render.connection"],t,function(i,o){var r=i.type,a=o.element,s=o.gfx,c=o.attrs;if(n.canRender(a))return r==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,o){if(n.canRender(o))return i.type==="render.getShapePath"?n.getShapePath(o):n.getConnectionPath(o)})}xo.prototype.canRender=function(e){},xo.prototype.drawShape=function(e,t){},xo.prototype.drawConnection=function(e,t){},xo.prototype.getShapePath=function(e){},xo.prototype.getConnectionPath=function(e){};function $r(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function CP(e){return["M",e.x,e.y]}function Zd(e){return["L",e.x,e.y]}function MP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function AP(e,t){const n=e.length,i=[CP(e[0])];for(let o=1;o<n;o++){const r=e[o-1],a=e[o],s=e[o+1];if(!s||!t){i.push(Zd(a));continue}const c=Math.min(t,Jd(a.x-r.x,a.y-r.y),Jd(s.x-a.x,s.y-a.y));if(!c){i.push(Zd(a));continue}const l=xl(a,r,c),u=xl(a,r,c*.5),p=xl(a,s,c),d=xl(a,s,c*.5);i.push(Zd(l)),i.push(MP(u,d,p))}return i}function xl(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Jd(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Jd(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ms(e,t,n){Qe(t)&&(n=t,t=null),t||(t={});const i=He("path",t);return Qe(n)&&(i.dataset.cornerRadius=String(n)),Qd(i,e)}function Qd(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Le(e,{d:$r(AP(t,n))}),e}function bl(e){var t=new Set(e);return lt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Fr(e,t,n){n=n||0,Je(e)||(e=[e]),V(e,function(i,o){var r=t(i,o,n);Je(r)&&r.length&&Fr(r,t,n+1)})}function ef(e,t,n){var i=new Set,o=new Set;return Fr(e,function(r,a,s){i.add(r);var c=r.children;if(c&&!o.has(c))return o.add(c),c}),Array.from(i)}function As(e,t){return ef(e)}function TP(e,t,n){Ar(t)&&(t=!0),vn(t)&&(n=t,t=!0),n=n||{};var i=Ts(n.allShapes),o=Ts(n.allConnections),r=Ts(n.enclosedElements),a=Ts(n.enclosedConnections),s=Ts(n.topLevel,t&&pa(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]=r[u.id]=u),o[u.id]=u}function l(u){if(r[u.id]=u,u.waypoints)a[u.id]=o[u.id]=u;else return i[u.id]=u,V(u.incoming,c),V(u.outgoing,c),u.children}return Fr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function un(e,t){t=!!t,Je(e)||(e=[e]);var n,i,o,r;return V(e,function(a){var s=a;a.waypoints&&!t&&(s=un(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>o||o===void 0)&&(o=c+p),(l+u>r||r===void 0)&&(r=l+u)}),{x:n,y:i,height:r-i,width:o-n}}function _a(e,t){var n={};return V(e,function(i){var o=i;o.waypoints&&(o=un(o)),!Qe(t.y)&&o.x>t.x&&(n[i.id]=i),!Qe(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Qe(t.width)&&Qe(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Qe(t.width)||!Qe(t.height))&&(n[i.id]=i)}),n}function Jv(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Qv(e){return!!(e&&e.isFrame)}function Ts(e,t){return Y({},e||{},t||{})}var PP=1;function qo(e,t){xo.call(this,e,PP),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})}Be(qo,xo),qo.prototype.canRender=function(){return!0},qo.prototype.drawShape=function(t,n,i){var o=He("rect");return Le(o,{x:0,y:0,width:n.width||0,height:n.height||0}),Qv(n)?Le(o,Y({},this.FRAME_STYLE,i||{})):Le(o,Y({},this.SHAPE_STYLE,i||{})),nt(t,o),o},qo.prototype.drawConnection=function(t,n,i){var o=Ms(n.waypoints,Y({},this.CONNECTION_STYLE,i||{}));return nt(t,o),o},qo.prototype.getShapePath=function(t){var n=t.x,i=t.y,o=t.width,r=t.height,a=[["M",n,i],["l",o,0],["l",0,r],["l",-o,0],["z"]];return $r(a)},qo.prototype.getConnectionPath=function(t){var n=t.waypoints,i,o,r=[];for(i=0;o=n[i];i++)o=o.original||o,r.push([i===0?"M":"L",o.x,o.y]);return $r(r)},qo.$inject=["eventBus","styles"];function kP(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,o){var r=this.style(i,o);return Y(r,{class:n})},this.style=function(n,i){!Je(n)&&!i&&(i=n,n=[]);var o=oi(n,function(r,a){return Y(r,e[a]||{})},{});return i?Y(o,i):o},this.computeStyle=function(n,i,o){return Je(i)||(o=i,i=[]),t.style(i||[],Y({},o,n||{}))}}const OP={__init__:["defaultRenderer"],defaultRenderer:["type",qo],styles:["type",kP]};function en(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function rn(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 tf(e,t){return!e||!t?-1:e.indexOf(t)}function Ps(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nf(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var o=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),r=Ps(e,t);return Math.abs(o/r)<=i}var DP=2;function bo(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(LP(o,n))return r;return!1}function LP(e,t){const n=t[0];return Bo(t,function(i){return Math.abs(n[e]-i[e])<=DP})}function ex(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 of(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var IP=/,?([a-z]),?/gi,tx=parseFloat,pn=Math,Yo=pn.PI,to=pn.min,no=pn.max,nx=pn.pow,Ko=pn.abs,BP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,NP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,ix=Array.isArray||function(e){return e instanceof Array};function $P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function FP(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 jP(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),o=t.cache=t.cache||{},r=t.count=t.count||[];return $P(o,i)?(FP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function HP(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(BP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(NP,function(c,l){l&&a.push(+l)}),s=="m"&&a.length>2&&(n.push([o,...a.splice(0,2)]),s="l",o=o=="m"?"l":"L");a.length>=t[s]&&(n.push([o,...a.splice(0,t[s])]),!!t[s]););}),n.toString=af,n}function zP(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 GP(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 rf(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 af(){return this.join(",").replace(IP,"$1")}function VP(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var o=e[n],r=t[n]=new Array(o.length),a=0,s=o.length;a<s;a++)r[a]=o[a];return t.toString=af,t}function ox(e,t,n,i,o,r,a,s,c){var l=1-c,u=nx(l,3),p=nx(l,2),d=c*c,f=d*c,g=u*e+p*3*c*n+l*3*c*c*o+f*a,h=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:wl(g),y:wl(h)}}function rx(e){var t=XP(...e);return rf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Xo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function WP(e,t){return e=rf(e),t=rf(t),Xo(t,e.x,e.y)||Xo(t,e.x2,e.y)||Xo(t,e.x,e.y2)||Xo(t,e.x2,e.y2)||Xo(e,t.x,t.y)||Xo(e,t.x2,t.y)||Xo(e,t.x,t.y2)||Xo(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 ax(e,t,n,i,o){var r=-3*t+9*n-9*i+3*o,a=e*r+6*t-12*n+6*i;return e*a-3*t+3*n}function sx(e,t,n,i,o,r,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],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,g=0;g<u;g++){var h=l*p[g]+l,y=ax(h,e,n,o,a),_=ax(h,t,i,r,s),m=y*y+_*_;f+=d[g]*pn.sqrt(m)}return l*f}function UP(e,t,n,i,o,r,a,s){if(!(no(e,n)<to(o,a)||to(e,n)>no(o,a)||no(t,i)<to(r,s)||to(t,i)>no(r,s))){var c=(e*i-t*n)*(o-a)-(e-n)*(o*s-r*a),l=(e*i-t*n)*(r-s)-(t-i)*(o*s-r*a),u=(e-n)*(r-s)-(t-i)*(o-a);if(u){var p=wl(c/u),d=wl(l/u),f=+p.toFixed(2),g=+d.toFixed(2);if(!(f<+to(e,n).toFixed(2)||f>+no(e,n).toFixed(2)||f<+to(o,a).toFixed(2)||f>+no(o,a).toFixed(2)||g<+to(t,i).toFixed(2)||g>+no(t,i).toFixed(2)||g<+to(r,s).toFixed(2)||g>+no(r,s).toFixed(2)))return{x:p,y:d}}}}function wl(e){return Math.round(e*1e11)/1e11}function qP(e,t,n){var i=rx(e),o=rx(t);if(!WP(i,o))return[];var r=sx(...e),a=sx(...t),s=lx(e)?1:~~(r/5)||1,c=lx(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,g;for(f=0;f<s+1;f++){var h=ox(...e,f/s);l[f]={x:h.x,y:h.y,t:f/s}}for(f=0;f<c+1;f++)h=ox(...t,f/c),u[f]={x:h.x,y:h.y,t:f/c};for(f=0;f<s;f++)for(g=0;g<c;g++){var y=l[f],_=l[f+1],m=u[g],v=u[g+1],b=Ko(_.x-y.x)<.01?"y":"x",E=Ko(v.x-m.x)<.01?"y":"x",C=UP(y.x,y.y,_.x,_.y,m.x,m.y,v.x,v.y),I;if(C){if(I=C.x.toFixed(9)+"#"+C.y.toFixed(9),p[I])continue;p[I]=!0;var k=y.t+Ko((C[b]-y[b])/(_[b]-y[b]))*(_.t-y.t),T=m.t+Ko((C[E]-m[E])/(v[E]-m[E]))*(v.t-m.t);k>=0&&k<=1&&T>=0&&T<=1&&d.push({x:C.x,y:C.y,t1:k,t2:T})}}return d}function cx(e,t,n){e=dx(e),t=dx(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];if(y[0]=="M")i=s=y[1],o=c=y[2];else{y[0]=="C"?(p=[i,o,...y.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,m=t.length;_<m;_++){var v=t[_];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(d=[r,a,...v.slice(1)],r=d[6],a=d[7]):(d=[r,a,r,a,l,u,l,u],r=l,a=u);var b=qP(p,d);{for(var E=0,C=b.length;E<C;E++)b[E].segment1=g,b[E].segment2=_,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function YP(e){return ix(e)&&ix(e[0])}function KP(e){if(zP(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=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":o=+l[1]+n,r=+l[2]+i;default:for(var d=1,f=l.length;d<f;d++)c[d]=+l[d]+(d%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=+o,i=+r;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":o=c[c.length-2],r=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=af,t}function lx(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function _l(e,t,n,i){return[e,t,n,i,n,i]}function ux(e,t,n,i,o,r){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*o+s*n,a*r+s*i,o,r]}function px(e,t,n,i,o,r,a,s,c,l){var u=Yo*120/180,p=Yo/180*(+o||0),d=[],f,g=jP(function($,M,R){var U=$*pn.cos(R)-M*pn.sin(R),X=$*pn.sin(R)+M*pn.cos(R);return{x:U,y:X}});if(l)I=l[0],k=l[1],E=l[2],C=l[3];else{f=g(e,t,-p),e=f.x,t=f.y,f=g(s,c,-p),s=f.x,c=f.y;var h=(e-s)/2,y=(t-c)/2,_=h*h/(n*n)+y*y/(i*i);_>1&&(_=pn.sqrt(_),n=_*n,i=_*i);var m=n*n,v=i*i,b=(r==a?-1:1)*pn.sqrt(Ko((m*v-m*y*y-v*h*h)/(m*y*y+v*h*h))),E=b*n*y/i+(e+s)/2,C=b*-i*h/n+(t+c)/2,I=pn.asin(((t-C)/i).toFixed(9)),k=pn.asin(((c-C)/i).toFixed(9));I=e<E?Yo-I:I,k=s<E?Yo-k:k,I<0&&(I=Yo*2+I),k<0&&(k=Yo*2+k),a&&I>k&&(I=I-Yo*2),!a&&k>I&&(k=k-Yo*2)}var T=k-I;if(Ko(T)>u){var F=k,z=s,G=c;k=I+u*(a&&k>I?1:-1),s=E+n*pn.cos(k),c=C+i*pn.sin(k),d=px(s,c,n,i,o,0,a,z,G,[k,F,E,C])}T=k-I;var ne=pn.cos(I),re=pn.sin(I),K=pn.cos(k),xe=pn.sin(k),de=pn.tan(T/4),we=4/3*n*de,he=4/3*i*de,W=[e,t],le=[e+we*re,t-he*ne],q=[s+we*xe,c-he*K],ee=[s,c];if(le[0]=2*W[0]-le[0],le[1]=2*W[1]-le[1],l)return[le,q,ee].concat(d);d=[le,q,ee].concat(d).join().split(",");for(var me=[],Re=0,ze=d.length;Re<ze;Re++)me[Re]=Re%2?g(d[Re-1],d[Re],p).y:g(d[Re],d[Re+1],p).x;return me}function XP(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,g,h,y,_,m=0;m<2;++m){if(m==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,d=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,d=3*i-3*t),Ko(u)<1e-12){if(Ko(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}y=p*p-4*d*u,_=pn.sqrt(y),!(y<0)&&(g=(-p+_)/(2*u),0<g&&g<1&&c.push(g),h=(-p-_)/(2*u),0<h&&h<1&&c.push(h))}for(var v=c.length,b=v,E;v--;)f=c[v],E=1-f,l[0][v]=E*E*E*e+3*E*E*f*n+3*E*f*f*o+f*f*f*a,l[1][v]=E*E*E*t+3*E*E*f*i+3*E*f*f*r+f*f*f*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:to(...l[0]),y0:to(...l[1]),x1:no(...l[0]),y1:no(...l[1])}}function dx(e){if(YP(e)||(e=HP(e)),GP(e))return e;for(var t=VP(KP(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,g){var h,y;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C",...px(f.x,f.y,...d.slice(1))];break;case"S":g=="C"||g=="S"?(h=f.x*2-f.bx,y=f.y*2-f.by):(h=f.x,y=f.y),d=["C",h,y,...d.slice(1)];break;case"T":g=="Q"||g=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C",...ux(f.x,f.y,f.qx,f.qy,d[1],d[2])];break;case"Q":f.qx=d[1],f.qy=d[2],d=["C",...ux(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",..._l(f.x,f.y,d[1],d[2])];break;case"H":d=["C",..._l(f.x,f.y,d[1],f.y)];break;case"V":d=["C",..._l(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",..._l(f.x,f.y,f.X,f.Y)];break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var g=d[f];g.length;)r[f]="A",d.splice(f++,0,["C",...g.splice(0,6)]);d.splice(f,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=tx(u[p-4])||n.x,n.by=tx(u[p-3])||n.y}return t}function Dt(e){return vn(e)&&ii(e,"waypoints")}function at(e){return vn(e)&&ii(e,"labelTarget")}function ZP(e){return vn(e)&&la(e.parent)}function fx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function wo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ye(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function El(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function JP(e){return wo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function QP(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var d=t[p-1];if(d){var f=l[l.length-1],g=f&&f.endLength||0,h=nk(d,u);l.push({start:d,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),o=i/2,r=0,a=n[r];a.endLength<o;)a=n[++r];var s=(o-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 et(e){return Dt(e)?QP(e):JP(e)}function Ln(e,t,n){n=n||0,vn(n)||(n={x:n,y:n});var i=Ye(e),o=Ye(t),r=i.bottom+n.y<=o.top,a=i.left-n.x>=o.right,s=i.top-n.y>=o.bottom,c=i.right+n.x<=o.left,l=r?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function ks(e,t,n){var i=ek(e,t);return i.length===1||i.length===2&&Ps(i[0],i[1])<1?wo(i[0]):i.length>1?(i=Yi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),wo(i[n?0:i.length-1])):null}function ek(e,t){return cx(e,t)}function tk(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ps(n,o)===0||nf(i,o,n)?e.splice(t,1):t++;return e}function nk(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Sl(e,t){return Math.round(e*t)/t}function hx(e){return Qe(e)?e+"px":e}function ik(e){for(;e.parent;)e=e.parent;return e}function ok(e){e=Y({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Yn(n,{position:"relative",overflow:"hidden",width:hx(e.width),height:hx(e.height)}),t.appendChild(n),n}function gx(e,t,n){const i=He("g");dt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const rk="base",mx=0,ak=1,sk={shape:["x","y","width","height"],connection:["waypoints"]};function tt(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||{})}tt.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],tt.prototype._init=function(e){const t=this._eventBus,n=this._container=ok(e),i=this._svg=He("svg");Le(i,{width:"100%",height:"100%"}),An(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,r=>{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")}),nt(n,i);const o=this._viewport=gx(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Hp(this._viewboxChanged,300)),this._restoreFocus=Hp(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:o})}),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)},tt.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},tt.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},tt.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Jv(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},tt.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},tt.prototype.restoreFocus=function(){this._restoreFocus()},tt.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},tt.prototype.isFocused=function(){return this._focused},tt.prototype.getDefaultLayer=function(){return this.getLayer(rk,mx)},tt.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},tt.prototype._getChildIndex=function(e){return oi(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},tt.prototype._createLayer=function(e,t){typeof t>"u"&&(t=ak);const n=this._getChildIndex(t);return{group:gx(this._viewport,"layer-"+e,n),index:t,visible:!0}},tt.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,o=t.index;if(t.visible)return i;const r=this._getChildIndex(o);return n.insertBefore(i,n.childNodes[r]||null),t.visible=!0,i},tt.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&&(ln(n),t.visible=!1),n},tt.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],ln(t.group))},tt.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},tt.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(ik(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},tt.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},tt.prototype._findPlaneForRoot=function(e){return Bt(this._planes,function(t){return t.rootElement===e})},tt.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},tt.prototype._resolveElements=function(e){return Je(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},tt.prototype.getContainer=function(){return this._container},tt.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&&(V([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),dt(o).add(t)):(e.markers.delete(t),dt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},tt.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},tt.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},tt.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},tt.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},tt.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},tt.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,mx);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},tt.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},tt.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},tt.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)},tt.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})},tt.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})},tt.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=sk[e];if(!Bo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},tt.prototype._setParent=function(e,t,n){rn(t.children,e,n),e.parent=t},tt.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const o=this._eventBus,r=this._graphicsFactory;this._ensureValid(e,t),o.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=r.create(e,t,i);return this._elementRegistry.add(t,a),r.update(e,t,a),o.fire(e+".added",{element:t,gfx:a}),t},tt.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},tt.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},tt.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,o=this._eventBus;if(e=n.get(e.id||e),!!e)return o.fire(t+".remove",{element:e}),i.remove(e),en(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},tt.prototype.removeShape=function(e){return this._removeElement(e,"shape")},tt.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},tt.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},tt.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},tt.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},tt.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,o,r,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);Cs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Cs(t),o=a?a.matrix:dP(),s=Sl(o.a,1e3),c=Sl(-o.e||0,1e3),l=Sl(-o.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},tt.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=Y({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),yx(t,n)}),{x:n.e,y:n.f}},tt.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const o=this.findRoot(i);if(!o)return;o!==this.getRootElement()&&this.setRootElement(o);const r=i.filter(g=>g!=o);if(!r.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=un(r),s=Ye(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 d=Ye(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-d.right),h=Math.min(0,s.left-d.left),y=Math.max(0,s.bottom-d.bottom),_=Math.min(0,s.top-d.top);u=g||h,p=y||_}this.scroll({dx:-u*l,dy:-p*l})},tt.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)}),Sl(i.a,1e3)};function yx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}tt.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let o,r;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?r={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(o=Math.min(1,n.width/i.width,n.height/i.height),r={x:i.x+(e?i.width/2-n.width/o/2:0),y:i.y+(e?i.height/2-n.height/o/2:0),width:n.width/o,height:n.height/o}),this.viewbox(r),this.viewbox(!1).scale},tt.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,o=n.createSVGMatrix(),r=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const p=c.a;return t?(a=Y(r,t),s=a.matrixTransform(c.inverse()),l=o.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),u=c.multiply(l)):u=o.scale(e),yx(this._viewport,u),u},tt.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},tt.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,o=n.y*t.scale-t.y*t.scale,r=n.width*t.scale,a=n.height*t.scale;return{x:i,y:o,width:r,height:a}},tt.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ea="data-element-id";function yi(e){this._elements={},this._eventBus=e}yi.$inject=["eventBus"],yi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Le(t,Ea,i),n&&Le(n,Ea,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},yi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Le(i.gfx,Ea,""),i.secondaryGfx&&Le(i.secondaryGfx,Ea,""),delete t[n])},yi.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)},yi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&Le(t,Ea,i),t},yi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Le(e,Ea);var n=this._elements[t];return n&&n.element},yi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},yi.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var o=n[i],r=t[o],a=r.element,s=r.gfx;if(e(a,s))return a}},yi.prototype.getAll=function(){return this.filter(function(e){return e})},yi.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],o=i.element,r=i.gfx;return e(o,r)})},yi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},yi.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 ck(e,t,n,i){var o=n.inverse;return Object.defineProperty(e,"remove",{value:function(r){var a=this.indexOf(r);return a!==-1&&(this.splice(a,1),t.unset(r,o,i)),r}}),Object.defineProperty(e,"contains",{value:function(r){return this.indexOf(r)!==-1}}),Object.defineProperty(e,"add",{value:function(r,a){var s=this.indexOf(r);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,r),s===-1&&t.set(r,o,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function lk(e){return e.__refs_collection===!0}function uk(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function vx(e,t,n){var i=ck(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(o){e.set(o,t.inverse,n)})}function pk(e,t,n){var i=t.inverse,o=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return o},set:function(r){if(r!==o){var a=o;o=null,a&&e.unset(a,i,n),o=r,e.set(o,i,n)}}})}function Ei(e,t){if(!(this instanceof Ei))return new Ei(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ei.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?vx(this,t,e):pk(this,t,e)},Ei.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return lk(n)||vx(this,t,e),n},Ei.prototype.ensureBound=function(e,t){uk(e,t)||this.bind(e,t)},Ei.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ei.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var sf=new Ei({name:"children",enumerable:!0,collection:!0},{name:"parent"}),xx=new Ei({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),bx=new Ei({name:"attachers",collection:!0},{name:"host"}),wx=new Ei({name:"outgoing",collection:!0},{name:"source"}),_x=new Ei({name:"incoming",collection:!0},{name:"target"});function Sa(){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)}}),sf.bind(this,"parent"),xx.bind(this,"labels"),wx.bind(this,"outgoing"),_x.bind(this,"incoming")}function Os(){Sa.call(this),sf.bind(this,"children"),bx.bind(this,"host"),bx.bind(this,"attachers")}Be(Os,Sa);function Ex(){Sa.call(this),sf.bind(this,"children")}Be(Ex,Os);function Sx(){Os.call(this),xx.bind(this,"labelTarget")}Be(Sx,Os);function Rx(){Sa.call(this),wx.bind(this,"source"),_x.bind(this,"target")}Be(Rx,Sa);var dk={connection:Rx,shape:Os,label:Sx,root:Ex};function fk(e,t){var n=dk[e];if(!n)throw new Error("unknown type: <"+e+">");return Y(new n,t)}function hk(e){return e instanceof Sa}function _o(){this._uid=12}_o.prototype.createRoot=function(e){return this.create("root",e)},_o.prototype.createLabel=function(e){return this.create("label",e)},_o.prototype.createShape=function(e){return this.create("shape",e)},_o.prototype.createConnection=function(e){return this.create("connection",e)},_o.prototype.create=function(e,t){return t=Y({},t||{}),t.id||(t.id=e+"_"+this._uid++),fk(e,t)};var Rl="__fn",Cx=1e3,gk=Array.prototype.slice;function ai(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ai.prototype.on=function(e,t,n,i){if(e=Je(e)?e:[e],En(t)&&(i=n,n=t,t=Cx),!Qe(t))throw new Error("priority must be a number");var o=n;i&&(o=Zn(n,i),o[Rl]=n[Rl]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ai.prototype.once=function(e,t,n,i){var o=this;if(En(t)&&(i=n,n=t,t=Cx),!Qe(t))throw new Error("priority must be a number");function r(){r.__isTomb=!0;var a=n.apply(i,arguments);return o.off(e,r),a}r[Rl]=n,this.on(e,t,r)},ai.prototype.off=function(e,t){e=Je(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ai.prototype.createEvent=function(e){var t=new Ds;return t.init(e),t},ai.prototype.fire=function(e,t){var n,i,o,r;if(r=gk.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 Ds?n=t:n=this.createEvent(t),r[0]=n;var a=n.type;e!==a&&(n.type=e);try{o=this._invokeListeners(n,r,i)}finally{e!==a&&(n.type=a)}return o===void 0&&n.defaultPrevented&&(o=!1),o}},ai.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ai.prototype._destroy=function(){this._listeners={}},ai.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ai.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=mk(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(o){if(!this.handleError(o))throw console.error("unhandled error in event listener",o),o}return i},ai.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},ai.prototype._getListeners=function(e){return this._listeners[e]},ai.prototype._setListeners=function(e,t){this._listeners[e]=t},ai.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,o,r;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,r=n.callback,(r===t||r[Rl]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function Ds(){}Ds.prototype.stopPropagation=function(){this.cancelBubble=!0},Ds.prototype.preventDefault=function(){this.defaultPrevented=!0},Ds.prototype.init=function(e){Y(this,e||{})};function mk(e,t){return e.apply(null,t)}function Zo(e){return e.childNodes[0]}function yk(e){return e.parentNode.childNodes[1]}function Cl(e,t,n,i,o){var r=Rs();r.setTranslate(t,n);var a=Rs();a.setRotate(i||0,0,0);var s=Rs();s.setScale(1,1),Cs(e,[r,a,s])}function In(e,t,n){var i=Rs();i.setTranslate(t,n),Cs(e,i)}function Mx(e,t){var n=Rs();n.setRotate(t,0,0),Cs(e,n)}function vi(e,t){this._eventBus=e,this._elementRegistry=t}vi.$inject=["eventBus","elementRegistry"],vi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=yk(t),n||(n=He("g"),dt(n).add("djs-children"),nt(t.parentNode,n))):n=t,n},vi.prototype._clear=function(e){var t=Zo(e);return ml(t),t},vi.prototype._createContainer=function(e,t,n,i){var o=He("g");dt(o).add("djs-group"),typeof n<"u"?vk(o,t,t.childNodes[n]):nt(t,o);var r=He("g");dt(r).add("djs-element"),dt(r).add("djs-"+e),i&&dt(r).add("djs-frame"),nt(o,r);var a=He("g");return dt(a).add("djs-visual"),nt(r,a),r},vi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Qv(t))},vi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=oi(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),V(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;V(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},vi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},vi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},vi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},vi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},vi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),In(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Le(n,"display","none"):Le(n,"display","block")}},vi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);ln(t.parentNode)};function vk(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const xk={__depends__:[OP],__init__:["canvas"],canvas:["type",tt],elementRegistry:["type",yi],elementFactory:["type",_o],eventBus:["type",ai],graphicsFactory:["type",vi]};function bk(e){var t=new Zv(e);return t.init(),t}function wk(e){e=e||{};var t={config:["value",e]},n=[t,xk].concat(e.modules||[]);return bk(n)}function Jo(e,t){this._injector=t||wk(e),this.get("eventBus").fire("diagram.init")}Jo.prototype.get=function(e,t){return this._injector.get(e,t)},Jo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Jo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Jo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Vn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Qn(e,t){return e.$instanceOf(t)}function _k(e){return Bt(e.rootElements,function(t){return Qn(t,"bpmn:Process")||Qn(t,"bpmn:Collaboration")})}function Ek(e){var t={},n=[],i={};function o(q,ee){return function(me){q(me,ee)}}function r(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,ee){var me=q.gfx;if(me)throw new Error(`already rendered ${Vn(q)}`);return e.element(q,i[q.id],ee)}function c(q,ee){return e.root(q,i[q.id],ee)}function l(q,ee){try{var me=i[q.id]&&s(q,ee);return r(q),me}catch(Re){u(Re.message,{element:q,error:Re}),console.error(`failed to import ${Vn(q)}`,Re)}}function u(q,ee){e.error(q,ee)}var p=this.registerDi=function(ee){var me=ee.bpmnElement;me?i[me.id]?u(`multiple DI elements defined for ${Vn(me)}`,{element:me}):i[me.id]=ee:u(`no bpmnElement referenced in ${Vn(ee)}`,{element:ee})};function d(q){f(q.plane)}function f(q){p(q),V(q.planeElement,g)}function g(q){p(q)}this.handleDefinitions=function(ee,me){var Re=ee.diagrams;if(me&&Re.indexOf(me)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!me&&Re&&Re.length&&(me=Re[0]),!me)throw new Error("no diagram to display");i={},d(me);var ze=me.plane;if(!ze)throw new Error(`no plane for ${Vn(me)}`);var $=ze.bpmnElement;if(!$)if($=_k(ee),$)u(`correcting missing bpmnElement on ${Vn(ze)} to ${Vn($)}`),ze.bpmnElement=$,p(ze);else throw new Error("no process or collaboration to display");var M=c($,ze);if(Qn($,"bpmn:Process")||Qn($,"bpmn:SubProcess"))y($,M);else if(Qn($,"bpmn:Collaboration"))W($,M),_(ee.rootElements,M);else throw new Error(`unsupported bpmnElement for ${Vn(ze)}: ${Vn($)}`);h(n)};var h=this.handleDeferred=function(){for(var ee;n.length;)ee=n.shift(),ee()};function y(q,ee){de(q,ee),T(q.ioSpecification,ee),k(q.artifacts,ee),r(q)}function _(q,ee){var me=lt(q,function(Re){return!a(Re)&&Qn(Re,"bpmn:Process")&&Re.laneSets});me.forEach(o(y,ee))}function m(q,ee){l(q,ee)}function v(q,ee){V(q,o(m,ee))}function b(q,ee){l(q,ee)}function E(q,ee){l(q,ee)}function C(q,ee){l(q,ee)}function I(q,ee){l(q,ee)}function k(q,ee){V(q,function(me){Qn(me,"bpmn:Association")?n.push(function(){I(me,ee)}):I(me,ee)})}function T(q,ee){q&&(V(q.dataInputs,o(E,ee)),V(q.dataOutputs,o(C,ee)))}var F=this.handleSubProcess=function(ee,me){de(ee,me),k(ee.artifacts,me)};function z(q,ee){var me=l(q,ee);Qn(q,"bpmn:SubProcess")&&F(q,me||ee),Qn(q,"bpmn:Activity")&&T(q.ioSpecification,ee),n.push(function(){V(q.dataInputAssociations,o(b,ee)),V(q.dataOutputAssociations,o(b,ee))})}function G(q,ee){l(q,ee)}function ne(q,ee){l(q,ee)}function re(q,ee){n.push(function(){var me=l(q,ee);q.childLaneSet&&K(q.childLaneSet,me||ee),le(q)})}function K(q,ee){V(q.lanes,o(re,ee))}function xe(q,ee){V(q,o(K,ee))}function de(q,ee){we(q.flowElements,ee),q.laneSets&&xe(q.laneSets,ee)}function we(q,ee){V(q,function(me){Qn(me,"bpmn:SequenceFlow")?n.push(function(){G(me,ee)}):Qn(me,"bpmn:BoundaryEvent")?n.unshift(function(){z(me,ee)}):Qn(me,"bpmn:FlowNode")?z(me,ee):Qn(me,"bpmn:DataObject")||(Qn(me,"bpmn:DataStoreReference")||Qn(me,"bpmn:DataObjectReference")?ne(me,ee):u(`unrecognized flowElement ${Vn(me)} in context ${Vn(ee&&ee.businessObject)}`,{element:me,context:ee}))})}function he(q,ee){var me=l(q,ee),Re=q.processRef;Re&&y(Re,me||ee)}function W(q,ee){V(q.participants,o(he,ee)),n.push(function(){v(q.messageFlows,ee)}),k(q.artifacts,ee)}function le(q){V(q.flowNodeRef,function(ee){var me=ee.get("lanes");me&&me.push(q)})}}function Ax(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,y){return i.add(h,y)},element:function(h,y,_){return i.add(h,y,_)},error:function(h,y){s.push({message:h,context:y})}},d=new Ek(p);u=u||l.diagrams&&l.diagrams[0];var f=Sk(l,u);if(!f)throw new Error("no diagram to display");V(f,function(h){d.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(g+"_plane")||r.findRoot(g))}return new Promise(function(l,u){try{return i=e.get("bpmnImporter"),o=e.get("eventBus"),r=e.get("canvas"),o.fire("import.render.start",{definitions:t}),c(t,n),o.fire("import.render.complete",{error:a,warnings:s}),l({warnings:s})}catch(p){return p.warnings=s,u(p)}})}function Sk(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=Rk(n));var o;A(i,"bpmn:Collaboration")?o=i:o=Bt(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return Bt(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Hn(o.participants,function(l){return l.processRef}),r.push(o));var a=Tx(r),s=[t],c=[n];return V(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 Tx(e){var t=[];return V(e,function(n){n&&(t.push(n),t=t.concat(Tx(n.flowElements)))}),t}function Rk(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var Ck='<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>',Px=Ck,kx={verticalAlign:"middle"},Ox={color:"#404040"},Mk={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Ak={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},Tk={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"},Pk='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Px+'</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>',io;function kk(){io=Ht(Pk),Yn(io,Mk),Yn(Rt("svg",io),kx),Yn(Rt(".backdrop",io),Ak),Yn(Rt(".notice",io),Tk),Yn(Rt(".link",io),Ox,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function Ok(){io||(kk(),ri.bind(io,".backdrop","click",function(e){document.body.removeChild(io)})),document.body.appendChild(io)}const Ml=5,Dx="djs-outline-hidden";function Vt(e){e=Y({},Lk,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),Bk(this._container)}Be(Vt,Jo),Vt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(d){throw this._emit("import.parse.complete",{error:d}),d}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),Al(s,r),s=Dk(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Vt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Vt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw Al(r,[]),r}if(typeof t=="string"&&(i=Ik(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw Al(r,[]),r}try{this.clear()}catch(r){throw Al(r,[]),r}const{warnings:o}=await Ax(this,n,i);return{warnings:o}},Vt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,o;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,o=(await this._moddle.toXML(n,t)).xml,o=this._emit("saveXML.serialized",{xml:o})||o}catch(a){i=a}const r=i?{error:i}:{xml:o};if(this._emit("saveXML.done",r),i)throw i;return r},Vt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Rt(":scope > defs",i._svg),a=Xv(o),s=r?"<defs>"+Xv(r)+"</defs>":"",c=i.getContainer();Mt(c).add(Dx);let l;try{l=o.getBBox()}finally{Mt(c).remove(Dx)}const u=l.x-Ml,p=l.y-Ml,d=l.width+Ml*2,f=l.height+Ml*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
8
7
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
9
8
|
<!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="`+d+'" height="'+f+'" viewBox="'+u+" "+p+" "+d+" "+f+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Vt.prototype._setDefinitions=function(e){this._definitions=e},Vt.prototype.getModules=function(){return this._modules},Vt.prototype.clear=function(){this.getDefinitions()&&Jo.prototype.clear.call(this)},Vt.prototype.destroy=function(){Jo.prototype.destroy.call(this),eo(this._container)},Vt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Vt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Vt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Vt.prototype.getDefinitions=function(){return this._definitions},Vt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Vt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=Y(Ki(n,["additionalModules"]),{canvas:Y({},n.canvas,{container:e}),modules:a});Jo.call(this,s),n&&n.container&&this.attachTo(n.container)},Vt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Vt.prototype._createContainer=function(e){const t=Ht('<div class="bjs-container"></div>');return Yn(t,{width:_x(e.width),height:_x(e.height),position:e.position}),t},Vt.prototype._createModdle=function(e){const t=Y({},this._moddleExtensions,e.moddleExtensions);return new Bm(t)},Vt.prototype._modules=[];function Ml(e,t){return e.warnings=t,e}function pk(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 dk={width:"100%",height:"100%",position:"relative"};function _x(e){return e+(Qe(e)?"px":"")}function fk(e,t){return t&&Bt(e.diagrams,function(n){return n.id===t})||null}function hk(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+vx+"</a>",i=Ht(n);Yn(Rt("svg",i),xx),Yn(i,bx,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ue.bind(i,"click",function(o){uk(),o.preventDefault()})}function jr(e){Vt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Be(jr,Vt),jr.prototype._createModdle=function(e){var t=Vt.prototype._createModdle.call(this,e);return t.ids=new Qi([32,36,1]),t},jr.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function ft(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||gt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!Ee(e).processRef:!0}function Sn(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=gt(e).isHorizontal;return t===void 0?!0:t}}function gk(e){return e&&Ee(e).isInterrupting!==!1}function Wn(e){return e&&!!Ee(e).triggeredByEvent}function Ra(e,t){var n=Ee(e).eventDefinitions;return No(n,function(i){return A(i,t)})}function mk(e){return Ra(e,"bpmn:ErrorEventDefinition")}function yk(e){return Ra(e,"bpmn:EscalationEventDefinition")}function vk(e){return Ra(e,"bpmn:CompensateEventDefinition")}var Hr={width:90,height:20},Ex=15;function Qo(e){return A(e,"bpmn:Event")||A(e,"bpmn:Gateway")||A(e,"bpmn:DataStoreReference")||A(e,"bpmn:DataObjectReference")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:Group")}function Al(e){return at(e.label)}function xk(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=bk(e),r=Math.atan((i.y-n.y)/(i.x-n.x)),a=o.x,s=o.y;return Math.abs(r)<Math.PI/2?s-=Ex:a+=Ex,{x:a,y:s}}function bk(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 sf(e){return e.waypoints?xk(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Hr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Hr.height/2}}function Sx(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Hr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=sf(t),i=Hr),Y({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Rx(e){if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return"name";if(A(e,"bpmn:TextAnnotation"))return"text";if(A(e,"bpmn:Group"))return"categoryValueRef"}function wk(e){var t=e.categoryValueRef;return t&&t.value||""}function si(e){var t=e.businessObject,n=Rx(t);if(n)return n==="categoryValueRef"?wk(t):t[n]||""}function _k(e,t){var n=e.businessObject,i=Rx(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function Ek(e){return at(e)&&Qo(e.labelTarget)}var Ca=7;function Cx(e){let t=[];return V(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),V(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ls(e){const t=new Map;return V(Qd(e),n=>{V(Cx(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 cf="hsl(225, 10%, 15%)",Sk="white";function oo(e,t){return No(e.eventDefinitions,function(n){return n.$type===t})}function Rk(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Ck(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function pt(e,t,n){var i=gt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||Sk}function Ie(e,t,n){var i=gt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||cf}function Is(e,t,n,i){var o=gt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ie(e,n)}function Mx(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,o=[["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 $r(o)}function lf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return $r(a)}function Mk(e){var t=e.width,n=e.height,i=e.x,o=e.y,r=t/2,a=n/2,s=[["M",i+r,o],["l",r,a],["l",-r,a],["l",-r,-a],["z"]];return $r(s)}function Ak(e){var t=e.x,n=e.y,i=e.width,o=e.height,r=[["M",t,n],["l",i,0],["l",0,o],["l",-i,0],["z"]];return $r(r)}function Bs(e,t={}){return{width:Si(e,t),height:ci(e,t)}}function Si(e,t={}){return ii(t,"width")?t.width:e.width}function ci(e,t={}){return ii(t,"height")?t.height:e.height}var Pk=new Qi,Tk=10,Pl=3,kk=1.5,Tl=10,Ok=4,Ma=.95,Dk=1,Lk=.25;function zr(e,t,n,i,o,r,a){xo.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:cf,strokeWidth:2,fill:"white"})}function p($){return n.computeStyle($,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:cf,strokeWidth:2})}function d($,M){var{ref:R={x:0,y:0},scale:U=1,element:X,parentGfx:pe=o._svg}=M,Ne=He("marker",{id:$,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*U,markerHeight:20*U,orient:"auto"});nt(Ne,X);var Ke=Rt(":scope > defs",pe);Ke||(Ke=He("defs"),nt(pe,Ke)),nt(Ke,Ne)}function f($,M,R,U){var X=Pk.nextPrefixed("marker-");return g($,X,M,R,U),"url(#"+X+")"}function g($,M,R,U,X){if(R==="sequenceflow-end"){var pe=He("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:X,stroke:X,strokeWidth:1})});d(M,{element:pe,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(R==="messageflow-start"){var Ne=He("circle",{cx:6,cy:6,r:3.5,...u({fill:U,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});d(M,{element:Ne,ref:{x:6,y:6},parentGfx:$})}if(R==="messageflow-end"){var Ke=He("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:U,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});d(M,{element:Ke,ref:{x:8.5,y:5},parentGfx:$})}if(R==="association-start"){var ht=He("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(M,{element:ht,ref:{x:1,y:10},scale:.5,parentGfx:$})}if(R==="association-end"){var kt=He("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(M,{element:kt,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(R==="conditional-flow-marker"){var St=He("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:U,stroke:X})});d(M,{element:St,ref:{x:-1,y:10},scale:.5,parentGfx:$})}if(R==="conditional-default-flow-marker"){var tn=He("path",{d:"M 6 4 L 10 16",...u({stroke:X,fill:"none"})});d(M,{element:tn,ref:{x:0,y:10},scale:.5,parentGfx:$})}}function h($,M,R,U,X={}){vn(U)&&(X=U,U=0),U=U||0,X=u(X);var pe=M/2,Ne=R/2,Ke=He("circle",{cx:pe,cy:Ne,r:Math.round((M+R)/4-U),...X});return nt($,Ke),Ke}function y($,M,R,U,X,pe){vn(X)&&(pe=X,X=0),X=X||0,pe=u(pe);var Ne=He("rect",{x:X,y:X,width:M-X*2,height:R-X*2,rx:U,ry:U,...pe});return nt($,Ne),Ne}function w($,M,R,U){var X=M/2,pe=R/2,Ne=[{x:X,y:0},{x:M,y:pe},{x:X,y:R},{x:0,y:pe}],Ke=Ne.map(function(kt){return kt.x+","+kt.y}).join(" ");U=u(U);var ht=He("polygon",{...U,points:Ke});return nt($,ht),ht}function m($,M,R,U){R=p(R);var X=Ms(M,R,U);return nt($,X),X}function v($,M,R){return m($,M,R,5)}function b($,M,R){R=p(R);var U=He("path",{...R,d:M});return nt($,U),U}function E($,M,R,U){return b(M,R,Y({"data-marker":$},U))}function C($){return ze[$]}function I($){return function(M,R,U){return C($)(M,R,U)}}var k={"bpmn:MessageEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.235,my:.315}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill),Ne=U?pt(M,s,R.fill):Ie(M,c,R.stroke),Ke=b($,X,{fill:pe,stroke:Ne,strokeWidth:1});return Ke},"bpmn:TimerEventDefinition":function($,M,R={}){var U=R.width||M.width,X=R.height||M.height,pe=R.width?1:2,Ne=h($,U,X,.2*X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:pe}),Ke=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:X,position:{mx:.5,my:.5}});b($,Ke,{stroke:Ie(M,c,R.stroke),strokeWidth:pe});for(var ht=0;ht<12;ht++){var kt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:X,position:{mx:.5,my:.5}}),St=U/2,tn=X/2;b($,kt,{strokeWidth:1,stroke:Ie(M,c,R.stroke),transform:"rotate("+ht*30+","+tn+","+St+")"})}return Ne},"bpmn:EscalationEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.5,my:.2}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function($,M,R={}){var U=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.5,my:.222}});return b($,U,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.57,my:.263}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.2,my:.722}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.638,my:-.055}}),pe=U?Ie(M,c,R.stroke):"none",Ne=b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1});return gx(Ne,45),Ne},"bpmn:CompensateEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.22,my:.5}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.5,my:.2}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{strokeWidth:1,fill:pe,stroke:Ie(M,c,R.stroke)})},"bpmn:MultipleEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.211,my:.36}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function($,M,R={}){var U=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.458,my:.194}});return b($,U,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function($,M,R={}){var U=h($,M.width,M.height,8,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:4});return U}};function P($,M,R={},U){var X=Ee($),pe=Rk(X),Ne=U||$;return X.get("eventDefinitions")&&X.get("eventDefinitions").length>1?X.get("parallelMultiple")?k["bpmn:ParallelMultipleEventDefinition"](M,Ne,R,pe):k["bpmn:MultipleEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:MessageEventDefinition")?k["bpmn:MessageEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:TimerEventDefinition")?k["bpmn:TimerEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:ConditionalEventDefinition")?k["bpmn:ConditionalEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:SignalEventDefinition")?k["bpmn:SignalEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:EscalationEventDefinition")?k["bpmn:EscalationEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:LinkEventDefinition")?k["bpmn:LinkEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:ErrorEventDefinition")?k["bpmn:ErrorEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:CancelEventDefinition")?k["bpmn:CancelEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:CompensateEventDefinition")?k["bpmn:CompensateEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:TerminateEventDefinition")?k["bpmn:TerminateEventDefinition"](M,Ne,R,pe):null}var F={ParticipantMultiplicityMarker:function($,M,R={}){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2-6)/U,my:(X-15)/X}});E("participant-multiplicity",$,pe,{strokeWidth:2,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},SubProcessMarker:function($,M,R={}){var U=y($,14,14,0,{strokeWidth:1,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)});In(U,M.width/2-7.5,M.height-20);var X=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2-7.5)/M.width,my:(M.height-20)/M.height}});E("sub-process",$,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},ParallelMarker:function($,M,R){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2+R.parallel)/U,my:(X-20)/X}});E("parallel",$,pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},SequentialMarker:function($,M,R){var U=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2+R.seq)/M.width,my:(M.height-19)/M.height}});E("sequential",$,U,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},CompensationMarker:function($,M,R){var U=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2+R.compensation)/M.width,my:(M.height-13)/M.height}});E("compensation",$,U,{strokeWidth:1,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},LoopMarker:function($,M,R){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2+R.loop)/U,my:(X-7)/X}});E("loop",$,pe,{strokeWidth:1.5,fill:"none",stroke:Ie(M,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function($,M,R){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2+R.adhoc)/U,my:(X-15)/X}});E("adhoc",$,pe,{strokeWidth:1,fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke)})}};function z($,M,R,U){F[$](M,R,U)}function G($,M,R=[],U={}){U={fill:U.fill,stroke:U.stroke,width:Si(M,U),height:ci(M,U)};var X=Ee(M),pe=R.includes("SubProcessMarker");pe?U={...U,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:U={...U,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},X.get("isForCompensation")&&R.push("CompensationMarker"),A(X,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),pe||Y(U,{compensation:U.compensation-18}));var Ne=X.get("loopCharacteristics"),Ke=Ne&&Ne.get("isSequential");Ne&&(Y(U,{compensation:U.compensation-18}),R.includes("AdhocMarker")&&Y(U,{seq:-23,loop:-18,parallel:-24}),Ke===void 0&&R.push("LoopMarker"),Ke===!1&&R.push("ParallelMarker"),Ke===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&Y(U,{compensation:-8}),V(R,function(ht){z(ht,$,M,U)})}function ne($,M,R={}){R=Y({size:{width:100}},R);var U=r.createText(M||"",R);return dt(U).add("djs-label"),nt($,U),U}function re($,M,R,U={}){var X=Ee(M),pe=Bs({x:M.x,y:M.y,width:M.width,height:M.height},U);return ne($,X.name,{align:R,box:pe,padding:7,style:{fill:Is(M,l,c,U.stroke)}})}function K($,M,R={}){var U={width:M.width,height:M.height,x:M.width/2+M.x,y:M.height/2+M.y};return ne($,si(M),{box:U,style:Y({},r.getExternalStyle(),{fill:Is(M,l,c,R.stroke)})})}function xe($,M,R,U={}){var X=Sn(R),pe=ne($,M,{box:{height:30,width:X?ci(R,U):Si(R,U)},align:"center-middle",style:{fill:Is(R,l,c,U.stroke)}});if(X){var Ne=-1*ci(R,U);Rl(pe,0,-Ne,270)}}function de($,M,R={}){var{width:U,height:X}=Bs(M,R);return y($,U,X,Tl,{...R,fill:pt(M,s,R.fill),fillOpacity:Ma,stroke:Ie(M,c,R.stroke)})}function we($,M,R={}){var U=Ee(M),X=pt(M,s,R.fill),pe=Ie(M,c,R.stroke);return(U.get("associationDirection")==="One"||U.get("associationDirection")==="Both")&&(R.markerEnd=f($,"association-end",X,pe)),U.get("associationDirection")==="Both"&&(R.markerStart=f($,"association-start",X,pe)),R=yt(R,["markerStart","markerEnd"]),v($,M.waypoints,{...R,stroke:pe,strokeDasharray:"0, 5"})}function he($,M,R={}){var U=pt(M,s,R.fill),X=Ie(M,c,R.stroke),pe=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.474,my:.296}}),Ne=b($,pe,{fill:U,fillOpacity:Ma,stroke:X}),Ke=Ee(M);if(Ck(Ke)){var ht=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.33,my:(M.height-18)/M.height}});b($,ht,{strokeWidth:2,fill:U,stroke:X})}return Ne}function W($,M,R={}){return h($,M.width,M.height,{fillOpacity:Ma,...R,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})}function le($,M,R={}){return w($,M.width,M.height,{fill:pt(M,s,R.fill),fillOpacity:Ma,stroke:Ie(M,c,R.stroke)})}function q($,M,R={}){var U=y($,Si(M,R),ci(M,R),0,{fill:pt(M,s,R.fill),fillOpacity:R.fillOpacity||Ma,stroke:Ie(M,c,R.stroke),strokeWidth:1.5}),X=Ee(M);if(A(X,"bpmn:Lane")){var pe=X.get("name");xe($,pe,M,R)}return U}function ee($,M,R={}){var U=de($,M,R),X=ft(M);if(Wn(M)&&(Le(U,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!X)){var pe=Ee(M).flowElements||[],Ne=pe.filter(Ke=>A(Ke,"bpmn:StartEvent"));Ne.length===1&&me(Ne[0],$,R,M)}return re($,M,X?"center-top":"center-middle",R),X?G($,M,void 0,R):G($,M,["SubProcessMarker"],R),U}function me($,M,R,U){var X=22,pe={fill:pt(U,s,R.fill),stroke:Ie(U,c,R.stroke),width:X,height:X},Ne=Ee($).isInterrupting,Ke=Ne?0:3,ht=Ne?1:1.2,kt=20,St=(X-kt)/2,tn="translate("+St+","+St+")";h(M,kt,kt,{fill:pe.fill,stroke:pe.stroke,strokeWidth:ht,strokeDasharray:Ke,transform:tn}),P($,M,pe,U)}function Re($,M,R={}){var U=de($,M,R);return re($,M,"center-middle",R),G($,M,void 0,R),U}var ze=this.handlers={"bpmn:AdHocSubProcess":function($,M,R={}){return ft(M)?R=yt(R,["fill","stroke","width","height"]):R=yt(R,["fill","stroke"]),ee($,M,R)},"bpmn:Association":function($,M,R={}){return R=yt(R,["fill","stroke"]),we($,M,R)},"bpmn:BoundaryEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=Ee(M),pe=X.get("cancelActivity");R={strokeWidth:1.5,fill:pt(M,s,R.fill),fillOpacity:Dk,stroke:Ie(M,c,R.stroke)},pe||(R.strokeDasharray="6");var Ne=W($,M,R);return h($,M.width,M.height,Pl,{...R,fill:"none"}),U&&P(M,$,R),Ne},"bpmn:BusinessRuleTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),pe=b($,X);Le(pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1});var Ne=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ke=b($,Ne);return Le(Ke,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:CallActivity":function($,M,R={}){return R=yt(R,["fill","stroke"]),ee($,M,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R),X=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:M.width,containerHeight:M.height,position:{mx:.46,my:.26}});return b($,X,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:DataInput":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),X=he($,M,R);return b($,U,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1}),X},"bpmn:DataInputAssociation":function($,M,R={}){return R=yt(R,["fill","stroke"]),we($,M,{...R,markerEnd:f($,"association-end",pt(M,s,R.fill),Ie(M,c,R.stroke))})},"bpmn:DataObject":function($,M,R={}){return R=yt(R,["fill","stroke"]),he($,M,R)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),X=he($,M,R);return b($,U,{strokeWidth:1,fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke)}),X},"bpmn:DataOutputAssociation":function($,M,R={}){return R=yt(R,["fill","stroke"]),we($,M,{...R,markerEnd:f($,"association-end",pt(M,s,R.fill),Ie(M,c,R.stroke))})},"bpmn:DataStoreReference":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:0,my:.133}});return b($,U,{fill:pt(M,s,R.fill),fillOpacity:Ma,stroke:Ie(M,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=W($,M,{...R,strokeWidth:4});return U&&P(M,$,R),X},"bpmn:EventBasedGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Ee(M),X=le($,M,R);h($,M.width,M.height,M.height*.2,{fill:pt(M,"none",R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1});var pe=U.get("eventGatewayType"),Ne=!!U.get("instantiate");function Ke(){var kt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:M.width,containerHeight:M.height,position:{mx:.36,my:.44}});b($,kt,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:2})}if(pe==="Parallel"){var ht=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:M.width,containerHeight:M.height,position:{mx:.474,my:.296}});b($,ht,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1})}else pe==="Exclusive"&&(Ne||h($,M.width,M.height,M.height*.26,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1}),Ke());return X},"bpmn:ExclusiveGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R),X=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:M.width,containerHeight:M.height,position:{mx:.32,my:.3}}),pe=gt(M);return pe.get("isMarkerVisible")&&b($,X,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:Gateway":function($,M,R={}){return R=yt(R,["fill","stroke"]),le($,M,R)},"bpmn:Group":function($,M,R={}){return R=yt(R,["fill","stroke","width","height"]),y($,M.width,M.height,Tl,{stroke:Ie(M,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Si(M,R),height:ci(M,R)})},"bpmn:InclusiveGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R);return h($,M.width,M.height,M.height*.24,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:2.5}),U},"bpmn:IntermediateEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=W($,M,{...R,strokeWidth:1.5});return h($,M.width,M.height,Pl,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1.5}),U&&P(M,$,R),X},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function($,M,R={}){return R=yt(R,["fill","stroke","width","height"]),q($,M,{...R,fillOpacity:Lk})},"bpmn:ManualTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b($,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:.5}),U},"bpmn:MessageFlow":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Ee(M),X=gt(M),pe=pt(M,s,R.fill),Ne=Ie(M,c,R.stroke),Ke=v($,M.waypoints,{markerEnd:f($,"messageflow-end",pe,Ne),markerStart:f($,"messageflow-start",pe,Ne),stroke:Ne,strokeDasharray:"10, 11",strokeWidth:1.5});if(U.get("messageRef")){var ht=Ke.getPointAtLength(Ke.getTotalLength()/2),kt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ht.x,y:ht.y}}),St={strokeWidth:1};X.get("messageVisibleKind")==="initiating"?(St.fill=pe,St.stroke=Ne):(St.fill=Ne,St.stroke=pe);var tn=b($,kt,St),Rn=U.get("messageRef"),Fn=Rn.get("name"),Nt=ne($,Fn,{align:"center-top",fitBox:!0,style:{fill:Ne}}),nn=tn.getBBox(),on=Nt.getBBox(),Wi=ht.x-on.width/2,hi=ht.y+nn.height/2+Tk;Rl(Nt,Wi,hi,0)}return Ke},"bpmn:ParallelGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R),X=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:M.width,containerHeight:M.height,position:{mx:.46,my:.2}});return b($,X,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:Participant":function($,M,R={}){R=yt(R,["fill","stroke","width","height"]);var U=q($,M,R),X=ft(M),pe=Sn(M),Ne=Ee(M),Ke=Ne.get("name");if(X){var ht=pe?[{x:30,y:0},{x:30,y:ci(M,R)}]:[{x:0,y:30},{x:Si(M,R),y:30}];m($,ht,{stroke:Ie(M,c,R.stroke),strokeWidth:kk}),xe($,Ke,M,R)}else{var kt=Bs(M,R);pe||(kt.height=Si(M,R),kt.width=ci(M,R));var St=ne($,Ke,{box:kt,align:"center-middle",style:{fill:Is(M,l,c,R.stroke)}});if(!pe){var tn=-1*ci(M,R);Rl(St,0,-tn,270)}}return Ne.get("participantMultiplicity")&&z("ParticipantMultiplicityMarker",$,M,R),U},"bpmn:ReceiveTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Ee(M),X=Re($,M,R),pe;return U.get("instantiate")?(h($,28,28,20*.22,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),pe=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):pe=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b($,pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),X},"bpmn:ScriptTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b($,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:SendTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b($,X,{fill:Ie(M,c,R.stroke),stroke:pt(M,s,R.fill),strokeWidth:1}),U},"bpmn:SequenceFlow":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=pt(M,s,R.fill),X=Ie(M,c,R.stroke),pe=v($,M.waypoints,{markerEnd:f($,"sequenceflow-end",U,X),stroke:X}),Ne=Ee(M),{source:Ke}=M;if(Ke){var ht=Ee(Ke);Ne.get("conditionExpression")&&A(ht,"bpmn:Activity")&&Le(pe,{markerStart:f($,"conditional-flow-marker",U,X)}),ht.get("default")&&(A(ht,"bpmn:Gateway")||A(ht,"bpmn:Activity"))&&ht.get("default")===Ne&&Le(pe,{markerStart:f($,"conditional-default-flow-marker",U,X)})}return pe},"bpmn:ServiceTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R);h($,10,10,{fill:pt(M,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b($,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),h($,10,10,{fill:pt(M,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var pe=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b($,pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:StartEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=Ee(M);X.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var pe=W($,M,R);return U&&P(M,$,R),pe},"bpmn:SubProcess":function($,M,R={}){return ft(M)?R=yt(R,["fill","stroke","width","height"]):R=yt(R,["fill","stroke"]),ee($,M,R)},"bpmn:Task":function($,M,R={}){return R=yt(R,["fill","stroke"]),Re($,M,R)},"bpmn:TextAnnotation":function($,M,R={}){R=yt(R,["fill","stroke"]);var{width:U,height:X}=Bs(M,R),pe=y($,U,X,0,0,{fill:"none",stroke:"none"}),Ne=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:0,my:0}});b($,Ne,{stroke:Ie(M,c,R.stroke)});var Ke=Ee(M),ht=Ke.get("text")||"";return ne($,ht,{align:"left-top",box:Bs(M,R),padding:Ca,style:{fill:Is(M,l,c,R.stroke)}}),pe},"bpmn:Transaction":function($,M,R={}){ft(M)?R=yt(R,["fill","stroke","width","height"]):R=yt(R,["fill","stroke"]);var U=ee($,M,{strokeWidth:1.5,...R}),X=n.style(["no-fill","no-events"],{stroke:Ie(M,c,R.stroke),strokeWidth:1.5}),pe=ft(M);return pe||(R={}),y($,Si(M,R),ci(M,R),Tl-Pl,Pl,X),U},"bpmn:UserTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=15,pe=12,Ne=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:X,y:pe}});b($,Ne,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:.5});var Ke=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:X,y:pe}});b($,Ke,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:.5});var ht=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:X,y:pe}});return b($,ht,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:.5}),U},label:function($,M,R={}){return K($,M,R)}};this._drawPath=b,this._renderer=C}Be(zr,xo),zr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],zr.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},zr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},zr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},zr.prototype.getShapePath=function(e){return at(e)?lf(e,Ok):A(e,"bpmn:Event")?Mx(e):A(e,"bpmn:Activity")?lf(e,Tl):A(e,"bpmn:Gateway")?Mk(e):Ak(e)};function yt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var Ik=0,Bk={width:150,height:50};function Nk(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function $k(e){return vn(e)?Y({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var uf=null;function Fk(){return uf||(uf=document.createElement("canvas").getContext("2d")),uf}function jk(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(Ax(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Ax(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Hk(e,t){var n=Fk();if(!n)return{width:0,height:0};n.font=jk(t),"letterSpacing"in n&&(n.letterSpacing=Ax(t.letterSpacing)||"0px");var i=e==="",o=i?"dummy":e.replace(/\s+$/,""),r=n.measureText(o);return{width:i?0:r.width,height:"fontBoundingBoxAscent"in r?r.fontBoundingBoxAscent+r.fontBoundingBoxDescent:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent}}function zk(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=Hk(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return Gk(e,o,i,r);o=Wk(o,r.width,t)}}function Gk(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var Px="";function Vk(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,o=[],r=0;if(n.length>1)for(;i=n.shift();)if(i.length+r<t)o.push(i),r+=i.length;else{(i==="-"||i===Px)&&o.pop();break}var a=o[o.length-1];return a&&a===Px&&(o[o.length-1]="-"),o.join("")}function Wk(e,t,n){var i=Math.max(e.length*(n/t),1),o=Vk(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function kl(e){this._config=Y({},{size:Bk,padding:Ik,style:{},align:"center-top"},e||{})}kl.prototype.createText=function(e,t){return this.layoutText(e,t).element},kl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},kl.prototype.layoutText=function(e,t){for(var n=Y({},this._config.size,t.box),i=Y({},this._config.style,t.style),o=Nk(t.align||this._config.align),r=$k(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Uk(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(zk(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=oi(l,function(y,w,m){return y+(s||w.height)},0)+r.top+r.bottom,d=oi(l,function(y,w,m){return w.width>y?w.width:y},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var g=He("text");Le(g,i),V(l,function(y){var w;switch(f+=s||y.height,o.horizontal){case"left":w=r.left;break;case"right":w=(a?d:u)-r.right-y.width;break;default:w=Math.max(((a?d:u)-y.width)/2+r.left,0)}var m=He("tspan");Le(m,{x:w,y:f}),m.textContent=y.text,nt(g,m)});var h={width:d,height:p};return{dimensions:h,element:g}};function Uk(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var qk=12,Yk=1.2,Kk=40;function Tx(e){var t=Y({fontFamily:"Arial, sans-serif",fontSize:qk,fontWeight:"normal",lineHeight:Yk},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=Y({},t,{fontSize:n},e&&e.externalStyle||{}),o=new kl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Hr.width),height:30},l=r(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=r(s,a,{style:t,align:"left-top",padding:Ca});return{x:a.x,y:a.y,width:a.width,height:Math.max(Kk,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,Y({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Tx.$inject=["config.textRenderer"];function Xk(){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],o,r;n.abspos?(o=n.abspos.x,r=n.abspos.y):(o=n.containerWidth*n.position.mx,r=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=e2(i.d,{mx:o,my:r,e:a});return p}}var Zk=/\{([^{}]+)\}/g,Jk=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Qk(e,t,n){var i=n;return t.replace(Jk,function(o,r,a,s,c){r=r||s,i&&(r in i&&(i=i[r]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function e2(e,t){return String(e).replace(Zk,function(n,i){return Qk(n,i,t)})}const t2={__init__:["bpmnRenderer"],bpmnRenderer:["type",zr],textRenderer:["type",Tx],pathMap:["type",Xk]};function n2(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ns={translate:["value",n2]};function Ol(e,t,n){return Y({id:e.id,type:e.$type,businessObject:e,di:t},n)}function i2(e,t,n){var i=e.waypoint;return!i||i.length<2?[et(t),et(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function kx(e,t,n){return new Error(`element ${Vn(t)} referenced by ${Vn(e)}#${n} not yet drawn`)}function Eo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Eo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Eo.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ol(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!ft(e,t),c=r2(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Ol(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),A(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),A(e,"bpmn:Lane")&&(r=0),A(e,"bpmn:DataStoreReference")&&(o2(n,et(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(A(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ol(e,t,{hidden:o,source:u,target:p,waypoints:i2(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Vn(t)} for element ${Vn(e)}`);return Qo(e)&&si(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Eo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Vn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw kx(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Eo.prototype.addLabel=function(e,t,n){var i,o,r;return i=Sx(t,n),o=si(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Ol(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!si(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(r,n.parent)},Eo.prototype._getConnectedElement=function(e,t){var n,i,o=e.$type;if(i=e[t+"Ref"],t==="source"&&o==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&o==="bpmn:DataOutputAssociation"||t==="target"&&o==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?kx(e,i,t+"Ref"):new Error(`${Vn(e)}#${t} Ref not specified`)},Eo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Eo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Eo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function o2(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 r2(e){return A(e,"bpmn:Group")}const Ox={__depends__:[t2,{__depends__:[Ns],bpmnImporter:["type",Eo]}]};function $s(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Gi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function pf(e){return Math.log(e)/Math.log(10)}var a2=1e3;function _e(e){this._eventBus=e}_e.$inject=["eventBus"];function s2(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}_e.prototype.on=function(e,t,n,i,o,r){if((En(t)||Qe(t))&&(r=o,o=i,i=n,n=t,t=null),En(n)&&(r=o,o=i,i=n,n=a2),vn(o)&&(r=o,o=!1),!En(i))throw new Error("handlerFn must be a function");Je(e)||(e=[e]);var a=this._eventBus;V(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?s2(i,r):i,r)})},_e.prototype.canExecute=So("canExecute"),_e.prototype.preExecute=So("preExecute"),_e.prototype.preExecuted=So("preExecuted"),_e.prototype.execute=So("execute"),_e.prototype.executed=So("executed"),_e.prototype.postExecute=So("postExecute"),_e.prototype.postExecuted=So("postExecuted"),_e.prototype.revert=So("revert"),_e.prototype.reverted=So("reverted");function So(e){return function(n,i,o,r,a){(En(n)||Qe(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var df=["top","bottom","left","right"],Dl=10;function ff(e,t){_e.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(Al(o)&&!Dt(o)){var r=u2(o);r&&i(o,r)}}function i(o,r){var a=et(o),s=o.label,c=et(s);if(s.parent){var l=Ye(o),u;switch(r){case"top":u={x:a.x,y:l.top-Dl-s.height/2};break;case"left":u={x:l.left-Dl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Dl+s.height/2};break;case"right":u={x:l.right+Dl+s.width/2,y:a.y};break}var p=Gi(u,c);t.moveShape(s,p)}}}Be(ff,_e),ff.$inject=["eventBus","modeling"];function c2(e){var t=e.host,n=et(e),i=Ln(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=df.filter(function(a){return o.indexOf(a)===-1});return r}function l2(e){var t=et(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 Dx(t,i)});return n}function u2(e){var t=et(e.label),n=et(e),i=Dx(n,t);if(p2(i)){var o=l2(e);if(e.host){var r=c2(e);o=o.concat(r)}var a=df.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?Ln(e.label,e)!=="intersect"?void 0:i:a[0]}}function Dx(e,t){return Ln(t,e,5)}function p2(e){return df.indexOf(e)!==-1}function hf(e){_e.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(A(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)}Be(hf,_e),hf.$inject=["eventBus"];var d2=1500;function gf(e,t,n){e.invoke(_e,this),this.preExecute("elements.delete",d2,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=lt(o,l=>A(l,"bpmn:Participant")||A(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>A(l,"bpmn:Artifact"))),c=new Set;return V(r,l=>{const u=new Set(ua(_a(Array.from(s),ln(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Be(gf,_e),gf.$inject=["injector","eventBus","canvas"];function mf(e,t){e.invoke(_e,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=lt(o.incoming.concat(o.outgoing),function(a){return A(a,"bpmn:Association")});V(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Be(mf,_e),mf.$inject=["injector","modeling"];function Aa(e,t){for(ni(t)&&(t=[t]);e=e.parent;)if(st(e,t))return e;return null}function Lx(e,t){var n=Aa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Aa(e,i),n)return Sn(n);if(st(e,i))return Sn(e);var o;for(o=Ee(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=Ee(a);return s&&s.get("processRef")===o});return r?Sn(r):!0}var Ix=500;function Ll(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ix,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Bx(r,a)}),o.length===1&&o.map(function(r){return o.indexOf(r)}).forEach(function(r){var a=o[r];i.elements[r]=n._replaceShape(o[r],a)})},!0),this.preExecute("elements.move",Ix,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Bx(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Ll.$inject=["bpmnReplace","injector"],Be(Ll,_e),Ll.prototype._replaceShape=function(e,t){var n=f2(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function f2(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function Bx(e,t){return!at(e)&&st(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function yf(e,t){_e.call(this,e);function n(i){return lt(i.attachers,function(o){return A(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);A(o,"bpmn:EventBasedGateway")&&A(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;A(o,"bpmn:Gateway")&&A(r,"bpmn:EventBasedGateway")&&V(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}yf.$inject=["eventBus","modeling"],Be(yf,_e);function Nx(e){return e.create("bpmn:Category")}function h2(e){return e.create("bpmn:CategoryValue")}function $x(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=h2(e)),n.$parent||(n.$parent=Nx(e)),n}function g2(e,t,n){return rn(t.get("categoryValue"),e),e.$parent=t,rn(n.get("rootElements"),t),t.$parent=n,e}function m2(e){var t=e.$parent;return t&&(en(t.get("categoryValue"),e),e.$parent=null),e}function y2(e){var t=e.$parent;return t&&(en(t.get("rootElements"),e),e.$parent=null),e}var v2=500;function vf(e,t,n){n.invoke(_e,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(Ee).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&g2(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&y2(l),c&&!o(c,u)&&m2(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(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;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.executed(["shape.move","shape.resize"],v2,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,Ee(l))},!0),this.executed("group.updateRefs",function(c){Fx(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Fx(c).forEach(function(l){s(l.categoryValue,l.category,Ee(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}vf.$inject=["bpmnjs","elementRegistry","injector"],Be(vf,_e);function Fx(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function xf(e,t,n){_e.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const w=y.source,m=y.target;Pa(w)&&Fs(m)&&u(m)}function o(y){const w=y.connection,m=y.source,v=y.target;Pa(m)&&Il(v)&&(l(v),d(m,[w]))}function r(y){const w=y.newTarget,m=y.oldSource,v=y.oldTarget;if(v!==w){const b=m;Fs(v)&&u(v),Pa(b)&&Il(w)&&l(w)}}function a(y){const{element:w}=y;Fs(w)?(p(w),f(w)):Il(w)&&g(w)}function s(y){const{newData:w,oldShape:m}=y;if(Pa(y.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const v=m.outgoing.find(({target:b})=>Fs(b));v&&v.target&&(y._connectionTarget=v.target)}else if(!Pa(y.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const v=m.outgoing.find(({target:b})=>Il(b));v&&v.target&&(y._connectionTarget=v.target),h(m)}}function c(y){const{_connectionTarget:w,newShape:m}=y;w&&t.connect(m,w)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const w of y.incoming)n.canConnect(w.source,y)||t.removeConnection(w);for(const w of y.outgoing)n.canConnect(y,w.target)||t.removeConnection(w)}function d(y,w){y.outgoing.filter(b=>A(b,"bpmn:Association")).filter(b=>Fs(b.target)&&!w.includes(b)).forEach(b=>t.removeConnection(b))}function f(y){const w=y.attachers.slice();w.length&&t.removeElements(w)}function g(y){const w=y.incoming.filter(m=>Pa(m.source));t.removeElements(w)}function h(y){const w=y.outgoing.filter(m=>A(m,"bpmn:SequenceFlow"));t.removeElements(w)}}Be(xf,_e),xf.$inject=["eventBus","modeling","bpmnRules"];function Fs(e){const t=Ee(e);return t&&t.get("isForCompensation")}function Pa(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ra(e,"bpmn:CompensateEventDefinition")}function Il(e){return e&&A(e,"bpmn:Activity")&&!Wn(e)}function bf(e){e.invoke(_e,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;A(i,"bpmn:Lane")&&!A(o,"bpmn:Lane")&&(n.parent=Aa(i,"bpmn:Participant"))})}bf.$inject=["injector"],Be(bf,_e);function wf(e,t){_e.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(A(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}wf.$inject=["eventBus","bpmnFactory"],Be(wf,_e);var _f=20,Ef=20,jx=30,Bl=2e3;function Sf(e,t,n){_e.call(this,t),t.on(["create.start","shape.move.start"],Bl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!A(a,"bpmn:Participant")||!A(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!A(p,"bpmn:Group")&&!at(p)&&!Dt(p)});if(c.length){var l=ln(c),u=x2(a,l);Y(a,u),r.createConstraints=b2(a,l)}}}),t.on("create.start",Bl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}A(a,"bpmn:Participant")&&A(s,"bpmn:Process")&&(t.on("element.hover",Bl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return A(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",Bl,function(o){var r=o.elements,a=o.parent,s=w2(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=Ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;A(a,"bpmn:Participant")&&A(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=Ee(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&Ee(s).set("processRef",Ee(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&Ee(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.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)}Sf.$inject=["canvas","eventBus","modeling"],Be(Sf,_e);function x2(e,t){t={width:t.width+_f*2+jx,height:t.height+Ef*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 b2(e,t){return t=Ye(t),{bottom:t.top+e.height/2-Ef,left:t.right-e.width/2+_f,top:t.bottom-e.height/2+Ef,right:t.left+e.width/2-_f-jx}}function w2(e){return Bt(e,function(t){return A(t,"bpmn:Participant")})}var Hx="__targetRef_placeholder";function Rf(e,t){_e.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],zx(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],zx(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Bt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Bt(c,function(u){return u.name===Hx});return!l&&s&&(l=t.create("bpmn:Property",{name:Hx}),rn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||en(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,d=s.newTarget,f=d&&d.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,w;h&&h!==p&&o(h,l),f&&f!==p&&o(f,l),p?(w=i(p,!0),y.targetRef=w):y.targetRef=null}}Rf.$inject=["eventBus","bpmnFactory"],Be(Rf,_e);function zx(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Nl(e){this._bpmnUpdater=e}Nl.$inject=["bpmnUpdater"],Nl.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},Nl.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,o=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]};function Cf(e,t,n,i){_e.call(this,i),t.registerHandler("dataStore.updateContainment",Nl);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&Ee(s).processRef})[0]}function r(s){return s.children.filter(function(c){return A(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:gt(s),newSemanticParent:u.processRef||u,newDiParent:gt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;A(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 A(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!A(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(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(!A(u,"bpmn:Collaboration")&&A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(p,"bpmn:Collaboration")){var d=A(u,"bpmn:Participant")?u:E2(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();st(l,["bpmn:Participant","bpmn:SubProcess"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return _2(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(d){A(u,"bpmn:Process")&&a(d,u)})})}Cf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Be(Cf,_e);function _2(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 E2(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var $l=Math.max,Fl=Math.min,S2=20;function Gx(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function R2(e,t,n){var i=n.x,o=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+o,r.height=e.height-o):t.indexOf("s")!==-1&&(r.height=e.height+o),t.indexOf("e")!==-1?r.width=e.width+i:t.indexOf("w")!==-1&&(r.x=e.x+i,r.width=e.width-i),r}function C2(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 jl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Qe(o)&&(i=(/top|left/.test(e)?Fl:$l)(i,o)),Qe(r)&&(i=(/top|left/.test(e)?$l:Fl)(i,r)),i}function M2(e,t){if(!t)return e;var n=Ye(e);return _l({top:jl("top",n,t),right:jl("right",n,t),bottom:jl("bottom",n,t),left:jl("left",n,t)})}function A2(e,t,n,i){var o=Ye(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},a=i?Ye(i):r,s={top:Fl(r.top,a.top),left:Fl(r.left,a.left),bottom:$l(r.bottom,a.bottom),right:$l(r.right,a.right)};return _l(s)}function js(e,t){return typeof e<"u"?e:S2}function P2(e,t){var n,i,o,r;return typeof t=="object"?(n=js(t.left),i=js(t.right),o=js(t.top),r=js(t.bottom)):n=i=o=r=js(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function T2(e){return!(e.waypoints||e.type==="label")}function Vx(e,t){var n;if(e.length===void 0?n=lt(e.children,T2):n=e,n.length)return P2(ln(n),t)}var er=Math.abs;function k2(e,t){return Gx(Ye(t),Ye(e))}var O2=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ri=30;function Hl(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Hl(n,t),t.push(n))}),t}function tr(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Ci(e){return Aa(e,O2)||e}function D2(e,t){var n=Ci(e),i=A(n,"bpmn:Process")?[]:[n],o=Hl(n,i),r=Ye(e),a=Ye(t),s=k2(e,t),c=[],l=Sn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,d=l?s.right:0,f=l?0:s.bottom,g=l?s.left:0,h=Ye(u);s.top&&(er(h.bottom-r.top)<10&&(f=a.top-h.bottom),er(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(er(h.right-r.left)<10&&(d=a.left-h.right),er(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(er(h.top-r.bottom)<10&&(p=a.bottom-h.top),er(h.bottom-r.bottom)<5&&(f=a.bottom-h.bottom)),s.right&&(er(h.left-r.right)<10&&(g=a.right-h.left),er(h.right-r.right)<5&&(d=a.right-h.right)),(p||d||f||g)&&c.push({shape:u,newBounds:C2(u,{top:p,right:d,bottom:f,left:g})})}}),c}var L2=500;function Mf(e,t){_e.call(this,e);function n(i,o){var r=Sn(i),a=tr(o),s=[],c=[],l=[],u=[];if(Fr(a,function(y){return r?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;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var d,f,g,h;s.length&&(d=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},"s")),c.length&&(f=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(f.movingShapes,f.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",L2,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;A(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Mf.$inject=["eventBus","spaceTool"],Be(Mf,_e);var Wx=500;function zl(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Wx,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Ux(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Wx,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Ux(a,B2(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}zl.$inject=["bpmnReplace","injector"],Be(zl,_e),zl.prototype._replaceShape=function(e){var t=I2(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function I2(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function Ux(e,t){return!at(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function B2(e,t){return e.indexOf(t)!==-1}var Gl=Math.round,N2=Math.max;function $2(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 F2(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var qx=10;function j2(e,t){var n,i;for(n=0;i=e[n];n++)if(Ts(i,t)<=qx)return{point:e[n],bendpoint:!0,index:n};return null}function H2(e,t){var n=Xv($2(t,qx),F2(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=N2(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Gl(i.x+o.x)/2,y:Gl(i.y+o.y)/2},index:i.segment2}:{point:{x:Gl(i.x),y:Gl(i.y)},index:i.segment2}:null}function Af(e,t){return j2(e,t)||H2(e,t)}function Pf(e,t,n){_e.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,g,h=o.outgoing.slice(),y=o.incoming.slice(),w;Qe(a.width)?w=et(a):w=a;var m=Af(s,w);if(m){if(c=s.slice(0,m.index),l=s.slice(m.index+(m.bendpoint?1:0)),!c.length||!l.length)return;u=m.bendpoint?s[m.index]:w,(c.length===1||!Yx(o,c[c.length-1]))&&c.push(Kx(u)),(l.length===1||!Yx(o,l[0]))&&l.unshift(Kx(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||w),f=r),t.canConnect(o,d,r)&&(f?g=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||w),g=r));var v=[].concat(f&<(y,function(b){return b.source===f.source})||[],g&<(h,function(b){return b.target===g.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=et(c),u={x:l.x+s.x,y:l.y+s.y},p=Bt(r.children,function(d){var f=t.canInsert(a,d);return f&&Af(d.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}Be(Pf,_e),Pf.$inject=["eventBus","bpmnRules","modeling"];function Yx(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 Kx(e){return Y({},e)}function Tf(e,t){_e.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Ta(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Ta(l)):c=a.incoming.filter(l=>l!==o&&Ta(l)&&A(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(A(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Ta).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Ta).forEach(function(s){const c=a.incoming.filter(Ta).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}Tf.$inject=["eventBus","modeling"],Be(Tf,_e);function Ta(e){return A(e,"bpmn:SequenceFlow")}var Vl=1500,Xx=2e3;function Zx(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 o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!st(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ci(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||st(r,["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 o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Ci(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Vl,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ci(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Vl,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Ci(r)||r)}),t.on("shape.move.start",Xx,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Ci(o)||o)}),t.on("spaceTool.move",Xx,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Ci(o))})}Zx.$inject=["elementRegistry","eventBus","canvas"];var Jx=770;function kf(e,t,n,i){n.invoke(_e,this);function o(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef;u||(u=$x(e,l));var p=c.category||u.$parent||Nx(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=Ee(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;A(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=Ee(l);if(!(!A(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(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=Ee(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||Ee(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Jx,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=Ee(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",Jx,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})}kf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Be(kf,_e);function Of(e,t,n,i){var o,r,a,s,c;return o=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),o==0?null:(r=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*r-(i.y-n.y)*a,s=c/o,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Qx(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Of(i,o,r,a),l=Of(i,o,r,s),u;c&&l?eb(c,r)>eb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],et(i.source)),t(o[o.length-1],o[o.length-2],et(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Qx.$inject=["eventBus"];function eb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Df(e){_e.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=Ee(i),r=gt(i);if(st(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}Df.$inject=["eventBus"],Be(Df,_e);function tb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function nb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function z2(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 G2(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],o=i[0].n*t[0]+i[1].n*t[1],r=i[0].lambda*t[0]+i[1].lambda*t[1];return-o/r}function Lf(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=G2([n.x,n.y],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function ib(e,t){var n=Lf(e,t),i={x:n.x-e.x,y:n.y-e.y};return tb(i)}function Hs(e,t){return tb({x:e.x-t.x,y:e.y-t.y})}var ob=Math.sqrt,rb=Math.min,V2=Math.max,ab=Math.abs;function sb(e){return Math.pow(e,2)}function zs(e,t){return ob(sb(e.x-t.x)+sb(e.y-t.y))}function W2(e,t){var n=0,i,o,r,a,s,c,l,u,p,d,f;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],lb(i,o)?l=[i]:(r=zs(e,i),a=zs(e,o),c=rb(r,a),l=U2(i,o,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:lb(i,l[0])?n:n+1}),l.length===2&&(s=Y2(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:zs(i,s)/zs(i,o)}),p=zs(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function U2(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,d=u/c,f=p*p-d;if(f<0&&f>-1e-6&&(f=0),f<0)return[];var g=ob(f),h=-p+g,y=-p-g,w={x:e.x-o*h,y:e.y-r*h};if(f===0)return[w];var m={x:e.x-o*y,y:e.y-r*y};return[w,m].filter(function(v){return q2(v,e,t)})}function q2(e,t,n){return cb(e.x,t.x,n.x)&&cb(e.y,t.y,n.y)}function cb(e,t,n){return e>=rb(t,n)-Wl&&e<=V2(t,n)+Wl}function Y2(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Wl=.1;function lb(e,t){return ab(e.x-t.x)<=Wl&&ab(e.y-t.y)<=Wl}function K2(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=pb(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function ub(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=W2(e,n),c=s.segmentIndex,l=K2(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=db(n,c),p=db(t,l),d=s.position,f=Z2(u,d),g=X2(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,w=n[y];if(t.indexOf(w)!==-1)return a;if(h===0){var m=t[y];return o=m.x-s.position.x,r=m.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&y!==0&&y<n.length-1&&(f=pb(n,y))}var v={x:(p[1].x-p[0].x)*f+p[0].x,y:(p[1].y-p[0].y)*f+p[0].y},b=z2({x:e.x-d.x,y:e.y-d.y},g);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:wo(v),delta:wo({x:o,y:r})}}function pb(e,t){var n=Hs(e[t-1],e[t]),i=Hs(e[t],e[t+1]),o=n/(n+i);return o}function X2(e,t){var n=nb(e),i=nb(t);return i-n}function db(e,t){return[e[t],e[t+1]]}function Z2(e,t){var n=Hs(e[0],e[1]),i=Hs(e[0],t);return n===0?0:i/n}function J2(e,t,n,i){var o=et(e);return ub(o,t,n,i).delta}function Gs(e,t,n){var i=$s(t),o=$s(n),r=Gi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return wo({x:o.x+a.x,y:o.y+a.y})}function fb(e,t,n){var i=$s(e),o=$s(t),r=$s(n),a=Gi(e,i),s=Gi(i,o),c=Q2(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:r.x+l.x,y:r.y+l.y};return wo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function Q2(e,t,n){var i=Ye(t),o=Ye(n);if(eO(i,o))return null;var r=Ln(t,e),a,s,c;if(r==="top")a={x:0,y:o.bottom-i.bottom};else if(r==="bottom")a={x:0,y:o.top-i.top};else if(r==="right")a={x:o.left-i.left,y:0};else if(r==="left")a={x:o.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=Ln(n,s),c!==r?null:a}function eO(e,t){return tO(e,t)||nO(e,t)}function tO(e,t){return e.right!==t.right&&e.left!==t.left}function nO(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var hb="name",gb="text";function If(e,t,n,i){_e.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{Ee(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(hb in l&&t.updateLabel(c,l[hb]),gb in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[gb]||"");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;at(l)||!Qo(l)||si(l)&&t.updateLabel(l,si(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 r(a){var s=a.context,c=s.connection,l=c.label,u=Y({},s.hints),p=s.newWaypoints||c.waypoints,d=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),J2(l,p,d,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=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=Ee(c);u&&Qo(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(!(!at(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(si(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?g-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Al(c)){var p=c.label,d=et(p),f=rO(u),g=oO(d,f),h=iO(g,u,l);t.moveShape(p,h)}})}Be(If,_e),If.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function iO(e,t,n){var i=Gs(e,t,n);return wo(Gi(i,e))}function oO(e,t){if(t.length){var n=aO(e,t);return Lf(e,n)}}function rO(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 aO(e,t){var n=t.map(function(o){return{line:o,distance:ib(e,o)}}),i=Yi(n,"distance");return i[0].line}function sO(e,t,n,i){return ub(e,t,n,i).point}function Bf(e,t){_e.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=Y({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),sO(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.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 o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},d=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,d)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},d=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,d)})})}Be(Bf,_e),Bf.$inject=["eventBus","modeling"];function Ul(e,t,n){var i=Yl(e),o=yb(i,t),r=i[0];return o.length?o[o.length-1]:Gs(r.original||r,n,t)}function ql(e,t,n){var i=Yl(e),o=yb(i,t),r=i[i.length-1];return o.length?o[0]:Gs(r.original||r,n,t)}function Nf(e,t,n){var i=Yl(e),o=mb(t,n),r=i[0];return Gs(r.original||r,o,t)}function $f(e,t,n){var i=Yl(e),o=mb(t,n),r=i[i.length-1];return Gs(r.original||r,o,t)}function mb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Yl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function yb(e,t){var n=Hn(e,lO);return lt(n,function(i){return cO(i,t)})}function cO(e,t){return Ln(t,e,1)==="intersect"}function lO(e){return e.original||e}function Ff(e,t){_e.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(uO(i,o)){var r=pO(i);r.incoming.forEach(function(a){var s=ql(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Ul(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Ff.$inject=["eventBus","modeling"],Be(Ff,_e);function uO(e,t){return A(e,"bpmn:Participant")&&ft(e)&&A(t,"bpmn:Participant")&&!ft(t)}function pO(e){var t=As([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){A(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){A(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const dO=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function vb(e){const t=Ee(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Wn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:dO.some(i=>A(n[0],i))}function xb(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function jf(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!vb(o))return;const a=xb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=Ee(i).get(a),l=Ee(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}jf.$inject=["injector","modeling"],Be(jf,_e);function Hf(e,t){_e.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=gt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Be(Hf,_e),Hf.$inject=["eventBus","modeling"];function zf(e,t,n){_e.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!A(r,"bpmn:SequenceFlow")||!A(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=fO(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Be(zf,_e),zf.$inject=["eventBus","bpmnRules","modeling"];function ka(e){return e.original||e}function fO(e,t){var n=Of(ka(e[e.length-2]),ka(e[e.length-1]),ka(t[1]),ka(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ka(e[0]),ka(t[t.length-1])]}function Gf(e,t){_e.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;A(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}Gf.$inject=["eventBus","modeling"],Be(Gf,_e);function Vf(e,t,n,i){_e.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var d,f;A(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),A(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(f=!0),n.canConnectSequenceFlow(l,u)&&(d="bpmn:SequenceFlow")),f&&t.removeConnection(c),d&&t.connect(l,u,{type:d,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,d=l.newTarget||u.target,f,g;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(g=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,d;!p||!p.length||(d=p.indexOf(c),d!==-1&&p.splice(d,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;V(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,d=p.businessObject,f;u.default&&(f=Bt(p.outgoing,da({id:p.businessObject.default.id})),f&&t.updateProperties(f,{conditionExpression:void 0})),u.conditionExpression&&d.sourceRef.default===d&&t.updateProperties(p.source,{default:void 0})})}Be(Vf,_e),Vf.$inject=["eventBus","modeling","bpmnRules","injector"];function Kl(e,t,n,i,o,r){i.invoke(_e,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=oi(l,function(p,d){var f=t.canReplace([d],d.host||d.parent||c);return f?p.concat(f.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=[];V(s.closure.topLevel,function(d){Wn(d)?u=u.concat(d.children):u=u.concat(d)}),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;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Be(Kl,_e),Kl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;V(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Kl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var hO=1500,gO={width:140,height:120},Wf={width:300,height:60},Uf={width:60,height:300},Xl={width:300,height:150},Zl={width:150,height:300},bb={width:140,height:120},wb={width:100,height:40};function _b(e){e.on("resize.start",hO,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(A(i,"bpmn:Lane")||A(i,"bpmn:Participant"))&&(n.resizeConstraints=bO(i,o,r)),A(i,"bpmn:SubProcess")&&ft(i)&&(n.minDimensions=bb),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=wb)})}_b.$inject=["eventBus"];var nr=Math.abs,mO=Math.min,yO=Math.max;function Eb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Oa(e,t,n){return Eb(e,t,n,mO)}function Da(e,t,n){return Eb(e,t,n,yO)}var vO={top:20,left:50,right:20,bottom:20},xO={top:50,left:20,right:20,bottom:20};function bO(e,t,n){var i=Ci(e),o=!0,r=!0,a=Hl(i,[i]),s=Ye(e),c={},l={},u=Sn(e),p=u?Wf:Uf;/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=Ye(g);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&nr(s.top-h.bottom)<10&&Da(c,"top",h.top+p.height),nr(s.top-h.top)<5&&Oa(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&nr(s.right-h.left)<10&&Oa(c,"right",h.right-p.width),nr(s.right-h.right)<5&&Da(l,"right",h.left+p.width)),/s/.test(t)&&(n&&nr(s.bottom-h.top)<10&&Oa(c,"bottom",h.bottom-p.height),nr(s.bottom-h.bottom)<5&&Da(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&nr(s.left-h.right)<10&&Da(c,"left",h.left+p.width),nr(s.left-h.left)<5&&Oa(l,"left",h.right-p.width))});var d=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(A(g,"bpmn:FlowElement")||A(g,"bpmn:Artifact"))}),f=u?vO:xO;return d.forEach(function(g){var h=Ye(g);/n/.test(t)&&(!u||o)&&Oa(l,"top",h.top-f.top),/e/.test(t)&&(u||r)&&Da(l,"right",h.right+f.right),/s/.test(t)&&(!u||r)&&Da(l,"bottom",h.bottom+f.bottom),/w/.test(t)&&(u||o)&&Oa(l,"left",h.left-f.left)}),{min:l,max:c}}function Sb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function La(e){return e.originalEvent||e.srcEvent}function qf(e){Sb(e),Sb(La(e))}function Gr(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 Rb(){return/mac/i.test(navigator.platform)}function Cb(e,t){return(La(e)||e).button===t}function ir(e){return Cb(e,0)}function wO(e){return Cb(e,1)}function Vs(e){var t=La(e)||e;return ir(e)?Rb()?t.metaKey:t.ctrlKey:!1}function Jl(e){var t=La(e)||e;return ir(e)&&t.shiftKey}var Mb=1001;function Ab(e,t){e.on("resize.start",Mb+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!Vs(n))}),e.on("resize.end",Mb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))return r&&(a=tx(a),t.resizeLane(o,a,i.balanced)),!1})}Ab.$inject=["eventBus","modeling"];var _O=500;function Yf(e,t,n,i,o){n.invoke(_e,this);function r(u){return st(u,["bpmn:ReceiveTask","bpmn:SendTask"])||EO(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!Bt(d,da({id:u.id}))}function s(u){if(A(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(A(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(A(u,"bpmn:MessageEventDefinition"))return"messageRef";if(A(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(st(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),d=p[0];return d.get(s(d))}function l(u,p){if(st(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var d=u.get("eventDefinitions"),f=d[0];return f.set(s(f),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var d=Ee(p),f=c(d),g;f&&!a(f)&&(g=e.getDefinitions().get("rootElements"),rn(g,f),u.addedRootElement=f)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var d=e.getDefinitions().get("rootElements");en(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=Ee(d),g=c(f);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",_O,function(u){var p=u.descriptor,d=p.businessObject,f=p.referencedRootElement;f&&(a(f)||(f=i.copyElement(f,o.create(f.$type))),l(d,f),delete p.referencedRootElement)})}Yf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Be(Yf,_e);function EO(e,t){return Je(t)||(t=[t]),No(t,function(n){return Ra(e,n)})}var Pb=Math.max;function Tb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return V(n,function(a){var s=a.id;A(a,"bpmn:Participant")&&(r[s]=RO(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=Sn(a)?Wf:Uf),A(a,"bpmn:SubProcess")&&ft(a)&&(r[s]=bb),A(a,"bpmn:TextAnnotation")&&(r[s]=wb),A(a,"bpmn:Group")&&(r[s]=gO)}),r})}Tb.$inject=["eventBus"];function SO(e){return e==="x"}function RO(e,t,n){var i=Sn(e);if(!AO(e))return i?Xl:Zl;var o=SO(t),r={};return o?i?r=Xl:r={width:MO(e,n,o),height:Zl.height}:i?r={width:Xl.width,height:CO(e,n,o)}:r=Zl,r}function CO(e,t,n){var i;return i=PO(e,t,n),Pb(Xl.height,i)}function MO(e,t,n){var i;return i=TO(e,t,n),Pb(Zl.width,i)}function AO(e){return!!tr(e).length}function PO(e,t,n){var i=tr(e),o;return o=Kf(i,t,n),e.height-o.height+Wf.height}function TO(e,t,n){var i=tr(e),o;return o=Kf(i,t,n),e.width-o.width+Uf.width}function Kf(e,t,n){var i,o,r;for(i=0;i<e.length;i++)if(o=e[i],!n&&t>=o.y&&t<=o.y+o.height||n&&t>=o.x&&t<=o.x+o.width)return r=tr(o),r.length?Kf(r,t,n):o}var kb="_plane";function Ob(e){var t=e.id;return kO(t)}function ro(e){var t=e.id;return A(e,"bpmn:SubProcess")?Db(t):t}function Vr(e){return Db(e)}function Ql(e){var t=gt(e);return A(t,"bpmndi:BPMNPlane")}function Db(e){return e+kb}function kO(e){return e.replace(new RegExp(kb+"$"),"")}var Lb=400,OO=600,Ib={x:180,y:160};function Ro(e,t,n,i,o,r,a){_e.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return A(p,"bpmn:SubProcess")&&!ft(p)}function l(p){var d=p.shape,f=p.newRootElement,g=Ee(d);f=s._addDiagram(f||g),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=Ee(d);s._removeDiagram(f);var g=p.newRootElement=a.get(ro(f));e.removeRootElement(g)}this.executed("shape.create",function(p){var d=p.shape;c(d)&&l(p)},!0),this.postExecuted("elements.create",function(p){var d=p.elements;V(d,function(f){if(c(f)){var g=a.get(ro(f));if(!(!g||!f.children||!f.children.length)){var h=Bb(f);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var d=p.shape;c(d)&&u(p)},!0),this.preExecute("shape.delete",function(p){var d=p.shape;!A(d,"bpmn:SubProcess")||!ft(d)||V(Ls([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(ro(d));f&&n.removeElements(f.children.slice())}},!0),this.executed("shape.delete",function(p){var d=p.shape;c(d)&&u(p)},!0),this.reverted("shape.delete",function(p){var d=p.shape;c(d)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var d=p.oldShape,f=p.newShape;!c(d)||!c(f)||(p.oldRoot=e.removeRootElement(ro(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,g=e.findRoot(ro(d));if(!(!f||!g)){var h=f.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,g=p.oldProperties,h=g.id,y=f.id;if(h!==y){if(Ql(d)){a.updateId(d,Vr(y)),a.updateId(h,y);return}var w=a.get(Vr(h));w&&a.updateId(Vr(h),Vr(y))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,g=p.oldProperties,h=g.id,y=f.id;if(h!==y){if(Ql(d)){a.updateId(d,Vr(h)),a.updateId(y,h);return}var w=a.get(Vr(y));w&&a.updateId(w,Vr(h))}}},!0),t.on("element.changed",function(p){var d=p.element;if(Ql(d)){var f=d,g=a.get(Ob(f));!g||g===f||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Lb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(ft(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",Lb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(ft(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",OO,function(p){var d=p.shape;if(A(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(ft(d))s._moveChildrenToShape(f.children.slice(),d),V(Ls(d.children),h=>{n.moveShape(h.annotation,{x:0,y:0},d.parent),V(h.associations,y=>{n.moveConnection(y,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var g=Bb(d);s._moveChildrenToShape(g,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var g=ro(d),h=a.get(g);h&&f.push.apply(f,h.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,g=p.elements,h=f.parent,y=A(gt(h),"bpmndi:BPMNPlane");if(y){var w=Ob(h),m=Bt(g,function(v){return v.id===w});m&&(d.parent=m.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}Be(Ro,_e),Ro.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 o=ln(i),r;if(!t.x)r={x:Ib.x-o.x,y:Ib.y-o.y};else{var a=et(t),s=et(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},Ro.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Cx(e).map(i=>i.annotation));n.size&&V(Ls(e.children),i=>{n.has(i.annotation)&&V(i.associations,o=>{t.removeConnection(o)})})},Ro.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},Ro.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},Ro.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:ro(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},Ro.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Bt(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ro.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function DO(e){var t=[];return V(Ls(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Bb(e){return e.children.slice().concat(DO(e.children)).concat(LO(e))}function LO(e){return Qd(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Xf(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!A(o,"bpmn:SubProcess")||A(o,"bpmn:AdHocSubProcess")||!(A(i,"bpmn:Task")||A(i,"bpmn:CallActivity"))||!ft(o))){var r=IO(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Xf.$inject=["injector","modeling"],Be(Xf,_e);function IO(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Zf(e,t){_e.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;A(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&&A(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!A(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,si(o)||""),c=a.y!==o.y&&Math.abs(a.y+a.height-(o.y+o.height))<=1,l=o.y+o.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Be(Zf,_e),Zf.$inject=["eventBus","textRenderer"];function Jf(e,t){_e.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ft(i))return;var o=As(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();V(s,function(l){r(l,!0)}),V(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,et(i)):t.reconnectStart(a,i,et(i)))}},!0)}Be(Jf,_e),Jf.$inject=["eventBus","modeling"];var Qf=500;function eh(e,t,n){_e.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=BO(c).concat([a]),p=Vx(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 r(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"],Qf,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?gt(c).isExpanded=!1:(i(c.children),gt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Qf,function(a){var s=a.context,c=s.shape;c.collapsed?gt(c).isExpanded=!1:gt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Qf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=r(s,c):l=o(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Be(eh,_e),eh.$inject=["eventBus","elementFactory","modeling"];function BO(e){return e.filter(function(t){return!t.hidden})}function th(e,t,n,i){t.invoke(_e,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;at(a)||(A(a,"bpmn:Participant")&&ft(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;A(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Be(th,_e),th.$inject=["canvas","injector","moddle","modeling"];function nh(e,t){_e.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;NO(o,r)&&t.updateProperties(r,{default:null})})}Be(nh,_e),nh.$inject=["eventBus","modeling"];function NO(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=Ee(t),i=Ee(e);return n.get("default")===i}var $O=500,FO=5e3,Nb=["shape.create","shape.delete","shape.move","shape.resize"],$b=[...Nb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function ih(e,t){_e.call(this,e);var n;function i(){return n=n||new jO,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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($b,FO,function(){i()}),this.postExecuted($b,$O,function(){r()}),this.preExecute(Nb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(A(c,"bpmn:Lane")&&l.addLane(c),A(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}ih.$inject=["eventBus","modeling"],Be(ih,_e);function jO(){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 HO=500,zO=5e3,Fb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],jb=[...Fb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function oh(e,t){_e.call(this,e);var n;function i(){return n=n||new GO,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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(jb,zO,function(){i()}),this.postExecuted(jb,HO,function(){r()}),this.preExecute(Fb,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(A(s,"bpmn:FlowElement")&&c.addFlowElement(s),A(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;A(s,"bpmn:Group")&&o().addGroup(s)})}oh.$inject=["eventBus","modeling"],Be(oh,_e);function GO(){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 rh(e,t){_e.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)VO(r)&&!UO(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Be(rh,_e),rh.$inject=["eventBus","modeling"];function VO(e){const t=Ee(e);return t&&t.isForCompensation}function WO(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ra(e,"bpmn:CompensateEventDefinition")}function UO(e){return e.incoming.filter(n=>WO(n.source)).length>0}const qO={__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",ff],appendBehavior:["type",hf],associationBehavior:["type",mf],attachEventBehavior:["type",Ll],artifactBehavior:["type",gf],boundaryEventBehavior:["type",yf],categoryRootElementReferenceBehavior:["type",vf],compensateBoundaryEventBehaviour:["type",xf],createBehavior:["type",bf],createDataObjectBehavior:["type",wf],createParticipantBehavior:["type",Sf],dataInputAssociationBehavior:["type",Rf],dataStoreBehavior:["type",Cf],deleteLaneBehavior:["type",Mf],detachEventBehavior:["type",zl],dropOnFlowBehavior:["type",Pf],eventBasedGatewayBehavior:["type",Tf],fixHoverBehavior:["type",Zx],groupBehavior:["type",kf],importDockingFix:["type",Qx],isHorizontalFix:["type",Df],labelBehavior:["type",If],layoutConnectionBehavior:["type",Bf],messageFlowBehavior:["type",Ff],nonInterruptingBehavior:["type",jf],removeElementBehavior:["type",zf],removeEmbeddedLabelBoundsBehavior:["type",Hf],removeParticipantBehavior:["type",Gf],replaceConnectionBehavior:["type",Vf],replaceElementBehaviour:["type",Kl],resizeBehavior:["type",_b],resizeLaneBehavior:["type",Ab],rootElementReferenceBehavior:["type",Yf],spaceToolBehavior:["type",Tb],subProcessPlaneBehavior:["type",Ro],subProcessStartEventBehavior:["type",Xf],textAnnotationBehavior:["type",Zf],toggleCollapseConnectionBehaviour:["type",Jf],toggleElementCollapseBehaviour:["type",eh],unclaimIdBehavior:["type",th],unsetDefaultFlowBehavior:["type",nh],updateFlowNodeRefsBehavior:["type",ih],updateCategoryValueRefsBehavior:["type",oh],setCompensationActivityAfterPasteBehavior:["type",rh]};function ah(e){this._commandStack=e.get("commandStack",!1)}ah.$inject=["injector"],ah.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const ao={__init__:["rules"],rules:["type",ah]};function Mi(e){_e.call(this,e),this.init()}Mi.$inject=["eventBus"],Be(Mi,_e),Mi.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},Mi.prototype.init=function(){};function Hb(e,t){var n=Ln(e,t,-15);return n!=="intersect"?n:null}function Bn(e){Mi.call(this,e)}Be(Bn,Mi),Bn.$inject=["eventBus"],Bn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return YO(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},o=i.targetParent,r=i.targetAttach;if(r)return!1;o&&(n.parent=o);try{return tu(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return tu(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 ew(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Dt(i)&&!nu(t,i)?!1:Bo(t,function(o){return Dt(o)?tu(o.source,o.target,o):o.host?Ws(o,o.host,null,n):uh(o,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,o=e.hints;return o!=null&&o.keyboardMove&&n.some(function(a){return Yb(a)&&!n.includes(a.host)})?!1:Ws(n,t,null,i)||Jb(n,t,i)||Qb(n,t)||nu(n,t)}),this.addRule("shape.create",function(e){return uh(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ws(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return rw(n,t)})},Bn.prototype.canConnectMessageFlow=iw,Bn.prototype.canConnectSequenceFlow=ow,Bn.prototype.canConnectDataAssociation=ph,Bn.prototype.canConnectAssociation=tw,Bn.prototype.canConnectCompensationAssociation=nw,Bn.prototype.canMove=Qb,Bn.prototype.canAttach=Ws,Bn.prototype.canReplace=Jb,Bn.prototype.canDrop=Ia,Bn.prototype.canInsert=nu,Bn.prototype.canCreate=uh,Bn.prototype.canConnect=tu,Bn.prototype.canResize=ew,Bn.prototype.canCopy=rw;function YO(e){return sh(e)?null:st(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function sh(e){return!e||at(e)}function zb(e){do{if(A(e,"bpmn:Process"))return Ee(e);if(A(e,"bpmn:Participant"))return Ee(e).processRef||Ee(e)}while(e=e.parent)}function ch(e){return A(e,"bpmn:TextAnnotation")}function lh(e){return A(e,"bpmn:Group")&&!e.labelTarget}function Gb(e){return A(e,"bpmn:BoundaryEvent")&&so(e,"bpmn:CompensateEventDefinition")}function eu(e){return Ee(e).isForCompensation}function KO(e,t){var n=zb(e),i=zb(t);return n===i}function XO(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&Ub(e,"bpmn:MessageEventDefinition"))}function ZO(e){return A(e,"bpmn:InteractionNode")&&!eu(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&Ub(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!so(e,"bpmn:MessageEventDefinition"))}function Vb(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return Ee(t);if(A(t,"bpmn:Participant"))return Ee(t).processRef}return null}function Wb(e,t){var n=Vb(e),i=Vb(t);return n===i}function so(e,t){var n=Ee(e);return!!Bt(n.eventDefinitions||[],function(i){return A(i,t)})}function Ub(e,t){var n=Ee(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function JO(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&so(e,"bpmn:LinkEventDefinition"))&&!Gb(e)&&!eu(e)}function QO(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&so(e,"bpmn:LinkEventDefinition"))&&!eu(e)}function eD(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(so(e,"bpmn:MessageEventDefinition")||so(e,"bpmn:TimerEventDefinition")||so(e,"bpmn:ConditionalEventDefinition")||so(e,"bpmn:SignalEventDefinition"))}function tD(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function qb(e,t){var n=tD(t);return n.indexOf(e)!==-1}function tu(e,t,n){if(sh(e)||sh(t))return null;if(!A(n,"bpmn:DataAssociation")){if(iw(e,t))return{type:"bpmn:MessageFlow"};if(ow(e,t))return{type:"bpmn:SequenceFlow"}}var i=ph(e,t);return i||(nw(e,t)?{type:"bpmn:Association",associationDirection:"One"}:tw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ia(e,t){return at(e)||lh(e)?!0:A(t,"bpmn:Participant")&&!ft(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):st(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:A(e,"bpmn:Lane")?A(t,"bpmn:Participant")||A(t,"bpmn:Lane"):A(e,"bpmn:BoundaryEvent")&&!nD(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?ft(t):st(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?No(Ee(t).get("participants"),function(n){return!!n.get("processRef")}):st(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?st(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function nD(e){return Ee(e).cancelActivity&&(Kb(e)||Xb(e))}function Yb(e){return!at(e)&&A(e,"bpmn:BoundaryEvent")}function iD(e){return A(e,"bpmn:Lane")}function oD(e){return Yb(e)||A(e,"bpmn:IntermediateThrowEvent")&&Kb(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&Xb(e)}function Kb(e){var t=Ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Xb(e){return Zb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Zb(e,t){return t.some(function(n){return so(e,n)})}function rD(e){return A(e,"bpmn:ReceiveTask")&&Bt(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Ws(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return at(o)||!oD(o)||Wn(t)||!A(t,"bpmn:Activity")||eu(t)||i&&!Hb(i,t)||rD(t)?!1:"attach"}function Jb(e,t,n){if(!t)return!1;var i={replacements:[]};return V(e,function(o){Wn(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&Ia(o,t)&&(gk(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(mk(o)||yk(o)||vk(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),Zb(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&A(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),A(t,"bpmn:Transaction")||so(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(A(o,"bpmn:EndEvent")&&Ia(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Ws(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Qb(e,t){return No(e,iD)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ia(n,t)})}function uh(e,t,n,i){return t?at(e)||lh(e)?!0:Ia(e,t)||nu(e,t):!1}function ew(e,t,n){return A(e,"bpmn:SubProcess")?ft(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:ch(e)?n?n==="e"||n==="w":!0:lh(e)?!0:at(e)?n?n==="e"||n==="w":!0:!1}function aD(e,t){var n=ch(e),i=ch(t);return(n||i)&&n!==i}function tw(e,t){return qb(t,e)||qb(e,t)?!1:aD(e,t)?!0:!!ph(e,t)}function nw(e,t){return Wb(e,t)&&Gb(e)&&A(t,"bpmn:Activity")&&!cD(t,e)&&!Wn(t)}function iw(e,t){return sw(e)&&!sw(t)?!1:XO(e)&&ZO(t)&&!KO(e,t)}function ow(e,t){return JO(e)&&QO(t)&&Wb(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!eD(t))}function ph(e,t){return st(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&st(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:st(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&st(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function nu(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:st(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!at(t)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&Ia(e,t.parent)}function dh(e,t){return e&&t&&e.indexOf(t)!==-1}function rw(e,t){return at(t)?!0:!(A(t,"bpmn:Lane")&&!dh(e,t.parent)||A(t,"bpmn:MessageFlow")&&!sD(e,t))}function sD(e,t){var n=aw(t.source),i=aw(t.target);return dh(e,n)&&dh(e,i)}function aw(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function sw(e){return Aa(e,"bpmn:Process")||Aa(e,"bpmn:Collaboration")}function cD(e,t){return e.attachers.includes(t)}const lD={__depends__:[ao],__init__:["bpmnRules"],bpmnRules:["type",Bn]};var uD=2e3;function cw(e,t){e.on("saveXML.start",uD,n);function n(){var i=t.getRootElements();V(i,function(o){var r=gt(o),a,s;a=As([o]),a=lt(a,function(c){return c!==o&&!c.labelTarget}),s=Hn(a,gt),r.set("planeElement",s)})}}cw.$inject=["eventBus","canvas"];const pD={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",cw]};function iu(e){_e.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);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,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}iu.prototype.getOrdering=function(e,t){return null},Be(iu,_e);function fh(e,t){iu.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=Bt(n,function(c){return st(a,[c.type])});return s&&s.order||{level:1}}function o(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function r(a,s,c){for(var l=s;l&&!st(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||A(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=hm(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<o(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}fh.$inject=["eventBus","canvas"],Be(fh,iu);const dD={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",fh]};function Us(){}Us.prototype.get=function(){return this._data},Us.prototype.set=function(e){this._data=e},Us.prototype.clear=function(){var e=this._data;return delete this._data,e},Us.prototype.isEmpty=function(){return!this._data};const fD={clipboard:["type",Us]};var lw=1500;function uw(e,t,n){var i=this,o=n.get("dragging",!1);function r(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),o.hover({element:l,gfx:c}),o.move(s))}}o&&t.on("drag.start",function(a){t.once("drag.move",lw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",lw,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=Gr(a),c=document.elementFromPoint(s.x,s.y),hD(c)}}uw.$inject=["elementRegistry","eventBus","injector"];function hD(e){return Nr(e,"svg, .djs-element",!0)}const gD={__init__:["hoverFix"],hoverFix:["type",uw]};function mD(e){return!0}function ou(e){return ir(e)||wO(e)}var pw=500;function dw(e,t,n){var i=this;function o(k,P,F){if(!s(k,P)){var z,G,ne;F?G=t.getGraphics(F):(z=P.delegateTarget||P.target,z&&(G=z,F=t.get(G))),!(!G||!F)&&(ne=e.fire(k,{element:F,gfx:G,originalEvent:P}),ne===!1&&(P.stopPropagation(),P.preventDefault()))}}var r={};function a(k){return r[k]}function s(k,P){var F=l[k]||ir;return!F(P)}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":mD,"element.mousedown":ou,"element.mouseup":ou,"element.click":ou,"element.dblclick":ou};function u(k,P,F){var z=c[k];if(!z)throw new Error("unmapped DOM event name <"+k+">");return o(z,P,F)}var p="svg, .djs-element";function d(k,P,F,z){var G=r[F]=function(ne){o(F,ne)};z&&(l[F]=z),G.$delegate=ri.bind(k,p,P,G)}function f(k,P,F){var z=a(F);z&&ri.unbind(k,P,z.$delegate)}function g(k){V(c,function(P,F){d(k,F,P)})}function h(k){V(c,function(P,F){f(k,F,P)})}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 P=k.element,F=k.gfx;e.fire("interactionEvents.createHit",{element:P,gfx:F})}),e.on(["shape.changed","connection.changed"],pw,function(k){var P=k.element,F=k.gfx;e.fire("interactionEvents.updateHit",{element:P,gfx:F})}),e.on("interactionEvents.createHit",pw,function(k){var P=k.element,F=k.gfx;i.createDefaultHit(P,F)}),e.on("interactionEvents.updateHit",function(k){var P=k.element,F=k.gfx;i.updateDefaultHit(P,F)});var y=E("djs-hit djs-hit-stroke"),w=E("djs-hit djs-hit-click-stroke"),m=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:m,"click-stroke":w,stroke:y,"no-move":v};function E(k,P){return P=Y({stroke:"white",strokeWidth:15},P||{}),n.cls(k,["no-fill","no-border"],P)}function C(k,P){var F=b[P];if(!F)throw new Error("invalid hit type <"+P+">");return Le(k,F),k}function I(k,P){nt(k,P)}this.removeHits=function(k){var P=Es(".djs-hit",k);V(P,cn)},this.createDefaultHit=function(k,P){var F=k.waypoints,z=k.isFrame,G;return F?this.createWaypointsHit(P,F):(G=z?"stroke":"all",this.createBoxHit(P,G,{width:k.width,height:k.height}))},this.createWaypointsHit=function(k,P){var F=Ms(P);return C(F,"stroke"),I(k,F),F},this.createBoxHit=function(k,P,F){F=Y({x:0,y:0},F);var z=He("rect");return C(z,P),Le(z,F),I(k,z),z},this.updateDefaultHit=function(k,P){var F=Rt(".djs-hit",P);if(F)return k.waypoints?Jd(F,k.waypoints):Le(F,{width:k.width,height:k.height}),F},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}dw.$inject=["eventBus","elementRegistry","styles"];const ru={__init__:["interactionEvents"],interactionEvents:["type",dw]};function Ba(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ba.$inject=["eventBus","canvas"],Ba.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()})}},Ba.prototype.get=function(){return Array.from(this._selectedElements)},Ba.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ba.prototype.select=function(e,t){var n=this.get();Je(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?V(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var fw="hover",hw="selected";function gw(e,t){this._canvas=e;function n(o,r){e.addMarker(o,r)}function i(o,r){e.removeMarker(o,r)}t.on("element.hover",function(o){n(o.element,fw)}),t.on("element.out",function(o){i(o.element,fw)}),t.on("selection.changed",function(o){function r(l){i(l,hw)}function a(l){n(l,hw)}var s=new Set(o.oldSelection),c=new Set(o.newSelection);for(let l of s)c.has(l)||r(l);for(let l of c)s.has(l)||a(l)})}gw.$inject=["canvas","eventBus"];function mw(e,t,n,i){e.on("create.end",500,function(o){var r=o.context,a=r.canExecute,s=r.elements,c=r.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Je(l)?t.select(l):t.select(s.filter(yD))}}),e.on("connect.end",500,function(o){var r=o.context,a=r.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(o){var r=o.previousSelection||[],a=i.get(o.context.shape.id),s=Bt(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(ir(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Jl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}mw.$inject=["eventBus","selection","canvas","elementRegistry"];function yD(e){return!e.hidden}const Ai={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ru],selection:["type",Ba],selectionVisuals:["type",gw],selectionBehavior:["type",mw]};var vD=/^djs-cursor-.*$/;function au(e){var t=Mt(document.body);t.removeMatching(vD),e&&t.add("djs-cursor-"+e)}function yw(){au(null)}var xD=5e3;function vw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,xD,n),function(){e.off(t,n)}}var bD=["c","C"],wD=["v","V"],_D=["d","D"],ED=["x","X"],SD=["y","Y"],xw=["z","Z"];function RD(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function li(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function bn(e,t){return e=Je(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function hh(e){return e.shiftKey}function CD(e){return li(e)&&bn(bD,e)}function MD(e){return li(e)&&bn(wD,e)}function AD(e){return li(e)&&bn(_D,e)}function PD(e){return li(e)&&bn(ED,e)}function TD(e){return li(e)&&!hh(e)&&bn(xw,e)}function kD(e){return li(e)&&(bn(SD,e)||bn(xw,e)&&hh(e))}var Na=Math.round,bw="djs-drag-active";function Wr(e){e.preventDefault()}function OD(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function DD(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ww(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(v.x-E.left)/b.scale,y:b.y+(v.y-E.top)/b.scale}}function s(v,b){b=b||r;var E=e.createEvent(Y({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(b.prefix+"."+v,E)}function c(v){var b=v.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(v,b){var E=r.payload,C=r.displacement,I=r.globalStart,k=Gr(v),P=Gi(k,I),F=r.localStart,z=a(k),G=Gi(z,F);if(!r.active&&(b||DD(P)>r.threshold)){if(Y(E,{x:Na(F.x+C.x),y:Na(F.y+C.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&au(r.cursor),t.addMarker(t.getRootElement(),bw)}qf(v),r.active&&(Y(E,{x:Na(z.x+C.x),y:Na(z.y+C.y),dx:Na(G.x),dy:Na(G.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,qf(v)),E=s("end")),E===!1&&s("rejected"),b=w(E!==!0),s("ended",b)}function p(v){bn("Escape",v)&&(Wr(v),y())}function d(v){var b;r.active&&(b=vw(e),setTimeout(b,400),Wr(v)),u(v)}function f(v){l(v)}function g(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function h(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function y(v){var b;if(r){var E=r.active;E&&s("cancel"),b=w(v),E&&s("canceled",b)}}function w(v){var b,E;s("cleanup"),yw(),r.trapClick?E=d:E=u,Ue.unbind(document,"mousemove",l),Ue.unbind(document,"dragstart",Wr),Ue.unbind(document,"selectstart",Wr),Ue.unbind(document,"mousedown",E,!0),Ue.unbind(document,"mouseup",E,!0),Ue.unbind(document,"keyup",p),Ue.unbind(document,"touchstart",f,!0),Ue.unbind(document,"touchcancel",y,!0),Ue.unbind(document,"touchmove",l,!0),Ue.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),bw);var C=r.payload.previousSelection;return v!==!1&&C&&!n.get().length&&c(C),b=r,r=null,b}function m(v,b,E,C){r&&y(!1),typeof b=="string"&&(C=E,E=b,b=null),C=Y({},o,C||{});var I=C.data||{},k,P,F,z,G;if(C.trapClick?z=d:z=u,v?(k=La(v)||v,P=Gr(v),qf(v),k.type==="dragstart"&&Wr(k)):(k=null,P={x:0,y:0}),F=a(P),b||(b=F),G=OD(k),r=Y({prefix:E,data:I,payload:{},globalStart:P,displacement:Gi(b,F),localStart:F,isTouch:G},C),C.manual||(G?(Ue.bind(document,"touchstart",f,!0),Ue.bind(document,"touchcancel",y,!0),Ue.bind(document,"touchmove",l,!0),Ue.bind(document,"touchend",u,!0)):(Ue.bind(document,"mousemove",l),Ue.bind(document,"dragstart",Wr),Ue.bind(document,"selectstart",Wr),Ue.bind(document,"mousedown",z,!0),Ue.bind(document,"mouseup",z,!0)),Ue.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;C.autoActivate&&l(v,!0)}e.on("diagram.destroy",y),this.init=m,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){Y(o,v)}}ww.$inject=["eventBus","canvas","selection","elementRegistry"];const Co={__depends__:[gD,Ai],dragging:["type",ww]};function Ur(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ur.prototype.next=function(){return this._prefix+ ++this._counter};const LD=new Ur("ps");var ID=["marker-start","marker-mid","marker-end"],BD=["circle","ellipse","line","path","polygon","polyline","path","rect"];function or(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}or.$inject=["elementRegistry","eventBus","canvas","styles"],or.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},or.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},or.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Vd(n);return this._cloneMarkers(Zo(o),i),Le(o,this._styles.cls(i,[])),nt(t,o),Le(o,"data-preview-support-element-id",e.id),o},or.prototype.addFrame=function(e,t){var n=He("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return nt(t,n),Le(n,"data-preview-support-element-id",e.id),n},or.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),jD(e)&&ID.forEach(function(o){if(Le(e,o)){var r=ND(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},or.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,LD.next()].join("-"),a=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Vd(n);s.id=r,dt(s).add(o);var c=Rt(":scope > defs",e);c||(c=He("defs"),nt(e,c)),nt(c,s);var l=FD(s.id);Le(t,i,l)};function ND(e,t,n){var i=$D(Le(e,t));return Rt("marker#"+i,n||document)}function $D(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function FD(e){return"url(#"+e+")"}function jD(e){return BD.indexOf(e.nodeName)!==-1}const $a={__init__:["previewSupport"],previewSupport:["type",or]};var HD="drop-ok",_w="drop-not-ok",Ew="attach-ok",Sw="new-parent",Rw="create",zD=2e3;function Cw(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=lt(c,function(m){var v=m.labelTarget;return!m.parent&&!(at(m)&&c.indexOf(v)!==-1)});var f=Bt(c,function(m){return!Dt(m)}),g=!1,h=!1,y=!1;Aw(c)&&(g=o.allowed("shape.attach",{position:u,shape:f,target:l})),g||(Aw(c)?y=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var w=d.connectionTarget;return y||g?(f&&p&&(h=o.allowed("connection.create",{source:w===p?f:p,target:w===p?p:f,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[Ew,HD,_w,Sw].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,d=l.source,f=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Mw(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,g,d,f);p&&h!==null&&(l.target=p,h&&h.attach?a(p,Ew):a(p,h?Sw:_w))}),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,d=l.elements,f=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,w=l.hints||{};if(g===!1||!f)return!1;Mw(c);var m={x:c.x,y:c.y};y?p=i.appendShape(u,p,m,f,{attach:h,connection:y===!0?{}:y,connectionTarget:w.connectionTarget}):(d=i.createElements(d,m,f,Y({},w,{attach:h})),p=Bt(d,function(v){return!Dt(v)})),Y(l,{elements:d,shape:p}),Y(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===Rw&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],zD,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Je(l)||(l=[l]);var p=Bt(l,function(g){return!Dt(g)});if(p){u=Y({elements:l,hints:{},shape:p},u||{}),V(l,function(g){Qe(g.x)||(g.x=0),Qe(g.y)||(g.y=0)});var d=lt(l,function(g){return!g.hidden}),f=ln(d);V(l,function(g){Dt(g)&&(g.waypoints=Hn(g.waypoints,function(h){return{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2}})),Y(g,{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2})}),t.init(c,Rw,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Cw.$inject=["canvas","dragging","eventBus","modeling","rules"];function Mw(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 Aw(e){return e&&e.length===1&&!Dt(e[0])}var GD=750;function Pw(e,t,n,i,o){function r(a){var s=He("g");Le(s,o.cls("djs-drag-group",["no-events"]));var c=He("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Zo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Zo(u),l),In(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",GD,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),nt(p,u)),In(u,a.x,a.y)):cn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&cn(c)})}Pw.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const su={__depends__:[Co,$a,ao,Ai],__init__:["create","createPreview"],create:["type",Cw],createPreview:["type",Pw]};function gh(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var o=t._svg=i.svg;o.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}gh.$inject=["eventBus"],gh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||VD(0,0)};function VD(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,a,!1,!1,!1,!1,0,null),n}const qs={__init__:["mouse"],mouse:["type",gh]};var Tw=2e3;function ui(e,t,n,i,o,r,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=o,this._modeling=r,this._mouse=a,this._rules=s,o.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),WD(u)&&(l.priority=2,l.host=u.host.id),Dt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=UD(u)),at(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),V(["x","y","width","height"],function(d){Qe(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Tw,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Tw,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;Y(l,{createElementsBehavior:!1})})}ui.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ui.prototype.copy=function(e,t={}){var n,i;return Je(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Je(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ui.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 o=t.hints,r=this._createElements(i);if(t.element&&t.point)return this._paste(r,t.element,t.point,o);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:o})}}},ui.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ui.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(o){return n[o.id]});return i.length>0&&this._modeling.removeElements(i),t},ui.prototype._getElementIdsFromTree=function(e){var t={};return V(e,function(n){V(n,function(i){i.id&&(t[i.id]=!0)})}),t},ui.prototype._paste=function(e,t,n,i){V(e,function(r){Qe(r.x)||(r.x=0),Qe(r.y)||(r.y=0)});var o=ln(e);return V(e,function(r){Dt(r)&&(r.waypoints=Hn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),Y(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,Y({},i))},ui.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return V(e,function(r,a){r=Yi(r,"priority"),V(r,function(s){var c=Y({},Ki(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Dt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(at(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},ui.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ki(e,["id"]));return t},ui.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ki(e,["id"]));return t},ui.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ki(e,["id"]));return t},ui.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Dt(e)&&(!n.has(e.source)||!n.has(e.target))||at(e)&&!n.has(e.labelTarget))},ui.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=xl(e);function s(p,d){return t.allowed("element.copy",{element:p,elements:d})}function c(p,d){var f=r.get(p);if(!f){var g={element:p,depth:d};o.push(g),r.set(p,g);return}if(f.depth<d){o=l(f,o);var h={element:f.element,depth:d};o.push(h),r.set(p,h)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}Fr(a,function(p,d,f){if(at(p))return;V(p.labels,function(y){c(y,f)});function g(y){y&&y.length&&V(y,function(w){V(w.labels,function(m){c(m,f)}),c(w,f)})}V([p.attachers,p.incoming,p.outgoing],g),c(p,f);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Hn(o,function(p){return p.element});var u=new Set(e);return o=Hn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Yi(o,function(p){return p.descriptor.priority}),e=Hn(o,function(p){return p.element}),V(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){Ow(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Ow(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function WD(e){return!!e.host}function UD(e){return Hn(e.waypoints,function(t){return t=kw(t),t.original&&(t.original=kw(t.original)),t})}function kw(e){return Y({},e)}function Ow(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const qD={__depends__:[fD,su,qs,ao],__init__:["copyPaste"],copyPaste:["type",ui]};function mh(e,t,n){Je(n)||(n=[n]),V(n,function(i){Ar(e[i])||(t[i]=e[i])})}var yh=750;function Dw(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",yh,function(c){var l=c.descriptor,u=c.element,p=Ee(u);if(at(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(gt(u),!0);f.bpmnElement=d,mh(d,l,"name"),mh(f,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=Ee(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(Ee(c).attachedToRef=Ee(l[c.host])),Ki(u,oi(u,function(d,f,g){var h=f.element,y=f.property;return g===c.id&&(h.set(y,p),d.push(c.id)),d},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,d=u.di;if(at(u)){u.businessObject=Ee(l[u.labelTarget]),u.di=gt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,mh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",yh,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=Ee(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;A(l,"bpmn:SubProcess")&&V(Ls(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",yh,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Dw.$inject=["bpmnFactory","eventBus","moddleCopy"];const YD=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],KD=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ys(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Yi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=vn(o)&&o.$descriptor;if(a&&KD.includes(a))return r;if(a&&YD.includes(a)||a&&s&&!Bt(s.properties,da({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(A(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Ys.$inject=["eventBus","bpmnFactory","moddle"],Ys.prototype.copyElement=function(e,t,n,i=!1){n&&!Je(n)&&(n=[n]),n=n||vh(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Je(o)&&(n=o),V(n,r=>{let a;ii(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!yn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Ys.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return vn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):Je(e)?oi(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):vn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},Ys.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 vh(e,t){return oi(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Lw={__depends__:[qD],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Dw],moddleCopy:["type",Ys]};var Iw=Math.round;function xh(e,t){this._modeling=e,this._eventBus=t}xh.$inject=["modeling","eventBus"],xh.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=Iw(s+r/2),u=Iw(c+a/2),p=i.replaceShape(e,Y({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Bw(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Bw.$inject=["selection","eventBus"];const XD={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Bw],replace:["type",xh]};function ZD(e,t,n){Je(n)||(n=[n]),V(n,function(i){Ar(e[i])||(t[i]=e[i])})}var JD=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function QD(e,t){var n=e&&ii(e,"collapsed")?e.collapsed:!ft(e),i;return t&&(ii(t,"collapsed")||ii(t,"isExpanded"))?i=ii(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Nw(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(cu(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&QD(s,c))return i.toggleCollapse(s),s;var d=e.create(u),f={type:u,businessObject:d};f.di={},u==="bpmn:ExclusiveGateway"&&(f.di.isMarkerVisible=!0),ZD(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var g=vh(p.$descriptor),h=vh(d.$descriptor,!0),y=eL(g,h);Y(d,$i(c,JD));var w=lt(y,function(b){return b==="eventDefinitions"?$w(s,c.eventDefinitionType):b==="loopCharacteristics"?!Wn(d):ii(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Wn(d):!0});if(d=n.copyElement(p,d,w),c.eventDefinitionType&&($w(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(cu(p))f.isExpanded=ft(s);else if(c&&ii(c,"isExpanded")){f.isExpanded=c.isExpanded;var m=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=m.width,f.height=m.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}ft(s)&&!A(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(cu(p)&&!cu(d)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=Sn(s);gt(s).isHorizontal||(gt(f).isHorizontal=v),f.width=v?s.width:t.getDefaultSize(f).width,f.height=v?t.getDefaultSize(f).height:s.height}return r.allowed("shape.resize",{shape:d})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),d.name=p.name,st(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&st(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!A(p,"bpmn:BoundaryEvent")&&A(d,"bpmn:BoundaryEvent")&&(f.host=c.host),(f.type==="bpmn:DataStoreReference"||f.type==="bpmn:DataObjectReference")&&(f.x=s.x+(s.width-f.width)/2),o.replaceElement(s,f,{...l,targetElement:c})}this.replaceElement=a}Nw.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function cu(e){return A(e,"bpmn:SubProcess")}function $w(e,t){var n=Ee(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function eL(e,t){return e.filter(function(n){return t.includes(n)})}const Fw={__depends__:[Lw,XD,Ai],bpmnReplace:["type",Nw]};var tL=250;function qr(e){this._eventBus=e,this._tools=[],this._active=null}qr.$inject=["eventBus"],qr.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)},qr.prototype.isActive=function(e){return e&&this._active===e},qr.prototype.length=function(e){return this._tools.length},qr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},qr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),V(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,tL,function(o){this._active&&(nL(o)||this.setActive(null))},this)};function nL(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Nr(t,'.group[data-group="tools"]')}const lu={__depends__:[Co],__init__:["toolManager"],toolManager:["type",qr]};function iL(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 oL(e,t){var n=[],i=new Set(e);V(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;V(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function rL(e,t,n){var i=e.x,o=e.y,r=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:o+c,width:r,height:a-c};case"s":return{x:i,y:o,width:r,height:a+c};case"w":return{x:i+s,y:o,width:r-s,height:a};case"e":return{x:i,y:o,width:r+s,height:a};default:throw new Error("unknown direction: "+t)}}var bh=Math.abs,aL=Math.round,Mo={x:"width",y:"height"},jw="crosshair",rr={n:"top",w:"left",s:"bottom",e:"right"},sL=1500,uu={n:"s",w:"e",s:"n",e:"w"},pu=20;function Pi(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.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",sL,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&zw(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,g=l.start;if(l.initialized){zw(c);var h={x:0,y:0};h[u]=aL(c["d"+u]),s.makeSpace(d,f,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Pi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Pi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:jw,data:{context:{reactivate:n}},trapClick:!1})},Pi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:jw,data:{context:{}}})},Pi.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Pi.prototype.init=function(e,t){var n=bh(e.dx)>bh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(bh(i)<5)return!1;i<0&&(i*=-1),Vs(e)&&(i*=-1);var r=iL(n,i),a=this._canvas.getRootElement();!Jl(e)&&e.hover&&(a=e.hover);var s=[...As(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=cL(c,n,r,o,l);return Y(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),au("resize-"+(n==="x"?"ew":"ns")),!0},Pi.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(f){s.has(f)||(s.add(f),r.push(f));var g=f.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function d(f){c.has(f)||(c.add(f),a.push(f))}return V(e,function(f){if(!(!f.parent||at(f))){if(Dt(f)){u.push(f);return}var g=f[t],h=g+f[Mo[t]];if(lL(f)&&(n>0&&et(f)[t]>i||n<0&&et(f)[t]<i)){l.push(f);return}if(n>0&&g>i||n<0&&h<i){p(f);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),V(r,function(f){var g=f.attachers;g&&V(g,function(h){p(h)})}),V(l,function(f){var g=f.host;(s.has(g)||c.has(g))&&p(f)}),V(u,function(f){var g=f.source,h=f.target,y=f.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},Pi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Pi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Hw(e){return{top:e.top-pu,right:e.right+pu,bottom:e.bottom+pu,left:e.left-pu}}function zw(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Qe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Qe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Qe(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Qe(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function cL(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return V(a,function(d){var f=d.attachers,g=d.children,h=Ye(d),y=lt(g,function(G){return!Dt(G)&&!at(G)&&!u.has(G)&&!p.has(G)}),w=lt(g,function(G){return!Dt(G)&&!at(G)&&u.has(G)}),m,v,b,E=[],C=[],I,k,P,F;y.length&&(v=Hw(Ye(ln(y))),m=i-h[rr[n]]+v[rr[n]],n==="n"?s.bottom=l=Qe(l)?Math.min(l,m):m:n==="w"?s.right=l=Qe(l)?Math.min(l,m):m:n==="s"?s.top=c=Qe(c)?Math.max(c,m):m:n==="e"&&(s.left=c=Qe(c)?Math.max(c,m):m)),w.length&&(b=Hw(Ye(ln(w))),m=i-b[rr[uu[n]]]+h[rr[uu[n]]],n==="n"?s.bottom=l=Qe(l)?Math.min(l,m):m:n==="w"?s.right=l=Qe(l)?Math.min(l,m):m:n==="s"?s.top=c=Qe(c)?Math.max(c,m):m:n==="e"&&(s.left=c=Qe(c)?Math.max(c,m):m)),f&&f.length&&(f.forEach(function(G){u.has(G)?E.push(G):C.push(G)}),E.length&&(I=Ye(ln(E.map(et))),k=h[rr[uu[n]]]-(I[rr[uu[n]]]-i)),C.length&&(P=Ye(ln(C.map(et))),F=P[rr[n]]-(h[rr[n]]-i)),n==="n"?(m=Math.min(k||1/0,F||1/0),s.bottom=l=Qe(l)?Math.min(l,m):m):n==="w"?(m=Math.min(k||1/0,F||1/0),s.right=l=Qe(l)?Math.min(l,m):m):n==="s"?(m=Math.max(k||-1/0,F||-1/0),s.top=c=Qe(c)?Math.max(c,m):m):n==="e"&&(m=Math.max(k||-1/0,F||-1/0),s.left=c=Qe(c)?Math.max(c,m):m));var z=o&&o[d.id];z&&(n==="n"?(m=i+d[Mo[t]]-z[Mo[t]],s.bottom=l=Qe(l)?Math.min(l,m):m):n==="w"?(m=i+d[Mo[t]]-z[Mo[t]],s.right=l=Qe(l)?Math.min(l,m):m):n==="s"?(m=i-d[Mo[t]]+z[Mo[t]],s.top=c=Qe(c)?Math.max(c,m):m):n==="e"&&(m=i-d[Mo[t]]+z[Mo[t]],s.left=c=Qe(c)?Math.max(c,m):m))}),s}}function lL(e){return!!e.host}var wh="djs-dragging",Gw="djs-resizing",uL=250,du=Math.max;function Vw(e,t,n,i,o){function r(a,s){V(a,function(c){o.addDragger(c,s),n.addMarker(c,wh)})}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=He("g");Le(u,i.cls("djs-crosshair-group",["no-events"])),nt(s,u);var p=He("path");Le(p,"d",l.x),dt(p).add("djs-crosshair"),nt(u,p);var d=He("path");Le(d,"d",l.y),dt(d).add("djs-crosshair"),nt(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;In(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&cn(c)}),e.on("spaceTool.move",uL,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 d=n.getLayer("space");c=He("path"),Le(c,"d","M0,0 L0,0"),dt(c).add("djs-crosshair"),nt(d,c),s.line=c;var f=He("g");Le(f,i.cls("djs-drag-group",["no-events"])),nt(n.getActiveLayer(),f),r(u,f);var g=new Set(u);V(p,function(C){g.add(C)});var h=new Set,y=s.movingConnections=[];g.forEach(function(C){V(C.outgoing,function(I){h.has(I)||!Dt(I)||!g.has(I.target)||(h.add(I),y.push(I))})}),r(y,f),s.dragGroup=f}if(!s.frameGroup){var w=He("g");Le(w,i.cls("djs-frame-group",["no-events"])),nt(n.getActiveLayer(),w);var m=[];V(p,function(C){var I=o.addFrame(C,w),k=I.getBBox();m.push({element:I,initialBounds:k}),n.addMarker(C,Gw)}),s.frameGroup=w,s.frames=m}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Le(c,{d:v[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,In(s.dragGroup,E.x,E.y),V(s.frames,function(C){var I=C.element,k=C.initialBounds,P,F;s.direction==="e"?Le(I,{width:du(k.width+E.x,5)}):(P=du(k.width-E.x,5),Le(I,{width:P,x:k.x+k.width-P})),s.direction==="s"?Le(I,{height:du(k.height+E.y,5)}):(F=du(k.height-E.y,5),Le(I,{height:F,y:k.y+k.height-F}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,d=s.dragGroup,f=s.frameGroup;V(c,function(g){n.removeMarker(g,wh)}),V(l,function(g){n.removeMarker(g,wh)}),d&&(cn(p),cn(d)),V(u,function(g){n.removeMarker(g,Gw)}),f&&cn(f)})}Vw.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const pL={__init__:["spaceToolPreview"],__depends__:[Co,ao,lu,$a,qs],spaceTool:["type",Pi],spaceToolPreview:["type",Vw]};function fu(e,t){e.invoke(Pi,this),this._canvas=t}fu.$inject=["injector","canvas"],Be(fu,Pi),fu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=ua(_a(o.children.filter(l=>A(l,"bpmn:Artifact")),ln(r))));const s=[...e,...a];var c=Pi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||dL(l)&&(t==="y"&&Sn(l)||t==="x"&&!Sn(l)))}),c};function dL(e){return A(e,"bpmn:Participant")&&!Ee(e).processRef}const Ww={__depends__:[pL],spaceTool:["type",fu]};function Wt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Wt.$inject=["eventBus","injector"],Wt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Wt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Wt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Wt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Wt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Wt.prototype.register=function(e,t){this._setHandler(e,t)},Wt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Wt.prototype.canUndo=function(){return!!this._getUndoAction()},Wt.prototype.canRedo=function(){return!!this._getRedoAction()},Wt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Wt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Wt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Wt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Wt.prototype._createId=function(){return this._uid++},Wt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Wt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Wt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Wt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:gm("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Wt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Je(e)?e:[e],t.dirty=t.dirty.concat(e))},Wt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Wt.prototype._revertedAction=function(e){this._stackIdx--},Wt.prototype._getHandler=function(e){return this._handlerMap[e]},Wt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const fL={commandStack:["type",Wt]};function ar(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 hL=250,Uw=1400;function _h(e,t,n){_e.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Uw,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=qw(a),r.validatedShapes=qw(s)}),i&&t.on("shape.move.start",hL,function(o){var r=o.context,a=new Set(r.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(r,c,!0)}),this.preExecuted("elements.move",Uw,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];V(s,function(l){V(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;ar(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.labelTarget;s&&(r.labelTargetIndex=ef(s.labels,a),r.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(o){var r=o.context,a=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(rn(s.labels,a,c),a.labelTarget=s)})}Be(_h,_e),_h.$inject=["injector","eventBus","modeling"];function qw(e){var t=new Set(e);return lt(e,function(n){return!t.has(n.labelTarget)})}const gL={__init__:["labelSupport"],labelSupport:["type",_h]};var mL=251,Yw=1401,Kw="attach-ok";function Eh(e,t,n,i,o){_e.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",Yw,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=yL(c),s.validatedShapes=vL(l)}),r&&t.on("shape.move.start",mL,function(a){var s=a.context,c=s.shapes,l=Sh(c);V(l,function(u){r.makeDraggable(s,u,!0),V(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&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,Kw),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Kw)}))}}),this.preExecuted("elements.move",Yw,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Sh(l);V(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=lt(c,function(p){var d=p.host;return xL(p)&&!bL(c,d)}),V(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;V(s,function(c){V(c.attachers,function(l){V(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),V(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;ar(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&V(l.attachers,function(u){var p=fb(u,c,l);o.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,d=s.hints||{};d.attachSupport!==!1&&V(p,function(f){var g=fb(f,l,u);o.moveShape(f,g,f.parent),V(f.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ar(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Be(Eh,_e),Eh.$inject=["injector","eventBus","canvas","rules","modeling"];function Sh(e){return Fp(Hn(e,function(t){return t.attachers||[]}))}function yL(e){var t=Sh(e);return hR("id",e,t)}function vL(e){var t=pa(e,"id");return lt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function xL(e){return!!e.host}function bL(e,t){return e.indexOf(t)!==-1}const wL={__depends__:[ao],__init__:["attachSupport"],attachSupport:["type",Eh]};function Xw(e,t,n,i){e.on("element.changed",function(o){var r=o.element;(r.parent||r===t.getRootElement())&&(o.gfx=n.getGraphics(r)),o.gfx&&e.fire(jv(r)+".changed",o)}),e.on("elements.changed",function(o){var r=o.elements;r.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(r)}),e.on("shape.changed",function(o){i.update("shape",o.element,o.gfx)}),e.on("connection.changed",function(o){i.update("connection",o.element,o.gfx)})}Xw.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Rh={__init__:["changeSupport"],changeSupport:["type",Xw]};function Ti(e){this._model=e}Ti.$inject=["moddle"],Ti.prototype._needsId=function(e){return st(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"])},Ti.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;A(e,"bpmn:Activity")?t="Activity":A(e,"bpmn:Event")?t="Event":A(e,"bpmn:Gateway")?t="Gateway":st(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))},Ti.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Ti.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Ti.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",Y({bpmnElement:e,bounds:this.createDiBounds()},t))},Ti.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Ti.prototype.createDiWaypoints=function(e){var t=this;return Hn(e,function(n){return t.createDiWaypoint(n)})},Ti.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$i(e,["x","y"]))},Ti.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",Y({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Ti.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",Y({bpmnElement:e},t))};function pi(e,t,n){_e.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var g=f.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"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var g=f.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(f){var g=f.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"],di(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],di(a));function s(f){var g=f.context,h=g.oldRoot,y=h.children;V(y,function(w){A(w,"bpmn:BaseElement")&&i.updateParent(w)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var g=f.context.shape;A(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],di(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],di(function(f){f.context.shape.type!=="label"&&c(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&c({context:{shape:f.element}})});function l(f){i.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],di(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],di(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],di(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],di(u)),this.executed("connection.reconnect",di(function(f){var g=f.context,h=g.connection,y=g.oldSource,w=g.newSource,m=Ee(h),v=Ee(y),b=Ee(w);m.conditionExpression&&!st(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=m.conditionExpression,delete m.conditionExpression),y!==w&&v.default===m&&(g.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",di(function(f){var g=f.context,h=g.connection,y=g.oldSource,w=g.newSource,m=Ee(h),v=Ee(y),b=Ee(w);g.oldConditionExpression&&(m.conditionExpression=g.oldConditionExpression),g.oldDefault&&(v.default=g.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],di(p)),this.reverted(["element.updateAttachment"],di(p)),this.executed("element.updateLabel",di(d)),this.reverted("element.updateLabel",di(d));function d(f){const{element:g}=f.context,h=si(g),y=gt(g),w=y&&y.get("label");Qo(g)||Ql(g)||(h&&!w?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&w&&y.set("label",void 0))}}Be(pi,_e),pi.$inject=["eventBus","bpmnFactory","connectionDocking"],pi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},pi.prototype.updateParent=function(e,t){if(!at(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=gt(e),r=n&&n.businessObject,a=gt(n);A(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),A(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),A(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),A(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},pi.prototype.updateBounds=function(e){var t=gt(e),n=EL(e);if(n){var i=Gi(n,t.get("bounds"));Y(n,{x:e.x+i.x,y:e.y+i.y})}var o=at(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),Y(r,{x:e.x,y:e.y,width:e.width,height:e.height})},pi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),en(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),rn(o,e))}},pi.prototype.updateDiConnection=function(e,t,n){var i=gt(e),o=gt(t),r=gt(n);i.sourceElement&&i.sourceElement.bpmnElement!==Ee(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==Ee(n)&&(i.targetElement=n&&r)},pi.prototype.updateDiParent=function(e,t){if(t&&!A(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(en(n,e),e.$parent=null)}};function _L(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}pi.prototype.getLaneSet=function(e){var t,n;return A(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(A(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)},pi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))&&(A(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(A(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(A(e,"bpmn:FlowElement")){if(t){if(A(t,"bpmn:Participant"))t=t.processRef;else if(A(t,"bpmn:Lane"))do t=t.$parent.$parent;while(A(t,"bpmn:Lane"))}i="flowElements"}else if(A(e,"bpmn:Artifact")){for(;t&&!A(t,"bpmn:Process")&&!A(t,"bpmn:SubProcess")&&!A(t,"bpmn:Collaboration");)if(A(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(A(e,"bpmn:MessageFlow"))i="messageFlows";else if(A(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=_L(e.$parent||t),e.$parent&&(en(r.get("rootElements"),o),o.$parent=null),t&&(rn(r.get("rootElements"),o),o.$parent=r))}else A(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":A(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),en(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);en(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},pi.prototype.updateConnectionWaypoints=function(e){var t=gt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},pi.prototype.updateConnection=function(e){var t=e.connection,n=Ee(t),i=t.source,o=Ee(i),r=t.target,a=Ee(t.target),s;if(A(n,"bpmn:DataAssociation"))A(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):A(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=A(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(en(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(en(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,r)},pi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function di(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;A(i,"bpmn:BaseElement")&&e(t)}}function EL(e){if(A(e,"bpmn:Activity")){var t=gt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function sr(e,t){_o.call(this),this._bpmnFactory=e,this._moddle=t}Be(sr,_o),sr.$inject=["bpmnFactory","moddle"],sr.prototype._baseCreate=_o.prototype.create,sr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,Y({type:"label",di:n},Hr,t))}return this.createElement(e,t)},sr.prototype.createElement=function(e,t){t=Y({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!RL(o)){var r=Y({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}A(i,"bpmn:Group")&&(t=Y({isFrame:!0},t)),t=SL(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Ch(o,t,"isExpanded")),st(i,["bpmn:Lane","bpmn:Participant"])&&(t=Ch(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!ft(i,o)),A(i,"bpmn:ExclusiveGateway")&&(ii(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),yn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),yn(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,o),t=Y({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},sr.prototype.getDefaultSize=function(e,t){var n=Ee(e);if(t=t||gt(e),A(n,"bpmn:SubProcess"))return ft(n,t)?{width:350,height:200}:{width:100,height:80};if(A(n,"bpmn:Task"))return{width:100,height:80};if(A(n,"bpmn:Gateway"))return{width:50,height:50};if(A(n,"bpmn:Event"))return{width:36,height:36};if(A(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return ft(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return A(n,"bpmn:Lane")?{width:400,height:100}:A(n,"bpmn:DataObjectReference")?{width:36,height:50}:A(n,"bpmn:DataStoreReference")?{width:50,height:50}:A(n,"bpmn:TextAnnotation")?{width:100,height:40}:A(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},sr.prototype.createParticipantShape=function(e){return vn(e)||(e={isExpanded:e}),e=Y({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function SL(e,t,n){return V(n,function(i){t=Ch(e,t,i)}),t}function Ch(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ki(t,[n]))}function RL(e){return st(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function hu(e,t){this._modeling=e,this._canvas=t}hu.$inject=["modeling","canvas"],hu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;V(n,function(o){var r={x:0,y:0};yn(i.left)?r.x=i.left-o.x:yn(i.right)?r.x=i.right-o.width-o.x:yn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:yn(i.top)?r.y=i.top-o.y:yn(i.bottom)?r.y=i.bottom-o.height-o.y:yn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},hu.prototype.postExecute=function(e){};function gu(e){this._modeling=e}gu.$inject=["modeling"],gu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},gu.prototype.postExecute=function(e){var t=e.hints||{};CL(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 CL(e,t){return No(e.outgoing,function(n){return n.target===t})}function mu(e,t){this._canvas=e,this._layouter=t}mu.$inject=["canvas","layouter"],mu.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,o=e.parent,r=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!o)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,o,r),t},mu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var yu=Math.round;function Mh(e){this._modeling=e}Mh.$inject=["modeling"],Mh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;V(t,function(p){Qe(p.x)||(p.x=0),Qe(p.y)||(p.y=0)});var s=lt(t,function(p){return!p.hidden}),c=ln(s);V(t,function(p){Dt(p)&&(p.waypoints=Hn(p.waypoints,function(d){return{x:yu(d.x-c.x-c.width/2+o.x),y:yu(d.y-c.y-c.height/2+o.y)}})),Y(p,{x:yu(p.x-c.x-c.width/2+o.x),y:yu(p.y-c.y-c.height/2+o.y)})});var l=new Set(xl(t)),u={};V(t,function(p){if(Dt(p)){u[p.id]=Qe(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var d=Y({},r);l.has(p)||(d.autoResize=!1),at(p)&&(d=Ki(d,["attach"])),u[p.id]=Qe(i)?a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=ua(u)};var Zw=Math.round;function cr(e){this._canvas=e}cr.$inject=["canvas"],cr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?Y(t,n):Y(t,{x:n.x-Zw(t.width/2),y:n.y-Zw(t.height/2)}),this._canvas.addShape(t,i,o),t},cr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Ks(e){cr.call(this,e)}Be(Ks,cr),Ks.$inject=["canvas"];var ML=cr.prototype.execute;Ks.prototype.execute=function(e){var t=e.shape;return PL(t),t.labelTarget=e.labelTarget,ML.call(this,e)};var AL=cr.prototype.revert;Ks.prototype.revert=function(e){return e.shape.labelTarget=null,AL.call(this,e)};function PL(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Xs(e,t){this._canvas=e,this._modeling=t}Xs.$inject=["canvas","modeling"],Xs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ar(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ar(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Xs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=ef(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Xs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,rn(n.children,t,i),this._canvas.addConnection(t,n),t};function Ah(e,t){this._modeling=e,this._elementRegistry=t}Ah.$inject=["modeling","elementRegistry"],Ah.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;V(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Zs(e,t){this._canvas=e,this._modeling=t}Zs.$inject=["canvas","modeling"],Zs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ar(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ar(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ar(n.children,function(i){Dt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Zs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=ef(i.children,n),t.removeShape(n),n},Zs.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return rn(i.children,n,o),t.addShape(n,i),n};function vu(e){this._modeling=e}vu.$inject=["modeling"];var Jw={x:"y",y:"x"};vu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(y,w){y.range.min=Math.min(w[i],y.range.min),y.range.max=Math.max(w[i]+w[o],y.range.max)}function a(y){return y[i]+y[o]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,w){var m={y:0};m[i]=y-a(w),m[i]&&(m[Jw[i]]=0,t.moveElements([w],m,w.parent))}var u=n[0],p=s(n),d=n[p],f,g,h=0;V(n,function(y,w){var m,v,b;if(y.elements.length<2){w&&w!==n.length-1&&(r(y,y.elements[0]),h+=c(y.range));return}m=Yi(y.elements,i),v=m[0],w===p&&(v=m[s(m)]),b=a(v),y.range=null,V(m,function(E){if(l(b,E),y.range===null){y.range={min:E[i],max:E[i]+E[o]};return}r(y,E)}),w&&w!==n.length-1&&(h+=c(y.range))}),g=Math.abs(d.range.min-u.range.max),f=Math.round((g-h)/(n.length-1)),!(f<n.length-1)&&V(n,function(y,w){var m={},v;y===u||y===d||(v=n[w-1],y.range.max=0,V(y.elements,function(b,E){m[Jw[i]]=0,m[i]=v.range.max-b[i]+f,y.range.min!==b[i]&&(m[i]+=b[i]-y.range.min),m[i]&&t.moveElements([b],m,b.parent),y.range.max=Math.max(b[i]+b[o],E?y.range.max:0)}))})},vu.prototype.postExecute=function(e){};function xu(e,t){this._layouter=e,this._canvas=t}xu.$inject=["layouter","canvas"],xu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return Y(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ph(){}Ph.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=en(r.children,t),rn(i.children,t,o),t.parent=i,V(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},Ph.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return en(n.children,t),rn(i.children,t,o),t.parent=i,V(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function Th(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Th.prototype.add=function(e,t){return this.addAll([e],t)},Th.prototype.addAll=function(e,t){var n=sT(e,!!t,this);return Y(this,n),this};function Js(e){this._modeling=e}Js.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Js.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),V(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),V(s,function(p){var d=!!a[p.source.id],f=!!a[p.target.id];c[p.id]&&d&&f?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:d&&Nf(p,p.source,t),connectionEnd:f&&$f(p,p.target,t)})})},Js.prototype.getClosure=function(e){return new Th().addAll(e,!0)};function bu(e){this._helper=new Js(e)}bu.$inject=["modeling"],bu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},bu.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 Yr(e){this._modeling=e,this._helper=new Js(e)}Yr.$inject=["modeling"],Yr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=$i(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=en(r.children,t),rn(i.children,t,o),Y(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Yr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(V(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:$f(r,t,n)})}),V(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:Nf(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Yr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return rn(n.children,t,i),Y(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Yr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Yr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Qs(e){this._modeling=e}Qs.$inject=["modeling"],Qs.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Je(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Qs.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},a={};r.connectionStart&&(a.connectionStart=r.connectionStart),r.connectionEnd&&(a.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!i||r.docking==="source")&&(a.connectionStart=a.connectionStart||Qw(Je(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||Qw(Je(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Qs.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o};function Qw(e){return e.original||e}function Ao(e,t){this._modeling=e,this._rules=t}Ao.$inject=["modeling","rules"],Ao.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=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:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var d=o.incoming.slice(),f=o.outgoing.slice();V(d,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,ql(g,s,u),a)}),V(f,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,Ul(g,s,u),a)})},Ao.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ao.prototype.execute=function(e){},Ao.prototype.revert=function(e){},Ao.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ao.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ao.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ec(e){this._modeling=e}ec.$inject=["modeling"],ec.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},Y(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ec.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(V(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:ql(r,n,i)})}),V(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Ul(r,n,i)})}))},ec.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return Y(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function lr(e){this._modeling=e}lr.$inject=["modeling"],lr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),V(o,function(s){a[s.id]=kL(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(oL(i,o),t,n,r,i,o,a)},lr.prototype.execute=function(){},lr.prototype.revert=function(){},lr.prototype.moveShapes=function(e,t){var n=this;V(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},lr.prototype.resizeShapes=function(e,t,n){var i=this;V(e,function(o){var r=rL(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},lr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);V(e,function(u){var p=u.source,d=u.target,f=TL(u),g=t_(n),h={},y=c.has(p)||l.has(p),w=c.has(d)||l.has(d);y&&w?(f=Hn(f,function(m){return n_(m,i,n)&&(m[g]=m[g]+t[g]),m.original&&n_(m.original,i,n)&&(m.original[g]=m.original[g]+t[g]),m}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(y||w)&&(c.has(p)?h.connectionStart=Nf(u,p,t):c.has(d)?h.connectionEnd=$f(u,d,t):l.has(p)?h.connectionStart=Ul(u,p,a[p.id]):l.has(d)&&(h.connectionEnd=ql(u,d,a[d.id])),s._modeling.layoutConnection(u,h))})};function e_(e){return Y({},e)}function TL(e){return Hn(e.waypoints,function(t){return t=e_(t),t.original&&(t.original=e_(t.original)),t})}function t_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function n_(e,t,n){var i=t_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function kL(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function wu(e){this._modeling=e}wu.$inject=["modeling"],wu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=i_(n),t.collapsed=!t.collapsed;var i=o_(n,t.collapsed);return[t].concat(i)},wu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=r_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function i_(e){var t={};return V(e,function(n){t[n.id]=n.hidden,n.children&&(t=Y({},t,i_(n.children)))}),t}function o_(e,t){var n=[];return V(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(o_(i.children,i.collapsed||t)))}),n}function r_(e,t){var n=[];return V(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(r_(i.children,t)))}),n}function _u(e){this._modeling=e}_u.$inject=["modeling"],_u.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=a_(i,t),s_(n,t),t.host=n,t},_u.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,a_(n,t),s_(i,t,o),t};function a_(e,t){return en(e&&e.attachers,t)}function s_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),rn(i,t,n)}}function kh(){}kh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},kh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Lt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Lt.$inject=["eventBus","elementFactory","commandStack"],Lt.prototype.getHandlers=function(){return{"shape.append":gu,"shape.create":cr,"shape.delete":Zs,"shape.move":Yr,"shape.resize":ec,"shape.replace":Ao,"shape.toggleCollapse":wu,spaceTool:lr,"label.create":Ks,"connection.create":mu,"connection.delete":Xs,"connection.move":Ph,"connection.layout":xu,"connection.updateWaypoints":kh,"connection.reconnect":Qs,"elements.create":Mh,"elements.move":bu,"elements.delete":Ah,"elements.distribute":vu,"elements.align":hu,"element.updateAttachment":_u}},Lt.prototype.registerHandlers=function(e){V(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Lt.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Lt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Lt.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Lt.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Lt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Lt.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Lt.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Lt.prototype.createElements=function(e,t,n,i,o){Je(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Lt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Lt.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Lt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Lt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Lt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Lt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Lt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Lt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Lt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Lt.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Lt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Lt.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Lt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,Y(i,{docking:"source"}))},Lt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,Y(i,{docking:"target"}))},Lt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Lt.prototype._create=function(e,t){return UT(t)?t:this._elementFactory.create(e,t)},Lt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function tc(e){this._elementRegistry=e}tc.$inject=["elementRegistry"],tc.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||this._getVisualReferences(n).concat(t),r=e.oldProperties||OL(n,$c(i));return c_(n,i),e.oldProperties=r,e.changed=o,o},tc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return c_(n,t),i},tc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?DL(e,t):[]};function OL(e,t){return oi(t,function(n,i){return n[i]=e.get(i),n},{})}function c_(e,t){V(t,function(n,i){e.set(i,n)})}function DL(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&Ee(n).dataObjectRef===e})}var nc="default",Po="id",l_="di",LL={width:0,height:0};function ic(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ic.$inject=["elementRegistry","moddle","modeling","textRenderer"],ic.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,o=this._moddle.ids,r=t.businessObject,a=FL(e.properties),s=e.oldProperties||IL(t,a);return u_(a,r)&&(o.unclaim(r[Po]),i.updateId(t,a[Po]),o.claim(a[Po],r)),nc in a&&(a[nc]&&n.push(i.get(a[nc].id)),r[nc]&&n.push(i.get(r[nc].id))),p_(t,a),e.oldProperties=s,e.changed=n,n},ic.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Ee(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,LL)}},ic.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return p_(t,i),u_(n,o)&&(a.unclaim(n[Po]),r.updateId(t,i[Po]),a.claim(i[Po],o)),e.changed};function u_(e,t){return Po in e&&e[Po]!==t[Po]}function IL(e,t){var n=$c(t),i=e.businessObject,o=gt(e);return oi(n,function(r,a){return a!==l_?r[a]=i.get(a):r[a]=BL(o,$c(t.di)),r},{})}function BL(e,t){return oi(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function p_(e,t){var n=e.businessObject,i=gt(e);V(t,function(o,r){r!==l_?n.set(r,o):i&&NL(i,o)})}function NL(e,t){V(t,function(n,i){e.set(i,n)})}var $L=["default"];function FL(e){var t=Y({},e);return $L.forEach(function(n){n in e&&(t[n]=Ee(t[n]))}),t}function Eu(e,t){this._canvas=e,this._modeling=t}Eu.$inject=["canvas","modeling"],Eu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=gt(o);return t.setRootElement(n),t.removeRootElement(o),rn(a.rootElements,i),i.$parent=a,en(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},Eu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=gt(n);return t.setRootElement(o),t.removeRootElement(n),en(a.rootElements,i),i.$parent=null,rn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Oh(e,t){this._modeling=e,this._spaceTool=t}Oh.$inject=["modeling","spaceTool"],Oh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ci(i),a=r===i,s=a?i:i.parent,c=tr(s),l=Sn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+Ri,y:i.y,width:i.width-Ri,height:i.height}:{x:i.x,y:i.y+Ri,width:i.width,height:i.height-Ri};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Fr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:lt(b.children,function(E){return E!==i})});var d,f,g,h,y;o==="top"?(d=-120,f=i.y,g=f+10,h="n",y="y"):o==="left"?(d=-120,f=i.x,g=f+10,h="w",y="x"):o==="bottom"?(d=120,f=i.y+i.height,g=f-10,h="s",y="y"):o==="right"&&(d=120,f=i.x+i.width,g=f-10,h="e",y="x");var w=t.calculateAdjustments(p,y,d,g),m=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,m,h,g);var v=l?{x:i.x+(a?Ri:0),y:f-(o==="top"?120:0),width:i.width-(a?Ri:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Ri:0),width:120,height:i.height-(a?Ri:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function Dh(e){this._modeling=e}Dh.$inject=["modeling"],Dh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=tr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=Sn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,d;for(d=0;d<i;d++)d===i-1?l=s-c*d:l=c,u=a?{x:n.x+Ri,y:n.y+d*c,width:n.width-Ri,height:l}:{x:n.x+d*c,y:n.y+Ri,width:l,height:n.height-Ri},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function oc(e,t){this._modeling=e,this._spaceTool=t}oc.$inject=["modeling","spaceTool"],oc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},oc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=D2(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},oc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ye(e),o=Ye(t),r=Gx(o,i),a=Ci(e),s=[],c=[];Fr(a,function(g){return s.push(g),(A(g,"bpmn:Lane")||A(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,d,f;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",d=r.top>0||r.bottom<0?-l:l,f=n.calculateAdjustments(s,"y",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",d=r.left>0||r.right<0?-l:l,f=n.calculateAdjustments(c,"x",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},p))};var rc="flowNodeRef",Lh="lanes";function Su(){}Su.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=Ye(p),f={x:u.x+u.width/2,y:u.y+u.height/2};return f.x>d.left&&f.x<d.right&&f.y>d.top&&f.y<d.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ci(u);return o[p.id]||(o[p.id]=Hl(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(d){return a(u,d)}).map(function(d){return d.businessObject})}return t.forEach(function(u){var p=Ci(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return A(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get(Lh),f=d.slice(),g=l(u);i.push({flowNode:p,remove:f,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(rc).forEach(function(d){i.push({flowNode:d,remove:[p],add:[]})})}),i},Su.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,o=i.get(Lh);n.remove.forEach(function(r){en(o,r),en(r.get(rc),i)}),n.add.forEach(function(r){rn(o,r),rn(r.get(rc),i)})}),[]},Su.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Lh);n.add.forEach(function(r){en(o,r),en(r.get(rc),i)}),n.remove.forEach(function(r){rn(o,r),rn(r.get(rc),i)})}),[]};var Ih="categoryValueRef";function ac(e,t){this._bpmnFactory=e,this._elementRegistry=t}ac.$inject=["bpmnFactory","elementRegistry"],ac.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(m,v,b){if(v){var E=a.get(m);E||(E={},a.set(m,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:Bh(m)}:E.past={categoryValue:v}))}}function c(m){o.set(m,Ee(m))}function l(){n.filter(function(m){return A(m,"bpmn:FlowElement")&&!at(m)&&m.parent}).forEach(c)}function u(m){var v=Ee(m),b=v.get("categoryValueRef");return b||(b=$x(i,v),r.push(jL(m,b))),b}function p(m){return m.reduce(function(v,b){var E=Bh(b),C=v.get(E);return C||(C=[],v.set(E,C)),C.push(b),v},new Map)}e=Array.from(e||[]);var d=p(e);t.length&&l(),e.forEach(c),n.filter(function(m){return A(m,"bpmn:Group")&&!at(m)&&m.parent}).forEach(function(m){var v=Ee(m).get("categoryValueRef");if(!v){var b=Bh(m),E=d.get(b)||[],C=_a(E,m),I=Object.keys(C).length>0;I&&(v=u(m))}s(m,v,!0)}),t.forEach(function(m){s(m.groupShape,m.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(m,v){return v.present&&m.add(v.present.categoryValue),v.past&&m.add(v.past.categoryValue),m},new Set),h=new Map,y=p(f);a.forEach(function(m,v){var b=m.present;if(b){var E=y.get(b.root)||[],C=_a(E,v);E.forEach(function(I){if(C[I.id]){var k=h.get(I);k||(k=new Set,h.set(I,k)),k.add(b.categoryValue)}})}});var w=f.reduce(function(m,v){var b=o.get(v),E=b.get(Ih),C=new Set(E),I=h.get(v)||new Set,k=Array.from(I).filter(function(F){return!C.has(F)}),P=E.filter(function(F){return g.has(F)&&!I.has(F)});return(k.length||P.length)&&m.push({businessObject:b,categoryValuesToAdd:k,categoryValuesToRemove:P}),m},[]);return{flowElements:w,groups:r}},ac.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),HL(t.groups),GL(t.flowElements),[]},ac.prototype.revert=function(e){var t=e.updates;return VL(t.flowElements),zL(t.groups),[]};function jL(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function HL(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function zL(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=null})}function GL(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ih);t.categoryValuesToRemove.forEach(function(o){en(i,o)}),t.categoryValuesToAdd.forEach(function(o){rn(i,o,!0)})})}function VL(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Ih);t.categoryValuesToAdd.forEach(function(o){en(i,o)}),t.categoryValuesToRemove.forEach(function(o){rn(i,o,!0)})})}function Bh(e){for(;e.parent;)e=e.parent;return e}function Ru(e){this._moddle=e}Ru.$inject=["moddle"],Ru.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},Ru.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.unclaim(n):t.claim(n,i),[]};var WL={fill:void 0,stroke:void 0};function Nh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ni(t)){var n=UL(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Nh.$inject=["commandStack"],Nh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||WL,i=this,o={};"fill"in n&&Y(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&Y(o,{"border-color":this._normalizeColor(n.stroke)}),V(t,function(r){var a=Dt(r)?$i(o,["border-color"]):o,s=gt(r);if(qL(a),at(r)){if(!s||!A(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!st(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function UL(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 qL(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var YL={width:0,height:0};function d_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return _k(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!at(l)&&Qo(l)&&!Al(l)&&!f_(p)){var d=7,f=sf(l);f={x:f.x,y:f.y+d},e.createLabel(l,f,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=si(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,d=c.newBounds,f=c.hints||{};if(!(!at(u)&&!A(u,"bpmn:TextAnnotation"))){if(at(u)&&f_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=si(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,g)),d&&e.resizeShape(u,d,YL)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}d_.$inject=["modeling","textRenderer","bpmnFactory"];function f_(e){return!e||!e.trim()}function Nn(e,t,n,i){Lt.call(this,e,t,n),this._bpmnRules=i}Be(Nn,Lt),Nn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Nn.prototype.getHandlers=function(){var e=Lt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=tc,e["element.updateProperties"]=ic,e["canvas.updateRoot"]=Eu,e["lane.add"]=Oh,e["lane.resize"]=oc,e["lane.split"]=Dh,e["lane.updateRefs"]=Su,e["group.updateRefs"]=ac,e["id.updateClaim"]=Ru,e["element.setColor"]=Nh,e["element.updateLabel"]=d_,e},Nn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Nn.prototype.connect=function(e,t,n,i){var o=this._bpmnRules;if(n||(n=o.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Nn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Nn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Nn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Nn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Nn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Nn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Nn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Nn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Nn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Nn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Nn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Nn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function h_(){}h_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||et(t.source||e.source),t.connectionEnd||et(t.target||e.target)]};var Cu=20,KL=5,Mu=Math.round,g_=20,XL={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ZL(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function JL(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function m_(e,t,n){var i=Ln(t,e,KL),o=n.split(":")[0],r=Mu((t.x-e.x)/2+e.x),a=Mu((t.y-e.y)/2+e.y),s,c,l=JL(o,i),u=/h|r|l/.test(o),p=!1,d=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=ZL(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+Cu*(/l/.test(o)?-1:1),y:d?a+Cu:a}):(d=r===e.x,s={x:d?r+Cu:r,y:e.y+Cu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:$h(e,s,c).concat(s),directions:c,turnNextDirections:d}}function QL(e,t,n){return m_(e,t,n)}function eI(e,t,n){var i=m_(t,e,y_(n));return{waypoints:i.waypoints.slice().reverse(),directions:y_(i.directions),turnNextDirections:i.turnNextDirections}}function tI(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 o=n+":"+i,r=$h(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function y_(e){return e.split(":").reverse().join(":")}function nI(e,t,n){var i=Mu((t.x-e.x)/2+e.x),o=Mu((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:o},{x:t.x,y:o}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function $h(e,t,n){if(n=n||"h:h",!pI(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(x_(n)){var i=QL(e,t,n),o=eI(e,t,n),r=tI(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return nI(e,t,n)}function iI(e,t,n){var i=$h(e,t,n);return i.unshift(e),i.push(t),w_(i)}function oI(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=dR(r,"straight")[0]||"h:h",s=XL[a]||0,c=Ln(e,t,s),l=uI(c,a);n=n||et(e),i=i||et(t);var u=l.split(":"),p=b_(n,e,u[0],dI(c)),d=b_(i,t,u[1],c);return iI(p,d,l)}function rI(e,t,n,i,o,r){Je(n)&&(o=n,r=i,n=et(e),i=et(t)),r=Y({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&sI(e,t,n,i,r),c||(c=r.connectionEnd&&lI(t,e,i,o),c)||(c=r.connectionStart&&cI(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:oI(e,t,n,i,r)}function aI(e,t,n){return e>=t&&e<=n}function v_(e,t,n){var i={x:"width",y:"height"};return aI(t[e],n[e],n[e]+n[i[e]])}function sI(e,t,n,i,o){var r={},a,s;return s=Ln(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?v_(a,i,e)?(r[a]=i[a],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:i.x,y:i.y}]):null:v_(a,n,t)?(r[a]=n[a],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y,original:{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y}}]):null):null}function cI(e,t,n,i){return Fh(e,t,n,i)}function lI(e,t,n,i){var o=i.slice().reverse();return o=Fh(e,t,n,o),o?o.reverse():null}function Fh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Bt(u,function(p,d){var f=u[d-1];return f&&Ts(p,f)<3})}function r(u,p,d){var f=bo(p,u);switch(f){case"v":return{x:d.x,y:u.y};case"h":return{x:u.x,y:d.y}}return{x:u.x,y:u.y}}function a(u,p,d){var f;for(f=u.length-2;f!==0;f--)if(zv(u[f],p,g_)||zv(u[f],d,g_))return u.slice(f);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=Fh(e,t,n,l)),c&&bo(c)?null:c}function uI(e,t){if(x_(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 pI(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function x_(e){return e&&/t|r|b|l/.test(e)}function dI(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 b_(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 w_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return tf(o,r,n,0)||t.push(n),t},[])}var fI=-10,hI=40,gI={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},mI={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},jh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},sc={top:"t",right:"r",bottom:"b",left:"l"};function Au(e){this._elementRegistry=e}Be(Au,h_),Au.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,o=t.waypoints||e.waypoints,r=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(r||(r=__(o&&o[0],n)),a||(a=__(o&&o[o.length-1],i)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!E_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Lx(n,s)?gI:mI;return A(e,"bpmn:MessageFlow")?c=vI(n,i,u):(A(e,"bpmn:SequenceFlow")||E_(n,i))&&(n===i?c={preferredLayouts:SI(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:RI(n,i,a,u)}:cc(n)||cc(i)?c={preferredLayouts:u.subProcess,preserveDocking:bI(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=Y(c,t),l=w_(rI(n,i,r,a,o,c))),l||[r,a]};function yI(e){var t=e.host;return Ln(et(e),t,fI)}function vI(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:xI(e,t)}}function xI(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":cc(t)?"source":cc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function bI(e){return cc(e)?"target":"source"}function __(e,t){return e?e.original||e:et(t)}function E_(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function cc(e){return A(e,"bpmn:SubProcess")&&ft(e)}function Kr(e,t){return e===t}function wI(e,t){return t.indexOf(e)!==-1}function Fa(e){var t=/right|left/.exec(e);return t&&t[0]}function ja(e){var t=/top|bottom/.exec(e);return t&&t[0]}function S_(e,t){return jh[e]===t}function _I(e,t){var n=Fa(e),i=jh[n];return t.indexOf(i)!==-1}function EI(e,t){var n=ja(e),i=jh[n];return t.indexOf(i)!==-1}function R_(e){return e==="right"||e==="left"}function SI(e,t,n){var i=t.waypoints,o=i&&i.length&&Ln(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function RI(e,t,n,i){var o=et(e),r=et(t),a=yI(e),s,c,l=Kr(e.host,t),u=wI(a,["top","right","bottom","left"]),p=Ln(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?CI(a,u,e,t,n,i):(s=MI(a,p,u,i.isHorizontal),c=AI(a,p,u,i.isHorizontal),[s+":"+c])}function CI(e,t,n,i,o,r){var a=t?e:r.isHorizontal?ja(e):Fa(e),s=sc[a],c;return t?R_(e)?c=C_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=C_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function C_(e,t,n,i){var o=hI;return!(Hh(e,i,n,o)||Hh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Hh(e,i,et(t),o))}function Hh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function MI(e,t,n,i){if(n)return sc[e];var o=ja(e),r=Fa(e),a=ja(t),s=Fa(t);if(i){if(Kr(o,a)||S_(r,s))return sc[o]}else if(Kr(r,s)||S_(o,a))return sc[r];return sc[i?r:o]}function AI(e,t,n,i){if(n)return R_(e)?_I(e,t)||Kr(e,t)?"h":"v":EI(e,t)||Kr(e,t)?"v":"h";var o=ja(e),r=Fa(e),a=ja(t),s=Fa(t);return a&&!s?"v":s&&!a?"h":i?Kr(o,a)?"h":"v":Kr(r,s)?"v":"h"}Au.$inject=["elementRegistry"];function M_(e){return Y({original:e.point.original||e.point},e.actual)}function ur(e,t){this._elementRegistry=e,this._graphicsFactory=t}ur.$inject=["elementRegistry","graphicsFactory"],ur.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(M_(i)),r.push(M_(o)),r},ur.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},ur.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return ks(i,o,n)},ur.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},ur.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},ur.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const zh={__init__:["modeling","bpmnUpdater"],__depends__:[qO,lD,pD,dD,Fw,fL,gL,wL,Ai,Rh,Ww],bpmnFactory:["type",Ti],bpmnUpdater:["type",pi],elementFactory:["type",sr],modeling:["type",Nn],layouter:["type",Au],connectionDocking:["type",ur]};var PI=10,A_=50,TI=250;function Gh(e,t,n,i){for(var o;o=kI(e,n,t);)n=i(t,n,o);return n}function Vh(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach(function(r){var a=e[r];if(a){var s=r==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?o[r]=Math.min(i[r]+c-t[s]/2,n[r]-l+c):o[r]=Math.max(i[r]+i[s]+c+t[s]/2,n[r]+l+c)}}),o}}function kI(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=DI(e);return Bt(o,function(r){if(r===n)return!1;var a=Ln(r,i,PI);return a==="intersect"})}function OI(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||A_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||TI,c=t.reference||"start";r||(r=BI);function l(g,h){return o==="n"?c==="start"?Ye(g).top-Ye(h).bottom:c==="center"?Ye(g).top-et(h).y:Ye(g).top-Ye(h).top:o==="w"?c==="start"?Ye(g).left-Ye(h).right:c==="center"?Ye(g).left-et(h).x:Ye(g).left-Ye(h).left:o==="s"?c==="start"?Ye(h).top-Ye(g).bottom:c==="center"?et(h).y-Ye(g).bottom:Ye(h).bottom-Ye(g).bottom:c==="start"?Ye(h).left-Ye(g).right:c==="center"?et(h).x-Ye(g).right:Ye(h).right-Ye(g).right}var u=e.incoming.filter(r).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(r).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}}),d=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),f=oi(d,function(g,h){var y=h.distance,w=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*w,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return f.distance||i}function DI(e){var t=Wh(e);return e.host&&(t=t.concat(Wh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Wh(i))},[]))),t}function Wh(e){return II(e).concat(LI(e))}function LI(e){return e.incoming.map(function(t){return t.source})}function II(e){return e.outgoing.map(function(t){return t.target})}function BI(){return!0}var NI=100;function P_(e,t,n){e.on("autoPlace",NI,function(i){var o=i.shape,r=i.source;return $I(r,o)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,o,r){e.fire("autoPlace.start",{source:i,shape:o});var a=e.fire("autoPlace",{source:i,shape:o}),s=t.appendShape(i,o,a,i.parent,r);return e.fire("autoPlace.end",{source:i,shape:s}),s}}P_.$inject=["eventBus","modeling","canvas"];function $I(e,t,n){n||(n={});var i=n.defaultDistance||A_,o=et(e),r=Ye(e);return{x:r.right+i+t.width/2,y:o.y}}function T_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}T_.$inject=["eventBus","selection"];const FI={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",P_],autoPlaceSelectionBehavior:["type",T_]};function k_(e,t,n){var i=Lx(e,n);if(A(t,"bpmn:TextAnnotation"))return HI(e,t,i);if(st(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return zI(e,t,i);if(A(t,"bpmn:FlowNode"))return jI(e,t,i)}function jI(e,t,n){var i=Ye(e),o=et(e),r=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=OI(e,{filter:function(f){return A(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;A(e,"bpmn:BoundaryEvent")&&(l=Ln(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+O_(l,c,r)}:{x:o.x+O_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return Gh(e,t,u,Vh(d))}function O_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function HI(e,t,n){var i=Ye(e),o=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};Dt(e)&&(o=et(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return Gh(e,t,o,Vh(a))}function zI(e,t,n){var i=Ye(e),o=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},r={margin:30,minDistance:30},a=n?{x:r}:{y:r};return Gh(e,t,o,Vh(a))}function D_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return k_(o,i,t)})}D_.$inject=["eventBus","elementRegistry"];const Pu={__depends__:[FI],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",D_]};function To(e,t,n,i){_e.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=Fp(ua(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=pa(s,function(p){return p.parent.id});V(u,function(p,d){Je(l)&&(p=p.filter(function(f){return Bt(l,da({id:f.id}))})),o._expand(p,d)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}To.$inject=["eventBus","elementRegistry","modeling","rules"],Be(To,_e),To.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ye(ln(e)),r=Ye(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),_l(Y({},r,a))},To.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(GI(i,t)){var o=VI($i(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},To.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},To.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},To.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function GI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function VI(e,t){var n="";return e=Ye(e),t=Ye(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Tu(e){e.invoke(To,this)}Tu.$inject=["injector"],Be(Tu,To),Tu.prototype.resize=function(e,t,n){A(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function lc(e){Mi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}lc.$inject=["eventBus"],Be(lc,Mi),lc.prototype.canResize=function(e,t){return!1};function ku(e,t){lc.call(this,e),this._modeling=t}Be(ku,lc),ku.$inject=["eventBus","modeling"],ku.prototype.canResize=function(e,t){if(A(t.di,"bpmndi:BPMNPlane")||!A(t,"bpmn:Participant")&&!A(t,"bpmn:Lane")&&!A(t,"bpmn:SubProcess"))return!1;var n=!0;return V(e,function(i){if(A(i,"bpmn:Lane")||at(i)){n=!1;return}}),n};const L_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Tu],bpmnAutoResizeProvider:["type",ku]},WI=1500;class I_{constructor(t){t.on("moddleCopy.canCopyProperties",WI,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Pr)))return;const o=Mn(n);o!==void 0&&i.set("xml:lang",o)})}}mn(I_,"$inject",["eventBus"]);const B_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",I_]},UI=500,Ou=1,N_=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Ou||n>e.x+e.width+Ou||i<e.y-Ou||i>e.y+e.height+Ou)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class $_{constructor(t){t.on("bpmnElement.added",UI,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(N_(n.source,i[0]),N_(n.target,i[i.length-1]))})}}mn($_,"$inject",["eventBus"]);const F_={__init__:["annotationImportDocking"],annotationImportDocking:["type",$_]},Uh=[Ox,Ns,zh,Pu,L_,Kp,B_,F_];function qI(e={}){Fm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new jr({container:t,moddleExtensions:e.moddleExtensions??fs,additionalModules:[...Uh,...e.additionalModules??[]]})}const j_={"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":"풀"},YI={이:["이","가"],을:["을","를"],와:["과","와"]};function KI(e,t){const[n,i]=YI[t],o=e.at(-1)??"",r=o.charCodeAt(0);return r>=44032&&r<=55203?e+((r-44032)%28===0?i:n):o>="0"&&o<="9"?e+("013678".includes(o)?n:i):e+`${n}(${i})`}const XI={"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":"연관선"},ZI="요소";function qh(e){return(e&&XI[e.type])??ZI}const H_=20;function JI(e){const t=e.replace(/\s+/g," ").trim();return t.length>H_?`${t.slice(0,H_)}…`:t}function Du(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:JI(o.name),a=r===void 0?i+qh(o):r,s=r===void 0?a:`「${r}」`;return n?s+KI(a,n).slice(a.length):s}function QI(e,t,n,i,o){const[r,a]=[e(t),e(n)],s=(r==null?void 0:r.name)===void 0&&(a==null?void 0:a.name)===void 0&&qh(r)===qh(a);return[Du(e,t,i),Du(e,n,o,s?"다른 ":"")]}function eB(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 tB(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 Lu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function nB(e,t){const n=(o,r)=>Du(t,o,r),i=(o,r,a,s)=>QI(t,o,r,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[o,r]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${o} ${r} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${o} ${r} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[o,r]=i(e.edge,e.other,void 0,"와");return`${o}의 라벨이 ${r} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}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[o,r]=i(e.groups[0],e.groups[1],"와","이");return`${o} ${r} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${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)}의 ${Lu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${Lu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Lu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Lu[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[o,r]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${o} ${r} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${o} ${r} 겹칩니다.`}}}function iB(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Du(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const z_="기타",Yh={error:0,warning:1,info:2};function G_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:eB(i),targetRefs:tB(i),category:j_[i.kind]??z_,message:nB(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:j_[i.ruleId]??z_,message:iB(i,t)});return n}function V_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ha(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Kh(e,t){if(t===void 0||e.length===0)return!1;const n=Ha(e[0],t);return e.some(i=>Ha(i,t)!==n)}function W_(e,t){const n=Kh(e,t);return e.slice().sort((i,o)=>(n?Number(Ha(o,t))-Number(Ha(i,t)):0)||Yh[i.severity]-Yh[o.severity])}const U_="i18n-untranslated",q_="i18n-review-requested",Iu="i18nDisplay.redrawn",Y_=[["untranslated",U_],["reviewRequested",q_]];class Xh{constructor(t,n,i,o,r,a,s,c){mn(this,"config");mn(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(d,f,g)=>this.withDisplayText(f,()=>l(d,f,g),d);const u=r.activate.bind(r);r.activate=d=>this.withDisplayText(d,()=>u(d));const p=r.update.bind(r);r.update=(d,f,g,h)=>{const y=this.resolve(d);if(!y||y.native)return p(d,f,g,h);(f??"").trim()!==(g??"").trim()&&i.execute(jc,{element:d.labelTarget??d,locale:this.displayLocale,text:f,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",d=>{if(!this.config)return;const{element:f,newLabel:g,oldLabel:h}=d.context;(g??"")!==(h??"")&&i.execute(jc,{element:f.labelTarget??f,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,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=Tr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=$o(n).filter(d=>Mn(d)),s=d=>d.body??"",c=a.find(d=>Mn(d)===o&&s(d)),l=Fo(n).some(d=>d.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(d=>s(d)===r).map(Mn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i){var d;if(!this.config)return n();const o=this.resolve(t),r=(d=i==null?void 0:i.parentNode)==null?void 0:d.classList;if(r)for(const[f,g]of Y_)r.toggle(g,(o==null?void 0:o.status)===f);if(!o||o.native)return n();const{target:a,key:s}=Tr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const f=n();return p&&(f!=null&&f.setAttribute)&&f.setAttribute("transform",`translate(${p.dx}, 0)`),f}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}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[,o]of Y_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(Iu)}}mn(Xh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const K_={__depends__:[Kp],__init__:["i18nDisplay"],i18nDisplay:["type",Xh]};var oB=2e3;function Zh(e,t,n){e.on("autoPlace",oB,function(i){var o=i.source,r=et(o),a=i.shape,s=k_(o,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==r[c]&&(s[c]>r[c]?l.min=s[c]:l.max=s[c],A(a,"bpmn:TextAnnotation")&&(rB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}Zh.$inject=["eventBus","gridSnapping","elementRegistry"];function rB(e){return e==="x"}var aB=3e3;function za(e,t,n){_e.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],aB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||sB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}za.$inject=["eventBus","gridSnapping","modeling"],Be(za,_e),za.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=uB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function sB(e){return e.length>3}function cB(e){return e==="h"}function lB(e){return e==="v"}function uB(e,t,n){var i=bo(t,n),o={};return cB(i)&&(o.y=e.snapValue(t.y)),lB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=Y({},t,o),n=Y({},n,o)),[t,n]}function pB(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Lr(e,t),fontBoundingBoxAscent:t*Zi.ascentEm,fontBoundingBoxDescent:t*Zi.descentEm,actualBoundingBoxAscent:t*Zi.ascentEm,actualBoundingBoxDescent:t*Zi.descentEm}}class Jh{constructor(t,n,i,o,r,a){mn(this,"active",!1);mn(this,"shadow");mn(this,"shadowContainer");this.eventBus=t,this.elementRegistry=n,this.textRenderer=i,this.graphicsFactory=o,this.canvas=r,this.bpmnjs=a,t.on("diagram.destroy",()=>this.disposeShadow())}isActive(){return this.active}run(t){if(this.active)throw new Error("headlessReplay.run: 이미 창 안이다(중첩 금지)");const n=typeof CanvasRenderingContext2D>"u"?void 0:CanvasRenderingContext2D.prototype,i=n==null?void 0:n.measureText;n&&(n.measureText=pB),this.active=!0;try{return this.reproject(),t()}finally{this.active=!1,n&&i&&(n.measureText=i),this.relabel(),this.syncGraphicsOrder(),this.redrawAll()}}atBatchBoundary(){if(!this.active)throw new Error("headlessReplay.atBatchBoundary: 창 밖이다");this.eventBus.fire("saveXML.start",{definitions:this.bpmnjs.getDefinitions()}),this.reproject()}reproject(){const t=this.ensureShadow();t.get("eventBus").fire("diagram.clear");let n=!1;t.get("eventBus").once("import.render.complete",()=>n=!0);let i;if(mx(t,this.bpmnjs.getDefinitions()).catch(u=>i=u),!n)throw new Error(`headlessReplay: 그림자 import 가 동기로 끝나지 않았다${i?` — ${String(i)}`:""}`);const o=t.get("elementRegistry"),r=this.elementRegistry,a=u=>u?r.get(u.id):void 0,s=o.getAll();for(const u of s){const p=r.get(u.id);if(!p)continue;u.waypoints?p.waypoints=u.waypoints.map(f=>({x:f.x,y:f.y,...f.original?{original:{x:f.original.x,y:f.original.y}}:{}})):u.parent&&(p.x=u.x,p.y=u.y,p.width=u.width,p.height=u.height),p.collapsed=u.collapsed,p.hidden=u.hidden,p.isFrame=u.isFrame;const d=a(u.parent);d&&p.parent!==d&&(p.parent=d);for(const f of["incoming","outgoing"]){const g=(u[f]??[]).map(a).filter(Boolean),h=p[f];h&&g.length===h.length&&g.every(y=>h.includes(y))&&g.forEach((y,w)=>h[w]=y)}}for(const u of s){const p=r.get(u.id);if(!(p!=null&&p.children)||!u.children)continue;const d=u.children.map(a).filter(Boolean),f=p.children.filter(g=>!d.includes(g)&&g.parent===p);p.children.length=0,p.children.push(...d,...f)}const c=r._elements,l={};for(const u of s)u.id in c&&(l[u.id]=c[u.id]);for(const u of Object.keys(c))u in l||(l[u]=c[u]);r._elements=l}relabel(){for(const t of this.elementRegistry.filter(n=>n.type==="label")){const n=t.labelTarget,i=n&&si(n);if(!i)continue;const o=this.textRenderer.getExternalLabelBounds(Sx(gt(n),n),i);t.x=Math.round(o.x),t.y=Math.round(o.y),t.width=Math.round(o.width),t.height=Math.round(o.height)}}syncGraphicsOrder(){var t,n;for(const i of this.elementRegistry.getAll()){if(!((t=i.children)!=null&&t.length))continue;const o=this.graphicsFactory._getChildrenContainer(i);for(const r of i.children){const a=(n=this.elementRegistry.getGraphics(r))==null?void 0:n.parentNode;a&&o.appendChild(a)}}}redrawAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);i&&this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}this.eventBus.fire(Iu)}ensureShadow(){if(this.shadow)return this.shadow;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-10000px;top:0;width:800px;height:600px;visibility:hidden",document.body.appendChild(t),this.shadowContainer=t,this.shadow=new jr({container:t,moddleExtensions:fs,additionalModules:[...Uh]}),this.shadow}disposeShadow(){var t,n;(t=this.shadow)==null||t.destroy(),this.shadow=void 0,(n=this.shadowContainer)==null||n.remove(),this.shadowContainer=void 0}}mn(Jh,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function X_(e,t){const n=Object.create(e);return n.on=(i,o,r,a)=>{typeof o=="function"&&(a=r,r=o,o=1e3);const s=function(...c){return t.isActive()?void 0:r.apply(this,c)};return e.on(i,o,s,a)},n}function Qh(e,t,n,i){Zh.call(this,X_(e,i),t,n)}Qh.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Bu(e,t,n,i){za.call(this,X_(e,i),t,n)}Bu.prototype=Object.create(za.prototype),Bu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function dB(e){return e instanceof Qh||e instanceof Bu}const Z_={__init__:["headlessReplay"],headlessReplay:["type",Jh],gridSnappingAutoPlaceBehavior:["type",Qh],gridSnappingLayoutConnectionBehavior:["type",Bu]};function Xr(e){return CSS.escape(e)}var fB={"&":"&","<":"<",">":">",'"':""","'":"'"};function J_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return fB[t]})}var Nu=50,hB=new Ur,Q_={min:.2,max:4},gB=10,mB=.1,yB=250,vB=100,xB=2e3;function $n(e,t,n,i,o){var r=this;this._canvas=i,this._elementRegistry=o,this._eventBus=n,this._injector=t,this._config=e||{},this._updateTimeout=null,this._firstDebounceTime=null,this._dirty=!1,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=hB.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=$u({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);eg(p,r._canvas),r._update()}function s(u){return function(d){var f=tg(d);(!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var g=$u({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),y=wB(g,h),w=r._viewportDom.getBoundingClientRect(),m={x:f.x-w.left+1,y:f.y-w.top+1};Y(r._state,{cachedViewbox:h,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:y,offsetViewportDom:m,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ue.bind(document,"mousemove",c),Ue.bind(document,"mouseup",l)}}function c(u){var p=tg(u);if(r._state.isDragging){(!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,g=r._state.parentClientRect;Y(r._viewportDom.style,{top:p.y-d.y-g.top+"px",left:p.x-d.x-g.left+"px"});var h=t0(g,{top:p.y-d.y-g.top,left:p.x-d.x-g.left,width:f.width,height:f.height});Y(r._overlay.style,{clipPath:h});var y=$u({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);eg({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=tg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),Y(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ue.unbind(document,"mousemove",c),Ue.unbind(document,"mouseup",l))}Ue.bind(this._viewportDom,"mousedown",s(!1)),Ue.bind(this._svg,"mousedown",s(!0)),Ue.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!CB(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*MB(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>mB){var f=d>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=AB(Q_,gB*2),y=Math.round(g/h)*h;y+=h*f;var w=Math.pow(10,y);i.zoom(PB(Q_,w),m),r._state.zoomDelta=0;var m=$u({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);eg(m,r._canvas),r._update()}}}),Ue.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",yB,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,d=u.newId;r._updateElementId(p,d)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(d){r._addElement(d)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}$n.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],$n.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Mt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Mt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Mt(o).add("map"),n.appendChild(o);var r=this._svg=He("svg");Le(r,{width:"100%",height:"100%"}),nt(o,r);var a=this._elementsGroup=He("g");nt(r,a);var s=this._viewportGroup=He("g");nt(r,s);var c=this._viewport=He("rect");dt(c).add("viewport"),nt(s,c),Ue.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Mt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Mt(u).add("overlay"),this._parent.appendChild(u)},$n.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Qe(this._config.debounceDelay)?this._config.debounceDelay:vB,n=Qe(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:xB,i=Date.now();if(this._firstDebounceTime&&i-this._firstDebounceTime>=n){this._update();return}this._updateTimeout&&clearTimeout(this._updateTimeout),this._firstDebounceTime=this._firstDebounceTime||i,this._updateTimeout=setTimeout(function(){e._update()},t)}},$n.prototype._rebuild=function(){this._clear();var e=this._canvas,t=e.getRootElement&&e.getRootElement();if(t&&t.children){var n=this;t.children.forEach(function(i){n._addElement(i)})}},$n.prototype._update=function(){if(this.isOpen()){this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._firstDebounceTime=null;var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(n0(e)){var i,o,r,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,r=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,r=t.width),t.height<n.height?(o=t.y-c/2,a=n.height,t.y+t.height<n.height&&(o=Math.min(0,t.y))):(o=t.y,a=t.height),i=i-Nu,o=o-Nu,r=r+Nu*2,a=a+Nu*2,this._lastViewbox={x:i,y:o,width:r,height:a},Le(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Le(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};Y(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=t0(l,p);Y(this._overlay.style,{clipPath:d})}}},$n.prototype.open=function(){Y(this._state,{isOpen:!0}),Mt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};An(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},$n.prototype.close=function(){Y(this._state,{isOpen:!1}),Mt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};An(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},$n.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},$n.prototype.isOpen=function(){return this._state.isOpen},$n.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){console.warn("Minimap#_updateElement errored",t)}},$n.prototype._updateElementId=function(e,t){try{var n=Rt("#"+Xr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},$n.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},$n.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,o,r=this._createElement(e),a=Rt("#"+Xr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=EB(e);return s!==-1?a?SB(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),bB(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Le(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Le(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},$n.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&cn(t)},$n.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Zo(t),n)){var i=TB(Vd(n));return Le(i,{id:this._prefixId(e.id)}),i}},$n.prototype._clear=function(){Ss(this._elementsGroup)},$n.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function bB(e){return e.waypoints}function wB(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function $u(e,t,n){var i=t.getBoundingClientRect(),o=_B(n,i.width/i.height),r=e0(e.x,0,i.width,o.x,o.x+o.width),a=e0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function eg(e,t){var n=t.viewbox(),i=n.width,o=n.height;t.viewbox({x:e.x-i/2,y:e.y-o/2,width:i,height:o})}function _B(e,t){var n=e.width/e.height,i=Y({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;Y(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;Y(i,{x:s,width:a})}return i}function e0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function EB(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function SB(e,t,n){var i=RB(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function RB(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function Fu(e){return e.width===0&&e.height===0}function CB(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var MB=Math.sign||function(e){return e>=0?1:-1};function AB(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),o=Math.abs(n)+Math.abs(i);return o/t}function PB(e,t){return Math.max(e.min,Math.min(e.max,t))}function t0(e,t){var n=[co(t.left,t.top),co(t.left+t.width,t.top),co(t.left+t.width,t.top+t.height),co(t.left,t.top+t.height),co(t.left,e.height),co(e.width,e.height),co(e.width,0),co(0,0),co(0,e.height),co(t.left,e.height)].join(", ");return"polygon("+n+")"}function co(e,t){return e+"px "+t+"px"}function n0(e){return Bo(e,function(t){return vn(t)?n0(t):Qe(t)&&isFinite(t)})}function tg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function TB(e){return Es("[id]",e).forEach(function(t){t.remove()}),e}var kB={__init__:["minimap"],minimap:["type",$n]};const i0={closed:"미니맵",open:"접기"};class o0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(Iu,()=>this.rebuild()),t.on("minimap.toggle",o=>this.retitle(o.open)),this.retitle(n.isOpen())}rebuild(){const t=this.minimap;if(!t.isOpen()){t._dirty=!0;return}t._rebuild(),t._update()}retitle(t){const n=this.canvas.getContainer().querySelector(".djs-minimap .toggle");n==null||n.setAttribute("title",t?i0.open:i0.closed)}}mn(o0,"$inject",["eventBus","minimap","canvas"]);const r0=[K_,{__depends__:[kB],__init__:["minimapI18n"],minimapI18n:["type",o0]},B_,F_,Z_];var OB=new Ur("ov"),DB=500;function Pn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=OB,this._overlayDefaults=Y({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=LB(n.getContainer()),this._init()}Pn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Pn.prototype.get=function(e){if(ni(e)&&(e={id:e}),ni(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?lt(t.overlays,da({type:e.type})):t.overlays.slice():[]}else return e.type?lt(this._overlays,da({type:e.type})):e.id?this._overlays[e.id]:null},Pn.prototype.add=function(e,t,n){if(vn(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=Y({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Pn.prototype.remove=function(e){var t=this.get(e)||[];Je(t)||(t=[t]);var n=this;V(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(eo(i.html),eo(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Pn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Pn.prototype.show=function(){ju(this._overlayRoot)},Pn.prototype.hide=function(){ju(this._overlayRoot,!1)},Pn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],gl(this._overlayRoot)},Pn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=ln(t);i=r.x,o=r.y}a0(n,i,o),An(e.html,"data-container-id",t.id)},Pn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=ln(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=ln(i).height:s=i.height,r=t.bottom*-1+s}a0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Pn.prototype._createOverlayContainer=function(e){var t=Ht('<div class="djs-overlays" />');Yn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Pn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";s0(this._overlayRoot,n)},Pn.prototype._getOverlayContainer=function(e,t){var n=Bt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Pn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),ni(i)&&(i=Ht(i)),r=this._getOverlayContainer(n),o=Ht('<div class="djs-overlay" data-overlay-id="'+t+'">'),Yn(o,{position:"absolute"}),o.appendChild(i),e.type&&Mt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();ju(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Pn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(yn(o)&&o>t.scale||yn(r)&&r<t.scale))&&(c=!1),ju(a,c),this._updateOverlayScale(e,t)},Pn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),yn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),yn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),yn(a)&&(s="scale("+a+","+a+")"),s0(r,s)},Pn.prototype._updateOverlaysVisibilty=function(e){var t=this;V(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Pn.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 o=i.element,r=t.get({element:o});V(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){eo(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",DB,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(V(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&Mt(o.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 LB(e){var t=Ht('<div class="djs-overlay-container" />');return Yn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function a0(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function ju(e,t){e.style.display=t===!1?"none":""}function s0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Hu={__init__:["overlays"],overlays:["type",Pn]};function ng(e,t){t.invoke(_e,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)})}Be(ng,_e),ng.$inject=["canvas","injector"];const IB={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ng]};var BB="bjs-breadcrumbs-shown";function c0(e,t,n){var i=Ht('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Mt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=Ee(l),p=Bt(a,function(d){return d===u});p&&s()});function s(c){c&&(a=NB(c));var l=a.flatMap(function(p){var d=n.findRoot(ro(p))||n.findRoot(p.id);if(!d&&A(p,"bpmn:Process")){var f=t.find(function(y){var w=Ee(y);return w&&w.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var g=J_(p.name||p.id),h=Ht('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(d)}),h});i.innerHTML="";var u=l.length>1;r.toggle(BB,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}c0.$inject=["eventBus","elementRegistry","canvas"];function NB(e){for(var t=Ee(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function l0(e,t){var n=null,i=new $B;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!A(r,"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})}l0.$inject=["eventBus","canvas"];function $B(){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 u0={x:180,y:160};function Zr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Zr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Zr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),jB(a,e)&&i.push({diElement:r,parent:s})}});var o=[];return n.forEach(function(r){if(!t._processToDiagramMap[r.id]){var a=t._createDiagram(r);t._processToDiagramMap[r.id]=a,o.push(a)}}),i.forEach(function(r){for(var a=r.diElement,s=r.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),o},Zr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=FB(e),i={x:n.x-u0.x,y:n.y-u0.y};t.forEach(function(o){o.waypoint?o.waypoint.forEach(function(r){r.x=r.x-i.x,r.y=r.y-i.y}):o.bounds&&(o.bounds.x=o.bounds.x-i.x,o.bounds.y=o.bounds.y-i.y)})},Zr.prototype._moveToDiPlane=function(e,t){var n=p0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Zr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Zr.$inject=["eventBus","moddle"];function p0(e){return A(e,"bpmndi:BPMNDiagram")?e:p0(e.$parent)}function FB(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ye(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),_l(t)}function jB(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||st(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var zu=250,HB='<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>',zB="bjs-drilldown-empty";function pr(e,t,n,i,o){_e.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",zu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",zu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],zu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],zu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}Be(pr,_e),pr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},pr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(ro(e))},pr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Mt(i.html).toggle(zB,!o)}},pr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Ee(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Ht('<button type="button" class="bjs-drilldown">'+HB+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(ro(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},pr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},pr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const GB={__depends__:[Hu,Rh,IB],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",c0],drilldownCentering:["type",l0],drilldownOverlayBehavior:["type",pr],subprocessCompatibility:["type",Zr]};function dr(e){Vt.call(this,e)}Be(dr,Vt),dr.prototype._modules=[Ox,GB,Hu,Ai,Ns],dr.prototype._moddleExtensions={};var Gu="keyboard.keydown",VB="keyboard.keyup",WB=1e3,d0="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 Kn(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(d0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Kn.$inject=["config.keyboard","eventBus"],Kn.prototype._keydownHandler=function(e){this._keyHandler(e,Gu)},Kn.prototype._keyupHandler=function(e){this._keyHandler(e,VB)},Kn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Gu,i),n&&e.preventDefault()}},Kn.prototype._isEventIgnored=function(e){return!1},Kn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(d0)),this.unbind(),e=this._node=this._target,Ue.bind(e,"keydown",this._keydownHandler),Ue.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Kn.prototype.getBinding=function(){return this._node},Kn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ue.unbind(e,"keydown",this._keydownHandler),Ue.unbind(e,"keyup",this._keyupHandler)),this._node=null},Kn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Kn.prototype.addListener=function(e,t,n){En(e)&&(n=t,t=e,e=WB),this._eventBus.on(n||Gu,e,t)},Kn.prototype.removeListener=function(e,t){this._eventBus.off(t||Gu,e)},Kn.prototype.hasModifier=RD,Kn.prototype.isCmd=li,Kn.prototype.isShift=hh,Kn.prototype.isKey=bn;var UB=500;function Ga(e,t){var n=this;e.on("editorActions.init",UB,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ga.$inject=["eventBus","keyboard"],Ga.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(TD(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(kD(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(CD(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(MD(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(AD(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(PD(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["+","Add","="],o)&&li(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["-","Subtract"],o)&&li(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(bn("0",o)&&li(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(bn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const ig={__init__:["keyboard","keyboardBindings"],keyboard:["type",Kn],keyboardBindings:["type",Ga]};var qB={moveSpeed:50,moveSpeedAccelerated:200};function f0(e,t,n){var i=this;this._config=Y({},qB,e||{}),t.addListener(o);function o(r){var a=r.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(r){var a=0,s=0,c=r.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(r.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})}}f0.$inject=["config.keyboardMove","keyboard","canvas"];const h0={__depends__:[ig],__init__:["keyboardMove"],keyboardMove:["type",f0]};var YB=15;function g0(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 o(s){var c=n.start,l=n.button,u=Gr(s),p=Gi(u,c);if(!n.dragging&&KB(p)>YB&&(n.dragging=!0,l===0&&vw(e),au("grab")),n.dragging){var d=n.last||n.start;p=Gi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ue.unbind(document,"mousemove",o),Ue.unbind(document,"mouseup",r),n=null,yw()}function a(s){if(!Nr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Gr(s)},Ue.bind(document,"mousemove",o),Ue.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}g0.$inject=["eventBus","canvas"];function KB(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const m0={__init__:["moveCanvas"],moveCanvas:["type",g0]};function y0(e,t){var n=pf(e.min),i=pf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function XB(e,t){return Math.max(e.min,Math.min(e.max,t))}var ZB=Math.sign||function(e){return e>=0?1:-1},og={min:.2,max:4},v0=10,JB=.1,QB=.75;function lo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Zn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||QB;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}lo.$inject=["config.zoomScroll","eventBus","canvas"],lo.prototype.scroll=function(t){this._canvas.scroll(t)},lo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},lo.prototype.zoom=function(t,n){var i=y0(og,v0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>JB&&(this._zoom(t,n,i),this._totalDelta=0)},lo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Rb()&&t.metaKey,o=t.shiftKey,r=-1*this._scale,a;if(i?r*=t.deltaMode===0?.02:.32:r*=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))*ZB(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},lo.prototype.stepZoom=function(t,n){var i=y0(og,v0);this._zoom(t,n,i)},lo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=pf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(XB(og,s),t)},lo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ue[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},lo.prototype._init=function(e){this.toggle(e)};const x0={__init__:["zoomScroll"],zoomScroll:["type",lo]};function uc(e){dr.call(this,e)}Be(uc,dr),uc.prototype._navigationModules=[h0,m0,x0],uc.prototype._modules=[].concat(dr.prototype._modules,uc.prototype._navigationModules);function rg(e){return e&&e[e.length-1]}function b0(e){return e.y}function w0(e){return e.x}var eN={left:w0,center:w0,right:function(e){return e.x+e.width},top:b0,middle:b0,bottom:function(e){return e.y+e.height}};function Va(e,t){this._modeling=e,this._rules=t}Va.$inject=["modeling","rules"],Va.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}},Va.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Va.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(d,f){return Math.round((d[i]+f[i]+f[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=rg(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(V(t,function(d){var f=d[i]+Math.round(d[o]/2);a[f]?a[f].elements.push(d):a[f]={elements:[d],center:f}}),c=Yi(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=rg(c).center,r;l=t[0],t=Yi(t,function(d){return d[i]+d[o]}),u=rg(t),r[e]=p(l,u)}return r},Va.prototype.trigger=function(e,t){var n=this._modeling,i,o=lt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Je(i)&&(o=i),!(o.length<2||!i)){var r=eN[t],a=Yi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const tN={__init__:["alignElements"],alignElements:["type",Va]},nN=new Ur;function Wa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Wa.$inject=["eventBus"],Wa.prototype.schedule=function(e,t=nN.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Wa.prototype._schedule=function(e,t){const n=iN();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(o){n.reject(o)}}catch(o){console.error("Scheduler#_schedule execution failed",o)}}),promise:n.promise}},Wa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Wa.prototype._cancel=function(e){clearTimeout(e.executionId)};function iN(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const oN={scheduler:["type",Wa]};var rN="djs-element-hidden",Vu=".entry",aN=1e3,_0=8,sN=300;function pn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}pn.$inject=["canvas","elementRegistry","eventBus","scheduler"],pn.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 o=i.target,r=Je(o)?o:[o],a=r.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=r.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,o=Je(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},pn.prototype._createContainer=function(){var e=Ht('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},pn.prototype.registerProvider=function(e,t){t||(t=e,e=aN),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},pn.prototype.getEntries=function(e){var t=this._getProviders(),n=Je(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return V(t,function(o){if(En(o[n])){var r=o[n](e);En(r)?i=r(i):V(r,function(a,s){i[s]=a})}}),i},pn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=An(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},sN);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},pn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(En(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},pn.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))}},pn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},pn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;V(t,function(o,r){var a=o.group||"default",s=Ht(o.html||'<div class="entry" draggable="true"></div>'),c;An(s,"data-action",r),c=Rt("[data-group="+Xr(a)+"]",n),c||(c=Ht('<div class="group"></div>'),An(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&cN(s,o.className),o.title&&An(s,"title",o.title),o.imageUrl&&(i=Ht("<img>"),An(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Mt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},pn.prototype._createHtml=function(e){var t=this,n=Ht('<div class="djs-context-pad"></div>');return ri.bind(n,Vu,"click",function(i){t.trigger("click",i)}),ri.bind(n,Vu,"dragstart",function(i){t.trigger("dragstart",i)}),ri.bind(n,Vu,"mouseover",function(i){t.trigger("mouseover",i)}),ri.bind(n,Vu,"mouseout",function(i){t.trigger("mouseout",i)}),Ue.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},pn.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()&&uN(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},pn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},pn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Je(e)!==Je(n)?!1:Je(e)?e.length===n.length&&Bo(e,function(i){return n.includes(i)}):n===e},pn.prototype.isShown=function(){return this.isOpen()&&Mt(this._current.html).has("open")},pn.prototype.show=function(){this.isOpen()&&(Mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},pn.prototype.hide=function(){this.isOpen()&&(Mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},pn.prototype._getPosition=function(e){if(!Je(e)&&Dt(e)){var t=this._canvas.viewbox(),n=lN(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+_0*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+_0*this._canvas.zoom(),top:s.top-a.top}},pn.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")},pn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Je(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,rN)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},pn.prototype._getTargetBounds=function(e){var t=this,n=Je(e)?e:[e],i=n.map(function(o){return t._canvas.getGraphics(o)});return i.reduce(function(o,r){const a=r.getBoundingClientRect();return o.top=Math.min(o.top,a.top),o.right=Math.max(o.right,a.right),o.bottom=Math.max(o.bottom,a.bottom),o.left=Math.min(o.left,a.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function cN(e,t){var n=Mt(e);t=Je(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function lN(e){return e.waypoints[e.waypoints.length-1]}function uN(e,t){return e=Je(e)?e:[e],t=Je(t)?t:[t],e.length===t.length&&Bo(e,function(n){return t.includes(n)})}const E0={__depends__:[ru,oN,Hu],contextPad:["type",pn]};var Wu,Ut,S0,fr,R0,C0,M0,ag,Uu,pc,A0,sg,cg,lg,qu={},Yu=[],pN=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ku=Array.isArray;function ko(e,t){for(var n in t)e[n]=t[n];return e}function ug(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function P0(e,t,n){var i,o,r,a={};for(r in t)r=="key"?i=t[r]:r=="ref"?o=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?Wu.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)a[r]===void 0&&(a[r]=e.defaultProps[r]);return Xu(e,a,i,o,null)}function Xu(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++S0,__i:-1,__u:0};return o==null&&Ut.vnode!=null&&Ut.vnode(r),r}function Zu(e){return e.children}function Ju(e,t){this.props=e,this.context=t}function Jr(e,t){if(t==null)return e.__?Jr(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"?Jr(e):null}function dN(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=ko({},t);r.__v=t.__v+1,Ut.vnode&&Ut.vnode(r),pg(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Jr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,N0(i,r,o),t.__e=t.__=null,r.__e!=n&&T0(r)}}function T0(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}),T0(e)}function k0(e){(!e.__d&&(e.__d=!0)&&fr.push(e)&&!Qu.__r++||R0!=Ut.debounceRendering)&&((R0=Ut.debounceRendering)||C0)(Qu)}function Qu(){try{for(var e,t=1;fr.length;)fr.length>t&&fr.sort(M0),e=fr.shift(),t=fr.length,dN(e)}finally{fr.length=Qu.__r=0}}function O0(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,g,h,y,w=i&&i.__k||Yu,m=t.length;for(c=fN(n,t,w,c,m),p=0;p<m;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&w[f.__i]||qu,f.__i=p,y=pg(e,f,d,o,r,a,s,c,l,u),g=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&dg(d.ref,null,f),u.push(f.ref,f.__c||g,f)),h==null&&g!=null&&(h=g),4&f.__u?(c=D0(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),f.__u&=-7);return n.__e=h,c}function fN(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,d=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=Xu(null,a,null,null,null):Ku(a)?a=e.__k[r]=Xu(Zu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Xu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+d,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=hN(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?d--:o<u&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Jr(s)),F0(s,s));return i}function D0(e,t,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=D0(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Jr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function hN(e,t,n,i){var o,r,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(o=n-1,r=n+1;o>=0||r<t.length;)if((l=t[a=o>=0?o--:r++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function L0(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||pN.test(t)?n:n+"px"}function ep(e,t,n,i,o){var r,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||L0(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||L0(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(A0,"$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+r]=n,n?i?n[pc]=i[pc]:(n[pc]=sg,e.addEventListener(t,r?lg:cg,r)):e.removeEventListener(t,r?lg:cg,r);else{if(o=="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 I0(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Uu]==null)t[Uu]=sg++;else if(t[Uu]<n[pc])return;return n(Ut.event?Ut.event(t):t)}}}function pg(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,g,h,y,w,m,v,b,E,C,I,k,P,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Ut.__b)&&u(t);e:if(typeof F=="function"){p=a.length;try{if(m=t.props,v=F.prototype&&F.prototype.render,b=(u=F.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?w=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new F(m,E):(t.__c=d=new Ju(m,E),d.constructor=F,d.render=mN),b&&b.sub(d),d.state||(d.state={}),d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&F.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ko({},d.__s)),ko(d.__s,F.getDerivedStateFromProps(m,d.__s))),g=d.props,h=d.state,d.__v=t,f)v&&F.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&F.getDerivedStateFromProps==null&&m!==g&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(m,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(m,d.__s,E)===!1){t.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),Yu.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=Jr(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(m,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(g,h,y)})}if(d.context=E,d.props=m,d.__P=e,d.__e=!1,C=Ut.__r,I=0,v)d.state=d.__s,d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),Yu.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++I<25);d.state=d.__s,d.getChildContext!=null&&(i=ko(ko({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(g,h)),k=u!=null&&u.type===Zu&&u.key==null?$0(u.props.children):u,s=O0(e,Ku(k)?k:[k],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),w&&(d.__E=d.__=null)}catch(z){if(a.length=p,t.__v=null,c||r!=null){if(z.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(P=r.length;P--;)ug(r[P])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),z.then||B0(t),Ut.__e(z,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=gN(n.__e,t,n,i,o,r,a,c,l);return(u=Ut.diffed)&&u(t),128&t.__u?void 0:s}function B0(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(B0))}function N0(e,t,n){for(var i=0;i<n.length;i++)dg(n[i],n[++i],n[++i]);Ut.__c&&Ut.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Ut.__e(r,o.__v)}})}function $0(e){return typeof e!="object"||e==null||e.__b>0?e:Ku(e)?e.map($0):e.constructor!==void 0?null:ko({},e)}function gN(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,g,h,y=n.props||qu,w=t.props,m=t.type;if(m=="svg"?o="http://www.w3.org/2000/svg":m=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((f=r[l])&&"setAttribute"in f==!!m&&(m?f.localName==m:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(m==null)return document.createTextNode(w);e=document.createElementNS(o,m,w.is&&w),s&&(Ut.__m&&Ut.__m(t,r),s=!1),r=null}if(m==null)y===w||s&&e.data==w||(e.data=w);else{if(r=m=="textarea"&&w.defaultValue!=null?null:r&&Wu.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(f=e.attributes[l]).name]=f.value;for(l in y)f=y[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in w||l=="value"&&"defaultValue"in w||l=="checked"&&"defaultChecked"in w||ep(e,l,null,f,o);for(l in w)f=w[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?g=f:l=="checked"?h=f:s&&typeof f!="function"||y[l]===f||ep(e,l,f,y[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),O0(t.type=="template"?e.content:e,Ku(d)?d:[d],t,n,i,m=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Jr(n,0),s,c),r!=null)for(l=r.length;l--;)ug(r[l]);s&&m!="textarea"||(l="value",m=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||m=="progress"&&!g||m=="option"&&g!=y[l])&&ep(e,l,g,y[l],o),l="checked",h!=null&&h!=e[l]&&ep(e,l,h,y[l],o))}return e}function dg(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(o){Ut.__e(o,n)}}function F0(e,t,n){var i,o;if(Ut.unmount&&Ut.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||dg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Ut.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&F0(i[o],t,n||typeof e.type!="function");n||ug(e.__e),e.__c=e.__=e.__e=void 0}function mN(e,t,n){return this.constructor(e,n)}function j0(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Ut.__&&Ut.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],pg(t,e=t.__k=P0(Zu,null,[e]),o||qu,qu,t.namespaceURI,o?null:t.firstChild?Wu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),N0(r,e,a),e.props.children=null}Wu=Yu.slice,Ut={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},S0=0,Ju.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ko({},this.state),typeof e=="function"&&(e=e(ko({},n),this.props)),e&&ko(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),k0(this))},Ju.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),k0(this))},Ju.prototype.render=Zu,fr=[],C0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,M0=function(e,t){return e.__v.__b-t.__v.__b},Qu.__r=0,ag=Math.random().toString(8),Uu="__d"+ag,pc="__a"+ag,A0=/(PointerCapture)$|Capture$/i,sg=0,cg=I0(!1),lg=I0(!0);var H0=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var a=t[r++],s=t[r]?(t[0]|=a?1:2,n[t[r++]]):t[++r];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++r]]=s:a===6?i[1][t[++r]]+=s+"":a?(o=e.apply(s,H0(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},z0=new Map;function yN(e){var t=z0.get(this);return t||(t=new Map,z0.set(this,t)),(t=H0(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(d){r===1&&(d||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,d,a):r===3&&(d||a)?(c.push(3,d,a),r=2):r===2&&a==="..."&&d?c.push(4,d,0):r===2&&a&&!d?c.push(5,0,!0,a):r>=5&&((a||!d&&r===5)&&(c.push(r,0,a,o),r=6),d&&(c.push(r,d,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var It=
|
|
9
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+d+'" height="'+f+'" viewBox="'+u+" "+p+" "+d+" "+f+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Vt.prototype._setDefinitions=function(e){this._definitions=e},Vt.prototype.getModules=function(){return this._modules},Vt.prototype.clear=function(){this.getDefinitions()&&Jo.prototype.clear.call(this)},Vt.prototype.destroy=function(){Jo.prototype.destroy.call(this),eo(this._container)},Vt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Vt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Vt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Vt.prototype.getDefinitions=function(){return this._definitions},Vt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Vt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=Y(Ki(n,["additionalModules"]),{canvas:Y({},n.canvas,{container:e}),modules:a});Jo.call(this,s),n&&n.container&&this.attachTo(n.container)},Vt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Vt.prototype._createContainer=function(e){const t=Ht('<div class="bjs-container"></div>');return Yn(t,{width:Lx(e.width),height:Lx(e.height),position:e.position}),t},Vt.prototype._createModdle=function(e){const t=Y({},this._moddleExtensions,e.moddleExtensions);return new $m(t)},Vt.prototype._modules=[];function Al(e,t){return e.warnings=t,e}function Dk(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 Lk={width:"100%",height:"100%",position:"relative"};function Lx(e){return e+(Qe(e)?"px":"")}function Ik(e,t){return t&&Bt(e.diagrams,function(n){return n.id===t})||null}function Bk(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Px+"</a>",i=Ht(n);Yn(Rt("svg",i),kx),Yn(i,Ox,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ue.bind(i,"click",function(o){Ok(),o.preventDefault()})}function jr(e){Vt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Be(jr,Vt),jr.prototype._createModdle=function(e){var t=Vt.prototype._createModdle.call(this,e);return t.ids=new Qi([32,36,1]),t},jr.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,o;i.clear();for(o in t)i.claim(o,t[o])};function ft(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||gt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!Ee(e).processRef:!0}function Sn(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=gt(e).isHorizontal;return t===void 0?!0:t}}function Nk(e){return e&&Ee(e).isInterrupting!==!1}function Wn(e){return e&&!!Ee(e).triggeredByEvent}function Ra(e,t){var n=Ee(e).eventDefinitions;return No(n,function(i){return A(i,t)})}function $k(e){return Ra(e,"bpmn:ErrorEventDefinition")}function Fk(e){return Ra(e,"bpmn:EscalationEventDefinition")}function jk(e){return Ra(e,"bpmn:CompensateEventDefinition")}var Hr={width:90,height:20},Ix=15;function Qo(e){return A(e,"bpmn:Event")||A(e,"bpmn:Gateway")||A(e,"bpmn:DataStoreReference")||A(e,"bpmn:DataObjectReference")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:Group")}function Tl(e){return at(e.label)}function Hk(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=zk(e),r=Math.atan((i.y-n.y)/(i.x-n.x)),a=o.x,s=o.y;return Math.abs(r)<Math.PI/2?s-=Ix:a+=Ix,{x:a,y:s}}function zk(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 cf(e){return e.waypoints?Hk(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Hr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Hr.height/2}}function Bx(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Hr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=cf(t),i=Hr),Y({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Nx(e){if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return"name";if(A(e,"bpmn:TextAnnotation"))return"text";if(A(e,"bpmn:Group"))return"categoryValueRef"}function Gk(e){var t=e.categoryValueRef;return t&&t.value||""}function si(e){var t=e.businessObject,n=Nx(t);if(n)return n==="categoryValueRef"?Gk(t):t[n]||""}function Vk(e,t){var n=e.businessObject,i=Nx(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function Wk(e){return at(e)&&Qo(e.labelTarget)}var Ca=7;function $x(e){let t=[];return V(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),V(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ls(e){const t=new Map;return V(ef(e),n=>{V($x(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 lf="hsl(225, 10%, 15%)",Uk="white";function oo(e,t){return No(e.eventDefinitions,function(n){return n.$type===t})}function qk(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Yk(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function pt(e,t,n){var i=gt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||Uk}function Ie(e,t,n){var i=gt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||lf}function Is(e,t,n,i){var o=gt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ie(e,n)}function Fx(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,o=[["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 $r(o)}function uf(e,t){var n=e.x,i=e.y,o=e.width,r=e.height,a=[["M",n+t,i],["l",o-t*2,0],["a",t,t,0,0,1,t,t],["l",0,r-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-o,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-r],["a",t,t,0,0,1,t,-t],["z"]];return $r(a)}function Kk(e){var t=e.width,n=e.height,i=e.x,o=e.y,r=t/2,a=n/2,s=[["M",i+r,o],["l",r,a],["l",-r,a],["l",-r,-a],["z"]];return $r(s)}function Xk(e){var t=e.x,n=e.y,i=e.width,o=e.height,r=[["M",t,n],["l",i,0],["l",0,o],["l",-i,0],["z"]];return $r(r)}function Bs(e,t={}){return{width:Si(e,t),height:ci(e,t)}}function Si(e,t={}){return ii(t,"width")?t.width:e.width}function ci(e,t={}){return ii(t,"height")?t.height:e.height}var Zk=new Qi,Jk=10,Pl=3,Qk=1.5,kl=10,e2=4,Ma=.95,t2=1,n2=.25;function zr(e,t,n,i,o,r,a){xo.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:lf,strokeWidth:2,fill:"white"})}function p($){return n.computeStyle($,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:lf,strokeWidth:2})}function d($,M){var{ref:R={x:0,y:0},scale:U=1,element:X,parentGfx:pe=o._svg}=M,Ne=He("marker",{id:$,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*U,markerHeight:20*U,orient:"auto"});nt(Ne,X);var Ke=Rt(":scope > defs",pe);Ke||(Ke=He("defs"),nt(pe,Ke)),nt(Ke,Ne)}function f($,M,R,U){var X=Zk.nextPrefixed("marker-");return g($,X,M,R,U),"url(#"+X+")"}function g($,M,R,U,X){if(R==="sequenceflow-end"){var pe=He("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:X,stroke:X,strokeWidth:1})});d(M,{element:pe,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(R==="messageflow-start"){var Ne=He("circle",{cx:6,cy:6,r:3.5,...u({fill:U,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});d(M,{element:Ne,ref:{x:6,y:6},parentGfx:$})}if(R==="messageflow-end"){var Ke=He("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:U,stroke:X,strokeWidth:1,strokeDasharray:[1e4,1]})});d(M,{element:Ke,ref:{x:8.5,y:5},parentGfx:$})}if(R==="association-start"){var ht=He("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(M,{element:ht,ref:{x:1,y:10},scale:.5,parentGfx:$})}if(R==="association-end"){var kt=He("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:X,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(M,{element:kt,ref:{x:11,y:10},scale:.5,parentGfx:$})}if(R==="conditional-flow-marker"){var St=He("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:U,stroke:X})});d(M,{element:St,ref:{x:-1,y:10},scale:.5,parentGfx:$})}if(R==="conditional-default-flow-marker"){var tn=He("path",{d:"M 6 4 L 10 16",...u({stroke:X,fill:"none"})});d(M,{element:tn,ref:{x:0,y:10},scale:.5,parentGfx:$})}}function h($,M,R,U,X={}){vn(U)&&(X=U,U=0),U=U||0,X=u(X);var pe=M/2,Ne=R/2,Ke=He("circle",{cx:pe,cy:Ne,r:Math.round((M+R)/4-U),...X});return nt($,Ke),Ke}function y($,M,R,U,X,pe){vn(X)&&(pe=X,X=0),X=X||0,pe=u(pe);var Ne=He("rect",{x:X,y:X,width:M-X*2,height:R-X*2,rx:U,ry:U,...pe});return nt($,Ne),Ne}function _($,M,R,U){var X=M/2,pe=R/2,Ne=[{x:X,y:0},{x:M,y:pe},{x:X,y:R},{x:0,y:pe}],Ke=Ne.map(function(kt){return kt.x+","+kt.y}).join(" ");U=u(U);var ht=He("polygon",{...U,points:Ke});return nt($,ht),ht}function m($,M,R,U){R=p(R);var X=Ms(M,R,U);return nt($,X),X}function v($,M,R){return m($,M,R,5)}function b($,M,R){R=p(R);var U=He("path",{...R,d:M});return nt($,U),U}function E($,M,R,U){return b(M,R,Y({"data-marker":$},U))}function C($){return ze[$]}function I($){return function(M,R,U){return C($)(M,R,U)}}var k={"bpmn:MessageEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.235,my:.315}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill),Ne=U?pt(M,s,R.fill):Ie(M,c,R.stroke),Ke=b($,X,{fill:pe,stroke:Ne,strokeWidth:1});return Ke},"bpmn:TimerEventDefinition":function($,M,R={}){var U=R.width||M.width,X=R.height||M.height,pe=R.width?1:2,Ne=h($,U,X,.2*X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:pe}),Ke=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:X,position:{mx:.5,my:.5}});b($,Ke,{stroke:Ie(M,c,R.stroke),strokeWidth:pe});for(var ht=0;ht<12;ht++){var kt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:U,containerHeight:X,position:{mx:.5,my:.5}}),St=U/2,tn=X/2;b($,kt,{strokeWidth:1,stroke:Ie(M,c,R.stroke),transform:"rotate("+ht*30+","+tn+","+St+")"})}return Ne},"bpmn:EscalationEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.5,my:.2}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function($,M,R={}){var U=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.5,my:.222}});return b($,U,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.57,my:.263}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.2,my:.722}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.638,my:-.055}}),pe=U?Ie(M,c,R.stroke):"none",Ne=b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1});return Mx(Ne,45),Ne},"bpmn:CompensateEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.22,my:.5}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.5,my:.2}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{strokeWidth:1,fill:pe,stroke:Ie(M,c,R.stroke)})},"bpmn:MultipleEventDefinition":function($,M,R={},U){var X=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.211,my:.36}}),pe=U?Ie(M,c,R.stroke):pt(M,s,R.fill);return b($,X,{fill:pe,stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function($,M,R={}){var U=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||M.width,containerHeight:R.height||M.height,position:{mx:.458,my:.194}});return b($,U,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function($,M,R={}){var U=h($,M.width,M.height,8,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:4});return U}};function T($,M,R={},U){var X=Ee($),pe=qk(X),Ne=U||$;return X.get("eventDefinitions")&&X.get("eventDefinitions").length>1?X.get("parallelMultiple")?k["bpmn:ParallelMultipleEventDefinition"](M,Ne,R,pe):k["bpmn:MultipleEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:MessageEventDefinition")?k["bpmn:MessageEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:TimerEventDefinition")?k["bpmn:TimerEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:ConditionalEventDefinition")?k["bpmn:ConditionalEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:SignalEventDefinition")?k["bpmn:SignalEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:EscalationEventDefinition")?k["bpmn:EscalationEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:LinkEventDefinition")?k["bpmn:LinkEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:ErrorEventDefinition")?k["bpmn:ErrorEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:CancelEventDefinition")?k["bpmn:CancelEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:CompensateEventDefinition")?k["bpmn:CompensateEventDefinition"](M,Ne,R,pe):oo(X,"bpmn:TerminateEventDefinition")?k["bpmn:TerminateEventDefinition"](M,Ne,R,pe):null}var F={ParticipantMultiplicityMarker:function($,M,R={}){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2-6)/U,my:(X-15)/X}});E("participant-multiplicity",$,pe,{strokeWidth:2,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},SubProcessMarker:function($,M,R={}){var U=y($,14,14,0,{strokeWidth:1,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)});In(U,M.width/2-7.5,M.height-20);var X=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2-7.5)/M.width,my:(M.height-20)/M.height}});E("sub-process",$,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},ParallelMarker:function($,M,R){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2+R.parallel)/U,my:(X-20)/X}});E("parallel",$,pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},SequentialMarker:function($,M,R){var U=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2+R.seq)/M.width,my:(M.height-19)/M.height}});E("sequential",$,U,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},CompensationMarker:function($,M,R){var U=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:(M.width/2+R.compensation)/M.width,my:(M.height-13)/M.height}});E("compensation",$,U,{strokeWidth:1,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})},LoopMarker:function($,M,R){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2+R.loop)/U,my:(X-7)/X}});E("loop",$,pe,{strokeWidth:1.5,fill:"none",stroke:Ie(M,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function($,M,R){var U=Si(M,R),X=ci(M,R),pe=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:(U/2+R.adhoc)/U,my:(X-15)/X}});E("adhoc",$,pe,{strokeWidth:1,fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke)})}};function z($,M,R,U){F[$](M,R,U)}function G($,M,R=[],U={}){U={fill:U.fill,stroke:U.stroke,width:Si(M,U),height:ci(M,U)};var X=Ee(M),pe=R.includes("SubProcessMarker");pe?U={...U,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:U={...U,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},X.get("isForCompensation")&&R.push("CompensationMarker"),A(X,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),pe||Y(U,{compensation:U.compensation-18}));var Ne=X.get("loopCharacteristics"),Ke=Ne&&Ne.get("isSequential");Ne&&(Y(U,{compensation:U.compensation-18}),R.includes("AdhocMarker")&&Y(U,{seq:-23,loop:-18,parallel:-24}),Ke===void 0&&R.push("LoopMarker"),Ke===!1&&R.push("ParallelMarker"),Ke===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&Y(U,{compensation:-8}),V(R,function(ht){z(ht,$,M,U)})}function ne($,M,R={}){R=Y({size:{width:100}},R);var U=r.createText(M||"",R);return dt(U).add("djs-label"),nt($,U),U}function re($,M,R,U={}){var X=Ee(M),pe=Bs({x:M.x,y:M.y,width:M.width,height:M.height},U);return ne($,X.name,{align:R,box:pe,padding:7,style:{fill:Is(M,l,c,U.stroke)}})}function K($,M,R={}){var U={width:M.width,height:M.height,x:M.width/2+M.x,y:M.height/2+M.y};return ne($,si(M),{box:U,style:Y({},r.getExternalStyle(),{fill:Is(M,l,c,R.stroke)})})}function xe($,M,R,U={}){var X=Sn(R),pe=ne($,M,{box:{height:30,width:X?ci(R,U):Si(R,U)},align:"center-middle",style:{fill:Is(R,l,c,U.stroke)}});if(X){var Ne=-1*ci(R,U);Cl(pe,0,-Ne,270)}}function de($,M,R={}){var{width:U,height:X}=Bs(M,R);return y($,U,X,kl,{...R,fill:pt(M,s,R.fill),fillOpacity:Ma,stroke:Ie(M,c,R.stroke)})}function we($,M,R={}){var U=Ee(M),X=pt(M,s,R.fill),pe=Ie(M,c,R.stroke);return(U.get("associationDirection")==="One"||U.get("associationDirection")==="Both")&&(R.markerEnd=f($,"association-end",X,pe)),U.get("associationDirection")==="Both"&&(R.markerStart=f($,"association-start",X,pe)),R=yt(R,["markerStart","markerEnd"]),v($,M.waypoints,{...R,stroke:pe,strokeDasharray:"0, 5"})}function he($,M,R={}){var U=pt(M,s,R.fill),X=Ie(M,c,R.stroke),pe=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.474,my:.296}}),Ne=b($,pe,{fill:U,fillOpacity:Ma,stroke:X}),Ke=Ee(M);if(Yk(Ke)){var ht=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:.33,my:(M.height-18)/M.height}});b($,ht,{strokeWidth:2,fill:U,stroke:X})}return Ne}function W($,M,R={}){return h($,M.width,M.height,{fillOpacity:Ma,...R,fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke)})}function le($,M,R={}){return _($,M.width,M.height,{fill:pt(M,s,R.fill),fillOpacity:Ma,stroke:Ie(M,c,R.stroke)})}function q($,M,R={}){var U=y($,Si(M,R),ci(M,R),0,{fill:pt(M,s,R.fill),fillOpacity:R.fillOpacity||Ma,stroke:Ie(M,c,R.stroke),strokeWidth:1.5}),X=Ee(M);if(A(X,"bpmn:Lane")){var pe=X.get("name");xe($,pe,M,R)}return U}function ee($,M,R={}){var U=de($,M,R),X=ft(M);if(Wn(M)&&(Le(U,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!X)){var pe=Ee(M).flowElements||[],Ne=pe.filter(Ke=>A(Ke,"bpmn:StartEvent"));Ne.length===1&&me(Ne[0],$,R,M)}return re($,M,X?"center-top":"center-middle",R),X?G($,M,void 0,R):G($,M,["SubProcessMarker"],R),U}function me($,M,R,U){var X=22,pe={fill:pt(U,s,R.fill),stroke:Ie(U,c,R.stroke),width:X,height:X},Ne=Ee($).isInterrupting,Ke=Ne?0:3,ht=Ne?1:1.2,kt=20,St=(X-kt)/2,tn="translate("+St+","+St+")";h(M,kt,kt,{fill:pe.fill,stroke:pe.stroke,strokeWidth:ht,strokeDasharray:Ke,transform:tn}),T($,M,pe,U)}function Re($,M,R={}){var U=de($,M,R);return re($,M,"center-middle",R),G($,M,void 0,R),U}var ze=this.handlers={"bpmn:AdHocSubProcess":function($,M,R={}){return ft(M)?R=yt(R,["fill","stroke","width","height"]):R=yt(R,["fill","stroke"]),ee($,M,R)},"bpmn:Association":function($,M,R={}){return R=yt(R,["fill","stroke"]),we($,M,R)},"bpmn:BoundaryEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=Ee(M),pe=X.get("cancelActivity");R={strokeWidth:1.5,fill:pt(M,s,R.fill),fillOpacity:t2,stroke:Ie(M,c,R.stroke)},pe||(R.strokeDasharray="6");var Ne=W($,M,R);return h($,M.width,M.height,Pl,{...R,fill:"none"}),U&&T(M,$,R),Ne},"bpmn:BusinessRuleTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),pe=b($,X);Le(pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1});var Ne=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ke=b($,Ne);return Le(Ke,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:CallActivity":function($,M,R={}){return R=yt(R,["fill","stroke"]),ee($,M,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R),X=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:M.width,containerHeight:M.height,position:{mx:.46,my:.26}});return b($,X,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:DataInput":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),X=he($,M,R);return b($,U,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1}),X},"bpmn:DataInputAssociation":function($,M,R={}){return R=yt(R,["fill","stroke"]),we($,M,{...R,markerEnd:f($,"association-end",pt(M,s,R.fill),Ie(M,c,R.stroke))})},"bpmn:DataObject":function($,M,R={}){return R=yt(R,["fill","stroke"]),he($,M,R)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=i.getRawPath("DATA_ARROW"),X=he($,M,R);return b($,U,{strokeWidth:1,fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke)}),X},"bpmn:DataOutputAssociation":function($,M,R={}){return R=yt(R,["fill","stroke"]),we($,M,{...R,markerEnd:f($,"association-end",pt(M,s,R.fill),Ie(M,c,R.stroke))})},"bpmn:DataStoreReference":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:M.width,containerHeight:M.height,position:{mx:0,my:.133}});return b($,U,{fill:pt(M,s,R.fill),fillOpacity:Ma,stroke:Ie(M,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=W($,M,{...R,strokeWidth:4});return U&&T(M,$,R),X},"bpmn:EventBasedGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Ee(M),X=le($,M,R);h($,M.width,M.height,M.height*.2,{fill:pt(M,"none",R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1});var pe=U.get("eventGatewayType"),Ne=!!U.get("instantiate");function Ke(){var kt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:M.width,containerHeight:M.height,position:{mx:.36,my:.44}});b($,kt,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:2})}if(pe==="Parallel"){var ht=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:M.width,containerHeight:M.height,position:{mx:.474,my:.296}});b($,ht,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1})}else pe==="Exclusive"&&(Ne||h($,M.width,M.height,M.height*.26,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1}),Ke());return X},"bpmn:ExclusiveGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R),X=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:M.width,containerHeight:M.height,position:{mx:.32,my:.3}}),pe=gt(M);return pe.get("isMarkerVisible")&&b($,X,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:Gateway":function($,M,R={}){return R=yt(R,["fill","stroke"]),le($,M,R)},"bpmn:Group":function($,M,R={}){return R=yt(R,["fill","stroke","width","height"]),y($,M.width,M.height,kl,{stroke:Ie(M,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Si(M,R),height:ci(M,R)})},"bpmn:InclusiveGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R);return h($,M.width,M.height,M.height*.24,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:2.5}),U},"bpmn:IntermediateEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=W($,M,{...R,strokeWidth:1.5});return h($,M.width,M.height,Pl,{fill:"none",stroke:Ie(M,c,R.stroke),strokeWidth:1.5}),U&&T(M,$,R),X},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function($,M,R={}){return R=yt(R,["fill","stroke","width","height"]),q($,M,{...R,fillOpacity:n2})},"bpmn:ManualTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b($,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:.5}),U},"bpmn:MessageFlow":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Ee(M),X=gt(M),pe=pt(M,s,R.fill),Ne=Ie(M,c,R.stroke),Ke=v($,M.waypoints,{markerEnd:f($,"messageflow-end",pe,Ne),markerStart:f($,"messageflow-start",pe,Ne),stroke:Ne,strokeDasharray:"10, 11",strokeWidth:1.5});if(U.get("messageRef")){var ht=Ke.getPointAtLength(Ke.getTotalLength()/2),kt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ht.x,y:ht.y}}),St={strokeWidth:1};X.get("messageVisibleKind")==="initiating"?(St.fill=pe,St.stroke=Ne):(St.fill=Ne,St.stroke=pe);var tn=b($,kt,St),Rn=U.get("messageRef"),Fn=Rn.get("name"),Nt=ne($,Fn,{align:"center-top",fitBox:!0,style:{fill:Ne}}),nn=tn.getBBox(),on=Nt.getBBox(),Wi=ht.x-on.width/2,hi=ht.y+nn.height/2+Jk;Cl(Nt,Wi,hi,0)}return Ke},"bpmn:ParallelGateway":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=le($,M,R),X=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:M.width,containerHeight:M.height,position:{mx:.46,my:.2}});return b($,X,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:Participant":function($,M,R={}){R=yt(R,["fill","stroke","width","height"]);var U=q($,M,R),X=ft(M),pe=Sn(M),Ne=Ee(M),Ke=Ne.get("name");if(X){var ht=pe?[{x:30,y:0},{x:30,y:ci(M,R)}]:[{x:0,y:30},{x:Si(M,R),y:30}];m($,ht,{stroke:Ie(M,c,R.stroke),strokeWidth:Qk}),xe($,Ke,M,R)}else{var kt=Bs(M,R);pe||(kt.height=Si(M,R),kt.width=ci(M,R));var St=ne($,Ke,{box:kt,align:"center-middle",style:{fill:Is(M,l,c,R.stroke)}});if(!pe){var tn=-1*ci(M,R);Cl(St,0,-tn,270)}}return Ne.get("participantMultiplicity")&&z("ParticipantMultiplicityMarker",$,M,R),U},"bpmn:ReceiveTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Ee(M),X=Re($,M,R),pe;return U.get("instantiate")?(h($,28,28,20*.22,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),pe=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):pe=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b($,pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),X},"bpmn:ScriptTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b($,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:SendTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b($,X,{fill:Ie(M,c,R.stroke),stroke:pt(M,s,R.fill),strokeWidth:1}),U},"bpmn:SequenceFlow":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=pt(M,s,R.fill),X=Ie(M,c,R.stroke),pe=v($,M.waypoints,{markerEnd:f($,"sequenceflow-end",U,X),stroke:X}),Ne=Ee(M),{source:Ke}=M;if(Ke){var ht=Ee(Ke);Ne.get("conditionExpression")&&A(ht,"bpmn:Activity")&&Le(pe,{markerStart:f($,"conditional-flow-marker",U,X)}),ht.get("default")&&(A(ht,"bpmn:Gateway")||A(ht,"bpmn:Activity"))&&ht.get("default")===Ne&&Le(pe,{markerStart:f($,"conditional-default-flow-marker",U,X)})}return pe},"bpmn:ServiceTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R);h($,10,10,{fill:pt(M,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b($,X,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),h($,10,10,{fill:pt(M,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var pe=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b($,pe,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:1}),U},"bpmn:StartEvent":function($,M,R={}){var{renderIcon:U=!0}=R;R=yt(R,["fill","stroke"]);var X=Ee(M);X.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var pe=W($,M,R);return U&&T(M,$,R),pe},"bpmn:SubProcess":function($,M,R={}){return ft(M)?R=yt(R,["fill","stroke","width","height"]):R=yt(R,["fill","stroke"]),ee($,M,R)},"bpmn:Task":function($,M,R={}){return R=yt(R,["fill","stroke"]),Re($,M,R)},"bpmn:TextAnnotation":function($,M,R={}){R=yt(R,["fill","stroke"]);var{width:U,height:X}=Bs(M,R),pe=y($,U,X,0,0,{fill:"none",stroke:"none"}),Ne=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:U,containerHeight:X,position:{mx:0,my:0}});b($,Ne,{stroke:Ie(M,c,R.stroke)});var Ke=Ee(M),ht=Ke.get("text")||"";return ne($,ht,{align:"left-top",box:Bs(M,R),padding:Ca,style:{fill:Is(M,l,c,R.stroke)}}),pe},"bpmn:Transaction":function($,M,R={}){ft(M)?R=yt(R,["fill","stroke","width","height"]):R=yt(R,["fill","stroke"]);var U=ee($,M,{strokeWidth:1.5,...R}),X=n.style(["no-fill","no-events"],{stroke:Ie(M,c,R.stroke),strokeWidth:1.5}),pe=ft(M);return pe||(R={}),y($,Si(M,R),ci(M,R),kl-Pl,Pl,X),U},"bpmn:UserTask":function($,M,R={}){R=yt(R,["fill","stroke"]);var U=Re($,M,R),X=15,pe=12,Ne=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:X,y:pe}});b($,Ne,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:.5});var Ke=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:X,y:pe}});b($,Ke,{fill:pt(M,s,R.fill),stroke:Ie(M,c,R.stroke),strokeWidth:.5});var ht=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:X,y:pe}});return b($,ht,{fill:Ie(M,c,R.stroke),stroke:Ie(M,c,R.stroke),strokeWidth:.5}),U},label:function($,M,R={}){return K($,M,R)}};this._drawPath=b,this._renderer=C}Be(zr,xo),zr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],zr.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},zr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},zr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},zr.prototype.getShapePath=function(e){return at(e)?uf(e,e2):A(e,"bpmn:Event")?Fx(e):A(e,"bpmn:Activity")?uf(e,kl):A(e,"bpmn:Gateway")?Kk(e):Xk(e)};function yt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var i2=0,o2={width:150,height:50};function r2(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function a2(e){return vn(e)?Y({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var pf=null;function s2(){return pf||(pf=document.createElement("canvas").getContext("2d")),pf}function c2(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(jx(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function jx(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function l2(e,t){var n=s2();if(!n)return{width:0,height:0};n.font=c2(t),"letterSpacing"in n&&(n.letterSpacing=jx(t.letterSpacing)||"0px");var i=e==="",o=i?"dummy":e.replace(/\s+$/,""),r=n.measureText(o);return{width:i?0:r.width,height:"fontBoundingBoxAscent"in r?r.fontBoundingBoxAscent+r.fontBoundingBoxDescent:r.actualBoundingBoxAscent+r.actualBoundingBoxDescent}}function u2(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=l2(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return p2(e,o,i,r);o=f2(o,r.width,t)}}function p2(e,t,n,i){if(t.length<n.length){var o=n.slice(t.length).trim();e.unshift(o)}return{width:i.width,height:i.height,text:t}}var Hx="";function d2(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,o=[],r=0;if(n.length>1)for(;i=n.shift();)if(i.length+r<t)o.push(i),r+=i.length;else{(i==="-"||i===Hx)&&o.pop();break}var a=o[o.length-1];return a&&a===Hx&&(o[o.length-1]="-"),o.join("")}function f2(e,t,n){var i=Math.max(e.length*(n/t),1),o=d2(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Ol(e){this._config=Y({},{size:o2,padding:i2,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=Y({},this._config.size,t.box),i=Y({},this._config.style,t.style),o=r2(t.align||this._config.align),r=a2(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=h2(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(u2(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=oi(l,function(y,_,m){return y+(s||_.height)},0)+r.top+r.bottom,d=oi(l,function(y,_,m){return _.width>y?_.width:y},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var g=He("text");Le(g,i),V(l,function(y){var _;switch(f+=s||y.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?d:u)-r.right-y.width;break;default:_=Math.max(((a?d:u)-y.width)/2+r.left,0)}var m=He("tspan");Le(m,{x:_,y:f}),m.textContent=y.text,nt(g,m)});var h={width:d,height:p};return{dimensions:h,element:g}};function h2(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var g2=12,m2=1.2,y2=40;function zx(e){var t=Y({fontFamily:"Arial, sans-serif",fontSize:g2,fontWeight:"normal",lineHeight:m2},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=Y({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Ol({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Hr.width),height:30},l=r(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=r(s,a,{style:t,align:"left-top",padding:Ca});return{x:a.x,y:a.y,width:a.width,height:Math.max(y2,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,Y({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}zx.$inject=["config.textRenderer"];function v2(){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],o,r;n.abspos?(o=n.abspos.x,r=n.abspos.y):(o=n.containerWidth*n.position.mx,r=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=_2(i.d,{mx:o,my:r,e:a});return p}}var x2=/\{([^{}]+)\}/g,b2=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function w2(e,t,n){var i=n;return t.replace(b2,function(o,r,a,s,c){r=r||s,i&&(r in i&&(i=i[r]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function _2(e,t){return String(e).replace(x2,function(n,i){return w2(n,i,t)})}const E2={__init__:["bpmnRenderer"],bpmnRenderer:["type",zr],textRenderer:["type",zx],pathMap:["type",v2]};function S2(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ns={translate:["value",S2]};function Dl(e,t,n){return Y({id:e.id,type:e.$type,businessObject:e,di:t},n)}function R2(e,t,n){var i=e.waypoint;return!i||i.length<2?[et(t),et(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Gx(e,t,n){return new Error(`element ${Vn(t)} referenced by ${Vn(e)}#${n} not yet drawn`)}function Eo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Eo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Eo.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Dl(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!ft(e,t),c=M2(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Dl(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),A(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),A(e,"bpmn:Lane")&&(r=0),A(e,"bpmn:DataStoreReference")&&(C2(n,et(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(A(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Dl(e,t,{hidden:o,source:u,target:p,waypoints:R2(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Vn(t)} for element ${Vn(e)}`);return Qo(e)&&si(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Eo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Vn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Gx(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Eo.prototype.addLabel=function(e,t,n){var i,o,r;return i=Bx(t,n),o=si(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Dl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!si(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(r,n.parent)},Eo.prototype._getConnectedElement=function(e,t){var n,i,o=e.$type;if(i=e[t+"Ref"],t==="source"&&o==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&o==="bpmn:DataOutputAssociation"||t==="target"&&o==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Gx(e,i,t+"Ref"):new Error(`${Vn(e)}#${t} Ref not specified`)},Eo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Eo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Eo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function C2(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 M2(e){return A(e,"bpmn:Group")}const Vx={__depends__:[E2,{__depends__:[Ns],bpmnImporter:["type",Eo]}]};function $s(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Gi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function df(e){return Math.log(e)/Math.log(10)}var A2=1e3;function _e(e){this._eventBus=e}_e.$inject=["eventBus"];function T2(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}_e.prototype.on=function(e,t,n,i,o,r){if((En(t)||Qe(t))&&(r=o,o=i,i=n,n=t,t=null),En(n)&&(r=o,o=i,i=n,n=A2),vn(o)&&(r=o,o=!1),!En(i))throw new Error("handlerFn must be a function");Je(e)||(e=[e]);var a=this._eventBus;V(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?T2(i,r):i,r)})},_e.prototype.canExecute=So("canExecute"),_e.prototype.preExecute=So("preExecute"),_e.prototype.preExecuted=So("preExecuted"),_e.prototype.execute=So("execute"),_e.prototype.executed=So("executed"),_e.prototype.postExecute=So("postExecute"),_e.prototype.postExecuted=So("postExecuted"),_e.prototype.revert=So("revert"),_e.prototype.reverted=So("reverted");function So(e){return function(n,i,o,r,a){(En(n)||Qe(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var ff=["top","bottom","left","right"],Ll=10;function hf(e,t){_e.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(Tl(o)&&!Dt(o)){var r=O2(o);r&&i(o,r)}}function i(o,r){var a=et(o),s=o.label,c=et(s);if(s.parent){var l=Ye(o),u;switch(r){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=Gi(u,c);t.moveShape(s,p)}}}Be(hf,_e),hf.$inject=["eventBus","modeling"];function P2(e){var t=e.host,n=et(e),i=Ln(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=ff.filter(function(a){return o.indexOf(a)===-1});return r}function k2(e){var t=et(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 Wx(t,i)});return n}function O2(e){var t=et(e.label),n=et(e),i=Wx(n,t);if(D2(i)){var o=k2(e);if(e.host){var r=P2(e);o=o.concat(r)}var a=ff.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?Ln(e.label,e)!=="intersect"?void 0:i:a[0]}}function Wx(e,t){return Ln(t,e,5)}function D2(e){return ff.indexOf(e)!==-1}function gf(e){_e.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(A(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)}Be(gf,_e),gf.$inject=["eventBus"];var L2=1500;function mf(e,t,n){e.invoke(_e,this),this.preExecute("elements.delete",L2,function(o){var r=o.context,a=r.elements,s=i(a);s.length&&(r.elements=a.concat(s))}),t.on("shape.move.start",function(o){var r=o.context.shapes,a=i(r);a.length&&(o.context.shapes=r.concat(a))});function i(o){var r=lt(o,l=>A(l,"bpmn:Participant")||A(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>A(l,"bpmn:Artifact"))),c=new Set;return V(r,l=>{const u=new Set(ua(_a(Array.from(s),un(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Be(mf,_e),mf.$inject=["injector","eventBus","canvas"];function yf(e,t){e.invoke(_e,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=lt(o.incoming.concat(o.outgoing),function(a){return A(a,"bpmn:Association")});V(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Be(yf,_e),yf.$inject=["injector","modeling"];function Aa(e,t){for(ni(t)&&(t=[t]);e=e.parent;)if(st(e,t))return e;return null}function Ux(e,t){var n=Aa(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Aa(e,i),n)return Sn(n);if(st(e,i))return Sn(e);var o;for(o=Ee(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=Ee(a);return s&&s.get("processRef")===o});return r?Sn(r):!0}var qx=500;function Il(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",qx,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Yx(r,a)}),o.length===1&&o.map(function(r){return o.indexOf(r)}).forEach(function(r){var a=o[r];i.elements[r]=n._replaceShape(o[r],a)})},!0),this.preExecute("elements.move",qx,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Yx(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}Il.$inject=["bpmnReplace","injector"],Be(Il,_e),Il.prototype._replaceShape=function(e,t){var n=I2(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function I2(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function Yx(e,t){return!at(e)&&st(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function vf(e,t){_e.call(this,e);function n(i){return lt(i.attachers,function(o){return A(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);A(o,"bpmn:EventBasedGateway")&&A(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;A(o,"bpmn:Gateway")&&A(r,"bpmn:EventBasedGateway")&&V(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}vf.$inject=["eventBus","modeling"],Be(vf,_e);function Kx(e){return e.create("bpmn:Category")}function B2(e){return e.create("bpmn:CategoryValue")}function Xx(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=B2(e)),n.$parent||(n.$parent=Kx(e)),n}function N2(e,t,n){return rn(t.get("categoryValue"),e),e.$parent=t,rn(n.get("rootElements"),t),t.$parent=n,e}function $2(e){var t=e.$parent;return t&&(en(t.get("categoryValue"),e),e.$parent=null),e}function F2(e){var t=e.$parent;return t&&(en(t.get("rootElements"),e),e.$parent=null),e}var j2=500;function xf(e,t,n){n.invoke(_e,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(Ee).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&N2(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&F2(l),c&&!o(c,u)&&$2(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(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;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.executed(["shape.move","shape.resize"],j2,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,Ee(l))},!0),this.executed("group.updateRefs",function(c){Zx(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Zx(c).forEach(function(l){s(l.categoryValue,l.category,Ee(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}xf.$inject=["bpmnjs","elementRegistry","injector"],Be(xf,_e);function Zx(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function bf(e,t,n){_e.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const _=y.source,m=y.target;Ta(_)&&Fs(m)&&u(m)}function o(y){const _=y.connection,m=y.source,v=y.target;Ta(m)&&Bl(v)&&(l(v),d(m,[_]))}function r(y){const _=y.newTarget,m=y.oldSource,v=y.oldTarget;if(v!==_){const b=m;Fs(v)&&u(v),Ta(b)&&Bl(_)&&l(_)}}function a(y){const{element:_}=y;Fs(_)?(p(_),f(_)):Bl(_)&&g(_)}function s(y){const{newData:_,oldShape:m}=y;if(Ta(y.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const v=m.outgoing.find(({target:b})=>Fs(b));v&&v.target&&(y._connectionTarget=v.target)}else if(!Ta(y.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const v=m.outgoing.find(({target:b})=>Bl(b));v&&v.target&&(y._connectionTarget=v.target),h(m)}}function c(y){const{_connectionTarget:_,newShape:m}=y;_&&t.connect(m,_)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const _ of y.incoming)n.canConnect(_.source,y)||t.removeConnection(_);for(const _ of y.outgoing)n.canConnect(y,_.target)||t.removeConnection(_)}function d(y,_){y.outgoing.filter(b=>A(b,"bpmn:Association")).filter(b=>Fs(b.target)&&!_.includes(b)).forEach(b=>t.removeConnection(b))}function f(y){const _=y.attachers.slice();_.length&&t.removeElements(_)}function g(y){const _=y.incoming.filter(m=>Ta(m.source));t.removeElements(_)}function h(y){const _=y.outgoing.filter(m=>A(m,"bpmn:SequenceFlow"));t.removeElements(_)}}Be(bf,_e),bf.$inject=["eventBus","modeling","bpmnRules"];function Fs(e){const t=Ee(e);return t&&t.get("isForCompensation")}function Ta(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ra(e,"bpmn:CompensateEventDefinition")}function Bl(e){return e&&A(e,"bpmn:Activity")&&!Wn(e)}function wf(e){e.invoke(_e,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;A(i,"bpmn:Lane")&&!A(o,"bpmn:Lane")&&(n.parent=Aa(i,"bpmn:Participant"))})}wf.$inject=["injector"],Be(wf,_e);function _f(e,t){_e.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(A(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}_f.$inject=["eventBus","bpmnFactory"],Be(_f,_e);var Ef=20,Sf=20,Jx=30,Nl=2e3;function Rf(e,t,n){_e.call(this,t),t.on(["create.start","shape.move.start"],Nl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!A(a,"bpmn:Participant")||!A(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!A(p,"bpmn:Group")&&!at(p)&&!Dt(p)});if(c.length){var l=un(c),u=H2(a,l);Y(a,u),r.createConstraints=z2(a,l)}}}),t.on("create.start",Nl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}A(a,"bpmn:Participant")&&A(s,"bpmn:Process")&&(t.on("element.hover",Nl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return A(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",Nl,function(o){var r=o.elements,a=o.parent,s=G2(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=Ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;A(a,"bpmn:Participant")&&A(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=Ee(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&Ee(s).set("processRef",Ee(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&Ee(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.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)}Rf.$inject=["canvas","eventBus","modeling"],Be(Rf,_e);function H2(e,t){t={width:t.width+Ef*2+Jx,height:t.height+Sf*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 z2(e,t){return t=Ye(t),{bottom:t.top+e.height/2-Sf,left:t.right-e.width/2+Ef,top:t.bottom-e.height/2+Sf,right:t.left+e.width/2-Ef-Jx}}function G2(e){return Bt(e,function(t){return A(t,"bpmn:Participant")})}var Qx="__targetRef_placeholder";function Cf(e,t){_e.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],eb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],eb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Bt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Bt(c,function(u){return u.name===Qx});return!l&&s&&(l=t.create("bpmn:Property",{name:Qx}),rn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||en(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,d=s.newTarget,f=d&&d.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,_;h&&h!==p&&o(h,l),f&&f!==p&&o(f,l),p?(_=i(p,!0),y.targetRef=_):y.targetRef=null}}Cf.$inject=["eventBus","bpmnFactory"],Be(Cf,_e);function eb(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function $l(e){this._bpmnUpdater=e}$l.$inject=["bpmnUpdater"],$l.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,o=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]},$l.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,o=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,o),[]};function Mf(e,t,n,i){_e.call(this,i),t.registerHandler("dataStore.updateContainment",$l);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&Ee(s).processRef})[0]}function r(s){return s.children.filter(function(c){return A(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:gt(s),newSemanticParent:u.processRef||u,newDiParent:gt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;A(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 A(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!A(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(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(!A(u,"bpmn:Collaboration")&&A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(p,"bpmn:Collaboration")){var d=A(u,"bpmn:Participant")?u:W2(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();st(l,["bpmn:Participant","bpmn:SubProcess"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return V2(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(d){A(u,"bpmn:Process")&&a(d,u)})})}Mf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Be(Mf,_e);function V2(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 W2(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var Fl=Math.max,jl=Math.min,U2=20;function tb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function q2(e,t,n){var i=n.x,o=n.y,r={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(r.y=e.y+o,r.height=e.height-o):t.indexOf("s")!==-1&&(r.height=e.height+o),t.indexOf("e")!==-1?r.width=e.width+i:t.indexOf("w")!==-1&&(r.x=e.x+i,r.width=e.width-i),r}function Y2(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],o=n.min&&n.min[e],r=n.max&&n.max[e];return Qe(o)&&(i=(/top|left/.test(e)?jl:Fl)(i,o)),Qe(r)&&(i=(/top|left/.test(e)?Fl:jl)(i,r)),i}function K2(e,t){if(!t)return e;var n=Ye(e);return El({top:Hl("top",n,t),right:Hl("right",n,t),bottom:Hl("bottom",n,t),left:Hl("left",n,t)})}function X2(e,t,n,i){var o=Ye(t),r={top:/n/.test(e)?o.bottom-n.height:o.top,left:/w/.test(e)?o.right-n.width:o.left,bottom:/s/.test(e)?o.top+n.height:o.bottom,right:/e/.test(e)?o.left+n.width:o.right},a=i?Ye(i):r,s={top:jl(r.top,a.top),left:jl(r.left,a.left),bottom:Fl(r.bottom,a.bottom),right:Fl(r.right,a.right)};return El(s)}function js(e,t){return typeof e<"u"?e:U2}function Z2(e,t){var n,i,o,r;return typeof t=="object"?(n=js(t.left),i=js(t.right),o=js(t.top),r=js(t.bottom)):n=i=o=r=js(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function J2(e){return!(e.waypoints||e.type==="label")}function nb(e,t){var n;if(e.length===void 0?n=lt(e.children,J2):n=e,n.length)return Z2(un(n),t)}var er=Math.abs;function Q2(e,t){return tb(Ye(t),Ye(e))}var eO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ri=30;function zl(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(zl(n,t),t.push(n))}),t}function tr(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Ci(e){return Aa(e,eO)||e}function tO(e,t){var n=Ci(e),i=A(n,"bpmn:Process")?[]:[n],o=zl(n,i),r=Ye(e),a=Ye(t),s=Q2(e,t),c=[],l=Sn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,d=l?s.right:0,f=l?0:s.bottom,g=l?s.left:0,h=Ye(u);s.top&&(er(h.bottom-r.top)<10&&(f=a.top-h.bottom),er(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(er(h.right-r.left)<10&&(d=a.left-h.right),er(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(er(h.top-r.bottom)<10&&(p=a.bottom-h.top),er(h.bottom-r.bottom)<5&&(f=a.bottom-h.bottom)),s.right&&(er(h.left-r.right)<10&&(g=a.right-h.left),er(h.right-r.right)<5&&(d=a.right-h.right)),(p||d||f||g)&&c.push({shape:u,newBounds:Y2(u,{top:p,right:d,bottom:f,left:g})})}}),c}var nO=500;function Af(e,t){_e.call(this,e);function n(i,o){var r=Sn(i),a=tr(o),s=[],c=[],l=[],u=[];if(Fr(a,function(y){return r?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;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var d,f,g,h;s.length&&(d=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},"s")),c.length&&(f=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(f.movingShapes,f.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",nO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;A(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Af.$inject=["eventBus","spaceTool"],Be(Af,_e);var ib=500;function Gl(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ib,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return ob(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",ib,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;ob(a,oO(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Gl.$inject=["bpmnReplace","injector"],Be(Gl,_e),Gl.prototype._replaceShape=function(e){var t=iO(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function iO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function ob(e,t){return!at(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function oO(e,t){return e.indexOf(t)!==-1}var Vl=Math.round,rO=Math.max;function aO(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 sO(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var rb=10;function cO(e,t){var n,i;for(n=0;i=e[n];n++)if(Ps(i,t)<=rb)return{point:e[n],bendpoint:!0,index:n};return null}function lO(e,t){var n=cx(aO(t,rb),sO(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=rO(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Vl(i.x+o.x)/2,y:Vl(i.y+o.y)/2},index:i.segment2}:{point:{x:Vl(i.x),y:Vl(i.y)},index:i.segment2}:null}function Tf(e,t){return cO(e,t)||lO(e,t)}function Pf(e,t,n){_e.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,g,h=o.outgoing.slice(),y=o.incoming.slice(),_;Qe(a.width)?_=et(a):_=a;var m=Tf(s,_);if(m){if(c=s.slice(0,m.index),l=s.slice(m.index+(m.bendpoint?1:0)),!c.length||!l.length)return;u=m.bendpoint?s[m.index]:_,(c.length===1||!ab(o,c[c.length-1]))&&c.push(sb(u)),(l.length===1||!ab(o,l[0]))&&l.unshift(sb(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),f=r),t.canConnect(o,d,r)&&(f?g=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),g=r));var v=[].concat(f&<(y,function(b){return b.source===f.source})||[],g&<(h,function(b){return b.target===g.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=et(c),u={x:l.x+s.x,y:l.y+s.y},p=Bt(r.children,function(d){var f=t.canInsert(a,d);return f&&Tf(d.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}Be(Pf,_e),Pf.$inject=["eventBus","bpmnRules","modeling"];function ab(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 sb(e){return Y({},e)}function kf(e,t){_e.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Pa(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Pa(l)):c=a.incoming.filter(l=>l!==o&&Pa(l)&&A(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(A(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Pa).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Pa).forEach(function(s){const c=a.incoming.filter(Pa).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}kf.$inject=["eventBus","modeling"],Be(kf,_e);function Pa(e){return A(e,"bpmn:SequenceFlow")}var Wl=1500,cb=2e3;function lb(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"],Wl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!st(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ci(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||st(r,["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"],Wl,function(i){var o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Ci(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Wl,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ci(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Wl,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Ci(r)||r)}),t.on("shape.move.start",cb,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Ci(o)||o)}),t.on("spaceTool.move",cb,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Ci(o))})}lb.$inject=["elementRegistry","eventBus","canvas"];var ub=770;function Of(e,t,n,i){n.invoke(_e,this);function o(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef;u||(u=Xx(e,l));var p=c.category||u.$parent||Kx(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=Ee(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;A(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=Ee(l);if(!(!A(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(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=Ee(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||Ee(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",ub,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=Ee(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",ub,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})}Of.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Be(Of,_e);function Df(e,t,n,i){var o,r,a,s,c;return o=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),o==0?null:(r=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*r-(i.y-n.y)*a,s=c/o,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function pb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Df(i,o,r,a),l=Df(i,o,r,s),u;c&&l?db(c,r)>db(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],et(i.source)),t(o[o.length-1],o[o.length-2],et(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}pb.$inject=["eventBus"];function db(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Lf(e){_e.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=Ee(i),r=gt(i);if(st(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}Lf.$inject=["eventBus"],Be(Lf,_e);function fb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function hb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function uO(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 pO(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],o=i[0].n*t[0]+i[1].n*t[1],r=i[0].lambda*t[0]+i[1].lambda*t[1];return-o/r}function If(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=pO([n.x,n.y],[o.x,o.y],[e.x,e.y]);return{x:n.x+r*o.x,y:n.y+r*o.y}}function gb(e,t){var n=If(e,t),i={x:n.x-e.x,y:n.y-e.y};return fb(i)}function Hs(e,t){return fb({x:e.x-t.x,y:e.y-t.y})}var mb=Math.sqrt,yb=Math.min,dO=Math.max,vb=Math.abs;function xb(e){return Math.pow(e,2)}function zs(e,t){return mb(xb(e.x-t.x)+xb(e.y-t.y))}function fO(e,t){var n=0,i,o,r,a,s,c,l,u,p,d,f;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],wb(i,o)?l=[i]:(r=zs(e,i),a=zs(e,o),c=yb(r,a),l=hO(i,o,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:wb(i,l[0])?n:n+1}),l.length===2&&(s=mO(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:zs(i,s)/zs(i,o)}),p=zs(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function hO(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,d=u/c,f=p*p-d;if(f<0&&f>-1e-6&&(f=0),f<0)return[];var g=mb(f),h=-p+g,y=-p-g,_={x:e.x-o*h,y:e.y-r*h};if(f===0)return[_];var m={x:e.x-o*y,y:e.y-r*y};return[_,m].filter(function(v){return gO(v,e,t)})}function gO(e,t,n){return bb(e.x,t.x,n.x)&&bb(e.y,t.y,n.y)}function bb(e,t,n){return e>=yb(t,n)-Ul&&e<=dO(t,n)+Ul}function mO(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ul=.1;function wb(e,t){return vb(e.x-t.x)<=Ul&&vb(e.y-t.y)<=Ul}function yO(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=Eb(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function _b(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=fO(e,n),c=s.segmentIndex,l=yO(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Sb(n,c),p=Sb(t,l),d=s.position,f=xO(u,d),g=vO(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,_=n[y];if(t.indexOf(_)!==-1)return a;if(h===0){var m=t[y];return o=m.x-s.position.x,r=m.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&y!==0&&y<n.length-1&&(f=Eb(n,y))}var v={x:(p[1].x-p[0].x)*f+p[0].x,y:(p[1].y-p[0].y)*f+p[0].y},b=uO({x:e.x-d.x,y:e.y-d.y},g);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:wo(v),delta:wo({x:o,y:r})}}function Eb(e,t){var n=Hs(e[t-1],e[t]),i=Hs(e[t],e[t+1]),o=n/(n+i);return o}function vO(e,t){var n=hb(e),i=hb(t);return i-n}function Sb(e,t){return[e[t],e[t+1]]}function xO(e,t){var n=Hs(e[0],e[1]),i=Hs(e[0],t);return n===0?0:i/n}function bO(e,t,n,i){var o=et(e);return _b(o,t,n,i).delta}function Gs(e,t,n){var i=$s(t),o=$s(n),r=Gi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return wo({x:o.x+a.x,y:o.y+a.y})}function Rb(e,t,n){var i=$s(e),o=$s(t),r=$s(n),a=Gi(e,i),s=Gi(i,o),c=wO(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:r.x+l.x,y:r.y+l.y};return wo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function wO(e,t,n){var i=Ye(t),o=Ye(n);if(_O(i,o))return null;var r=Ln(t,e),a,s,c;if(r==="top")a={x:0,y:o.bottom-i.bottom};else if(r==="bottom")a={x:0,y:o.top-i.top};else if(r==="right")a={x:o.left-i.left,y:0};else if(r==="left")a={x:o.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=Ln(n,s),c!==r?null:a}function _O(e,t){return EO(e,t)||SO(e,t)}function EO(e,t){return e.right!==t.right&&e.left!==t.left}function SO(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Cb="name",Mb="text";function Bf(e,t,n,i){_e.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{Ee(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Cb in l&&t.updateLabel(c,l[Cb]),Mb in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Mb]||"");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;at(l)||!Qo(l)||si(l)&&t.updateLabel(l,si(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 r(a){var s=a.context,c=s.connection,l=c.label,u=Y({},s.hints),p=s.newWaypoints||c.waypoints,d=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),bO(l,p,d,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=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=Ee(c);u&&Qo(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(!(!at(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(si(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?g-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Tl(c)){var p=c.label,d=et(p),f=MO(u),g=CO(d,f),h=RO(g,u,l);t.moveShape(p,h)}})}Be(Bf,_e),Bf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function RO(e,t,n){var i=Gs(e,t,n);return wo(Gi(i,e))}function CO(e,t){if(t.length){var n=AO(e,t);return If(e,n)}}function MO(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 AO(e,t){var n=t.map(function(o){return{line:o,distance:gb(e,o)}}),i=Yi(n,"distance");return i[0].line}function TO(e,t,n,i){return _b(e,t,n,i).point}function Nf(e,t){_e.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=Y({},r.hints),c=r.newWaypoints||a.waypoints,l=r.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),TO(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.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 o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},d=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,d)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},d=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,d)})})}Be(Nf,_e),Nf.$inject=["eventBus","modeling"];function ql(e,t,n){var i=Kl(e),o=Tb(i,t),r=i[0];return o.length?o[o.length-1]:Gs(r.original||r,n,t)}function Yl(e,t,n){var i=Kl(e),o=Tb(i,t),r=i[i.length-1];return o.length?o[0]:Gs(r.original||r,n,t)}function $f(e,t,n){var i=Kl(e),o=Ab(t,n),r=i[0];return Gs(r.original||r,o,t)}function Ff(e,t,n){var i=Kl(e),o=Ab(t,n),r=i[i.length-1];return Gs(r.original||r,o,t)}function Ab(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Kl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Tb(e,t){var n=Hn(e,kO);return lt(n,function(i){return PO(i,t)})}function PO(e,t){return Ln(t,e,1)==="intersect"}function kO(e){return e.original||e}function jf(e,t){_e.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(OO(i,o)){var r=DO(i);r.incoming.forEach(function(a){var s=Yl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=ql(a,o,i);t.reconnectStart(a,o,s)})}},!0)}jf.$inject=["eventBus","modeling"],Be(jf,_e);function OO(e,t){return A(e,"bpmn:Participant")&&ft(e)&&A(t,"bpmn:Participant")&&!ft(t)}function DO(e){var t=As([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){A(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){A(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const LO=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Pb(e){const t=Ee(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Wn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:LO.some(i=>A(n[0],i))}function kb(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Hf(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Pb(o))return;const a=kb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=Ee(i).get(a),l=Ee(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Hf.$inject=["injector","modeling"],Be(Hf,_e);function zf(e,t){_e.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=gt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Be(zf,_e),zf.$inject=["eventBus","modeling"];function Gf(e,t,n){_e.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!A(r,"bpmn:SequenceFlow")||!A(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=IO(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Be(Gf,_e),Gf.$inject=["eventBus","bpmnRules","modeling"];function ka(e){return e.original||e}function IO(e,t){var n=Df(ka(e[e.length-2]),ka(e[e.length-1]),ka(t[1]),ka(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[ka(e[0]),ka(t[t.length-1])]}function Vf(e,t){_e.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;A(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}Vf.$inject=["eventBus","modeling"],Be(Vf,_e);function Wf(e,t,n,i){_e.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var d,f;A(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),A(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(f=!0),n.canConnectSequenceFlow(l,u)&&(d="bpmn:SequenceFlow")),f&&t.removeConnection(c),d&&t.connect(l,u,{type:d,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,d=l.newTarget||u.target,f,g;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(g=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,d;!p||!p.length||(d=p.indexOf(c),d!==-1&&p.splice(d,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;V(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,d=p.businessObject,f;u.default&&(f=Bt(p.outgoing,da({id:p.businessObject.default.id})),f&&t.updateProperties(f,{conditionExpression:void 0})),u.conditionExpression&&d.sourceRef.default===d&&t.updateProperties(p.source,{default:void 0})})}Be(Wf,_e),Wf.$inject=["eventBus","modeling","bpmnRules","injector"];function Xl(e,t,n,i,o,r){i.invoke(_e,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=oi(l,function(p,d){var f=t.canReplace([d],d.host||d.parent||c);return f?p.concat(f.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=[];V(s.closure.topLevel,function(d){Wn(d)?u=u.concat(d.children):u=u.concat(d)}),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;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Be(Xl,_e),Xl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;V(t,function(r){var a={type:r.newElementType},s=n.get(r.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&o.select(e)},Xl.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var BO=1500,NO={width:140,height:120},Uf={width:300,height:60},qf={width:60,height:300},Zl={width:300,height:150},Jl={width:150,height:300},Ob={width:140,height:120},Db={width:100,height:40};function Lb(e){e.on("resize.start",BO,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(A(i,"bpmn:Lane")||A(i,"bpmn:Participant"))&&(n.resizeConstraints=zO(i,o,r)),A(i,"bpmn:SubProcess")&&ft(i)&&(n.minDimensions=Ob),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=Db)})}Lb.$inject=["eventBus"];var nr=Math.abs,$O=Math.min,FO=Math.max;function Ib(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Oa(e,t,n){return Ib(e,t,n,$O)}function Da(e,t,n){return Ib(e,t,n,FO)}var jO={top:20,left:50,right:20,bottom:20},HO={top:50,left:20,right:20,bottom:20};function zO(e,t,n){var i=Ci(e),o=!0,r=!0,a=zl(i,[i]),s=Ye(e),c={},l={},u=Sn(e),p=u?Uf:qf;/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=Ye(g);u?(h.top<s.top-10&&(o=!1),h.bottom>s.bottom+10&&(r=!1)):(h.left<s.left-10&&(o=!1),h.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&nr(s.top-h.bottom)<10&&Da(c,"top",h.top+p.height),nr(s.top-h.top)<5&&Oa(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&nr(s.right-h.left)<10&&Oa(c,"right",h.right-p.width),nr(s.right-h.right)<5&&Da(l,"right",h.left+p.width)),/s/.test(t)&&(n&&nr(s.bottom-h.top)<10&&Oa(c,"bottom",h.bottom-p.height),nr(s.bottom-h.bottom)<5&&Da(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&nr(s.left-h.right)<10&&Da(c,"left",h.left+p.width),nr(s.left-h.left)<5&&Oa(l,"left",h.right-p.width))});var d=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(A(g,"bpmn:FlowElement")||A(g,"bpmn:Artifact"))}),f=u?jO:HO;return d.forEach(function(g){var h=Ye(g);/n/.test(t)&&(!u||o)&&Oa(l,"top",h.top-f.top),/e/.test(t)&&(u||r)&&Da(l,"right",h.right+f.right),/s/.test(t)&&(!u||r)&&Da(l,"bottom",h.bottom+f.bottom),/w/.test(t)&&(u||o)&&Oa(l,"left",h.left-f.left)}),{min:l,max:c}}function Bb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function La(e){return e.originalEvent||e.srcEvent}function Yf(e){Bb(e),Bb(La(e))}function Gr(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 Nb(){return/mac/i.test(navigator.platform)}function $b(e,t){return(La(e)||e).button===t}function ir(e){return $b(e,0)}function GO(e){return $b(e,1)}function Vs(e){var t=La(e)||e;return ir(e)?Nb()?t.metaKey:t.ctrlKey:!1}function Ql(e){var t=La(e)||e;return ir(e)&&t.shiftKey}var Fb=1001;function jb(e,t){e.on("resize.start",Fb+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!Vs(n))}),e.on("resize.end",Fb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))return r&&(a=fx(a),t.resizeLane(o,a,i.balanced)),!1})}jb.$inject=["eventBus","modeling"];var VO=500;function Kf(e,t,n,i,o){n.invoke(_e,this);function r(u){return st(u,["bpmn:ReceiveTask","bpmn:SendTask"])||WO(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!Bt(d,da({id:u.id}))}function s(u){if(A(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(A(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(A(u,"bpmn:MessageEventDefinition"))return"messageRef";if(A(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(st(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),d=p[0];return d.get(s(d))}function l(u,p){if(st(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var d=u.get("eventDefinitions"),f=d[0];return f.set(s(f),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var d=Ee(p),f=c(d),g;f&&!a(f)&&(g=e.getDefinitions().get("rootElements"),rn(g,f),u.addedRootElement=f)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var d=e.getDefinitions().get("rootElements");en(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=Ee(d),g=c(f);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",VO,function(u){var p=u.descriptor,d=p.businessObject,f=p.referencedRootElement;f&&(a(f)||(f=i.copyElement(f,o.create(f.$type))),l(d,f),delete p.referencedRootElement)})}Kf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Be(Kf,_e);function WO(e,t){return Je(t)||(t=[t]),No(t,function(n){return Ra(e,n)})}var Hb=Math.max;function zb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return V(n,function(a){var s=a.id;A(a,"bpmn:Participant")&&(r[s]=qO(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=Sn(a)?Uf:qf),A(a,"bpmn:SubProcess")&&ft(a)&&(r[s]=Ob),A(a,"bpmn:TextAnnotation")&&(r[s]=Db),A(a,"bpmn:Group")&&(r[s]=NO)}),r})}zb.$inject=["eventBus"];function UO(e){return e==="x"}function qO(e,t,n){var i=Sn(e);if(!XO(e))return i?Zl:Jl;var o=UO(t),r={};return o?i?r=Zl:r={width:KO(e,n,o),height:Jl.height}:i?r={width:Zl.width,height:YO(e,n,o)}:r=Jl,r}function YO(e,t,n){var i;return i=ZO(e,t,n),Hb(Zl.height,i)}function KO(e,t,n){var i;return i=JO(e,t,n),Hb(Jl.width,i)}function XO(e){return!!tr(e).length}function ZO(e,t,n){var i=tr(e),o;return o=Xf(i,t,n),e.height-o.height+Uf.height}function JO(e,t,n){var i=tr(e),o;return o=Xf(i,t,n),e.width-o.width+qf.width}function Xf(e,t,n){var i,o,r;for(i=0;i<e.length;i++)if(o=e[i],!n&&t>=o.y&&t<=o.y+o.height||n&&t>=o.x&&t<=o.x+o.width)return r=tr(o),r.length?Xf(r,t,n):o}var Gb="_plane";function Vb(e){var t=e.id;return QO(t)}function ro(e){var t=e.id;return A(e,"bpmn:SubProcess")?Wb(t):t}function Vr(e){return Wb(e)}function eu(e){var t=gt(e);return A(t,"bpmndi:BPMNPlane")}function Wb(e){return e+Gb}function QO(e){return e.replace(new RegExp(Gb+"$"),"")}var Ub=400,eD=600,qb={x:180,y:160};function Ro(e,t,n,i,o,r,a){_e.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return A(p,"bpmn:SubProcess")&&!ft(p)}function l(p){var d=p.shape,f=p.newRootElement,g=Ee(d);f=s._addDiagram(f||g),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=Ee(d);s._removeDiagram(f);var g=p.newRootElement=a.get(ro(f));e.removeRootElement(g)}this.executed("shape.create",function(p){var d=p.shape;c(d)&&l(p)},!0),this.postExecuted("elements.create",function(p){var d=p.elements;V(d,function(f){if(c(f)){var g=a.get(ro(f));if(!(!g||!f.children||!f.children.length)){var h=Yb(f);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var d=p.shape;c(d)&&u(p)},!0),this.preExecute("shape.delete",function(p){var d=p.shape;!A(d,"bpmn:SubProcess")||!ft(d)||V(Ls([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(ro(d));f&&n.removeElements(f.children.slice())}},!0),this.executed("shape.delete",function(p){var d=p.shape;c(d)&&u(p)},!0),this.reverted("shape.delete",function(p){var d=p.shape;c(d)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var d=p.oldShape,f=p.newShape;!c(d)||!c(f)||(p.oldRoot=e.removeRootElement(ro(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,g=e.findRoot(ro(d));if(!(!f||!g)){var h=f.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,g=p.oldProperties,h=g.id,y=f.id;if(h!==y){if(eu(d)){a.updateId(d,Vr(y)),a.updateId(h,y);return}var _=a.get(Vr(h));_&&a.updateId(Vr(h),Vr(y))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,g=p.oldProperties,h=g.id,y=f.id;if(h!==y){if(eu(d)){a.updateId(d,Vr(h)),a.updateId(y,h);return}var _=a.get(Vr(y));_&&a.updateId(_,Vr(h))}}},!0),t.on("element.changed",function(p){var d=p.element;if(eu(d)){var f=d,g=a.get(Vb(f));!g||g===f||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Ub,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(ft(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",Ub,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(ft(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",eD,function(p){var d=p.shape;if(A(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(ft(d))s._moveChildrenToShape(f.children.slice(),d),V(Ls(d.children),h=>{n.moveShape(h.annotation,{x:0,y:0},d.parent),V(h.associations,y=>{n.moveConnection(y,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var g=Yb(d);s._moveChildrenToShape(g,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var g=ro(d),h=a.get(g);h&&f.push.apply(f,h.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,g=p.elements,h=f.parent,y=A(gt(h),"bpmndi:BPMNPlane");if(y){var _=Vb(h),m=Bt(g,function(v){return v.id===_});m&&(d.parent=m.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}Be(Ro,_e),Ro.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 o=un(i),r;if(!t.x)r={x:qb.x-o.x,y:qb.y-o.y};else{var a=et(t),s=et(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},Ro.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set($x(e).map(i=>i.annotation));n.size&&V(Ls(e.children),i=>{n.has(i.annotation)&&V(i.associations,o=>{t.removeConnection(o)})})},Ro.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(o){o.hidden=!!t,i=i.concat(o),o.children&&(i=i.concat(n._showRecursively(o.children,o.collapsed||t)))}),i},Ro.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},Ro.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),o=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=o;var r=n.createRoot({id:ro(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},Ro.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Bt(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ro.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function tD(e){var t=[];return V(Ls(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Yb(e){return e.children.slice().concat(tD(e.children)).concat(nD(e))}function nD(e){return ef(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Zf(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!A(o,"bpmn:SubProcess")||A(o,"bpmn:AdHocSubProcess")||!(A(i,"bpmn:Task")||A(i,"bpmn:CallActivity"))||!ft(o))){var r=iD(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}Zf.$inject=["injector","modeling"],Be(Zf,_e);function iD(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Jf(e,t){_e.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;A(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&&A(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!A(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,si(o)||""),c=a.y!==o.y&&Math.abs(a.y+a.height-(o.y+o.height))<=1,l=o.y+o.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}Be(Jf,_e),Jf.$inject=["eventBus","textRenderer"];function Qf(e,t){_e.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ft(i))return;var o=As(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();V(s,function(l){r(l,!0)}),V(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,et(i)):t.reconnectStart(a,i,et(i)))}},!0)}Be(Qf,_e),Qf.$inject=["eventBus","modeling"];var eh=500;function th(e,t,n){_e.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=oD(c).concat([a]),p=nb(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 r(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"],eh,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?gt(c).isExpanded=!1:(i(c.children),gt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],eh,function(a){var s=a.context,c=s.shape;c.collapsed?gt(c).isExpanded=!1:gt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],eh,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=r(s,c):l=o(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}Be(th,_e),th.$inject=["eventBus","elementFactory","modeling"];function oD(e){return e.filter(function(t){return!t.hidden})}function nh(e,t,n,i){t.invoke(_e,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;at(a)||(A(a,"bpmn:Participant")&&ft(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;A(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Be(nh,_e),nh.$inject=["canvas","injector","moddle","modeling"];function ih(e,t){_e.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;rD(o,r)&&t.updateProperties(r,{default:null})})}Be(ih,_e),ih.$inject=["eventBus","modeling"];function rD(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=Ee(t),i=Ee(e);return n.get("default")===i}var aD=500,sD=5e3,Kb=["shape.create","shape.delete","shape.move","shape.resize"],Xb=[...Kb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function oh(e,t){_e.call(this,e);var n;function i(){return n=n||new cD,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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(Xb,sD,function(){i()}),this.postExecuted(Xb,aD,function(){r()}),this.preExecute(Kb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(A(c,"bpmn:Lane")&&l.addLane(c),A(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}oh.$inject=["eventBus","modeling"],Be(oh,_e);function cD(){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 lD=500,uD=5e3,Zb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Jb=[...Zb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function rh(e,t){_e.call(this,e);var n;function i(){return n=n||new pD,n.enter(),n}function o(){if(!n)throw new Error("out of bounds release");return n}function r(){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(Jb,uD,function(){i()}),this.postExecuted(Jb,lD,function(){r()}),this.preExecute(Zb,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(A(s,"bpmn:FlowElement")&&c.addFlowElement(s),A(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;A(s,"bpmn:Group")&&o().addGroup(s)})}rh.$inject=["eventBus","modeling"],Be(rh,_e);function pD(){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 ah(e,t){_e.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)dD(r)&&!hD(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Be(ah,_e),ah.$inject=["eventBus","modeling"];function dD(e){const t=Ee(e);return t&&t.isForCompensation}function fD(e){return e&&A(e,"bpmn:BoundaryEvent")&&Ra(e,"bpmn:CompensateEventDefinition")}function hD(e){return e.incoming.filter(n=>fD(n.source)).length>0}const gD={__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",hf],appendBehavior:["type",gf],associationBehavior:["type",yf],attachEventBehavior:["type",Il],artifactBehavior:["type",mf],boundaryEventBehavior:["type",vf],categoryRootElementReferenceBehavior:["type",xf],compensateBoundaryEventBehaviour:["type",bf],createBehavior:["type",wf],createDataObjectBehavior:["type",_f],createParticipantBehavior:["type",Rf],dataInputAssociationBehavior:["type",Cf],dataStoreBehavior:["type",Mf],deleteLaneBehavior:["type",Af],detachEventBehavior:["type",Gl],dropOnFlowBehavior:["type",Pf],eventBasedGatewayBehavior:["type",kf],fixHoverBehavior:["type",lb],groupBehavior:["type",Of],importDockingFix:["type",pb],isHorizontalFix:["type",Lf],labelBehavior:["type",Bf],layoutConnectionBehavior:["type",Nf],messageFlowBehavior:["type",jf],nonInterruptingBehavior:["type",Hf],removeElementBehavior:["type",Gf],removeEmbeddedLabelBoundsBehavior:["type",zf],removeParticipantBehavior:["type",Vf],replaceConnectionBehavior:["type",Wf],replaceElementBehaviour:["type",Xl],resizeBehavior:["type",Lb],resizeLaneBehavior:["type",jb],rootElementReferenceBehavior:["type",Kf],spaceToolBehavior:["type",zb],subProcessPlaneBehavior:["type",Ro],subProcessStartEventBehavior:["type",Zf],textAnnotationBehavior:["type",Jf],toggleCollapseConnectionBehaviour:["type",Qf],toggleElementCollapseBehaviour:["type",th],unclaimIdBehavior:["type",nh],unsetDefaultFlowBehavior:["type",ih],updateFlowNodeRefsBehavior:["type",oh],updateCategoryValueRefsBehavior:["type",rh],setCompensationActivityAfterPasteBehavior:["type",ah]};function sh(e){this._commandStack=e.get("commandStack",!1)}sh.$inject=["injector"],sh.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const ao={__init__:["rules"],rules:["type",sh]};function Mi(e){_e.call(this,e),this.init()}Mi.$inject=["eventBus"],Be(Mi,_e),Mi.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(o){i.canExecute(o,t,function(r,a,s){return n(r)},!0)})},Mi.prototype.init=function(){};function Qb(e,t){var n=Ln(e,t,-15);return n!=="intersect"?n:null}function Bn(e){Mi.call(this,e)}Be(Bn,Mi),Bn.$inject=["eventBus"],Bn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return mD(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},o=i.targetParent,r=i.targetAttach;if(r)return!1;o&&(n.parent=o);try{return nu(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return nu(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 dw(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Dt(i)&&!iu(t,i)?!1:Bo(t,function(o){return Dt(o)?nu(o.source,o.target,o):o.host?Ws(o,o.host,null,n):ph(o,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,o=e.hints;return o!=null&&o.keyboardMove&&n.some(function(a){return aw(a)&&!n.includes(a.host)})?!1:Ws(n,t,null,i)||uw(n,t,i)||pw(n,t)||iu(n,t)}),this.addRule("shape.create",function(e){return ph(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ws(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return yw(n,t)})},Bn.prototype.canConnectMessageFlow=gw,Bn.prototype.canConnectSequenceFlow=mw,Bn.prototype.canConnectDataAssociation=dh,Bn.prototype.canConnectAssociation=fw,Bn.prototype.canConnectCompensationAssociation=hw,Bn.prototype.canMove=pw,Bn.prototype.canAttach=Ws,Bn.prototype.canReplace=uw,Bn.prototype.canDrop=Ia,Bn.prototype.canInsert=iu,Bn.prototype.canCreate=ph,Bn.prototype.canConnect=nu,Bn.prototype.canResize=dw,Bn.prototype.canCopy=yw;function mD(e){return ch(e)?null:st(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function ch(e){return!e||at(e)}function ew(e){do{if(A(e,"bpmn:Process"))return Ee(e);if(A(e,"bpmn:Participant"))return Ee(e).processRef||Ee(e)}while(e=e.parent)}function lh(e){return A(e,"bpmn:TextAnnotation")}function uh(e){return A(e,"bpmn:Group")&&!e.labelTarget}function tw(e){return A(e,"bpmn:BoundaryEvent")&&so(e,"bpmn:CompensateEventDefinition")}function tu(e){return Ee(e).isForCompensation}function yD(e,t){var n=ew(e),i=ew(t);return n===i}function vD(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&ow(e,"bpmn:MessageEventDefinition"))}function xD(e){return A(e,"bpmn:InteractionNode")&&!tu(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&ow(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!so(e,"bpmn:MessageEventDefinition"))}function nw(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return Ee(t);if(A(t,"bpmn:Participant"))return Ee(t).processRef}return null}function iw(e,t){var n=nw(e),i=nw(t);return n===i}function so(e,t){var n=Ee(e);return!!Bt(n.eventDefinitions||[],function(i){return A(i,t)})}function ow(e,t){var n=Ee(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function bD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&so(e,"bpmn:LinkEventDefinition"))&&!tw(e)&&!tu(e)}function wD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Wn(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&so(e,"bpmn:LinkEventDefinition"))&&!tu(e)}function _D(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(so(e,"bpmn:MessageEventDefinition")||so(e,"bpmn:TimerEventDefinition")||so(e,"bpmn:ConditionalEventDefinition")||so(e,"bpmn:SignalEventDefinition"))}function ED(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function rw(e,t){var n=ED(t);return n.indexOf(e)!==-1}function nu(e,t,n){if(ch(e)||ch(t))return null;if(!A(n,"bpmn:DataAssociation")){if(gw(e,t))return{type:"bpmn:MessageFlow"};if(mw(e,t))return{type:"bpmn:SequenceFlow"}}var i=dh(e,t);return i||(hw(e,t)?{type:"bpmn:Association",associationDirection:"One"}:fw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ia(e,t){return at(e)||uh(e)?!0:A(t,"bpmn:Participant")&&!ft(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):st(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:A(e,"bpmn:Lane")?A(t,"bpmn:Participant")||A(t,"bpmn:Lane"):A(e,"bpmn:BoundaryEvent")&&!SD(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?ft(t):st(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?No(Ee(t).get("participants"),function(n){return!!n.get("processRef")}):st(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?st(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function SD(e){return Ee(e).cancelActivity&&(sw(e)||cw(e))}function aw(e){return!at(e)&&A(e,"bpmn:BoundaryEvent")}function RD(e){return A(e,"bpmn:Lane")}function CD(e){return aw(e)||A(e,"bpmn:IntermediateThrowEvent")&&sw(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&cw(e)}function sw(e){var t=Ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function cw(e){return lw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function lw(e,t){return t.some(function(n){return so(e,n)})}function MD(e){return A(e,"bpmn:ReceiveTask")&&Bt(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Ws(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return at(o)||!CD(o)||Wn(t)||!A(t,"bpmn:Activity")||tu(t)||i&&!Qb(i,t)||MD(t)?!1:"attach"}function uw(e,t,n){if(!t)return!1;var i={replacements:[]};return V(e,function(o){Wn(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&Ia(o,t)&&(Nk(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),($k(o)||Fk(o)||jk(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),lw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&A(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),A(t,"bpmn:Transaction")||so(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(A(o,"bpmn:EndEvent")&&Ia(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Ws(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function pw(e,t){return No(e,RD)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ia(n,t)})}function ph(e,t,n,i){return t?at(e)||uh(e)?!0:Ia(e,t)||iu(e,t):!1}function dw(e,t,n){return A(e,"bpmn:SubProcess")?ft(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:lh(e)?n?n==="e"||n==="w":!0:uh(e)?!0:at(e)?n?n==="e"||n==="w":!0:!1}function AD(e,t){var n=lh(e),i=lh(t);return(n||i)&&n!==i}function fw(e,t){return rw(t,e)||rw(e,t)?!1:AD(e,t)?!0:!!dh(e,t)}function hw(e,t){return iw(e,t)&&tw(e)&&A(t,"bpmn:Activity")&&!PD(t,e)&&!Wn(t)}function gw(e,t){return xw(e)&&!xw(t)?!1:vD(e)&&xD(t)&&!yD(e,t)}function mw(e,t){return bD(e)&&wD(t)&&iw(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!_D(t))}function dh(e,t){return st(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&st(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:st(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&st(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function iu(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:st(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!at(t)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&Ia(e,t.parent)}function fh(e,t){return e&&t&&e.indexOf(t)!==-1}function yw(e,t){return at(t)?!0:!(A(t,"bpmn:Lane")&&!fh(e,t.parent)||A(t,"bpmn:MessageFlow")&&!TD(e,t))}function TD(e,t){var n=vw(t.source),i=vw(t.target);return fh(e,n)&&fh(e,i)}function vw(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function xw(e){return Aa(e,"bpmn:Process")||Aa(e,"bpmn:Collaboration")}function PD(e,t){return e.attachers.includes(t)}const kD={__depends__:[ao],__init__:["bpmnRules"],bpmnRules:["type",Bn]};var OD=2e3;function bw(e,t){e.on("saveXML.start",OD,n);function n(){var i=t.getRootElements();V(i,function(o){var r=gt(o),a,s;a=As([o]),a=lt(a,function(c){return c!==o&&!c.labelTarget}),s=Hn(a,gt),r.set("planeElement",s)})}}bw.$inject=["eventBus","canvas"];const DD={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",bw]};function ou(e){_e.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);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,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}ou.prototype.getOrdering=function(e,t){return null},Be(ou,_e);function hh(e,t){ou.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=Bt(n,function(c){return st(a,[c.type])});return s&&s.order||{level:1}}function o(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function r(a,s,c){for(var l=s;l&&!st(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||A(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=mm(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<o(p).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}hh.$inject=["eventBus","canvas"],Be(hh,ou);const LD={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",hh]};function Us(){}Us.prototype.get=function(){return this._data},Us.prototype.set=function(e){this._data=e},Us.prototype.clear=function(){var e=this._data;return delete this._data,e},Us.prototype.isEmpty=function(){return!this._data};const ID={clipboard:["type",Us]};var ww=1500;function _w(e,t,n){var i=this,o=n.get("dragging",!1);function r(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),l=c&&e.get(c);c&&l&&(a.stopPropagation(),o.hover({element:l,gfx:c}),o.move(s))}}o&&t.on("drag.start",function(a){t.once("drag.move",ww,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",ww,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=Gr(a),c=document.elementFromPoint(s.x,s.y),BD(c)}}_w.$inject=["elementRegistry","eventBus","injector"];function BD(e){return Nr(e,"svg, .djs-element",!0)}const ND={__init__:["hoverFix"],hoverFix:["type",_w]};function $D(e){return!0}function ru(e){return ir(e)||GO(e)}var Ew=500;function Sw(e,t,n){var i=this;function o(k,T,F){if(!s(k,T)){var z,G,ne;F?G=t.getGraphics(F):(z=T.delegateTarget||T.target,z&&(G=z,F=t.get(G))),!(!G||!F)&&(ne=e.fire(k,{element:F,gfx:G,originalEvent:T}),ne===!1&&(T.stopPropagation(),T.preventDefault()))}}var r={};function a(k){return r[k]}function s(k,T){var F=l[k]||ir;return!F(T)}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":$D,"element.mousedown":ru,"element.mouseup":ru,"element.click":ru,"element.dblclick":ru};function u(k,T,F){var z=c[k];if(!z)throw new Error("unmapped DOM event name <"+k+">");return o(z,T,F)}var p="svg, .djs-element";function d(k,T,F,z){var G=r[F]=function(ne){o(F,ne)};z&&(l[F]=z),G.$delegate=ri.bind(k,p,T,G)}function f(k,T,F){var z=a(F);z&&ri.unbind(k,T,z.$delegate)}function g(k){V(c,function(T,F){d(k,F,T)})}function h(k){V(c,function(T,F){f(k,F,T)})}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 T=k.element,F=k.gfx;e.fire("interactionEvents.createHit",{element:T,gfx:F})}),e.on(["shape.changed","connection.changed"],Ew,function(k){var T=k.element,F=k.gfx;e.fire("interactionEvents.updateHit",{element:T,gfx:F})}),e.on("interactionEvents.createHit",Ew,function(k){var T=k.element,F=k.gfx;i.createDefaultHit(T,F)}),e.on("interactionEvents.updateHit",function(k){var T=k.element,F=k.gfx;i.updateDefaultHit(T,F)});var y=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),m=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:m,"click-stroke":_,stroke:y,"no-move":v};function E(k,T){return T=Y({stroke:"white",strokeWidth:15},T||{}),n.cls(k,["no-fill","no-border"],T)}function C(k,T){var F=b[T];if(!F)throw new Error("invalid hit type <"+T+">");return Le(k,F),k}function I(k,T){nt(k,T)}this.removeHits=function(k){var T=Es(".djs-hit",k);V(T,ln)},this.createDefaultHit=function(k,T){var F=k.waypoints,z=k.isFrame,G;return F?this.createWaypointsHit(T,F):(G=z?"stroke":"all",this.createBoxHit(T,G,{width:k.width,height:k.height}))},this.createWaypointsHit=function(k,T){var F=Ms(T);return C(F,"stroke"),I(k,F),F},this.createBoxHit=function(k,T,F){F=Y({x:0,y:0},F);var z=He("rect");return C(z,T),Le(z,F),I(k,z),z},this.updateDefaultHit=function(k,T){var F=Rt(".djs-hit",T);if(F)return k.waypoints?Qd(F,k.waypoints):Le(F,{width:k.width,height:k.height}),F},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}Sw.$inject=["eventBus","elementRegistry","styles"];const au={__init__:["interactionEvents"],interactionEvents:["type",Sw]};function Ba(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var o=i.element;n.deselect(o)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Ba.$inject=["eventBus","canvas"],Ba.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()})}},Ba.prototype.get=function(){return Array.from(this._selectedElements)},Ba.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ba.prototype.select=function(e,t){var n=this.get();Je(e)||(e=e?[e]:[]);var i=this._canvas,o=i.getRootElement();e=e.filter(function(r){var a=i.findRoot(r);return o===a}),t?V(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Rw="hover",Cw="selected";function Mw(e,t){this._canvas=e;function n(o,r){e.addMarker(o,r)}function i(o,r){e.removeMarker(o,r)}t.on("element.hover",function(o){n(o.element,Rw)}),t.on("element.out",function(o){i(o.element,Rw)}),t.on("selection.changed",function(o){function r(l){i(l,Cw)}function a(l){n(l,Cw)}var s=new Set(o.oldSelection),c=new Set(o.newSelection);for(let l of s)c.has(l)||r(l);for(let l of c)s.has(l)||a(l)})}Mw.$inject=["canvas","eventBus"];function Aw(e,t,n,i){e.on("create.end",500,function(o){var r=o.context,a=r.canExecute,s=r.elements,c=r.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Je(l)?t.select(l):t.select(s.filter(FD))}}),e.on("connect.end",500,function(o){var r=o.context,a=r.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(o){var r=o.previousSelection||[],a=i.get(o.context.shape.id),s=Bt(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(ir(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Ql(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Aw.$inject=["eventBus","selection","canvas","elementRegistry"];function FD(e){return!e.hidden}const Ai={__init__:["selectionVisuals","selectionBehavior"],__depends__:[au],selection:["type",Ba],selectionVisuals:["type",Mw],selectionBehavior:["type",Aw]};var jD=/^djs-cursor-.*$/;function su(e){var t=Mt(document.body);t.removeMatching(jD),e&&t.add("djs-cursor-"+e)}function Tw(){su(null)}var HD=5e3;function Pw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,HD,n),function(){e.off(t,n)}}var zD=["c","C"],GD=["v","V"],VD=["d","D"],WD=["x","X"],UD=["y","Y"],kw=["z","Z"];function qD(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function li(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function bn(e,t){return e=Je(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function gh(e){return e.shiftKey}function YD(e){return li(e)&&bn(zD,e)}function KD(e){return li(e)&&bn(GD,e)}function XD(e){return li(e)&&bn(VD,e)}function ZD(e){return li(e)&&bn(WD,e)}function JD(e){return li(e)&&!gh(e)&&bn(kw,e)}function QD(e){return li(e)&&(bn(UD,e)||bn(kw,e)&&gh(e))}var Na=Math.round,Ow="djs-drag-active";function Wr(e){e.preventDefault()}function eL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function tL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Dw(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(v.x-E.left)/b.scale,y:b.y+(v.y-E.top)/b.scale}}function s(v,b){b=b||r;var E=e.createEvent(Y({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(b.prefix+"."+v,E)}function c(v){var b=v.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(v,b){var E=r.payload,C=r.displacement,I=r.globalStart,k=Gr(v),T=Gi(k,I),F=r.localStart,z=a(k),G=Gi(z,F);if(!r.active&&(b||tL(T)>r.threshold)){if(Y(E,{x:Na(F.x+C.x),y:Na(F.y+C.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&su(r.cursor),t.addMarker(t.getRootElement(),Ow)}Yf(v),r.active&&(Y(E,{x:Na(z.x+C.x),y:Na(z.y+C.y),dx:Na(G.x),dy:Na(G.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Yf(v)),E=s("end")),E===!1&&s("rejected"),b=_(E!==!0),s("ended",b)}function p(v){bn("Escape",v)&&(Wr(v),y())}function d(v){var b;r.active&&(b=Pw(e),setTimeout(b,400),Wr(v)),u(v)}function f(v){l(v)}function g(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function h(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function y(v){var b;if(r){var E=r.active;E&&s("cancel"),b=_(v),E&&s("canceled",b)}}function _(v){var b,E;s("cleanup"),Tw(),r.trapClick?E=d:E=u,Ue.unbind(document,"mousemove",l),Ue.unbind(document,"dragstart",Wr),Ue.unbind(document,"selectstart",Wr),Ue.unbind(document,"mousedown",E,!0),Ue.unbind(document,"mouseup",E,!0),Ue.unbind(document,"keyup",p),Ue.unbind(document,"touchstart",f,!0),Ue.unbind(document,"touchcancel",y,!0),Ue.unbind(document,"touchmove",l,!0),Ue.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),Ow);var C=r.payload.previousSelection;return v!==!1&&C&&!n.get().length&&c(C),b=r,r=null,b}function m(v,b,E,C){r&&y(!1),typeof b=="string"&&(C=E,E=b,b=null),C=Y({},o,C||{});var I=C.data||{},k,T,F,z,G;if(C.trapClick?z=d:z=u,v?(k=La(v)||v,T=Gr(v),Yf(v),k.type==="dragstart"&&Wr(k)):(k=null,T={x:0,y:0}),F=a(T),b||(b=F),G=eL(k),r=Y({prefix:E,data:I,payload:{},globalStart:T,displacement:Gi(b,F),localStart:F,isTouch:G},C),C.manual||(G?(Ue.bind(document,"touchstart",f,!0),Ue.bind(document,"touchcancel",y,!0),Ue.bind(document,"touchmove",l,!0),Ue.bind(document,"touchend",u,!0)):(Ue.bind(document,"mousemove",l),Ue.bind(document,"dragstart",Wr),Ue.bind(document,"selectstart",Wr),Ue.bind(document,"mousedown",z,!0),Ue.bind(document,"mouseup",z,!0)),Ue.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;C.autoActivate&&l(v,!0)}e.on("diagram.destroy",y),this.init=m,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){Y(o,v)}}Dw.$inject=["eventBus","canvas","selection","elementRegistry"];const Co={__depends__:[ND,Ai],dragging:["type",Dw]};function Ur(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ur.prototype.next=function(){return this._prefix+ ++this._counter};const nL=new Ur("ps");var iL=["marker-start","marker-mid","marker-end"],oL=["circle","ellipse","line","path","polygon","polyline","path","rect"];function or(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}or.$inject=["elementRegistry","eventBus","canvas","styles"],or.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},or.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},or.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Wd(n);return this._cloneMarkers(Zo(o),i),Le(o,this._styles.cls(i,[])),nt(t,o),Le(o,"data-preview-support-element-id",e.id),o},or.prototype.addFrame=function(e,t){var n=He("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return nt(t,n),Le(n,"data-preview-support-element-id",e.id),n},or.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),cL(e)&&iL.forEach(function(o){if(Le(e,o)){var r=rL(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},or.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,nL.next()].join("-"),a=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Wd(n);s.id=r,dt(s).add(o);var c=Rt(":scope > defs",e);c||(c=He("defs"),nt(e,c)),nt(c,s);var l=sL(s.id);Le(t,i,l)};function rL(e,t,n){var i=aL(Le(e,t));return Rt("marker#"+i,n||document)}function aL(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function sL(e){return"url(#"+e+")"}function cL(e){return oL.indexOf(e.nodeName)!==-1}const $a={__init__:["previewSupport"],previewSupport:["type",or]};var lL="drop-ok",Lw="drop-not-ok",Iw="attach-ok",Bw="new-parent",Nw="create",uL=2e3;function $w(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=lt(c,function(m){var v=m.labelTarget;return!m.parent&&!(at(m)&&c.indexOf(v)!==-1)});var f=Bt(c,function(m){return!Dt(m)}),g=!1,h=!1,y=!1;jw(c)&&(g=o.allowed("shape.attach",{position:u,shape:f,target:l})),g||(jw(c)?y=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=d.connectionTarget;return y||g?(f&&p&&(h=o.allowed("connection.create",{source:_===p?f:p,target:_===p?p:f,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[Iw,lL,Lw,Bw].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,d=l.source,f=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Fw(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,g,d,f);p&&h!==null&&(l.target=p,h&&h.attach?a(p,Iw):a(p,h?Bw:Lw))}),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,d=l.elements,f=l.target,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,_=l.hints||{};if(g===!1||!f)return!1;Fw(c);var m={x:c.x,y:c.y};y?p=i.appendShape(u,p,m,f,{attach:h,connection:y===!0?{}:y,connectionTarget:_.connectionTarget}):(d=i.createElements(d,m,f,Y({},_,{attach:h})),p=Bt(d,function(v){return!Dt(v)})),Y(l,{elements:d,shape:p}),Y(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===Nw&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],uL,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Je(l)||(l=[l]);var p=Bt(l,function(g){return!Dt(g)});if(p){u=Y({elements:l,hints:{},shape:p},u||{}),V(l,function(g){Qe(g.x)||(g.x=0),Qe(g.y)||(g.y=0)});var d=lt(l,function(g){return!g.hidden}),f=un(d);V(l,function(g){Dt(g)&&(g.waypoints=Hn(g.waypoints,function(h){return{x:h.x-f.x-f.width/2,y:h.y-f.y-f.height/2}})),Y(g,{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2})}),t.init(c,Nw,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}$w.$inject=["canvas","dragging","eventBus","modeling","rules"];function Fw(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 jw(e){return e&&e.length===1&&!Dt(e[0])}var pL=750;function Hw(e,t,n,i,o){function r(a){var s=He("g");Le(s,o.cls("djs-drag-group",["no-events"]));var c=He("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Zo(u),l)):(u=n._createContainer("shape",c),n.drawShape(Zo(u),l),In(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",pL,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=r(l));var p;s?(u.parentNode||(p=e.getActiveLayer(),nt(p,u)),In(u,a.x,a.y)):ln(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&ln(c)})}Hw.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const cu={__depends__:[Co,$a,ao,Ai],__init__:["create","createPreview"],create:["type",$w],createPreview:["type",Hw]};function mh(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var o=t._svg=i.svg;o.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}mh.$inject=["eventBus"],mh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||dL(0,0)};function dL(e,t){var n=document.createEvent("MouseEvent"),i=e,o=t,r=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,o,r,a,!1,!1,!1,!1,0,null),n}const qs={__init__:["mouse"],mouse:["type",mh]};var zw=2e3;function ui(e,t,n,i,o,r,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=o,this._modeling=r,this._mouse=a,this._rules=s,o.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),fL(u)&&(l.priority=2,l.host=u.host.id),Dt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=hL(u)),at(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),V(["x","y","width","height"],function(d){Qe(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",zw,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",zw,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;Y(l,{createElementsBehavior:!1})})}ui.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ui.prototype.copy=function(e,t={}){var n,i;return Je(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Je(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ui.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 o=t.hints,r=this._createElements(i);if(t.element&&t.point)return this._paste(r,t.element,t.point,o);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:o})}}},ui.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ui.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(o){return n[o.id]});return i.length>0&&this._modeling.removeElements(i),t},ui.prototype._getElementIdsFromTree=function(e){var t={};return V(e,function(n){V(n,function(i){i.id&&(t[i.id]=!0)})}),t},ui.prototype._paste=function(e,t,n,i){V(e,function(r){Qe(r.x)||(r.x=0),Qe(r.y)||(r.y=0)});var o=un(e);return V(e,function(r){Dt(r)&&(r.waypoints=Hn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),Y(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,Y({},i))},ui.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return V(e,function(r,a){r=Yi(r,"priority"),V(r,function(s){var c=Y({},Ki(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Dt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(at(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),o.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),o.push(l)})}),o},ui.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ki(e,["id"]));return t},ui.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ki(e,["id"]));return t},ui.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ki(e,["id"]));return t},ui.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Dt(e)&&(!n.has(e.source)||!n.has(e.target))||at(e)&&!n.has(e.labelTarget))},ui.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=bl(e);function s(p,d){return t.allowed("element.copy",{element:p,elements:d})}function c(p,d){var f=r.get(p);if(!f){var g={element:p,depth:d};o.push(g),r.set(p,g);return}if(f.depth<d){o=l(f,o);var h={element:f.element,depth:d};o.push(h),r.set(p,h)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}Fr(a,function(p,d,f){if(at(p))return;V(p.labels,function(y){c(y,f)});function g(y){y&&y.length&&V(y,function(_){V(_.labels,function(m){c(m,f)}),c(_,f)})}V([p.attachers,p.incoming,p.outgoing],g),c(p,f);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Hn(o,function(p){return p.element});var u=new Set(e);return o=Hn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Yi(o,function(p){return p.descriptor.priority}),e=Hn(o,function(p){return p.element}),V(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){Vw(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Vw(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function fL(e){return!!e.host}function hL(e){return Hn(e.waypoints,function(t){return t=Gw(t),t.original&&(t.original=Gw(t.original)),t})}function Gw(e){return Y({},e)}function Vw(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const gL={__depends__:[ID,cu,qs,ao],__init__:["copyPaste"],copyPaste:["type",ui]};function yh(e,t,n){Je(n)||(n=[n]),V(n,function(i){Ar(e[i])||(t[i]=e[i])})}var vh=750;function Ww(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",vh,function(c){var l=c.descriptor,u=c.element,p=Ee(u);if(at(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(gt(u),!0);f.bpmnElement=d,yh(d,l,"name"),yh(f,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=Ee(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(Ee(c).attachedToRef=Ee(l[c.host])),Ki(u,oi(u,function(d,f,g){var h=f.element,y=f.property;return g===c.id&&(h.set(y,p),d.push(c.id)),d},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,d=u.di;if(at(u)){u.businessObject=Ee(l[u.labelTarget]),u.di=gt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,yh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",vh,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=Ee(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;A(l,"bpmn:SubProcess")&&V(Ls(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",vh,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Ww.$inject=["bpmnFactory","eventBus","moddleCopy"];const mL=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],yL=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ys(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:o}=i;if(!(!o||!o.length))return Yi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=vn(o)&&o.$descriptor;if(a&&yL.includes(a))return r;if(a&&mL.includes(a)||a&&s&&!Bt(s.properties,da({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(A(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Ys.$inject=["eventBus","bpmnFactory","moddle"],Ys.prototype.copyElement=function(e,t,n,i=!1){n&&!Je(n)&&(n=[n]),n=n||xh(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Je(o)&&(n=o),V(n,r=>{let a;ii(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!yn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Ys.prototype.copyProperty=function(e,t,n,i=!1){let o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(o===!1)return;if(o)return vn(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;const r=this._moddle.getPropertyDescriptor(t,n);if(!r.isReference)return r.isId?e&&this._copyId(e,t,i):Je(e)?oi(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):vn(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(o=this._bpmnFactory.create(e.$type),o.$parent=t,o=this.copyElement(e,o,null,i),o):e},Ys.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 xh(e,t){return oi(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Uw={__depends__:[gL],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ww],moddleCopy:["type",Ys]};var qw=Math.round;function bh(e,t){this._modeling=e,this._eventBus=t}bh.$inject=["modeling","eventBus"],bh.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,o=this._eventBus;o.fire("replace.start",{element:e,attrs:t,hints:n});var r=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,l=qw(s+r/2),u=qw(c+a/2),p=i.replaceShape(e,Y({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Yw(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Yw.$inject=["selection","eventBus"];const vL={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Yw],replace:["type",bh]};function xL(e,t,n){Je(n)||(n=[n]),V(n,function(i){Ar(e[i])||(t[i]=e[i])})}var bL=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function wL(e,t){var n=e&&ii(e,"collapsed")?e.collapsed:!ft(e),i;return t&&(ii(t,"collapsed")||ii(t,"isExpanded"))?i=ii(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Kw(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(lu(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&wL(s,c))return i.toggleCollapse(s),s;var d=e.create(u),f={type:u,businessObject:d};f.di={},u==="bpmn:ExclusiveGateway"&&(f.di.isMarkerVisible=!0),xL(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var g=xh(p.$descriptor),h=xh(d.$descriptor,!0),y=_L(g,h);Y(d,$i(c,bL));var _=lt(y,function(b){return b==="eventDefinitions"?Xw(s,c.eventDefinitionType):b==="loopCharacteristics"?!Wn(d):ii(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Wn(d):!0});if(d=n.copyElement(p,d,_),c.eventDefinitionType&&(Xw(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(lu(p))f.isExpanded=ft(s);else if(c&&ii(c,"isExpanded")){f.isExpanded=c.isExpanded;var m=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=m.width,f.height=m.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}ft(s)&&!A(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(lu(p)&&!lu(d)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=Sn(s);gt(s).isHorizontal||(gt(f).isHorizontal=v),f.width=v?s.width:t.getDefaultSize(f).width,f.height=v?t.getDefaultSize(f).height:s.height}return r.allowed("shape.resize",{shape:d})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),d.name=p.name,st(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&st(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!A(p,"bpmn:BoundaryEvent")&&A(d,"bpmn:BoundaryEvent")&&(f.host=c.host),(f.type==="bpmn:DataStoreReference"||f.type==="bpmn:DataObjectReference")&&(f.x=s.x+(s.width-f.width)/2),o.replaceElement(s,f,{...l,targetElement:c})}this.replaceElement=a}Kw.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lu(e){return A(e,"bpmn:SubProcess")}function Xw(e,t){var n=Ee(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function _L(e,t){return e.filter(function(n){return t.includes(n)})}const Zw={__depends__:[Uw,vL,Ai],bpmnReplace:["type",Kw]};var EL=250;function qr(e){this._eventBus=e,this._tools=[],this._active=null}qr.$inject=["eventBus"],qr.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)},qr.prototype.isActive=function(e){return e&&this._active===e},qr.prototype.length=function(e){return this._tools.length},qr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},qr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),V(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,EL,function(o){this._active&&(SL(o)||this.setActive(null))},this)};function SL(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Nr(t,'.group[data-group="tools"]')}const uu={__depends__:[Co],__init__:["toolManager"],toolManager:["type",qr]};function RL(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 CL(e,t){var n=[],i=new Set(e);V(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;V(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(o.has(c)||(o.add(c),n.push(c)))})}),n}function ML(e,t,n){var i=e.x,o=e.y,r=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:o+c,width:r,height:a-c};case"s":return{x:i,y:o,width:r,height:a+c};case"w":return{x:i+s,y:o,width:r-s,height:a};case"e":return{x:i,y:o,width:r+s,height:a};default:throw new Error("unknown direction: "+t)}}var wh=Math.abs,AL=Math.round,Mo={x:"width",y:"height"},Jw="crosshair",rr={n:"top",w:"left",s:"bottom",e:"right"},TL=1500,pu={n:"s",w:"e",s:"n",e:"w"},du=20;function Ti(e,t,n,i,o,r,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=o,this._toolManager=r,this._mouse=a;var s=this;r.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",TL,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&e_(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,g=l.start;if(l.initialized){e_(c);var h={x:0,y:0};h[u]=AL(c["d"+u]),s.makeSpace(d,f,h,p,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}Ti.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ti.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Jw,data:{context:{reactivate:n}},trapClick:!1})},Ti.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Jw,data:{context:{}}})},Ti.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ti.prototype.init=function(e,t){var n=wh(e.dx)>wh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(wh(i)<5)return!1;i<0&&(i*=-1),Vs(e)&&(i*=-1);var r=RL(n,i),a=this._canvas.getRootElement();!Ql(e)&&e.hover&&(a=e.hover);var s=[...As(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,o),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:r,shapes:c.resizingShapes,start:o}),u=PL(c,n,r,o,l);return Y(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),su("resize-"+(n==="x"?"ew":"ns")),!0},Ti.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(f){s.has(f)||(s.add(f),r.push(f));var g=f.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function d(f){c.has(f)||(c.add(f),a.push(f))}return V(e,function(f){if(!(!f.parent||at(f))){if(Dt(f)){u.push(f);return}var g=f[t],h=g+f[Mo[t]];if(kL(f)&&(n>0&&et(f)[t]>i||n<0&&et(f)[t]<i)){l.push(f);return}if(n>0&&g>i||n<0&&h<i){p(f);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),V(r,function(f){var g=f.attachers;g&&V(g,function(h){p(h)})}),V(l,function(f){var g=f.host;(s.has(g)||c.has(g))&&p(f)}),V(u,function(f){var g=f.source,h=f.target,y=f.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},Ti.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ti.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Qw(e){return{top:e.top-du,right:e.right+du,bottom:e.bottom+du,left:e.left-du}}function e_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Qe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Qe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Qe(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Qe(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function PL(e,t,n,i,o){var r=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(r),p=new Set(a);return V(a,function(d){var f=d.attachers,g=d.children,h=Ye(d),y=lt(g,function(G){return!Dt(G)&&!at(G)&&!u.has(G)&&!p.has(G)}),_=lt(g,function(G){return!Dt(G)&&!at(G)&&u.has(G)}),m,v,b,E=[],C=[],I,k,T,F;y.length&&(v=Qw(Ye(un(y))),m=i-h[rr[n]]+v[rr[n]],n==="n"?s.bottom=l=Qe(l)?Math.min(l,m):m:n==="w"?s.right=l=Qe(l)?Math.min(l,m):m:n==="s"?s.top=c=Qe(c)?Math.max(c,m):m:n==="e"&&(s.left=c=Qe(c)?Math.max(c,m):m)),_.length&&(b=Qw(Ye(un(_))),m=i-b[rr[pu[n]]]+h[rr[pu[n]]],n==="n"?s.bottom=l=Qe(l)?Math.min(l,m):m:n==="w"?s.right=l=Qe(l)?Math.min(l,m):m:n==="s"?s.top=c=Qe(c)?Math.max(c,m):m:n==="e"&&(s.left=c=Qe(c)?Math.max(c,m):m)),f&&f.length&&(f.forEach(function(G){u.has(G)?E.push(G):C.push(G)}),E.length&&(I=Ye(un(E.map(et))),k=h[rr[pu[n]]]-(I[rr[pu[n]]]-i)),C.length&&(T=Ye(un(C.map(et))),F=T[rr[n]]-(h[rr[n]]-i)),n==="n"?(m=Math.min(k||1/0,F||1/0),s.bottom=l=Qe(l)?Math.min(l,m):m):n==="w"?(m=Math.min(k||1/0,F||1/0),s.right=l=Qe(l)?Math.min(l,m):m):n==="s"?(m=Math.max(k||-1/0,F||-1/0),s.top=c=Qe(c)?Math.max(c,m):m):n==="e"&&(m=Math.max(k||-1/0,F||-1/0),s.left=c=Qe(c)?Math.max(c,m):m));var z=o&&o[d.id];z&&(n==="n"?(m=i+d[Mo[t]]-z[Mo[t]],s.bottom=l=Qe(l)?Math.min(l,m):m):n==="w"?(m=i+d[Mo[t]]-z[Mo[t]],s.right=l=Qe(l)?Math.min(l,m):m):n==="s"?(m=i-d[Mo[t]]+z[Mo[t]],s.top=c=Qe(c)?Math.max(c,m):m):n==="e"&&(m=i-d[Mo[t]]+z[Mo[t]],s.left=c=Qe(c)?Math.max(c,m):m))}),s}}function kL(e){return!!e.host}var _h="djs-dragging",t_="djs-resizing",OL=250,fu=Math.max;function n_(e,t,n,i,o){function r(a,s){V(a,function(c){o.addDragger(c,s),n.addMarker(c,_h)})}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=He("g");Le(u,i.cls("djs-crosshair-group",["no-events"])),nt(s,u);var p=He("path");Le(p,"d",l.x),dt(p).add("djs-crosshair"),nt(u,p);var d=He("path");Le(d,"d",l.y),dt(d).add("djs-crosshair"),nt(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;In(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&ln(c)}),e.on("spaceTool.move",OL,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 d=n.getLayer("space");c=He("path"),Le(c,"d","M0,0 L0,0"),dt(c).add("djs-crosshair"),nt(d,c),s.line=c;var f=He("g");Le(f,i.cls("djs-drag-group",["no-events"])),nt(n.getActiveLayer(),f),r(u,f);var g=new Set(u);V(p,function(C){g.add(C)});var h=new Set,y=s.movingConnections=[];g.forEach(function(C){V(C.outgoing,function(I){h.has(I)||!Dt(I)||!g.has(I.target)||(h.add(I),y.push(I))})}),r(y,f),s.dragGroup=f}if(!s.frameGroup){var _=He("g");Le(_,i.cls("djs-frame-group",["no-events"])),nt(n.getActiveLayer(),_);var m=[];V(p,function(C){var I=o.addFrame(C,_),k=I.getBBox();m.push({element:I,initialBounds:k}),n.addMarker(C,t_)}),s.frameGroup=_,s.frames=m}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Le(c,{d:v[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,In(s.dragGroup,E.x,E.y),V(s.frames,function(C){var I=C.element,k=C.initialBounds,T,F;s.direction==="e"?Le(I,{width:fu(k.width+E.x,5)}):(T=fu(k.width-E.x,5),Le(I,{width:T,x:k.x+k.width-T})),s.direction==="s"?Le(I,{height:fu(k.height+E.y,5)}):(F=fu(k.height-E.y,5),Le(I,{height:F,y:k.y+k.height-F}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,d=s.dragGroup,f=s.frameGroup;V(c,function(g){n.removeMarker(g,_h)}),V(l,function(g){n.removeMarker(g,_h)}),d&&(ln(p),ln(d)),V(u,function(g){n.removeMarker(g,t_)}),f&&ln(f)})}n_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const DL={__init__:["spaceToolPreview"],__depends__:[Co,ao,uu,$a,qs],spaceTool:["type",Ti],spaceToolPreview:["type",n_]};function hu(e,t){e.invoke(Ti,this),this._canvas=t}hu.$inject=["injector","canvas"],Be(hu,Ti),hu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=ua(_a(o.children.filter(l=>A(l,"bpmn:Artifact")),un(r))));const s=[...e,...a];var c=Ti.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||LL(l)&&(t==="y"&&Sn(l)||t==="x"&&!Sn(l)))}),c};function LL(e){return A(e,"bpmn:Participant")&&!Ee(e).processRef}const i_={__depends__:[DL],spaceTool:["type",hu]};function Wt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Wt.$inject=["eventBus","injector"],Wt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Wt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Wt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Wt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Wt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Wt.prototype.register=function(e,t){this._setHandler(e,t)},Wt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Wt.prototype.canUndo=function(){return!!this._getUndoAction()},Wt.prototype.canRedo=function(){return!!this._getRedoAction()},Wt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Wt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Wt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Wt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Wt.prototype._createId=function(){return this._uid++},Wt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Wt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,o=this._getHandler(n);if(!o)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),o.preExecute&&o.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),o.execute&&this._markDirty(o.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),o.postExecute&&o.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Wt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Wt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:ym("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Wt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Je(e)?e:[e],t.dirty=t.dirty.concat(e))},Wt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Wt.prototype._revertedAction=function(e){this._stackIdx--},Wt.prototype._getHandler=function(e){return this._handlerMap[e]},Wt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const IL={commandStack:["type",Wt]};function ar(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 BL=250,o_=1400;function Eh(e,t,n){_e.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",o_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=r_(a),r.validatedShapes=r_(s)}),i&&t.on("shape.move.start",BL,function(o){var r=o.context,a=new Set(r.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(r,c,!0)}),this.preExecuted("elements.move",o_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];V(s,function(l){V(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;ar(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.labelTarget;s&&(r.labelTargetIndex=tf(s.labels,a),r.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(o){var r=o.context,a=r.shape,s=r.labelTarget,c=r.labelTargetIndex;s&&(rn(s.labels,a,c),a.labelTarget=s)})}Be(Eh,_e),Eh.$inject=["injector","eventBus","modeling"];function r_(e){var t=new Set(e);return lt(e,function(n){return!t.has(n.labelTarget)})}const NL={__init__:["labelSupport"],labelSupport:["type",Eh]};var $L=251,a_=1401,s_="attach-ok";function Sh(e,t,n,i,o){_e.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",a_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=FL(c),s.validatedShapes=jL(l)}),r&&t.on("shape.move.start",$L,function(a){var s=a.context,c=s.shapes,l=Rh(c);V(l,function(u){r.makeDraggable(s,u,!0),V(u.labels,function(p){r.makeDraggable(s,p,!0)})})}),r&&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,s_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,s_)}))}}),this.preExecuted("elements.move",a_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Rh(l);V(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=lt(c,function(p){var d=p.host;return HL(p)&&!zL(c,d)}),V(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;V(s,function(c){V(c.attachers,function(l){V(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),V(l.incoming.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&o.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;ar(c.attachers,function(u){var p=i.allowed("elements.move",{target:l,shapes:[u]});p==="attach"?o.updateAttachment(u,l):o.removeShape(u)}),l.attachers.length&&V(l.attachers,function(u){var p=Rb(u,c,l);o.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,d=s.hints||{};d.attachSupport!==!1&&V(p,function(f){var g=Rb(f,l,u);o.moveShape(f,g,f.parent),V(f.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;ar(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Be(Sh,_e),Sh.$inject=["injector","eventBus","canvas","rules","modeling"];function Rh(e){return Fp(Hn(e,function(t){return t.attachers||[]}))}function FL(e){var t=Rh(e);return RR("id",e,t)}function jL(e){var t=pa(e,"id");return lt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function HL(e){return!!e.host}function zL(e,t){return e.indexOf(t)!==-1}const GL={__depends__:[ao],__init__:["attachSupport"],attachSupport:["type",Sh]};function c_(e,t,n,i){e.on("element.changed",function(o){var r=o.element;(r.parent||r===t.getRootElement())&&(o.gfx=n.getGraphics(r)),o.gfx&&e.fire(Jv(r)+".changed",o)}),e.on("elements.changed",function(o){var r=o.elements;r.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(r)}),e.on("shape.changed",function(o){i.update("shape",o.element,o.gfx)}),e.on("connection.changed",function(o){i.update("connection",o.element,o.gfx)})}c_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Ch={__init__:["changeSupport"],changeSupport:["type",c_]};function Pi(e){this._model=e}Pi.$inject=["moddle"],Pi.prototype._needsId=function(e){return st(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"])},Pi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;A(e,"bpmn:Activity")?t="Activity":A(e,"bpmn:Event")?t="Event":A(e,"bpmn:Gateway")?t="Gateway":st(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))},Pi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Pi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Pi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",Y({bpmnElement:e,bounds:this.createDiBounds()},t))},Pi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Pi.prototype.createDiWaypoints=function(e){var t=this;return Hn(e,function(n){return t.createDiWaypoint(n)})},Pi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",$i(e,["x","y"]))},Pi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",Y({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Pi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",Y({bpmnElement:e},t))};function pi(e,t,n){_e.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var g=f.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"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var g=f.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(f){var g=f.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"],di(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],di(a));function s(f){var g=f.context,h=g.oldRoot,y=h.children;V(y,function(_){A(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var g=f.context.shape;A(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],di(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],di(function(f){f.context.shape.type!=="label"&&c(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&c({context:{shape:f.element}})});function l(f){i.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],di(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],di(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],di(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],di(u)),this.executed("connection.reconnect",di(function(f){var g=f.context,h=g.connection,y=g.oldSource,_=g.newSource,m=Ee(h),v=Ee(y),b=Ee(_);m.conditionExpression&&!st(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=m.conditionExpression,delete m.conditionExpression),y!==_&&v.default===m&&(g.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",di(function(f){var g=f.context,h=g.connection,y=g.oldSource,_=g.newSource,m=Ee(h),v=Ee(y),b=Ee(_);g.oldConditionExpression&&(m.conditionExpression=g.oldConditionExpression),g.oldDefault&&(v.default=g.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],di(p)),this.reverted(["element.updateAttachment"],di(p)),this.executed("element.updateLabel",di(d)),this.reverted("element.updateLabel",di(d));function d(f){const{element:g}=f.context,h=si(g),y=gt(g),_=y&&y.get("label");Qo(g)||eu(g)||(h&&!_?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&y.set("label",void 0))}}Be(pi,_e),pi.$inject=["eventBus","bpmnFactory","connectionDocking"],pi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},pi.prototype.updateParent=function(e,t){if(!at(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=gt(e),r=n&&n.businessObject,a=gt(n);A(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),A(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),A(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),A(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},pi.prototype.updateBounds=function(e){var t=gt(e),n=WL(e);if(n){var i=Gi(n,t.get("bounds"));Y(n,{x:e.x+i.x,y:e.y+i.y})}var o=at(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),Y(r,{x:e.x,y:e.y,width:e.width,height:e.height})},pi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),en(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),rn(o,e))}},pi.prototype.updateDiConnection=function(e,t,n){var i=gt(e),o=gt(t),r=gt(n);i.sourceElement&&i.sourceElement.bpmnElement!==Ee(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==Ee(n)&&(i.targetElement=n&&r)},pi.prototype.updateDiParent=function(e,t){if(t&&!A(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(en(n,e),e.$parent=null)}};function VL(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}pi.prototype.getLaneSet=function(e){var t,n;return A(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(A(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)},pi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))&&(A(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(A(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(A(e,"bpmn:FlowElement")){if(t){if(A(t,"bpmn:Participant"))t=t.processRef;else if(A(t,"bpmn:Lane"))do t=t.$parent.$parent;while(A(t,"bpmn:Lane"))}i="flowElements"}else if(A(e,"bpmn:Artifact")){for(;t&&!A(t,"bpmn:Process")&&!A(t,"bpmn:SubProcess")&&!A(t,"bpmn:Collaboration");)if(A(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(A(e,"bpmn:MessageFlow"))i="messageFlows";else if(A(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=VL(e.$parent||t),e.$parent&&(en(r.get("rootElements"),o),o.$parent=null),t&&(rn(r.get("rootElements"),o),o.$parent=r))}else A(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":A(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),en(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);en(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},pi.prototype.updateConnectionWaypoints=function(e){var t=gt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},pi.prototype.updateConnection=function(e){var t=e.connection,n=Ee(t),i=t.source,o=Ee(i),r=t.target,a=Ee(t.target),s;if(A(n,"bpmn:DataAssociation"))A(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):A(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=A(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(en(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(en(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,r)},pi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function di(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;A(i,"bpmn:BaseElement")&&e(t)}}function WL(e){if(A(e,"bpmn:Activity")){var t=gt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function sr(e,t){_o.call(this),this._bpmnFactory=e,this._moddle=t}Be(sr,_o),sr.$inject=["bpmnFactory","moddle"],sr.prototype._baseCreate=_o.prototype.create,sr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,Y({type:"label",di:n},Hr,t))}return this.createElement(e,t)},sr.prototype.createElement=function(e,t){t=Y({},t||{});var n,i=t.businessObject,o=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!qL(o)){var r=Y({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}A(i,"bpmn:Group")&&(t=Y({isFrame:!0},t)),t=UL(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Mh(o,t,"isExpanded")),st(i,["bpmn:Lane","bpmn:Participant"])&&(t=Mh(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!ft(i,o)),A(i,"bpmn:ExclusiveGateway")&&(ii(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),yn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),yn(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,o),t=Y({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},sr.prototype.getDefaultSize=function(e,t){var n=Ee(e);if(t=t||gt(e),A(n,"bpmn:SubProcess"))return ft(n,t)?{width:350,height:200}:{width:100,height:80};if(A(n,"bpmn:Task"))return{width:100,height:80};if(A(n,"bpmn:Gateway"))return{width:50,height:50};if(A(n,"bpmn:Event"))return{width:36,height:36};if(A(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return ft(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return A(n,"bpmn:Lane")?{width:400,height:100}:A(n,"bpmn:DataObjectReference")?{width:36,height:50}:A(n,"bpmn:DataStoreReference")?{width:50,height:50}:A(n,"bpmn:TextAnnotation")?{width:100,height:40}:A(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},sr.prototype.createParticipantShape=function(e){return vn(e)||(e={isExpanded:e}),e=Y({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function UL(e,t,n){return V(n,function(i){t=Mh(e,t,i)}),t}function Mh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ki(t,[n]))}function qL(e){return st(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gu(e,t){this._modeling=e,this._canvas=t}gu.$inject=["modeling","canvas"],gu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;V(n,function(o){var r={x:0,y:0};yn(i.left)?r.x=i.left-o.x:yn(i.right)?r.x=i.right-o.width-o.x:yn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:yn(i.top)?r.y=i.top-o.y:yn(i.bottom)?r.y=i.bottom-o.height-o.y:yn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},gu.prototype.postExecute=function(e){};function mu(e){this._modeling=e}mu.$inject=["modeling"],mu.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,o=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:o.attach}),e.shape=i},mu.prototype.postExecute=function(e){var t=e.hints||{};YL(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 YL(e,t){return No(e.outgoing,function(n){return n.target===t})}function yu(e,t){this._canvas=e,this._layouter=t}yu.$inject=["canvas","layouter"],yu.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,o=e.parent,r=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!o)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,o,r),t},yu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var vu=Math.round;function Ah(e){this._modeling=e}Ah.$inject=["modeling"],Ah.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;V(t,function(p){Qe(p.x)||(p.x=0),Qe(p.y)||(p.y=0)});var s=lt(t,function(p){return!p.hidden}),c=un(s);V(t,function(p){Dt(p)&&(p.waypoints=Hn(p.waypoints,function(d){return{x:vu(d.x-c.x-c.width/2+o.x),y:vu(d.y-c.y-c.height/2+o.y)}})),Y(p,{x:vu(p.x-c.x-c.width/2+o.x),y:vu(p.y-c.y-c.height/2+o.y)})});var l=new Set(bl(t)),u={};V(t,function(p){if(Dt(p)){u[p.id]=Qe(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var d=Y({},r);l.has(p)||(d.autoResize=!1),at(p)&&(d=Ki(d,["attach"])),u[p.id]=Qe(i)?a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,$i(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=ua(u)};var l_=Math.round;function cr(e){this._canvas=e}cr.$inject=["canvas"],cr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?Y(t,n):Y(t,{x:n.x-l_(t.width/2),y:n.y-l_(t.height/2)}),this._canvas.addShape(t,i,o),t},cr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Ks(e){cr.call(this,e)}Be(Ks,cr),Ks.$inject=["canvas"];var KL=cr.prototype.execute;Ks.prototype.execute=function(e){var t=e.shape;return ZL(t),t.labelTarget=e.labelTarget,KL.call(this,e)};var XL=cr.prototype.revert;Ks.prototype.revert=function(e){return e.shape.labelTarget=null,XL.call(this,e)};function ZL(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Xs(e,t){this._canvas=e,this._modeling=t}Xs.$inject=["canvas","modeling"],Xs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;ar(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ar(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Xs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=tf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Xs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,rn(n.children,t,i),this._canvas.addConnection(t,n),t};function Th(e,t){this._modeling=e,this._elementRegistry=t}Th.$inject=["modeling","elementRegistry"],Th.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;V(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Zs(e,t){this._canvas=e,this._modeling=t}Zs.$inject=["canvas","modeling"],Zs.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;ar(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),ar(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),ar(n.children,function(i){Dt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Zs.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=tf(i.children,n),t.removeShape(n),n},Zs.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return rn(i.children,n,o),t.addShape(n,i),n};function xu(e){this._modeling=e}xu.$inject=["modeling"];var u_={x:"y",y:"x"};xu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(y,_){y.range.min=Math.min(_[i],y.range.min),y.range.max=Math.max(_[i]+_[o],y.range.max)}function a(y){return y[i]+y[o]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,_){var m={y:0};m[i]=y-a(_),m[i]&&(m[u_[i]]=0,t.moveElements([_],m,_.parent))}var u=n[0],p=s(n),d=n[p],f,g,h=0;V(n,function(y,_){var m,v,b;if(y.elements.length<2){_&&_!==n.length-1&&(r(y,y.elements[0]),h+=c(y.range));return}m=Yi(y.elements,i),v=m[0],_===p&&(v=m[s(m)]),b=a(v),y.range=null,V(m,function(E){if(l(b,E),y.range===null){y.range={min:E[i],max:E[i]+E[o]};return}r(y,E)}),_&&_!==n.length-1&&(h+=c(y.range))}),g=Math.abs(d.range.min-u.range.max),f=Math.round((g-h)/(n.length-1)),!(f<n.length-1)&&V(n,function(y,_){var m={},v;y===u||y===d||(v=n[_-1],y.range.max=0,V(y.elements,function(b,E){m[u_[i]]=0,m[i]=v.range.max-b[i]+f,y.range.min!==b[i]&&(m[i]+=b[i]-y.range.min),m[i]&&t.moveElements([b],m,b.parent),y.range.max=Math.max(b[i]+b[o],E?y.range.max:0)}))})},xu.prototype.postExecute=function(e){};function bu(e,t){this._layouter=e,this._canvas=t}bu.$inject=["layouter","canvas"],bu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return Y(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},bu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ph(){}Ph.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldParent=r,e.oldParentIndex=en(r.children,t),rn(i.children,t,o),t.parent=i,V(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},Ph.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return en(n.children,t),rn(i.children,t,o),t.parent=i,V(t.waypoints,function(a){a.x-=r.x,a.y-=r.y,a.original&&(a.original.x-=r.x,a.original.y-=r.y)}),t};function kh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}kh.prototype.add=function(e,t){return this.addAll([e],t)},kh.prototype.addAll=function(e,t){var n=TP(e,!!t,this);return Y(this,n),this};function Js(e){this._modeling=e}Js.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Js.prototype.moveClosure=function(e,t,n,i,o){var r=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;o&&o.parent===n&&(u=!0),V(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),V(s,function(p){var d=!!a[p.source.id],f=!!a[p.target.id];c[p.id]&&d&&f?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:d&&$f(p,p.source,t),connectionEnd:f&&Ff(p,p.target,t)})})},Js.prototype.getClosure=function(e){return new kh().addAll(e,!0)};function wu(e){this._helper=new Js(e)}wu.$inject=["modeling"],wu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wu.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 Yr(e){this._modeling=e,this._helper=new Js(e)}Yr.$inject=["modeling"],Yr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,o=e.newParentIndex,r=t.parent;return e.oldBounds=$i(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=en(r.children,t),rn(i.children,t,o),Y(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Yr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(V(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Ff(r,t,n)})}),V(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:$f(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Yr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return rn(n.children,t,i),Y(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Yr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Yr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Qs(e){this._modeling=e}Qs.$inject=["modeling"],Qs.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,o=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Je(o)&&(e.oldWaypoints=i.waypoints,i.waypoints=o),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Qs.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,o=e.dockingOrPoints,r=e.hints||{},a={};r.connectionStart&&(a.connectionStart=r.connectionStart),r.connectionEnd&&(a.connectionEnd=r.connectionEnd),r.layoutConnection!==!1&&(n&&(!i||r.docking==="source")&&(a.connectionStart=a.connectionStart||p_(Je(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||p_(Je(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Qs.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,o=e.connection;return t&&(o.source=t),n&&(o.target=n),i&&(o.waypoints=i),o};function p_(e){return e.original||e}function Ao(e,t){this._modeling=e,this._rules=t}Ao.$inject=["modeling","rules"],Ao.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,o=e.oldShape,r=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:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var d=o.incoming.slice(),f=o.outgoing.slice();V(d,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,Yl(g,s,u),a)}),V(f,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,ql(g,s,u),a)})},Ao.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Ao.prototype.execute=function(e){},Ao.prototype.revert=function(e){},Ao.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Ao.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Ao.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ec(e){this._modeling=e}ec.$inject=["modeling"],ec.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},Y(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ec.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(V(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Yl(r,n,i)})}),V(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:ql(r,n,i)})}))},ec.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return Y(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function lr(e){this._modeling=e}lr.$inject=["modeling"],lr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,o=e.resizingShapes,r=e.start,a={};this.moveShapes(i,t),V(o,function(s){a[s.id]=QL(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(CL(i,o),t,n,r,i,o,a)},lr.prototype.execute=function(){},lr.prototype.revert=function(){},lr.prototype.moveShapes=function(e,t){var n=this;V(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},lr.prototype.resizeShapes=function(e,t,n){var i=this;V(e,function(o){var r=ML(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},lr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);V(e,function(u){var p=u.source,d=u.target,f=JL(u),g=f_(n),h={},y=c.has(p)||l.has(p),_=c.has(d)||l.has(d);y&&_?(f=Hn(f,function(m){return h_(m,i,n)&&(m[g]=m[g]+t[g]),m.original&&h_(m.original,i,n)&&(m.original[g]=m.original[g]+t[g]),m}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(y||_)&&(c.has(p)?h.connectionStart=$f(u,p,t):c.has(d)?h.connectionEnd=Ff(u,d,t):l.has(p)?h.connectionStart=ql(u,p,a[p.id]):l.has(d)&&(h.connectionEnd=Yl(u,d,a[d.id])),s._modeling.layoutConnection(u,h))})};function d_(e){return Y({},e)}function JL(e){return Hn(e.waypoints,function(t){return t=d_(t),t.original&&(t.original=d_(t.original)),t})}function f_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function h_(e,t,n){var i=f_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function QL(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function _u(e){this._modeling=e}_u.$inject=["modeling"],_u.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=g_(n),t.collapsed=!t.collapsed;var i=m_(n,t.collapsed);return[t].concat(i)},_u.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=y_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function g_(e){var t={};return V(e,function(n){t[n.id]=n.hidden,n.children&&(t=Y({},t,g_(n.children)))}),t}function m_(e,t){var n=[];return V(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(m_(i.children,i.collapsed||t)))}),n}function y_(e,t){var n=[];return V(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(y_(i.children,t)))}),n}function Eu(e){this._modeling=e}Eu.$inject=["modeling"],Eu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=v_(i,t),x_(n,t),t.host=n,t},Eu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,v_(n,t),x_(i,t,o),t};function v_(e,t){return en(e&&e.attachers,t)}function x_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),rn(i,t,n)}}function Oh(){}Oh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Oh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Lt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Lt.$inject=["eventBus","elementFactory","commandStack"],Lt.prototype.getHandlers=function(){return{"shape.append":mu,"shape.create":cr,"shape.delete":Zs,"shape.move":Yr,"shape.resize":ec,"shape.replace":Ao,"shape.toggleCollapse":_u,spaceTool:lr,"label.create":Ks,"connection.create":yu,"connection.delete":Xs,"connection.move":Ph,"connection.layout":bu,"connection.updateWaypoints":Oh,"connection.reconnect":Qs,"elements.create":Ah,"elements.move":wu,"elements.delete":Th,"elements.distribute":xu,"elements.align":gu,"element.updateAttachment":Eu}},Lt.prototype.registerHandlers=function(e){V(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Lt.prototype.moveShape=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=null);var r={shape:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("shape.move",r)},Lt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Lt.prototype.moveElements=function(e,t,n,i){i=i||{};var o=i.attach,r=n,a;o===!0?(a=n,r=n.parent):o===!1&&(a=null);var s={shapes:e,delta:t,newParent:r,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Lt.prototype.moveConnection=function(e,t,n,i,o){typeof i=="object"&&(o=i,i=void 0);var r={connection:e,delta:t,newParent:n,newParentIndex:i,hints:o||{}};this._commandStack.execute("connection.move",r)},Lt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Lt.prototype.createConnection=function(e,t,n,i,o,r){typeof n=="object"&&(r=o,o=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:o,parentIndex:n,connection:i,hints:r};return this._commandStack.execute("connection.create",a),a.connection},Lt.prototype.createShape=function(e,t,n,i,o){typeof i!="number"&&(o=i,i=void 0),o=o||{};var r=o.attach,a,s;e=this._create("shape",e),r?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:o};return this._commandStack.execute("shape.create",c),c.shape},Lt.prototype.createElements=function(e,t,n,i,o){Je(e)||(e=[e]),typeof i!="number"&&(o=i,i=void 0),o=o||{};var r={position:t,elements:e,parent:n,parentIndex:i,hints:o};return this._commandStack.execute("elements.create",r),r.elements},Lt.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var o={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",o),o.shape},Lt.prototype.appendShape=function(e,t,n,i,o){o=o||{},t=this._create("shape",t);var r={source:e,position:n,target:i,shape:t,connection:o.connection,connectionParent:o.connectionParent,hints:o};return this._commandStack.execute("shape.append",r),r.shape},Lt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Lt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Lt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Lt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Lt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Lt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Lt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Lt.prototype.createSpace=function(e,t,n,i,o){var r={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:o};this._commandStack.execute("spaceTool",r)},Lt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Lt.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},Lt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,Y(i,{docking:"source"}))},Lt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,Y(i,{docking:"target"}))},Lt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Lt.prototype._create=function(e,t){return hk(t)?t:this._elementFactory.create(e,t)},Lt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function tc(e){this._elementRegistry=e}tc.$inject=["elementRegistry"],tc.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var o=e.changed||this._getVisualReferences(n).concat(t),r=e.oldProperties||eI(n,Fc(i));return b_(n,i),e.oldProperties=r,e.changed=o,o},tc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return b_(n,t),i},tc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?tI(e,t):[]};function eI(e,t){return oi(t,function(n,i){return n[i]=e.get(i),n},{})}function b_(e,t){V(t,function(n,i){e.set(i,n)})}function tI(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&Ee(n).dataObjectRef===e})}var nc="default",To="id",w_="di",nI={width:0,height:0};function ic(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ic.$inject=["elementRegistry","moddle","modeling","textRenderer"],ic.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,o=this._moddle.ids,r=t.businessObject,a=sI(e.properties),s=e.oldProperties||iI(t,a);return __(a,r)&&(o.unclaim(r[To]),i.updateId(t,a[To]),o.claim(a[To],r)),nc in a&&(a[nc]&&n.push(i.get(a[nc].id)),r[nc]&&n.push(i.get(r[nc].id))),E_(t,a),e.oldProperties=s,e.changed=n,n},ic.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Ee(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,nI)}},ic.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return E_(t,i),__(n,o)&&(a.unclaim(n[To]),r.updateId(t,i[To]),a.claim(i[To],o)),e.changed};function __(e,t){return To in e&&e[To]!==t[To]}function iI(e,t){var n=Fc(t),i=e.businessObject,o=gt(e);return oi(n,function(r,a){return a!==w_?r[a]=i.get(a):r[a]=oI(o,Fc(t.di)),r},{})}function oI(e,t){return oi(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function E_(e,t){var n=e.businessObject,i=gt(e);V(t,function(o,r){r!==w_?n.set(r,o):i&&rI(i,o)})}function rI(e,t){V(t,function(n,i){e.set(i,n)})}var aI=["default"];function sI(e){var t=Y({},e);return aI.forEach(function(n){n in e&&(t[n]=Ee(t[n]))}),t}function Su(e,t){this._canvas=e,this._modeling=t}Su.$inject=["canvas","modeling"],Su.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=gt(o);return t.setRootElement(n),t.removeRootElement(o),rn(a.rootElements,i),i.$parent=a,en(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},Su.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=gt(n);return t.setRootElement(o),t.removeRootElement(n),en(a.rootElements,i),i.$parent=null,rn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Dh(e,t){this._modeling=e,this._spaceTool=t}Dh.$inject=["modeling","spaceTool"],Dh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ci(i),a=r===i,s=a?i:i.parent,c=tr(s),l=Sn(i);if(l?o==="left"?o="top":o==="right"&&(o="bottom"):o==="top"?o="left":o==="bottom"&&(o="right"),!c.length){var u=l?{x:i.x+Ri,y:i.y,width:i.width-Ri,height:i.height}:{x:i.x,y:i.y+Ri,width:i.width,height:i.height-Ri};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Fr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:lt(b.children,function(E){return E!==i})});var d,f,g,h,y;o==="top"?(d=-120,f=i.y,g=f+10,h="n",y="y"):o==="left"?(d=-120,f=i.x,g=f+10,h="w",y="x"):o==="bottom"?(d=120,f=i.y+i.height,g=f-10,h="s",y="y"):o==="right"&&(d=120,f=i.x+i.width,g=f-10,h="e",y="x");var _=t.calculateAdjustments(p,y,d,g),m=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,m,h,g);var v=l?{x:i.x+(a?Ri:0),y:f-(o==="top"?120:0),width:i.width-(a?Ri:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Ri:0),width:120,height:i.height-(a?Ri:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function Lh(e){this._modeling=e}Lh.$inject=["modeling"],Lh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=tr(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=Sn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,d;for(d=0;d<i;d++)d===i-1?l=s-c*d:l=c,u=a?{x:n.x+Ri,y:n.y+d*c,width:n.width-Ri,height:l}:{x:n.x+d*c,y:n.y+Ri,width:l,height:n.height-Ri},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function oc(e,t){this._modeling=e,this._spaceTool=t}oc.$inject=["modeling","spaceTool"],oc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},oc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=tO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},oc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ye(e),o=Ye(t),r=tb(o,i),a=Ci(e),s=[],c=[];Fr(a,function(g){return s.push(g),(A(g,"bpmn:Lane")||A(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,d,f;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",d=r.top>0||r.bottom<0?-l:l,f=n.calculateAdjustments(s,"y",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",d=r.left>0||r.right<0?-l:l,f=n.calculateAdjustments(c,"x",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},p))};var rc="flowNodeRef",Ih="lanes";function Ru(){}Ru.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=Ye(p),f={x:u.x+u.width/2,y:u.y+u.height/2};return f.x>d.left&&f.x<d.right&&f.y>d.top&&f.y<d.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ci(u);return o[p.id]||(o[p.id]=zl(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(d){return a(u,d)}).map(function(d){return d.businessObject})}return t.forEach(function(u){var p=Ci(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return A(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get(Ih),f=d.slice(),g=l(u);i.push({flowNode:p,remove:f,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(rc).forEach(function(d){i.push({flowNode:d,remove:[p],add:[]})})}),i},Ru.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,o=i.get(Ih);n.remove.forEach(function(r){en(o,r),en(r.get(rc),i)}),n.add.forEach(function(r){rn(o,r),rn(r.get(rc),i)})}),[]},Ru.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Ih);n.add.forEach(function(r){en(o,r),en(r.get(rc),i)}),n.remove.forEach(function(r){rn(o,r),rn(r.get(rc),i)})}),[]};var Bh="categoryValueRef";function ac(e,t){this._bpmnFactory=e,this._elementRegistry=t}ac.$inject=["bpmnFactory","elementRegistry"],ac.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(m,v,b){if(v){var E=a.get(m);E||(E={},a.set(m,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:Nh(m)}:E.past={categoryValue:v}))}}function c(m){o.set(m,Ee(m))}function l(){n.filter(function(m){return A(m,"bpmn:FlowElement")&&!at(m)&&m.parent}).forEach(c)}function u(m){var v=Ee(m),b=v.get("categoryValueRef");return b||(b=Xx(i,v),r.push(cI(m,b))),b}function p(m){return m.reduce(function(v,b){var E=Nh(b),C=v.get(E);return C||(C=[],v.set(E,C)),C.push(b),v},new Map)}e=Array.from(e||[]);var d=p(e);t.length&&l(),e.forEach(c),n.filter(function(m){return A(m,"bpmn:Group")&&!at(m)&&m.parent}).forEach(function(m){var v=Ee(m).get("categoryValueRef");if(!v){var b=Nh(m),E=d.get(b)||[],C=_a(E,m),I=Object.keys(C).length>0;I&&(v=u(m))}s(m,v,!0)}),t.forEach(function(m){s(m.groupShape,m.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(m,v){return v.present&&m.add(v.present.categoryValue),v.past&&m.add(v.past.categoryValue),m},new Set),h=new Map,y=p(f);a.forEach(function(m,v){var b=m.present;if(b){var E=y.get(b.root)||[],C=_a(E,v);E.forEach(function(I){if(C[I.id]){var k=h.get(I);k||(k=new Set,h.set(I,k)),k.add(b.categoryValue)}})}});var _=f.reduce(function(m,v){var b=o.get(v),E=b.get(Bh),C=new Set(E),I=h.get(v)||new Set,k=Array.from(I).filter(function(F){return!C.has(F)}),T=E.filter(function(F){return g.has(F)&&!I.has(F)});return(k.length||T.length)&&m.push({businessObject:b,categoryValuesToAdd:k,categoryValuesToRemove:T}),m},[]);return{flowElements:_,groups:r}},ac.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),lI(t.groups),pI(t.flowElements),[]},ac.prototype.revert=function(e){var t=e.updates;return dI(t.flowElements),uI(t.groups),[]};function cI(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function lI(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function uI(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=null})}function pI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Bh);t.categoryValuesToRemove.forEach(function(o){en(i,o)}),t.categoryValuesToAdd.forEach(function(o){rn(i,o,!0)})})}function dI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Bh);t.categoryValuesToAdd.forEach(function(o){en(i,o)}),t.categoryValuesToRemove.forEach(function(o){rn(i,o,!0)})})}function Nh(e){for(;e.parent;)e=e.parent;return e}function Cu(e){this._moddle=e}Cu.$inject=["moddle"],Cu.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},Cu.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.unclaim(n):t.claim(n,i),[]};var fI={fill:void 0,stroke:void 0};function $h(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ni(t)){var n=hI(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}$h.$inject=["commandStack"],$h.prototype.postExecute=function(e){var t=e.elements,n=e.colors||fI,i=this,o={};"fill"in n&&Y(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&Y(o,{"border-color":this._normalizeColor(n.stroke)}),V(t,function(r){var a=Dt(r)?$i(o,["border-color"]):o,s=gt(r);if(gI(a),at(r)){if(!s||!A(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!st(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function hI(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 gI(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var mI={width:0,height:0};function S_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return Vk(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!at(l)&&Qo(l)&&!Tl(l)&&!R_(p)){var d=7,f=cf(l);f={x:f.x,y:f.y+d},e.createLabel(l,f,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=si(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,d=c.newBounds,f=c.hints||{};if(!(!at(u)&&!A(u,"bpmn:TextAnnotation"))){if(at(u)&&R_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=si(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,g)),d&&e.resizeShape(u,d,mI)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}S_.$inject=["modeling","textRenderer","bpmnFactory"];function R_(e){return!e||!e.trim()}function Nn(e,t,n,i){Lt.call(this,e,t,n),this._bpmnRules=i}Be(Nn,Lt),Nn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Nn.prototype.getHandlers=function(){var e=Lt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=tc,e["element.updateProperties"]=ic,e["canvas.updateRoot"]=Su,e["lane.add"]=Dh,e["lane.resize"]=oc,e["lane.split"]=Lh,e["lane.updateRefs"]=Ru,e["group.updateRefs"]=ac,e["id.updateClaim"]=Cu,e["element.setColor"]=$h,e["element.updateLabel"]=S_,e},Nn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Nn.prototype.connect=function(e,t,n,i){var o=this._bpmnRules;if(n||(n=o.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Nn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Nn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Nn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Nn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Nn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Nn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Nn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Nn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Nn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Nn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Nn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Nn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function C_(){}C_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||et(t.source||e.source),t.connectionEnd||et(t.target||e.target)]};var Mu=20,yI=5,Au=Math.round,M_=20,vI={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function xI(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function bI(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function A_(e,t,n){var i=Ln(t,e,yI),o=n.split(":")[0],r=Au((t.x-e.x)/2+e.x),a=Au((t.y-e.y)/2+e.y),s,c,l=bI(o,i),u=/h|r|l/.test(o),p=!1,d=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=xI(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+Mu*(/l/.test(o)?-1:1),y:d?a+Mu:a}):(d=r===e.x,s={x:d?r+Mu:r,y:e.y+Mu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Fh(e,s,c).concat(s),directions:c,turnNextDirections:d}}function wI(e,t,n){return A_(e,t,n)}function _I(e,t,n){var i=A_(t,e,T_(n));return{waypoints:i.waypoints.slice().reverse(),directions:T_(i.directions),turnNextDirections:i.turnNextDirections}}function EI(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 o=n+":"+i,r=Fh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function T_(e){return e.split(":").reverse().join(":")}function SI(e,t,n){var i=Au((t.x-e.x)/2+e.x),o=Au((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:o},{x:t.x,y:o}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Fh(e,t,n){if(n=n||"h:h",!DI(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(k_(n)){var i=wI(e,t,n),o=_I(e,t,n),r=EI(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return SI(e,t,n)}function RI(e,t,n){var i=Fh(e,t,n);return i.unshift(e),i.push(t),D_(i)}function CI(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=ER(r,"straight")[0]||"h:h",s=vI[a]||0,c=Ln(e,t,s),l=OI(c,a);n=n||et(e),i=i||et(t);var u=l.split(":"),p=O_(n,e,u[0],LI(c)),d=O_(i,t,u[1],c);return RI(p,d,l)}function MI(e,t,n,i,o,r){Je(n)&&(o=n,r=i,n=et(e),i=et(t)),r=Y({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&TI(e,t,n,i,r),c||(c=r.connectionEnd&&kI(t,e,i,o),c)||(c=r.connectionStart&&PI(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:CI(e,t,n,i,r)}function AI(e,t,n){return e>=t&&e<=n}function P_(e,t,n){var i={x:"width",y:"height"};return AI(t[e],n[e],n[e]+n[i[e]])}function TI(e,t,n,i,o){var r={},a,s;return s=Ln(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?P_(a,i,e)?(r[a]=i[a],[{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y,original:{x:r.x!==void 0?r.x:n.x,y:r.y!==void 0?r.y:n.y}},{x:i.x,y:i.y}]):null:P_(a,n,t)?(r[a]=n[a],[{x:n.x,y:n.y},{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y,original:{x:r.x!==void 0?r.x:i.x,y:r.y!==void 0?r.y:i.y}}]):null):null}function PI(e,t,n,i){return jh(e,t,n,i)}function kI(e,t,n,i){var o=i.slice().reverse();return o=jh(e,t,n,o),o?o.reverse():null}function jh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Bt(u,function(p,d){var f=u[d-1];return f&&Ps(p,f)<3})}function r(u,p,d){var f=bo(p,u);switch(f){case"v":return{x:d.x,y:u.y};case"h":return{x:u.x,y:d.y}}return{x:u.x,y:u.y}}function a(u,p,d){var f;for(f=u.length-2;f!==0;f--)if(ex(u[f],p,M_)||ex(u[f],d,M_))return u.slice(f);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=jh(e,t,n,l)),c&&bo(c)?null:c}function OI(e,t){if(k_(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 DI(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function k_(e){return e&&/t|r|b|l/.test(e)}function LI(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 O_(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 D_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return nf(o,r,n,0)||t.push(n),t},[])}var II=-10,BI=40,NI={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},$I={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},Hh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},sc={top:"t",right:"r",bottom:"b",left:"l"};function Tu(e){this._elementRegistry=e}Be(Tu,C_),Tu.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,o=t.waypoints||e.waypoints,r=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,l;if(r||(r=L_(o&&o[0],n)),a||(a=L_(o&&o[o.length-1],i)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!I_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Ux(n,s)?NI:$I;return A(e,"bpmn:MessageFlow")?c=jI(n,i,u):(A(e,"bpmn:SequenceFlow")||I_(n,i))&&(n===i?c={preferredLayouts:UI(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:qI(n,i,a,u)}:cc(n)||cc(i)?c={preferredLayouts:u.subProcess,preserveDocking:zI(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=Y(c,t),l=D_(MI(n,i,r,a,o,c))),l||[r,a]};function FI(e){var t=e.host;return Ln(et(e),t,II)}function jI(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:HI(e,t)}}function HI(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":cc(t)?"source":cc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function zI(e){return cc(e)?"target":"source"}function L_(e,t){return e?e.original||e:et(t)}function I_(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function cc(e){return A(e,"bpmn:SubProcess")&&ft(e)}function Kr(e,t){return e===t}function GI(e,t){return t.indexOf(e)!==-1}function Fa(e){var t=/right|left/.exec(e);return t&&t[0]}function ja(e){var t=/top|bottom/.exec(e);return t&&t[0]}function B_(e,t){return Hh[e]===t}function VI(e,t){var n=Fa(e),i=Hh[n];return t.indexOf(i)!==-1}function WI(e,t){var n=ja(e),i=Hh[n];return t.indexOf(i)!==-1}function N_(e){return e==="right"||e==="left"}function UI(e,t,n){var i=t.waypoints,o=i&&i.length&&Ln(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function qI(e,t,n,i){var o=et(e),r=et(t),a=FI(e),s,c,l=Kr(e.host,t),u=GI(a,["top","right","bottom","left"]),p=Ln(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?YI(a,u,e,t,n,i):(s=KI(a,p,u,i.isHorizontal),c=XI(a,p,u,i.isHorizontal),[s+":"+c])}function YI(e,t,n,i,o,r){var a=t?e:r.isHorizontal?ja(e):Fa(e),s=sc[a],c;return t?N_(e)?c=$_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=$_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function $_(e,t,n,i){var o=BI;return!(zh(e,i,n,o)||zh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||zh(e,i,et(t),o))}function zh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function KI(e,t,n,i){if(n)return sc[e];var o=ja(e),r=Fa(e),a=ja(t),s=Fa(t);if(i){if(Kr(o,a)||B_(r,s))return sc[o]}else if(Kr(r,s)||B_(o,a))return sc[r];return sc[i?r:o]}function XI(e,t,n,i){if(n)return N_(e)?VI(e,t)||Kr(e,t)?"h":"v":WI(e,t)||Kr(e,t)?"v":"h";var o=ja(e),r=Fa(e),a=ja(t),s=Fa(t);return a&&!s?"v":s&&!a?"h":i?Kr(o,a)?"h":"v":Kr(r,s)?"v":"h"}Tu.$inject=["elementRegistry"];function F_(e){return Y({original:e.point.original||e.point},e.actual)}function ur(e,t){this._elementRegistry=e,this._graphicsFactory=t}ur.$inject=["elementRegistry","graphicsFactory"],ur.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),o=this.getDockingPoint(e,n),r=e.waypoints.slice(i.idx+1,o.idx);return r.unshift(F_(i)),r.push(F_(o)),r},ur.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,o,r,a;return o=n?0:i.length-1,r=i[o],a=this._getIntersection(t,e,n),{point:r,actual:a||r,idx:o}},ur.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return ks(i,o,n)},ur.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},ur.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},ur.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Gh={__init__:["modeling","bpmnUpdater"],__depends__:[gD,kD,DD,LD,Zw,IL,NL,GL,Ai,Ch,i_],bpmnFactory:["type",Pi],bpmnUpdater:["type",pi],elementFactory:["type",sr],modeling:["type",Nn],layouter:["type",Tu],connectionDocking:["type",ur]};var ZI=10,j_=50,JI=250;function Vh(e,t,n,i){for(var o;o=QI(e,n,t);)n=i(t,n,o);return n}function Wh(e){return function(t,n,i){var o={x:n.x,y:n.y};return["x","y"].forEach(function(r){var a=e[r];if(a){var s=r==="x"?"width":"height",c=a.margin,l=a.minDistance;c<0?o[r]=Math.min(i[r]+c-t[s]/2,n[r]-l+c):o[r]=Math.max(i[r]+i[s]+c+t[s]/2,n[r]+l+c)}}),o}}function QI(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=tB(e);return Bt(o,function(r){if(r===n)return!1;var a=Ln(r,i,ZI);return a==="intersect"})}function eB(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||j_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||JI,c=t.reference||"start";r||(r=oB);function l(g,h){return o==="n"?c==="start"?Ye(g).top-Ye(h).bottom:c==="center"?Ye(g).top-et(h).y:Ye(g).top-Ye(h).top:o==="w"?c==="start"?Ye(g).left-Ye(h).right:c==="center"?Ye(g).left-et(h).x:Ye(g).left-Ye(h).left:o==="s"?c==="start"?Ye(h).top-Ye(g).bottom:c==="center"?et(h).y-Ye(g).bottom:Ye(h).bottom-Ye(g).bottom:c==="start"?Ye(h).left-Ye(g).right:c==="center"?et(h).x-Ye(g).right:Ye(h).right-Ye(g).right}var u=e.incoming.filter(r).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(r).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}}),d=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),f=oi(d,function(g,h){var y=h.distance,_=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*_,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return f.distance||i}function tB(e){var t=Uh(e);return e.host&&(t=t.concat(Uh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Uh(i))},[]))),t}function Uh(e){return iB(e).concat(nB(e))}function nB(e){return e.incoming.map(function(t){return t.source})}function iB(e){return e.outgoing.map(function(t){return t.target})}function oB(){return!0}var rB=100;function H_(e,t,n){e.on("autoPlace",rB,function(i){var o=i.shape,r=i.source;return aB(r,o)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,o,r){e.fire("autoPlace.start",{source:i,shape:o});var a=e.fire("autoPlace",{source:i,shape:o}),s=t.appendShape(i,o,a,i.parent,r);return e.fire("autoPlace.end",{source:i,shape:s}),s}}H_.$inject=["eventBus","modeling","canvas"];function aB(e,t,n){n||(n={});var i=n.defaultDistance||j_,o=et(e),r=Ye(e);return{x:r.right+i+t.width/2,y:o.y}}function z_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}z_.$inject=["eventBus","selection"];const sB={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",H_],autoPlaceSelectionBehavior:["type",z_]};function G_(e,t,n){var i=Ux(e,n);if(A(t,"bpmn:TextAnnotation"))return lB(e,t,i);if(st(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return uB(e,t,i);if(A(t,"bpmn:FlowNode"))return cB(e,t,i)}function cB(e,t,n){var i=Ye(e),o=et(e),r=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=eB(e,{filter:function(f){return A(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;A(e,"bpmn:BoundaryEvent")&&(l=Ln(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+V_(l,c,r)}:{x:o.x+V_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return Vh(e,t,u,Wh(d))}function V_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function lB(e,t,n){var i=Ye(e),o=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};Dt(e)&&(o=et(e),n?(o.x+=100,o.y-=50):(o.x+=100,o.y+=50));var r={margin:n?-30:30,minDistance:20},a=n?{y:r}:{x:r};return Vh(e,t,o,Wh(a))}function uB(e,t,n){var i=Ye(e),o=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},r={margin:30,minDistance:30},a=n?{x:r}:{y:r};return Vh(e,t,o,Wh(a))}function W_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return G_(o,i,t)})}W_.$inject=["eventBus","elementRegistry"];const Pu={__depends__:[sB],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",W_]};function Po(e,t,n,i){_e.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=Fp(ua(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=pa(s,function(p){return p.parent.id});V(u,function(p,d){Je(l)&&(p=p.filter(function(f){return Bt(l,da({id:f.id}))})),o._expand(p,d)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}Po.$inject=["eventBus","elementRegistry","modeling","rules"],Be(Po,_e),Po.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ye(un(e)),r=Ye(t),a={};return o.top-r.top<i.top&&(a.top=o.top-n.top),o.left-r.left<i.left&&(a.left=o.left-n.left),r.right-o.right<i.right&&(a.right=o.right+n.right),r.bottom-o.bottom<i.bottom&&(a.bottom=o.bottom+n.bottom),El(Y({},r,a))},Po.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(pB(i,t)){var o=dB($i(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Po.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Po.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Po.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function pB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function dB(e,t){var n="";return e=Ye(e),t=Ye(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function ku(e){e.invoke(Po,this)}ku.$inject=["injector"],Be(ku,Po),ku.prototype.resize=function(e,t,n){A(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function lc(e){Mi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}lc.$inject=["eventBus"],Be(lc,Mi),lc.prototype.canResize=function(e,t){return!1};function Ou(e,t){lc.call(this,e),this._modeling=t}Be(Ou,lc),Ou.$inject=["eventBus","modeling"],Ou.prototype.canResize=function(e,t){if(A(t.di,"bpmndi:BPMNPlane")||!A(t,"bpmn:Participant")&&!A(t,"bpmn:Lane")&&!A(t,"bpmn:SubProcess"))return!1;var n=!0;return V(e,function(i){if(A(i,"bpmn:Lane")||at(i)){n=!1;return}}),n};const U_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",ku],bpmnAutoResizeProvider:["type",Ou]},fB=1500;class q_{constructor(t){t.on("moddleCopy.canCopyProperties",fB,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Tr)))return;const o=Mn(n);o!==void 0&&i.set("xml:lang",o)})}}sn(q_,"$inject",["eventBus"]);const Y_={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",q_]},hB=500,Du=1,K_=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Du||n>e.x+e.width+Du||i<e.y-Du||i>e.y+e.height+Du)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class X_{constructor(t){t.on("bpmnElement.added",hB,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(K_(n.source,i[0]),K_(n.target,i[i.length-1]))})}}sn(X_,"$inject",["eventBus"]);const Z_={__init__:["annotationImportDocking"],annotationImportDocking:["type",X_]},qh=[Vx,Ns,Gh,Pu,U_,Kp,Y_,Z_,rv];function gB(e={}){zm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new jr({container:t,moddleExtensions:e.moddleExtensions??fs,additionalModules:[...qh,...e.additionalModules??[]]})}const J_={"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":"풀"},mB={이:["이","가"],을:["을","를"],와:["과","와"]};function yB(e,t){const[n,i]=mB[t],o=e.at(-1)??"",r=o.charCodeAt(0);return r>=44032&&r<=55203?e+((r-44032)%28===0?i:n):o>="0"&&o<="9"?e+("013678".includes(o)?n:i):e+`${n}(${i})`}const vB={"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":"연관선"},xB="요소";function Yh(e){return(e&&vB[e.type])??xB}const Q_=20;function bB(e){const t=e.replace(/\s+/g," ").trim();return t.length>Q_?`${t.slice(0,Q_)}…`:t}function Lu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:bB(o.name),a=r===void 0?i+Yh(o):r,s=r===void 0?a:`「${r}」`;return n?s+yB(a,n).slice(a.length):s}function wB(e,t,n,i,o){const[r,a]=[e(t),e(n)],s=(r==null?void 0:r.name)===void 0&&(a==null?void 0:a.name)===void 0&&Yh(r)===Yh(a);return[Lu(e,t,i),Lu(e,n,o,s?"다른 ":"")]}function _B(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 EB(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 Iu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function SB(e,t){const n=(o,r)=>Lu(t,o,r),i=(o,r,a,s)=>wB(t,o,r,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[o,r]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${o} ${r} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${o} ${r} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[o,r]=i(e.edges[0],e.edges[1],"와","이");return`${o} ${r} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[o,r]=i(e.edge,e.other,void 0,"와");return`${o}의 라벨이 ${r} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}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[o,r]=i(e.groups[0],e.groups[1],"와","이");return`${o} ${r} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${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)}의 ${Iu[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[o,r]=i(e.groups[0],e.groups[1],"와");return`${o} ${r}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${Iu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${Iu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${Iu[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[o,r]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${o} ${r} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${o} ${r} 겹칩니다.`}}}function RB(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Lu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const e0="기타",Kh={error:0,warning:1,info:2};function t0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${ct(i)}`,source:"geometry",code:i.kind,severity:_B(i),targetRefs:EB(i),category:J_[i.kind]??e0,message:SB(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:J_[i.ruleId]??e0,message:RB(i,t)});return n}function n0(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Ha(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function Xh(e,t){if(t===void 0||e.length===0)return!1;const n=Ha(e[0],t);return e.some(i=>Ha(i,t)!==n)}function i0(e,t){const n=Xh(e,t);return e.slice().sort((i,o)=>(n?Number(Ha(o,t))-Number(Ha(i,t)):0)||Kh[i.severity]-Kh[o.severity])}const o0="i18n-untranslated",r0="i18n-review-requested",uc="i18nDisplay.redrawn",a0=[["untranslated",o0],["reviewRequested",r0]];class Zh{constructor(t,n,i,o,r,a,s,c){sn(this,"config");sn(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(d,f,g)=>this.withDisplayText(f,()=>l(d,f,g),d);const u=r.activate.bind(r);r.activate=d=>this.withDisplayText(d,()=>u(d));const p=r.update.bind(r);r.update=(d,f,g,h)=>{const y=this.resolve(d);if(!y||y.native)return p(d,f,g,h);(f??"").trim()!==(g??"").trim()&&i.execute(Hc,{element:d.labelTarget??d,locale:this.displayLocale,text:f,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",d=>{if(!this.config)return;const{element:f,newLabel:g,oldLabel:h}=d.context;(g??"")!==(h??"")&&i.execute(Hc,{element:f.labelTarget??f,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,o,r;const t=(i=this.canvas.getRootElement())==null?void 0:i.businessObject,n=(t==null?void 0:t.$parent)??t;return((o=n==null?void 0:n.get)==null?void 0:o.call(n,"xml:lang"))??((r=n==null?void 0:n.$attrs)==null?void 0:r["xml:lang"])}resolve(t){if(!this.config||!this.displayLocale)return;const n=(t.labelTarget??t).businessObject,i=Pr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=$o(n).filter(d=>Mn(d)),s=d=>d.body??"",c=a.find(d=>Mn(d)===o&&s(d)),l=Fo(n).some(d=>d.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(d=>s(d)===r).map(Mn);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i){var d;if(!this.config)return n();const o=this.resolve(t),r=(d=i==null?void 0:i.parentNode)==null?void 0:d.classList;if(r)for(const[f,g]of a0)r.toggle(g,(o==null?void 0:o.status)===f);if(!o||o.native)return n();const{target:a,key:s}=Pr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const f=n();return p&&(f!=null&&f.setAttribute)&&f.setAttribute("transform",`translate(${p.dx}, 0)`),f}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}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[,o]of a0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(uc)}}sn(Zh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const s0={__depends__:[Kp],__init__:["i18nDisplay"],i18nDisplay:["type",Zh]};var CB=2e3;function Jh(e,t,n){e.on("autoPlace",CB,function(i){var o=i.source,r=et(o),a=i.shape,s=G_(o,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==r[c]&&(s[c]>r[c]?l.min=s[c]:l.max=s[c],A(a,"bpmn:TextAnnotation")&&(MB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}Jh.$inject=["eventBus","gridSnapping","elementRegistry"];function MB(e){return e==="x"}var AB=3e3;function za(e,t,n){_e.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],AB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||TB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}za.$inject=["eventBus","gridSnapping","modeling"],Be(za,_e),za.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=OB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function TB(e){return e.length>3}function PB(e){return e==="h"}function kB(e){return e==="v"}function OB(e,t,n){var i=bo(t,n),o={};return PB(i)&&(o.y=e.snapValue(t.y)),kB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=Y({},t,o),n=Y({},n,o)),[t,n]}function DB(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Lr(e,t),fontBoundingBoxAscent:t*Zi.ascentEm,fontBoundingBoxDescent:t*Zi.descentEm,actualBoundingBoxAscent:t*Zi.ascentEm,actualBoundingBoxDescent:t*Zi.descentEm}}class Qh{constructor(t,n,i,o,r,a){sn(this,"active",!1);sn(this,"shadow");sn(this,"shadowContainer");this.eventBus=t,this.elementRegistry=n,this.textRenderer=i,this.graphicsFactory=o,this.canvas=r,this.bpmnjs=a,t.on("diagram.destroy",()=>this.disposeShadow());let s=[];t.on("elements.changed",c=>{this.active||(s=c.elements??[])}),t.on("commandStack.changed",c=>{const l=s;s=[],!(this.active||(c==null?void 0:c.trigger)!=="undo"&&(c==null?void 0:c.trigger)!=="redo")&&this.remeasureLabelsOf(l)})}isActive(){return this.active}run(t){if(this.active)throw new Error("headlessReplay.run: 이미 창 안이다(중첩 금지)");const n=typeof CanvasRenderingContext2D>"u"?void 0:CanvasRenderingContext2D.prototype,i=n==null?void 0:n.measureText;n&&(n.measureText=DB),this.active=!0;try{return this.reproject(),t()}finally{this.active=!1,n&&i&&(n.measureText=i),this.relabel(),this.syncGraphicsOrder(),this.redrawAll()}}atBatchBoundary(){if(!this.active)throw new Error("headlessReplay.atBatchBoundary: 창 밖이다");this.eventBus.fire("saveXML.start",{definitions:this.bpmnjs.getDefinitions()}),this.reproject()}reproject(){const t=this.ensureShadow();t.get("eventBus").fire("diagram.clear");let n=!1;t.get("eventBus").once("import.render.complete",()=>n=!0);let i;if(Ax(t,this.bpmnjs.getDefinitions()).catch(u=>i=u),!n)throw new Error(`headlessReplay: 그림자 import 가 동기로 끝나지 않았다${i?` — ${String(i)}`:""}`);const o=t.get("elementRegistry"),r=this.elementRegistry,a=u=>u?r.get(u.id):void 0,s=o.getAll();for(const u of s){const p=r.get(u.id);if(!p)continue;u.waypoints?p.waypoints=u.waypoints.map(f=>({x:f.x,y:f.y,...f.original?{original:{x:f.original.x,y:f.original.y}}:{}})):u.parent&&(p.x=u.x,p.y=u.y,p.width=u.width,p.height=u.height),p.collapsed=u.collapsed,p.hidden=u.hidden,p.isFrame=u.isFrame;const d=a(u.parent);d&&p.parent!==d&&(p.parent=d);for(const f of["incoming","outgoing"]){const g=(u[f]??[]).map(a).filter(Boolean),h=p[f];h&&g.length===h.length&&g.every(y=>h.includes(y))&&g.forEach((y,_)=>h[_]=y)}}for(const u of s){const p=r.get(u.id);if(!(p!=null&&p.children)||!u.children)continue;const d=u.children.map(a).filter(Boolean),f=p.children.filter(g=>!d.includes(g)&&g.parent===p);p.children.length=0,p.children.push(...d,...f)}const c=r._elements,l={};for(const u of s)u.id in c&&(l[u.id]=c[u.id]);for(const u of Object.keys(c))u in l||(l[u]=c[u]);r._elements=l}relabel(){for(const t of this.elementRegistry.filter(n=>n.type==="label"))this.remeasure(t)}remeasure(t){const n=t.labelTarget,i=n&&si(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(Bx(gt(n),n),i),r={x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)};return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height?!1:(Object.assign(t,r),!0)}remeasureLabelsOf(t){const n=new Set;for(const o of t){(o==null?void 0:o.type)==="label"&&n.add(o);for(const r of(o==null?void 0:o.labels)??[])n.add(r)}let i=0;for(const o of n){if(!this.elementRegistry.get(o.id)||!this.remeasure(o))continue;const r=this.elementRegistry.getGraphics(o);r&&this.graphicsFactory.update("shape",o,r),i++}i&&this.eventBus.fire(uc)}syncGraphicsOrder(){var t,n;for(const i of this.elementRegistry.getAll()){if(!((t=i.children)!=null&&t.length))continue;const o=this.graphicsFactory._getChildrenContainer(i);for(const r of i.children){const a=(n=this.elementRegistry.getGraphics(r))==null?void 0:n.parentNode;a&&o.appendChild(a)}}}redrawAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);i&&this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}this.eventBus.fire(uc)}ensureShadow(){if(this.shadow)return this.shadow;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-10000px;top:0;width:800px;height:600px;visibility:hidden",document.body.appendChild(t),this.shadowContainer=t,this.shadow=new jr({container:t,moddleExtensions:fs,additionalModules:[...qh]}),this.shadow}disposeShadow(){var t,n;(t=this.shadow)==null||t.destroy(),this.shadow=void 0,(n=this.shadowContainer)==null||n.remove(),this.shadowContainer=void 0}}sn(Qh,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function c0(e,t){const n=Object.create(e);return n.on=(i,o,r,a)=>{typeof o=="function"&&(a=r,r=o,o=1e3);const s=function(...c){return t.isActive()?void 0:r.apply(this,c)};return e.on(i,o,s,a)},n}function eg(e,t,n,i){Jh.call(this,c0(e,i),t,n)}eg.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Bu(e,t,n,i){za.call(this,c0(e,i),t,n)}Bu.prototype=Object.create(za.prototype),Bu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function LB(e){return e instanceof eg||e instanceof Bu}const l0={__init__:["headlessReplay"],headlessReplay:["type",Qh],gridSnappingAutoPlaceBehavior:["type",eg],gridSnappingLayoutConnectionBehavior:["type",Bu]};function Xr(e){return CSS.escape(e)}var IB={"&":"&","<":"<",">":">",'"':""","'":"'"};function u0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return IB[t]})}var Nu=50,BB=new Ur,p0={min:.2,max:4},NB=10,$B=.1,FB=250,jB=100,HB=2e3;function $n(e,t,n,i,o){var r=this;this._canvas=i,this._elementRegistry=o,this._eventBus=n,this._injector=t,this._config=e||{},this._updateTimeout=null,this._firstDebounceTime=null,this._dirty=!1,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=BB.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=$u({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);tg(p,r._canvas),r._update()}function s(u){return function(d){var f=ng(d);(!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var g=$u({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),y=GB(g,h),_=r._viewportDom.getBoundingClientRect(),m={x:f.x-_.left+1,y:f.y-_.top+1};Y(r._state,{cachedViewbox:h,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:y,offsetViewportDom:m,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ue.bind(document,"mousemove",c),Ue.bind(document,"mouseup",l)}}function c(u){var p=ng(u);if(r._state.isDragging){(!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,g=r._state.parentClientRect;Y(r._viewportDom.style,{top:p.y-d.y-g.top+"px",left:p.x-d.x-g.left+"px"});var h=f0(g,{top:p.y-d.y-g.top,left:p.x-d.x-g.left,width:f.width,height:f.height});Y(r._overlay.style,{clipPath:h});var y=$u({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);tg({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=ng(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),Y(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ue.unbind(document,"mousemove",c),Ue.unbind(document,"mouseup",l))}Ue.bind(this._viewportDom,"mousedown",s(!1)),Ue.bind(this._svg,"mousedown",s(!0)),Ue.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||Fu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!YB(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*KB(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>$B){var f=d>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=XB(p0,NB*2),y=Math.round(g/h)*h;y+=h*f;var _=Math.pow(10,y);i.zoom(ZB(p0,_),m),r._state.zoomDelta=0;var m=$u({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);tg(m,r._canvas),r._update()}}}),Ue.bind(this._toggle,"click",function(u){u.preventDefault(),u.stopPropagation(),r.toggle()}),n.on(["shape.added","connection.added"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._addElement(u.element),r._scheduleUpdate()}),n.on(["shape.removed","connection.removed"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._removeElement(u.element),r._scheduleUpdate()}),n.on("elements.changed",FB,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,d=u.newId;r._updateElementId(p,d)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(d){r._addElement(d)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}$n.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],$n.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Mt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Mt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Mt(o).add("map"),n.appendChild(o);var r=this._svg=He("svg");Le(r,{width:"100%",height:"100%"}),nt(o,r);var a=this._elementsGroup=He("g");nt(r,a);var s=this._viewportGroup=He("g");nt(r,s);var c=this._viewport=He("rect");dt(c).add("viewport"),nt(s,c),Ue.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Mt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Mt(u).add("overlay"),this._parent.appendChild(u)},$n.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Qe(this._config.debounceDelay)?this._config.debounceDelay:jB,n=Qe(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:HB,i=Date.now();if(this._firstDebounceTime&&i-this._firstDebounceTime>=n){this._update();return}this._updateTimeout&&clearTimeout(this._updateTimeout),this._firstDebounceTime=this._firstDebounceTime||i,this._updateTimeout=setTimeout(function(){e._update()},t)}},$n.prototype._rebuild=function(){this._clear();var e=this._canvas,t=e.getRootElement&&e.getRootElement();if(t&&t.children){var n=this;t.children.forEach(function(i){n._addElement(i)})}},$n.prototype._update=function(){if(this.isOpen()){this._updateTimeout&&(clearTimeout(this._updateTimeout),this._updateTimeout=null),this._firstDebounceTime=null;var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(h0(e)){var i,o,r,a,s=n.width-t.width,c=n.height-t.height;t.width<n.width?(i=t.x-s/2,r=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,r=t.width),t.height<n.height?(o=t.y-c/2,a=n.height,t.y+t.height<n.height&&(o=Math.min(0,t.y))):(o=t.y,a=t.height),i=i-Nu,o=o-Nu,r=r+Nu*2,a=a+Nu*2,this._lastViewbox={x:i,y:o,width:r,height:a},Le(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),Le(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var l=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),p={top:u.top-l.top,left:u.left-l.left,width:u.width,height:u.height};Y(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=f0(l,p);Y(this._overlay.style,{clipPath:d})}}},$n.prototype.open=function(){Y(this._state,{isOpen:!0}),Mt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};An(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},$n.prototype.close=function(){Y(this._state,{isOpen:!1}),Mt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};An(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},$n.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},$n.prototype.isOpen=function(){return this._state.isOpen},$n.prototype._updateElement=function(e){try{e.parent!==void 0&&e.parent!==null&&(this._removeElement(e),this._addElement(e))}catch(t){console.warn("Minimap#_updateElement errored",t)}},$n.prototype._updateElementId=function(e,t){try{var n=Rt("#"+Xr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},$n.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},$n.prototype._addElement=function(e){var t=this;if(this._removeElement(e),!!this.isOnActivePlane(e)&&!e.hidden){var n,i,o,r=this._createElement(e),a=Rt("#"+Xr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=WB(e);return s!==-1?a?UB(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),zB(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),Le(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),Le(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},$n.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&ln(t)},$n.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Zo(t),n)){var i=JB(Wd(n));return Le(i,{id:this._prefixId(e.id)}),i}},$n.prototype._clear=function(){Ss(this._elementsGroup)},$n.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function zB(e){return e.waypoints}function GB(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}function $u(e,t,n){var i=t.getBoundingClientRect(),o=VB(n,i.width/i.height),r=d0(e.x,0,i.width,o.x,o.x+o.width),a=d0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function tg(e,t){var n=t.viewbox(),i=n.width,o=n.height;t.viewbox({x:e.x-i/2,y:e.y-o/2,width:i,height:o})}function VB(e,t){var n=e.width/e.height,i=Y({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var o=i.width*(1/t),r=i.y-(o-i.height)/2;Y(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;Y(i,{x:s,width:a})}return i}function d0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function WB(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function UB(e,t,n){var i=qB(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function qB(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function Fu(e){return e.width===0&&e.height===0}function YB(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var KB=Math.sign||function(e){return e>=0?1:-1};function XB(e,t){var n=Math.log(e.min)/Math.log(10),i=Math.log(e.max)/Math.log(10),o=Math.abs(n)+Math.abs(i);return o/t}function ZB(e,t){return Math.max(e.min,Math.min(e.max,t))}function f0(e,t){var n=[co(t.left,t.top),co(t.left+t.width,t.top),co(t.left+t.width,t.top+t.height),co(t.left,t.top+t.height),co(t.left,e.height),co(e.width,e.height),co(e.width,0),co(0,0),co(0,e.height),co(t.left,e.height)].join(", ");return"polygon("+n+")"}function co(e,t){return e+"px "+t+"px"}function h0(e){return Bo(e,function(t){return vn(t)?h0(t):Qe(t)&&isFinite(t)})}function ng(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function JB(e){return Es("[id]",e).forEach(function(t){t.remove()}),e}var QB={__init__:["minimap"],minimap:["type",$n]};const g0={closed:"미니맵",open:"접기"};class m0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(uc,()=>this.rebuild()),t.on("minimap.toggle",o=>this.retitle(o.open)),this.retitle(n.isOpen())}rebuild(){const t=this.minimap;if(!t.isOpen()){t._dirty=!0;return}t._rebuild(),t._update()}retitle(t){const n=this.canvas.getContainer().querySelector(".djs-minimap .toggle");n==null||n.setAttribute("title",t?g0.open:g0.closed)}}sn(m0,"$inject",["eventBus","minimap","canvas"]);const y0=[s0,{__depends__:[QB],__init__:["minimapI18n"],minimapI18n:["type",m0]},Y_,Z_,rv,l0];var eN=new Ur("ov"),tN=500;function Tn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=eN,this._overlayDefaults=Y({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=nN(n.getContainer()),this._init()}Tn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Tn.prototype.get=function(e){if(ni(e)&&(e={id:e}),ni(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?lt(t.overlays,da({type:e.type})):t.overlays.slice():[]}else return e.type?lt(this._overlays,da({type:e.type})):e.id?this._overlays[e.id]:null},Tn.prototype.add=function(e,t,n){if(vn(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=Y({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Tn.prototype.remove=function(e){var t=this.get(e)||[];Je(t)||(t=[t]);var n=this;V(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(eo(i.html),eo(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Tn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Tn.prototype.show=function(){ju(this._overlayRoot)},Tn.prototype.hide=function(){ju(this._overlayRoot,!1)},Tn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ml(this._overlayRoot)},Tn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=un(t);i=r.x,o=r.y}v0(n,i,o),An(e.html,"data-container-id",t.id)},Tn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=un(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=un(i).height:s=i.height,r=t.bottom*-1+s}v0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Tn.prototype._createOverlayContainer=function(e){var t=Ht('<div class="djs-overlays" />');Yn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Tn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";x0(this._overlayRoot,n)},Tn.prototype._getOverlayContainer=function(e,t){var n=Bt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Tn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),ni(i)&&(i=Ht(i)),r=this._getOverlayContainer(n),o=Ht('<div class="djs-overlay" data-overlay-id="'+t+'">'),Yn(o,{position:"absolute"}),o.appendChild(i),e.type&&Mt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();ju(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Tn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(yn(o)&&o>t.scale||yn(r)&&r<t.scale))&&(c=!1),ju(a,c),this._updateOverlayScale(e,t)},Tn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),yn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),yn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),yn(a)&&(s="scale("+a+","+a+")"),x0(r,s)},Tn.prototype._updateOverlaysVisibilty=function(e){var t=this;V(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Tn.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 o=i.element,r=t.get({element:o});V(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){eo(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",tN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(V(r.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(r))}),e.on("element.marker.update",function(i){var o=t._getOverlayContainer(i.element,!0);o&&Mt(o.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 nN(e){var t=Ht('<div class="djs-overlay-container" />');return Yn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function v0(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function ju(e,t){e.style.display=t===!1?"none":""}function x0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Hu={__init__:["overlays"],overlays:["type",Tn]};function ig(e,t){t.invoke(_e,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)})}Be(ig,_e),ig.$inject=["canvas","injector"];const iN={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ig]};var oN="bjs-breadcrumbs-shown";function b0(e,t,n){var i=Ht('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Mt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=Ee(l),p=Bt(a,function(d){return d===u});p&&s()});function s(c){c&&(a=rN(c));var l=a.flatMap(function(p){var d=n.findRoot(ro(p))||n.findRoot(p.id);if(!d&&A(p,"bpmn:Process")){var f=t.find(function(y){var _=Ee(y);return _&&_.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var g=u0(p.name||p.id),h=Ht('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(d)}),h});i.innerHTML="";var u=l.length>1;r.toggle(oN,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}b0.$inject=["eventBus","elementRegistry","canvas"];function rN(e){for(var t=Ee(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function w0(e,t){var n=null,i=new aN;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!A(r,"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})}w0.$inject=["eventBus","canvas"];function aN(){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 _0={x:180,y:160};function Zr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Zr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Zr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),cN(a,e)&&i.push({diElement:r,parent:s})}});var o=[];return n.forEach(function(r){if(!t._processToDiagramMap[r.id]){var a=t._createDiagram(r);t._processToDiagramMap[r.id]=a,o.push(a)}}),i.forEach(function(r){for(var a=r.diElement,s=r.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),o},Zr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=sN(e),i={x:n.x-_0.x,y:n.y-_0.y};t.forEach(function(o){o.waypoint?o.waypoint.forEach(function(r){r.x=r.x-i.x,r.y=r.y-i.y}):o.bounds&&(o.bounds.x=o.bounds.x-i.x,o.bounds.y=o.bounds.y-i.y)})},Zr.prototype._moveToDiPlane=function(e,t){var n=E0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Zr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Zr.$inject=["eventBus","moddle"];function E0(e){return A(e,"bpmndi:BPMNDiagram")?e:E0(e.$parent)}function sN(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ye(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),El(t)}function cN(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||st(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var zu=250,lN='<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>',uN="bjs-drilldown-empty";function pr(e,t,n,i,o){_e.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",zu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",zu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],zu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],zu,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;r._canDrillDown(l)&&r._addOverlay(l),r._updateDrilldownOverlay(s),r._updateDrilldownOverlay(c),r._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return r._canDrillDown(a)}).map(function(a){r._addOverlay(a)})})}Be(pr,_e),pr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},pr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(ro(e))},pr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Mt(i.html).toggle(uN,!o)}},pr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Ee(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Ht('<button type="button" class="bjs-drilldown">'+lN+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});r.setAttribute("title",s),r.addEventListener("click",function(){t.setRootElement(t.findRoot(ro(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},pr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},pr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const pN={__depends__:[Hu,Ch,iN],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",b0],drilldownCentering:["type",w0],drilldownOverlayBehavior:["type",pr],subprocessCompatibility:["type",Zr]};function dr(e){Vt.call(this,e)}Be(dr,Vt),dr.prototype._modules=[Vx,pN,Hu,Ai,Ns],dr.prototype._moddleExtensions={};var Gu="keyboard.keydown",dN="keyboard.keyup",fN=1e3,S0="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 Kn(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(S0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Kn.$inject=["config.keyboard","eventBus"],Kn.prototype._keydownHandler=function(e){this._keyHandler(e,Gu)},Kn.prototype._keyupHandler=function(e){this._keyHandler(e,dN)},Kn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Gu,i),n&&e.preventDefault()}},Kn.prototype._isEventIgnored=function(e){return!1},Kn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(S0)),this.unbind(),e=this._node=this._target,Ue.bind(e,"keydown",this._keydownHandler),Ue.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Kn.prototype.getBinding=function(){return this._node},Kn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ue.unbind(e,"keydown",this._keydownHandler),Ue.unbind(e,"keyup",this._keyupHandler)),this._node=null},Kn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Kn.prototype.addListener=function(e,t,n){En(e)&&(n=t,t=e,e=fN),this._eventBus.on(n||Gu,e,t)},Kn.prototype.removeListener=function(e,t){this._eventBus.off(t||Gu,e)},Kn.prototype.hasModifier=qD,Kn.prototype.isCmd=li,Kn.prototype.isShift=gh,Kn.prototype.isKey=bn;var hN=500;function Ga(e,t){var n=this;e.on("editorActions.init",hN,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ga.$inject=["eventBus","keyboard"],Ga.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(JD(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(QD(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(YD(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(KD(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(XD(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(ZD(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["+","Add","="],o)&&li(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(bn(["-","Subtract"],o)&&li(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(bn("0",o)&&li(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(bn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const og={__init__:["keyboard","keyboardBindings"],keyboard:["type",Kn],keyboardBindings:["type",Ga]};var gN={moveSpeed:50,moveSpeedAccelerated:200};function R0(e,t,n){var i=this;this._config=Y({},gN,e||{}),t.addListener(o);function o(r){var a=r.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(r){var a=0,s=0,c=r.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(r.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})}}R0.$inject=["config.keyboardMove","keyboard","canvas"];const C0={__depends__:[og],__init__:["keyboardMove"],keyboardMove:["type",R0]};var mN=15;function M0(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 o(s){var c=n.start,l=n.button,u=Gr(s),p=Gi(u,c);if(!n.dragging&&yN(p)>mN&&(n.dragging=!0,l===0&&Pw(e),su("grab")),n.dragging){var d=n.last||n.start;p=Gi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ue.unbind(document,"mousemove",o),Ue.unbind(document,"mouseup",r),n=null,Tw()}function a(s){if(!Nr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Gr(s)},Ue.bind(document,"mousemove",o),Ue.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}M0.$inject=["eventBus","canvas"];function yN(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const A0={__init__:["moveCanvas"],moveCanvas:["type",M0]};function T0(e,t){var n=df(e.min),i=df(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function vN(e,t){return Math.max(e.min,Math.min(e.max,t))}var xN=Math.sign||function(e){return e>=0?1:-1},rg={min:.2,max:4},P0=10,bN=.1,wN=.75;function lo(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Zn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||wN;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}lo.$inject=["config.zoomScroll","eventBus","canvas"],lo.prototype.scroll=function(t){this._canvas.scroll(t)},lo.prototype.reset=function(){this._canvas.zoom("fit-viewport")},lo.prototype.zoom=function(t,n){var i=T0(rg,P0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>bN&&(this._zoom(t,n,i),this._totalDelta=0)},lo.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Nb()&&t.metaKey,o=t.shiftKey,r=-1*this._scale,a;if(i?r*=t.deltaMode===0?.02:.32:r*=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))*xN(t.deltaY)*r,this.zoom(a,c)}else o?a={dx:r*t.deltaY,dy:0}:a={dx:r*t.deltaX,dy:r*t.deltaY},this.scroll(a)}},lo.prototype.stepZoom=function(t,n){var i=T0(rg,P0);this._zoom(t,n,i)},lo.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=df(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(vN(rg,s),t)},lo.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ue[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},lo.prototype._init=function(e){this.toggle(e)};const k0={__init__:["zoomScroll"],zoomScroll:["type",lo]};function pc(e){dr.call(this,e)}Be(pc,dr),pc.prototype._navigationModules=[C0,A0,k0],pc.prototype._modules=[].concat(dr.prototype._modules,pc.prototype._navigationModules);function ag(e){return e&&e[e.length-1]}function O0(e){return e.y}function D0(e){return e.x}var _N={left:D0,center:D0,right:function(e){return e.x+e.width},top:O0,middle:O0,bottom:function(e){return e.y+e.height}};function Va(e,t){this._modeling=e,this._rules=t}Va.$inject=["modeling","rules"],Va.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}},Va.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Va.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(d,f){return Math.round((d[i]+f[i]+f[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=ag(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(V(t,function(d){var f=d[i]+Math.round(d[o]/2);a[f]?a[f].elements.push(d):a[f]={elements:[d],center:f}}),c=Yi(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=ag(c).center,r;l=t[0],t=Yi(t,function(d){return d[i]+d[o]}),u=ag(t),r[e]=p(l,u)}return r},Va.prototype.trigger=function(e,t){var n=this._modeling,i,o=lt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Je(i)&&(o=i),!(o.length<2||!i)){var r=_N[t],a=Yi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const EN={__init__:["alignElements"],alignElements:["type",Va]},SN=new Ur;function Wa(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Wa.$inject=["eventBus"],Wa.prototype.schedule=function(e,t=SN.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Wa.prototype._schedule=function(e,t){const n=RN();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(o){n.reject(o)}}catch(o){console.error("Scheduler#_schedule execution failed",o)}}),promise:n.promise}},Wa.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Wa.prototype._cancel=function(e){clearTimeout(e.executionId)};function RN(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const CN={scheduler:["type",Wa]};var MN="djs-element-hidden",Vu=".entry",AN=1e3,L0=8,TN=300;function dn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}dn.$inject=["canvas","elementRegistry","eventBus","scheduler"],dn.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 o=i.target,r=Je(o)?o:[o],a=r.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=r.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,o=Je(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},dn.prototype._createContainer=function(){var e=Ht('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},dn.prototype.registerProvider=function(e,t){t||(t=e,e=AN),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},dn.prototype.getEntries=function(e){var t=this._getProviders(),n=Je(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return V(t,function(o){if(En(o[n])){var r=o[n](e);En(r)?i=r(i):V(r,function(a,s){i[s]=a})}}),i},dn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=An(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},TN);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},dn.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var o=this._current.target,r=this._current.entries,a=r[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(En(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},dn.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))}},dn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},dn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;V(t,function(o,r){var a=o.group||"default",s=Ht(o.html||'<div class="entry" draggable="true"></div>'),c;An(s,"data-action",r),c=Rt("[data-group="+Xr(a)+"]",n),c||(c=Ht('<div class="group"></div>'),An(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&PN(s,o.className),o.title&&An(s,"title",o.title),o.imageUrl&&(i=Ht("<img>"),An(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Mt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},dn.prototype._createHtml=function(e){var t=this,n=Ht('<div class="djs-context-pad"></div>');return ri.bind(n,Vu,"click",function(i){t.trigger("click",i)}),ri.bind(n,Vu,"dragstart",function(i){t.trigger("dragstart",i)}),ri.bind(n,Vu,"mouseover",function(i){t.trigger("mouseover",i)}),ri.bind(n,Vu,"mouseout",function(i){t.trigger("mouseout",i)}),Ue.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},dn.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()&&ON(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},dn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},dn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Je(e)!==Je(n)?!1:Je(e)?e.length===n.length&&Bo(e,function(i){return n.includes(i)}):n===e},dn.prototype.isShown=function(){return this.isOpen()&&Mt(this._current.html).has("open")},dn.prototype.show=function(){this.isOpen()&&(Mt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},dn.prototype.hide=function(){this.isOpen()&&(Mt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},dn.prototype._getPosition=function(e){if(!Je(e)&&Dt(e)){var t=this._canvas.viewbox(),n=kN(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+L0*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+L0*this._canvas.zoom(),top:s.top-a.top}},dn.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")},dn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Je(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,MN)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},dn.prototype._getTargetBounds=function(e){var t=this,n=Je(e)?e:[e],i=n.map(function(o){return t._canvas.getGraphics(o)});return i.reduce(function(o,r){const a=r.getBoundingClientRect();return o.top=Math.min(o.top,a.top),o.right=Math.max(o.right,a.right),o.bottom=Math.max(o.bottom,a.bottom),o.left=Math.min(o.left,a.left),o.x=o.left,o.y=o.top,o.width=o.right-o.left,o.height=o.bottom-o.top,o},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function PN(e,t){var n=Mt(e);t=Je(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function kN(e){return e.waypoints[e.waypoints.length-1]}function ON(e,t){return e=Je(e)?e:[e],t=Je(t)?t:[t],e.length===t.length&&Bo(e,function(n){return t.includes(n)})}const I0={__depends__:[au,CN,Hu],contextPad:["type",dn]};var Wu,Ut,B0,fr,N0,$0,F0,sg,Uu,dc,j0,cg,lg,ug,qu={},Yu=[],DN=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ku=Array.isArray;function ko(e,t){for(var n in t)e[n]=t[n];return e}function pg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function H0(e,t,n){var i,o,r,a={};for(r in t)r=="key"?i=t[r]:r=="ref"?o=t[r]:a[r]=t[r];if(arguments.length>2&&(a.children=arguments.length>3?Wu.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)a[r]===void 0&&(a[r]=e.defaultProps[r]);return Xu(e,a,i,o,null)}function Xu(e,t,n,i,o){var r={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++B0,__i:-1,__u:0};return o==null&&Ut.vnode!=null&&Ut.vnode(r),r}function Zu(e){return e.children}function Ju(e,t){this.props=e,this.context=t}function Jr(e,t){if(t==null)return e.__?Jr(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"?Jr(e):null}function LN(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=ko({},t);r.__v=t.__v+1,Ut.vnode&&Ut.vnode(r),dg(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Jr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,K0(i,r,o),t.__e=t.__=null,r.__e!=n&&z0(r)}}function z0(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}),z0(e)}function G0(e){(!e.__d&&(e.__d=!0)&&fr.push(e)&&!Qu.__r++||N0!=Ut.debounceRendering)&&((N0=Ut.debounceRendering)||$0)(Qu)}function Qu(){try{for(var e,t=1;fr.length;)fr.length>t&&fr.sort(F0),e=fr.shift(),t=fr.length,LN(e)}finally{fr.length=Qu.__r=0}}function V0(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,g,h,y,_=i&&i.__k||Yu,m=t.length;for(c=IN(n,t,_,c,m),p=0;p<m;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&_[f.__i]||qu,f.__i=p,y=dg(e,f,d,o,r,a,s,c,l,u),g=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&fg(d.ref,null,f),u.push(f.ref,f.__c||g,f)),h==null&&g!=null&&(h=g),4&f.__u?(c=W0(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),f.__u&=-7);return n.__e=h,c}function IN(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,d=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=Xu(null,a,null,null,null):Ku(a)?a=e.__k[r]=Xu(Zu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Xu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+d,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=BN(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?d--:o<u&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Jr(s)),Z0(s,s));return i}function W0(e,t,n){var i,o;if(typeof e.type=="function"){for(i=e.__k,o=0;i&&o<i.length;o++)i[o]&&(i[o].__=e,t=W0(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Jr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function BN(e,t,n,i){var o,r,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(o=n-1,r=n+1;o>=0||r<t.length;)if((l=t[a=o>=0?o--:r++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function U0(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||DN.test(t)?n:n+"px"}function ep(e,t,n,i,o){var r,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||U0(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||U0(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(j0,"$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+r]=n,n?i?n[dc]=i[dc]:(n[dc]=cg,e.addEventListener(t,r?ug:lg,r)):e.removeEventListener(t,r?ug:lg,r);else{if(o=="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 q0(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Uu]==null)t[Uu]=cg++;else if(t[Uu]<n[dc])return;return n(Ut.event?Ut.event(t):t)}}}function dg(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,g,h,y,_,m,v,b,E,C,I,k,T,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Ut.__b)&&u(t);e:if(typeof F=="function"){p=a.length;try{if(m=t.props,v=F.prototype&&F.prototype.render,b=(u=F.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?_=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new F(m,E):(t.__c=d=new Ju(m,E),d.constructor=F,d.render=$N),b&&b.sub(d),d.state||(d.state={}),d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&F.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=ko({},d.__s)),ko(d.__s,F.getDerivedStateFromProps(m,d.__s))),g=d.props,h=d.state,d.__v=t,f)v&&F.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&F.getDerivedStateFromProps==null&&m!==g&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(m,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(m,d.__s,E)===!1){t.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),Yu.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=Jr(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(m,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(g,h,y)})}if(d.context=E,d.props=m,d.__P=e,d.__e=!1,C=Ut.__r,I=0,v)d.state=d.__s,d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),Yu.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,C&&C(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++I<25);d.state=d.__s,d.getChildContext!=null&&(i=ko(ko({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(g,h)),k=u!=null&&u.type===Zu&&u.key==null?X0(u.props.children):u,s=V0(e,Ku(k)?k:[k],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(z){if(a.length=p,t.__v=null,c||r!=null){if(z.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r!=null&&(r[r.indexOf(s)]=null),t.__e=s}else if(r!=null)for(T=r.length;T--;)pg(r[T])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),z.then||Y0(t),Ut.__e(z,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=NN(n.__e,t,n,i,o,r,a,c,l);return(u=Ut.diffed)&&u(t),128&t.__u?void 0:s}function Y0(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Y0))}function K0(e,t,n){for(var i=0;i<n.length;i++)fg(n[i],n[++i],n[++i]);Ut.__c&&Ut.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Ut.__e(r,o.__v)}})}function X0(e){return typeof e!="object"||e==null||e.__b>0?e:Ku(e)?e.map(X0):e.constructor!==void 0?null:ko({},e)}function NN(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,g,h,y=n.props||qu,_=t.props,m=t.type;if(m=="svg"?o="http://www.w3.org/2000/svg":m=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((f=r[l])&&"setAttribute"in f==!!m&&(m?f.localName==m:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(m==null)return document.createTextNode(_);e=document.createElementNS(o,m,_.is&&_),s&&(Ut.__m&&Ut.__m(t,r),s=!1),r=null}if(m==null)y===_||s&&e.data==_||(e.data=_);else{if(r=m=="textarea"&&_.defaultValue!=null?null:r&&Wu.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(f=e.attributes[l]).name]=f.value;for(l in y)f=y[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||ep(e,l,null,f,o);for(l in _)f=_[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?g=f:l=="checked"?h=f:s&&typeof f!="function"||y[l]===f||ep(e,l,f,y[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),V0(t.type=="template"?e.content:e,Ku(d)?d:[d],t,n,i,m=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Jr(n,0),s,c),r!=null)for(l=r.length;l--;)pg(r[l]);s&&m!="textarea"||(l="value",m=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||m=="progress"&&!g||m=="option"&&g!=y[l])&&ep(e,l,g,y[l],o),l="checked",h!=null&&h!=e[l]&&ep(e,l,h,y[l],o))}return e}function fg(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(o){Ut.__e(o,n)}}function Z0(e,t,n){var i,o;if(Ut.unmount&&Ut.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||fg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Ut.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&Z0(i[o],t,n||typeof e.type!="function");n||pg(e.__e),e.__c=e.__=e.__e=void 0}function $N(e,t,n){return this.constructor(e,n)}function J0(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Ut.__&&Ut.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],dg(t,e=t.__k=H0(Zu,null,[e]),o||qu,qu,t.namespaceURI,o?null:t.firstChild?Wu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),K0(r,e,a),e.props.children=null}Wu=Yu.slice,Ut={__e:function(e,t,n,i){for(var o,r,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,i||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},B0=0,Ju.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ko({},this.state),typeof e=="function"&&(e=e(ko({},n),this.props)),e&&ko(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),G0(this))},Ju.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),G0(this))},Ju.prototype.render=Zu,fr=[],$0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,F0=function(e,t){return e.__v.__b-t.__v.__b},Qu.__r=0,sg=Math.random().toString(8),Uu="__d"+sg,dc="__a"+sg,j0=/(PointerCapture)$|Capture$/i,cg=0,lg=q0(!1),ug=q0(!0);var Q0=function(e,t,n,i){var o;t[0]=0;for(var r=1;r<t.length;r++){var a=t[r++],s=t[r]?(t[0]|=a?1:2,n[t[r++]]):t[++r];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++r]]=s:a===6?i[1][t[++r]]+=s+"":a?(o=e.apply(s,Q0(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},eE=new Map;function FN(e){var t=eE.get(this);return t||(t=new Map,eE.set(this,t)),(t=Q0(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(d){r===1&&(d||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,d,a):r===3&&(d||a)?(c.push(3,d,a),r=2):r===2&&a==="..."&&d?c.push(4,d,0):r===2&&a&&!d?c.push(5,0,!0,a):r>=5&&((a||!d&&r===5)&&(c.push(r,0,a,o),r=6),d&&(c.push(r,d,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
|
|
10
|
+
`||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var It=FN.bind(H0),Ua,fn,hg,tE,fc=0,nE=[],wn=Ut,iE=wn.__b,oE=wn.__r,rE=wn.diffed,aE=wn.__c,sE=wn.unmount,cE=wn.__;function tp(e,t){wn.__h&&wn.__h(fn,e,fc||t),fc=0;var n=fn.__H||(fn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function gg(e){return fc=1,jN(uE,e)}function jN(e,t,n){var i=tp(Ua++,2);if(i.t=e,!i.__c&&(i.__=[uE(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=fn,!fn.__f)){var o=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(f){if(f.__N){u=!0;var g=f.__[0];f.__=f.__N,f.__N=void 0,g!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};fn.__f=!0;var r=fn.shouldComponentUpdate,a=fn.componentWillUpdate;fn.componentWillUpdate=function(s,c,l){if(this.__e){var u=r;r=void 0,o(s,c,l),r=u}a&&a.call(this,s,c,l)},fn.shouldComponentUpdate=o}return i.__N||i.__}function np(e,t){var n=tp(Ua++,3);!wn.__s&&vg(n.__H,t)&&(n.__=e,n.u=t,fn.__H.__h.push(n))}function mg(e,t){var n=tp(Ua++,4);!wn.__s&&vg(n.__H,t)&&(n.__=e,n.u=t,fn.__h.push(n))}function ip(e){return fc=5,Oo(function(){return{current:e}},[])}function Oo(e,t){var n=tp(Ua++,7);return vg(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function hc(e,t){return fc=8,Oo(function(){return e},t)}function HN(){for(var e;e=nE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(op),t.__h.some(yg),t.__h=[]}catch(n){t.__h=[],wn.__e(n,e.__v)}}}wn.__b=function(e){fn=null,iE&&iE(e)},wn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),cE&&cE(e,t)},wn.__r=function(e){oE&&oE(e),Ua=0;var t=(fn=e.__c).__H;t&&(hg===fn?(t.__h=[],fn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(op),t.__h.some(yg),t.__h=[],Ua=0)),hg=fn},wn.diffed=function(e){rE&&rE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(nE.push(t)!==1&&tE===wn.requestAnimationFrame||((tE=wn.requestAnimationFrame)||zN)(HN)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),hg=fn=null},wn.__c=function(e,t){t.some(function(n){try{n.__h.some(op),n.__h=n.__h.filter(function(i){return!i.__||yg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],wn.__e(i,n.__v)}}),aE&&aE(e,t)},wn.unmount=function(e){sE&&sE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{op(i)}catch(o){t=o}}),n.__H=void 0,t&&wn.__e(t,n.__v))};var lE=typeof requestAnimationFrame=="function";function zN(e){var t,n=function(){clearTimeout(i),lE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);lE&&(t=requestAnimationFrame(n))}function op(e){var t=fn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),fn=t}function yg(e){var t=fn;e.__c=e.__(),fn=t}function vg(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function uE(e,t){return typeof t=="function"?t(e):t}function GN(e){const{navigationStack:t,setNavigationStack:n}=e,i=Oo(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),o=t.length>0?()=>n([]):null,r=t.length>0?t[t.length-1].label:null;return It`
|
|
12
11
|
<div class="djs-popup-breadcrumbs">
|
|
13
12
|
${o&&It`
|
|
14
13
|
<button
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
</span>
|
|
42
41
|
`}
|
|
43
42
|
</div>
|
|
44
|
-
`}function
|
|
43
|
+
`}function pE(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=pE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function rp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=pE(e))&&(i&&(i+=" "),i+=t);return i}function VN(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Oo(()=>WN(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return It`
|
|
45
44
|
<div class="djs-popup-header">
|
|
46
45
|
<h3 class="djs-popup-title" title=${r}>${r}</h3>
|
|
47
46
|
${a.map(l=>It`
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
${l.entries.map(u=>It`
|
|
51
50
|
<li key=${u.id}>
|
|
52
51
|
<${s(u)?"button":"span"}
|
|
53
|
-
class=${
|
|
52
|
+
class=${UN(u,u===i)}
|
|
54
53
|
onClick=${p=>c(p,u)}
|
|
55
54
|
title=${u.title||u.label}
|
|
56
55
|
data-id=${u.id}
|
|
@@ -70,11 +69,11 @@
|
|
|
70
69
|
</ul>
|
|
71
70
|
`)}
|
|
72
71
|
</div>
|
|
73
|
-
`}function
|
|
72
|
+
`}function WN(e){return e.reduce((t,n)=>{const i=n.group||"default",o=t.find(r=>r.id===i);return o?o.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function UN(e,t){return rp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function dE(e,t){return`${e}-entry-${t.id}`}function qN(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:o,onMouseLeave:r,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return It`
|
|
74
73
|
<li
|
|
75
74
|
class=${rp("entry",{selected:i,disabled:n.disabled})}
|
|
76
75
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
76
|
+
id=${dE(t,n)}
|
|
78
77
|
role="option"
|
|
79
78
|
aria-selected=${i||void 0}
|
|
80
79
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -131,7 +130,7 @@
|
|
|
131
130
|
</div>
|
|
132
131
|
`}
|
|
133
132
|
</li>
|
|
134
|
-
`}function
|
|
133
|
+
`}function YN(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=ip();mg(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const y=h.querySelector(".selected");y&&KN(y)},[t]);const d=()=>{o.current=!1},f=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return It`
|
|
135
134
|
<div
|
|
136
135
|
class="djs-popup-results"
|
|
137
136
|
ref=${p}
|
|
@@ -144,7 +143,7 @@
|
|
|
144
143
|
>
|
|
145
144
|
${i.map(h=>It`
|
|
146
145
|
${h.name&&It`
|
|
147
|
-
<div key=${h.id} id=${
|
|
146
|
+
<div key=${h.id} id=${fE(r,h)} class="entry-header" title=${h.name}>
|
|
148
147
|
${h.name}
|
|
149
148
|
</div>
|
|
150
149
|
`}
|
|
@@ -152,10 +151,10 @@
|
|
|
152
151
|
class="djs-popup-group"
|
|
153
152
|
data-group=${h.id}
|
|
154
153
|
role="group"
|
|
155
|
-
aria-labelledby=${h.name?
|
|
154
|
+
aria-labelledby=${h.name?fE(r,h):void 0}
|
|
156
155
|
>
|
|
157
156
|
${h.entries.map(y=>It`
|
|
158
|
-
<${
|
|
157
|
+
<${qN}
|
|
159
158
|
key=${y.id}
|
|
160
159
|
idPrefix=${r}
|
|
161
160
|
entry=${y}
|
|
@@ -168,8 +167,8 @@
|
|
|
168
167
|
</ul>
|
|
169
168
|
`)}
|
|
170
169
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
170
|
+
`}function fE(e,t){return`${e}-group-${t.id}`}function KN(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const XN=new Ur("djs-popup");function ZN(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:d,onOpened:f,onClosed:g}=e,[h,y]=gg([]);np(()=>{y([])},[d]);const[_,m]=gg(""),v=_.trim().length>0,b=Oo(()=>e$(d),[d]),E=Oo(()=>yn(l)?b.length>5:!1,[l,b]),C=Oo(()=>{const q=h.length?h[h.length-1].entries:d;return E?v?p(b.filter(({searchable:ee})=>ee!==!1),_,{keys:["label","search","description"]}).map(({item:ee})=>ee):q.filter(({rank:ee=0})=>ee>=0):q},[E,v,b,_,p,h,d]),I=Oo(()=>v?C.length?[{id:"default",entries:C}]:[]:t$(C),[C,v]),[k,T]=gg(C[0]),F=ip(null),z=ip(!1),G=Oo(()=>XN.next(),[]),ne=`${G}-results`,re=k&&dE(G,k);np(()=>{const q=F.current;q&&C.includes(q)?T(q):T(C[0]),F.current=null},[C]);const K=hc(q=>{const ee=QN(I);let Re=ee.indexOf(k)+q;Re<0&&(Re=ee.length-1),Re>=ee.length&&(Re=0),z.current=!0,T(ee[Re])},[I,k]),xe=hc(q=>{q>0&&k&&k.entries&&(z.current=!0,y(ee=>[...ee,k])),q<0&&h.length>0&&(z.current=!0,F.current=h[h.length+q],y(ee=>ee.slice(0,q)))},[k,h]),de=hc((q,ee,me)=>{if(!(!ee||ee.disabled))return ee.entries?(q.preventDefault(),xe(1)):n(q,ee,me)},[n,xe]),we=hc(q=>{if(q.key==="Enter"&&k){const ee=q.target;return!!Nr(ee,"a, button",!0)||k.disabled?void 0:de(q,k)}if(q.key==="Backspace"){const ee=q.target;if(!(Gd(ee,"input")&&ee.value!==""))return xe(-1),q.preventDefault()}if(q.key==="ArrowUp")return K(-1),q.preventDefault();if(q.key==="ArrowDown")return K(1),q.preventDefault();if(q.key==="ArrowRight")return xe(1),q.preventDefault();if(q.key==="ArrowLeft")return xe(-1),q.preventDefault()},[k,K,xe,de]),he=hc(q=>{Gd(q.target,"input")&&m(()=>q.target.value)},[m]);np(()=>(f(),()=>{g()}),[]);const W=!v&&h.length>0,le=(a||o.length>0)&&!W;return It`
|
|
171
|
+
<${hE}
|
|
173
172
|
onClose=${t}
|
|
174
173
|
onKeyup=${he}
|
|
175
174
|
onKeydown=${we}
|
|
@@ -180,16 +179,16 @@
|
|
|
180
179
|
navigationStack=${h}
|
|
181
180
|
>
|
|
182
181
|
${le&&It`
|
|
183
|
-
<${
|
|
182
|
+
<${VN}
|
|
184
183
|
headerEntries=${o}
|
|
185
184
|
onSelect=${n}
|
|
186
185
|
selectedEntry=${k}
|
|
187
|
-
setSelectedEntry=${
|
|
186
|
+
setSelectedEntry=${T}
|
|
188
187
|
title=${a}
|
|
189
188
|
/>
|
|
190
189
|
`}
|
|
191
190
|
${W&&It`
|
|
192
|
-
<${
|
|
191
|
+
<${GN}
|
|
193
192
|
navigationStack=${h}
|
|
194
193
|
setNavigationStack=${y}
|
|
195
194
|
/>
|
|
@@ -221,10 +220,10 @@
|
|
|
221
220
|
</div>
|
|
222
221
|
`}
|
|
223
222
|
|
|
224
|
-
<${
|
|
223
|
+
<${YN}
|
|
225
224
|
groupedEntries=${I}
|
|
226
225
|
selectedEntry=${k}
|
|
227
|
-
setSelectedEntry=${
|
|
226
|
+
setSelectedEntry=${T}
|
|
228
227
|
keyboardSelection=${z}
|
|
229
228
|
onAction=${de}
|
|
230
229
|
idPrefix=${G}
|
|
@@ -255,13 +254,13 @@
|
|
|
255
254
|
</div>
|
|
256
255
|
`}
|
|
257
256
|
${u&&C.length===0&&It`
|
|
258
|
-
<div class="djs-popup-no-results">${En(u)?u(
|
|
257
|
+
<div class="djs-popup-no-results">${En(u)?u(_):u}</div>
|
|
259
258
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
259
|
+
</${hE}>
|
|
260
|
+
`}function hE(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=ip();return mg(()=>{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]),mg(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),np(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Nr(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)}},[]),It`
|
|
262
261
|
<div
|
|
263
262
|
class=${rp("djs-popup",o)}
|
|
264
|
-
style=${
|
|
263
|
+
style=${JN(e)}
|
|
265
264
|
onKeydown=${n}
|
|
266
265
|
onKeyup=${i}
|
|
267
266
|
ref=${c}
|
|
@@ -269,8 +268,8 @@
|
|
|
269
268
|
>
|
|
270
269
|
${r}
|
|
271
270
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
271
|
+
`}function JN(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:yn(t)?n:void 0,maxWidth:yn(t)?"unset":void 0,"transform-origin":"top left"}}function QN(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function e$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function t$(e){const t=[],n=r=>t.find(a=>r.id===a.id),i=r=>!!n(r),o=r=>typeof r=="string"?{id:r}:r;return e.forEach(r=>{const a=r.group?o(r.group):{id:"default"};i(a)?n(a).entries.push(r):t.push({...a,entries:[r]})}),t}var n$="data-id",gE=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],i$=1e3;function qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=yn(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}qt.$inject=["config.popupMenu","eventBus","canvas","search"],qt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=mE(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);J0(It`
|
|
272
|
+
<${ZN}
|
|
274
273
|
onClose=${d=>this.close(d)}
|
|
275
274
|
onSelect=${(d,f,g)=>this.trigger(d,f,g)}
|
|
276
275
|
position=${c}
|
|
@@ -284,7 +283,7 @@
|
|
|
284
283
|
searchFn=${this._search}
|
|
285
284
|
...${{...r}}
|
|
286
285
|
/>
|
|
287
|
-
`,this._current.container)},qt.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 o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},qt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},qt.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),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},qt.prototype.reset=function(){const e=this._current.container;
|
|
286
|
+
`,this._current.container)},qt.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 o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},qt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},qt.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),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},qt.prototype.reset=function(){const e=this._current.container;J0(null,e),eo(e)},qt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},qt.prototype._onOpened=function(){this._emit("opened")},qt.prototype._onClosed=function(){this._emit("closed")},qt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ht(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},qt.prototype._bindAutoClose=function(){this._eventBus.once(gE,this.close,this)},qt.prototype._unbindAutoClose=function(){this._eventBus.off(gE,this.close,this)},qt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),yn(n)&&e<n&&(o=n),yn(i)&&e>i&&(o=i)),o},qt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},qt.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},qt.prototype.registerProvider=function(e,t,n){n||(n=t,t=i$),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},qt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},qt.prototype._getEntries=function(e,t){var n={};return V(t,function(i){if(!i.getPopupMenuEntries){V(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=Ki(r,["id"])});return}var o=i.getPopupMenuEntries(e);En(o)?n=o(n):V(o,function(r,a){n[a]=r})}),n},qt.prototype._getHeaderEntries=function(e,t){var n={};return V(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;V(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=Ki(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);En(o)?n=o(n):V(o,function(r,a){n[a]=r})}),n},qt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>En(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},qt.prototype.isOpen=function(){return!!this._current},qt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Nr(e.delegateTarget||e.target,".entry",!0),r=An(o,n$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(En(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},qt.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 mE(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=mE(o.entries,[...t,...yE(o.search)]):t.length&&(o.search=[...t,...yE(o.search)]),o})}function yE(e){return e?Je(e)?e:[e]:[]}function o$(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const o=t.trim().toLowerCase().split(/\s+/);return e.flatMap(r=>{const a=r$(r,o,i);return a?{item:r,tokens:a}:[]}).sort(a$(i))}function r$(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Je(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=_E(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):_E(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function a$(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=s$(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=vE;continue}const s=c$(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=vE;continue}}return i}}function s$(e,t){return xE(t)-xE(e)}const vE=.5,qa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function xE(e){const t=e.reduce((s,c)=>s+bE(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),o=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),r=i?o/i:0;return t*(1+r)}function bE(e){if(Je(e))return Math.max(...e.map(bE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?qa.FULL:e.wordEnd?qa.START_FULL_WORD:qa.START_WORD_PART:e.wordStart?qa.WORD_START:qa.WORD_PART)*t:qa.NO_MATCH*t}function wE(e=""){return Je(e)?e.join(", "):e}function c$(e,t){return wE(e).localeCompare(wE(t))}function _E(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(l$),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),a=new RegExp(r,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,d=s.index+u.length,f=p===0,g=d===e.length,h=!!((l=s.groups)!=null&&l.all),y=f||/\s/.test(e.charAt(p-1)),_=g||/\s/.test(e.charAt(d));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:_,start:f,end:g,all:h});const m=h?t:[u];for(const v of m)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function l$(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const EE={search:["value",o$]},xg={__depends__:[EE],__init__:["popupMenu"],popupMenu:["type",qt]};var SE={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
|
|
288
287
|
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
289
288
|
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
290
289
|
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -312,8 +311,8 @@
|
|
|
312
311
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
313
312
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
314
313
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
315
|
-
</svg>`},zN=900;function Ya(e,t,n,i){e.registerProvider(zN,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ya.$inject=["contextPad","popupMenu","translate","canvas"],Ya.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&Y(t,this._getEntries(e)),t},Ya.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ya.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${dE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);Y(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ya.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),o={x:i.left,y:i.bottom+t};return o};var GN=["left","center","right","top","middle","bottom"];function hc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}hc.$inject=["popupMenu","alignElements","translate","rules"],hc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Y(t,this._getEntries(e)),t},hc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},hc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return V(GN,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:dE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function ap(e){Mi.call(this,e)}ap.$inject=["eventBus"],Be(ap,Mi),ap.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=lt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xl(n),n.length<2?!1:n})};const VN={__depends__:[tN,E0,vg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ya],alignElementsMenuProvider:["type",hc],bpmnAlignElements:["type",ap]};function Ka(e,t,n){this._canvas=n,this._opts=Y({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ka.$inject=["config.autoScroll","eventBus","canvas"],Ka.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)WN(r[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 WN(e,t,n){return t<e&&e<n}Ka.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ka.prototype.setOptions=function(e){this._opts=Y({},this._opts,e)},Ka.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Gr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const UN={__depends__:[Co],__init__:["autoScroll"],autoScroll:["type",Ka]};var fE="djs-bendpoint",hE="djs-segment-dragger";function qN(e,t){var n=Gr(t),i=e._container.getBoundingClientRect(),o;o={x:i.left,y:i.top};var r=e.viewbox();return{x:r.x+(n.x-o.x)/r.scale,y:r.y+(n.y-o.y)/r.scale}}function xg(e,t,n){var i=qN(e,n),o=Af(t,i);return o}function bg(e,t){var n=He("g");dt(n).add(fE),nt(e,n);var i=He("circle");Le(i,{cx:0,cy:0,r:4}),dt(i).add("djs-visual"),nt(n,i);var o=He("circle");return Le(o,{cx:0,cy:0,r:10}),dt(o).add("djs-hit"),nt(n,o),t&&dt(n).add(t),n}function YN(e,t,n,i){var o=He("g");nt(e,o);var r=18,a=6,s=11,c=XN(t,n,i),l=a+s,u=He("rect");Le(u,{x:-r/2,y:-a/2,width:r,height:a}),dt(u).add("djs-visual"),nt(o,u);var p=He("rect");return Le(p,{x:-c/2,y:-l/2,width:c,height:l}),dt(p).add("djs-hit"),nt(o,p),gx(o,i==="v"?90:0),o}function gE(e,t,n){var i=He("g"),o=nf(t,n),r=bo(t,n);return nt(e,i),YN(i,t,n,r),dt(i).add(hE),dt(i).add(r==="h"?"horizontal":"vertical"),In(i,o.x,o.y),i}function wg(e){return Math.abs(Math.round(e*2/3))}function KN(e,t){var n=ZN(e,t);return Lf(e,n)}function XN(e,t,n){var i=t.x-e.x,o=t.y-e.y;return wg(n==="h"?i:o)}function ZN(e,t){for(var n=t.waypoints,i=1/0,o,r=0;r<n.length-1;r++){var a=n[r],s=n[r+1],c=ib(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function mE(e,t,n,i,o){function r(v,b,E){var C=v.index,I=v.point,k,P,F,z,G,ne;return C<=0||v.bendpoint?!1:(k=b[C-1],P=b[C],F=nf(k,P),z=bo(k,P),G=Math.abs(I.x-F.x),ne=Math.abs(I.y-F.y),z&&G<=E&&ne<=E)}function a(v,b){var E=v.waypoints,C,I,k,P;return b.index<=0||b.bendpoint||(C={start:E[b.index-1],end:E[b.index]},I=bo(C.start,C.end),!I)?null:(I==="h"?k=C.end.x-C.start.x:k=C.end.y-C.start.y,P=wg(k)/2,P)}function s(v,b){var E=b.waypoints,C=xg(t,E,v),I;if(C){I=a(b,C);var k;if(r(C,E,I)?k=o.start(v,b,C.index):k=i.start(v,b,C.index,!C.bendpoint),k!==!1)return!0}}function c(v,b,E){Ue.bind(v,b,function(C){n.triggerMouseEvent(b,C,E),C.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),C=Rt('.djs-bendpoints[data-element-id="'+Xr(v.id)+'"]',E);return!C&&b&&(C=He("g"),Le(C,{"data-element-id":v.id}),dt(C).add("djs-bendpoints"),nt(E,C),c(C,"mousedown",v),c(C,"click",v),c(C,"dblclick",v)),C}function u(v,b){return Rt('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,C){var I=bg(v);nt(v,I),In(I,E.x,E.y)}),bg(v,"floating")}function d(v,b){for(var E=b.waypoints,C,I,k,P=1;P<E.length;P++)C=E[P-1],I=E[P],bo(C,I)&&(k=gE(v,C,I),Le(k,{"data-segment-idx":P}),c(k,"mousemove",b))}function f(v){V(Es("."+fE,v),function(b){cn(b)})}function g(v){V(Es("."+hE,v),function(b){cn(b)})}function h(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function y(v){var b=l(v);b&&(g(b),f(b),d(b,v),p(b,v))}function w(v,b){var E=Rt(".floating",v),C=b.point;E&&(In(E,C.x,C.y),dt(E).add("positioned"))}function m(v,b,E){var C=u(b.index,v),I=E[b.index-1],k=E[b.index],P=b.point,F=nf(I,k),z=bo(I,k),G,ne;C&&(G=JN(C),ne={x:P.x-F.x,y:P.y-F.y},z==="v"&&(ne={x:ne.y,y:ne.x}),In(G,ne.x,ne.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&cn(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=h(b),v.add?dt(E).add(v.marker):dt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,E=b.waypoints,C,I;if(E){if(C=l(b,!0),I=xg(t,E,v.originalEvent),!I)return;w(C,I),I.bendpoint||m(C,I,E)}}),e.on("element.mousedown",function(v){if(ir(v)){var b=v.originalEvent,E=v.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(v){var b=v.newSelection,E=b[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&h(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var C=Rt(".floating",E);C&&dt(C).remove("positioned")}}}),e.on("element.updateId",function(v){var b=v.element,E=v.newId;if(b.waypoints){var C=l(b);C&&Le(C,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}mE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function JN(e){return Rt(".djs-visual",e)}var yE=Math.round,Qr="reconnectStart",ea="reconnectEnd",gc="updateWaypoints";function _g(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,d=s.target,f=s.waypoints,g;!l&&c===0?g=Qr:!l&&c===f.length-1?g=ea:g=gc;var h=g===gc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(h,{connection:s,source:p,target:d});if(y===!1&&(y=o.allowed(h,{connection:s,source:d,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:d,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,d=s.type;s.hover=p;var f;if(p){var g=d===gc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(g,{connection:c,source:d===Qr?p:l,target:d===ea?p:u}),f){s.source=d===Qr?p:l,s.target=d===ea?p:u;return}f===!1&&(f=s.allowed=o.allowed(g,{connection:c,source:d===ea?p:u,target:d===Qr?p:l})),f&&(s.source=d===ea?p:u,s.target=d===Qr?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!==gc&&(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,d=u.waypoints.slice(),f=s.source,g=s.target,h=s.type,y=s.hints||{},w={x:yE(a.x),y:yE(a.y)};if(!c)return!1;h===gc?(p?d.splice(l,0,w):d[l]=w,y.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,DT(d),y)):(h===Qr?(y.docking="source",sp(s)&&(y.docking="target",y.newWaypoints=d.reverse())):h===ea&&(y.docking="target",sp(s)&&(y.docking="source",y.newWaypoints=d.reverse())),r.reconnect(u,f,g,w,y))},this)}_g.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],_g.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 sp(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Qr)return t&&i&&t===i&&n!==i;if(o===ea)return t&&n&&t===n&&n!==i}var QN="reconnectStart",e$="reconnectEnd",vE="updateWaypoints",mc="connect-ok",cp="connect-not-ok",xE="connect-hover",bE="djs-updating",wE="djs-dragging",_E=1100;function EE(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.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:r.x,y:r.y}),c.waypoints=p;var d=a.draggerGfx=bg(i.getLayer("overlays"));dt(d).add("djs-dragging"),i.addMarker(c,wE),i.addMarker(c,bE)}),n.on("bendpoint.move.hover",function(r){var a=r.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,xE),l===vE)return;s?(i.removeMarker(c,cp),i.addMarker(c,mc)):s===!1&&(i.removeMarker(c,mc),i.addMarker(c,cp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],_E,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,xE),i.removeMarker(s,c?mc:cp))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,d=a.connection,f=d.source,g=d.target,h=d.waypoints.slice(),y={x:r.x,y:r.y},w=a.hints||{},m={};o&&(w.connectionStart&&(m.connectionStart=w.connectionStart),w.connectionEnd&&(m.connectionEnd=w.connectionEnd),p===QN?sp(a)?(m.connectionEnd=m.connectionEnd||y,m.source=g,m.target=u||f,h=h.reverse()):(m.connectionStart=m.connectionStart||y,m.source=u||f,m.target=g):p===e$?sp(a)?(m.connectionStart=m.connectionStart||y,m.source=u||g,m.target=f,h=h.reverse()):(m.connectionEnd=m.connectionEnd||y,m.source=f,m.target=u||g):(m.noCropping=!0,m.noLayout=!0,h[c]=y),p===vE&&(h=e.cropWaypoints(d,h)),m.waypoints=h,o.drawPreview(a,s,m)),In(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],_E,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,cn(c),i.removeMarker(s,bE),i.removeMarker(s,wE),l&&(i.removeMarker(l,mc),i.removeMarker(l,u?mc:cp)),o&&o.cleanUp(a)})}EE.$inject=["bendpointMove","injector","eventBus","canvas"];var SE="connect-hover",RE="djs-updating";function CE(e,t,n){return Eg(e,t,e[t]+n)}function Eg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function t$(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(r+a,e[i]),o-a);return Eg(t,i,s)}function ME(e){return e==="x"?"y":"x"}function AE(e,t,n){var i,o;return e.original?e.original:(i=et(t),o=ME(n),Eg(e,o,i[o]))}function PE(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var g,h=n.getGraphics(d),y=f-1,w=f,m=d.waypoints,v=m[y],b=m[w],E=xg(n,m,p),C,I,k;if(C=bo(v,b),!!C)return I=C==="v"?"x":"y",y===0&&(v=AE(v,d.source,I)),w===m.length-1&&(b=AE(b,d.target,I)),E?k=E.point:k={x:(v.x+b.x)/2,y:(v.y+b.y)/2},g={connection:d,segmentStartIndex:y,segmentEndIndex:w,segmentStart:v,segmentEnd:b,axis:I,dragPosition:k},i.init(p,k,"connectionSegment.move",{cursor:I==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:h,context:g}})};function s(p,d){if(!a)return d;var f=p.waypoints,g;return p.waypoints=d,g=a.getCroppedWaypoints(p),p.waypoints=f,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var g=p.newWaypoints,h=p.segmentStartIndex+d,y=g[h],w=p.segmentEndIndex+d,m=g[w],v=ME(p.axis),b=t$(f,y,m,v);In(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,g=p.filter(function(h,y){return tf(p[y-1],p[y+1],h)?(f=y<=d?f-1:f,!1):!0});return{waypoints:g,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,g=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=gE(g,d.segmentStart,d.segmentEnd),dt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,RE)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,g=d.segmentStartIndex,h=d.segmentEndIndex,y=d.segmentStart,w=d.segmentEnd,m=d.axis,v=d.originalWaypoints.slice(),b=CE(y,m,p["d"+m]),E=CE(w,m,p["d"+m]),C=v.length,I=0;v[g]=b,v[h]=E;var k,P;g<2&&(k=Ln(f.source,b),g===1?k==="intersect"&&(v.shift(),v[0]=b,I--):k!=="intersect"&&(v.unshift(y),I++)),h>C-3&&(P=Ln(f.target,E),h===C-2?P==="intersect"&&(v.pop(),v[v.length-1]=E):P!=="intersect"&&v.push(w)),d.newWaypoints=f.waypoints=s(f,v),l(d,I,p),d.newSegmentStartIndex=g+I,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,SE)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,SE)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&cn(d.draggerGfx),n.removeMarker(f,RE)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var d=p.context,f=d.connection;f.waypoints=d.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var d=p.context,f=d.connection,g=d.newWaypoints,h=d.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var y=u(g,h),w=y.waypoints,m=s(f,w),v=y.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(f,m,b)})}PE.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var n$=Math.abs,TE=Math.round;function i$(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],n$(o-e)<=n)return o}function kE(e){return{x:e.x,y:e.y}}function OE(e){return{x:e.x+e.width,y:e.y+e.height}}function ki(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:TE(e.x+e.width/2),y:TE(e.y+e.height/2)}}function Xa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function fn(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,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function DE(e){return e.children||[]}var o$=Math.abs,LE=Math.round,Sg=10;function IE(e){function t(r,a){if(Je(r)){for(var s=r.length;s--;)if(o$(r[s]-a)<=Sg)return r[s]}else{r=+r;var c=a%r;if(c<Sg)return a-c;if(c>r-Sg)return a-c+r}return a}function n(r,a){if(r.waypoints)return KN(a,r);if(r.width)return{x:LE(r.width/2+r.x),y:LE(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,d=a.segmentEnd,f=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,d,l[f+1]];return p<2&&h.unshift(n(c.source,r)),f>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},V(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(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,d=c-u;Y(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&fn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&fn(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},V(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(r){var a=r.context,s=a.hover,c=s&&n(s,r);!Dt(s)||!c||!c.x||!c.y||(fn(r,"x",c.x),fn(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,d,f;if(s){d=t(l?s.vertical.concat([l.x]):s.vertical,u),f=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-d,h=p-f;Y(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&fn(r,"x",d),(h||s.horizontal.indexOf(p)!==-1)&&fn(r,"y",f)}})}IE.$inject=["eventBus"];const r$={__depends__:[Co,ao],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",mE],bendpointMove:["type",_g],bendpointMovePreview:["type",EE],connectionSegmentMove:["type",PE],bendpointSnapping:["type",IE]};function BE(e,t,n,i){function o(a,s){return i.allowed("connection.create",{source:a,target:s})}function r(a,s){return o(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=o(c,l),!la(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!la(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,d=s.target;if(!c)return!1;var f=null,g={connectionStart:Rg(s)?u:l,connectionEnd:Rg(s)?l:u};vn(c)&&(f=c),s.connection=n.connect(p,d,f,g)}),this.start=function(a,s,c,l){vn(c)||(l=c,c=et(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}BE.$inject=["eventBus","dragging","modeling","rules"];function Rg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var a$=1100,s$=900,NE="connect-ok",$E="connect-not-ok";function FE(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,d=r.connectionStart||u,f=r.connectionEnd||{x:o.x,y:o.y},g=d,h=f;Rg(r)&&(g=f,h=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",s$,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?NE:$E)}),t.on(["connect.out","connect.cleanup"],a$,function(o){var r=o.hover;r&&(n.removeMarker(r,NE),n.removeMarker(r,$E))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}FE.$inject=["injector","eventBus","canvas"];const Cg={__depends__:[Ai,ao,Co],__init__:["connectPreview"],connect:["type",BE],connectPreview:["type",FE]};var c$="djs-dragger";function Do(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)}Do.$inject=["injector","canvas","graphicsFactory","elementFactory"],Do.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,d=n.noNoop,f,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ss(i),o||(o=e.getConnection=l$(function(h,y,w){return g.getConnection(h,y,w)})),t&&(f=o(t,r,a)),!f){!d&&this.drawNoopPreview(i,n);return}f.waypoints=s||[],this._layouter&&!u&&(f.waypoints=this._layouter.layoutConnection(f,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||f.waypoints})),(!f.waypoints||!f.waypoints.length)&&(f.waypoints=[r?et(r):c,a?et(a):l]),this._connectionDocking&&(r||a)&&!p&&(f.waypoints=this._connectionDocking.getCroppedWaypoints(f,r,a)),this._graphicsFactory.drawConnection(i,f,{stroke:"var(--element-dragger-color)"})},Do.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||et(n),r=t.connectionEnd||et(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);nt(e,s)},Do.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return e=n&&ks(r,s,!0)||e,t=i&&ks(a,s,!1)||t,[e,t]},Do.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&cn(e.connectionPreviewGfx)},Do.prototype.getConnection=function(e){var t=u$(e);return this._elementFactory.createConnection(t)},Do.prototype.createConnectionPreviewGfx=function(){var e=He("g");return Le(e,{pointerEvents:"none"}),dt(e).add(c$),nt(this._canvas.getActiveLayer(),e),e},Do.prototype.createNoopConnection=function(e,t){return Ms([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function l$(e){var t={};return function(n){var i=JSON.stringify(n),o=t[i];return o||(o=t[i]=e.apply(null,arguments)),o}}function u$(e){return vn(e)?e:{}}const p$={__init__:["connectionPreview"],connectionPreview:["type",Do]},lp="complex-preview";class jE{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:o=[],resized:r=[]}=t,a=this._canvas.getLayer(lp);n.filter(s=>!d$(s)).forEach(s=>{let c;Dt(s)?(c=this._graphicsFactory._createContainer("connection",He("g")),this._graphicsFactory.drawConnection(Zo(c),s)):(c=this._graphicsFactory._createContainer("shape",He("g")),this._graphicsFactory.drawShape(Zo(c),s),In(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);Dt(s)?In(l,c.x,c.y):In(l,s.x+c.x,s.y+c.y)}),o.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"])}),r.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",He("g"));this._graphicsFactory.drawShape(Zo(l),s,{width:c.width,height:c.height}),In(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Ss(this._canvas.getLayer(lp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(lp)}hide(){this._canvas.hideLayer(lp)}}jE.$inject=["canvas","graphicsFactory","previewSupport"];function d$(e){return e.hidden}const f$={__depends__:[$a],__init__:["complexPreview"],complexPreview:["type",jE]},HE=Math.round;function up(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}up.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(Y({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;Y(l,{x:u.x-HE(l.width/2),y:u.y-HE(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;p&&(d=r.createConnection(p),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=o.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter(f=>!la(f))})},up.prototype.cleanUp=function(){this._complexPreview.cleanUp()},up.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const h$={__depends__:[Pu,f$,zh],__init__:["appendPreview"],appendPreview:["type",up]};var zE=Math.min,GE=Math.max;function Mg(e){e.preventDefault()}function yc(e){e.stopPropagation()}function g$(e){return e.nodeType===Node.TEXT_NODE}function m$(e){return[].slice.call(e)}function Vi(e){this.container=e.container,this.parent=Ht('<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=Zn(this.autoResize,this),this.handlePaste=Zn(this.handlePaste,this)}Vi.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=$i(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);Y(r.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=$i(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return Y(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&Y(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ue.bind(a,"keydown",this.keyHandler),Ue.bind(a,"mousedown",yc),Ue.bind(a,"paste",o.handlePaste),Ue.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ue.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Vi.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 o=this.autoResize(n);o&&this.resizeHandler(o)}},Vi.prototype.insertText=function(e){e=y$(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Vi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=m$(a.childNodes),c,l;if(g$(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var d=s.indexOf(n),f=s.indexOf(i);s.forEach(function(g,h){h===d?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>d&&h<=f&&eo(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Vi.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(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},Vi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Ht('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Mg(g),yc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ue.bind(document,"mousemove",d),Ue.bind(document,"mouseup",f)},d=function(g){Mg(g),yc(g);var h=zE(GE(l+g.clientX-s,i),r),y=zE(GE(u+g.clientY-c,o),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})},f=function(g){Mg(g),yc(g),Ue.unbind(document,"mousemove",d,!1),Ue.unbind(document,"mouseup",f,!1)};Ue.bind(n,"mousedown",p)}Y(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)},Vi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ue.unbind(t,"keydown",this.keyHandler),Ue.unbind(t,"mousedown",yc),Ue.unbind(t,"input",this.autoResize),Ue.unbind(t,"paste",this.handlePaste),Ue.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),eo(n)),eo(e)},Vi.prototype.getValue=function(){return this.content.innerText.trim()},Vi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Vi.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 y$(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function fi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Vi({container:t.getContainer(),keyHandler:Zn(this._handleKey,this),resizeHandler:Zn(this._handleResize,this),focusoutHandler:Zn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}fi.$inject=["eventBus","canvas"],fi.prototype.registerProvider=function(e){this._providers.push(e)},fi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},fi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},fi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},fi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},fi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},fi.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue(),r=e.context.text;(o!==r||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},fi.prototype.getValue=function(){return this._textbox.getValue()},fi.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()},fi.prototype._handleResize=function(e){this._fire("resize",e)},fi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},fi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Bt(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 VE={__depends__:[ru],__init__:["directEditing"],directEditing:["type",fi]};function v$(e){return function(t){var n=t.target,i=Ee(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ft(e);return!r||!a||!s||!c}}const x$={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 be(e,t={}){var n=x$[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var b$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start")],w$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"})],_$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-intermediate-catch"),be("message-intermediate-throw"),be("timer-intermediate-catch"),be("escalation-intermediate-throw"),be("conditional-intermediate-catch"),be("link-intermediate-catch"),be("link-intermediate-throw"),be("compensation-intermediate-throw"),be("signal-intermediate-catch"),be("signal-intermediate-throw")],E$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-end"),be("escalation-end"),be("error-end"),be("cancel-end"),be("compensation-end"),be("signal-end"),be("terminate-end")],S$=[be("exclusive-gateway"),be("parallel-gateway"),be("inclusive-gateway"),be("complex-gateway"),be("event-based-gateway")],R$=[be("transaction"),be("event-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("collapsed-subprocess")],C$=[be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("transaction"),be("event-subprocess"),be("collapsed-ad-hoc-subprocess")],WE=[be("transaction"),be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("event-subprocess")],M$=WE,UE=[be("task"),be("user-task"),be("service-task"),be("send-task"),be("receive-task"),be("manual-task"),be("rule-task"),be("script-task"),be("call-activity"),be("collapsed-subprocess"),be("expanded-subprocess"),be("collapsed-ad-hoc-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],A$=[be("data-store-reference")],P$=[be("data-object-reference")],T$=[be("message-boundary"),be("timer-boundary"),be("escalation-boundary"),be("conditional-boundary"),be("error-boundary"),be("cancel-boundary"),be("signal-boundary"),be("compensation-boundary"),be("non-interrupting-message-boundary"),be("non-interrupting-timer-boundary"),be("non-interrupting-escalation-boundary"),be("non-interrupting-conditional-boundary"),be("non-interrupting-signal-boundary")],k$=[be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start"),be("error-start"),be("escalation-start"),be("compensation-start"),be("non-interrupting-message-start"),be("non-interrupting-timer-start"),be("non-interrupting-conditional-start"),be("non-interrupting-signal-start"),be("non-interrupting-escalation-start")],O$=[{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"}],D$=[be("expanded-pool"),be("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],L$={"bpmn:MessageEventDefinition":[be("message-start"),be("message-intermediate-catch"),be("message-intermediate-throw"),be("message-end")],"bpmn:TimerEventDefinition":[be("timer-start"),be("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[be("conditional-start"),be("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[be("signal-start"),be("signal-intermediate-catch"),be("signal-intermediate-throw"),be("signal-end")],"bpmn:ErrorEventDefinition":[be("error-start"),be("error-end")],"bpmn:EscalationEventDefinition":[be("escalation-start"),be("escalation-intermediate-throw"),be("escalation-end")],"bpmn:CompensateEventDefinition":[be("compensation-start"),be("compensation-intermediate-throw"),be("compensation-end")]};const qE={"start-event-non-interrupting":`
|
|
314
|
+
</svg>`},u$=900;function Ya(e,t,n,i){e.registerProvider(u$,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Ya.$inject=["contextPad","popupMenu","translate","canvas"],Ya.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&Y(t,this._getEntries(e)),t},Ya.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Ya.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${SE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);Y(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Ya.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),o={x:i.left,y:i.bottom+t};return o};var p$=["left","center","right","top","middle","bottom"];function gc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}gc.$inject=["popupMenu","alignElements","translate","rules"],gc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Y(t,this._getEntries(e)),t},gc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},gc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return V(p$,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:SE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function ap(e){Mi.call(this,e)}ap.$inject=["eventBus"],Be(ap,Mi),ap.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=lt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=bl(n),n.length<2?!1:n})};const d$={__depends__:[EN,I0,xg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Ya],alignElementsMenuProvider:["type",gc],bpmnAlignElements:["type",ap]};function Ka(e,t,n){this._canvas=n,this._opts=Y({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ka.$inject=["config.autoScroll","eventBus","canvas"],Ka.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,o=t.getContainer().getBoundingClientRect(),r=[e.x,e.y,o.width-e.x,o.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)f$(r[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 f$(e,t,n){return t<e&&e<n}Ka.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ka.prototype.setOptions=function(e){this._opts=Y({},this._opts,e)},Ka.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Gr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const h$={__depends__:[Co],__init__:["autoScroll"],autoScroll:["type",Ka]};var RE="djs-bendpoint",CE="djs-segment-dragger";function g$(e,t){var n=Gr(t),i=e._container.getBoundingClientRect(),o;o={x:i.left,y:i.top};var r=e.viewbox();return{x:r.x+(n.x-o.x)/r.scale,y:r.y+(n.y-o.y)/r.scale}}function bg(e,t,n){var i=g$(e,n),o=Tf(t,i);return o}function wg(e,t){var n=He("g");dt(n).add(RE),nt(e,n);var i=He("circle");Le(i,{cx:0,cy:0,r:4}),dt(i).add("djs-visual"),nt(n,i);var o=He("circle");return Le(o,{cx:0,cy:0,r:10}),dt(o).add("djs-hit"),nt(n,o),t&&dt(n).add(t),n}function m$(e,t,n,i){var o=He("g");nt(e,o);var r=18,a=6,s=11,c=v$(t,n,i),l=a+s,u=He("rect");Le(u,{x:-r/2,y:-a/2,width:r,height:a}),dt(u).add("djs-visual"),nt(o,u);var p=He("rect");return Le(p,{x:-c/2,y:-l/2,width:c,height:l}),dt(p).add("djs-hit"),nt(o,p),Mx(o,i==="v"?90:0),o}function ME(e,t,n){var i=He("g"),o=of(t,n),r=bo(t,n);return nt(e,i),m$(i,t,n,r),dt(i).add(CE),dt(i).add(r==="h"?"horizontal":"vertical"),In(i,o.x,o.y),i}function _g(e){return Math.abs(Math.round(e*2/3))}function y$(e,t){var n=x$(e,t);return If(e,n)}function v$(e,t,n){var i=t.x-e.x,o=t.y-e.y;return _g(n==="h"?i:o)}function x$(e,t){for(var n=t.waypoints,i=1/0,o,r=0;r<n.length-1;r++){var a=n[r],s=n[r+1],c=gb(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function AE(e,t,n,i,o){function r(v,b,E){var C=v.index,I=v.point,k,T,F,z,G,ne;return C<=0||v.bendpoint?!1:(k=b[C-1],T=b[C],F=of(k,T),z=bo(k,T),G=Math.abs(I.x-F.x),ne=Math.abs(I.y-F.y),z&&G<=E&&ne<=E)}function a(v,b){var E=v.waypoints,C,I,k,T;return b.index<=0||b.bendpoint||(C={start:E[b.index-1],end:E[b.index]},I=bo(C.start,C.end),!I)?null:(I==="h"?k=C.end.x-C.start.x:k=C.end.y-C.start.y,T=_g(k)/2,T)}function s(v,b){var E=b.waypoints,C=bg(t,E,v),I;if(C){I=a(b,C);var k;if(r(C,E,I)?k=o.start(v,b,C.index):k=i.start(v,b,C.index,!C.bendpoint),k!==!1)return!0}}function c(v,b,E){Ue.bind(v,b,function(C){n.triggerMouseEvent(b,C,E),C.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),C=Rt('.djs-bendpoints[data-element-id="'+Xr(v.id)+'"]',E);return!C&&b&&(C=He("g"),Le(C,{"data-element-id":v.id}),dt(C).add("djs-bendpoints"),nt(E,C),c(C,"mousedown",v),c(C,"click",v),c(C,"dblclick",v)),C}function u(v,b){return Rt('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,C){var I=wg(v);nt(v,I),In(I,E.x,E.y)}),wg(v,"floating")}function d(v,b){for(var E=b.waypoints,C,I,k,T=1;T<E.length;T++)C=E[T-1],I=E[T],bo(C,I)&&(k=ME(v,C,I),Le(k,{"data-segment-idx":T}),c(k,"mousemove",b))}function f(v){V(Es("."+RE,v),function(b){ln(b)})}function g(v){V(Es("."+CE,v),function(b){ln(b)})}function h(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function y(v){var b=l(v);b&&(g(b),f(b),d(b,v),p(b,v))}function _(v,b){var E=Rt(".floating",v),C=b.point;E&&(In(E,C.x,C.y),dt(E).add("positioned"))}function m(v,b,E){var C=u(b.index,v),I=E[b.index-1],k=E[b.index],T=b.point,F=of(I,k),z=bo(I,k),G,ne;C&&(G=b$(C),ne={x:T.x-F.x,y:T.y-F.y},z==="v"&&(ne={x:ne.y,y:ne.x}),In(G,ne.x,ne.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&ln(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=h(b),v.add?dt(E).add(v.marker):dt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,E=b.waypoints,C,I;if(E){if(C=l(b,!0),I=bg(t,E,v.originalEvent),!I)return;_(C,I),I.bendpoint||m(C,I,E)}}),e.on("element.mousedown",function(v){if(ir(v)){var b=v.originalEvent,E=v.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(v){var b=v.newSelection,E=b[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&h(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var C=Rt(".floating",E);C&&dt(C).remove("positioned")}}}),e.on("element.updateId",function(v){var b=v.element,E=v.newId;if(b.waypoints){var C=l(b);C&&Le(C,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}AE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function b$(e){return Rt(".djs-visual",e)}var TE=Math.round,Qr="reconnectStart",ea="reconnectEnd",mc="updateWaypoints";function Eg(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,d=s.target,f=s.waypoints,g;!l&&c===0?g=Qr:!l&&c===f.length-1?g=ea:g=mc;var h=g===mc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(h,{connection:s,source:p,target:d});if(y===!1&&(y=o.allowed(h,{connection:s,source:d,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:d,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,d=s.type;s.hover=p;var f;if(p){var g=d===mc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(g,{connection:c,source:d===Qr?p:l,target:d===ea?p:u}),f){s.source=d===Qr?p:l,s.target=d===ea?p:u;return}f===!1&&(f=s.allowed=o.allowed(g,{connection:c,source:d===ea?p:u,target:d===Qr?p:l})),f&&(s.source=d===ea?p:u,s.target=d===Qr?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!==mc&&(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,d=u.waypoints.slice(),f=s.source,g=s.target,h=s.type,y=s.hints||{},_={x:TE(a.x),y:TE(a.y)};if(!c)return!1;h===mc?(p?d.splice(l,0,_):d[l]=_,y.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,tk(d),y)):(h===Qr?(y.docking="source",sp(s)&&(y.docking="target",y.newWaypoints=d.reverse())):h===ea&&(y.docking="target",sp(s)&&(y.docking="source",y.newWaypoints=d.reverse())),r.reconnect(u,f,g,_,y))},this)}Eg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Eg.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 sp(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Qr)return t&&i&&t===i&&n!==i;if(o===ea)return t&&n&&t===n&&n!==i}var w$="reconnectStart",_$="reconnectEnd",PE="updateWaypoints",yc="connect-ok",cp="connect-not-ok",kE="connect-hover",OE="djs-updating",DE="djs-dragging",LE=1100;function IE(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.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:r.x,y:r.y}),c.waypoints=p;var d=a.draggerGfx=wg(i.getLayer("overlays"));dt(d).add("djs-dragging"),i.addMarker(c,DE),i.addMarker(c,OE)}),n.on("bendpoint.move.hover",function(r){var a=r.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,kE),l===PE)return;s?(i.removeMarker(c,cp),i.addMarker(c,yc)):s===!1&&(i.removeMarker(c,yc),i.addMarker(c,cp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],LE,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,kE),i.removeMarker(s,c?yc:cp))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,d=a.connection,f=d.source,g=d.target,h=d.waypoints.slice(),y={x:r.x,y:r.y},_=a.hints||{},m={};o&&(_.connectionStart&&(m.connectionStart=_.connectionStart),_.connectionEnd&&(m.connectionEnd=_.connectionEnd),p===w$?sp(a)?(m.connectionEnd=m.connectionEnd||y,m.source=g,m.target=u||f,h=h.reverse()):(m.connectionStart=m.connectionStart||y,m.source=u||f,m.target=g):p===_$?sp(a)?(m.connectionStart=m.connectionStart||y,m.source=u||g,m.target=f,h=h.reverse()):(m.connectionEnd=m.connectionEnd||y,m.source=f,m.target=u||g):(m.noCropping=!0,m.noLayout=!0,h[c]=y),p===PE&&(h=e.cropWaypoints(d,h)),m.waypoints=h,o.drawPreview(a,s,m)),In(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],LE,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,ln(c),i.removeMarker(s,OE),i.removeMarker(s,DE),l&&(i.removeMarker(l,yc),i.removeMarker(l,u?yc:cp)),o&&o.cleanUp(a)})}IE.$inject=["bendpointMove","injector","eventBus","canvas"];var BE="connect-hover",NE="djs-updating";function $E(e,t,n){return Sg(e,t,e[t]+n)}function Sg(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function E$(e,t,n,i){var o=Math.max(t[i],n[i]),r=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(r+a,e[i]),o-a);return Sg(t,i,s)}function FE(e){return e==="x"?"y":"x"}function jE(e,t,n){var i,o;return e.original?e.original:(i=et(t),o=FE(n),Sg(e,o,i[o]))}function HE(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var g,h=n.getGraphics(d),y=f-1,_=f,m=d.waypoints,v=m[y],b=m[_],E=bg(n,m,p),C,I,k;if(C=bo(v,b),!!C)return I=C==="v"?"x":"y",y===0&&(v=jE(v,d.source,I)),_===m.length-1&&(b=jE(b,d.target,I)),E?k=E.point:k={x:(v.x+b.x)/2,y:(v.y+b.y)/2},g={connection:d,segmentStartIndex:y,segmentEndIndex:_,segmentStart:v,segmentEnd:b,axis:I,dragPosition:k},i.init(p,k,"connectionSegment.move",{cursor:I==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:h,context:g}})};function s(p,d){if(!a)return d;var f=p.waypoints,g;return p.waypoints=d,g=a.getCroppedWaypoints(p),p.waypoints=f,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var g=p.newWaypoints,h=p.segmentStartIndex+d,y=g[h],_=p.segmentEndIndex+d,m=g[_],v=FE(p.axis),b=E$(f,y,m,v);In(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,g=p.filter(function(h,y){return nf(p[y-1],p[y+1],h)?(f=y<=d?f-1:f,!1):!0});return{waypoints:g,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,g=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=ME(g,d.segmentStart,d.segmentEnd),dt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,NE)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,g=d.segmentStartIndex,h=d.segmentEndIndex,y=d.segmentStart,_=d.segmentEnd,m=d.axis,v=d.originalWaypoints.slice(),b=$E(y,m,p["d"+m]),E=$E(_,m,p["d"+m]),C=v.length,I=0;v[g]=b,v[h]=E;var k,T;g<2&&(k=Ln(f.source,b),g===1?k==="intersect"&&(v.shift(),v[0]=b,I--):k!=="intersect"&&(v.unshift(y),I++)),h>C-3&&(T=Ln(f.target,E),h===C-2?T==="intersect"&&(v.pop(),v[v.length-1]=E):T!=="intersect"&&v.push(_)),d.newWaypoints=f.waypoints=s(f,v),l(d,I,p),d.newSegmentStartIndex=g+I,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,BE)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,BE)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&ln(d.draggerGfx),n.removeMarker(f,NE)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var d=p.context,f=d.connection;f.waypoints=d.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var d=p.context,f=d.connection,g=d.newWaypoints,h=d.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var y=u(g,h),_=y.waypoints,m=s(f,_),v=y.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:h+v}};r.updateWaypoints(f,m,b)})}HE.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var S$=Math.abs,zE=Math.round;function R$(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],S$(o-e)<=n)return o}function GE(e){return{x:e.x,y:e.y}}function VE(e){return{x:e.x+e.width,y:e.y+e.height}}function ki(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:zE(e.x+e.width/2),y:zE(e.y+e.height/2)}}function Xa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function hn(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,o=e[t],r=e.snapped=e.snapped||{};return n===!1?r[t]=!1:(r[t]=!0,i=n-o,e[t]+=i,e["d"+t]+=i),o}function WE(e){return e.children||[]}var C$=Math.abs,UE=Math.round,Rg=10;function qE(e){function t(r,a){if(Je(r)){for(var s=r.length;s--;)if(C$(r[s]-a)<=Rg)return r[s]}else{r=+r;var c=a%r;if(c<Rg)return a-c;if(c>r-Rg)return a-c+r}return a}function n(r,a){if(r.waypoints)return y$(a,r);if(r.width)return{x:UE(r.width/2+r.x),y:UE(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,d=a.segmentEnd,f=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,d,l[f+1]];return p<2&&h.unshift(n(c.source,r)),f>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},V(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(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,d=c-u;Y(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&hn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&hn(r,"y",u)}});function o(r){var a=r.snapPoints,s=r.connection.waypoints,c=r.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return r.snapPoints=a={horizontal:[],vertical:[]},V(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(r){var a=r.context,s=a.hover,c=s&&n(s,r);!Dt(s)||!c||!c.x||!c.y||(hn(r,"x",c.x),hn(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,d,f;if(s){d=t(l?s.vertical.concat([l.x]):s.vertical,u),f=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-d,h=p-f;Y(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&hn(r,"x",d),(h||s.horizontal.indexOf(p)!==-1)&&hn(r,"y",f)}})}qE.$inject=["eventBus"];const M$={__depends__:[Co,ao],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",AE],bendpointMove:["type",Eg],bendpointMovePreview:["type",IE],connectionSegmentMove:["type",HE],bendpointSnapping:["type",qE]};function YE(e,t,n,i){function o(a,s){return i.allowed("connection.create",{source:a,target:s})}function r(a,s){return o(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=o(c,l),!la(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!la(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,d=s.target;if(!c)return!1;var f=null,g={connectionStart:Cg(s)?u:l,connectionEnd:Cg(s)?l:u};vn(c)&&(f=c),s.connection=n.connect(p,d,f,g)}),this.start=function(a,s,c,l){vn(c)||(l=c,c=et(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}YE.$inject=["eventBus","dragging","modeling","rules"];function Cg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var A$=1100,T$=900,KE="connect-ok",XE="connect-not-ok";function ZE(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,d=r.connectionStart||u,f=r.connectionEnd||{x:o.x,y:o.y},g=d,h=f;Cg(r)&&(g=f,h=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",T$,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?KE:XE)}),t.on(["connect.out","connect.cleanup"],A$,function(o){var r=o.hover;r&&(n.removeMarker(r,KE),n.removeMarker(r,XE))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}ZE.$inject=["injector","eventBus","canvas"];const Mg={__depends__:[Ai,ao,Co],__init__:["connectPreview"],connect:["type",YE],connectPreview:["type",ZE]};var P$="djs-dragger";function Do(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)}Do.$inject=["injector","canvas","graphicsFactory","elementFactory"],Do.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,d=n.noNoop,f,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ss(i),o||(o=e.getConnection=k$(function(h,y,_){return g.getConnection(h,y,_)})),t&&(f=o(t,r,a)),!f){!d&&this.drawNoopPreview(i,n);return}f.waypoints=s||[],this._layouter&&!u&&(f.waypoints=this._layouter.layoutConnection(f,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||f.waypoints})),(!f.waypoints||!f.waypoints.length)&&(f.waypoints=[r?et(r):c,a?et(a):l]),this._connectionDocking&&(r||a)&&!p&&(f.waypoints=this._connectionDocking.getCroppedWaypoints(f,r,a)),this._graphicsFactory.drawConnection(i,f,{stroke:"var(--element-dragger-color)"})},Do.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||et(n),r=t.connectionEnd||et(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);nt(e,s)},Do.prototype.cropWaypoints=function(e,t,n,i){var o=this._graphicsFactory,r=n&&o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return e=n&&ks(r,s,!0)||e,t=i&&ks(a,s,!1)||t,[e,t]},Do.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&ln(e.connectionPreviewGfx)},Do.prototype.getConnection=function(e){var t=O$(e);return this._elementFactory.createConnection(t)},Do.prototype.createConnectionPreviewGfx=function(){var e=He("g");return Le(e,{pointerEvents:"none"}),dt(e).add(P$),nt(this._canvas.getActiveLayer(),e),e},Do.prototype.createNoopConnection=function(e,t){return Ms([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function k$(e){var t={};return function(n){var i=JSON.stringify(n),o=t[i];return o||(o=t[i]=e.apply(null,arguments)),o}}function O$(e){return vn(e)?e:{}}const D$={__init__:["connectionPreview"],connectionPreview:["type",Do]},lp="complex-preview";class JE{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:o=[],resized:r=[]}=t,a=this._canvas.getLayer(lp);n.filter(s=>!L$(s)).forEach(s=>{let c;Dt(s)?(c=this._graphicsFactory._createContainer("connection",He("g")),this._graphicsFactory.drawConnection(Zo(c),s)):(c=this._graphicsFactory._createContainer("shape",He("g")),this._graphicsFactory.drawShape(Zo(c),s),In(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);Dt(s)?In(l,c.x,c.y):In(l,s.x+c.x,s.y+c.y)}),o.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"])}),r.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",He("g"));this._graphicsFactory.drawShape(Zo(l),s,{width:c.width,height:c.height}),In(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Ss(this._canvas.getLayer(lp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(lp)}hide(){this._canvas.hideLayer(lp)}}JE.$inject=["canvas","graphicsFactory","previewSupport"];function L$(e){return e.hidden}const I$={__depends__:[$a],__init__:["complexPreview"],complexPreview:["type",JE]},QE=Math.round;function up(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}up.prototype.create=function(e,t,n){const i=this._complexPreview,o=this._connectionDocking,r=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=r.createShape(Y({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;Y(l,{x:u.x-QE(l.width/2),y:u.y-QE(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;p&&(d=r.createConnection(p),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=o.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter(f=>!la(f))})},up.prototype.cleanUp=function(){this._complexPreview.cleanUp()},up.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const B$={__depends__:[Pu,I$,Gh],__init__:["appendPreview"],appendPreview:["type",up]};var e1=Math.min,t1=Math.max;function Ag(e){e.preventDefault()}function vc(e){e.stopPropagation()}function N$(e){return e.nodeType===Node.TEXT_NODE}function $$(e){return[].slice.call(e)}function Vi(e){this.container=e.container,this.parent=Ht('<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=Zn(this.autoResize,this),this.handlePaste=Zn(this.handlePaste,this)}Vi.prototype.create=function(e,t,n,i){var o=this,r=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=$i(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);Y(r.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=$i(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return Y(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&Y(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ue.bind(a,"keydown",this.keyHandler),Ue.bind(a,"mousedown",vc),Ue.bind(a,"paste",o.handlePaste),Ue.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ue.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Vi.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 o=this.autoResize(n);o&&this.resizeHandler(o)}},Vi.prototype.insertText=function(e){e=F$(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Vi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=$$(a.childNodes),c,l;if(N$(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var d=s.indexOf(n),f=s.indexOf(i);s.forEach(function(g,h){h===d?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>d&&h<=f&&eo(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Vi.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(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},Vi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,o=parseInt(this.style.minHeight)||0,r=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Ht('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Ag(g),vc(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ue.bind(document,"mousemove",d),Ue.bind(document,"mouseup",f)},d=function(g){Ag(g),vc(g);var h=e1(t1(l+g.clientX-s,i),r),y=e1(t1(u+g.clientY-c,o),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})},f=function(g){Ag(g),vc(g),Ue.unbind(document,"mousemove",d,!1),Ue.unbind(document,"mouseup",f,!1)};Ue.bind(n,"mousedown",p)}Y(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)},Vi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ue.unbind(t,"keydown",this.keyHandler),Ue.unbind(t,"mousedown",vc),Ue.unbind(t,"input",this.autoResize),Ue.unbind(t,"paste",this.handlePaste),Ue.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),eo(n)),eo(e)},Vi.prototype.getValue=function(){return this.content.innerText.trim()},Vi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Vi.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 F$(e){return e.replace(/\r\n|\r|\n/g,`
|
|
315
|
+
`)}function fi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Vi({container:t.getContainer(),keyHandler:Zn(this._handleKey,this),resizeHandler:Zn(this._handleResize,this),focusoutHandler:Zn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}fi.$inject=["eventBus","canvas"],fi.prototype.registerProvider=function(e){this._providers.push(e)},fi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},fi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},fi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},fi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},fi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},fi.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),o=this.getValue(),r=e.context.text;(o!==r||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,o,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},fi.prototype.getValue=function(){return this._textbox.getValue()},fi.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()},fi.prototype._handleResize=function(e){this._fire("resize",e)},fi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},fi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Bt(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 n1={__depends__:[au],__init__:["directEditing"],directEditing:["type",fi]};function j$(e){return function(t){var n=t.target,i=Ee(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===ft(e);return!r||!a||!s||!c}}const H$={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 be(e,t={}){var n=H$[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var z$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start")],G$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing"),be("none-end-event",{actionName:"replace-with-none-end"})],V$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-intermediate-catch"),be("message-intermediate-throw"),be("timer-intermediate-catch"),be("escalation-intermediate-throw"),be("conditional-intermediate-catch"),be("link-intermediate-catch"),be("link-intermediate-throw"),be("compensation-intermediate-throw"),be("signal-intermediate-catch"),be("signal-intermediate-throw")],W$=[be("none-start-event",{actionName:"replace-with-none-start"}),be("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),be("none-end-event",{actionName:"replace-with-none-end"}),be("message-end"),be("escalation-end"),be("error-end"),be("cancel-end"),be("compensation-end"),be("signal-end"),be("terminate-end")],U$=[be("exclusive-gateway"),be("parallel-gateway"),be("inclusive-gateway"),be("complex-gateway"),be("event-based-gateway")],q$=[be("transaction"),be("event-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("collapsed-subprocess")],Y$=[be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("transaction"),be("event-subprocess"),be("collapsed-ad-hoc-subprocess")],i1=[be("transaction"),be("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),be("event-subprocess")],K$=i1,o1=[be("task"),be("user-task"),be("service-task"),be("send-task"),be("receive-task"),be("manual-task"),be("rule-task"),be("script-task"),be("call-activity"),be("collapsed-subprocess"),be("expanded-subprocess"),be("collapsed-ad-hoc-subprocess"),be("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],X$=[be("data-store-reference")],Z$=[be("data-object-reference")],J$=[be("message-boundary"),be("timer-boundary"),be("escalation-boundary"),be("conditional-boundary"),be("error-boundary"),be("cancel-boundary"),be("signal-boundary"),be("compensation-boundary"),be("non-interrupting-message-boundary"),be("non-interrupting-timer-boundary"),be("non-interrupting-escalation-boundary"),be("non-interrupting-conditional-boundary"),be("non-interrupting-signal-boundary")],Q$=[be("message-start"),be("timer-start"),be("conditional-start"),be("signal-start"),be("error-start"),be("escalation-start"),be("compensation-start"),be("non-interrupting-message-start"),be("non-interrupting-timer-start"),be("non-interrupting-conditional-start"),be("non-interrupting-signal-start"),be("non-interrupting-escalation-start")],e5=[{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"}],t5=[be("expanded-pool"),be("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],n5={"bpmn:MessageEventDefinition":[be("message-start"),be("message-intermediate-catch"),be("message-intermediate-throw"),be("message-end")],"bpmn:TimerEventDefinition":[be("timer-start"),be("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[be("conditional-start"),be("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[be("signal-start"),be("signal-intermediate-catch"),be("signal-intermediate-throw"),be("signal-end")],"bpmn:ErrorEventDefinition":[be("error-start"),be("error-end")],"bpmn:EscalationEventDefinition":[be("escalation-start"),be("escalation-intermediate-throw"),be("escalation-end")],"bpmn:CompensateEventDefinition":[be("compensation-start"),be("compensation-intermediate-throw"),be("compensation-end")]};const r1={"start-event-non-interrupting":`
|
|
317
316
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
318
317
|
<g transform="translate(0 995.64)">
|
|
319
318
|
<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 +323,7 @@
|
|
|
324
323
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
325
324
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
326
325
|
</g>
|
|
327
|
-
</svg>`};function Oi(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}Oi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Oi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Oi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Je(e)||!n.allowed("shape.replace",{element:e}))return{};var a=v$(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,A$):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,P$):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=L$[o]||[],!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")&&(i=lt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),A(t,"bpmn:StartEvent")&&!A(t.$parent,"bpmn:SubProcess")?(r=lt(b$.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=lt(D$,function(c){return ft(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Wn(t.$parent)?(r=lt(k$.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,r)):A(t,"bpmn:StartEvent")&&!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=lt(w$.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=lt(E$.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):A(t,"bpmn:BoundaryEvent")?(r=lt(T$,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:IntermediateCatchEvent")||A(t,"bpmn:IntermediateThrowEvent")?(r=lt(_$.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=lt(S$,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=lt(WE,a),this._createEntries(e,r)):Wn(t)&&ft(e)?(r=lt(M$,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&ft(e)?(r=lt(C$,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&ft(e)?(r=lt(R$,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!ft(e)?(r=lt(UE,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):A(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,O$):A(t,"bpmn:FlowNode")?(r=lt(UE,a),this._createEntries(e,r)):{})},Oi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Wn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),vb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Oi.prototype._createEntries=function(e,t){var n={},i=this;return V(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Oi.prototype._createSequenceFlowEntries=function(e,t){var n=Ee(e),i={},o=this._modeling,r=this._moddle,a=this;return V(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&A(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:A(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Oi.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},Oi.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&&A(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 o=Ee(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.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"}}}},Oi.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},Oi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},Oi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ee(e),i=this,o=xb(e),r=A(e,"bpmn:BoundaryEvent")?qE["intermediate-event-non-interrupting"]:qE["start-event-non-interrupting"],a=!n[o];return{"toggle-non-interrupting":{imageHtml:r,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[o]:!!a})}}}};const I$={__depends__:[vg,Fw,Pu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Oi]};function vc(e,t,n,i,o,r,a,s,c,l,u,p,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=d,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(f){var g=f.context,h=g.shape;if(!(!Vs(f)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(f,h)}}),n.on("contextPad.close",function(){d.cleanUp()})}vc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],vc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&Y(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},vc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Je(t)?Bo(e,n=>t.includes(n)):t},vc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&Y(u,g()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function h(v){var b=5,E=t.getPad(v).html,C=E.getBoundingClientRect(),I={x:C.left,y:C.bottom+b};return I}function y(v,b,E,C){function I(F,z){var G=i.createShape(Y({type:v},C));r.start(F,G,{source:z})}var k=s?function(F,z){var G=i.createShape(Y({type:v},C));s.append(z,G)}:I,P=s?function(F,z){return l.create(z,v,C),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:I,click:k,hover:P}}}function w(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(st(p,["bpmn:Lane","bpmn:Participant"])&&ft(e)){var m=tr(e);Y(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,b){n.addLane(b,"top")}}}}),m.length<2&&((Sn(e)?e.height>=120:e.width>=120)&&Y(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(Sn(e)?e.height>=180:e.width>=180)&&Y(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),Y(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,b){n.addLane(b,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?Y(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"})}):YE(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?Y(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!YE(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Wn(p)&&Y(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")||Y(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=Y(h(b),{cursor:{x:v.x,y:v.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&Y(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&Y(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),st(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Y(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:d,dragstart:d}}}),A(p,"bpmn:TextAnnotation")&&Y(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),st(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Y(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),A(p,"bpmn:Group")&&Y(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&Y(u,g()),u};function YE(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return V(r,function(a){a.$type===n&&(o=!0)}),i&&o}const B$={__depends__:[h$,VE,E0,Ai,Cg,su,I$],__init__:["contextPadProvider"],contextPadProvider:["type",vc]};var N$={horizontal:["x","width"],vertical:["y","height"]},KE=5;function Lo(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Je(i)?i:i?n:[]})}Lo.$inject=["modeling","rules"],Lo.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Lo.prototype.trigger=function(e,t){var n=this._modeling,i,o;if(!(e.length<3)&&(this._setOrientation(t),o=this._filterElements(e),i=this._createGroups(o),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Lo.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(V(t,function(r){o=r(o,n,i)}),o):e},Lo.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var r=Yi(e,i);return V(r,function(a,s){var c=n._findRange(a,i,o),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},Lo.prototype._setOrientation=function(e){var t=N$[e];this._axis=t[0],this._dimension=t[1]},Lo.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)},Lo.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+KE,max:t+n-KE}};const $$={__init__:["distributeElements"],distributeElements:["type",Lo]};function pp(e){Mi.call(this,e)}pp.$inject=["eventBus"],Be(pp,Mi),pp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=lt(t,function(n){var i=st(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xl(t),t.length<3?!1:t})};var XE={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
326
|
+
</svg>`};function Oi(e,t,n,i,o,r,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=o,this._rules=r,this._translate=a,this._moddleCopy=s,this._register()}Oi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Oi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Oi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Je(e)||!n.allowed("shape.replace",{element:e}))return{};var a=j$(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,X$):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,Z$):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=n5[o]||[],!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")&&(i=lt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),A(t,"bpmn:StartEvent")&&!A(t.$parent,"bpmn:SubProcess")?(r=lt(z$.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=lt(t5,function(c){return ft(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Wn(t.$parent)?(r=lt(Q$.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,r)):A(t,"bpmn:StartEvent")&&!Wn(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=lt(G$.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=lt(W$.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):A(t,"bpmn:BoundaryEvent")?(r=lt(J$,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:IntermediateCatchEvent")||A(t,"bpmn:IntermediateThrowEvent")?(r=lt(V$.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=lt(U$,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=lt(i1,a),this._createEntries(e,r)):Wn(t)&&ft(e)?(r=lt(K$,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&ft(e)?(r=lt(Y$,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&ft(e)?(r=lt(q$,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!ft(e)?(r=lt(o1,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):A(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,e5):A(t,"bpmn:FlowNode")?(r=lt(o1,a),this._createEntries(e,r)):{})},Oi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Wn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Pb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Oi.prototype._createEntries=function(e,t){var n={},i=this;return V(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Oi.prototype._createSequenceFlowEntries=function(e,t){var n=Ee(e),i={},o=this._modeling,r=this._moddle,a=this;return V(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&A(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:A(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Oi.prototype._createEntry=function(e,t,n){var i=this._translate,o=this._bpmnReplace.replaceElement,r=function(){return o(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||r,{label:i(a),className:e.className,action:n}},Oi.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&&A(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 o=Ee(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.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"}}}},Oi.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function o(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:o}}},Oi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function o(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:o}}},Oi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ee(e),i=this,o=kb(e),r=A(e,"bpmn:BoundaryEvent")?r1["intermediate-event-non-interrupting"]:r1["start-event-non-interrupting"],a=!n[o];return{"toggle-non-interrupting":{imageHtml:r,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[o]:!!a})}}}};const i5={__depends__:[xg,Zw,Pu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Oi]};function xc(e,t,n,i,o,r,a,s,c,l,u,p,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=d,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(f){var g=f.context,h=g.shape;if(!(!Vs(f)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(f,h)}}),n.on("contextPad.close",function(){d.cleanUp()})}xc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],xc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&Y(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},xc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Je(t)?Bo(e,n=>t.includes(n)):t},xc.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,o=this._connect,r=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&Y(u,g()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function h(v){var b=5,E=t.getPad(v).html,C=E.getBoundingClientRect(),I={x:C.left,y:C.bottom+b};return I}function y(v,b,E,C){function I(F,z){var G=i.createShape(Y({type:v},C));r.start(F,G,{source:z})}var k=s?function(F,z){var G=i.createShape(Y({type:v},C));s.append(z,G)}:I,T=s?function(F,z){return l.create(z,v,C),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:I,click:k,hover:T}}}function _(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(st(p,["bpmn:Lane","bpmn:Participant"])&&ft(e)){var m=tr(e);Y(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,b){n.addLane(b,"top")}}}}),m.length<2&&((Sn(e)?e.height>=120:e.width>=120)&&Y(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(Sn(e)?e.height>=180:e.width>=180)&&Y(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),Y(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,b){n.addLane(b,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?Y(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"})}):a1(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?Y(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!a1(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Wn(p)&&Y(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")||Y(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=Y(h(b),{cursor:{x:v.x,y:v.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&Y(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&Y(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),st(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Y(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:d,dragstart:d}}}),A(p,"bpmn:TextAnnotation")&&Y(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),st(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Y(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),A(p,"bpmn:Group")&&Y(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&Y(u,g()),u};function a1(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return V(r,function(a){a.$type===n&&(o=!0)}),i&&o}const o5={__depends__:[B$,n1,I0,Ai,Mg,cu,i5],__init__:["contextPadProvider"],contextPadProvider:["type",xc]};var r5={horizontal:["x","width"],vertical:["y","height"]},s1=5;function Lo(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Je(i)?i:i?n:[]})}Lo.$inject=["modeling","rules"],Lo.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Lo.prototype.trigger=function(e,t){var n=this._modeling,i,o;if(!(e.length<3)&&(this._setOrientation(t),o=this._filterElements(e),i=this._createGroups(o),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Lo.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(V(t,function(r){o=r(o,n,i)}),o):e},Lo.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,o=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var r=Yi(e,i);return V(r,function(a,s){var c=n._findRange(a,i,o),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},Lo.prototype._setOrientation=function(e){var t=r5[e];this._axis=t[0],this._dimension=t[1]},Lo.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)},Lo.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+s1,max:t+n-s1}};const a5={__init__:["distributeElements"],distributeElements:["type",Lo]};function pp(e){Mi.call(this,e)}pp.$inject=["eventBus"],Be(pp,Mi),pp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=lt(t,function(n){var i=st(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=bl(t),t.length<3?!1:t})};var c1={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
328
327
|
<polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
329
328
|
<rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
330
329
|
<rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -332,7 +331,7 @@
|
|
|
332
331
|
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
333
332
|
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
334
333
|
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
335
|
-
</svg>`},F$=900;function xc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",F$,this)}xc.$inject=["popupMenu","distributeElements","translate","rules"],xc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Y(t,this._getEntries(e)),t},xc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},xc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:XE.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:XE.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const j$={__depends__:[vg,$$],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",pp],distributeElementsMenuProvider:["type",xc]};var ZE="is not a registered action",H$="is already registered";function Di(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Di.$inject=["eventBus","injector"],Di.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=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()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&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 d=Je(p)?p:u;return r.cut(d.slice())}}}),o&&this.register("stepZoom",function(u){o.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}),d;p!==!1&&(Je(p)?d=p:d=u,d.length&&n.removeElements(d.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Di.prototype.trigger=function(e,t){if(!this._actions[e])throw Ag(e,ZE);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Di.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);V(e,function(i,o){n._registerAction(o,i)})},Di.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ag(e,H$);this._actions[e]=t},Di.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ag(e,ZE);this._actions[e]=void 0},Di.prototype.getActions=function(){return Object.keys(this._actions)},Di.prototype.isRegistered=function(e){return!!this._actions[e]};function Ag(e,t){return new Error(e+" "+t)}const z$={__init__:["editorActions"],editorActions:["type",Di]};function dp(e){e.invoke(Di,this)}Be(dp,Di),dp.$inject=["injector"],dp.prototype._registerDefaultActions=function(e){Di.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=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),d=e.get("modeling",!1),f=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}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.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=[],w=g.type;h.length&&(y=lt(h,function(m){return!A(m,"bpmn:Lane")}),l.trigger(y,w))}),i&&d&&this._registerAction("setColor",function(g){var h=i.get();h.length&&d.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&&d&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;A(g,"bpmn:Collaboration")?y=n.filter(function(w){return A(w.parent,"bpmn:Collaboration")}):y=n.filter(function(w){return w!==g&&!A(w.parent,"bpmn:SubProcess")}),h=ln(y),d.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&f&&this._registerAction("replaceElement",function(g){f.triggerEntry("replace","click",g)})};const G$={__depends__:[z$],editorActions:["type",dp]};function JE(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;st(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}JE.$inject=["eventBus"];function ta(e,t){_e.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;ni(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}ta.$inject=["eventBus","gridSnapping","modeling"],Be(ta,_e),ta.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},ta.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},ta.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),Y(e,r),e},ta.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),Y(e,r),e};var V$=2e3;function QE(e,t){e.on(["spaceTool.move","spaceTool.end"],V$,function(n){var i=n.context;if(i.initialized){var o=i.axis,r;o==="x"?(r=t.snapValue(n.dx),n.x=n.x+r-n.dx,n.dx=r):(r=t.snapValue(n.dy),n.y=n.y+r-n.dy,n.dy=r)}})}QE.$inject=["eventBus","gridSnapping"];const W$={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ta],gridSnappingSpaceToolBehavior:["type",QE]};var fp=10;function Pg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var U$=1200,q$=800;function hr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",q$,function(){o.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"],U$,function(r){var a=r.originalEvent;if(!(!o.active||a&&li(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=K$(r,l,e);p&&(u.offset=p);var d=Y$(r,l);d&&Y(u,d),Xa(r,l)||o.snapEvent(r,l,u)})}})}hr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);fn(e,t,i)},hr.prototype.getGridSpacing=function(){return fp},hr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Pg(e,fp);var i,o;return t&&t.min&&(i=t.min,Qe(i)&&(i=Pg(i+n,fp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Qe(o)&&(o=Pg(o+n,fp,"floor"),e=Math.min(e,o))),e-=n,e},hr.prototype.isActive=function(){return this.active},hr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},hr.prototype.toggleActive=function(){this.setActive(!this.active)},hr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function Y$(e,t){var n=e.context,i=n.createConstraints,o=n.resizeConstraints||{},r=n.gridSnappingContext,a=r.snapConstraints;if(a&&a[t])return a[t];a||(a=r.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(hp(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=o.min,l=o.max;return c&&(hp(t)?t1(s)?a.x.max=c.left:a.x.min=c.right:e1(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(hp(t)?t1(s)?a.x.min=l.left:a.x.max=l.right:e1(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function K$(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Qe(s[t])||(s||(s=r.snapOffset={}),Qe(s[t])||(s[t]=0),!o)||(n.get(o.id)||(hp(t)?s[t]+=o[t]+o.width/2:s[t]+=o[t]+o.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=o.width/2:/right/.test(a)&&(s[t]+=o.width/2):/top/.test(a)?s[t]-=o.height/2:/bottom/.test(a)&&(s[t]+=o.height/2)),s[t]}function hp(e){return e==="x"}function e1(e){return e.indexOf("n")!==-1}function t1(e){return e.indexOf("w")!==-1}const X$={__depends__:[W$],__init__:["gridSnapping"],gridSnapping:["type",hr]};var Z$=1750;function n1(e,t,n){t.on(["create.start","shape.move.start"],Z$,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!A(r,"bpmn:Participant")||!A(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}n1.$inject=["canvas","eventBus","gridSnapping"];const J$={__depends__:[X$,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Zh],gridSnappingParticipantBehavior:["type",n1],gridSnappingLayoutConnectionBehavior:["type",za]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",JE]};var Q$=30,i1=30;function bc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return ft(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return ft(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}bc.$inject=["eventBus","interactionEvents"],bc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},bc.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=Sn(e)?{width:Q$,height:e.height}:{width:e.width,height:i1};return this._interactionEvents.createBoxHit(t,"all",n),!0},bc.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:i1}),!0};const e5={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",bc]};function gp(e){e.invoke(Ga,this)}Be(gp,Ga),gp.$inject=["injector"],gp.prototype.registerBindings=function(e,t){Ga.prototype.registerBindings.call(this,e,t);function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("selectElements",function(i){var o=i.keyEvent;if(e.isKey(["a","A"],o)&&e.isCmd(o))return t.trigger("selectElements"),!0}),n("find",function(i){var o=i.keyEvent;if(e.isKey(["f","F"],o)&&e.isCmd(o))return t.trigger("find"),!0}),n("spaceTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["s","S"],o))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["l","L"],o))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["h","H"],o))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["c","C"],o))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["e","E"],o))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["r","R"],o))return t.trigger("replaceElement",o),!0})};const t5={__depends__:[ig],__init__:["keyboardBindings"],keyboardBindings:["type",gp]};var n5={moveSpeed:1,moveSpeedAccelerated:10},i5=1500,o1="left",r1="up",a1="right",s1="down",o5={ArrowLeft:o1,Left:o1,ArrowUp:r1,Up:r1,ArrowRight:a1,Right:a1,ArrowDown:s1,Down:s1},r5={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 c1(e,t,n,i,o){var r=this;this._config=Y({},n5,e||{}),t.addListener(i5,function(a){var s=a.keyEvent,c=o5[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=r5[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}c1.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const a5={__depends__:[ig,Ai],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",c1]};var l1=10;function wc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,d=c.resizeConstraints,f;c.delta=l,f=R2(u,p,l),c.newBounds=M2(f,d),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:Ye(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=tx(p),!s5(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};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}wc.prototype.canResize=function(e){var t=this._rules,n=$i(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},wc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=Y({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,u1(t,r),"resize",{autoActivate:!0,cursor:c5(r),data:{shape:t,context:o}})},wc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:l1,height:l1},o=Vx(t,e.childrenBoxPadding),A2(n,t,i,o)},wc.$inject=["eventBus","rules","modeling","dragging"];function s5(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function u1(e,t){var n=et(e),i=Ye(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function c5(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 p1="djs-resizing",d1="resize-not-ok",l5=500;function f1(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,p1)),s.width>5&&Le(c,{x:s.x,width:s.width}),s.height>5&&Le(c,{y:s.y,height:s.height}),r.canExecute?dt(c).remove(d1):dt(c).add(d1)}function o(r){var a=r.shape,s=r.frame;s&&cn(r.frame),t.removeMarker(a,p1)}e.on("resize.move",l5,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}f1.$inject=["eventBus","canvas","previewSupport"];var mp=-6,yp=8,vp=20,_c="djs-resizer",u5=["n","w","s","e","nw","ne","se","sw"];function gr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&V(a,Zn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}gr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){ir(r)&&i.activate(r,e,n)}Ue.bind(t,"mousedown",o),Ue.bind(t,"touchstart",o)},gr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=p5(i),a=He("g");dt(a).add(_c),dt(a).add(_c+"-"+e.id),dt(a).add(_c+"-"+i),nt(o,a);var s=He("rect");Le(s,{x:-yp/2+r.x,y:-yp/2+r.y,width:yp,height:yp}),dt(s).add(_c+"-visual"),nt(a,s);var c=He("rect");return Le(c,{x:-vp/2+r.x,y:-vp/2+r.y,width:vp,height:vp}),dt(c).add(_c+"-hit"),nt(a,c),Rl(a,t,n),a},gr.prototype.createResizer=function(e,t){var n=u1(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},gr.prototype.addResizer=function(e){var t=this;Dt(e)||V(u5,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},gr.prototype.removeResizers=function(){var e=this._getResizersParent();Ss(e)},gr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},gr.$inject=["eventBus","canvas","selection","resize"];function p5(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-mp:e.indexOf("w")!==-1&&(t.x=mp),e.indexOf("s")!==-1?t.y=-mp:e.indexOf("n")!==-1&&(t.y=mp),t}const h1={__depends__:[ao,Co,$a],__init__:["resize","resizePreview","resizeHandles"],resize:["type",wc],resizePreview:["type",f1],resizeHandles:["type",gr]};var d5=2e3;function Ec(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,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"],d5,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,d=c.isTouch;d||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||st(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ec.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ec.prototype.activate=function(e){var t=si(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);Y(n,i);var o={},r=n.style||{};return Y(r,{backgroundColor:null,border:null}),(st(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||g1(e))&&Y(o,{centerVertically:!0}),Qo(e)&&(Y(o,{resizable:!0,autoResize:!0}),Y(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(Y(o,{resizable:!0,autoResize:!0}),Y(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),Y(n,{options:o,style:r}),n}},Ec.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={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,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(A(e,"bpmn:Lane")||g5(e)){var g=Sn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};Y(r,h),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(h5(e)){var y=Sn(e),w=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};Y(r,w),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(st(e,["bpmn:Task","bpmn:CallActivity"])||g1(e))&&(Y(r,{width:i.width,height:i.height}),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),f5(e)&&(Y(r,{width:i.width,x:i.x}),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var m=1,v=i.width+2*m;if(n.labelTarget&&(Y(r,{width:v,height:i.height+2*m,x:i.x-m,y:i.y-m}),Y(f,{fontSize:l+"px",lineHeight:u})),Qo(n)&&!Al(n)&&!at(n)){var b=sf(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),C=l,I=Hr.width*a+2*m;Y(r,{width:I,height:C+2*m,x:E.x-I/2,y:E.y-C/2-m}),Y(f,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(Y(r,{width:i.width+2*m,height:i.height+2*m,x:i.x-m,y:i.y-m,minWidth:30*a,minHeight:10*a}),Y(f,{textAlign:"left",paddingTop:Ca*a+"px",paddingBottom:Ca*a+"px",paddingLeft:Ca*a+"px",paddingRight:Ca*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Ec.prototype.update=function(e,t,n,i){var o,r;A(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),m5(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function g1(e){return A(e,"bpmn:SubProcess")&&!ft(e)}function f5(e){return A(e,"bpmn:SubProcess")&&ft(e)}function h5(e){return A(e,"bpmn:Participant")&&!ft(e)}function g5(e){return A(e,"bpmn:Participant")&&ft(e)}function m5(e){return!e||!e.trim()}var m1="djs-element-hidden",y1="djs-label-hidden";function v1(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,A(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=He("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=He("path");Le(p,{d:u,strokeWidth:2,stroke:y5(r)}),nt(s,p),nt(o,s),In(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,m1):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,y1)}),e.on("directEditing.resize",function(c){if(A(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),d=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});Le(i.path,{d})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,m1),t.removeMarker(r,y1)),r=void 0,a=void 0,s&&(cn(s),s=void 0)})}v1.$inject=["eventBus","canvas","pathMap"];function y5(e,t){var n=gt(e);return n.get("stroke")||t||"black"}const v5={__depends__:[Rh,h1,VE],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ec],labelEditingPreview:["type",v1]};var x5=500,b5=1e3;function uo(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){PT(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){V(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],x5,function(r){var a=r.element,s=r.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}uo.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(),nt(t,n),this.updateOutline(e,n)),n},uo.prototype._createOutlineGfx=function(){var e=He("rect");return Le(e,Y({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},uo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},uo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&V(i,function(o){n=n||o.updateOutline(t,e)}),n||Le(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},uo.prototype.updateConnectionOutline=function(e,t){var n=ln(t);Le(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},uo.prototype.registerProvider=function(e,t){t||(t=e,e=b5),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},uo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},uo.prototype.getOutline=function(e){var t,n=this._getProviders();return V(n,function(i){En(i.getOutline)&&(t=t||i.getOutline(e))}),t},uo.$inject=["eventBus","styles","elementRegistry"];var xp=6;function Tg(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(o){n.isSelected(o.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(o){var r=o.newSelection;i._updateMultiSelectionOutline(r)})}Tg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ss(t);var n=e.length>1,i=this._canvas.getContainer();if(dt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=w5(ln(e)),r=He("rect");Le(r,Y({rx:3},o)),dt(r).add("djs-selection-outline"),nt(t,r)}},Tg.$inject=["eventBus","canvas","selection"];function w5(e){return{x:e.x-xp,y:e.y-xp,width:e.width+xp*2,height:e.height+xp*2}}const kg={__depends__:[Ai],__init__:["outline","multiSelectionOutline"],outline:["type",uo],multiSelectionOutline:["type",Tg]},x1=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],b1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},_5=15,bp=2;function w1(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var f;const d=p.filter(g=>st(g,x1));if(d.length===1){const g=d[0];at(g)?a(g,g.labelTarget):(f=g.labels)!=null&&f.length&&a(g.labels[0],g)}if(d.length===2){const g=d.find(at),h=d.find(y=>{var w;return(w=y.labels)==null?void 0:w.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var d;!st(p,x1)||!u(p)||(at(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=Ms([et(d),et(p)],b1),g=f.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),w=ks(y,g);if(!w)return;const v=o.isSelected(d)?c(d):l(d),b=ks(v,g)||et(d);Hs(b,w)<_5||(Jd(f,[b,w]),nt(r,f))}function s(){Es(`.${b1.class}`,r).forEach(cn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+mr(d,"x")-bp,y:p.y+mr(d,"y")-bp,width:mr(d,"width")+bp*2,height:mr(d,"height")+bp*2};return lf(f,mr(d,"rx"))}if(d.cx){const f=mr(d,"r"),g={x:p.x+mr(d,"cx")-f,y:p.y+mr(d,"cy")-f,width:f*2,height:f*2};return Mx(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}w1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function mr(e,t){return parseFloat(Le(e,t)||0)}const E5={__depends__:[Ai,kg],__init__:["labelLink"],labelLink:["type",w1]};var S5=new Ur("tt");function R5(e){var t=Ht('<div class="djs-tooltip-container" />');return Yn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function C5(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function Og(e,t){e.style.display=t===!1?"none":""}var _1="djs-tooltip",Dg="."+_1;function ei(e,t){this._eventBus=e,this._canvas=t,this._ids=S5,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=R5(t.getContainer());var n=this;ri.bind(this._tooltipRoot,Dg,"mousedown",function(i){i.stopPropagation()}),ri.bind(this._tooltipRoot,Dg,"mouseover",function(i){n.trigger("mouseover",i)}),ri.bind(this._tooltipRoot,Dg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ei.$inject=["eventBus","canvas"],ei.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=Y({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ei.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(An(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ei.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ei.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ei.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)}},ei.prototype.remove=function(e){var t=this.get(e);t&&(eo(t.html),eo(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ei.prototype.show=function(){Og(this._tooltipRoot)},ei.prototype.hide=function(){Og(this._tooltipRoot,!1)},ei.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},ei.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),ni(n)&&(n=Ht(n)),i=Ht('<div data-tooltip-id="'+t+'" class="'+_1+'">'),Yn(i,{position:"absolute"}),i.appendChild(n),e.type&&Mt(i).add("djs-tooltip-"+e.type),e.className&&Mt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ei.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;C5(n,t.x,t.y)},ei.prototype._updateTooltipVisibilty=function(e){V(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Og(i,o))})},ei.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 M5={__init__:["tooltips"],tooltips:["type",ei]};var A5="flow elements must be children of pools/participants",P5="Data object must be placed within a pool/participant.";function E1(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(A5)):A(a,"bpmn:DataObjectReference")&&i(o,n(P5)))})}E1.$inject=["eventBus","tooltips","translate"];const T5={__depends__:[M5],__init__:["modelingFeedback"],modelingFeedback:["type",E1]};var k5=500,O5=1250,D5=1500,wp=Math.round;function L5(e){return{x:e.x+wp(e.width/2),y:e.y+wp(e.height/2)}}function S1(e,t,n,i,o){function r(s,c,l,u){return o.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",D5,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=I5(u),Y(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",O5,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",k5,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},d={x:s.x,y:s.y},f;if(f=r(l,p,d,u),c.delta=p,c.canExecute=f,f===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",d=c.shapes;if(u===!1)return!1;l.x=wp(l.x),l.y=wp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(d,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ir(s)){var c=La(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(vn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!dt(s.target).has("djs-hit-no-move")){var p=L5(c),d=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(d!==!1)return!0}}this.start=a}S1.$inject=["eventBus","dragging","modeling","selection","rules"];function I5(e){var t=pa(e,"id");return lt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var R1=499,Lg="djs-dragging",C1="drop-ok",M1="drop-not-ok",A1="new-parent",P1="attach-ok";function T1(e,t,n,i){function o(c){var l=r(c),u=B5(l);return u}function r(c){var l=As(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[P1,C1,M1,A1].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,Lg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",R1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=He("g");Le(f,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();nt(g,f),l.dragGroup=f}d.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Fp([p,r(u)]):p=r(u),V(p,function(h){t.addMarker(h,Lg)}),l.allDraggedElements=p,l.differentParents=N5(u)}),e.on("shape.move.move",R1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,P1):l.canExecute&&d&&p.id!==d.id?a(p,A1):a(p,l.canExecute?C1:M1)),In(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;V(u,function(d){t.removeMarker(d,Lg)}),p&&cn(p)}),this.makeDraggable=s}T1.$inject=["eventBus","canvas","styles","previewSupport"];function B5(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=lt(e,function(i){return Dt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function N5(e){return fR(pa(e,function(t){return t.parent&&t.parent.id}))!==1}const $5={__depends__:[ru,Ai,kg,ao,Co,$a],__init__:["move","movePreview"],move:["type",S1],movePreview:["type",T1]};var k1=".djs-palette-toggle",O1=".entry",F5=k1+", "+O1,Ig="djs-palette-",j5="shown",Bg="open",D1="two-column",H5=1e3;function hn(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}hn.$inject=["eventBus","canvas"],hn.prototype.registerProvider=function(e,t){t||(t=e,e=H5),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},hn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(G5,{})},hn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},hn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ht(hn.HTML_MARKUP);n.appendChild(i),Mt(n).add(Ig+j5),ri.bind(i,F5,"click",function(o){var r=o.delegateTarget;if(zd(r,k1))return e.toggle();e.trigger("click",o)}),Ue.bind(i,"mousedown",function(o){o.stopPropagation()}),ri.bind(i,O1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},hn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},hn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Mt(n),a=Mt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(D1,o),a.toggle(Ig+D1,o),"open"in e&&(r.toggle(Bg,e.open),a.toggle(Ig+Bg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},hn.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();gl(e),V(t,function(n,i){var o=n.group||"default",r=Rt("[data-group="+Xr(o)+"]",e);r||(r=Ht('<div class="group"></div>'),An(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ht(a);if(r.appendChild(s),!n.separator&&(An(s,"data-action",i),n.title&&An(s,"title",n.title),n.className&&z5(s,n.className),n.imageUrl)){var c=Ht("<img>");An(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},hn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=An(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},hn.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(En(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},hn.prototype._layoutChanged=function(){this._toggleState({})},hn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},hn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},hn.prototype.open=function(){this._toggleState({open:!0})},hn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},hn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},hn.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,V(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Mt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},hn.prototype.isOpen=function(){return Mt(this._container).has(Bg)},hn.prototype._getParentContainer=function(){return this._canvas.getContainer()},hn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function z5(e,t){var n=Mt(e),i=Je(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function G5(e,t){var n=t.getPaletteEntries();return En(n)?n(e):(V(n,function(i,o){e[o]=i}),e)}const V5={__init__:["palette"],palette:["type",hn]};var L1="crosshair",I1="selected",W5="djs-dragging-active-lasso";function yr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var d=t.getActiveLayer(),f=p.frame=He("rect");Le(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),nt(d,f),l(!0),this.update(p)},update:function(p){var d=p.frame,f=p.bbox;d&&f&&Le(d,{x:f.x,y:f.y,width:f.width,height:f.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,I1);for(const y of g)h.has(y)||t.addMarker(y,I1)}},remove:function(p){this.update(p),p.frame&&cn(p.frame),l(!1)}};function l(p){dt(t.getContainer()).toggle(W5,p)}function u(p){var d=i.getAll();return new Set(ua(_a(d,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var d=p.originalEvent.target;!p.hover&&!(d instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var d=p.context;s._select(Array.from(d.marked))}),e.on("lasso.start",function(p){var d=p.context;d.bbox=B1(p),d.add=Jl(p),d.lastMarked=new Set(o.get()),d.add?d.marked=d.lastMarked:d.marked=new Set,d.initialMarked=d.marked,c.create(d)}),e.on("lasso.move",function(p){var d=p.context,f=d.bbox=B1(p),g=u(f),h=d.initialMarked.union(g);d.lastMarked=d.marked,d.marked=h,c.update(d)}),e.on("lasso.cleanup",function(p){var d=p.context;d.lastMarked=d.marked,d.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Jl(p))return s.activateLasso(p.originalEvent),!0})}yr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],yr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:L1,data:{context:{}},keepSelection:!0})},yr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:L1,data:{context:{}},keepSelection:!0})},yr.prototype._select=function(e){this._selection.select(e)},yr.prototype.select=function(e,t,n=[]){var i=ua(_a(e,t));this._select([...n,...i])},yr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},yr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function B1(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 U5={__depends__:[lu,qs],__init__:["lassoTool"],lassoTool:["type",yr]};var Ng=1500,N1="grab";function Za(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Ng,function(c){if(Vs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Ng,function(c){if(!(!$1(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Ng,function(c){!$1(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!Vs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Za.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Za.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:N1,data:{context:n||{}}})},Za.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:N1,data:{context:{reactivate:n}}})},Za.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Za.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function $1(e){return bn("Space",e)}const q5={__depends__:[lu,qs],__init__:["handTool"],handTool:["type",Za]};var F1="connect-ok",j1="connect-not-ok";function Ja(e,t,n,i,o,r,a){var s=this;this._dragging=t,this._rules=r,this._mouse=a,o.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?F1:j1))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?F1:j1)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},d=s.canStartConnect(u);if(d)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})}Ja.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ja.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ja.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ja.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ja.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const Y5={__depends__:[Cg,ao,Co,lu,qs],globalConnect:["type",Ja]};function $g(e,t,n,i,o,r,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=o,this._handTool=r,this._globalConnect=a,this._translate=s,e.registerProvider(this)}$g.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],$g.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,d,f,g,h){function y(w){var m=n.createShape(Y({type:p},h));t.start(w,m)}return{group:d,className:f,title:g,action:{dragstart:y,click:y}}}function l(p){var d=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),f=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:d});t.start(p,[d,f],{hints:{autoSelect:[d]}})}function u(p){t.start(p,n.createParticipantShape())}return Y(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.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 K5={__depends__:[V5,su,Ww,U5,q5,Y5,Ns],__init__:["paletteProvider"],paletteProvider:["type",$g]};var X5=250;function Fg(e,t,n,i,o){_e.call(this,e);function r(s){var c=s.canExecute.replacements;V(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);Y(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var g=Rt('[data-element-id="'+Xr(d.id)+'"]',s.dragGroup);g&&Le(g,{display:"none"});var h=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;V(c,function(l,u){var p=Rt('[data-element-id="'+Xr(u)+'"]',s.dragGroup);p&&Le(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",X5,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Fg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Be(Fg,_e);const Z5={__depends__:[$a],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Fg]};var J5=1250,jg=40,Q5=20,e3=10,H1=20,z1=["x","y"],t3=Math.abs;function G1(e){e.on(["connect.hover","connect.move","connect.end"],J5,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&li(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&n3(t,r,a3(r)),r&&r3(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=ki(o),st(r,["bpmn:Event","bpmn:Gateway"])&&V1(t,ki(r)),st(r,["bpmn:Task","bpmn:SubProcess"])&&i3(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&o3(t)):W1(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=ki(o)),A(r,"bpmn:Event")&&V1(t,ki(r))):n.connectionStart=n.initialConnectionStart)})}G1.$inject=["eventBus"];function n3(e,t,n){z1.forEach(function(i){var o=U1(i,t);e[i]<t[i]+n?fn(e,i,t[i]+n):e[i]>t[i]+o-n&&fn(e,i,t[i]+o-n)})}function i3(e,t){var n=ki(t);z1.forEach(function(i){s3(e,t,i)&&fn(e,i,n[i])})}function o3(e){var t=e.context,n=t.source,i=t.target;if(!c3(t)){var o=ki(n),r=Ln(o,i,-10),a=[];/top|bottom/.test(r)&&a.push("x"),/left|right/.test(r)&&a.push("y"),a.forEach(function(s){var c=e[s],l;t3(c-o[s])<jg&&(c>o[s]?l=o[s]+jg:l=o[s]-jg,fn(e,s,l))})}}function V1(e,t){fn(e,"x",t.x),fn(e,"y",t.y)}function W1(e,t){return e&&e.type===t}function r3(e,t){return No(t,function(n){return W1(e,n)})}function U1(e,t){return e==="x"?t.width:t.height}function a3(e){return A(e,"bpmn:Task")?e3:Q5}function s3(e,t,n){return e[n]>t[n]+H1&&e[n]<t[n]+U1(n,t)-H1}function c3(e){var t=e.hover,n=e.source;return t&&n&&t===n}function vr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}vr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},vr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},vr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},vr.prototype.getSnapLocations=function(){return this._snapLocations},vr.prototype.setSnapLocations=function(e){this._snapLocations=e},vr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new _p,n.initDefaults(this._defaultSnaps)),n};function _p(){this._snapValues={}}_p.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)},_p.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&i$(e[n],o[n],i)},_p.prototype.initDefaults=function(e){var t=this;V(e||{},function(n,i){V(n,function(o){t.add(i,o)})})};var l3=1250;function po(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],l3,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&li(o.originalEvent))&&!(Xa(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}po.$inject=["elementRegistry","eventBus","snapping"],po.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new vr);var r;t.get(i.id)?r=ki(i,e):r={x:e.x+ki(i).x,y:e.y+ki(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),at(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},po.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return V(i,function(o){if(at(o)){at(t)&&e.add("mid",ki(o));return}if(Dt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);V(r,function(a){e.add("mid",a)});return}e.add("mid",ki(o))}),!Qe(t.x)||!Qe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",ki(t)),e},po.prototype.getSnapTargets=function(e,t){return DE(t).filter(function(n){return!u3(n)})};function u3(e){return!!e.hidden}var q1=1500;function Qa(e,t){t.invoke(po,this),e.on(["create.move","create.end"],q1,h3),e.on(["create.move","create.end","shape.move.move","shape.move.end"],q1,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Xa(n)&&p3(n,r)})}Be(Qa,po),Qa.$inject=["eventBus","injector"],Qa.prototype.initSnap=function(e){var t=po.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return V(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",K1(r,i,e))}),V(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",K1(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Qa.prototype.addSnapTargetPoints=function(e,t,n){po.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);V(i,function(r){(f3(r)||d3([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",kE(r)),e.add("bottom-right",OE(r)))});var o=this._elementRegistry;return V(t.incoming,function(r){if(o.get(t.id)){Y1(i,r.source)||e.add("mid",et(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),V(t.outgoing,function(r){if(o.get(t.id)){Y1(i,r.target)||e.add("mid",et(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),A(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Qa.prototype.getSnapTargets=function(e,t){return po.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function p3(e,t){var n=Ye(t),i=Hb(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=et(r),/top/.test(i)?fn(e,"y",n.top-a.y):/bottom/.test(i)&&fn(e,"y",n.bottom-a.y),/left/.test(i)?fn(e,"x",n.left-a.x):/right/.test(i)&&fn(e,"x",n.right-a.x)}function d3(e,t){return e.every(function(n){return A(n,t)})}function f3(e){return A(e,"bpmn:SubProcess")&&ft(e)?!0:A(e,"bpmn:Participant")}function h3(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&fn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&fn(e,"y",e.y)}}function Y1(e,t){return e.indexOf(t)!==-1}function K1(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var g3=1250;function Sc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],g3,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&li(i.originalEvent))&&!Xa(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),v3(s)&&fn(i,"x",i.x),x3(s)&&fn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Sc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new vr);var r=X1(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Sc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return V(o,function(r){e.add("corner",OE(r)),e.add("corner",kE(r))}),e.add("corner",X1(t,i)),e},Sc.$inject=["eventBus","snapping"],Sc.prototype.getSnapTargets=function(e,t){return DE(t).filter(function(n){return!m3(n,e)&&!Dt(n)&&!y3(n)&&!at(n)})};function X1(e,t){var n=et(e),i=Ye(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function m3(e,t){return e.host===t}function y3(e){return!!e.hidden}function v3(e){return e==="n"||e==="s"}function x3(e){return e==="e"||e==="w"}var b3=7,w3=1e3;function xr(e){this._canvas=e,this._asyncHide=Hp(Zn(this.hide,this),w3)}xr.$inject=["canvas"],xr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Xa(e,"x"),y:Xa(e,"y")};V(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(V(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,b3),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),V(["x","y"],function(a){var s=r[a];vn(s)&&fn(e,a,s.originValue)})},xr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=He("path");return Le(n,{d:"M0,0 L0,0"}),dt(n).add("djs-snap-line"),nt(t,n),{update:function(i){Qe(i)?e==="horizontal"?Le(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Le(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Le(n,{display:"none"})}}},xr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},xr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},xr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},xr.prototype.hide=function(){V(this._snapLines,function(e){e.update()})};const _3={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",po],resizeSnapping:["type",Sc],snapping:["type",xr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",G1],createMoveSnapping:["type",Qa]};var Z1=300;function ot(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(ot.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(ot.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ot.$inject=["canvas","eventBus","selection","translate"],ot.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ri.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ot.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ot.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ot.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ot.INPUT_SELECTOR,"keydown",function(n){bn("ArrowUp",n)&&n.preventDefault(),bn("ArrowDown",n)&&n.preventDefault()}),t(this._container,ot.INPUT_SELECTOR,"keyup",function(n){if(bn("Escape",n))return e.close();if(bn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(bn("ArrowUp",n))return e._scrollToDirection(!0);if(bn("ArrowDown",n))return e._scrollToDirection();bn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ot.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ri.unbind(e.el,e.type,e.listener)})},ot.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(o){return!t._canvas.getRootElements().includes(o.element)}),!n.length){this._selection.select(null);return}n.forEach(function(o){var r=o.element.id,a=t._createResultNode(o,r);t._results[r]={element:o.element,node:a}});var i=Rt(ot.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ot.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ot.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)}},ot.prototype._clearResults=function(){gl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ot.prototype._getCurrentResult=function(){return Rt(ot.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ot.prototype._createResultNode=function(e,t){var n=Ht(ot.RESULT_HTML);return e.primaryTokens.length>0&&J1(n,e.primaryTokens,ot.RESULT_PRIMARY_HTML),J1(n,e.secondaryTokens,ot.RESULT_SECONDARY_HTML),An(n,ot.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ot.prototype.registerProvider=function(e){this._searchProvider=e},ot.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,Mt(this._canvas.getContainer()).add("djs-search-open"),Mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ot.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,Mt(this._canvas.getContainer()).remove("djs-search-open"),Mt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ot.prototype.isOpen=function(){return this._open},ot.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Mt(t).remove(ot.RESULT_SELECTED_CLASS);var n=An(e,ot.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Mt(e).add(ot.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Z1}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ot.prototype._select=function(e){var t=An(e,ot.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Z1}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ot.prototype._getBoxHtml=function(){const e=Ht(ot.BOX_HTML),t=Rt(ot.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function J1(e,t,n){var i=E3(t),o=Ht(n);o.innerHTML=i,e.appendChild(o)}function E3(e){var t="";return e.forEach(function(n){var i=J_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+ot.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ot.CONTAINER_SELECTOR=".djs-search-container",ot.INPUT_SELECTOR=".djs-search-input input",ot.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ot.RESULT_SELECTOR=".djs-search-result",ot.RESULT_SELECTED_CLASS="djs-search-result-selected",ot.RESULT_SELECTED_SELECTOR="."+ot.RESULT_SELECTED_CLASS,ot.RESULT_ID_ATTRIBUTE="data-result-id",ot.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ot.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
334
|
+
</svg>`},s5=900;function bc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",s5,this)}bc.$inject=["popupMenu","distributeElements","translate","rules"],bc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Y(t,this._getEntries(e)),t},bc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},bc.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,o={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:c1.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:c1.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const c5={__depends__:[xg,a5],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",pp],distributeElementsMenuProvider:["type",bc]};var l1="is not a registered action",l5="is already registered";function Di(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Di.$inject=["eventBus","injector"],Di.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=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()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&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 d=Je(p)?p:u;return r.cut(d.slice())}}}),o&&this.register("stepZoom",function(u){o.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}),d;p!==!1&&(Je(p)?d=p:d=u,d.length&&n.removeElements(d.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Di.prototype.trigger=function(e,t){if(!this._actions[e])throw Tg(e,l1);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Di.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);V(e,function(i,o){n._registerAction(o,i)})},Di.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Tg(e,l5);this._actions[e]=t},Di.prototype.unregister=function(e){if(!this.isRegistered(e))throw Tg(e,l1);this._actions[e]=void 0},Di.prototype.getActions=function(){return Object.keys(this._actions)},Di.prototype.isRegistered=function(e){return!!this._actions[e]};function Tg(e,t){return new Error(e+" "+t)}const u5={__init__:["editorActions"],editorActions:["type",Di]};function dp(e){e.invoke(Di,this)}Be(dp,Di),dp.$inject=["injector"],dp.prototype._registerDefaultActions=function(e){Di.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=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),d=e.get("modeling",!1),f=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}),o&&this._registerAction("spaceTool",function(){o.toggle()}),r&&this._registerAction("lassoTool",function(){r.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=[],_=g.type;h.length&&(y=lt(h,function(m){return!A(m,"bpmn:Lane")}),l.trigger(y,_))}),i&&d&&this._registerAction("setColor",function(g){var h=i.get();h.length&&d.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&&d&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;A(g,"bpmn:Collaboration")?y=n.filter(function(_){return A(_.parent,"bpmn:Collaboration")}):y=n.filter(function(_){return _!==g&&!A(_.parent,"bpmn:SubProcess")}),h=un(y),d.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&f&&this._registerAction("replaceElement",function(g){f.triggerEntry("replace","click",g)})};const p5={__depends__:[u5],editorActions:["type",dp]};function u1(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;st(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}u1.$inject=["eventBus"];function ta(e,t){_e.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;ni(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}ta.$inject=["eventBus","gridSnapping","modeling"],Be(ta,_e),ta.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},ta.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},ta.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),o=/e/.test(t),r={};return r.width=n.snapValue(e.width,{min:e.width}),o&&(i?(r.x=n.snapValue(e.x,{max:e.x}),r.width+=n.snapValue(e.x-r.x,{min:e.x-r.x})):e.x=e.x+e.width-r.width),Y(e,r),e},ta.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),o=/s/.test(t),r={};return r.height=n.snapValue(e.height,{min:e.height}),i&&(o?(r.y=n.snapValue(e.y,{max:e.y}),r.height+=n.snapValue(e.y-r.y,{min:e.y-r.y})):e.y=e.y+e.height-r.height),Y(e,r),e};var d5=2e3;function p1(e,t){e.on(["spaceTool.move","spaceTool.end"],d5,function(n){var i=n.context;if(i.initialized){var o=i.axis,r;o==="x"?(r=t.snapValue(n.dx),n.x=n.x+r-n.dx,n.dx=r):(r=t.snapValue(n.dy),n.y=n.y+r-n.dy,n.dy=r)}})}p1.$inject=["eventBus","gridSnapping"];const f5={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ta],gridSnappingSpaceToolBehavior:["type",p1]};var fp=10;function Pg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var h5=1200,g5=800;function hr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",g5,function(){o.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"],h5,function(r){var a=r.originalEvent;if(!(!o.active||a&&li(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=y5(r,l,e);p&&(u.offset=p);var d=m5(r,l);d&&Y(u,d),Xa(r,l)||o.snapEvent(r,l,u)})}})}hr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);hn(e,t,i)},hr.prototype.getGridSpacing=function(){return fp},hr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Pg(e,fp);var i,o;return t&&t.min&&(i=t.min,Qe(i)&&(i=Pg(i+n,fp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Qe(o)&&(o=Pg(o+n,fp,"floor"),e=Math.min(e,o))),e-=n,e},hr.prototype.isActive=function(){return this.active},hr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},hr.prototype.toggleActive=function(){this.setActive(!this.active)},hr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function m5(e,t){var n=e.context,i=n.createConstraints,o=n.resizeConstraints||{},r=n.gridSnappingContext,a=r.snapConstraints;if(a&&a[t])return a[t];a||(a=r.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(hp(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=o.min,l=o.max;return c&&(hp(t)?f1(s)?a.x.max=c.left:a.x.min=c.right:d1(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(hp(t)?f1(s)?a.x.min=l.left:a.x.max=l.right:d1(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function y5(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Qe(s[t])||(s||(s=r.snapOffset={}),Qe(s[t])||(s[t]=0),!o)||(n.get(o.id)||(hp(t)?s[t]+=o[t]+o.width/2:s[t]+=o[t]+o.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=o.width/2:/right/.test(a)&&(s[t]+=o.width/2):/top/.test(a)?s[t]-=o.height/2:/bottom/.test(a)&&(s[t]+=o.height/2)),s[t]}function hp(e){return e==="x"}function d1(e){return e.indexOf("n")!==-1}function f1(e){return e.indexOf("w")!==-1}const v5={__depends__:[f5],__init__:["gridSnapping"],gridSnapping:["type",hr]};var x5=1750;function h1(e,t,n){t.on(["create.start","shape.move.start"],x5,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!A(r,"bpmn:Participant")||!A(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}h1.$inject=["canvas","eventBus","gridSnapping"];const b5={__depends__:[v5,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Jh],gridSnappingParticipantBehavior:["type",h1],gridSnappingLayoutConnectionBehavior:["type",za]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",u1]};var w5=30,g1=30;function wc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return ft(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return ft(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}wc.$inject=["eventBus","interactionEvents"],wc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},wc.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=Sn(e)?{width:w5,height:e.height}:{width:e.width,height:g1};return this._interactionEvents.createBoxHit(t,"all",n),!0},wc.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:g1}),!0};const _5={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",wc]};function gp(e){e.invoke(Ga,this)}Be(gp,Ga),gp.$inject=["injector"],gp.prototype.registerBindings=function(e,t){Ga.prototype.registerBindings.call(this,e,t);function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("selectElements",function(i){var o=i.keyEvent;if(e.isKey(["a","A"],o)&&e.isCmd(o))return t.trigger("selectElements"),!0}),n("find",function(i){var o=i.keyEvent;if(e.isKey(["f","F"],o)&&e.isCmd(o))return t.trigger("find"),!0}),n("spaceTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["s","S"],o))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["l","L"],o))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["h","H"],o))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["c","C"],o))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["e","E"],o))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var o=i.keyEvent;if(!e.hasModifier(o)&&e.isKey(["r","R"],o))return t.trigger("replaceElement",o),!0})};const E5={__depends__:[og],__init__:["keyboardBindings"],keyboardBindings:["type",gp]};var S5={moveSpeed:1,moveSpeedAccelerated:10},R5=1500,m1="left",y1="up",v1="right",x1="down",C5={ArrowLeft:m1,Left:m1,ArrowUp:y1,Up:y1,ArrowRight:v1,Right:v1,ArrowDown:x1,Down:x1},M5={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 b1(e,t,n,i,o){var r=this;this._config=Y({},S5,e||{}),t.addListener(R5,function(a){var s=a.keyEvent,c=C5[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return r.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=o.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=M5[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}b1.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const A5={__depends__:[og,Ai],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",b1]};var w1=10;function _c(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,d=c.resizeConstraints,f;c.delta=l,f=q2(u,p,l),c.newBounds=K2(f,d),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:Ye(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=fx(p),!T5(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};r(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}_c.prototype.canResize=function(e){var t=this._rules,n=$i(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},_c.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=Y({shape:t},n),r=o.direction,!r)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,_1(t,r),"resize",{autoActivate:!0,cursor:P5(r),data:{shape:t,context:o}})},_c.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:w1,height:w1},o=nb(t,e.childrenBoxPadding),X2(n,t,i,o)},_c.$inject=["eventBus","rules","modeling","dragging"];function T5(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function _1(e,t){var n=et(e),i=Ye(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function P5(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 E1="djs-resizing",S1="resize-not-ok",k5=500;function R1(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,E1)),s.width>5&&Le(c,{x:s.x,width:s.width}),s.height>5&&Le(c,{y:s.y,height:s.height}),r.canExecute?dt(c).remove(S1):dt(c).add(S1)}function o(r){var a=r.shape,s=r.frame;s&&ln(r.frame),t.removeMarker(a,E1)}e.on("resize.move",k5,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}R1.$inject=["eventBus","canvas","previewSupport"];var mp=-6,yp=8,vp=20,Ec="djs-resizer",O5=["n","w","s","e","nw","ne","se","sw"];function gr(e,t,n,i){this._resize=i,this._canvas=t;var o=this;e.on("selection.changed",function(r){var a=r.newSelection;o.removeResizers(),a.length===1&&V(a,Zn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}gr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){ir(r)&&i.activate(r,e,n)}Ue.bind(t,"mousedown",o),Ue.bind(t,"touchstart",o)},gr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=D5(i),a=He("g");dt(a).add(Ec),dt(a).add(Ec+"-"+e.id),dt(a).add(Ec+"-"+i),nt(o,a);var s=He("rect");Le(s,{x:-yp/2+r.x,y:-yp/2+r.y,width:yp,height:yp}),dt(s).add(Ec+"-visual"),nt(a,s);var c=He("rect");return Le(c,{x:-vp/2+r.x,y:-vp/2+r.y,width:vp,height:vp}),dt(c).add(Ec+"-hit"),nt(a,c),Cl(a,t,n),a},gr.prototype.createResizer=function(e,t){var n=_1(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},gr.prototype.addResizer=function(e){var t=this;Dt(e)||V(O5,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},gr.prototype.removeResizers=function(){var e=this._getResizersParent();Ss(e)},gr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},gr.$inject=["eventBus","canvas","selection","resize"];function D5(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-mp:e.indexOf("w")!==-1&&(t.x=mp),e.indexOf("s")!==-1?t.y=-mp:e.indexOf("n")!==-1&&(t.y=mp),t}const C1={__depends__:[ao,Co,$a],__init__:["resize","resizePreview","resizeHandles"],resize:["type",_c],resizePreview:["type",R1],resizeHandles:["type",gr]};var L5=2e3;function Sc(e,t,n,i,o,r,a){this._bpmnFactory=t,this._canvas=n,this._modeling=o,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"],L5,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,d=c.isTouch;d||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||st(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Sc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Sc.prototype.activate=function(e){var t=si(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);Y(n,i);var o={},r=n.style||{};return Y(r,{backgroundColor:null,border:null}),(st(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||M1(e))&&Y(o,{centerVertically:!0}),Qo(e)&&(Y(o,{resizable:!0,autoResize:!0}),Y(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(Y(o,{resizable:!0,autoResize:!0}),Y(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),Y(n,{options:o,style:r}),n}},Sc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={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,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(A(e,"bpmn:Lane")||N5(e)){var g=Sn(e),h=g?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o.y-30*a/2}:{width:i.width,height:30*a};Y(r,h),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(B5(e)){var y=Sn(e),_=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};Y(r,_),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(st(e,["bpmn:Task","bpmn:CallActivity"])||M1(e))&&(Y(r,{width:i.width,height:i.height}),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),I5(e)&&(Y(r,{width:i.width,x:i.x}),Y(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var m=1,v=i.width+2*m;if(n.labelTarget&&(Y(r,{width:v,height:i.height+2*m,x:i.x-m,y:i.y-m}),Y(f,{fontSize:l+"px",lineHeight:u})),Qo(n)&&!Tl(n)&&!at(n)){var b=cf(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),C=l,I=Hr.width*a+2*m;Y(r,{width:I,height:C+2*m,x:E.x-I/2,y:E.y-C/2-m}),Y(f,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(Y(r,{width:i.width+2*m,height:i.height+2*m,x:i.x-m,y:i.y-m,minWidth:30*a,minHeight:10*a}),Y(f,{textAlign:"left",paddingTop:Ca*a+"px",paddingBottom:Ca*a+"px",paddingLeft:Ca*a+"px",paddingRight:Ca*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Sc.prototype.update=function(e,t,n,i){var o,r;A(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),$5(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function M1(e){return A(e,"bpmn:SubProcess")&&!ft(e)}function I5(e){return A(e,"bpmn:SubProcess")&&ft(e)}function B5(e){return A(e,"bpmn:Participant")&&!ft(e)}function N5(e){return A(e,"bpmn:Participant")&&ft(e)}function $5(e){return!e||!e.trim()}var A1="djs-element-hidden",T1="djs-label-hidden";function P1(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,A(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=He("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=He("path");Le(p,{d:u,strokeWidth:2,stroke:F5(r)}),nt(s,p),nt(o,s),In(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,A1):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,T1)}),e.on("directEditing.resize",function(c){if(A(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),d=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});Le(i.path,{d})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,A1),t.removeMarker(r,T1)),r=void 0,a=void 0,s&&(ln(s),s=void 0)})}P1.$inject=["eventBus","canvas","pathMap"];function F5(e,t){var n=gt(e);return n.get("stroke")||t||"black"}const j5={__depends__:[Ch,C1,n1],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Sc],labelEditingPreview:["type",P1]};var H5=500,z5=1e3;function uo(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function o(r){ZP(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){V(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],H5,function(r){var a=r.element,s=r.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}uo.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(),nt(t,n),this.updateOutline(e,n)),n},uo.prototype._createOutlineGfx=function(){var e=He("rect");return Le(e,Y({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},uo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},uo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&V(i,function(o){n=n||o.updateOutline(t,e)}),n||Le(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},uo.prototype.updateConnectionOutline=function(e,t){var n=un(t);Le(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},uo.prototype.registerProvider=function(e,t){t||(t=e,e=z5),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},uo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},uo.prototype.getOutline=function(e){var t,n=this._getProviders();return V(n,function(i){En(i.getOutline)&&(t=t||i.getOutline(e))}),t},uo.$inject=["eventBus","styles","elementRegistry"];var xp=6;function kg(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(o){n.isSelected(o.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(o){var r=o.newSelection;i._updateMultiSelectionOutline(r)})}kg.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ss(t);var n=e.length>1,i=this._canvas.getContainer();if(dt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=G5(un(e)),r=He("rect");Le(r,Y({rx:3},o)),dt(r).add("djs-selection-outline"),nt(t,r)}},kg.$inject=["eventBus","canvas","selection"];function G5(e){return{x:e.x-xp,y:e.y-xp,width:e.width+xp*2,height:e.height+xp*2}}const Og={__depends__:[Ai],__init__:["outline","multiSelectionOutline"],outline:["type",uo],multiSelectionOutline:["type",kg]},k1=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],O1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},V5=15,bp=2;function D1(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var f;const d=p.filter(g=>st(g,k1));if(d.length===1){const g=d[0];at(g)?a(g,g.labelTarget):(f=g.labels)!=null&&f.length&&a(g.labels[0],g)}if(d.length===2){const g=d.find(at),h=d.find(y=>{var _;return(_=y.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var d;!st(p,k1)||!u(p)||(at(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=Ms([et(d),et(p)],O1),g=f.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),_=ks(y,g);if(!_)return;const v=o.isSelected(d)?c(d):l(d),b=ks(v,g)||et(d);Hs(b,_)<V5||(Qd(f,[b,_]),nt(r,f))}function s(){Es(`.${O1.class}`,r).forEach(ln)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+mr(d,"x")-bp,y:p.y+mr(d,"y")-bp,width:mr(d,"width")+bp*2,height:mr(d,"height")+bp*2};return uf(f,mr(d,"rx"))}if(d.cx){const f=mr(d,"r"),g={x:p.x+mr(d,"cx")-f,y:p.y+mr(d,"cy")-f,width:f*2,height:f*2};return Fx(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}D1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function mr(e,t){return parseFloat(Le(e,t)||0)}const W5={__depends__:[Ai,Og],__init__:["labelLink"],labelLink:["type",D1]};var U5=new Ur("tt");function q5(e){var t=Ht('<div class="djs-tooltip-container" />');return Yn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Y5(e,t,n){Yn(e,{left:t+"px",top:n+"px"})}function Dg(e,t){e.style.display=t===!1?"none":""}var L1="djs-tooltip",Lg="."+L1;function ei(e,t){this._eventBus=e,this._canvas=t,this._ids=U5,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=q5(t.getContainer());var n=this;ri.bind(this._tooltipRoot,Lg,"mousedown",function(i){i.stopPropagation()}),ri.bind(this._tooltipRoot,Lg,"mouseover",function(i){n.trigger("mouseover",i)}),ri.bind(this._tooltipRoot,Lg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ei.$inject=["eventBus","canvas"],ei.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=Y({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ei.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(An(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ei.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ei.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ei.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)}},ei.prototype.remove=function(e){var t=this.get(e);t&&(eo(t.html),eo(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ei.prototype.show=function(){Dg(this._tooltipRoot)},ei.prototype.hide=function(){Dg(this._tooltipRoot,!1)},ei.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},ei.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),ni(n)&&(n=Ht(n)),i=Ht('<div data-tooltip-id="'+t+'" class="'+L1+'">'),Yn(i,{position:"absolute"}),i.appendChild(n),e.type&&Mt(i).add("djs-tooltip-"+e.type),e.className&&Mt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ei.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Y5(n,t.x,t.y)},ei.prototype._updateTooltipVisibilty=function(e){V(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Dg(i,o))})},ei.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 K5={__init__:["tooltips"],tooltips:["type",ei]};var X5="flow elements must be children of pools/participants",Z5="Data object must be placed within a pool/participant.";function I1(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(X5)):A(a,"bpmn:DataObjectReference")&&i(o,n(Z5)))})}I1.$inject=["eventBus","tooltips","translate"];const J5={__depends__:[K5],__init__:["modelingFeedback"],modelingFeedback:["type",I1]};var Q5=500,e3=1250,t3=1500,wp=Math.round;function n3(e){return{x:e.x+wp(e.width/2),y:e.y+wp(e.height/2)}}function B1(e,t,n,i,o){function r(s,c,l,u){return o.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",t3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=i3(u),Y(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",e3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",Q5,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},d={x:s.x,y:s.y},f;if(f=r(l,p,d,u),c.delta=p,c.canExecute=f,f===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",d=c.shapes;if(u===!1)return!1;l.x=wp(l.x),l.y=wp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(d,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ir(s)){var c=La(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(vn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!dt(s.target).has("djs-hit-no-move")){var p=n3(c),d=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(d!==!1)return!0}}this.start=a}B1.$inject=["eventBus","dragging","modeling","selection","rules"];function i3(e){var t=pa(e,"id");return lt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var N1=499,Ig="djs-dragging",$1="drop-ok",F1="drop-not-ok",j1="new-parent",H1="attach-ok";function z1(e,t,n,i){function o(c){var l=r(c),u=o3(l);return u}function r(c){var l=As(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[H1,$1,F1,j1].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,Ig),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",N1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=He("g");Le(f,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();nt(g,f),l.dragGroup=f}d.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=Fp([p,r(u)]):p=r(u),V(p,function(h){t.addMarker(h,Ig)}),l.allDraggedElements=p,l.differentParents=r3(u)}),e.on("shape.move.move",N1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,H1):l.canExecute&&d&&p.id!==d.id?a(p,j1):a(p,l.canExecute?$1:F1)),In(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;V(u,function(d){t.removeMarker(d,Ig)}),p&&ln(p)}),this.makeDraggable=s}z1.$inject=["eventBus","canvas","styles","previewSupport"];function o3(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=lt(e,function(i){return Dt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function r3(e){return SR(pa(e,function(t){return t.parent&&t.parent.id}))!==1}const a3={__depends__:[au,Ai,Og,ao,Co,$a],__init__:["move","movePreview"],move:["type",B1],movePreview:["type",z1]};var G1=".djs-palette-toggle",V1=".entry",s3=G1+", "+V1,Bg="djs-palette-",c3="shown",Ng="open",W1="two-column",l3=1e3;function gn(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var o=i.tool;n.updateToolHighlight(o)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}gn.$inject=["eventBus","canvas"],gn.prototype.registerProvider=function(e,t){t||(t=e,e=l3),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},gn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(p3,{})},gn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},gn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ht(gn.HTML_MARKUP);n.appendChild(i),Mt(n).add(Bg+c3),ri.bind(i,s3,"click",function(o){var r=o.delegateTarget;if(Gd(r,G1))return e.toggle();e.trigger("click",o)}),Ue.bind(i,"mousedown",function(o){o.stopPropagation()}),ri.bind(i,V1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},gn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},gn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Mt(n),a=Mt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(W1,o),a.toggle(Bg+W1,o),"open"in e&&(r.toggle(Ng,e.open),a.toggle(Bg+Ng,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},gn.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ml(e),V(t,function(n,i){var o=n.group||"default",r=Rt("[data-group="+Xr(o)+"]",e);r||(r=Ht('<div class="group"></div>'),An(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ht(a);if(r.appendChild(s),!n.separator&&(An(s,"data-action",i),n.title&&An(s,"title",n.title),n.className&&u3(s,n.className),n.imageUrl)){var c=Ht("<img>");An(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},gn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=An(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},gn.prototype.triggerEntry=function(e,t,n,i){var o=this._entries,r,a;if(r=o[e],!!r&&(a=r.action,this._eventBus.fire("palette.trigger",{entry:r,event:n})!==!1)){if(En(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},gn.prototype._layoutChanged=function(){this._toggleState({})},gn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},gn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},gn.prototype.open=function(){this._toggleState({open:!0})},gn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},gn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},gn.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,V(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Mt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},gn.prototype.isOpen=function(){return Mt(this._container).has(Ng)},gn.prototype._getParentContainer=function(){return this._canvas.getContainer()},gn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function u3(e,t){var n=Mt(e),i=Je(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function p3(e,t){var n=t.getPaletteEntries();return En(n)?n(e):(V(n,function(i,o){e[o]=i}),e)}const d3={__init__:["palette"],palette:["type",gn]};var U1="crosshair",q1="selected",f3="djs-dragging-active-lasso";function yr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var d=t.getActiveLayer(),f=p.frame=He("rect");Le(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),nt(d,f),l(!0),this.update(p)},update:function(p){var d=p.frame,f=p.bbox;d&&f&&Le(d,{x:f.x,y:f.y,width:f.width,height:f.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,q1);for(const y of g)h.has(y)||t.addMarker(y,q1)}},remove:function(p){this.update(p),p.frame&&ln(p.frame),l(!1)}};function l(p){dt(t.getContainer()).toggle(f3,p)}function u(p){var d=i.getAll();return new Set(ua(_a(d,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var d=p.originalEvent.target;!p.hover&&!(d instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var d=p.context;s._select(Array.from(d.marked))}),e.on("lasso.start",function(p){var d=p.context;d.bbox=Y1(p),d.add=Ql(p),d.lastMarked=new Set(o.get()),d.add?d.marked=d.lastMarked:d.marked=new Set,d.initialMarked=d.marked,c.create(d)}),e.on("lasso.move",function(p){var d=p.context,f=d.bbox=Y1(p),g=u(f),h=d.initialMarked.union(g);d.lastMarked=d.marked,d.marked=h,c.update(d)}),e.on("lasso.cleanup",function(p){var d=p.context;d.lastMarked=d.marked,d.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Ql(p))return s.activateLasso(p.originalEvent),!0})}yr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],yr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:U1,data:{context:{}},keepSelection:!0})},yr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:U1,data:{context:{}},keepSelection:!0})},yr.prototype._select=function(e){this._selection.select(e)},yr.prototype.select=function(e,t,n=[]){var i=ua(_a(e,t));this._select([...n,...i])},yr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},yr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Y1(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 h3={__depends__:[uu,qs],__init__:["lassoTool"],lassoTool:["type",yr]};var $g=1500,K1="grab";function Za(e,t,n,i,o,r){this._dragging=n,this._mouse=r;var a=this,s=i.get("keyboard",!1);o.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",$g,function(c){if(Vs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener($g,function(c){if(!(!X1(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener($g,function(c){!X1(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!Vs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Za.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Za.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:K1,data:{context:n||{}}})},Za.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:K1,data:{context:{reactivate:n}}})},Za.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Za.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function X1(e){return bn("Space",e)}const g3={__depends__:[uu,qs],__init__:["handTool"],handTool:["type",Za]};var Z1="connect-ok",J1="connect-not-ok";function Ja(e,t,n,i,o,r,a){var s=this;this._dragging=t,this._rules=r,this._mouse=a,o.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?Z1:J1))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?Z1:J1)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},d=s.canStartConnect(u);if(d)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})}Ja.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Ja.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Ja.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Ja.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ja.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const m3={__depends__:[Mg,ao,Co,uu,qs],globalConnect:["type",Ja]};function Fg(e,t,n,i,o,r,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=o,this._handTool=r,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Fg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Fg.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,d,f,g,h){function y(_){var m=n.createShape(Y({type:p},h));t.start(_,m)}return{group:d,className:f,title:g,action:{dragstart:y,click:y}}}function l(p){var d=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),f=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:d});t.start(p,[d,f],{hints:{autoSelect:[d]}})}function u(p){t.start(p,n.createParticipantShape())}return Y(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){r.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){o.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 y3={__depends__:[d3,cu,i_,h3,g3,m3,Ns],__init__:["paletteProvider"],paletteProvider:["type",Fg]};var v3=250;function jg(e,t,n,i,o){_e.call(this,e);function r(s){var c=s.canExecute.replacements;V(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);Y(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var g=Rt('[data-element-id="'+Xr(d.id)+'"]',s.dragGroup);g&&Le(g,{display:"none"});var h=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;V(c,function(l,u){var p=Rt('[data-element-id="'+Xr(u)+'"]',s.dragGroup);p&&Le(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",v3,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}jg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Be(jg,_e);const x3={__depends__:[$a],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",jg]};var b3=1250,Hg=40,w3=20,_3=10,Q1=20,eS=["x","y"],E3=Math.abs;function tS(e){e.on(["connect.hover","connect.move","connect.end"],b3,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&li(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&S3(t,r,A3(r)),r&&M3(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=ki(o),st(r,["bpmn:Event","bpmn:Gateway"])&&nS(t,ki(r)),st(r,["bpmn:Task","bpmn:SubProcess"])&&R3(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&C3(t)):iS(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=ki(o)),A(r,"bpmn:Event")&&nS(t,ki(r))):n.connectionStart=n.initialConnectionStart)})}tS.$inject=["eventBus"];function S3(e,t,n){eS.forEach(function(i){var o=oS(i,t);e[i]<t[i]+n?hn(e,i,t[i]+n):e[i]>t[i]+o-n&&hn(e,i,t[i]+o-n)})}function R3(e,t){var n=ki(t);eS.forEach(function(i){T3(e,t,i)&&hn(e,i,n[i])})}function C3(e){var t=e.context,n=t.source,i=t.target;if(!P3(t)){var o=ki(n),r=Ln(o,i,-10),a=[];/top|bottom/.test(r)&&a.push("x"),/left|right/.test(r)&&a.push("y"),a.forEach(function(s){var c=e[s],l;E3(c-o[s])<Hg&&(c>o[s]?l=o[s]+Hg:l=o[s]-Hg,hn(e,s,l))})}}function nS(e,t){hn(e,"x",t.x),hn(e,"y",t.y)}function iS(e,t){return e&&e.type===t}function M3(e,t){return No(t,function(n){return iS(e,n)})}function oS(e,t){return e==="x"?t.width:t.height}function A3(e){return A(e,"bpmn:Task")?_3:w3}function T3(e,t,n){return e[n]>t[n]+Q1&&e[n]<t[n]+oS(n,t)-Q1}function P3(e){var t=e.hover,n=e.source;return t&&n&&t===n}function vr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}vr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},vr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},vr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},vr.prototype.getSnapLocations=function(){return this._snapLocations},vr.prototype.setSnapLocations=function(e){this._snapLocations=e},vr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new _p,n.initDefaults(this._defaultSnaps)),n};function _p(){this._snapValues={}}_p.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)},_p.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&R$(e[n],o[n],i)},_p.prototype.initDefaults=function(e){var t=this;V(e||{},function(n,i){V(n,function(o){t.add(i,o)})})};var k3=1250;function po(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(o){i.initSnap(o)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],k3,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&li(o.originalEvent))&&!(Xa(o)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(o,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}po.$inject=["elementRegistry","eventBus","snapping"],po.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new vr);var r;t.get(i.id)?r=ki(i,e):r={x:e.x+ki(i).x,y:e.y+ki(i).y};var a={x:r.x-i.width/2,y:r.y-i.height/2},s={x:r.x+i.width/2,y:r.y+i.height/2};return o.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),at(i)||(o.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),o.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),o},po.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return V(i,function(o){if(at(o)){at(t)&&e.add("mid",ki(o));return}if(Dt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);V(r,function(a){e.add("mid",a)});return}e.add("mid",ki(o))}),!Qe(t.x)||!Qe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",ki(t)),e},po.prototype.getSnapTargets=function(e,t){return WE(t).filter(function(n){return!O3(n)})};function O3(e){return!!e.hidden}var rS=1500;function Qa(e,t){t.invoke(po,this),e.on(["create.move","create.end"],rS,B3),e.on(["create.move","create.end","shape.move.move","shape.move.end"],rS,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Xa(n)&&D3(n,r)})}Be(Qa,po),Qa.$inject=["eventBus","injector"],Qa.prototype.initSnap=function(e){var t=po.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return V(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",sS(r,i,e))}),V(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",sS(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Qa.prototype.addSnapTargetPoints=function(e,t,n){po.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);V(i,function(r){(I3(r)||L3([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",GE(r)),e.add("bottom-right",VE(r)))});var o=this._elementRegistry;return V(t.incoming,function(r){if(o.get(t.id)){aS(i,r.source)||e.add("mid",et(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),V(t.outgoing,function(r){if(o.get(t.id)){aS(i,r.target)||e.add("mid",et(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),A(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Qa.prototype.getSnapTargets=function(e,t){return po.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function D3(e,t){var n=Ye(t),i=Qb(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=et(r),/top/.test(i)?hn(e,"y",n.top-a.y):/bottom/.test(i)&&hn(e,"y",n.bottom-a.y),/left/.test(i)?hn(e,"x",n.left-a.x):/right/.test(i)&&hn(e,"x",n.right-a.x)}function L3(e,t){return e.every(function(n){return A(n,t)})}function I3(e){return A(e,"bpmn:SubProcess")&&ft(e)?!0:A(e,"bpmn:Participant")}function B3(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,o=n.right,r=n.bottom,a=n.left;(a&&a>=e.x||o&&o<=e.x)&&hn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&hn(e,"y",e.y)}}function aS(e,t){return e.indexOf(t)!==-1}function sS(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var N3=1250;function Rc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],N3,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&li(i.originalEvent))&&!Xa(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),j3(s)&&hn(i,"x",i.x),H3(s)&&hn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Rc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new vr);var r=cS(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Rc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return V(o,function(r){e.add("corner",VE(r)),e.add("corner",GE(r))}),e.add("corner",cS(t,i)),e},Rc.$inject=["eventBus","snapping"],Rc.prototype.getSnapTargets=function(e,t){return WE(t).filter(function(n){return!$3(n,e)&&!Dt(n)&&!F3(n)&&!at(n)})};function cS(e,t){var n=et(e),i=Ye(e),o={x:n.x,y:n.y};return t.indexOf("n")!==-1?o.y=i.top:t.indexOf("s")!==-1&&(o.y=i.bottom),t.indexOf("e")!==-1?o.x=i.right:t.indexOf("w")!==-1&&(o.x=i.left),o}function $3(e,t){return e.host===t}function F3(e){return!!e.hidden}function j3(e){return e==="n"||e==="s"}function H3(e){return e==="e"||e==="w"}var z3=7,G3=1e3;function xr(e){this._canvas=e,this._asyncHide=Hp(Zn(this.hide,this),G3)}xr.$inject=["canvas"],xr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Xa(e,"x"),y:Xa(e,"y")};V(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(V(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,z3),u!==void 0&&(r[l]={value:u,originValue:u-s[l]}))}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),V(["x","y"],function(a){var s=r[a];vn(s)&&hn(e,a,s.originValue)})},xr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=He("path");return Le(n,{d:"M0,0 L0,0"}),dt(n).add("djs-snap-line"),nt(t,n),{update:function(i){Qe(i)?e==="horizontal"?Le(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Le(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Le(n,{display:"none"})}}},xr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},xr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},xr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},xr.prototype.hide=function(){V(this._snapLines,function(e){e.update()})};const V3={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",po],resizeSnapping:["type",Rc],snapping:["type",xr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",tS],createMoveSnapping:["type",Qa]};var lS=300;function ot(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(ot.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(ot.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ot.$inject=["canvas","eventBus","selection","translate"],ot.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ri.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ot.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ot.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ot.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ot.INPUT_SELECTOR,"keydown",function(n){bn("ArrowUp",n)&&n.preventDefault(),bn("ArrowDown",n)&&n.preventDefault()}),t(this._container,ot.INPUT_SELECTOR,"keyup",function(n){if(bn("Escape",n))return e.close();if(bn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(bn("ArrowUp",n))return e._scrollToDirection(!0);if(bn("ArrowDown",n))return e._scrollToDirection();bn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ot.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ri.unbind(e.el,e.type,e.listener)})},ot.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(o){return!t._canvas.getRootElements().includes(o.element)}),!n.length){this._selection.select(null);return}n.forEach(function(o){var r=o.element.id,a=t._createResultNode(o,r);t._results[r]={element:o.element,node:a}});var i=Rt(ot.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ot.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ot.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)}},ot.prototype._clearResults=function(){ml(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ot.prototype._getCurrentResult=function(){return Rt(ot.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ot.prototype._createResultNode=function(e,t){var n=Ht(ot.RESULT_HTML);return e.primaryTokens.length>0&&uS(n,e.primaryTokens,ot.RESULT_PRIMARY_HTML),uS(n,e.secondaryTokens,ot.RESULT_SECONDARY_HTML),An(n,ot.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ot.prototype.registerProvider=function(e){this._searchProvider=e},ot.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,Mt(this._canvas.getContainer()).add("djs-search-open"),Mt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ot.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,Mt(this._canvas.getContainer()).remove("djs-search-open"),Mt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ot.prototype.isOpen=function(){return this._open},ot.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Mt(t).remove(ot.RESULT_SELECTED_CLASS);var n=An(e,ot.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Mt(e).add(ot.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:lS}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ot.prototype._select=function(e){var t=An(e,ot.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:lS}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ot.prototype._getBoxHtml=function(){const e=Ht(ot.BOX_HTML),t=Rt(ot.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function uS(e,t,n){var i=W3(t),o=Ht(n);o.innerHTML=i,e.appendChild(o)}function W3(e){var t="";return e.forEach(function(n){var i=u0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+ot.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ot.CONTAINER_SELECTOR=".djs-search-container",ot.INPUT_SELECTOR=".djs-search-input input",ot.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ot.RESULT_SELECTOR=".djs-search-result",ot.RESULT_SELECTED_CLASS="djs-search-result-selected",ot.RESULT_SELECTED_SELECTOR="."+ot.RESULT_SELECTED_CLASS,ot.RESULT_ID_ATTRIBUTE="data-result-id",ot.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ot.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
336
335
|
<div class="djs-search-input">
|
|
337
336
|
<svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
338
337
|
<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 +339,4 @@
|
|
|
340
339
|
<input type="text" spellcheck="false" />
|
|
341
340
|
</div>
|
|
342
341
|
<div class="djs-search-results" />
|
|
343
|
-
</div>`,ot.RESULT_HTML='<div class="djs-search-result"></div>',ot.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ot.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const S3={__depends__:[Ns,Hu,Ai],searchPad:["type",ot]};function Hg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Hg.$inject=["elementRegistry","searchPad","canvas","search"],Hg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!at(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:si(i),id:i.id})),e,{keys:["label","id"]}).map(R3)};function R3(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const C3={__depends__:[S3,pE],__init__:["bpmnSearch"],bpmnSearch:["type",Hg]},M3="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",A3="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",P3={width:36,height:50},T3={width:50,height:50};function Q1(e,t,n){return He("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Li=5;function Ep(e,t){this._styles=t,e.registerProvider(this)}Ep.$inject=["outline","styles"],Ep.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(Ek(e))return n=He("rect"),Le(n,Y({x:-Li,y:-Li,rx:4,width:e.width+Li*2,height:e.height+Li*2},t)),n;if(!at(e))return A(e,"bpmn:Gateway")?(n=He("rect"),Y(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Le(n,Y({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):st(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=He("rect"),Le(n,Y({x:-Li,y:-Li,rx:14,width:e.width+Li*2,height:e.height+Li*2},t))):A(e,"bpmn:EndEvent")?(n=He("circle"),Le(n,Y({cx:e.width/2,cy:e.height/2,r:e.width/2+Li+1},t))):A(e,"bpmn:Event")?(n=He("circle"),Le(n,Y({cx:e.width/2,cy:e.height/2,r:e.width/2+Li},t))):A(e,"bpmn:DataObjectReference")&&eS(e,"bpmn:DataObjectReference")?n=Q1(M3,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&eS(e,"bpmn:DataStoreReference")&&(n=Q1(A3,{x:-6,y:-6},t)),n},Ep.prototype.updateOutline=function(e,t){if(!at(e))return st(e,["bpmn:SubProcess","bpmn:Group"])?(Le(t,{width:e.width+Li*2,height:e.height+Li*2}),!0):!!st(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function eS(e,t){var n;return t==="bpmn:DataObjectReference"?n=P3:t==="bpmn:DataStoreReference"&&(n=T3),e.width===n.width&&e.height===n.height}const k3={__depends__:[kg],__init__:["outlineProvider"],outlineProvider:["type",Ep]};var O3='<?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 fo(e){jr.call(this,e)}Be(fo,jr),fo.Viewer=dr,fo.NavigatedViewer=uc,fo.prototype.createDiagram=function(){return this.importXML(O3)},fo.prototype._interactionModules=[h0,m0,x0],fo.prototype._modelingModules=[VN,Pu,UN,L_,r$,Cg,p$,B$,Lw,su,j$,G$,J$,e5,t5,a5,v5,E5,zh,T5,$5,K5,Z5,h1,_3,C3,k3],fo.prototype._modules=[].concat(dr.prototype._modules,fo.prototype._interactionModules,fo.prototype._modelingModules);const D3=Se.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Se.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=cd(u);return o("imported",p),{warnings:p}}catch(u){throw o("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 Se.onMounted(async()=>{a=new fo({container:r.value,moddleExtensions:fs,additionalModules:[...r0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Se.watch(()=>i.xml,l=>{l&&a&&s(l)}),Se.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Se.openBlock(),Se.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),zg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},L3=zg(D3,[["__scopeId","data-v-7cfbebdb"]]),I3=["title","aria-expanded"],B3=["title","onClick"],N3={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},$3={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},F3={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},j3={key:0,class:"bwl-validation__body"},H3={key:0,class:"bwl-validation__empty"},z3={key:1,class:"bwl-validation__empty"},G3={key:2,class:"bwl-validation__list"},V3=["onClick"],W3={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},U3={class:"bwl-validation__msg"},q3=["title"],Y3=zg(Se.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Se.computed(()=>G_(n.issues.value,n.describeElement)),o=Se.computed(()=>V_(i.value)),r=g=>Ha(g,n.changeScope.value),a=Se.computed(()=>Kh(i.value,n.changeScope.value)),s=Se.ref({error:!0,warning:!0,info:!0}),c=Se.computed(()=>W_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=Se.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function f(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(Se.openBlock(),Se.createElementBlock("section",{class:Se.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Se.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[Se.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Se.openBlock(),Se.createElementBlock("svg",{class:Se.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[Se.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=Se.createElementVNode("span",null,"검증",-1))],8,I3),Se.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=Se.withModifiers(()=>{},["stop"]))},[(Se.openBlock(),Se.createElementBlock(Se.Fragment,null,Se.renderList(u,y=>Se.createElementVNode("button",{key:y,type:"button",class:Se.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:w=>d(y)},[(Se.openBlock(),Se.createElementBlock("svg",N3,[h[4]||(h[4]=Se.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(Se.openBlock(),Se.createElementBlock("path",$3)):(Se.openBlock(),Se.createElementBlock("path",F3))])),Se.createElementVNode("span",null,Se.toDisplayString(o.value[y]),1)],10,B3)),64))])]),l.value?(Se.openBlock(),Se.createElementBlock("div",j3,[i.value.length===0?(Se.openBlock(),Se.createElementBlock("p",H3,"발견된 문제가 없습니다.")):c.value.length===0?(Se.openBlock(),Se.createElementBlock("p",z3," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Se.openBlock(),Se.createElementBlock("ul",G3,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(c.value,y=>(Se.openBlock(),Se.createElementBlock("li",{key:y.key,class:Se.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:w=>f(y)},[h[5]||(h[5]=Se.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(Se.openBlock(),Se.createElementBlock("span",W3,"이번 변경")):Se.createCommentVNode("",!0),Se.createElementVNode("span",U3,Se.toDisplayString(y.message),1),Se.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},Se.toDisplayString(y.category),9,q3)],10,V3))),128))]))])):Se.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),K3={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},X3=["aria-checked","title","data-locale","onClick"],Z3={class:"bwl-locale__label"},J3={key:0,class:"bwl-locale__badge"},Q3=zg(Se.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=Se.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(Se.openBlock(),Se.createElementBlock("div",K3,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(o.value,s=>(Se.openBlock(),Se.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Se.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=>Se.unref(n).setDisplayLocale(s.locale)},[Se.createElementVNode("span",Z3,Se.toDisplayString(s.label),1),s.pending>0?(Se.openBlock(),Se.createElementBlock("span",J3,Se.toDisplayString(s.pending),1)):Se.createCommentVNode("",!0)],10,X3))),128))])):Se.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ce.ADDABLE_FLOW_NODE_TYPES=Dc,ce.APPLY_BPMN_OPS_SCHEMA=BR,ce.BPMN_EVENT_DEFINITION_TYPES=Ic,ce.BPMN_MODDLE_EXTENSIONS=fs,ce.BPMN_MODELER_VIEW_MODULES=r0,ce.BWL_MODDLE_SCHEMA=lm,ce.BWL_NS=cm,ce.BWL_PREFIX=Bp,ce.BWL_REVIEW_REQUEST_TYPE=Nc,ce.BWL_SIDES=Np,ce.BpmnDisplayLocaleSwitcher=Q3,ce.BpmnModelerView=L3,ce.BpmnValidationPanel=Y3,ce.EDITOR=fP,ce.FLOW_LABEL_INDENT=Wm,ce.GROUP_BORDER_MIN_RUN=ld,ce.GROUP_BORDER_NEAR=ma,ce.HEADLESS_BPMN_MODULES=Uh,ce.HEADLESS_TEXT_METRICS=Zi,ce.HeadlessReplay=Jh,ce.HeadlessReplayModule=Z_,ce.I18N_DISPLAY_REDRAWN_EVENT=Iu,ce.I18N_NS=vR,ce.I18N_PREFIX=mm,ce.I18N_REVIEW_REQUESTED_CLASS=q_,ce.I18N_TRANSLATION_TYPE=Pr,ce.I18N_UNTRANSLATED_CLASS=U_,ce.I18nDisplay=Xh,ce.I18nDisplayModule=K_,ce.IR_EVENT_DEFINITIONS=Lc,ce.IR_FLOW_NODE_TYPES=Mr,ce.IR_TEXT_LOCALES=Bc,ce.LABEL_FORK_MARGIN=dd,ce.LABEL_SHAPE_MIN_DEPTH=iy,ce.SET_TRANSLATIONS_COMMAND=Wp,ce.SEVERITY_ORDER=Yh,ce.SYMBOLIC_OP_KINDS=ym,ce.SYMBOLIC_OP_SCHEMA=vm,ce.SetTranslationsHandler=Up,ce.TranslationCommands=Yp,ce.TranslationCommandsModule=Kp,ce.TranslationStateIndex=bP,ce.UNDO_EPISODE_COMMAND=$p,ce.UPDATE_TRANSLATION_COMMAND=jc,ce.UpdateTranslationHandler=Vp,ce.applyBpmnOpBatch=mv,ce.applyBpmnOps=Ld,ce.applyLocaleBackfill=xP,ce.applyTranslationLocaleRestore=RP,ce.approximateTextWidth=Lr,ce.auditBpmnGeometry=ay,ce.auditBpmnGeometryXml=OM,ce.auditBpmnSemantics=Bd,ce.auditBpmnSemanticsXml=eP,ce.auditGeometry=ut,ce.auditTargetsOf=kn,ce.axisSegmentsOf=sn,ce.blackBoxNameRect=ud,ce.buildBpmnOpBatch=cP,ce.buildRegistryIndex=cy,ce.collectTranslationStates=Sv,ce.containerBoundarySegments=va,ce.countBySeverity=V_,ce.createBpmnEditorController=hP,ce.createBpmnModdle=Nm,ce.createHeadlessBpmnModeler=qI,ce.crossedShapesOf=Tt,ce.crossingCost=Gn,ce.describeProcess=cv,ce.describeProcessXml=YA,ce.diffBpmnElements=pv,ce.diffBpmnElementsXml=aP,ce.documentLocalesOf=ls,ce.edgeCrossCount=gs,ce.edgeCrossingPairsOf=Ji,ce.edgeCrossingStatsOf=Jm,ce.executeAsUndoEpisode=pm,ce.feedGeneratedIds=gv,ce.followMovedEdgeLabels=Fy,ce.forwardThreePointCandidates=Jc,ce.geometryFindingKey=ct,ce.inferScriptLocale=hl,ce.installHeadlessBpmnDom=Fm,ce.irEventDefinitionOf=Ip,ce.isAddableFlowNodeType=am,ce.isChangeScopeMixed=Kh,ce.isEdgeOverlapFinding=pd,ce.isGuardedGridSnapping=dB,ce.isInChangeScope=Ha,ce.isIrEventDefinition=sm,ce.isIrFlowNodeType=rm,ce.isIrTextLocale=cR,ce.labelRectsOf=Vo,ce.labelShapeDepth=oy,ce.labelSlot=Tr,ce.lineCrossesLabel=Fi,ce.lineThroughLabel=qm,ce.lineThroughShapeLabel=ny,ce.loadBpmnXml=ga,ce.localeTextsOf=Gp,ce.lowerOps=iv,ce.mergeUndoSteps=fm,ce.oppositeOverlapCount=vM,ce.oppositeOverlapOf=Vm,ce.planBackEdgeBoundaryClearance=Ry,ce.planCrossPoolRoute=by,ce.planEdgeRepair=el,ce.planLabelLineClearance=Pd,ce.planLabelPlacement=By,ce.planLocaleBackfill=vP,ce.planMiddleSegmentShifts=hy,ce.planOppositeOverlapRepair=Py,ce.planSegmentDetours=Zc,ce.planShapeLabelClearance=zy,ce.planTranslationLocaleRestore=SP,ce.poolOverlapsOf=gd,ce.recordGeneratedIds=hv,ce.redockIntroducedDetachedEndpoints=Vy,ce.repairIntroducedBoundaryHugging=Cy,ce.repairIntroducedCrossings=xd,ce.repairIntroducedEdgeCrossings=gy,ce.repairIntroducedFakeMerges=ky,ce.repairIntroducedLabelLines=jy,ce.repairIntroducedOppositeOverlaps=Iy,ce.repairIntroducedShapeLabelLines=Gy,ce.repairIntroducedSharedSegmentLabels=Hy,ce.replayAgentTurn=yv,ce.rerouteIntroducedCrossPoolEdges=wy,ce.resolverServicesOf=Ky,ce.reviewRequestValuesOf=qp,ce.reviewRequestsOf=Fo,ce.rootLangOf=zp,ce.saveBpmnXml=aM,ce.sceneCrossingCost=Zm,ce.sceneFromDefinitions=ry,ce.sceneFromRegistry=Ve,ce.segmentShapeClearance=Go,ce.shapesUnderLabel=ms,ce.sharedEndpointCrossingPairsOf=wi,ce.sharedSegmentUnderLabel=Xc,ce.sharedSpansOf=Kc,ce.sortPanelIssues=W_,ce.toPanelIssues=G_,ce.touchedElements=sP,ce.translationLocale=Mn,ce.translationsOf=$o,ce.undoStepMark=dm,ce.unreadableOverlapCount=Jn,ce.unreadableOverlapOf=Ir,ce.validateOps=Yy,ce.warningMessages=cd,Object.defineProperty(ce,Symbol.toStringTag,{value:"Module"})}));
|
|
342
|
+
</div>`,ot.RESULT_HTML='<div class="djs-search-result"></div>',ot.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ot.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const U3={__depends__:[Ns,Hu,Ai],searchPad:["type",ot]};function zg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}zg.$inject=["elementRegistry","searchPad","canvas","search"],zg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!at(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:si(i),id:i.id})),e,{keys:["label","id"]}).map(q3)};function q3(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const Y3={__depends__:[U3,EE],__init__:["bpmnSearch"],bpmnSearch:["type",zg]},K3="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",X3="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",Z3={width:36,height:50},J3={width:50,height:50};function pS(e,t,n){return He("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Li=5;function Ep(e,t){this._styles=t,e.registerProvider(this)}Ep.$inject=["outline","styles"],Ep.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(Wk(e))return n=He("rect"),Le(n,Y({x:-Li,y:-Li,rx:4,width:e.width+Li*2,height:e.height+Li*2},t)),n;if(!at(e))return A(e,"bpmn:Gateway")?(n=He("rect"),Y(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Le(n,Y({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):st(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=He("rect"),Le(n,Y({x:-Li,y:-Li,rx:14,width:e.width+Li*2,height:e.height+Li*2},t))):A(e,"bpmn:EndEvent")?(n=He("circle"),Le(n,Y({cx:e.width/2,cy:e.height/2,r:e.width/2+Li+1},t))):A(e,"bpmn:Event")?(n=He("circle"),Le(n,Y({cx:e.width/2,cy:e.height/2,r:e.width/2+Li},t))):A(e,"bpmn:DataObjectReference")&&dS(e,"bpmn:DataObjectReference")?n=pS(K3,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&dS(e,"bpmn:DataStoreReference")&&(n=pS(X3,{x:-6,y:-6},t)),n},Ep.prototype.updateOutline=function(e,t){if(!at(e))return st(e,["bpmn:SubProcess","bpmn:Group"])?(Le(t,{width:e.width+Li*2,height:e.height+Li*2}),!0):!!st(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function dS(e,t){var n;return t==="bpmn:DataObjectReference"?n=Z3:t==="bpmn:DataStoreReference"&&(n=J3),e.width===n.width&&e.height===n.height}const Q3={__depends__:[Og],__init__:["outlineProvider"],outlineProvider:["type",Ep]};var eF='<?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 fo(e){jr.call(this,e)}Be(fo,jr),fo.Viewer=dr,fo.NavigatedViewer=pc,fo.prototype.createDiagram=function(){return this.importXML(eF)},fo.prototype._interactionModules=[C0,A0,k0],fo.prototype._modelingModules=[d$,Pu,h$,U_,M$,Mg,D$,o5,Uw,cu,c5,p5,b5,_5,E5,A5,j5,W5,Gh,J5,a3,y3,x3,C1,V3,Y3,Q3],fo.prototype._modules=[].concat(dr.prototype._modules,fo.prototype._interactionModules,fo.prototype._modelingModules);const tF=Se.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Se.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=cd(u);return o("imported",p),{warnings:p}}catch(u){throw o("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 Se.onMounted(async()=>{a=new fo({container:r.value,moddleExtensions:fs,additionalModules:[...y0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Se.watch(()=>i.xml,l=>{l&&a&&s(l)}),Se.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Se.openBlock(),Se.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),Gg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},nF=Gg(tF,[["__scopeId","data-v-7cfbebdb"]]),iF=["title","aria-expanded"],oF=["title","onClick"],rF={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},aF={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},sF={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},cF={key:0,class:"bwl-validation__body"},lF={key:0,class:"bwl-validation__empty"},uF={key:1,class:"bwl-validation__empty"},pF={key:2,class:"bwl-validation__list"},dF=["onClick"],fF={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},hF={class:"bwl-validation__msg"},gF=["title"],mF=Gg(Se.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Se.computed(()=>t0(n.issues.value,n.describeElement)),o=Se.computed(()=>n0(i.value)),r=g=>Ha(g,n.changeScope.value),a=Se.computed(()=>Xh(i.value,n.changeScope.value)),s=Se.ref({error:!0,warning:!0,info:!0}),c=Se.computed(()=>i0(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=Se.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function f(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(Se.openBlock(),Se.createElementBlock("section",{class:Se.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Se.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[Se.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Se.openBlock(),Se.createElementBlock("svg",{class:Se.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[Se.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=Se.createElementVNode("span",null,"검증",-1))],8,iF),Se.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=Se.withModifiers(()=>{},["stop"]))},[(Se.openBlock(),Se.createElementBlock(Se.Fragment,null,Se.renderList(u,y=>Se.createElementVNode("button",{key:y,type:"button",class:Se.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>d(y)},[(Se.openBlock(),Se.createElementBlock("svg",rF,[h[4]||(h[4]=Se.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(Se.openBlock(),Se.createElementBlock("path",aF)):(Se.openBlock(),Se.createElementBlock("path",sF))])),Se.createElementVNode("span",null,Se.toDisplayString(o.value[y]),1)],10,oF)),64))])]),l.value?(Se.openBlock(),Se.createElementBlock("div",cF,[i.value.length===0?(Se.openBlock(),Se.createElementBlock("p",lF,"발견된 문제가 없습니다.")):c.value.length===0?(Se.openBlock(),Se.createElementBlock("p",uF," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Se.openBlock(),Se.createElementBlock("ul",pF,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(c.value,y=>(Se.openBlock(),Se.createElementBlock("li",{key:y.key,class:Se.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:_=>f(y)},[h[5]||(h[5]=Se.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(Se.openBlock(),Se.createElementBlock("span",fF,"이번 변경")):Se.createCommentVNode("",!0),Se.createElementVNode("span",hF,Se.toDisplayString(y.message),1),Se.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},Se.toDisplayString(y.category),9,gF)],10,dF))),128))]))])):Se.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),yF={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},vF=["aria-checked","title","data-locale","onClick"],xF={class:"bwl-locale__label"},bF={key:0,class:"bwl-locale__badge"},wF=Gg(Se.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=Se.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(Se.openBlock(),Se.createElementBlock("div",yF,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(o.value,s=>(Se.openBlock(),Se.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Se.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=>Se.unref(n).setDisplayLocale(s.locale)},[Se.createElementVNode("span",xF,Se.toDisplayString(s.label),1),s.pending>0?(Se.openBlock(),Se.createElementBlock("span",bF,Se.toDisplayString(s.pending),1)):Se.createCommentVNode("",!0)],10,vF))),128))])):Se.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ce.ADDABLE_FLOW_NODE_TYPES=Lc,ce.APPLY_BPMN_OPS_SCHEMA=qR,ce.BPMN_EVENT_DEFINITION_TYPES=Bc,ce.BPMN_MODDLE_EXTENSIONS=fs,ce.BPMN_MODELER_VIEW_MODULES=y0,ce.BWL_MODDLE_SCHEMA=pm,ce.BWL_NS=um,ce.BWL_PREFIX=Bp,ce.BWL_REVIEW_REQUEST_TYPE=$c,ce.BWL_SIDES=Np,ce.BpmnDisplayLocaleSwitcher=wF,ce.BpmnModelerView=nF,ce.BpmnValidationPanel=mF,ce.EDITOR=IT,ce.FLOW_LABEL_INDENT=Ym,ce.GROUP_BORDER_MIN_RUN=ld,ce.GROUP_BORDER_NEAR=ma,ce.HEADLESS_BPMN_MODULES=qh,ce.HEADLESS_TEXT_METRICS=Zi,ce.HeadlessReplay=Qh,ce.HeadlessReplayModule=l0,ce.I18N_DISPLAY_REDRAWN_EVENT=uc,ce.I18N_NS=TR,ce.I18N_PREFIX=vm,ce.I18N_REVIEW_REQUESTED_CLASS=r0,ce.I18N_TRANSLATION_TYPE=Tr,ce.I18N_UNTRANSLATED_CLASS=o0,ce.I18nDisplay=Zh,ce.I18nDisplayModule=s0,ce.IR_EVENT_DEFINITIONS=Ic,ce.IR_FLOW_NODE_TYPES=Mr,ce.IR_TEXT_LOCALES=Nc,ce.LABEL_FORK_MARGIN=dd,ce.LABEL_SHAPE_MIN_DEPTH=ay,ce.SET_TRANSLATIONS_COMMAND=Wp,ce.SEVERITY_ORDER=Kh,ce.SYMBOLIC_OP_KINDS=xm,ce.SYMBOLIC_OP_SCHEMA=bm,ce.SetTranslationsHandler=Up,ce.TranslationCommands=Yp,ce.TranslationCommandsModule=Kp,ce.TranslationStateIndex=zT,ce.UNDO_EPISODE_COMMAND=$p,ce.UPDATE_TRANSLATION_COMMAND=Hc,ce.UpdateTranslationHandler=Vp,ce.applyBpmnOpBatch=Av,ce.applyBpmnOps=Id,ce.applyLocaleBackfill=HT,ce.applyTranslationLocaleRestore=qT,ce.approximateTextWidth=Lr,ce.auditBpmnGeometry=ly,ce.auditBpmnGeometryXml=GM,ce.auditBpmnSemantics=Nd,ce.auditBpmnSemanticsXml=_T,ce.auditGeometry=ut,ce.auditTargetsOf=kn,ce.axisSegmentsOf=cn,ce.blackBoxNameRect=ud,ce.buildBpmnOpBatch=PT,ce.buildRegistryIndex=py,ce.collectTranslationStates=Bv,ce.containerBoundarySegments=va,ce.countBySeverity=n0,ce.createBpmnEditorController=BT,ce.createBpmnModdle=Fm,ce.createHeadlessBpmnModeler=gB,ce.crossedShapesOf=Pt,ce.crossingCost=Gn,ce.describeProcess=bv,ce.describeProcessXml=mT,ce.diffBpmnElements=Ev,ce.diffBpmnElementsXml=AT,ce.documentLocalesOf=ls,ce.edgeCrossCount=gs,ce.edgeCrossingPairsOf=Ji,ce.edgeCrossingStatsOf=ty,ce.executeAsUndoEpisode=fm,ce.feedGeneratedIds=Mv,ce.followMovedEdgeLabels=zy,ce.forwardThreePointCandidates=Qc,ce.geometryFindingKey=ct,ce.inferScriptLocale=gl,ce.installHeadlessBpmnDom=zm,ce.irEventDefinitionOf=Ip,ce.isAddableFlowNodeType=cm,ce.isChangeScopeMixed=Xh,ce.isEdgeOverlapFinding=pd,ce.isGuardedGridSnapping=LB,ce.isInChangeScope=Ha,ce.isIrEventDefinition=lm,ce.isIrFlowNodeType=sm,ce.isIrTextLocale=xR,ce.labelRectsOf=Vo,ce.labelShapeDepth=sy,ce.labelSlot=Pr,ce.lineCrossesLabel=Fi,ce.lineThroughLabel=Xm,ce.lineThroughShapeLabel=ry,ce.loadBpmnXml=ga,ce.localeTextsOf=Gp,ce.lowerOps=gv,ce.mergeUndoSteps=gm,ce.oppositeOverlapCount=TM,ce.oppositeOverlapOf=qm,ce.planBackEdgeBoundaryClearance=Ay,ce.planCrossPoolRoute=Ey,ce.planEdgeRepair=tl,ce.planLabelLineClearance=Td,ce.planLabelPlacement=Fy,ce.planLocaleBackfill=jT,ce.planMiddleSegmentShifts=yy,ce.planOppositeOverlapRepair=Oy,ce.planSegmentDetours=Jc,ce.planShapeLabelClearance=Wy,ce.planTranslationLocaleRestore=UT,ce.poolOverlapsOf=gd,ce.recordGeneratedIds=Cv,ce.redockIntroducedDetachedEndpoints=qy,ce.repairIntroducedBoundaryHugging=Ty,ce.repairIntroducedCrossings=xd,ce.repairIntroducedEdgeCrossings=vy,ce.repairIntroducedFakeMerges=Ly,ce.repairIntroducedLabelLines=Gy,ce.repairIntroducedOppositeOverlaps=$y,ce.repairIntroducedShapeLabelLines=Uy,ce.repairIntroducedSharedSegmentLabels=Vy,ce.replayAgentTurn=Tv,ce.rerouteIntroducedCrossPoolEdges=Sy,ce.resolverServicesOf=av,ce.reviewRequestValuesOf=qp,ce.reviewRequestsOf=Fo,ce.rootLangOf=zp,ce.saveBpmnXml=yM,ce.sceneCrossingCost=ey,ce.sceneFromDefinitions=cy,ce.sceneFromRegistry=Ve,ce.segmentShapeClearance=Go,ce.shapesUnderLabel=ms,ce.sharedEndpointCrossingPairsOf=wi,ce.sharedSegmentUnderLabel=Zc,ce.sharedSpansOf=Xc,ce.sortPanelIssues=i0,ce.toPanelIssues=t0,ce.touchedElements=TT,ce.translationLocale=Mn,ce.translationsOf=$o,ce.undoStepMark=hm,ce.unreadableOverlapCount=Jn,ce.unreadableOverlapOf=Ir,ce.validateOps=Zy,ce.warningMessages=cd,Object.defineProperty(ce,Symbol.toStringTag,{value:"Module"})}));
|