@g1cloud/bpmn-modeler-next 5.0.0-beta.24 → 5.0.0-beta.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,14 @@
1
- (function(J,me){typeof exports=="object"&&typeof module<"u"?me(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],me):(J=typeof globalThis<"u"?globalThis:J||self,me(J.BpmnModeler={},J.Vue))})(this,(function(J,me){"use strict";var P5=Object.defineProperty;var T5=(J,me,dr)=>me in J?P5(J,me,{enumerable:!0,configurable:!0,writable:!0,value:dr}):J[me]=dr;var pi=(J,me,dr)=>T5(J,typeof me!="symbol"?me+"":me,dr);const dr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],yc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function vg(e){return dr.includes(e)}function bg(e){return yc.includes(e)}const vc=["timer"],bc={timer:"bpmn:TimerEventDefinition"};function xg(e){return typeof e=="string"&&vc.includes(e)}function fp(e){if(e.length===1)return vc.find(t=>bc[t]===e[0])}const xc=["ko","en","ja","zh"];function D1(e){return typeof e=="string"&&xc.includes(e)}const _g="http://g1project.net/spec/bpmn/bwl/1.0",dp="bwl",hp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],_c="bwl:ReviewRequest",wg={name:"bwl-hints",uri:_g,prefix:dp,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"}]}]},gp="bwl.undoEpisode",Eg=new WeakSet;function L1(e){Eg.has(e)||(e.register(gp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Eg.add(e))}function Sg(e,t){L1(e);const n={run:t};if(e.execute(gp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function mp(e){return Array.prototype.concat.apply([],e)}const Xa=Object.prototype.toString,I1=Object.prototype.hasOwnProperty;function hr(e){return e===void 0}function fn(e){return e!==void 0}function Yr(e){return e==null}function $e(e){return Xa.call(e)==="[object Array]"}function dn(e){return Xa.call(e)==="[object Object]"}function Fe(e){return Xa.call(e)==="[object Number]"}function vn(e){const t=Xa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Xn(e){return Xa.call(e)==="[object String]"}function B1(e){if(!$e(e))throw new Error("must supply array")}function Zn(e,t){return!Yr(e)&&I1.call(e,t)}function Ot(e,t){const n=Ec(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Rg(e,t){const n=Ec(t);let i=$e(e)?-1:void 0;return z(e,function(o,r){if(n(o,r))return i=r,!1}),i}function it(e,t){const n=Ec(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(hr(e))return;const o=$e(e)?H1:j1;for(let r in e)if(Zn(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function N1(e,t){if(hr(e))return[];B1(e);const n=Ec(t);return e.filter(function(i,o){return!n(i,o)})}function Qn(e,t,n){return z(e,function(i,o){n=t(n,i,o)}),n}function Ao(e,t){return!!Qn(e,function(n,i,o){return n&&t(i,o)},!0)}function Po(e,t){return!!Ot(e,t)}function Bn(e,t){let n=[];return z(e,function(i,o){n.push(t(i,o))}),n}function wc(e){return e&&Object.keys(e)||[]}function $1(e){return wc(e).length}function Kr(e){return Bn(e,t=>t)}function Xr(e,t,n={}){return t=yp(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Cg(e,...t){e=yp(e);let n={};return z(t,o=>Xr(o,e,n)),Bn(n,function(o,r){return o[0]})}const F1=Cg;function Hi(e,t){t=yp(t);let n=[];return z(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)}),Bn(n,i=>i.v)}function Zr(e){return function(t){return Ao(e,function(n,i){return t[i]===n})}}function yp(e){return vn(e)?e:t=>t[e]}function Ec(e){return vn(e)?e:t=>t===e}function j1(e){return e}function H1(e){return Number(e)}function vp(e,t){let n,i,o,r;function a(p){let f=Date.now(),d=p?0:r+t-f;if(d>0)return s(d);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 qn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function z1(e,t,n){let i=e;return z(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];fn(a)&&Yr(s)&&(s=i[o]=isNaN(+a)?{}:[]),hr(a)?hr(n)?delete i[o]:i[o]=n:i=s}),e}function Li(e,t){let n={},i=Object(e);return z(t,function(o){o in i&&(n[o]=e[o])}),n}function zi(e,t){let n={},i=Object(e);return z(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=de(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return Po(t,function(n){return M(e,n)})}function de(e){return e&&e.businessObject||e}function dt(e){return e&&e.di}const G1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Mg="i18n",Qr="i18n:Translation";function gr(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Jr(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,Qr)})}function Nn(e){return e.get("xml:lang")}function To(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 Za(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function bp(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 xp(e,t,n){const i=gr(e);if(!i)return{};const o=i.target[i.key]??"",r=Jr(e).filter(u=>Nn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Nn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of Za(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Nn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Sc="bwl.updateTranslation";class _p{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=gr(c),u=[];t.undo=u;const p=Jr(c).filter(D=>Nn(D)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(D=>{if(!D)return[];const $=p.filter(N=>N.body===D).map(Nn);return $.length?$:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,_=D=>{var $;return(($=p.find(N=>Nn(N)===D&&N.body))==null?void 0:$.body)??(h.includes(D)?f:"")},b=D=>To(c).some($=>$.locale===D),y=_(m);if(y===i)return[];const v=!!y&&!b(m),E=v?r.filter(D=>D!==m&&_(D)&&!b(D)):[],w=()=>{let D=c.extensionElements;return D||(D=this.moddle.create("bpmn:ExtensionElements",{values:[]}),D.$parent=c,c.extensionElements=D,u.push(()=>delete c.extensionElements)),D.get("values")},P=(D,$)=>{const N=w();let H=N.find(X=>{var Q;return((Q=X.$instanceOf)==null?void 0:Q.call(X,Qr))&&Nn(X)===D});if(H){const X=H.body;H.body=$,u.push(()=>H.body=X)}else H=this.moddle.create(Qr,{body:$}),H.set("xml:lang",D),H.$parent=c.extensionElements,N.push(H),u.push(()=>N.splice(N.indexOf(H),1))},T=D=>{const $=w(),N=$.indexOf(D);$.splice(N,1),u.push(()=>$.splice(N,0,D))};if(s===void 0){if(m===o&&l){if(f&&!p.some($=>$.body===f)){const $=a&&a!==o?a:void 0;$&&P($,f)}const D=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{D?l.target[l.key]=f:delete l.target[l.key]})}P(m,i)}else(p.some(D=>Nn(D)===m)||!f&&m!==d)&&P(m,i);if(!v)for(const D of To(c).filter($=>$.locale===m))T(D);for(const D of E){const $=w(),N=this.moddle.create(_c,{locale:D,sourceLocale:m,previous:y});N.$parent=c.extensionElements,$.push(N),u.push(()=>$.splice($.indexOf(N),1))}for(const D of To(c).filter($=>$.sourceLocale===m&&($.previous??"")===i))T(D);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):[]}}pi(_p,"$inject",["moddle"]);const wp="bwl.setTranslations",V1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Ep{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,!gr(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")},f=_=>{const b=p(),y=b.indexOf(_);y<0||(b.splice(y,1),u.push(()=>b.splice(y,0,_)))},d=_=>Jr(l).find(b=>Nn(b)===_);if(i===null)for(const _ of a){const b=d(_);b&&f(b)}else if(i)for(const _ of a){const b=i[_];if(b===void 0)continue;const y=d(_);if(y){if(y.body===b)continue;const w=y.body;y.body=b,u.push(()=>y.body=w);continue}if(_===r&&(s??r)===r)continue;const v=p(),E=this.moddle.create(Qr,{body:b});E.set("xml:lang",_),E.$parent=l.extensionElements,v.push(E),u.push(()=>v.splice(v.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 To(l)){const b=h.findIndex(y=>V1(_,y));b>=0?h.splice(b,1):f(_)}for(const _ of h){const b=p(),y=this.moddle.create(_c,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});y.$parent=l.extensionElements,b.push(y),u.push(()=>b.splice(b.indexOf(y),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),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):[]}}pi(Ep,"$inject",["moddle"]);function Sp(e){return To(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Rp{constructor(t){t.registerHandler(Sc,_p),t.registerHandler(wp,Ep)}}pi(Rp,"$inject",["commandStack"]);const Cp={__init__:["translationCommands"],translationCommands:["type",Rp]},Ag=["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"],W1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},U1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(xc.map(e=>[e,{type:"string"}])),additionalProperties:!1},q1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},Y1={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},K1={type:"string",enum:[...vc],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},X1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...yc]},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},Z1={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Q1={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},J1={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},eS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},tS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},nS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},iS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},oS={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},rS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...hp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function An(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const aS={"participant.add":An("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":An("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":An("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":An("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:[...yc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":An("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":An("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},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":An("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":An("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":An("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":An("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":An("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":An("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":An("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":An("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":An("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":An("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":An("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...xc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":An("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Pg={anyOf:Ag.map(e=>aS[e])},sS={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:q1,irParticipant:Y1,irNode:X1,irFlowCondition:Z1,irSequenceFlow:Q1,irMessageFlow:J1,irDataStore:eS,irDataAssociation:tS,irTextAnnotation:nS,irAssociation:iS,irGroup:oS,bwlPlacement:rS,eventDefinition:K1,localeTexts:U1,nullableString:W1,symbolicOp:Pg}};function Mp(){}Mp.prototype.get=function(e){return this.$model.properties.get(this,e)},Mp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Tg(e,t){this.model=e,this.properties=t}Tg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Mp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var 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}),z(a,qn(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 cS=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),kg=V(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 Ap(e,t){var n=kg[e];return n?n(t):t}function Pp(e){return!!cS[e]}function Og(e){return!!kg[e]}function $n(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 fi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}fi.prototype.build=function(){return Li(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fi.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)},fi.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},fi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=$n(o[0],i),a=$n(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},fi.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},fi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fi.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},fi.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},fi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},fi.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")},fi.prototype.hasProperty=function(e){return this.propertiesByName[e]},fi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(z(e.properties,qn(function(r){r=V({},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 ko(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,qn(this.registerPackage,this))}ko.prototype.getPackage=function(e){return this.packageMap[e]},ko.prototype.getPackages=function(){return this.packages},ko.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Dg(t,e,"prefix"),Dg(t,e,"uri"),z(e.types,qn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},ko.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=$n(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,qn(function(r){var a=$n(r.name,n.prefix),s=a.name;Pp(r.type)||(r.type=$n(r.type,a.prefix).name),V(r,{ns:a,name:s}),o[s]=r},this)),V(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,qn(function(r){var a=$n(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},ko.prototype.mapTypes=function(e,t,n){var i=Pp(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=$n(c,Pp(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+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},ko.prototype.getEffectiveDescriptor=function(e){var t=$n(e),n=new fi(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},ko.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Dg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function mr(e){this.model=e}mr.prototype.set=function(e,t,n){if(!Xn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;lS(n)?i?delete e[o]:delete e.$attrs[Tp(t)]:i?o in e?e[o]=n:Lg(e,i,n):e.$attrs[Tp(t)]=n},mr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Tp(t)];var i=n.name;return!e[i]&&n.isMany&&Lg(e,n,[]),e[i]},mr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},mr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},mr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},mr.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 lS(e){return typeof e>"u"}function Lg(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Tp(e){return e.replace(/^:/,"")}function vi(e,t={}){this.properties=new mr(this),this.factory=new Tg(this,this.properties),this.registry=new ko(e,this.properties),this.typeCache=Object.create(null),this.config=t}vi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},vi.prototype.getType=function(e){var t=this.typeCache,n=Xn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},vi.prototype.createAny=function(e,t,n){var i=$n(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){z1(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}),z(n,function(a,s){dn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},vi.prototype.getPackage=function(e){return this.registry.getPackage(e)},vi.prototype.getPackages=function(){return this.registry.getPackages()},vi.prototype.getElementDescriptor=function(e){return e.$descriptor},vi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},vi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},vi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Ig=String.fromCharCode,uS=Object.prototype.hasOwnProperty,pS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Qa={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Qa).forEach(function(e){Qa[e.toUpperCase()]=Qa[e]});function fS(e,t,n,i){return i?uS.call(Qa,i)?Qa[i]:"&"+i+";":Ig(t||parseInt(n,16))}function yr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(pS,fS):e}var Bg="non-whitespace outside of root node";function Oo(e){return new Error(e)}function dS(e){return"missing namespace for prefix <"+e+">"}function Rc(e){return{get:e,enumerable:!0}}function hS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Ng=Symbol("nameCache");function kp(e){return e+"$uri"}function gS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[kp(i)]=n;return t}function Cc(){return{line:0,column:0}}function mS(e){throw e}function $g(e){if(!this)return new $g(e);var t=e&&e.proxy,n,i,o,r,a=mS,s,c,l,u,p=Cc,f=!1,d=!1,g="",h=!1,m=!1,_=null,b=!1,y,v,E,w;function P(N){N instanceof Error||(N=Oo(N)),_=N,a(N,p)}function T(N){s&&(N instanceof Error||(N=Oo(N)),s(N,p))}this.on=function(N,H){if(typeof H!="function")throw Oo("required args <name, cb>");switch(N){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":o=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":r=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw Oo("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Oo("required args <nsMap={}>");var H=Object.create(null),X;for(X in N)H[X]=N[X];return m=!0,w=H,this};function D(){y=m?[]:null,v=m?gS(w):null,E=[],p=Cc,b=!1,_=null,d=!1,g=""}this.parse=function(N){if(typeof N!="string")throw Oo("required args <xml=string>");if(f)throw Oo("parse during stream; call end() first");return D(),$(N),p=Cc,b=!1,_},this.write=function(N){if(typeof N!="string")throw Oo("required args <xml=string>");return f||(D(),f=!0),_||(g=$(g+N,!0)||""),this},this.end=function(){return f||D(),f=!1,_||$(g),g="",p=Cc,b=!1,_},this.stop=function(){b=!0};function $(N,H=!1){var X=null,Q=null,ee,We=0,qe=!1,Ge=!1,Re=0,Z=0,oe,W,Y,ae,ge,Te,B,C,S,G="",q=0,ie;function Me(Ct,yn){var Rn=Ct.indexOf(":");if(Rn===-1)return Ct;var Vn=v[Ct.substring(0,Rn)];return Vn?yn===Vn?Ct.substr(Rn+1):Vn+Ct.substr(Rn):(T(dS(Ct.substring(0,Rn))),null)}function Xe(){if(ie!==null)return ie;var Ct,yn,Rn=m&&v.xmlns,Vn=m&&h?[]:null,At=q,Qt=G,_n=Qt.length,Va,Wn,$i,ci,on,Fr={},Wa=new Set,Cn,gt,Et;e:for(;At<_n;At++)if(Cn=!1,gt=Qt.charCodeAt(At),!(gt===32||gt<14&&gt>8)){for((gt<65||gt>122||gt>90&&gt<97)&&gt!==95&&gt!==58&&(T("illegal first char attribute name"),Cn=!0),Et=At+1;Et<_n;Et++)if(gt=Qt.charCodeAt(Et),!(gt>96&&gt<123||gt>64&&gt<91||gt>47&&gt<59||gt===46||gt===45||gt===95)){if(gt===32||gt<14&&gt>8){T("missing attribute value"),At=Et;continue e}if(gt===61)break;T("illegal attribute name char"),Cn=!0}if(on=Qt.substring(At,Et),on==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Cn=!0),gt=Qt.charCodeAt(Et+1),gt===34)Et=Qt.indexOf('"',At=Et+2),Et===-1&&(Et=Qt.indexOf("'",At),Et!==-1&&(T("attribute value quote missmatch"),Cn=!0));else if(gt===39)Et=Qt.indexOf("'",At=Et+2),Et===-1&&(Et=Qt.indexOf('"',At),Et!==-1&&(T("attribute value quote missmatch"),Cn=!0));else for(T("missing attribute value quotes"),Cn=!0,Et=Et+1;Et<_n&&(gt=Qt.charCodeAt(Et+1),!(gt===32||gt<14&&gt>8));Et++);for(Et===-1&&(T("missing closing quotes"),Et=_n,Cn=!0),Cn||($i=Qt.substring(At,Et)),At=Et;Et+1<_n&&(gt=Qt.charCodeAt(Et+1),!(gt===32||gt<14&&gt>8));Et++)At===Et&&(T("illegal character after attribute end"),Cn=!0);if(At=Et+1,Cn)continue e;if(Wa.has(on)){T("attribute <"+on+"> already defined");continue}if(Wa.add(on),!m){Fr[on]=$i;continue}if(h){if(Wn=on==="xmlns"?"xmlns":on.charCodeAt(0)===120&&on.substr(0,6)==="xmlns:"?on.substr(6):null,Wn!==null){if(Ct=yr($i),yn=kp(Wn),ci=w[Ct],!ci){if(Wn==="xmlns"||yn in v&&v[yn]!==Ct)do ci="ns"+We++;while(typeof v[ci]<"u");else ci=Wn;w[Ct]=ci}v[Wn]!==ci&&(Va||(v=hS(v),Va=!0),v[Wn]=ci,Wn==="xmlns"&&(v[kp(ci)]=Ct,Rn=ci),v[yn]=Ct),Fr[on]=$i;continue}Vn.push(on,$i);continue}on=Me(on,Rn),on!==null&&(Fr[on]=$i)}if(h)for(At=0,_n=Vn.length;At<_n;At++)on=Me(Vn[At++],Rn),$i=Vn[At],on!==null&&(Fr[on]=$i);return ie=Fr}function mt(){for(var Ct=/(\r\n|\r|\n)/g,yn=0,Rn=0,Vn=0,At=Z,Qt,_n;Re>=Vn&&(Qt=Ct.exec(N),!(!Qt||(At=Qt[0].length+Qt.index,At>Re)));)yn+=1,Vn=At;return Re==-1?(Rn=At,_n=N.substring(Z)):Z===0?_n=N.substring(Z,Re):(Rn=Re-Vn,_n=Z==-1?N.substring(Re):N.substring(Re,Z+1)),{data:_n,line:yn,column:Rn}}for(p=mt,t&&(S=Object.create({},{name:Rc(function(){return B}),originalName:Rc(function(){return C}),attrs:Rc(Xe),ns:Rc(function(){return v})}));Z!==-1;){if(N.charCodeAt(Z)===60?Re=Z:Re=N.indexOf("<",Z),Re===-1){if(H)return N.substring(Z);if(E.length)return P("unexpected end of file");if(!d)return P("missing start tag");Z<N.length&&N.substring(Z).trim()&&T(Bg);return}if(d||(d=!0),Z!==Re){if(E.length){if(n&&(n(N.substring(Z,Re),yr,p),b))return}else if(N.substring(Z,Re).trim()&&(T(Bg),b))return}if(ae=N.charCodeAt(Re+1),ae===33){if(Y=N.charCodeAt(Re+2),Y===91&&N.substr(Re+3,6)==="CDATA["){if(Z=N.indexOf("]]>",Re),Z===-1)return H?N.substring(Re):P("unclosed cdata");if(r&&(r(N.substring(Re+9,Z),p),b))return;Z+=3;continue}if(Y===45&&N.charCodeAt(Re+3)===45){if(Z=N.indexOf("-->",Re),Z===-1)return H?N.substring(Re):P("unclosed comment");if(c&&(c(N.substring(Re+4,Z),yr,p),b))return;Z+=3;continue}}if(ae===63){if(Z=N.indexOf("?>",Re),Z===-1)return H?N.substring(Re):P("unclosed question");if(l&&(l(N.substring(Re,Z+2),p),b))return;Z+=2;continue}for(oe=Re+1;;oe++){if(ge=N.charCodeAt(oe),isNaN(ge))return H?N.substring(Re):(Z=-1,P("unclosed tag"));if(ge===34)Y=N.indexOf('"',oe+1),oe=Y!==-1?Y:oe;else if(ge===39)Y=N.indexOf("'",oe+1),oe=Y!==-1?Y:oe;else if(ge===62){Z=oe;break}}if(ae===33){if(u&&(u(N.substring(Re,Z+1),yr,p),b))return;Z+=1;continue}if(ie={},ae===47){if(qe=!1,Ge=!0,!E.length)return P("missing open tag");if(oe=B=E.pop(),Y=Re+2+oe.length,N.substring(Re+2,Y)!==oe)return P("closing tag mismatch");for(;Y<Z;Y++)if(ae=N.charCodeAt(Y),!(ae===32||ae>8&&ae<14))return P("close tag")}else{if(N.charCodeAt(Z-1)===47?(oe=B=N.substring(Re+1,Z-1),qe=!0,Ge=!0):(oe=B=N.substring(Re+1,Z),qe=!0,Ge=!1),!(ae>96&&ae<123||ae>64&&ae<91||ae===95||ae===58))return P("illegal first char nodeName");for(Y=1,W=oe.length;Y<W;Y++)if(ae=oe.charCodeAt(Y),!(ae>96&&ae<123||ae>64&&ae<91||ae>47&&ae<59||ae===45||ae===95||ae==46)){if(ae===32||ae<14&&ae>8){B=oe.substring(0,Y),ie=null;break}return P("invalid nodeName")}Ge||E.push(B)}if(m){ee=v,qe&&(Ge||y.push(ee),ie===null&&(h=oe.indexOf("xmlns",Y)!==-1)&&(q=Y,G=oe,Xe(),h=!1)),C=B,Q!==v&&(X=v[Ng],X===void 0&&(X=v[Ng]=Object.create(null)),Q=v);var qt=X[B];if(qt!==void 0)B=qt;else{if(ae=B.indexOf(":"),ae!==-1){if(Te=v[B.substring(0,ae)],!Te)return P("missing namespace on <"+C+">");B=B.substr(ae+1)}else Te=v.xmlns;Te&&(B=Te+":"+B),X[C]=B}}if(qe&&(q=Y,G=oe,i&&(t?i(S,yr,Ge,p):i(B,Xe,yr,Ge,p),b)))return;if(Ge){if(o&&(o(t?S:B,yr,qe,p),b))return;m&&(qe?v=ee:v=y.pop())}Z+=1}}}function Fg(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Op={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},jg="property";function Hg(e){return e.xml&&e.xml.serialize}function yS(e){const t=Hg(e);return t!==jg&&(t||null)}function vS(e){return e.charAt(0).toUpperCase()+e.slice(1)}function zg(e,t){return Fg(t)?e.prefix+":"+vS(e.localName):e.name}function bS(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 xS(e,t,n){const i=$n(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=$n(o);var a=n.getPackage(r.prefix);return bS(r,a)}function Do(e){return new Error(e)}function co(e){return e.$descriptor}function _S(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Do("expected element");var n=this.elementsById,i=co(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 Do("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ja(){}Ja.prototype.handleEnd=function(){},Ja.prototype.handleText=function(){},Ja.prototype.handleNode=function(){};function Dp(){}Dp.prototype=Object.create(Ja.prototype),Dp.prototype.handleNode=function(){return this};function ea(){}ea.prototype=Object.create(Ja.prototype),ea.prototype.handleText=function(e){this.body=(this.body||"")+e};function es(e,t){this.property=e,this.context=t}es.prototype=Object.create(ea.prototype),es.prototype.handleNode=function(e){if(this.element)throw Do("expected no sub nodes");return this.element=this.createReference(e),this},es.prototype.handleEnd=function(){this.element.id=this.body},es.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Lp(e,t){this.element=t,this.propertyDesc=e}Lp.prototype=Object.create(ea.prototype),Lp.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Ap(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Mc(){}Mc.prototype=Object.create(ea.prototype),Mc.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 Hn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Hn.prototype=Object.create(Mc.prototype),Hn.prototype.addReference=function(e){this.context.addReference(e)},Hn.prototype.handleText=function(e){var t=this.element,n=co(t),i=n.bodyProperty;if(!i)throw Do("unexpected body text <"+e+">");ea.prototype.handleText.call(this,e)},Hn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=co(t),i=n.bodyProperty;i&&e!==void 0&&(e=Ap(i.type,e),t.set(i.name,e))},Hn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=co(n),o=this.context,r=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=Ap(u.type,c):l==="xmlns"?l=":"+l:(s=$n(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},Hn.prototype.getPropertyForNode=function(e){var t=e.name,n=$n(t),i=this.type,o=this.model,r=co(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=yS(s);if(l){const u=e.attributes[l];if(u){const p=xS(u,e.ns,o),f=o.getType(p);return V({},s,{effectiveType:co(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=zg(n,c),u=o.getType(l);if(s=Ot(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return V({},s,{effectiveType:co(u).name})}else if(s=Ot(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Do("unrecognized element <"+n.name+">")},Hn.prototype.toString=function(){return"ElementDescriptor["+co(this.type).name+"]"},Hn.prototype.valueHandler=function(e,t){return new Lp(e,t)},Hn.prototype.referenceHandler=function(e){return new es(e,this.context)},Hn.prototype.handler=function(e){return e==="Element"?new ta(this.model,e,this.context):new Hn(this.model,e,this.context)},Hn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Og(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?(V(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function Ip(e,t,n){Hn.call(this,e,t,n)}Ip.prototype=Object.create(Hn.prototype),Ip.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&zg(n,r)||t;if(!o.hasType(a))throw Do("unexpected element <"+e.originalName+">");return Hn.prototype.createElement.call(this,e)};function ta(e,t,n){this.model=e,this.context=n}ta.prototype=Object.create(Mc.prototype),ta.prototype.createElement=function(e){var t=e.name,n=$n(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ta.prototype.handleChild=function(e){var t=new ta(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},ta.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Bp(e){e instanceof vi&&(e={model:e}),V(this,{lax:!1},e)}Bp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Hn?(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 _S(V({},t,{rootHandler:i})),s=new $g({proxy:!0}),c=wS();i.context=a,c.push(i);function l(E,w,P){var T=w(),D=T.line,$=T.column,N=T.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var H="unparsable content "+(N?N+" ":"")+`detected
2
- line: `+D+`
1
+ (function(J,me){typeof exports=="object"&&typeof module<"u"?me(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],me):(J=typeof globalThis<"u"?globalThis:J||self,me(J.BpmnModeler={},J.Vue))})(this,(function(J,me){"use strict";var D5=Object.defineProperty;var L5=(J,me,gr)=>me in J?D5(J,me,{enumerable:!0,configurable:!0,writable:!0,value:gr}):J[me]=gr;var pi=(J,me,gr)=>L5(J,typeof me!="symbol"?me+"":me,gr);const gr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],xc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function _g(e){return gr.includes(e)}function wg(e){return xc.includes(e)}const _c=["timer"],wc={timer:"bpmn:TimerEventDefinition"};function Eg(e){return typeof e=="string"&&_c.includes(e)}function gp(e){if(e.length===1)return _c.find(t=>wc[t]===e[0])}const Ec=["ko","en","ja","zh"];function B1(e){return typeof e=="string"&&Ec.includes(e)}const Sg="http://g1project.net/spec/bpmn/bwl/1.0",mp="bwl",yp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Sc="bwl:ReviewRequest",Rg={name:"bwl-hints",uri:Sg,prefix:mp,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"}]}]},vp="bwl.undoEpisode",Cg=new WeakSet;function N1(e){Cg.has(e)||(e.register(vp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Cg.add(e))}function Mg(e,t){N1(e);const n={run:t};if(e.execute(vp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function bp(e){return Array.prototype.concat.apply([],e)}const Ja=Object.prototype.toString,$1=Object.prototype.hasOwnProperty;function mr(e){return e===void 0}function pn(e){return e!==void 0}function Xr(e){return e==null}function $e(e){return Ja.call(e)==="[object Array]"}function fn(e){return Ja.call(e)==="[object Object]"}function Fe(e){return Ja.call(e)==="[object Number]"}function vn(e){const t=Ja.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Zn(e){return Ja.call(e)==="[object String]"}function F1(e){if(!$e(e))throw new Error("must supply array")}function Qn(e,t){return!Xr(e)&&$1.call(e,t)}function Ot(e,t){const n=Cc(t);let i;return z(e,function(o,r){if(n(o,r))return i=o,!1}),i}function Ag(e,t){const n=Cc(t);let i=$e(e)?-1:void 0;return z(e,function(o,r){if(n(o,r))return i=r,!1}),i}function it(e,t){const n=Cc(t);let i=[];return z(e,function(o,r){n(o,r)&&i.push(o)}),i}function z(e,t){let n,i;if(mr(e))return;const o=$e(e)?V1:G1;for(let r in e)if(Qn(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function j1(e,t){if(mr(e))return[];F1(e);const n=Cc(t);return e.filter(function(i,o){return!n(i,o)})}function Jn(e,t,n){return z(e,function(i,o){n=t(n,i,o)}),n}function To(e,t){return!!Jn(e,function(n,i,o){return n&&t(i,o)},!0)}function ko(e,t){return!!Ot(e,t)}function Bn(e,t){let n=[];return z(e,function(i,o){n.push(t(i,o))}),n}function Rc(e){return e&&Object.keys(e)||[]}function H1(e){return Rc(e).length}function Zr(e){return Bn(e,t=>t)}function Qr(e,t,n={}){return t=xp(t),z(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function Pg(e,...t){e=xp(e);let n={};return z(t,o=>Qr(o,e,n)),Bn(n,function(o,r){return o[0]})}const z1=Pg;function zi(e,t){t=xp(t);let n=[];return z(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)}),Bn(n,i=>i.v)}function Jr(e){return function(t){return To(e,function(n,i){return t[i]===n})}}function xp(e){return vn(e)?e:t=>t[e]}function Cc(e){return vn(e)?e:t=>t===e}function G1(e){return e}function V1(e){return Number(e)}function _p(e,t){let n,i,o,r;function a(p){let f=Date.now(),d=p?0:r+t-f;if(d>0)return s(d);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 Yn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function W1(e,t,n){let i=e;return z(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];pn(a)&&Xr(s)&&(s=i[o]=isNaN(+a)?{}:[]),mr(a)?mr(n)?delete i[o]:i[o]=n:i=s}),e}function Ii(e,t){let n={},i=Object(e);return z(t,function(o){o in i&&(n[o]=e[o])}),n}function Gi(e,t){let n={},i=Object(e);return z(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function M(e,t){var n=de(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function nt(e,t){return ko(t,function(n){return M(e,n)})}function de(e){return e&&e.businessObject||e}function dt(e){return e&&e.di}const U1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Tg="i18n",ea="i18n:Translation";function yr(e){if(e){if(M(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(M(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function ta(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,ea)})}function Nn(e){return e.get("xml:lang")}function Oo(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,Sc)})}function es(e){const{designLocale:t,companionLocales:n}=e;return[t,...n.filter((i,o,r)=>i!==t&&r.indexOf(i)===o)]}function wp(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 Ep(e,t,n){const i=yr(e);if(!i)return{};const o=i.target[i.key]??"",r=ta(e).filter(u=>Nn(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(Nn):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of es(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(f=>Nn(f)===u&&a(f));p&&(l[u]=a(p))}return l}const Mc="bwl.updateTranslation";class Sp{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=yr(c),u=[];t.undo=u;const p=ta(c).filter(L=>Nn(L)),f=s??(l?l.target[l.key]??"":""),d=a??o,h=(L=>{if(!L)return[];const $=p.filter(N=>N.body===L).map(Nn);return $.length?$:[d]})(f),m=s!==void 0&&f&&!h.includes(t.locale)?h[0]:t.locale,_=L=>{var $;return(($=p.find(N=>Nn(N)===L&&N.body))==null?void 0:$.body)??(h.includes(L)?f:"")},b=L=>Oo(c).some($=>$.locale===L),y=_(m);if(y===i)return[];const v=!!y&&!b(m),E=v?r.filter(L=>L!==m&&_(L)&&!b(L)):[],w=()=>{let L=c.extensionElements;return L||(L=this.moddle.create("bpmn:ExtensionElements",{values:[]}),L.$parent=c,c.extensionElements=L,u.push(()=>delete c.extensionElements)),L.get("values")},P=(L,$)=>{const N=w();let H=N.find(X=>{var Q;return((Q=X.$instanceOf)==null?void 0:Q.call(X,ea))&&Nn(X)===L});if(H){const X=H.body;H.body=$,u.push(()=>H.body=X)}else H=this.moddle.create(ea,{body:$}),H.set("xml:lang",L),H.$parent=c.extensionElements,N.push(H),u.push(()=>N.splice(N.indexOf(H),1))},T=L=>{const $=w(),N=$.indexOf(L);$.splice(N,1),u.push(()=>$.splice(N,0,L))};if(s===void 0){if(m===o&&l){if(f&&!p.some($=>$.body===f)){const $=a&&a!==o?a:void 0;$&&P($,f)}const L=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{L?l.target[l.key]=f:delete l.target[l.key]})}P(m,i)}else(p.some(L=>Nn(L)===m)||!f&&m!==d)&&P(m,i);if(!v)for(const L of Oo(c).filter($=>$.locale===m))T(L);for(const L of E){const $=w(),N=this.moddle.create(Sc,{locale:L,sourceLocale:m,previous:y});N.$parent=c.extensionElements,$.push(N),u.push(()=>$.splice($.indexOf(N),1))}for(const L of Oo(c).filter($=>$.sourceLocale===m&&($.previous??"")===i))T(L);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):[]}}pi(Sp,"$inject",["moddle"]);const Rp="bwl.setTranslations",q1=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Cp{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,!yr(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")},f=_=>{const b=p(),y=b.indexOf(_);y<0||(b.splice(y,1),u.push(()=>b.splice(y,0,_)))},d=_=>ta(l).find(b=>Nn(b)===_);if(i===null)for(const _ of a){const b=d(_);b&&f(b)}else if(i)for(const _ of a){const b=i[_];if(b===void 0)continue;const y=d(_);if(y){if(y.body===b)continue;const w=y.body;y.body=b,u.push(()=>y.body=w);continue}if(_===r&&(s??r)===r)continue;const v=p(),E=this.moddle.create(ea,{body:b});E.set("xml:lang",_),E.$parent=l.extensionElements,v.push(E),u.push(()=>v.splice(v.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 Oo(l)){const b=h.findIndex(y=>q1(_,y));b>=0?h.splice(b,1):f(_)}for(const _ of h){const b=p(),y=this.moddle.create(Sc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});y.$parent=l.extensionElements,b.push(y),u.push(()=>b.splice(b.indexOf(y),1))}const m=l.extensionElements;return m&&!m.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=m)),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):[]}}pi(Cp,"$inject",["moddle"]);function Mp(e){return Oo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Ap{constructor(t){t.registerHandler(Mc,Sp),t.registerHandler(Rp,Cp)}}pi(Ap,"$inject",["commandStack"]);const Pp={__init__:["translationCommands"],translationCommands:["type",Ap]},kg=["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"],Y1={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},K1={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(Ec.map(e=>[e,{type:"string"}])),additionalProperties:!1},X1={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},Z1={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},Q1={type:"string",enum:[..._c],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},J1={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...xc]},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},eS={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},tS={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},nS={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},iS={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},oS={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},rS={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},aS={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},sS={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},cS={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...yp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function An(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const lS={"participant.add":An("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":An("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":An("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":An("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:[...xc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":An("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":An("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},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":An("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":An("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":An("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":An("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":An("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":An("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":An("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":An("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":An("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":An("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"translation.confirm":An("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...Ec],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":An("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Og={anyOf:kg.map(e=>lS[e])},uS={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라. 문서에 문서 언어 설정이 있으면(describe 의 i18n) 문구는 평문 name/text 가 아니라 names/texts 로 문서 언어 전부를 준다.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:X1,irParticipant:Z1,irNode:J1,irFlowCondition:eS,irSequenceFlow:tS,irMessageFlow:nS,irDataStore:iS,irDataAssociation:oS,irTextAnnotation:rS,irAssociation:aS,irGroup:sS,bwlPlacement:cS,eventDefinition:Q1,localeTexts:K1,nullableString:Y1,symbolicOp:Og}};function Tp(){}Tp.prototype.get=function(e){return this.$model.properties.get(this,e)},Tp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Dg(e,t){this.model=e,this.properties=t}Dg.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Tp.prototype);z(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var 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}),z(a,Yn(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 pS=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Lg=V(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 kp(e,t){var n=Lg[e];return n?n(t):t}function Op(e){return!!pS[e]}function Ig(e){return!!Lg[e]}function $n(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 fi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}fi.prototype.build=function(){return Ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fi.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)},fi.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},fi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=$n(o[0],i),a=$n(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},fi.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},fi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fi.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},fi.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},fi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},fi.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")},fi.prototype.hasProperty=function(e){return this.propertiesByName[e]},fi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(z(e.properties,Yn(function(r){r=V({},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 Do(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Yn(this.registerPackage,this))}Do.prototype.getPackage=function(e){return this.packageMap[e]},Do.prototype.getPackages=function(){return this.packages},Do.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Bg(t,e,"prefix"),Bg(t,e,"uri"),z(e.types,Yn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Do.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=$n(e.name,t.prefix),i=n.name,o=Object.create(null);z(e.properties,Yn(function(r){var a=$n(r.name,n.prefix),s=a.name;Op(r.type)||(r.type=$n(r.type,a.prefix).name),V(r,{ns:a,name:s}),o[s]=r},this)),V(e,{ns:n,name:i,propertiesByName:o}),z(e.extends,Yn(function(r){var a=$n(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},Do.prototype.mapTypes=function(e,t,n){var i=Op(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=$n(c,Op(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+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},Do.prototype.getEffectiveDescriptor=function(e){var t=$n(e),n=new fi(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},Do.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Bg(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function vr(e){this.model=e}vr.prototype.set=function(e,t,n){if(!Zn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;fS(n)?i?delete e[o]:delete e.$attrs[Dp(t)]:i?o in e?e[o]=n:Ng(e,i,n):e.$attrs[Dp(t)]=n},vr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Dp(t)];var i=n.name;return!e[i]&&n.isMany&&Ng(e,n,[]),e[i]},vr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},vr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},vr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},vr.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 fS(e){return typeof e>"u"}function Ng(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Dp(e){return e.replace(/^:/,"")}function vi(e,t={}){this.properties=new vr(this),this.factory=new Dg(this,this.properties),this.registry=new Do(e,this.properties),this.typeCache=Object.create(null),this.config=t}vi.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},vi.prototype.getType=function(e){var t=this.typeCache,n=Zn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},vi.prototype.createAny=function(e,t,n){var i=$n(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){W1(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}),z(n,function(a,s){fn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},vi.prototype.getPackage=function(e){return this.registry.getPackage(e)},vi.prototype.getPackages=function(){return this.registry.getPackages()},vi.prototype.getElementDescriptor=function(e){return e.$descriptor},vi.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},vi.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},vi.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var $g=String.fromCharCode,dS=Object.prototype.hasOwnProperty,hS=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ts={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ts).forEach(function(e){ts[e.toUpperCase()]=ts[e]});function gS(e,t,n,i){return i?dS.call(ts,i)?ts[i]:"&"+i+";":$g(t||parseInt(n,16))}function br(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(hS,gS):e}var Fg="non-whitespace outside of root node";function Lo(e){return new Error(e)}function mS(e){return"missing namespace for prefix <"+e+">"}function Ac(e){return{get:e,enumerable:!0}}function yS(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var jg=Symbol("nameCache");function Lp(e){return e+"$uri"}function vS(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Lp(i)]=n;return t}function Pc(){return{line:0,column:0}}function bS(e){throw e}function Hg(e){if(!this)return new Hg(e);var t=e&&e.proxy,n,i,o,r,a=bS,s,c,l,u,p=Pc,f=!1,d=!1,g="",h=!1,m=!1,_=null,b=!1,y,v,E,w;function P(N){N instanceof Error||(N=Lo(N)),_=N,a(N,p)}function T(N){s&&(N instanceof Error||(N=Lo(N)),s(N,p))}this.on=function(N,H){if(typeof H!="function")throw Lo("required args <name, cb>");switch(N){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":o=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":r=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw Lo("unsupported event: "+N)}return this},this.ns=function(N){if(typeof N>"u"&&(N={}),typeof N!="object")throw Lo("required args <nsMap={}>");var H=Object.create(null),X;for(X in N)H[X]=N[X];return m=!0,w=H,this};function L(){y=m?[]:null,v=m?vS(w):null,E=[],p=Pc,b=!1,_=null,d=!1,g=""}this.parse=function(N){if(typeof N!="string")throw Lo("required args <xml=string>");if(f)throw Lo("parse during stream; call end() first");return L(),$(N),p=Pc,b=!1,_},this.write=function(N){if(typeof N!="string")throw Lo("required args <xml=string>");return f||(L(),f=!0),_||(g=$(g+N,!0)||""),this},this.end=function(){return f||L(),f=!1,_||$(g),g="",p=Pc,b=!1,_},this.stop=function(){b=!0};function $(N,H=!1){var X=null,Q=null,ee,We=0,qe=!1,Ge=!1,Se=0,Z=0,oe,W,Y,ae,ge,Te,B,C,S,G="",q=0,ie;function Me(Mt,mn){var Rn=Mt.indexOf(":");if(Rn===-1)return Mt;var Wn=v[Mt.substring(0,Rn)];return Wn?mn===Wn?Mt.substr(Rn+1):Wn+Mt.substr(Rn):(T(mS(Mt.substring(0,Rn))),null)}function Xe(){if(ie!==null)return ie;var Mt,mn,Rn=m&&v.xmlns,Wn=m&&h?[]:null,At=q,Zt=G,_n=Zt.length,Ua,Un,Fi,li,tn,Hr={},qa=new Set,Cn,gt,St;e:for(;At<_n;At++)if(Cn=!1,gt=Zt.charCodeAt(At),!(gt===32||gt<14&&gt>8)){for((gt<65||gt>122||gt>90&&gt<97)&&gt!==95&&gt!==58&&(T("illegal first char attribute name"),Cn=!0),St=At+1;St<_n;St++)if(gt=Zt.charCodeAt(St),!(gt>96&&gt<123||gt>64&&gt<91||gt>47&&gt<59||gt===46||gt===45||gt===95)){if(gt===32||gt<14&&gt>8){T("missing attribute value"),At=St;continue e}if(gt===61)break;T("illegal attribute name char"),Cn=!0}if(tn=Zt.substring(At,St),tn==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Cn=!0),gt=Zt.charCodeAt(St+1),gt===34)St=Zt.indexOf('"',At=St+2),St===-1&&(St=Zt.indexOf("'",At),St!==-1&&(T("attribute value quote missmatch"),Cn=!0));else if(gt===39)St=Zt.indexOf("'",At=St+2),St===-1&&(St=Zt.indexOf('"',At),St!==-1&&(T("attribute value quote missmatch"),Cn=!0));else for(T("missing attribute value quotes"),Cn=!0,St=St+1;St<_n&&(gt=Zt.charCodeAt(St+1),!(gt===32||gt<14&&gt>8));St++);for(St===-1&&(T("missing closing quotes"),St=_n,Cn=!0),Cn||(Fi=Zt.substring(At,St)),At=St;St+1<_n&&(gt=Zt.charCodeAt(St+1),!(gt===32||gt<14&&gt>8));St++)At===St&&(T("illegal character after attribute end"),Cn=!0);if(At=St+1,Cn)continue e;if(qa.has(tn)){T("attribute <"+tn+"> already defined");continue}if(qa.add(tn),!m){Hr[tn]=Fi;continue}if(h){if(Un=tn==="xmlns"?"xmlns":tn.charCodeAt(0)===120&&tn.substr(0,6)==="xmlns:"?tn.substr(6):null,Un!==null){if(Mt=br(Fi),mn=Lp(Un),li=w[Mt],!li){if(Un==="xmlns"||mn in v&&v[mn]!==Mt)do li="ns"+We++;while(typeof v[li]<"u");else li=Un;w[Mt]=li}v[Un]!==li&&(Ua||(v=yS(v),Ua=!0),v[Un]=li,Un==="xmlns"&&(v[Lp(li)]=Mt,Rn=li),v[mn]=Mt),Hr[tn]=Fi;continue}Wn.push(tn,Fi);continue}tn=Me(tn,Rn),tn!==null&&(Hr[tn]=Fi)}if(h)for(At=0,_n=Wn.length;At<_n;At++)tn=Me(Wn[At++],Rn),Fi=Wn[At],tn!==null&&(Hr[tn]=Fi);return ie=Hr}function mt(){for(var Mt=/(\r\n|\r|\n)/g,mn=0,Rn=0,Wn=0,At=Z,Zt,_n;Se>=Wn&&(Zt=Mt.exec(N),!(!Zt||(At=Zt[0].length+Zt.index,At>Se)));)mn+=1,Wn=At;return Se==-1?(Rn=At,_n=N.substring(Z)):Z===0?_n=N.substring(Z,Se):(Rn=Se-Wn,_n=Z==-1?N.substring(Se):N.substring(Se,Z+1)),{data:_n,line:mn,column:Rn}}for(p=mt,t&&(S=Object.create({},{name:Ac(function(){return B}),originalName:Ac(function(){return C}),attrs:Ac(Xe),ns:Ac(function(){return v})}));Z!==-1;){if(N.charCodeAt(Z)===60?Se=Z:Se=N.indexOf("<",Z),Se===-1){if(H)return N.substring(Z);if(E.length)return P("unexpected end of file");if(!d)return P("missing start tag");Z<N.length&&N.substring(Z).trim()&&T(Fg);return}if(d||(d=!0),Z!==Se){if(E.length){if(n&&(n(N.substring(Z,Se),br,p),b))return}else if(N.substring(Z,Se).trim()&&(T(Fg),b))return}if(ae=N.charCodeAt(Se+1),ae===33){if(Y=N.charCodeAt(Se+2),Y===91&&N.substr(Se+3,6)==="CDATA["){if(Z=N.indexOf("]]>",Se),Z===-1)return H?N.substring(Se):P("unclosed cdata");if(r&&(r(N.substring(Se+9,Z),p),b))return;Z+=3;continue}if(Y===45&&N.charCodeAt(Se+3)===45){if(Z=N.indexOf("-->",Se),Z===-1)return H?N.substring(Se):P("unclosed comment");if(c&&(c(N.substring(Se+4,Z),br,p),b))return;Z+=3;continue}}if(ae===63){if(Z=N.indexOf("?>",Se),Z===-1)return H?N.substring(Se):P("unclosed question");if(l&&(l(N.substring(Se,Z+2),p),b))return;Z+=2;continue}for(oe=Se+1;;oe++){if(ge=N.charCodeAt(oe),isNaN(ge))return H?N.substring(Se):(Z=-1,P("unclosed tag"));if(ge===34)Y=N.indexOf('"',oe+1),oe=Y!==-1?Y:oe;else if(ge===39)Y=N.indexOf("'",oe+1),oe=Y!==-1?Y:oe;else if(ge===62){Z=oe;break}}if(ae===33){if(u&&(u(N.substring(Se,Z+1),br,p),b))return;Z+=1;continue}if(ie={},ae===47){if(qe=!1,Ge=!0,!E.length)return P("missing open tag");if(oe=B=E.pop(),Y=Se+2+oe.length,N.substring(Se+2,Y)!==oe)return P("closing tag mismatch");for(;Y<Z;Y++)if(ae=N.charCodeAt(Y),!(ae===32||ae>8&&ae<14))return P("close tag")}else{if(N.charCodeAt(Z-1)===47?(oe=B=N.substring(Se+1,Z-1),qe=!0,Ge=!0):(oe=B=N.substring(Se+1,Z),qe=!0,Ge=!1),!(ae>96&&ae<123||ae>64&&ae<91||ae===95||ae===58))return P("illegal first char nodeName");for(Y=1,W=oe.length;Y<W;Y++)if(ae=oe.charCodeAt(Y),!(ae>96&&ae<123||ae>64&&ae<91||ae>47&&ae<59||ae===45||ae===95||ae==46)){if(ae===32||ae<14&&ae>8){B=oe.substring(0,Y),ie=null;break}return P("invalid nodeName")}Ge||E.push(B)}if(m){ee=v,qe&&(Ge||y.push(ee),ie===null&&(h=oe.indexOf("xmlns",Y)!==-1)&&(q=Y,G=oe,Xe(),h=!1)),C=B,Q!==v&&(X=v[jg],X===void 0&&(X=v[jg]=Object.create(null)),Q=v);var Ut=X[B];if(Ut!==void 0)B=Ut;else{if(ae=B.indexOf(":"),ae!==-1){if(Te=v[B.substring(0,ae)],!Te)return P("missing namespace on <"+C+">");B=B.substr(ae+1)}else Te=v.xmlns;Te&&(B=Te+":"+B),X[C]=B}}if(qe&&(q=Y,G=oe,i&&(t?i(S,br,Ge,p):i(B,Xe,br,Ge,p),b)))return;if(Ge){if(o&&(o(t?S:B,br,qe,p),b))return;m&&(qe?v=ee:v=y.pop())}Z+=1}}}function zg(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Ip={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Gg="property";function Vg(e){return e.xml&&e.xml.serialize}function xS(e){const t=Vg(e);return t!==Gg&&(t||null)}function _S(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Wg(e,t){return zg(t)?e.prefix+":"+_S(e.localName):e.name}function wS(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 ES(e,t,n){const i=$n(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=$n(o);var a=n.getPackage(r.prefix);return wS(r,a)}function Io(e){return new Error(e)}function uo(e){return e.$descriptor}function SS(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Io("expected element");var n=this.elementsById,i=uo(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 Io("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ns(){}ns.prototype.handleEnd=function(){},ns.prototype.handleText=function(){},ns.prototype.handleNode=function(){};function Bp(){}Bp.prototype=Object.create(ns.prototype),Bp.prototype.handleNode=function(){return this};function na(){}na.prototype=Object.create(ns.prototype),na.prototype.handleText=function(e){this.body=(this.body||"")+e};function is(e,t){this.property=e,this.context=t}is.prototype=Object.create(na.prototype),is.prototype.handleNode=function(e){if(this.element)throw Io("expected no sub nodes");return this.element=this.createReference(e),this},is.prototype.handleEnd=function(){this.element.id=this.body},is.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Np(e,t){this.element=t,this.propertyDesc=e}Np.prototype=Object.create(na.prototype),Np.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=kp(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Tc(){}Tc.prototype=Object.create(na.prototype),Tc.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 zn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}zn.prototype=Object.create(Tc.prototype),zn.prototype.addReference=function(e){this.context.addReference(e)},zn.prototype.handleText=function(e){var t=this.element,n=uo(t),i=n.bodyProperty;if(!i)throw Io("unexpected body text <"+e+">");na.prototype.handleText.call(this,e)},zn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=uo(t),i=n.bodyProperty;i&&e!==void 0&&(e=kp(i.type,e),t.set(i.name,e))},zn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=uo(n),o=this.context,r=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),z(p,function(f){o.addReference({element:r,property:u.ns.name,id:f})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=kp(u.type,c):l==="xmlns"?l=":"+l:(s=$n(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},zn.prototype.getPropertyForNode=function(e){var t=e.name,n=$n(t),i=this.type,o=this.model,r=uo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=xS(s);if(l){const u=e.attributes[l];if(u){const p=ES(u,e.ns,o),f=o.getType(p);return V({},s,{effectiveType:uo(f).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=Wg(n,c),u=o.getType(l);if(s=Ot(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return V({},s,{effectiveType:uo(u).name})}else if(s=Ot(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Io("unrecognized element <"+n.name+">")},zn.prototype.toString=function(){return"ElementDescriptor["+uo(this.type).name+"]"},zn.prototype.valueHandler=function(e,t){return new Np(e,t)},zn.prototype.referenceHandler=function(e){return new is(e,this.context)},zn.prototype.handler=function(e){return e==="Element"?new ia(this.model,e,this.context):new zn(this.model,e,this.context)},zn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Ig(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?(V(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function $p(e,t,n){zn.call(this,e,t,n)}$p.prototype=Object.create(zn.prototype),$p.prototype.createElement=function(e){var t=e.name,n=$n(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&Wg(n,r)||t;if(!o.hasType(a))throw Io("unexpected element <"+e.originalName+">");return zn.prototype.createElement.call(this,e)};function ia(e,t,n){this.model=e,this.context=n}ia.prototype=Object.create(Tc.prototype),ia.prototype.createElement=function(e){var t=e.name,n=$n(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},ia.prototype.handleChild=function(e){var t=new ia(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},ia.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Fp(e){e instanceof vi&&(e={model:e}),V(this,{lax:!1},e)}Fp.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof zn?(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 SS(V({},t,{rootHandler:i})),s=new Hg({proxy:!0}),c=RS();i.context=a,c.push(i);function l(E,w,P){var T=w(),L=T.line,$=T.column,N=T.data;N.charAt(0)==="<"&&N.indexOf(" ")!==-1&&(N=N.slice(0,N.indexOf(" "))+">");var H="unparsable content "+(N?N+" ":"")+`detected
2
+ line: `+L+`
3
3
  column: `+$+`
4
- nested error: `+E.message;if(P)return a.addWarning({message:H,error:E}),!0;throw Do(H)}function u(E,w){return l(E,w,!0)}function p(){var E=a.elementsById,w=a.references,P,T;for(P=0;T=w[P];P++){var D=T.element,$=E[T.id],N=co(D).propertiesByName[T.property];if($||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),N.isMany){var H=D.get(N.name),X=H.indexOf(T);X===-1&&(X=H.length),$?H[X]=$:H.splice(X,1)}else D.set(N.name,$)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(d.test(E)){var w=g.exec(E),P=w&&w[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function _(E,w){var P=c.peek();try{c.push(P.handleNode(E))}catch(T){l(T,w,r)&&c.push(new Dp)}}function b(E,w){try{c.peek().handleText(E)}catch(P){u(P,w)}}function y(E,w){E.trim()&&b(E,w)}var v=o.getPackages().reduce(function(E,w){return E[w.uri]=w.prefix,E},Object.entries(Op).reduce(function(E,[w,P]){return E[P]=w,E},o.config&&o.config.nsMap||{}));return s.ns(v).on("openTag",function(E,w,P,T){var D=E.attrs||{},$=Object.keys(D).reduce(function(H,X){var Q=w(D[X]);return H[X]=Q,H},{}),N={name:E.name,originalName:E.originalName,attributes:$,ns:E.ns};_(N,T)}).on("question",m).on("closeTag",f).on("cdata",b).on("text",function(E,w,P){y(w(E),P)}).on("error",l).on("warn",u),new Promise(function(E,w){var P;try{s.parse(e),p()}catch(H){P=H}var T=i.element;!P&&!T&&(P=Do("failed to parse document as <"+i.type.$descriptor.name+">"));var D=a.warnings,$=a.references,N=a.elementsById;return P?(P.warnings=D,w(P)):E({rootElement:T,elementsById:N,references:$,warnings:D})})},Bp.prototype.handler=function(e){return new Ip(this.model,e)};function wS(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var ES=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,SS=/<|>|'|"|&|\n\r|\n/g,Gg=/<|>|&/g;function Gi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Gi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Gi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Gi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Gi.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)},Gi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Gi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Gi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Gi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Gi.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 RS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function CS(e,t){return Fg(t)?RS(e):e}function Vg(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Wg(e){return Xn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function MS(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 AS(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:CS(t.ns.localName,t.$pkg)},e)}function PS(e,t){return V({localName:t.ns.localName},e)}function TS(e){var t=e.$descriptor;return it(t.properties,function(n){var i=n.name;if(n.isVirtual||!Zn(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var kS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},OS={"<":"lt",">":"gt","&":"amp"};function Ug(e,t,n){return e=Xn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function DS(e){return Ug(e,SS,kS)}function LS(e){return Ug(e,Gg,OS)}function IS(e){return it(e,function(t){return t.isAttr})}function BS(e){return it(e,function(t){return!t.isAttr})}function Np(e){this.tagName=e}Np.prototype.build=function(e){return this.element=e,this},Np.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function vr(){}vr.prototype.serializeValue=vr.prototype.serializeTo=function(e){e.append(this.escape?LS(this.value):this.value)},vr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Gg)!==-1&&(this.escape=!0),this};function $p(e){this.tagName=e}Vg($p,vr),$p.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.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=TS(e),this.parseAttributes(IS(o)),this.parseContainments(BS(o))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return AS(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return PS(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Xn(e)?t=$n(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}:V({localName:t.localName},n)},Ht.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}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new vr().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=$n(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)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;z(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)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new vr().build(o,r[0]));else if(Og(o.type))z(r,function(l){n.push(new $p(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)z(r,function(l){n.push(new Np(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Hg(o);z(r,function(l){var u;c?c===jg?u=new Ht(t,o):u=new Ac(t,o,c):u=new Ht(t),n.push(u.build(l))})}})},Ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Gi(i):t=i),t},Ht.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},Ht.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},Ht.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];z(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Wg(e)},Ht.prototype.addAttribute=function(e,t){var n=this.attrs;Xn(t)&&(t=DS(t));var i=Rg(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)},Ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=MS(n).concat(t)),z(t,function(i){e.append(" ").append(Wg(i.name)).append('="').append(i.value).append('"')})},Ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==vr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Ac(e,t,n){Ht.call(this,e,t),this.serialization=n}Vg(Ac,Ht),Ac.prototype.parseNsAttributes=function(e){var t=Ht.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},Ac.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function NS(){this.value="",this.write=function(e){this.value+=e}}function $S(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 FS(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new NS,r=new $S(o,e.format);e.preamble&&r.append(ES);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(jS(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function jS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Op)n[i]=Op[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 Pc(e,t){vi.call(this,e,t)}Pc.prototype=Object.create(vi.prototype),Pc.prototype.fromXML=function(e,t,n){Xn(t)||(n=t,t="bpmn:Definitions");var i=new Bp(V({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Pc.prototype.toXML=function(e,t){var n=new FS(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var HS="BPMN20",zS="http://www.omg.org/spec/BPMN/20100524/MODEL",GS="bpmn",VS=[],WS=[{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"}]}],US=[{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"}]}],qS={tagAlias:"lowerCase",typePrefix:"t"},YS={name:HS,uri:zS,prefix:GS,associations:VS,types:WS,enumerations:US,xml:qS},KS="BPMNDI",XS="http://www.omg.org/spec/BPMN/20100524/DI",ZS="bpmndi",QS=[{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"]}],JS=[{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"}]}],eR=[],tR={name:KS,uri:XS,prefix:ZS,types:QS,enumerations:JS,associations:eR},nR="DC",iR="http://www.omg.org/spec/DD/20100524/DC",oR="dc",rR=[{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}]}],aR=[],sR={name:nR,uri:iR,prefix:oR,types:rR,associations:aR},cR="DI",lR="http://www.omg.org/spec/DD/20100524/DI",uR="di",pR=[{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"}]}],fR=[],dR={tagAlias:"lowerCase"},hR={name:cR,uri:lR,prefix:uR,types:pR,associations:fR,xml:dR},gR="bpmn.io colors for BPMN",mR="http://bpmn.io/schema/bpmn/biocolor/1.0",yR="bioc",vR=[{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"}]}],bR=[],xR=[],_R={name:gR,uri:mR,prefix:yR,types:vR,enumerations:bR,associations:xR},wR="BPMN in Color",ER="http://www.omg.org/spec/BPMN/non-normative/color/1.0",SR="color",RR=[{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"}]}],CR=[],MR=[],AR={name:wR,uri:ER,prefix:SR,types:RR,enumerations:CR,associations:MR};const PR={bpmn:YS,bpmndi:tR,dc:sR,di:hR,bioc:_R,color:AR};function qg(e,t){const n=V({},PR,e);return new Pc(n,t)}const TR={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"}},Tc={[Mg]:TR,[dp]:wg};function Yg(){return qg(Tc)}const Kg=Yg();async function na(e){const{rootElement:t,warnings:n}=await Kg.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function kR(e){const{xml:t}=await Kg.toXML(e,{format:!0});return t}function Fp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ia={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},OR=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function DR(e){const t=ia;return OR.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function oa(e,t){let n=0;for(const i of e)n+=t*DR(i);return n}function Xg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&LR(e),IR(e),BR(e),NR(e)}function LR(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(o){var a;const r=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:oa(o,r),fontBoundingBoxAscent:r*ia.ascentEm,fontBoundingBoxDescent:r*ia.descentEm,actualBoundingBoxAscent:r*ia.ascentEm,actualBoundingBoxDescent:r*ia.descentEm}}};t.getContext=()=>n}function IR(e){if(e.SVGMatrix)return;class t{constructor(){pi(this,"a",1);pi(this,"b",0);pi(this,"c",0);pi(this,"d",1);pi(this,"e",0);pi(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 BR(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),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(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 NR(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:oa(n,12),height:14}})}const kc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),$R=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),FR=1,Oc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),jR=2;function lt(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 Zg=20,Dc=5,Qg=3,HR=8,ra=15,jp=50,Jg=12,zR=Jg*1.2;function Hp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>oa(r,Jg))),o=n.length*zR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const em=1;function bn(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 br(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 bn(e))for(const s of bn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>em)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>=Zg&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function zp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function tm(e,t){const n=br(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function GR(e,t){let n=0;for(const i of t)i.id!==e.id&&tm(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id!==e.id&&br(e,i)&&n++;return n}const nm=15,im=20;function VR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-im||t.at>n[1]+im)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 Gp=20;function Lc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>em)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<Zg||n.push([o-Gp,r+Gp])}return n}function Ic(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of bn(e)){const r=VR(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Lc(o,bn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const WR=10,UR=1,qR=(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 YR(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 f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(o-e.x,c)&&f(e.x-a,-c)&&f(r-e.y,l)&&f(e.y-s,-l)&&p>u}function Vp(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 KR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,aa=1;function Vi(e,t){const n=e.x+aa,i=e.x+e.width-aa,o=e.y+aa,r=e.y+e.height-aa;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 sa(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 om(e,t){const n=e.label;if(!n)return null;if(bn(e).some(i=>Vi(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(bn(i).some(o=>Vi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(sa(i).some(o=>Vi(n,o)))return i.id;return null}function en(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(YR(e.waypoints[r],e.waypoints[r+1],o,jR)){i.push(o);break}}return i}const ts=(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))},XR=(e,t,n,i)=>am(e,t,n,i)?0:Math.min(ts(e,n,i),ts(t,n,i),ts(n,e,t),ts(i,e,t)),rm=(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 ns(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,ts({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(rm(e,s)||rm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,XR(e,t,s[l],s[(l+1)%s.length]));return c}function am(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 Wp=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function sm(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(am(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function is(e,t){let n=0;for(const i of t)i.id===e.id||Wp(e,i)||sm(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id===e.id||Wp(e,i)||is(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function cm(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++)is(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function ca(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(is(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 Lo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Wp(n[i],n[o])&&sm(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 lm(e){const t=ca(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:ZR(e)}}function ZR(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 um(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Oc.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 pm(e){var n;const t=(n=$t(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=$t(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 fm=e=>e?{members:e}:{},Jn=e=>e.shapes.filter(t=>!t.container);function QR(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 JR(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 dm(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(bn(i).some(o=>Vi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(sa(i).some(o=>Vi(n,o)))return i.id;return null}function xr(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 hm=3;function gm(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 os(e,t){const n=[];for(const i of t.shapes){if(i.container||Oc.has(i.type))continue;const o=gm(e,i);o>=hm&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function pt(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of en(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&$R.has(y.type));if(o.length){const y=(v,E)=>{const w=e.shapes.find(P=>P.id===E);return!!w&&w.x>=v.x&&w.y>=v.y&&w.x+w.width<=v.x+v.width&&w.y+w.height<=v.y+v.height};for(const v of e.edges)for(const E of en(v,o))v.endpoints.includes(E.id)||v.endpoints.some(w=>y(E,w))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:E.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const v=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[E,w]of v){if(!E)continue;const P=e.shapes.find(N=>N.id===E);if(!P||P.container)continue;const T=Math.max(P.x-w.x,w.x-(P.x+P.width),0),D=Math.max(P.y-w.y,w.y-(P.y+P.height),0),$=Math.hypot(T,D);$>WR&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:E,distance:Math.round($)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const E=r[y],w=r[v];if(E.x+E.width<=w.x||w.x+w.width<=E.x||E.y+E.height<=w.y||w.y+w.height<=E.y)continue;const P=(T,D)=>T.x<=D.x&&T.y<=D.y&&T.x+T.width>=D.x+D.width&&T.y+T.height>=D.y+D.height;n.push({kind:"pool-overlap",pools:[E.id,w.id],contained:P(E,w)||P(w,E)})}const a=i.filter(y=>!y.attached);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const E=a[y],w=a[v];if(!Vp(E,w,FR))continue;const P=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:"shape-overlap",shapes:P,identical:KR(E,w)})}const s=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<s.length;y++)for(let v=y+1;v<s.length;v++){const E=s[y],w=s[v],P=Math.min(E.x+E.width,w.x+w.width)-Math.max(E.x,w.x),T=Math.min(E.y+E.height,w.y+w.height)-Math.max(E.y,w.y);if(P<=Dc||T<=Dc)continue;const D=E.id<w.id?[E.id,w.id]:[w.id,E.id],$=new Set(w.members);if(E.members.some(H=>$.has(H))){const H=um(e,s,{x:Math.max(E.x,w.x),y:Math.max(E.y,w.y),right:Math.min(E.x+E.width,w.x+w.width),bottom:Math.min(E.y+E.height,w.y+w.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:D,shapes:H});continue}const N=E.x<=w.x&&E.y<=w.y&&E.x+E.width>=w.x+w.width&&E.y+E.height>=w.y+w.height?E.id:w.x<=E.x&&w.y<=E.y&&w.x+w.width>=E.x+E.width&&w.y+w.height>=E.y+E.height?w.id:void 0;n.push({kind:"group-overlap-unintended",groups:D,...N?{container:N}:{}})}const c=new Set(s.flatMap(y=>[...y.members])),l=y=>e.shapes.filter(v=>!v.container&&!Oc.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of s){const v=l(y);if(!v.length)continue;const E=new Set(y.members),w=v.filter(P=>!E.has(P.id));w.some(P=>c.has(P.id))&&(w.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:w.map(P=>P.id).sort()}))}for(const y of s){const v=new Set(l(y).map($=>$.id)),E=new Set(y.members),w=new Set([...v].filter($=>!E.has($)&&c.has($)));if(!w.size)continue;let P=!1,T=!1,D=!1;for(const $ of e.edges){if($.type!=="bpmn:SequenceFlow"||!$.source||!$.target)continue;const N=w.has($.source),H=w.has($.target);!N&&H&&!v.has($.source)?P=!0:N&&!H&&!v.has($.target)?T=!0:N&&H&&(D=!0)}P&&T&&D&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...w].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let v=y+1;v<u.length;v++)for(let E=v+1;E<u.length;E++){const w=[u[y],u[v],u[E]],P={x:Math.max(...w.map($=>$.x)),y:Math.max(...w.map($=>$.y)),right:Math.min(...w.map($=>$.x+$.width)),bottom:Math.min(...w.map($=>$.y+$.height))};if(P.right-P.x<=Dc||P.bottom-P.y<=Dc)continue;const T=um(e,[],P);if(!T.length)continue;const D=w.map($=>$.id).sort();n.push({kind:"group-stack-unreadable",groups:D,shapes:T})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Oc.has(v.type)||v.width<=0||v.height<=0)continue;const E=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[w,P,T,D,$]of E){const N=T==="h"?v.x:v.y,H=T==="h"?v.x+v.width:v.y+v.height;if(!(N<$&&D<H))continue;const X=T==="h"?v.y:v.x,Q=T==="h"?v.y+v.height:v.x+v.width;if(!(X<P&&P<Q))continue;const ee=Math.min(P-X,Q-P);ee<HR||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:w,depth:ee})}}const p=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(p.length){const y=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 E=bn(v);if(E.length)for(const w of p){const P=w.x+w.width,T=w.y+w.height,D=v.endpoints.some(N=>{const H=y.get(N);return!!H&&w.x<H.x&&H.x<P&&w.y<H.y&&H.y<T});let $=null;for(const N of E){const[H,X,Q]=N.axis==="v"?[w.y,T,[["left",w.x],["right",P]]]:[w.x,P,[["top",w.y],["bottom",T]]],ee=Math.min(N.hi,X)-Math.max(N.lo,H);if(ee<jp)continue;const We=N.axis==="v"?w.x<N.at&&N.at<P:w.y<N.at&&N.at<T;if(!(We&&D))for(const[qe,Ge]of Q){const Re=Math.abs(N.at-Ge);Re<=ra&&(!$||Re<$.distance)&&($={side:qe,inside:We,distance:Re,length:ee})}}$&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:w.id,side:$.side,inside:$.inside,distance:Math.round($.distance),length:Math.round($.length)})}}}const f=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const E=y.x<v.x+v.width&&v.x<y.x+y.width,w=y.y<v.y+v.height&&v.y<y.y+y.height,P=[["top",y.y,v.y,E],["bottom",y.y+y.height,v.y+v.height,E],["left",y.x,v.x,w],["right",y.x+y.width,v.x+v.width,w]];for(const[T,D,$,N]of P)N&&Math.abs(D-$)<=Qg&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:T})}const d=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<d.length;y++)for(let v=y+1;v<d.length;v++){const E=d[y],w=d[v],P=E.x<w.x+w.width&&w.x<E.x+E.width,T=E.y<w.y+w.height&&w.y<E.y+E.height,D=[["x",E.x+E.width,w.x,T],["x",w.x+w.width,E.x,T],["y",E.y+E.height,w.y,P],["y",w.y+w.height,E.y,P]];for(const[$,N,H,X]of D)if(X&&Math.abs(N-H)<=Qg){n.push({kind:"group-on-group-boundary",groups:E.id<w.id?[E.id,w.id]:[w.id,E.id],axis:$});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const E=e.edges[y],w=e.edges[v],P=br(E,w);if(!P)continue;const T=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const y of e.edges){if(!y.label)continue;const v=Ic(y,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:y.id,other:v.other,axis:v.axis})}for(const y of e.edges){if(!y.label)continue;const v=om(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:E}of os(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(E)})}const g=new Set(i.map(y=>y.id)),h=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...h.filter(v=>!g.has(v.id))]){if(!y.label)continue;const v=dm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of h)for(const{owner:v,rect:E}of xr(e))v===y.id||m.has(v)||Vp(y.label,E,aa)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const _=xr(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:E}of _)v!==y.id&&Vp(y,E,aa)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const b=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??QR(y,e,b);if(!v)continue;const E=b.get(v);!E||!E.container||qR(E,y,UR)||y.type==="bpmn:TextAnnotation"&&!JR(y,E,e)||n.push({kind:"shape-outside-container",shape:y.id,container:E.id})}return n.sort((y,v)=>lt(y).localeCompare(lt(v)))}const $t=e=>typeof e=="object"&&e!==null?e:void 0,Xt=e=>typeof e=="number"?e:0,lo=e=>{const t=$t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function eC(e){const t=$t(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=lo(r);a&&n.push(a)}}return n}function tC(e){const t=$t(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:lo(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:lo(t.targetRef);return n&&i?{source:n,target:i}:{}}function nC(e,t){const n=$t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=lo(n);return o?t.get(o):void 0}if(kc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return lo(n)}function mm(e){var a,s,c,l,u;const t=[],n=[],i=((a=$t(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=$t(e))==null?void 0:s.rootElements)??[]){const f=$t(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=$t(d),h=lo(g),m=lo(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=$t((c=$t(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=$t(g);if(!h)continue;const m=$t(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const b=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",y=$t(h.bounds);if(y){const E=h.isExpanded===!1&&b!=="bpmn:Participant",w=$t((l=$t(h.label))==null?void 0:l.bounds),P={id:_,type:b,x:Xt(y.x),y:Xt(y.y),width:Xt(y.width),height:Xt(y.height),container:kc.has(b)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:nC(m,o)}:{},...w?{label:{x:Xt(w.x),y:Xt(w.y),width:Xt(w.width),height:Xt(w.height)}}:{},...b==="bpmn:Group"?fm(pm(m)):{}},T=h.isHorizontal!==!1,D=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(_)&&T&&D&&(P.label=Hp(P,D)),t.push(P);continue}const v=h.waypoint;if(Array.isArray(v)){const E=$t((u=$t(h.label))==null?void 0:u.bounds);n.push({id:_,type:b,waypoints:v.map(w=>{var P,T;return{x:Xt((P=$t(w))==null?void 0:P.x),y:Xt((T=$t(w))==null?void 0:T.y)}}),endpoints:eC(m),...tC(m),...E?{label:{x:Xt(E.x),y:Xt(E.y),width:Xt(E.width),height:Xt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function ym(e){return pt(mm(e),{includeObservationOnly:!0})}async function iC(e){const{definitions:t,warnings:n}=await na(e);return{findings:ym(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=$t(r.label),m=lo(r.source),_=lo(r.target);n.push({id:r.id,type:a,waypoints:s.map(b=>({x:Xt(b.x),y:Xt(b.y)})),endpoints:[m,_].filter(b=>!!b),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Xt(h.y),width:Xt(h.width),height:Xt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=$t(r.businessObject),l=$t(r.label);let u=$t(r.parent);for(;u&&u.type==="bpmn:Lane";)u=$t(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&kc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:Xt(r.width),height:Xt(r.height),container:kc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Xt(l.y),width:Xt(l.width),height:Xt(l.height)}}:{},...a==="bpmn:Group"?fm(pm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=$t(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Hp(d,g)),t.push(d)}return{shapes:t,edges:n}}const oC={"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 rC(e,t){const n=oC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function vm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function bm(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 rC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&vm(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?vm(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 fp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:To(i.businessObject).map(o=>o.locale)}}}const Up=20,aC=4,ot=(e,t)=>Math.abs(e-t)<.5;function Bc(e,t,n,i=Up){if(ot(e.y,t.y)&&!ot(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(ot(e.x,t.x)&&!ot(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 xm(e,t,n,i=Up){if(n.length<2)return null;if(ot(e.y,t.y)&&!ot(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(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(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(ot(e.x,t.x)&&!ot(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(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(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function _m(e,t,n=Up){if(e.length!==4)return null;const[i,o,r,a]=e;if(ot(i.y,o.y)&&ot(o.x,r.x)&&ot(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(ot(i.x,o.x)&&ot(o.y,r.y)&&ot(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 Nc(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 $c=30,sC=[0,-25,25,-40,40];function cC(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const 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+$c:s-$c,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return sC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>en({...e,endpoints:[],waypoints:f},[n]).length===0)}const qp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],la=(e,t,n)=>en({...e,waypoints:t},n).length;function Yp(e,t,n,i){let o=[...e.waypoints],r=la(e,o,t);if(r===0)return null;let a=!1;for(const p of Nc(e,t))if(la(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(bn),c=p=>bn({...e,waypoints:p}).some(f=>Lc(f,s).length>0),l=cC(e,t).filter(p=>la(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&ot(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(ot(d[0].y,d[1].y)&&!ot(d[0].x,d[1].x)){const g=t.filter(b=>!e.endpoints.includes(b.id)&&en({...e,waypoints:d},[b]).length>0),h=g.length>=2?xm(d[0],d[1],g):null,_=(h?h.map(b=>[d[0],...b,d[1]]):g.length===1?(Bc(d[0],d[1],g[0])??[]).map(b=>[d[0],...b,d[1]]):g.length===0?[d]:[]).filter(b=>la(e,b,t)===0&&b.length<=o.length).sort((b,y)=>Number(u(y))-Number(u(b)));if(_.length)return _.find(b=>!c(b))??_[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&en({...e,waypoints:[f,d]},[_]).length>0);if(g.length<2)continue;const h=xm(f,d,g);if(!h)continue;const m=h.map(_=>qp(o,p,_)).filter(_=>la(e,_,t)===0).sort((_,b)=>Number(u(b))-Number(u(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let p=0;p<aC&&r>0;p++){let f=!1;for(let d=0;d+1<o.length&&!f;d++){const g=o[d],h=o[d+1];for(const m of t){if(e.endpoints.includes(m.id)||en({...e,waypoints:[g,h]},[m]).length===0)continue;const _=Bc(g,h,m),b=_?_.map(v=>qp(o,d,v)):_m(o,m)??[];if(!b.length)continue;const y=[...b].sort((v,E)=>Number(u(E))-Number(u(v)));for(const v of y){const E=la(e,v,t);if(E<r){o=v,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function Kp(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=Jn(r),s=new Set,c=pt(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(lt(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(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=en(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=Yp(p,a,g,r.edges);if(!m){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const _=r.edges.filter(v=>v.id!==u),b=di(p,_);di({...p,waypoints:m},_)>b||o.updateWaypoints(f,m)}return s}const lC=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 Xp(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 Zp=(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),Qp=(e,t)=>is(e,[t])>0;function wm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=Jn(r);let s=r;const c=new Set(pt(r).map(lt));for(const[l,u]of ca(r))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(P=>P.id===p),g=s.edges.find(P=>P.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=Xp(h),_=lC(g),b=[...Nc(d,a)??[]],y=Yp(d,[...a,..._],m,r.edges);y&&b.push(y);for(let P=0;P+1<d.waypoints.length;P++)for(const T of _)for(const D of Bc(d.waypoints[P],d.waypoints[P+1],T)??[])b.push(qp(d.waypoints,P,D));const v=s.edges.filter(P=>P.id!==p),E=P=>({...s,edges:s.edges.map(T=>T.id===p?{...T,waypoints:P}:T)}),w=b.find(P=>{const T={...d,waypoints:P};return Qp(T,g)||!Zp(P,m)||v.some(D=>D.id!==f&&!Qp(d,D)&&Qp(T,D))?!1:pt(E(P)).every(D=>c.has(lt(D)))});if(w){o.updateWaypoints(h,w),s=E(w);break}}}const uC=["top","bottom","left","right"],Em={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},rs=20,pC=20;function fC(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&&ot(e.y,t.y)&&o.push("top"),n&&ot(e.y,t.y+t.height)&&o.push("bottom"),i&&ot(e.x,t.x)&&o.push("left"),i&&ot(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const dC=(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 Sm(e,t,n,i){const o=Em[t],r=Em[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",f=a?"x":"y",d=o[p],g=r[p];if(ot(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=rs?[e,n]:null;let h;if(d===-g){const _=e[p]+d*rs,b=n[p]-d*rs;if(d*(b-_)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+$c:Math.min(e[p],n[p])-$c;const m=(_,b)=>a?{x:b,y:_}:{x:_,y:b};return[e,m(h,e[f]),m(h,n[f]),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>=rs&&u>=rs?[e,c,n]:null}function hC(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?fC(a,r):null;if(!s)return[];const c=[];for(const l of uC){const u=dC(t,l),p=o?Sm(u,l,a,s):Sm(a,s,u,l);p&&c.push(p)}return c}const Rm=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 gC(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(pt(r).map(lt));let c=r;for(const[l,u]of Lo(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(D=>D.id===l),f=c.edges.find(D=>D.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Lo({edges:[p,f]}).length)continue;const d=p.endpoints.find(D=>f.endpoints.includes(D)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const _=D=>n.has(D.id)?[D.waypoints]:[D.waypoints,...hC(D,g,a)],b=D=>D.length-2,y=_(p).flatMap(D=>_(f).map($=>({pa:D,pb:$}))).filter(({pa:D,pb:$})=>D!==p.waypoints||$!==f.waypoints).map(D=>({...D,cost:Rm(D.pa)+Rm(D.pb)+pC*(b(D.pa)+b(D.pb))})).sort((D,$)=>D.cost-$.cost),v=Xp(h),E=Xp(m),w=Lo(c).length,P=new Set(ca(c).map(([D,$])=>`${D}|${$}`)),T=y.find(({pa:D,pb:$})=>{const N={...p,waypoints:D},H={...f,waypoints:$};if(Lo({edges:[N,H]}).length||br(N,H)||!Zp(D,v)||!Zp($,E))return!1;const X={...c,edges:c.edges.map(Q=>Q.id===l?N:Q.id===u?H:Q)};return Lo(X).length>=w||ca(X).some(([Q,ee])=>!P.has(`${Q}|${ee}`))?!1:pt(X).every(Q=>s.has(lt(Q)))});T&&(T.pa!==p.waypoints&&o.updateWaypoints(h,T.pa),T.pb!==f.waypoints&&o.updateWaypoints(m,T.pb),c={...c,edges:c.edges.map(D=>D.id===l?{...p,waypoints:T.pa}:D.id===u?{...f,waypoints:T.pb}:D)})}}const mC=10;function Cm(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 Mm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),o=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!o)return null;const r=Cm(i,n),a=Cm(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(H=>H.id!==r.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,X)=>H.y-X.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,m=s?g:d,_=e.waypoints[0],b=e.waypoints[e.waypoints.length-1],y=Jn(t),v=t.edges.filter(H=>H.id!==e.id),E=hi(e,v),w=en(e,y).length;if(E===0&&w===0||w===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),D=(_.x+b.x)/2,$=H=>H.filter((X,Q)=>Q===0||!(ot(X.x,H[Q-1].x)&&ot(X.y,H[Q-1].y)));let N;for(let H=P;H<=T;H+=mC){const X=$([_,{x:_.x,y:h},{x:H,y:h},{x:H,y:m},{x:b.x,y:m},b]),Q={...e,waypoints:X};if(en(Q,y).length>0)continue;const ee=hi(Q,v),We=Math.abs(H-D);(!N||ee<N.cross||ee===N.cross&&We<N.detour)&&(N={pts:X,cross:ee,detour:We})}return N&&(w>0?N.cross<=E:N.cross<E)?N.pts:null}const yC=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function vC(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=Jn(a);for(const p of t.edges){if(!yC.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const f=i.get(p.id);if(!(f!=null&&f.waypoints)||((l=f.source)==null?void 0:l.id)!==p.source||((u=f.target)==null?void 0:u.id)!==p.target)continue;const d=r.get(p.source),g=r.get(p.target),h=s.get(p.source),m=s.get(p.target);if(!d||!g||!h||!m||!ot(d.width,h.width)||!ot(d.height,h.height)||!ot(g.width,m.width)||!ot(g.height,m.height))continue;const _=h.x-d.x,b=h.y-d.y;if(ot(_,0)&&ot(b,0)||!ot(m.x-g.x,_)||!ot(m.y-g.y,b))continue;const y=p.waypoints.map(w=>({x:w.x+_,y:w.y+b})),v=f.waypoints.map(w=>({x:w.x,y:w.y}));v.length===y.length&&v.every((w,P)=>ot(w.x,y[P].x)&&ot(w.y,y[P].y))||v.length===2&&(ot(v[0].x,v[1].x)||ot(v[0].y,v[1].y))&&en({...p,waypoints:v},c).length===0||en({...p,waypoints:y},c).length>0||o.updateWaypoints(f,y)}}function Am(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=Mm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Wi=[25,-25,40,-40],ua=35;function bC(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)-ua:Math.max(e.y+e.height,t.y+t.height)+ua,p=_C(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,xC]];for(const[d,g]of f)for(const h of[0,...Wi])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Wi]){if(Math.abs(m)>=t.width/2-5)continue;const _=i+h,b=o+m,y=[{x:_,y:c},{x:_,y:d},{x:b,y:d},{x:b,y:l}];g&&en({endpoints:[],waypoints:y},a).length||r.push({pts:y,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const xC=45,Fc=20;function _C(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(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,_)=>m.width*m.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),f=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...f.map(b=>b.y));for(let b=!0;b;){b=!1;for(const y of d)y.y<m&&y.y<l&&y.y+y.height>m-Fc&&(m=y.y,b=!0)}const _=Math.max(u.y,...d.filter(b=>b.y+b.height<=m).map(b=>b.y+b.height));return m-_>=Fc?Math.round((m+_)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const _ of d)_.y+_.height>g&&_.y+_.height>l&&_.y<g+Fc&&(g=_.y+_.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=Fc?Math.round((g+h)/2):null}function jc(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 bC(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-ua:n.y+n.height+ua,p=[];for(const b of[0,...Wi]){if(Math.abs(b)>=i.width/2-5)continue;const y=r+b;p.push({pts:[{x:n.x,y:o},{x:y,y:o},{x:y,y:c}],cost:Math.abs(b)});for(const v of[0,...Wi]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:y,y:u},{x:y,y:c}],cost:Math.abs(b)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const b of[0,...Wi]){if(Math.abs(b)>=n.width/2-5)continue;const y=a+b;p.push({pts:[{x:y,y:g},{x:y,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(b)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+ua:i.y-ua;for(const b of[0,...Wi]){if(Math.abs(b)>=i.width/2-5)continue;const y=r+b;for(const v of[0,...Wi]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:g},{x:E,y:_},{x:y,y:_},{x:y,y:m}],cost:h+Math.abs(b)+Math.abs(v)})}}return p}const Hc=30;function Pm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=ot(i.y,o.y)&&!ot(i.x,o.x),a=ot(i.x,o.x)&&!ot(i.y,o.y);if(!(!r&&!a))for(const s of t)if(r){const c=Math.min(i.x,o.x);if(Math.max(i.x,o.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Hc||Math.abs(i.y-(s.y+s.height))<Hc)return!0}else{const c=Math.min(i.y,o.y);if(Math.max(i.y,o.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Hc||Math.abs(i.x-(s.x+s.width))<Hc)return!0}}return!1}const zc=40;function wC(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-zc,a=o.x+o.width+zc,s=o.y-zc,c=o.y+o.height+zc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>r&&f.y<c&&d.y>s){i++;break}}}return i}function Tm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),o=Jn(t),r=t.edges.filter(w=>w.id!==e.id),a=di(e,r),s=hi(e,r),c=w=>wC(w,t.shapes,e.endpoints)+(Pm(w,n)?1:0),l=c(e.waypoints),u=w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.find(D=>D.type==="bpmn:Lane"&&P>=D.x&&P<=D.x+D.width&&T>=D.y&&T<=D.y+D.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=w=>{if(!d||!f)return!1;for(let P=1;P<w.length-2;P++){const T=w[P],D=w[P+1];if(ot(T.y,D.y)&&!ot(T.x,D.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),_=(w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.filter(D=>D.type==="bpmn:Participant"&&P>=D.x&&P<=D.x+D.width&&T>=D.y&&T<=D.y+D.height).sort((D,$)=>D.width*D.height-$.width*$.height)[0]})(i.get(e.endpoints[0]??"")),b=w=>{if(!_)return 0;let P=0;for(let T=1;T<w.length-1;T++){const D=w[T];(D.x<_.x||D.x>_.x+_.width||D.y<_.y||D.y>_.y+_.height)&&P++}return P},y=b(e.waypoints);if(!Pm(e.waypoints,n)&&!(d&&!h)&&y===0)return null;const v=w=>w.reduce((P,T,D)=>D?P+Math.abs(T.x-w[D-1].x)+Math.abs(T.y-w[D-1].y):0,0);let E;for(const{pts:w,cost:P}of jc(e,i)){const T={...e,waypoints:w};if(en(T,o).length>0)continue;const D=di(T,r);if(D>a)continue;const $=b(w);if($>y)continue;const N=$<y&&D===0;if(!N&&hi(T,r)>s)continue;const H=c(w),X=g(w);if(!N&&!(X&&!h)&&H>=l)continue;const ee=X?0:1,We=v(w);(!E||$<E.out||$===E.out&&(ee<E.lane||ee===E.lane&&(D<E.opp||D===E.opp&&(H<E.sc||H===E.sc&&(P<E.cost||P===E.cost&&We<E.len)))))&&(E={pts:w,out:$,sc:H,lane:ee,opp:D,cost:P,len:We})}return(E==null?void 0:E.pts)??null}function EC(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 SC(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(m=>m.id===a);if(!c||c.waypoints.length<4)continue;const l=Jn(s),u=s.edges.filter(m=>m.id!==a),p=en(c,l).length,f=di(c,u),d=hi(c,u),g=n.has(a)?new Set(pt(s).map(lt)):null,h=Nc(c,s.shapes);h.length===2&&EC(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const _={...c,waypoints:m};if(en(_,l).length>p||di(_,u)>f||hi(_,u)>d)continue;if(g){const y=new Set(pt({...s,edges:s.edges.map(w=>w.id===a?_:w)}).map(lt)),v=[...y].filter(w=>!g.has(w)).length,E=[...g].filter(w=>!y.has(w)).length;if(v>E)continue}const b=i.get(a);b&&o.updateWaypoints(b,m);break}}}function km(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=Tm(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Jp(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=ot(n[0].x,n[1].x)&&!ot(n[0].y,n[1].y),s=ot(n[n.length-1].x,n[n.length-2].x)&&!ot(n[n.length-1].y,n[n.length-2].y);for(const c of Wi){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}function RC(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,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const _ of[0,...Wi])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return m}function ef(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 f of[0,...Wi]){const d=u+f;d<=o||d>=r||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function Om(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Jn(t),o=t.edges.filter(d=>d.id!==e.id),r=di(e,o);if(r===0)return null;const a=hi(e,o);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=l?1:0},p=u(e.waypoints),f=[...jc(e,n),...ef(e,n),...Jp(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(en(h,i).length>0)continue;const m=di(h,o),_=hi(h,o),b=r-m+(p-u(d));if(m>=r||_-a>b)continue;const y=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&y<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:y})}return(s==null?void 0:s.pts)??null}function Dm(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=br(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function CC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Jn(t),o=t.edges.filter(f=>f.id!==e.id),r=Dm(e,o);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...jc(e,n),...ef(e,n),...RC(e,n),...Jp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(en(g,i).length>0)continue;const h=Dm(g,o);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const b=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&b<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:_,cost:d,length:b})}return(u==null?void 0:u.pts)??null}function Lm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=pt(Ve(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(lt(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(f=>f.id===s);if(!l)continue;const u=CC(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function Im(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 Bm(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=br(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:Im(e,n)&&Im(t,n)}function Nm(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Bm(e,o,n)&&i++;return i}function MC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Jn(t),o=t.edges.filter(f=>f.id!==e.id),r=Nm(e,o,n);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...jc(e,n),...ef(e,n),...Jp(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(en(g,i).length>0)continue;const h=Nm(g,o,n);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const b=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&b<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:_,cost:d,length:b})}return(u==null?void 0:u.pts)??null}function AC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=pt(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(lt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!Bm(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ve(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=MC(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function $m(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=pt(r).filter(u=>zp(u)&&!t.has(lt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(zp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=r.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ve(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=Om(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const PC=10,TC=(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 Fm(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ic(e,i))return null;const o=Jn(t),r=i.flatMap(bn);for(const a of bn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Lc(a,r))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([b,y])=>y>b)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+PC*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-nm}:{x:a.at+Pn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Ic({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&TC(f,d)))return f}return null}const Pn=8;function tf(e,t){const n=e.label;if(!n)return null;const i=bn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=f=>{const d=f.axis==="h"?o:r,g=f.axis==="h"?r-f.at:o-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(bn),...t.shapes.filter(f=>f.container).flatMap(sa)],l=f=>!c.some(d=>Vi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Pn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Pn,s.at-Pn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-Pn-n.height,s.at+Pn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const jm=30,kC=(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},Hm=(e,t)=>kC({x:e.x+e.width/2,y:e.y+e.height/2},t);function OC(e,t){const n=e.label;if(!n)return null;const i=bn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(bn),...t.shapes.filter(c=>c.container).flatMap(sa)],r=xr(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=>Vi(c,l))&&!os(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+Pn,c.at-Pn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Pn,c.at-Pn-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 zm(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(pt(o).map(lt));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((w,P)=>w.x-u[P].x===d&&w.y-u[P].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const w=o.edges.find(N=>N.id===c);if(!(w!=null&&w.label)||!os(w.label,o).length)continue;let P={...w.label,x:l.label.x,y:l.label.y};if((os(P,o).length||Hm(P,w.waypoints)>jm)&&(P=null),!P&&Hm(w.label,w.waypoints)>jm&&(P=OC(w,o)),!P)continue;const T=P,D={...o,edges:o.edges.map(N=>N.id===c?{...N,label:T}:N)},$=pt(D);if($.some(N=>!r.has(lt(N))))continue;i.moveElements([f],{x:T.x-f.x,y:T.y-f.y}),o=D,r=new Set($.map(lt));continue}const m=l.label.x+d-f.x,_=l.label.y+g-f.y;if(m===0&&_===0)continue;const b=o.edges.find(w=>w.id===c);if(!(b!=null&&b.label))continue;const y={...b.label,x:b.label.x+m,y:b.label.y+_},v={...o,edges:o.edges.map(w=>w.id===c?{...w,label:y}:w)},E=pt(v);E.some(w=>!r.has(lt(w)))||(i.moveElements([f],{x:m,y:_}),o=v,r=new Set(E.map(lt)))}}function Gm(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=tf(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 Vm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=pt(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(lt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=Fm(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 Wm(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(bn),...t.shapes.filter(f=>f.container).flatMap(sa)],o=i.filter(f=>Vi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=xr(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Vi(f,d))&&!r.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of o)f.axis==="h"?l.push({...n,y:f.at-Pn-n.height},{...n,y:f.at+Pn}):l.push({...n,x:f.at-Pn-n.width},{...n,x:f.at+Pn});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+Pn},{...n,x:u-n.width/2,y:e.y-Pn-n.height},{...n,x:e.x+e.width+Pn,y:p-n.height/2},{...n,x:e.x-Pn-n.width,y:p-n.height/2}),l.find(c)??null}function Um(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=Wm(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 DC(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 qm(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(pt(o).map(lt));const a=[...new Set(pt(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(lt(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,m]of u){const _=h?o.shapes.find(y=>y.id===h):void 0;if(!_)continue;const b=DC(_,l[m]);b.x===l[m].x&&b.y===l[m].y||(l[m]=b,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=pt(f);if(d.some(h=>!r.has(lt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(lt)))}}const nf=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Ym(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 LC(e,t,n){const i=[],o=n?Za(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 Ym(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(!nf(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):o.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:o}),p=!1);if(!p)continue;const f=o.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function bi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function IC(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(nf(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=Ym(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=bi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=bi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:bi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:bi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:bi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:bi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(bi(c,"text",a(l[0])));break;default:s.push(nf(l[0].map)?bi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const BC=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Km=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Xm={"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}]},as=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Gc=e=>typeof e=="string"&&e!=="";function NC(e){const t=[];function n(i,o,r,a){if(a===null){Gc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!as(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)Gc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!as(i)||!Gc(i.kind)||!(i.kind in Xm)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of Xm[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!as(f))break;f=f[g]}if(!as(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(o,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}d.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;as(c)&&!Gc(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"&&!bg(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&&!xg(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 Zm(e,t,n={}){const i=NC(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,_){if(!BC.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{..._,opIndex:h})}e.forEach((h,m)=>{var _;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(b=>b.id)});for(const b of h.participant.lanes??[])s(m,b.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const b of h.associations??[])b.id&&s(m,b.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(_=h.association)!=null&&_.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(b=>b.id));for(const b of h.lanes)t.categoryOf(b.id)===void 0&&s(m,b.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,_,b){const y=c(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:_});return}if(b&&!b.includes(y)){o.push({kind:"ref-category",opIndex:h,ref:m,role:_,expected:b.join("|"),actual:y});return}return y}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var _;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:b,lane:y}=h.node;if(b===void 0){(p||y!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,b,"participant",["participant"])===void 0)break;y!==void 0&&((((_=r.get(b))==null?void 0:_.lanes)??a.get(b)??t.lanesOf(b)).includes(y)||o.push({kind:"lane-unknown",opIndex:m,lane:y,participant:b}));break}case"sequenceFlow.add":{const{id:b,source:y,target:v,name:E,condition:w}=h.flow,P=u(m,y,"source",["flowNode"]),T=u(m,v,"target",["flowNode"]);P&&T&&l(y)!==l(v)&&o.push({kind:"flow-cross-pool",opIndex:m,id:b}),E!==void 0&&w!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:b});break}case"messageFlow.add":{const{id:b,source:y,target:v}=h.flow,E=u(m,y,"source",["flowNode","participant"]),w=u(m,v,"target",["flowNode","participant"]);if(E&&w){const P=l(y),T=l(v);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:b})}for(const P of[y,v])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:b,ref:P});break}case"dataStore.add":{for(const b of h.associations??[]){if([b.source,b.target].filter(E=>E===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:b.source,target:b.target});continue}const v=b.source===h.dataStore.id?b.target:b.source;u(m,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:b,target:y}=h.association,v=u(m,b,"source"),E=u(m,y,"target");if(v&&E){const w=new Set([v,E]);w.has("dataStore")&&w.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:b,target:y})}break}case"association.add":{const{id:b,source:y,target:v}=h.association,E=u(m,y,"source"),w=u(m,v,"target");E&&w&&E!=="annotation"&&w!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:b??`${y}->${v}`});break}case"annotation.add":{if(h.association){const{source:b,target:y}=h.association;if(b!==h.annotation.id&&y!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const v=b===h.annotation.id?y:b;u(m,v,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const b of h.group.members??[]){const y=u(m,b,"member");y&&Km.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:b,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const b=t.lanesOf(h.id),y=h.lanes.map(E=>E.id);for(const E of b)y.includes(E)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:E});for(const E of y)t.categoryOf(E)!==void 0&&!b.includes(E)&&o.push({kind:"id-duplicate",opIndex:m,id:E});const v=y.filter(E=>b.includes(E));v.length===b.length&&v.some((E,w)=>E!==b[w])&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(g(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const b=t.participantOf(h.id);(b?a.get(b)??t.lanesOf(b):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:b??""})}break}case"sequenceFlow.update":{if(g(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const b=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,y=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),E=h.source??(v==null?void 0:v.source),w=h.target??(v==null?void 0:v.target);b&&y&&E!==void 0&&w!==void 0&&new Set([l(E),l(w),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":g(m,h.id,"messageFlow");break;case"dataStore.update":g(m,h.id,"dataStore");break;case"annotation.update":{if(g(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(g(m,h.id,"group")===void 0)break;for(const b of h.members??[]){const y=u(m,b,"member");y&&Km.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:b,role:"member",expected:"shape",actual:y})}break}case"translation.confirm":g(m,h.id);break;case"element.remove":{g(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...LC(e,t,n.i18n)),o;function g(h,m,_){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const b=t.categoryOf(m);if(b===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(_&&b!==_){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:_,actual:b});return}return b}}function Qm(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 Vc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Wc={"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]},Tn=10,$C=300,FC=160,Jm=20,of=100,ey=40,jC=10,HC=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function ty(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 Uc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function qc(e,t,n,i,o){const r=n,a=ty(e,t,i),s=a??i,c=(X,Q,ee=s)=>{const[We,qe]=Wc[X];let Ge={x:t.x+t.width/2+We*(t.width/2+r.width/2+Q),y:t.y+t.height/2+qe*(t.height/2+r.height/2+Q)};const Re=ee.x+Tn+r.width/2,Z=ee.x+ee.width-Tn-r.width/2,oe=ee.y+Tn+r.height/2,W=ee.y+ee.height-Tn-r.height/2,Y={x:Math.min(Z,Math.max(Re,Ge.x)),y:Math.min(W,Math.max(oe,Ge.y))};return(Y.x!==Ge.x||Y.y!==Ge.y)&&(Ge=Math.abs(Y.x-(t.x+t.width/2))<(t.width+r.width)/2+Tn&&Math.abs(Y.y-(t.y+t.height/2))<(t.height+r.height)/2+Tn?{x:t.x+t.width+Tn+r.width/2,y:Y.y}:Y),Ge},l=(i.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="bpmn:Lane"&&X.type!=="label"&&typeof X.x=="number"&&X.id!==o.selfId),u=Ve(e),p=X=>{var ee,We;if(!o.selfId)return!1;const Q=e.get(X);return!!Q&&(((ee=Q.source)==null?void 0:ee.id)===o.selfId||((We=Q.target)==null?void 0:We.id)===o.selfId)},f=u.edges.filter(X=>!p(X.id)).flatMap(bn),d=xr(u).filter(X=>X.owner!==o.selfId).map(X=>X.rect),g=X=>({x0:X.x-r.width/2-Tn,x1:X.x+r.width/2+Tn,y0:X.y-r.height/2-Tn,y1:X.y+r.height/2+Tn}),h=X=>{const Q=g(X);return l.some(ee=>Q.x0<ee.x+ee.width&&Q.x1>ee.x&&Q.y0<ee.y+ee.height&&Q.y1>ee.y)},m=X=>{const Q=g(X);return f.some(ee=>ee.axis==="h"?ee.at>Q.y0&&ee.at<Q.y1&&ee.lo<Q.x1&&ee.hi>Q.x0:ee.at>Q.x0&&ee.at<Q.x1&&ee.lo<Q.y1&&ee.hi>Q.y0)},_=X=>{const Q=g(X);return d.some(ee=>Q.x0<ee.x+ee.width&&Q.x1>ee.x&&Q.y0<ee.y+ee.height&&Q.y1>ee.y)},b=u.shapes.filter(X=>X.type==="bpmn:Group").flatMap(X=>[{axis:"h",at:X.y,lo:X.x,hi:X.x+X.width},{axis:"h",at:X.y+X.height,lo:X.x,hi:X.x+X.width},{axis:"v",at:X.x,lo:X.y,hi:X.y+X.height},{axis:"v",at:X.x+X.width,lo:X.y,hi:X.y+X.height}]),y=X=>{const Q=g(X);return b.some(ee=>ee.axis==="h"?ee.at>Q.y0&&ee.at<Q.y1&&ee.lo<Q.x1&&ee.hi>Q.x0:ee.at>Q.x0&&ee.at<Q.x1&&ee.lo<Q.y1&&ee.hi>Q.y0)},v=X=>h(X)||m(X)||_(X)||y(X),E=X=>X.x-r.width/2>=i.x&&X.x+r.width/2<=i.x+i.width&&X.y-r.height/2>=i.y&&X.y+r.height/2<=i.y+i.height,w=X=>E(X)&&(!a||Uc(X,r,a));if(o.placement){const X=Re=>Re.startsWith("top")?Re.replace(/^top/,"bottom"):Re.replace(/^bottom/,"top"),Q=Re=>Re.endsWith("left")?Re.replace(/left$/,"right"):Re.replace(/right$/,"left"),ee=o.placement.side,We=[ee,X(ee),Q(ee),X(Q(ee)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=o.placement.offset??50;let Ge=c(ee,qe);if(v(Ge)||a&&!Uc(Ge,r,a)){const Re=(Z,oe)=>{const W=new Set;for(const Y of We){if(W.has(Y))continue;W.add(Y);const ae=c(Y,qe,Z);if(oe(ae)&&!v(ae))return Ge=ae,!0}return!1};!Re(s,w)&&a&&Re(i,E)}return Ge}const P=o.from,T=s.x+Tn+r.width/2,D=s.x+s.width-Tn-r.width/2,$=s.y+Tn+r.height/2,N=s.y+s.height-Tn-r.height/2;let H={x:Math.min(D,Math.max(T,P.x)),y:Math.min(N,Math.max($,P.y))};if(v(H)){const X=(t.width+r.width)/2+Tn,ee=[{x:H.x+X,y:H.y},{x:H.x-X,y:H.y},{x:H.x,y:H.y-r.height-Tn},{x:H.x,y:H.y+r.height+Tn}].filter(w).find(We=>!v(We));ee&&(H=ee)}return H}function tn(e,t){return e.filter(n=>n.kind===t)}class ny extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function iy(e,t){var u1,p1,f1,d1,h1,g1,m1,y1,v1,b1,x1,_1,w1,E1,S1,R1,C1,M1,A1,P1,T1,k1,O1;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=x=>r.get(x),f=x=>{const R=p(x);if(!R)throw new Error(`하강 참조 해소 실패: ${x}`);return R},d=x=>{let R=x.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},g=new Map;for(const x of r.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))g.set(x.id,{x:x.x,y:x.y});const h=tn(e,"participant.add"),m=tn(e,"node.add"),_=tn(e,"sequenceFlow.add"),b=tn(e,"messageFlow.add"),y=tn(e,"dataStore.add"),v=tn(e,"dataAssociation.add"),E=tn(e,"annotation.add"),w=tn(e,"group.add"),P=new Map(m.map(x=>[x.node.id,x])),T=(x,R,A)=>{var F;const k=x.businessObject,L=(((F=k.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==R),O=A?[...L,i.create(R,A)]:L;if(!O.length){k.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:O});O.forEach(I=>{I.$parent=j}),n.updateProperties(x,{extensionElements:j})},D=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of tn(e,"element.remove")){const R=p(x.id);R&&n.removeElements([R])}const $=x=>r.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===x}).sort((R,A)=>R.y-A.y);for(const x of tn(e,"participant.update")){const R=f(x.id);if(x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),!x.lanes)continue;const A=$(x.id);if(!A.length){n.splitLane(R,x.lanes.length),$(x.id).forEach((L,O)=>{const j=x.lanes[O];j&&n.updateProperties(L,{id:j.id,name:j.name})});continue}const k=new Set(A.map(L=>L.id));x.lanes.forEach((L,O)=>{if(k.has(L.id)){n.updateProperties(f(L.id),{name:L.name});return}const j=O===0?n.addLane($(x.id)[0],"top"):n.addLane(f(x.lanes[O-1].id),"bottom");n.updateProperties(j,{id:L.id,name:L.name})})}const N=150,H=130,X=80,Q=90,ee=180,We=30,qe=30,Ge=(x,R,A,k,L)=>{const O=A-R.width/2,j=k-R.height/2;return(x.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(L!=null&&L.has(F.id))&&typeof F.x=="number"&&O<F.x+F.width+qe&&O+R.width+qe>F.x&&j<F.y+F.height&&j+R.height>F.y)},Re=new Set;for(const x of h){Re.add(`pool:${x.participant.id}`);for(const R of x.participant.lanes??[])Re.add(R.id)}const Z=new Map;for(const x of m){const R=x.node.lane??`pool:${x.node.participant??""}`;let A=Z.get(R);A||Z.set(R,A=new Set([0])),x.band!==void 0&&A.add(x.band)}const oe=new Map;for(const[x,R]of Z){if(!Re.has(x))continue;const A=[...R].sort((O,j)=>O-j),k=A.map((O,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),L=Math.min(...k);oe.set(x,new Map(A.map((O,j)=>[O,k[j]-L])))}{const x=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,k)=>x.set(A.id,k));for(const[R,A]of oe){if(!x.has(R)||A.size<2)continue;const k=x.get(R),L=A.get(0)??0,O=new Set;for(const ne of m){if(ne.node.lane!==R||(ne.band??0)!==0||!ne.node.type.endsWith("Gateway"))continue;const he={in:new Set,out:new Set,cross:new Set};for(const fe of _){const ye=fe.flow.source===ne.node.id;if(!ye&&fe.flow.target!==ne.node.id)continue;const Ye=P.get(ye?fe.flow.target:fe.flow.source);if(!Ye||Ye.node.participant!==ne.node.participant||!Ye.node.lane)continue;let Ae,te=!1;if(Ye.node.lane!==R){const se=x.get(Ye.node.lane);if(se===void 0)continue;Ae=se>k?"down":"up",te=!0}else{const se=A.get(Ye.band??0)??L;Ae=se>L?"down":se<L?"up":void 0}Ae&&(he[ye?"out":"in"].add(Ae),te&&he.cross.add(Ae))}for(const fe of["up","down"])he.in.has(fe)&&he.out.has(fe)&&he.cross.has(fe)&&O.add(fe)}if(O.size!==1)continue;const[j]=O,F=Math.max(...A.values()),I=j==="down"?F:0;if(L===I)continue;const U=[...A.entries()].filter(([ne])=>ne!==0).sort((ne,he)=>ne[1]-he[1]),K=[...Array(F+1).keys()].filter(ne=>ne!==I),re=new Map([[0,I]]);U.forEach(([ne],he)=>re.set(ne,K[he])),oe.set(R,re)}}const W=x=>{var R;return(((R=Z.get(x))==null?void 0:R.size)??0)>1},Y=x=>x.band??(x.node.lane||!W(`pool:${x.node.participant??""}`)?void 0:0),ae=new Map,ge=x=>ae.get(x.node.id)??Y(x),Te=new Set,B=new Set;{const x=new Map;for(const k of _)x.set(k.flow.target,(x.get(k.flow.target)??0)+1);const R=k=>{const L=[],O=new Set([k]),j=[k];for(;j.length;){const F=j.shift();L.push(F);for(const I of _)I.flow.source!==F||O.has(I.flow.target)||(x.get(I.flow.target)??0)!==1||(O.add(I.flow.target),j.push(I.flow.target))}return L},A=(k,L)=>{var O;return((O=oe.get(k))==null?void 0:O.get(L))??L};for(const k of m){if(!k.node.type.endsWith("Gateway"))continue;const L=k.node.lane??`pool:${k.node.participant??""}`,O=oe.get(L);if(!O||O.size<2)continue;const j=ge(k);if(j===void 0||A(L,j)!==A(L,0))continue;const F=A(L,j),I=_.filter(fe=>fe.flow.source===k.node.id).map(fe=>P.get(fe.flow.target)).filter(fe=>!!fe&&(fe.node.lane??`pool:${fe.node.participant??""}`)===L),U=I.filter(fe=>{const ye=ge(fe);return ye!==void 0&&A(L,ye)===F&&(x.get(fe.node.id)??0)===1}),K=I.some(fe=>{const ye=ge(fe);return ye!==void 0&&A(L,ye)>F});if(U.length!==1||!K)continue;const re=new Set(I.flatMap(fe=>R(fe.node.id)));if(!_.some(fe=>fe.flow.target===k.node.id&&re.has(fe.flow.source)))continue;const he=new Map;for(const[fe,ye]of O)he.set(fe,ye+1);he.set(-1,0),oe.set(L,he);for(const fe of R(U[0].node.id))P.has(fe)&&(ae.set(fe,-1),B.add(fe));Te.add(k.node.id)}}const C=(x,R)=>{var A;return((A=oe.get(x))==null?void 0:A.get(R))??R},S=(x,R,A,k)=>{const L=x?p(x):R?p(R):void 0;if(!L)return!1;const O=x?L.y+Math.min(L.height/2,Q):L.y+X;return Math.abs(O+C(x??`pool:${R??""}`,A)*N-k)<=N/2},G=new Map;for(const[x,R]of Z){let A=0;for(const k of R)A=Math.max(A,C(x,k));G.set(x,A)}const q=x=>ee+N*x,ie=(x,R,A)=>{const k=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="label"&&L.id!==R&&typeof L.y=="number"&&L.y>=x);k.length&&n.moveElements(k,{x:0,y:A})},Me=(x,R,A)=>{const k=x.type==="bpmn:Participant"?x:void 0;if(!k||k.children.some(F=>F.type==="bpmn:Lane"))return;const L=A+R.height/2+We-k.y;if(k.height>=L)return;const O=L-k.height,j=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:L}),ie(j,k.id,O)},Xe=(x,R)=>{const A=R-x.height;if(A<=0)return;const k=d(x)??x,L=[],O=I=>{L.push(I);for(const U of I.children??[])O(U)};O(k);const j=x.y+x.height-10,F=l.calculateAdjustments(L,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(x,R,A)=>{if(x){const j=f(x),F=q(R);if(j.height>=F)return;const I=F-j.height,U=d(j),K=U?U.y+U.height:j.y+j.height;Xe(j,F),ie(K,U==null?void 0:U.id,I);return}if(!A)return;const k=N*(R+1);if(A.height>=k)return;const L=k-A.height,O=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:k}),ie(O,A.id,L)},qt=new Map;for(const x of _)qt.set(x.flow.target,(qt.get(x.flow.target)??0)+1);const Ct=x=>(qt.get(x)??0)<=1,yn=new Set(m.map(x=>x.node.id).filter(x=>tn(e,"sequenceFlow.update").filter(R=>R.target===x).length===1&&!_.some(R=>R.flow.target===x||R.flow.source===x&&P.has(R.flow.target)))),Rn=new Map,Vn=(x,R)=>{if(!x)return;const A=p(x);if(!A||A.height>=q(R))return;const k=A.y+A.height-10,L=d(A);if(L)return new Set((L.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>k).map(O=>O.id))},At=(x,R,A)=>{if(!x)return!0;const k=p(x);return k?A-R.height/2>=k.y&&A+R.height/2<=k.y+k.height:!0},Qt=h.map((x,R)=>({op:x,declared:R}));Qt.sort((x,R)=>{const A=x.op.order??Number.POSITIVE_INFINITY,k=R.op.order??Number.POSITIVE_INFINITY;return A!==k?A-k:x.declared-R.declared});let _n=80;for(const x of r.getAll())x.parent===u()&&"height"in x&&typeof x.y=="number"&&(_n=Math.max(_n,x.y+x.height+60));for(const{op:x}of Qt){const R=x.participant,A=m.filter(ne=>ne.node.participant===R.id).length,k=((u1=R.lanes)==null?void 0:u1.length)??0,L=Math.max(1200,A*160+300),O=(R.lanes??[]).map(ne=>q(G.get(ne.id)??0)),j=O.reduce((ne,he)=>ne+he,0);k&&j<300&&(O[k-1]+=300-j);const F=Math.max(300,N*((G.get(`pool:${R.id}`)??0)+1)),I=R.blackBox||A+k===0?120:k?Math.max(300,j):F,U=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:L,height:I,isExpanded:!0}),K=n.createShape(U,{x:100+L/2,y:_n+I/2},u()),re=R.lanes??[];if(re.length&&n.splitLane(K,re.length),re.length){const ne=r.filter(he=>{var fe;return he.type==="bpmn:Lane"&&((fe=d(he))==null?void 0:fe.id)===R.id}).sort((he,fe)=>he.y-fe.y);if(ne.forEach((he,fe)=>{const ye=re[fe];ye&&n.updateProperties(he,{id:ye.id,name:ye.name})}),O.some(he=>he!==K.height/k)){let he=K.y;ne.forEach((fe,ye)=>{const Ye=O[ye];n.resizeShape(fe,{x:fe.x,y:he,width:fe.width,height:Ye}),he+=Ye})}}_n=K.y+K.height+60}const Va=x=>{var k;const R=P.get(x);if(R)return R.node.participant??"";const A=p(x);return A?A.type==="bpmn:Participant"?A.id:((k=d(A))==null?void 0:k.id)??"":""},Wn=new Map,$i=x=>{let R=Wn.get(x);return R||Wn.set(x,R={nodes:[],flows:[]}),R};for(const x of m)$i(x.node.participant??"").nodes.push(x);for(const x of _)$i(Va(x.flow.source)).flows.push(x);const ci=x=>{var R;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((R=x.condition)==null?void 0:R.label)})},on=(x,R,A)=>o.createShape({type:Vc(x.type),...x.eventDefinition?{eventDefinitionType:bc[x.eventDefinition]}:{},businessObject:i.create(Vc(x.type),{id:x.id,name:x.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Fr=[...Qt.map(({op:x})=>x.participant.id).filter(x=>Wn.has(x)),...[...Wn.keys()].filter(x=>!h.some(R=>R.participant.id===x))],Wa=x=>x.endsWith("Gateway");for(const x of Fr){const R=Wn.get(x),A=x?f(x):void 0,k=A?A.x+150:250;let L=A?A.y+80:120;const O=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,Q)+C(te,se??0)*N}return se!==void 0&&A?A.y+X+C(`pool:${x}`,se)*N:le},j=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,Q)+se*N}return A?A.y+X+se*N:le},F=te=>te.participant?f(te.participant):u(),I=(te,se,le,be,Ze,Qe,Dt,Ft)=>{const xe=le!==void 0||be!==void 0,ve=Ie=>{const Ee=()=>mt(le,Ie,A);Ft?Ft(Ee):Ee()},ce=C(le??`pool:${x}`,be??0);if((be===void 0||S(le,x,be,Dt??Number.NaN))&&Dt!==void 0&&At(le,se,Dt)&&!Ge(te,se,Ze,Dt))return{x:Ze,y:Dt};if(xe)for(let Ie=0;Ie<4;Ie++){const Ee=j(le,ce+Ie,Qe);if(!Ge(te,se,Ze,Ee,Vn(le,ce+Ie)))return ve(ce+Ie),{x:Ze,y:Ee}}const _e=O(le,be,Qe);xe?ve(ce):Ft?Ft(()=>Me(te,se,se.y+se.height/2)):Me(te,se,_e);let Ne=Ze;for(let Ie=0;Ie<64;Ie++){const Ee=Ge(te,se,Ne,_e);if(!Ee)break;Ne=Ee.x+Ee.width+H+se.width/2}return{x:Ne,y:_e}},U=new Set(R.flows.map(te=>te.flow.target)),K=new Map,re=te=>{if(te===void 0)return;const se=r.get(te);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+H};for(const te of R.nodes){if(U.has(te.node.id))continue;const se=on(te.node,te.band,te.afterColumn),le=Y(te),be=te.node.lane?`${te.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",Ze=F(te.node),Qe=K.get(be)??k,Dt=re(te.afterColumn),Ft=Dt===void 0?Qe:Math.max(Qe,Dt);let xe;const ve=I(Ze,se,te.node.lane,le,Ft,L,void 0,yn.has(te.node.id)&&te.node.participant!==void 0?ce=>xe=ce:void 0);if(xe?n.createShape(se,ve,Ze,{autoResize:!1}):n.createShape(se,ve,Ze),xe){const ce=te.node.lane?f(te.node.lane):Ze;Rn.set(te.node.id,{container:ce,relCy:ve.y-ce.y,grow:xe})}K.set(be,ve.x+se.width+H),!te.node.lane&&le===void 0&&(L+=160)}const ne=new Set,he=new Map,fe=new Map,ye=new Map;if(x&&Re.has(`pool:${x}`)){const te=new Map;for(const xe of R.flows)te.set(xe.flow.target,(te.get(xe.flow.target)??0)+1);const se=xe=>O(xe.node.lane,ge(xe),Number.NaN),le=new Set,be=xe=>{var _e;const ve=(_e=P.get(xe))==null?void 0:_e.node.participant;if(ve)return p(ve);const ce=p(xe);if(ce)return ce.type==="bpmn:Participant"?ce:d(ce)},Ze=xe=>{const ve=[],ce=new Set([xe]),_e=[xe];for(;_e.length;){const Ne=_e.shift(),Ie=P.get(Ne);Ie&&ve.push(Ie);for(const Ee of R.flows)Ee.flow.source!==Ne||ce.has(Ee.flow.target)||(te.get(Ee.flow.target)??0)!==1||(ce.add(Ee.flow.target),_e.push(Ee.flow.target))}return ve},Qe=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of b){if(!ve.has(Ne.flow.source))continue;const Ie=be(Ne.flow.target);!Ie||Ie.id===A.id||(Ie.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!Wa(xe.node.type))continue;const ve=O(xe.node.lane,Y(xe),Number.NaN);if(Number.isNaN(ve))continue;const ce=[];for(const Ee of R.flows){if(Ee.flow.source!==xe.node.id)continue;const rt=P.get(Ee.flow.target);if(!rt||rt.node.lane!==xe.node.lane||(te.get(rt.node.id)??0)!==1)continue;const ft=Y(rt);if(ft===void 0)continue;const Jt=O(rt.node.lane,ft,Number.NaN);if(Number.isNaN(Jt))continue;const li=Ze(rt.node.id),nt=Qe(li);nt&&ce.push({subtree:li,band:ft,row:Jt,dir:nt})}if(!ce.some(Ee=>Ee.dir==="up")||!ce.some(Ee=>Ee.dir==="down")||!ce.some(Ee=>Ee.dir==="up"&&ce.some(rt=>rt.dir==="down"&&rt.row<Ee.row)))continue;const Ne=[...ce].sort((Ee,rt)=>Ee.row-rt.row);[...ce.filter(Ee=>Ee.dir==="up"),...ce.filter(Ee=>Ee.dir==="down")].sort((Ee,rt)=>Ee.dir===rt.dir?Ee.row-rt.row:Ee.dir==="up"?-1:1).forEach((Ee,rt)=>{const ft=Ne[rt].band;if(ft!==Ee.band){le.add(xe.node.id);for(const Jt of Ee.subtree)Y(Jt)===Ee.band&&ae.set(Jt.node.id,ft)}})}const Dt=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of b){if(!ve.has(Ne.flow.target))continue;const Ie=be(Ne.flow.source);!Ie||Ie.id===A.id||(Ie.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!Wa(xe.node.type))continue;const ve=xe.node.lane??`pool:${x}`,ce=oe.get(ve);if(!ce||ce.size<2)continue;const _e=ce.get(0);if(_e===void 0)continue;const Ne=Math.max(...ce.values()),Ie=_e===Ne&&_e!==0?"down":void 0;if(!Ie)continue;const Ee=[];for(const nt of R.flows){if(nt.flow.source!==xe.node.id)continue;const zt=P.get(nt.flow.target);if(!zt||zt.node.lane!==xe.node.lane||(te.get(zt.node.id)??0)!==1)continue;const Pe=ge(zt);Pe!==void 0&&Ee.push({t:zt,subtree:Ze(zt.node.id),band:Pe})}const rt=Ee.find(nt=>(ce.get(nt.band)??nt.band)===_e);if(!rt||Dt(rt.subtree)===Ie||Qe(rt.subtree)===Ie)continue;const ft=Ee.find(nt=>nt!==rt&&Dt(nt.subtree)===Ie);if(!ft)continue;const Jt=rt.band,li=ft.band;for(const nt of rt.subtree)ge(nt)===Jt&&ae.set(nt.node.id,li);for(const nt of ft.subtree)ge(nt)===li&&ae.set(nt.node.id,Jt);le.add(xe.node.id)}for(const xe of R.nodes){if(!Wa(xe.node.type))continue;const ve=se(xe);if(Number.isNaN(ve)||E.some(Ee=>{var rt,ft;return(((rt=Ee.placement)==null?void 0:rt.anchor)??(Ee.association?Ee.association.source===Ee.annotation.id?Ee.association.target:Ee.association.source:void 0))===xe.node.id&&((ft=Ee.placement)==null?void 0:ft.side.startsWith("bottom"))}))continue;let _e,Ne=!1,Ie;for(const Ee of R.flows){if(Ee.flow.source!==xe.node.id)continue;const rt=P.get(Ee.flow.target);if(!rt||!rt.node.lane&&Y(rt)===void 0)continue;const ft=se(rt);Number.isNaN(ft)||(Math.abs(ft-ve)<.5&&(Ne=!0),ft>ve?!_e||ft>_e.row?_e={id:rt.node.id,row:ft,count:1}:ft===_e.row&&_e.count++:ft<ve&&rt.node.lane===xe.node.lane&&(!Ie||ft>Ie.row?Ie={op:rt,row:ft,count:1}:ft===Ie.row&&Ie.count++))}_e&&_e.count===1&&(te.get(_e.id)??0)===1&&!le.has(xe.node.id)&&ne.add(_e.id),!Ne&&Ie&&Ie.count===1&&(te.get(Ie.op.node.id)??0)===1&&!Te.has(xe.node.id)&&he.set(Ie.op.node.id,{lane:xe.node.lane,band:ge(xe)})}const Ft=new Map;for(const xe of b)Ft.set(xe.flow.target,[...Ft.get(xe.flow.target)??[],xe]);for(const xe of R.nodes){const ve=Ft.get(xe.node.id);if(!ve||ve.length!==1||!te.get(xe.node.id)||!xe.node.lane&&Y(xe)===void 0||B.has(xe.node.id))continue;const ce=(p1=P.get(ve[0].flow.source))==null?void 0:p1.node.participant,_e=ce?p(ce):void 0;if(!_e||!A||_e.id===A.id)continue;const Ne=xe.node.lane??`pool:${x}`,Ie=oe.get(Ne);if(!Ie)continue;const Ee=Ie.get(0)??0,rt=(Ie.get(ge(xe)??0)??Ee)-Ee;if(rt===0)continue;const ft=_e.y<A.y;if(ft&&rt<0||!ft&&rt>0)continue;let Jt;for(const[li,nt]of Ie){const zt=nt-Ee;(ft&&zt<0&&(!Jt||zt<Jt.row)||!ft&&zt>0&&(!Jt||zt>Jt.row))&&(Jt={band:li,row:zt})}Jt&&fe.set(xe.node.id,{lane:xe.node.lane,band:Jt.band})}}const Ye=new Set;let Ae=0;for(;Ae++<R.nodes.length+2;){for(let le=0;le<R.nodes.length+R.flows.length+2;le++){let be=!1;for(const Ze of R.flows){const Qe=Ze.flow;if(Ye.has(Qe.id))continue;const Dt=p(Qe.source);if(!Dt)continue;const Ft=p(Qe.target),xe=P.get(Qe.target);if(!Ft&&xe){const ve=on(xe.node,xe.band),ce=ge(xe);if(xe.node.lane||ce!==void 0){const _e=F(xe.node),Ne=Dt,Ie=Ne.x+(ye.get(Qe.source)??0)+Ne.width+H,Ee=he.get(Qe.target)??fe.get(Qe.target),rt=I(_e,ve,Ee?Ee.lane:xe.node.lane,Ee?Ee.band:ce,ne.has(Qe.target)?Ne.x+Ne.width/2:Ie,Number.NaN,Ee||!Ct(Qe.target)?void 0:Ne.y+Ne.height/2),ft=n.createShape(ve,rt,_e);ne.has(Qe.target)&&ye.set(Qe.target,Ie-(ft.x+ft.width/2)),n.connect(Dt,ft,{type:"bpmn:SequenceFlow",businessObject:ci(Qe)})}else s.append(Dt,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:ci(Qe)}})}else if(Ft)n.connect(Dt,Ft,{type:"bpmn:SequenceFlow",businessObject:ci(Qe)});else continue;Ye.add(Qe.id),be=!0}if(!be)break}const te=R.nodes.filter(le=>!p(le.node.id));if(!te.length)break;const se=te[0];{const le=on(se.node,se.band),be=F(se.node),Ze=Y(se);n.createShape(le,I(be,le,se.node.lane,Ze,k,L),be),!se.node.lane&&Ze===void 0&&(L+=160)}}}const Cn=40,gt=x=>{const R=K=>K.kind==="label-over-line"||K.kind==="label-over-shape"||K.kind==="label-on-shared-segment"?K.edge===x.id:K.kind==="annotation-over-label"||K.kind==="pool-name-over-label"?K.label===x.id:!1,A=()=>new Set(pt(Ve(r)).filter(K=>!R(K)).map(K=>lt(K))),k=A(),L=x.waypoints.map(K=>({x:K.x,y:K.y})),O=x.label,j=O&&{x:O.x,y:O.y};n.layoutConnection(x,{waypoints:[]});const F=A(),I=[...F].filter(K=>!k.has(K)).length,U=[...k].filter(K=>!F.has(K)).length;I<=U||(n.updateWaypoints(x,L),O&&j&&(O.x!==j.x||O.y!==j.y)&&n.moveElements([O],{x:j.x-O.x,y:j.y-O.y}))},Et=5,Oi=10,NE=200,pc=new Set([..._.map(x=>x.flow.id),...b.map(x=>x.flow.id),...tn(e,"sequenceFlow.update").map(x=>x.id),...tn(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),e5=(x,R,A,k,L,O)=>{const j=new Set(x.map(te=>te.id)),F=Math.min(...x.map(te=>te.x))+R-Oi,I=Math.max(...x.map(te=>te.x+te.width))+R+NE+Oi,U=Math.min(...x.map(te=>te.y+Math.min(0,...A)))-Oi,K=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...A)))+Oi,re=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const se=te;return pc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||j.has(be.id)||be.x>=k)?!1:se.waypoints.some((be,Ze)=>{const Qe=se.waypoints[Ze+1];return!!Qe&&Math.max(be.x,Qe.x)>=F&&Math.min(be.x,Qe.x)<=I&&Math.max(be.y,Qe.y)>=U&&Math.min(be.y,Qe.y)<=K})});if(!re.length)return 0;const ne=te=>{const se=new Map;for(const le of x)for(const be of A){const Ze={id:le.id,type:le.type,x:le.x+R+te,y:le.y+be,width:le.width,height:le.height};for(const Qe of re){let Dt=1/0;for(let xe=0;xe+1<Qe.waypoints.length;xe++)Dt=Math.min(Dt,ns(Qe.waypoints[xe],Qe.waypoints[xe+1],Ze));const Ft=`${Qe.id}|${le.id}`;se.set(Ft,Math.min(se.get(Ft)??1/0,Dt))}}return se},he=[...ne(0)].filter(([,te])=>te<=Et).map(([te])=>te);if(!he.length)return 0;let fe=0;for(let te=1;te<=NE;te++){const se=ne(te);if([...se.values()].every(le=>le>Et)&&he.every(le=>(se.get(le)??1/0)>=Oi)){fe=te;break}}if(!fe)return 0;const ye=Math.min(...x.map(te=>te.x))+R+fe,Ye=new Set(he.map(te=>te.slice(0,te.indexOf("|"))));return re.some(te=>te.type==="bpmn:SequenceFlow"&&Ye.has(te.id)&&te.waypoints.some((se,le)=>{const be=te.waypoints[le+1];if(!be||Math.min(se.y,be.y)>O||Math.max(se.y,be.y)<O||se.y===be.y)return!1;const Ze=se.x+(O-se.y)*(be.x-se.x)/(be.y-se.y);return Ze>L&&Ze<ye}))?0:fe},jr=(x,R=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],L=new Set([x]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.target;if(F.flow.source!==j||L.has(I)||!P.has(I))continue;L.add(I);const U=p(I);U&&R(U)&&k.push(U)}}return k},t5=(x,R=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],L=new Set([x]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.source;if(F.flow.target!==j||L.has(I)||!P.has(I))continue;L.add(I);const U=p(I);U&&R(U)&&k.push(U)}}return k},Di=30,Fi=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",op=(x,R)=>af(n,x,R),fc=(x,R,A=!1)=>{const k=new Set(x.flatMap(I=>I.subtree.map(U=>U.id)));for(const I of x){const U=(I.pool.children??[]).filter(Fi).filter(re=>!k.has(re.id));if(I.subtree.some(re=>U.some(ne=>re.x+R<ne.x+ne.width+Di&&re.x+R+re.width+Di>ne.x&&re.y<ne.y+ne.height&&re.y+re.height>ne.y)))return null}const L=x.map(I=>I.pool.width),O=A?r.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(U=>({x:U.x,y:U.y}))})):[],j=r.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(x.flatMap(I=>I.subtree),{x:R,y:0});const F=x.map(I=>{const K=Math.max(...I.subtree.map(re=>re.x+re.width))+oy-(I.pool.x+I.pool.width);return K>0&&op(I.pool,I.pool.width+K),K});return()=>{n.moveElements(x.flatMap(I=>I.subtree),{x:-R,y:0}),x.forEach((I,U)=>{F[U]>0&&op(I.pool,L[U])});for(const{c:I,wps:U}of O){const K=I.waypoints??[];K.length===U.length&&K.every((ne,he)=>Math.abs(ne.x-U[he].x)<=.5&&Math.abs(ne.y-U[he].y)<=.5)||n.updateWaypoints(I,U.map(ne=>({x:ne.x,y:ne.y})))}for(let I=0;I<3;I++){let U=0;for(const K of j){const re=K.x-K.label.x,ne=K.y-K.label.y;Math.abs(re)<=.5&&Math.abs(ne)<=.5||(n.moveElements([K.label],{x:re,y:ne}),U++)}if(!U)break}}},lg=x=>{var L,O;const R=new Map,A=new Map;for(const j of r.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(R.set(F.id,F),A.set(F.id,[]))}for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(L=F.source)==null?void 0:L.id,U=(O=F.target)==null?void 0:O.id;I&&U&&A.has(I)&&A.get(I).push(U),I&&U&&A.has(U)&&A.get(U).push(I)}const k=[];for(const[j,F]of A)F.length&&F.every(I=>x.has(I))&&k.push(R.get(j));return k},$E=(x,R)=>{if(!x.length)return null;const A=new Set(x.map(K=>K.id)),k=r.getAll().filter(K=>K.type==="bpmn:Participant"&&!A.has(K.id)),L=Math.min(...k.filter(K=>(K.children??[]).length>0).map(K=>K.x)),O=new Set(x.filter(K=>Math.abs(K.x-L)<=2).map(K=>K.id));if(x.some(K=>{const re=O.has(K.id)?K.x:K.x+R,ne=O.has(K.id)?K.width+R:K.width;return k.some(he=>re<he.x+he.width+Di&&re+ne+Di>he.x&&K.y<he.y+he.height&&K.y+K.height>he.y)}))return null;const F=r.filter(K=>K.type==="label").map(K=>({label:K,x:K.x,y:K.y})),I=x.filter(K=>!O.has(K.id)),U=x.filter(K=>O.has(K.id)).map(K=>({pool:K,was:{x:K.x,y:K.y,width:K.width,height:K.height}}));I.length&&n.moveElements(I,{x:R,y:0});for(const{pool:K,was:re}of U)n.resizeShape(K,{...re,width:re.width+R});return()=>{for(const{pool:K,was:re}of U)n.resizeShape(K,re);I.length&&n.moveElements(I,{x:-R,y:0});for(let K=0;K<3;K++){let re=0;for(const ne of F){const he=ne.x-ne.label.x,fe=ne.y-ne.label.y;Math.abs(he)<=.5&&Math.abs(fe)<=.5||(n.moveElements([ne.label],{x:he,y:fe}),re++)}if(!re)break}}},FE=(x,R,A)=>{const k=A.x+A.width/2,L=R.y>A.y,O=L?A.y+A.height:A.y,j=L?R.y:R.y+R.height,F=x.source===R?[{x:k,y:j},{x:k,y:O}]:[{x:k,y:O},{x:k,y:j}],I=Ve(r),U={...I.edges.find(K=>K.id===x.id),waypoints:F};return en(U,Jn(I)).length?!1:(n.updateWaypoints(x,F),!0)},n5=()=>{const x=r.filter(L=>L.type==="bpmn:Participant"),R=Math.min(...x.filter(L=>(L.children??[]).length>0).map(L=>L.x)),A=L=>!!L&&L.type==="bpmn:Participant"&&!(L.children??[]).length&&Math.abs(L.x-R)<=2&&!h.some(O=>O.participant.id===L.id),k=new Set;for(const L of r.getAll()){if(L.type!=="bpmn:MessageFlow")continue;const O=L;if((O.waypoints??[]).length!==2)continue;const j=[O.source,O.target].find(I=>A(I)),F=j===O.source?O.target:O.source;j&&F&&F.type!=="bpmn:Participant"&&k.add(O.id)}return k},i5=x=>{var A;const R=new Map;for(const k of x){const L=r.get(k);if(!L||(L.waypoints??[]).length===2)continue;const O=((A=L.source)==null?void 0:A.type)==="bpmn:Participant"?L.source:L.target,j=O===L.source?L.target:L.source;if(j.x+j.width/2<=O.x+O.width)continue;const F=R.get(O.id)??{pool:O,msgs:[]};F.msgs.push({conn:L,other:j}),R.set(O.id,F)}for(const{pool:k,msgs:L}of R.values()){const O=Math.max(...L.map(({other:fe})=>fe.x+fe.width/2))+of;if(r.getAll().some(fe=>{if(fe.type!=="bpmn:Participant"||fe.id===k.id)return!1;const ye=fe;return k.x<ye.x+ye.width+Di&&O+Di>ye.x&&k.y<ye.y+ye.height&&k.y+k.height>ye.y}))continue;const F={x:k.x,y:k.y,width:k.width,height:k.height},I=[...k.incoming??[],...k.outgoing??[]],U=I.map(fe=>({c:fe,wps:(fe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),K=I.flatMap(fe=>{const ye=fe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),re=ur();n.resizeShape(k,{...F,width:O-k.x});const ne=L.filter(({conn:fe,other:ye})=>FE(fe,k,ye)).length,he=ur();if(!(ne>0&&he.messages>re.messages&&he.lines>=re.lines)){n.resizeShape(k,F);for(const{c:fe,wps:ye}of U){const Ye=fe.waypoints??[];Ye.length===ye.length&&Ye.every((te,se)=>Math.abs(te.x-ye[se].x)<=.5&&Math.abs(te.y-ye[se].y)<=.5)||n.updateWaypoints(fe,ye.map(te=>({x:te.x,y:te.y})))}for(let fe=0;fe<3;fe++){let ye=0;for(const Ye of K){const Ae=Ye.x-Ye.label.x,te=Ye.y-Ye.label.y;Math.abs(Ae)<=.5&&Math.abs(te)<=.5||(n.moveElements([Ye.label],{x:Ae,y:te}),ye++)}if(!ye)break}}}},jE=()=>{let x=0;for(const R of r.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},HE=()=>{let x=0;for(const R of r.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},o5=x=>{const R=[];for(const A of r.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const k=A;if(x.has(k.id))continue;const O=[...k.incoming??[],...k.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===k?I.target:I.source);if(!O.length||O.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const U=I,K=[U.source,U.target];return K.some(re=>!re)?[]:K.map(re=>re.id)},F=O.flatMap(I=>j(I));F.length&&F.every(I=>x.has(I))&&R.push(k)}return R},zE=()=>pt(Ve(r)).filter(x=>x.kind==="edge-crosses-shape").length,GE=x=>{const R=(x.children??[]).filter(Fi);let A=0;for(let k=0;k<R.length;k++)for(let L=k+1;L<R.length;L++){const O=R[k],j=R[L];O.x<j.x+j.width&&O.x+O.width>j.x&&O.y<j.y+j.height&&O.y+O.height>j.y&&A++}return A},ur=()=>{const x=Ve(r),R=A=>A.length>=2&&(A.every(k=>Math.abs(k.x-A[0].x)<.01)||A.every(k=>Math.abs(k.y-A[0].y)<.01));return{messages:x.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:x.edges.filter(A=>R(A.waypoints)).length}},VE=x=>{const R=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const L=k;if(!L.waypoints||L.waypoints.length!==2)continue;const O=L.source,j=L.target;if(!O||!j)continue;const F=x.has(O.id);if(F===x.has(j.id))continue;const I=F?j:O,U=d(I);if(!U||x.has(I.id))continue;const K=R.get(U.id);K?I.x<K.minX&&(K.minX=I.x):R.set(U.id,{pool:U,minX:I.x})}const A=[];for(const{pool:k,minX:L}of R.values()){const O=(k.children??[]).filter(j=>Fi(j)&&!x.has(j.id)&&j.x>=L);O.length&&A.push({subtree:O,pool:k})}return A},r5=(x,R,A)=>{const k=new Map(R.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),L=new Set(x);for(const j of R)for(const F of j.subtree)L.add(F.id);let O=!1;for(;;){let j=0;for(const F of VE(L)){if(F.pool===A)continue;const I=k.get(F.pool.id);I?I.subtree.push(...F.subtree):k.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const U of F.subtree)L.add(U.id);j+=F.subtree.length}if(!j)break;O=!0}return O?[...k.values()]:null},a5=(x,R)=>{const A=new Map;for(const L of r.getAll()){if(L.type!=="bpmn:DataInputAssociation"&&L.type!=="bpmn:DataOutputAssociation")continue;const O=L,j=O.waypoints;if(!j||j.length<2||!j.every(he=>Math.abs(he.x-j[0].x)<1))continue;const F=O.source,I=O.target;if(!F||!I)continue;const U=x.has(F.id);if(U===x.has(I.id))continue;const K=U?I:F,re=d(K);if(!re||re===R||re===d(U?F:I))continue;const ne=A.get(re.id);ne?K.x<ne.minX&&(ne.minX=K.x):A.set(re.id,{pool:re,minX:K.x})}const k=[];for(const{pool:L,minX:O}of A.values()){const j=(L.children??[]).filter(F=>Fi(F)&&!x.has(F.id)&&F.x>=O);j.length&&k.push({subtree:j,pool:L})}return k},WE=x=>{const R=Ve(r),A=R.shapes.filter(L=>x.has(L.id)),k=new Set;for(const L of R.edges)if(!(L.type!=="bpmn:SequenceFlow"&&L.type!=="bpmn:MessageFlow"))for(const O of en(L,A))k.add(`${L.id}|${O.id}`);return k},UE=new Map;for(const x of tn(e,"sequenceFlow.update")){if(x.target===void 0)continue;const R=P.get(x.target);if(!R)continue;const A=p(x.target),k=p(x.id);if(!A||!k)continue;const L=x.source!==void 0?p(x.source):k.source,O=k.target;if(!L||!O||O.id===A.id)continue;const j=k.waypoints&&k.waypoints.length>=3&&Math.abs(k.waypoints[0].x-k.waypoints[1].x)<1&&Math.abs(k.waypoints[0].y-k.waypoints[1].y)>1?{x:k.waypoints[0].x,y:k.waypoints[0].y}:void 0,F=j?k.waypoints[1].y:void 0,I=j&&k.label?{x:k.label.x,y:k.label.y}:void 0,U=I&&k.label&&Math.abs(I.y+k.label.height/2-F)<=N/5&&I.x+k.label.width>j.x?I.x+k.label.width+6:void 0,K=(L.outgoing??[]).filter(Pe=>Pe.type==="bpmn:SequenceFlow"&&Pe.id!==k.id&&Pe.target&&!pc.has(Pe.id)),re=new Set(K.map(Pe=>Pe.target.id)),ne=Pe=>{const Mt={type:"bpmn:Task",x:Pe.x+2,y:Pe.y+2,width:Pe.width-4,height:Pe.height-4};return K.find(xt=>(xt.waypoints??[]).some((Mn,_t)=>!!xt.waypoints[_t+1]&&ns(Mn,xt.waypoints[_t+1],Mt)===0))},he=jr(x.target),fe=new Set(he.map(Pe=>Pe.id)),ye=Rn.has(x.target)?{autoResize:!1}:void 0,Ye=Math.min(...he.map(Pe=>Pe.x)),Ae=Math.max(...he.map(Pe=>Pe.x+Pe.width)),te=L.x+L.width,se=O.x+O.width<=L.x,le=(()=>{if(!se)return;const Pe=d(A),Mt=((Pe==null?void 0:Pe.children)??[]).filter(et=>Fi(et)&&!fe.has(et.id)&&et.type!=="bpmn:Group"&&et.type!=="bpmn:Participant"),xt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Mn=r.getAll().filter(et=>{if(!xt.includes(et.type))return!1;const jt=et;return jt.id===k.id||pc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Bt=>!Bt||fe.has(Bt.id))}),_t=(et,jt)=>he.every(Bt=>{var Vr;const vt={id:Bt.id,type:Bt.type,x:Bt.x+et,y:Bt.y+jt,width:Bt.width,height:Bt.height};return Pe&&(vt.x<Pe.x||vt.x+vt.width>Pe.x+Pe.width||vt.y<Pe.y||vt.y+vt.height>Pe.y+Pe.height)||!At((Vr=P.get(Bt.id))==null?void 0:Vr.node.lane,Bt,Bt.y+jt+Bt.height/2)||Mt.some(Un=>vt.x<Un.x+Un.width+Oi&&vt.x+vt.width+Oi>Un.x&&vt.y<Un.y+Un.height+Oi&&vt.y+vt.height+Oi>Un.y)?!1:Mn.every(Un=>{for(let ao=0;ao+1<Un.waypoints.length;ao++)if(ns(Un.waypoints[ao],Un.waypoints[ao+1],vt)<Oi)return!1;return!0})}),ut=L.x+L.width/2,Lt=L.y+L.height/2,ke=k.waypoints??[],St=ke.length>=2&&Math.abs(ke[0].y-ke[1].y)<1&&ke[1].x<ke[0].x;return[...F!==void 0?[{cx:ut,cy:F}]:[],...St?[{cx:L.x-Cn-A.width/2,cy:ke[0].y}]:[],{cx:ut,cy:Lt+N},{cx:ut,cy:Lt-N}].find(et=>_t(et.cx-(A.x+A.width/2),et.cy-(A.y+A.height/2)))})(),be=se&&!le?te:O.x,Ze=A.y+A.height/2,Qe=e5(he,te+Cn-Ye,[0,L.y+L.height/2-Ze,O.y+O.height/2-Ze],be,te,L.y+L.height/2),Dt=te+Cn+Qe,Ft=(()=>{if(U===void 0)return 0;const Pe=te+Cn,Mt=L.y+L.height/2-A.height/2,xt={x:Pe,y:Mt,width:Ae-Ye,height:A.height},Mn=d(L);return((Mn==null?void 0:Mn.children)??[]).some(ut=>Fi(ut)&&!fe.has(ut.id)&&ut.id!==L.id&&ut.id!==O.id&&ut.type!=="bpmn:Group"&&ut.type!=="bpmn:Participant"&&ut.x<xt.x+xt.width&&ut.x+ut.width>xt.x&&ut.y<xt.y+xt.height&&ut.y+ut.height>xt.y)||ne(xt)?Math.max(0,U-Pe):0})(),xe=le?0:Ae-Ye+Cn*2+Qe+Ft-(se?0:O.x-te);let ve=[];if(xe>0){const Pe=d(A),Mt=(Pe==null?void 0:Pe.children)??[],xt=ke=>ke.type==="bpmn:Lane";ve=(()=>{const ke=new Set;for(const De of Mt)Fi(De)&&!fe.has(De.id)&&De.id!==L.id&&De.x>=be&&ke.add(De.id);const St=[];for(const De of Mt){if(De.type!=="bpmn:DataStoreReference"&&De.type!=="bpmn:DataObjectReference")continue;const et=De,Bt=[...et.incoming??[],...et.outgoing??[]].filter(vt=>vt.type==="bpmn:DataInputAssociation"||vt.type==="bpmn:DataOutputAssociation").map(vt=>vt.source===et?vt.target:vt.source);Bt.length&&Bt.every(vt=>vt!==void 0&&ke.has(vt.id))&&St.push(et)}return St})();const _t=Mt.filter(ke=>!("waypoints"in ke&&ke.waypoints)&&!xt(ke)&&ke.type!=="label"&&!fe.has(ke.id)&&ke.id!==L.id&&ke.x>=be),ut=_t.flatMap(ke=>ke.labels??[]),Lt=Pe?[Pe,...Mt.filter(ke=>xt(ke))]:[];if(_t.length){const ke=new Set(_t.map(Ke=>Ke.id)),St=VE(ke),De=St.length?r5(ke,St,Pe):null,et=Ke=>{const bt=new Set(ke);for(const It of Ke)for(const Mo of It.subtree)bt.add(Mo.id);return o5(bt)},jt=et(St),Bt=De?et(De):jt,vt=lg(ke),Vr=new Set(ke);for(const Ke of St)for(const bt of Ke.subtree)Vr.add(bt.id);const Un=St.length?lg(Vr):vt,ao=(()=>{if(!De)return[];const Ke=new Set(ke);for(const bt of De)for(const It of bt.subtree)Ke.add(It.id);return lg(Ke)})(),Ya=De??St,Wr=(()=>{const Ke=new Set(ke);for(const bt of Ya)for(const It of bt.subtree)Ke.add(It.id);return a5(Ke,Pe)})(),yg=Wr.length?et([...Ya,...Wr]):jt,ji=new Set([..._t,...Lt].map(Ke=>Ke.id)),yt=Mt.filter(Ke=>{const bt=Ke.labelTarget;return Ke.type==="label"&&!!bt&&"waypoints"in bt&&!!bt.source&&!!bt.target&&ji.has(bt.source.id)&&ji.has(bt.target.id)}),wn=n5();n.createSpace([..._t,...ut,...yt],Lt,{x:xe,y:0},"e",be-1);const Yt=(Ke,bt,It)=>{const Mo=ur(),lp=It?WE(It):null,up=fc(Ke,xe,!!It);if(!up)return!1;const gc=bt.length?$E(bt,xe):null,pp=ur(),Kt=!!It&&!!lp&&[...WE(It)].some(qr=>!lp.has(qr));return pp.messages>Mo.messages&&pp.lines>=Mo.lines&&!Kt?!0:(gc==null||gc(),up(),!1)},ui=Wr.length>0&&Yt([...Ya,...Wr],De?ao:Un,new Set(Wr.flatMap(Ke=>Ke.subtree.map(bt=>bt.id)))),Ur=!ui&&De?Yt(De,ao):!1;let so=ui||Ur;!so&&St.length&&(so=Yt(St,Un));const Ka=ui?yg:Ur?Bt:jt;if(!so){for(const Ke of St){const bt=ur(),It=fc([Ke],xe);if(!It)continue;const Mo=ur();(Mo.messages<=bt.messages||Mo.lines<bt.lines)&&It()}if(vt.length){const Ke=ur(),bt=$E(vt,xe);if(bt){const It=ur();(It.messages<=Ke.messages||It.lines<Ke.lines)&&bt()}}}if(i5(wn),Ka.length){const Ke=()=>new Set(pt(Ve(r)).map(It=>lt(It))),bt=It=>{const Mo=HE(),lp=Ke(),up=It.map(Kt=>({a:Kt,x:Kt.x,y:Kt.y})),gc=r.filter(Kt=>Kt.type==="label").map(Kt=>({label:Kt,x:Kt.x,y:Kt.y}));n.moveElements(It,{x:xe,y:0});const pp=[...Ke()].filter(Kt=>!lp.has(Kt));if(HE()<Mo&&pp.length===0)return!0;for(const{a:Kt,x:qr,y:mc}of up)(Kt.x!==qr||Kt.y!==mc)&&n.moveElements([Kt],{x:qr-Kt.x,y:mc-Kt.y});for(const Kt of gc){const qr=Kt.x-Kt.label.x,mc=Kt.y-Kt.label.y;(qr!==0||mc!==0)&&n.moveElements([Kt.label],{x:qr,y:mc})}return!1};if(!bt(Ka)&&Ka.length>1)for(const It of Ka)bt([It])}}}const ce=R.node.lane!==void 0?p(R.node.lane):R.node.participant!==void 0?p(R.node.participant):void 0,_e=Pe=>{if(!ce)return!0;const Mt=Pe.y+Pe.height/2;return Mt>=ce.y&&Mt<=ce.y+ce.height},Ne=!_e(L)&&_e(O)?O:L,Ie=Ne.y+Ne.height/2,Ee=Ie-(A.y+A.height/2),rt=R.band!==void 0,ft=rt?[A]:he,Jt=(R.band===void 0||S(R.node.lane,R.node.participant,R.band,Ie))&&Ct(x.target)&&ft.every(Pe=>{var Mt;return At((Mt=P.get(Pe.id))==null?void 0:Mt.node.lane,Pe,Pe.y+Pe.height/2+Ee)}),li=Pe=>Math.abs(Pe.y+Pe.height/2-(A.y+A.height/2))<=N/2;if(Jt&&rt){const Pe=Math.abs(Ee)<=N/2?he.filter(Mt=>Mt.id!==A.id&&li(Mt)):[];if(n.moveElements(he,{x:Dt-Ye,y:0},void 0,ye),n.moveElements([A],{x:0,y:Ee},void 0,ye),Pe.length){const Mt=()=>new Set(pt(Ve(r)).map(ke=>lt(ke))),xt=Mt(),Mn=r.filter(ke=>ke.type==="label").map(ke=>({label:ke,x:ke.x,y:ke.y}));n.moveElements(Pe,{x:0,y:Ee});const _t=Mt(),ut=[..._t].filter(ke=>!xt.has(ke)).length,Lt=[...xt].filter(ke=>!_t.has(ke)).length;if(ut>Lt){n.moveElements(Pe,{x:0,y:-Ee});for(const ke of Mn){const St=ke.x-ke.label.x,De=ke.y-ke.label.y;(St!==0||De!==0)&&n.moveElements([ke.label],{x:St,y:De})}}}}else n.moveElements(he,{x:Dt-Ye,y:Jt?Ee:0},void 0,ye);const nt=d(A);if(!Jt&&R.node.lane===void 0&&R.band!==void 0&&nt){const Pe=nt.y+X+C(`pool:${R.node.participant??""}`,R.band)*N,Mt=Pe-(A.y+A.height/2);Mt!==0&&!Ge(nt,A,A.x+A.width/2,Pe,fe)&&n.moveElements([A],{x:0,y:Mt},void 0,ye)}if(le)n.moveElements(he,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(nt){const Pe=(nt.children??[]).filter(_t=>Fi(_t)&&!fe.has(_t.id)&&_t.type!=="bpmn:Group"&&_t.type!=="bpmn:Participant"),Mt=(_t,ut,Lt,ke,St)=>_t.x+ut<St.x+St.width+ke&&_t.x+ut+_t.width+ke>St.x&&_t.y+Lt<St.y+St.height+ke&&_t.y+Lt+_t.height+ke>St.y,xt=Pe.find(_t=>Mt(A,0,0,0,_t)),Mn=xt?void 0:ne(A);if(xt||Mn){const _t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],ut=r.getAll().filter(yt=>{if(!_t.includes(yt.type))return!1;const wn=yt;return pc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(Yt=>!Yt||fe.has(Yt.id))}),Lt=(yt,wn,Yt)=>{var ui;return At((ui=P.get(yt.id))==null?void 0:ui.node.lane,yt,yt.y+Yt+yt.height/2)&&yt.x+wn>=nt.x&&yt.x+wn+yt.width<=nt.x+nt.width&&yt.y+Yt>=nt.y&&yt.y+Yt+yt.height<=nt.y+nt.height},ke=(yt,wn)=>he.every(Yt=>Lt(Yt,yt,wn)&&!Pe.some(ui=>Mt(Yt,yt,wn,Oi,ui))&&ut.every(ui=>{const Ur={id:Yt.id,type:Yt.type,x:Yt.x+yt,y:Yt.y+wn,width:Yt.width,height:Yt.height};for(let so=0;so+1<ui.waypoints.length;so++)if(ns(ui.waypoints[so],ui.waypoints[so+1],Ur)<Oi)return!1;return!0})),St=A.y+A.height/2,De=[F,O.y+O.height/2].filter(yt=>yt!==void 0&&Math.abs(yt-St)>=1),et=xt&&re.has(xt.id)?xt:Mn==null?void 0:Mn.target,jt=et?et.x-A.x:0,Bt=Math.max(...he.map(yt=>yt.x+yt.width)),vt=[...jt!==0?[jt]:[],...Qe!==0?[-Qe]:[],0],Vr=U===void 0?[]:vt.map(yt=>Math.max(yt,U-A.x)),Un=yt=>Bt+yt+Cn<=O.x,ao=[...new Set([...Vr,...vt])].filter(Un),Ya=xt&&re.has(xt.id)?[xt.x+xt.width+Cn-A.x]:[],Wr=U===void 0?[]:Ya.map(yt=>Math.max(yt,U-A.x)),yg=[...new Set([...Wr,...Ya])].filter(yt=>Un(yt)&&!ao.includes(yt));let ji;for(const yt of[ao,yg]){for(const wn of De){for(const Yt of yt)if(ke(Yt,wn-St)){ji={dx:Yt,dy:wn-St};break}if(ji)break}if(ji)break}if(ji){const yt=Ke=>{const bt=Ke;return[bt.edge,bt.other,...Array.isArray(bt.edges)?bt.edges:[]].some(It=>typeof It=="string"&&pc.has(It))},wn=()=>new Set(pt(Ve(r)).filter(Ke=>!yt(Ke)).map(Ke=>lt(Ke))),Yt=wn(),ui=r.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y}));n.moveElements(he,{x:ji.dx,y:ji.dy},void 0,ye);const Ur=wn(),so=[...Ur].filter(Ke=>!Yt.has(Ke)).length,Ka=[...Yt].filter(Ke=>!Ur.has(Ke)).length;if(so>Ka){n.moveElements(he,{x:-ji.dx,y:-ji.dy},void 0,ye);for(const Ke of ui){const bt=Ke.x-Ke.label.x,It=Ke.y-Ke.label.y;(bt!==0||It!==0)&&n.moveElements([Ke.label],{x:bt,y:It})}}else j&&UE.set(k.id,{exit:j,channelY:F,label:I})}}}{const Pe=new Set(he.map(ut=>ut.id)),Mt=new Set(_.map(ut=>ut.flow.id)),xt=20,Mn=ut=>{const Lt=ut.source,ke=ut.target,St=Math.min(Lt.x,ke.x)-xt,De=Math.max(Lt.x+Lt.width,ke.x+ke.width)+xt,et=Math.min(Lt.y,ke.y)-xt,jt=Math.max(Lt.y+Lt.height,ke.y+ke.height)+xt;return ut.waypoints.some(Bt=>Bt.x<St||Bt.x>De||Bt.y<et||Bt.y>jt)},_t=new Map;for(const ut of he)for(const Lt of[...ut.incoming??[],...ut.outgoing??[]])Lt.id!==x.id&&Mt.has(Lt.id)&&!(Pe.has(Lt.source.id)&&Pe.has(Lt.target.id))&&_t.set(Lt.id,Lt);for(const ut of _t.values())Mn(ut)&&gt(ut)}const zt=ve.length?d(ve[0]):void 0;if(zt){const Pe={assoc:jE(),overlaps:GE(zt),crosses:zE()},Mt=ve.map(De=>({st:De,x:De.x})),xt=r.filter(De=>De.type==="label").map(De=>({label:De,x:De.x,y:De.y})),Mn=Math.min(...ve.flatMap(De=>[...De.incoming??[],...De.outgoing??[]].filter(et=>et.type==="bpmn:DataInputAssociation"||et.type==="bpmn:DataOutputAssociation").map(et=>(et.source===De?et.target:et.source).x))),_t=new Set(ve.map(De=>De.id)),ut=(zt.children??[]).filter(Fi).filter(De=>!_t.has(De.id));let Lt=Mn;for(const De of[...ve].sort((et,jt)=>et.x-jt.x)){let et=Lt;for(let jt=0;jt<100;jt++){const Bt=ut.find(vt=>et<vt.x+vt.width+Di&&et+De.width+Di>vt.x&&De.y<vt.y+vt.height&&De.y+De.height>vt.y);if(!Bt)break;et=Bt.x+Bt.width+Di}et!==De.x&&n.moveElements([De],{x:et-De.x,y:0}),Lt=et+De.width+Di}const ke=Lt+150-(zt.x+zt.width);ke>0&&op(zt,zt.width+ke);const St={assoc:jE(),overlaps:GE(zt),crosses:zE()};if(St.assoc>=Pe.assoc||St.overlaps>Pe.overlaps||St.crosses>Pe.crosses){for(const{st:De,x:et}of Mt)De.x!==et&&n.moveElements([De],{x:et-De.x,y:0});ke>0&&op(zt,zt.width-ke);for(const De of xt){const et=De.x-De.label.x,jt=De.y-De.label.y;(et!==0||jt!==0)&&n.moveElements([De.label],{x:et,y:jt})}}}}for(const[x,R]of Rn){const A=p(x);if(!A)continue;const k=R.container,L=Math.abs(A.y+A.height/2-k.y-R.relCy)>=.5,O=A.label,j=Math.min(A.y,O&&!O.hidden?O.y:A.y),F=Math.max(A.y+A.height,O&&!O.hidden?O.y+O.height:0);if(L&&j>=k.y&&F<=k.y+k.height)continue;const I=A.y;R.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const qE=(x,R)=>{const A=R.target===x,k=f(R.source),L=f(R.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,L,R.id?{type:O,businessObject:i.create(O,{id:R.id})}:{type:O})},YE=x=>{for(const R of h){if(!R.participant.blackBox)continue;const A=p(R.participant.id);if(!A)continue;const k=[];for(const O of b){const j=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&k.push(F)}if(!k.length)continue;if(!x&&R.order===void 0){const O=(()=>{var F;const j=new Map;for(const I of k){const U=d(I);if(!U)continue;const K=j.get(U.id);K?K.n+=1:j.set(U.id,{shape:U,n:1})}return(F=[...j.values()].sort((I,U)=>U.n-I.n)[0])==null?void 0:F.shape})();if(O){const j=U=>U.reduce((K,re)=>K+re,0)/U.length,F=j(k.map(U=>U.y+U.height/2))<O.y+O.height/2,I=r.filter(U=>U.type==="bpmn:Participant"&&U.id!==R.participant.id&&U.id!==O.id).filter(U=>F?U.y+U.height<=O.y+5:U.y>=O.y+O.height-5);if(I.length){const U=[...I.reduce((le,be)=>le.set(be.y,(le.get(be.y)??0)+1),new Map)].sort((le,be)=>be[1]-le[1]||(F?be[0]-le[0]:le[0]-be[0]))[0][0],K=Math.min(A.width,$C),re=FC,ne=k.map(le=>le.x+le.width/2),he=Math.round(j(ne)-K/2),fe=Math.max(...ne)+of,ye=le=>({x:le,width:Math.max(K,fe-le)}),Ye=I.filter(le=>Math.min(le.y+le.height,U+re)-Math.max(le.y,U)>0),Ae=le=>{const be=ye(le);return Ye.some(Ze=>Ze.x<be.x+be.width&&be.x<Ze.x+Ze.width)},te=le=>{const be=ye(le);return ne.filter(Ze=>Ze>=be.x+10&&Ze<=be.x+be.width-10).length},se=(()=>{if(!Ae(he))return he;const le=te(he);return Ye.flatMap(be=>[be.x+be.width+Jm,be.x-Jm-K]).map(be=>Math.round(be)).filter(be=>!Ae(be)&&te(be)>=le).sort((be,Ze)=>Math.abs(be-he)-Math.abs(Ze-he))[0]??he})();if(se!==A.x||U!==A.y||K!==A.width||re!==A.height){const le=()=>new Set(pt(Ve(r)).map(xe=>lt(xe))),be=le(),Ze={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:se,y:U,width:K,height:re});const Qe=le(),Dt=[...Qe].filter(xe=>!be.has(xe)).length,Ft=[...be].filter(xe=>!Qe.has(xe)).length;Dt>Ft&&n.resizeShape(A,Ze)}}}}const L=Math.max(...k.map(O=>O.x+O.width/2))+of;if(L>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:L-A.x,height:A.height}),!!x)for(const O of b){const j=p(O.flow.id),F=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const U=I.x+I.width/2;U<A.x+10||U>A.x+A.width-10||FE(j,A,I)}}};YE(!1);for(const x of b){const R=x.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([..._.map(I=>I.flow.id),...b.map(I=>I.flow.id)].filter(I=>!!I)),k=r.filter(I=>!!I.waypoints),L=(I,U)=>Math.abs(U.x-I.x)<2?"L":Math.abs(U.x-(I.x+I.width))<2?"R":Math.abs(U.y-I.y)<2?"T":Math.abs(U.y-(I.y+I.height))<2?"B":void 0,O=new Map,j=(I,U,K)=>{if(!I||!U||typeof I.x!="number")return;const re=L(I,U);if(!re)return;let ne=O.get(I.id);ne||O.set(I.id,ne=new Map),ne.set(re,[...ne.get(re)??[],K])};for(const I of k){const U=I.waypoints;!U||U.length<2||(j(I.source,U[0],{id:I.id,dir:"out"}),j(I.target,U[U.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,U]of O){const K=p(I);if(!K||typeof K.x!="number"||![...U.values()].some(Ae=>{const te=Ae.filter(se=>se.dir==="in");return Ae.length>=3&&te.length>=1&&Ae.some(se=>se.dir==="out")&&te.some(se=>A.has(se.id))}))continue;const ne=d(K);if(!ne||F.has(ne.id)||(ne.children??[]).some(Ae=>Ae.type==="bpmn:Lane"))continue;const he=(f1=U.get("T"))!=null&&f1.length?(d1=U.get("B"))!=null&&d1.length?void 0:"B":"T";if(!he||(he==="T"?K.y-ne.y:ne.y+ne.height-(K.y+K.height))>=N)continue;const ye=(ne.children??[]).filter(Ae=>!("waypoints"in Ae&&Ae.waypoints)&&Ae.type!=="label"&&typeof Ae.x=="number"),Ye=ne.y+ne.height;n.resizeShape(ne,{x:ne.x,y:ne.y,width:ne.width,height:ne.height+N}),ie(Ye,ne.id,N),he==="T"&&ye.length&&n.moveElements(ye,{x:0,y:N}),F.add(ne.id)}}const ug=20,KE=4,s5=3,c5=2,l5=[10,30,80],pr=()=>{const x=Ve(r);return{bad:pt(x).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:cm(x),straight:x.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Ua=x=>{const R=Ve(r),A=R.edges.find(k=>k.id===x);return A?en(A,Jn(R)).length:0},rp=x=>Ua(x)>0,ap=x=>Ve(r).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==x&&R.waypoints.length===2).length,u5=(x,R,A)=>fc([{subtree:x,pool:R}],A),XE=(x,R)=>R.bad>x.bad||R.crossings>x.crossings&&R.straight<=x.straight&&R.bad>=x.bad,qa=(x,R)=>XE(x,R)||R.straight<x.straight,Hr=(x,R,A=()=>!0,k=XE,L=!1)=>{const O=pr(),j=fc(x,R,L);if(!j)return!1;const F=pr();return k(O,F)||!A()?(j(),!1):!0},p5=(x,R,A,k=()=>!0)=>Hr([{subtree:x,pool:R}],A,k),zr=x=>{var R;return!!((R=P.get(x))!=null&&R.node.participant)},dc=new Map;for(const x of b){if(!zr(x.flow.target))continue;const R=dc.get(x.flow.target)??[];R.push(x),dc.set(x.flow.target,R)}const sp=[...dc.keys()],pg=new Set(_.map(x=>x.flow.target)),ZE=x=>Qt.findIndex(({op:R})=>R.participant.id===x);sp.sort((x,R)=>{var L,O;const A=pg.has(x)?1:0,k=pg.has(R)?1:0;return A!==k?A-k:ZE((L=P.get(x))==null?void 0:L.node.participant)-ZE((O=P.get(R))==null?void 0:O.node.participant)});const fr=x=>x.x+x.width/2,f5=x=>{const R=new Map;for(const L of r.getAll()){const O=L;if(!O.waypoints||!O.source||!O.target)continue;(R.get(O.source.id)??R.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([x]),k=[x];for(let L=0;L<k.length;L++)for(const O of R.get(k[L])??[])A.has(O)||(A.add(O),k.push(O));return A},d5=(x,R)=>{const A=f5(R);let k;for(const L of r.getAll()){const O=L;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==x||A.has(O.source.id))continue;const j=O.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=fr(j);(k===void 0||F>k)&&(k=F)}return k},fg=(x,R)=>{const A=p(x.flow.source);if(A)return A.type==="bpmn:Participant"?d5(A.id,R):fr(A)},QE=x=>{let R;for(const A of dc.get(x)??[]){const k=fg(A,x);k!==void 0&&(!R||k>R.cx)&&(R={op:A,cx:k})}return R==null?void 0:R.op},h5=x=>{const R=QE(x),A=p(x),k=R?fg(R,x):void 0;return A&&k!==void 0?k-fr(A):void 0},g5=x=>{const R=h5(x);return R!==void 0&&Math.abs(R)<ug},dg=(x,R,A,k,L)=>{var O;for(let j=!0;j;){j=!1;for(const F of b){if(F.flow.id===A)continue;const I=R.has(F.flow.source),U=R.has(F.flow.target);if(I===U||k(I?F.flow.source:F.flow.target))continue;const K=I?F.flow.target:F.flow.source;if(L(K)||!zr(K))continue;const re=p(F.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const ne=p(K),he=(O=P.get(K))==null?void 0:O.node.participant;if(!ne||!he)continue;const fe=jr(K,ye=>ye.x>=ne.x).filter(ye=>!R.has(ye.id));if(!(!fe.length||fe.some(ye=>L(ye.id)))){for(const ye of fe)R.add(ye.id);x.set(he,[...x.get(he)??[],...fe]),j=!0}}}return[...x].map(([j,F])=>({subtree:F,pool:f(j)}))},JE=(x,R,A,k,L)=>dg(new Map([[R,[...x]]]),new Set(x.map(O=>O.id)),k,O=>O===A,O=>O===L),hg=x=>{const R=QE(x);if(!R)return null;const A=p(x),k=p(R.flow.source),L=fg(R,x);if(!A||!k||L===void 0)return null;const O=L-fr(A);if(O>=ug){const j=P.get(x).node.participant,F=jr(x,I=>I.x>=A.x);return{groups:JE(F,j,x,R.flow.id,R.flow.source),dx:O}}if(-O>=ug&&zr(R.flow.source)){const j=P.get(R.flow.source).node.participant,F=jr(R.flow.source,I=>I.x>=k.x&&!g5(I.id));return{groups:JE(F,j,R.flow.source,R.flow.id,x),dx:-O}}return null},e1=()=>sp.map(x=>({id:x,plan:hg(x)})).filter(x=>!!x.plan).sort((x,R)=>Math.min(...x.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))).map(x=>x.id);for(let x=0;x<3;x++){const R=pr(),A=[];for(const L of e1()){const O=hg(L);if(!O)continue;const j=fc(O.groups,O.dx);j&&A.push(j)}if(!A.length)break;if(!qa(R,pr()))continue;for(const L of A.reverse())L();let k=!1;for(const L of e1()){const O=hg(L);O&&Hr(O.groups,O.dx,()=>!0,qa)&&(k=!0)}if(!k)break}for(const x of sp){if(pg.has(x))continue;const R=P.get(x);if(!R||R.node.lane!==void 0)continue;const A=Y(R);if(A===void 0)continue;const k=p(x),L=k?d(k):void 0;if(!k||!L)continue;const O=L.y+X+C(`pool:${R.node.participant??""}`,A)*N,j=O-(k.y+k.height/2);j!==0&&!Ge(L,k,k.x+k.width/2,O)&&n.moveElements([k],{x:0,y:j})}const t1=new Set;for(let x=0,R=!0;R&&x<s5;x++){R=!1;for(const A of sp.flatMap(k=>dc.get(k)??[])){if(t1.has(A.flow.id)||!rp(A.flow.id))continue;const k=p(A.flow.target);if(!k)continue;const L=f(P.get(A.flow.target).node.participant),O=jr(A.flow.target,U=>U.x>=k.x),j=k.width+H,F=Ua(A.flow.id),I=ap(A.flow.id);for(let U=1;U<=KE;U++){const K=()=>Ua(A.flow.id)<F&&ap(A.flow.id)>=I;if(p5(O,L,j*U,K)){t1.add(A.flow.id),R=!0;break}}}}const gg=b.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),n1=new Set(gg.map(x=>x.id));for(const x of r.filter(R=>R.type==="bpmn:MessageFlow"))n1.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&gg.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of gg){if(!rp(x.id))continue;const R=p(x.source),A=p(x.target);if(!R||!A)continue;let k,L,O;if(x.preexisting){const[F,I]=R.type==="bpmn:Participant"?[A,R]:[R,A];if(k=fr(F),k<I.x||k>I.x+I.width)continue;[L,O]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.y]}else{if(R.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(k=R.x+R.width/2,Math.abs(k-(A.x+A.width/2))>15))continue;[L,O]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==R.id&&F.id!==A.id).filter(F=>F.x<=k&&k<=F.x+F.width&&F.y+F.height>L&&F.y<O).sort((F,I)=>F.x-I.x);for(const F of j){const I=(h1=P.get(F.id))==null?void 0:h1.node.participant,U=I?p(I):void 0;if(!I||!U)continue;const K=[...P.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),re=se=>se.map(le=>p(le)).filter(le=>!!le),he=[t5(F.id,se=>{var le;return((le=P.get(se.id))==null?void 0:le.node.participant)===I}),re(K)].filter(se=>se.length).map(se=>[{subtree:se,pool:U}]);if(x.preexisting){const se=re(K);se.length&&he.push(dg(new Map([[I,[...se]]]),new Set(se.map(le=>le.id)),x.id,()=>!1,le=>le===R.id||le===A.id))}const fe=F.width+H,ye=Ua(x.id),Ye=ap(x.id),Ae=()=>Ua(x.id)<ye&&ap(x.id)>=Ye;let te=!1;for(const se of he){for(let le=1;le<=KE;le++)if(Hr(se,fe*le,Ae)){te=!0;break}if(te)break}if(!rp(x.id))break}}const cp=()=>{var R;const x=new Set;for(const A of pt(Ve(r)))A.kind!=="edge-crosses-shape"||n1.has(A.edge)||((R=p(A.edge))==null?void 0:R.type)==="bpmn:MessageFlow"&&x.add(`${A.edge}>${A.shape}`);return x},m5=(x,R)=>pr().bad>=x&&[...cp()].some(A=>!R.has(A)),i1=x=>{var R,A;return Ua(x)===0&&((A=(R=p(x))==null?void 0:R.waypoints)==null?void 0:A.length)===2},y5=(x,R,A)=>{const k=new Set(x.flatMap(O=>O.subtree.map(j=>j.id))),L=[...cp()].filter(O=>!A.has(O)).map(O=>O.split(">")[1]);return[...new Set(L)].filter(O=>k.has(O)&&O!==R.source&&O!==R.target)},v5=(x,R,A,k,L)=>{const O=x.map(U=>({...U,subtree:U.subtree.filter(K=>!L.includes(K.id))})).filter(U=>U.subtree.length),j=new Set(O.flatMap(U=>U.subtree.map(K=>K.id))),F=()=>L.every(U=>{const K=p(U);return!!K&&_.filter(re=>re.flow.target===U&&j.has(re.flow.source)).every(re=>{const ne=p(re.flow.source);return!!ne&&ne.x+ne.width<=K.x})});return Hr(O,R,()=>i1(A.id)&&[...cp()].every(U=>k.has(U))&&F(),qa,!0)};for(const x of b){if(!rp(x.flow.id))continue;const R=p(x.flow.id);if(((g1=R==null?void 0:R.waypoints)==null?void 0:g1.length)!==2)continue;const A=p(x.flow.source),k=p(x.flow.target);if(!A||!k||A.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!zr(x.flow.source)||!zr(x.flow.target)||Math.abs(fr(A)-fr(k))>c5)continue;const L=fr(A),O=R.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...O),Math.max(...O)],I=Jn(Ve(r)).filter(ye=>ye.id!==A.id&&ye.id!==k.id&&ye.x<L&&L<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const U=(m1=P.get(x.flow.source))==null?void 0:m1.node.participant,K=(y1=P.get(x.flow.target))==null?void 0:y1.node.participant;if(!U||!K)continue;const re=new Map;for(const[ye,Ye,Ae]of[[x.flow.source,A,U],[x.flow.target,k,K]]){const te=re.get(Ae)??[],se=jr(ye,le=>le.x>=Ye.x).filter(le=>!te.some(be=>be.id===le.id));re.set(Ae,[...te,...se])}const ne=new Set([...re.values()].flat().map(ye=>ye.id)),he=dg(re,ne,x.flow.id,ye=>ye===x.flow.source||ye===x.flow.target,()=>!1),fe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of l5){const Ye=fe+ye-L;if(Ye<=0)continue;const Ae=pr().bad,te=cp();let se=[],le=!0;const be=()=>!i1(x.flow.id)||le&&(se=y5(he,x.flow,te),se.length)?!1:!m5(Ae,te);if(Hr(he,Ye,be,qa))break;if(se.length&&(v5(he,Ye,x.flow,te,se)||(le=!1,Hr(he,Ye,be,qa))))break}}{const x=A=>A.y+A.height/2,R=[];for(const A of P.keys()){if(!zr(A))continue;const k=_.filter(j=>j.flow.target===A);if(k.length!==1)continue;const L=p(k[0].flow.source),O=p(A);!L||!O||!P.has(L.id)||Math.abs(x(L)-x(O))>1||O.x-(L.x+L.width)<=H+1||R.push({id:A,pred:L,node:O})}R.sort((A,k)=>A.node.x-k.node.x);for(const{id:A}of R){const k=P.get(A),L=p(A),O=p(_.find(ne=>ne.flow.target===A).flow.source);if(!L||!O)continue;const j=L.x-(O.x+O.width);if(j<=H+1)continue;const F=f(k.node.participant),I=jr(A,ne=>ne.x>=L.x),U=pr(),K=u5(I,F,-(j-H));if(!K)continue;const re=pr();(re.bad>U.bad||re.crossings>=U.crossings||re.straight<U.straight)&&K()}}YE(!0);const b5=10,x5=400,_5=x=>[...x.incoming??[],...x.outgoing??[]].filter(R=>R.type==="bpmn:DataInputAssociation"||R.type==="bpmn:DataOutputAssociation").map(R=>R.source===x?R.target:R.source).filter(R=>!!R&&typeof R.y=="number"),w5=r.filter(x=>x.type==="bpmn:DataStoreReference"&&g.has(x.id)),E5=(x,R)=>{const A=x.x+x.width/2,k=x.y+x.height/2;let L;for(const O of w5){if((d(O)??u())!==R||O.y<x.y+x.height)continue;const j=Math.abs(O.x+O.width/2-A);j>x5||j<O.width||!_5(O).some(I=>I.height===x.height&&Math.abs(I.y+I.height/2-k)<=b5&&O.y>=I.y+I.height)||(!L||j<L.dx||j===L.dx&&O.id<L.id)&&(L={dx:j,id:O.id,cy:O.y+O.height/2})}return L==null?void 0:L.cy};for(const x of y){const R=x.associations??[],A=R.map(O=>O.source===x.dataStore.id?O.target:O.source).map(p).find(Boolean),k=A?d(A)??u():u(),L=A?{x:A.x+A.width/2,y:E5(A,k)??A.y+A.height+110}:{x:200,y:_n+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},L,k);for(const O of R)qE(x.dataStore.id,O)}for(const x of v){const A=f(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;qE(A,x.association)}let o1=0;const Gr=10,r1=40,S5=(x,R)=>{const A=R.map(I=>d(I)).filter(I=>!!I);for(const I of A){const U=Gr,K=I.y,re=I.y+I.height,ne=I.x,he=I.x+I.width;if(Math.abs(x.y-K)<U){const fe=K+U-x.y;x.y+=fe,x.height-=fe}if(Math.abs(x.y+x.height-re)<U&&(x.height=re-U-x.y),Math.abs(x.x-ne)<U){const fe=ne+U-x.x;x.x+=fe,x.width-=fe}Math.abs(x.x+x.width-he)<U&&(x.width=he-U-x.x)}if(!A.length)return;const k=Math.min(...A.map(I=>I.y)),L=Math.max(...A.map(I=>I.y+I.height)),O=k-x.y,j=x.y+x.height-L,F=r1-Gr;if(O>0!=j>0)if(O>0&&O<F){const I=O+Gr;x.y+=I,x.height-=I}else j>0&&j<F&&(x.height-=j+Gr)},R5=(x,R)=>{const A=Gr,k=30,L=r.filter(O=>O.type==="bpmn:Group"&&O.id!==R);for(const O of L){const j=O.x,F=O.x+O.width,I=O.y,U=O.y+O.height,K=x.y<U&&I<x.y+x.height,re=x.x<F&&j<x.x+x.width;if(K){if(Math.abs(x.x-F)<A){const ne=Math.min(F+A-x.x,k);ne>0&&x.width-ne>0&&(x.x+=ne,x.width-=ne)}if(Math.abs(x.x+x.width-j)<A){const ne=Math.min(x.x+x.width-(j-A),k);ne>0&&x.width-ne>0&&(x.width-=ne)}}if(re){if(Math.abs(x.y-U)<A){const ne=Math.min(U+A-x.y,k);ne>0&&x.height-ne>0&&(x.y+=ne,x.height-=ne)}if(Math.abs(x.y+x.height-I)<A){const ne=Math.min(x.y+x.height-(I-A),k);ne>0&&x.height-ne>0&&(x.height-=ne)}}}},mg=(x,R)=>{const A=r1,k=Math.min(...x.map(I=>I.x))-A,L=Math.min(...x.map(I=>I.y))-A,O=Math.max(...x.map(I=>I.x+I.width))+A,j=Math.max(...x.map(I=>I.y+I.height))+A,F={x:k,y:L,width:O-k,height:j-L};return S5(F,x),R5(F,R),F};for(const x of w){const R=(x.group.members??[]).map(p).filter(L=>!!L);let A;R.length?A=mg(R,x.group.id):(A={x:300+o1*350,y:40,width:300,height:200},o1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());x.group.name&&n.updateLabel(k,x.group.name),(v1=x.group.members)!=null&&v1.length&&T(k,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(L=>!!L.waypoints),R=new Map,A=(L,O)=>{!L||!O||(R.has(L)||R.set(L,new Set),R.get(L).add(O))};for(const L of x){const O=(b1=L.source)==null?void 0:b1.id,j=(x1=L.target)==null?void 0:x1.id;A(O,j),((_1=L.type)!=null&&_1.includes("DataOutputAssociation")||(w1=L.type)!=null&&w1.includes("DataInputAssociation")||L.type==="bpmn:Association")&&A(j,O)}const k=r.filter(L=>L.type==="bpmn:Group");for(const L of k){const j=(((E1=L.businessObject.extensionElements)==null?void 0:E1.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),U=[...F];for(;U.length;){const Ae=U.shift();for(const te of R.get(Ae)??[])I.has(te)||(I.add(te),U.push(te))}const K=L.x,re=L.x+L.width,ne=L.y,he=L.y+L.height,fe=Ae=>_.filter(te=>te.flow.target===Ae).length,ye=Ae=>{var se;const te=((se=p(Ae))==null?void 0:se.type)??"";if(te==="bpmn:StartEvent"&&fe(Ae)===0)return!1;if(te.endsWith("Gateway")){const le=_.filter(be=>be.flow.target===Ae).map(be=>be.flow.source);if(le.length&&le.every(be=>{var Ze;return((Ze=p(be))==null?void 0:Ze.type)==="bpmn:StartEvent"&&fe(be)===0}))return!1}return!0},Ye=r.filter(Ae=>Fi(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!I.has(Ae.id)&&zr(Ae.id)&&ye(Ae.id)&&Ae.x<re&&Ae.x+Ae.width>K&&Ae.y<he&&Ae.y+Ae.height>ne);if(Ye.length)for(const Ae of[-1,1]){const te=Ye.filter(ve=>(ve.x+ve.width-K<=re-ve.x?-1:1)===Ae);if(!te.length)continue;const se=[];for(const ve of te){const ce=se.find(_e=>_e.some(Ne=>ve.y<Ne.y+Ne.height&&ve.y+ve.height>Ne.y));ce?ce.push(ve):se.push([ve])}const le=new Map;for(const ve of se){let ce=Ae<0?K-Gr:re+Gr;for(const _e of[...ve].sort((Ne,Ie)=>Ae<0?Ie.x-Ne.x:Ne.x-Ie.x)){const Ne=Ae<0?Math.min(_e.x,ce-_e.width):Math.max(_e.x,ce);ce=Ae<0?Ne-Di:Ne+_e.width+Di,Ne!==_e.x&&Math.sign(Ne-_e.x)===Ae&&le.set(_e.id,Ne-_e.x)}}const be=new Map,Ze=ve=>be.get(ve)===ve||!be.get(ve)?ve:Ze(be.get(ve));for(const ve of te)be.set(ve.id,ve.id);for(const ve of b){const ce=le.has(ve.flow.source)?ve.flow.source:void 0,_e=le.has(ve.flow.target)?ve.flow.target:void 0;if(!ce||!_e)continue;const Ne=p(ve.flow.id);((S1=Ne==null?void 0:Ne.waypoints)==null?void 0:S1.length)===2&&be.set(Ze(ce),Ze(_e))}const Qe=new Map;for(const ve of te){if(!le.has(ve.id))continue;const ce=Ze(ve.id);Qe.set(ce,[...Qe.get(ce)??[],ve])}const Dt=[...Qe.values()].sort((ve,ce)=>Ae<0?Math.min(...ve.map(_e=>_e.x))-Math.min(...ce.map(_e=>_e.x)):Math.max(...ce.map(_e=>_e.x))-Math.max(...ve.map(_e=>_e.x))),Ft=[];let xe=!0;for(const ve of Dt){const ce=ve.map(Ie=>le.get(Ie.id)??0).reduce((Ie,Ee)=>Math.abs(Ee)>Math.abs(Ie)?Ee:Ie,0),_e=new Map;let Ne=!0;for(const Ie of ve){const Ee=d(Ie);if(!Ee){Ne=!1;break}_e.has(Ee.id)||_e.set(Ee.id,{subtree:[],pool:Ee}),_e.get(Ee.id).subtree.push(Ie)}Ne&&Hr([..._e.values()],ce,()=>!0,qa)?Ft.push({shapes:ve,dx:ce}):xe=!1}if(!xe)for(const ve of Ft.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const x=new Set([...w.map(R=>R.group.id),...tn(e,"group.update").map(R=>R.id)]);for(const R of r.filter(A=>A.type==="bpmn:Group")){if(x.has(R.id))continue;const k=(((R1=R.businessObject.extensionElements)==null?void 0:R1.values)??[]).find(F=>F.$type==="bwl:Members"),L=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!L.length||!L.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!L.some(F=>F.x<R.x||F.y<R.y||F.x+F.width>R.x+R.width||F.y+F.height>R.y+R.height)||n.resizeShape(R,mg(L,R.id))}}{const R=new Map(xr(Ve(r)).map(F=>[F.owner,F.rect])),A=r.filter(F=>!!F.waypoints),k=new Map,L=(F,I)=>{!F||!I||(k.has(F)||k.set(F,new Set),k.get(F).add(I))};for(const F of A){const I=(C1=F.source)==null?void 0:C1.id,U=(M1=F.target)==null?void 0:M1.id;L(I,U),((A1=F.type)!=null&&A1.includes("DataOutputAssociation")||(P1=F.type)!=null&&P1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&L(U,I)}const O=F=>_.filter(I=>I.flow.target===F).length,j=F=>{var U;const I=((U=p(F))==null?void 0:U.type)??"";if(I==="bpmn:StartEvent"&&O(F)===0)return!1;if(I.endsWith("Gateway")){const K=_.filter(re=>re.flow.target===F).map(re=>re.flow.source);if(K.length&&K.every(re=>{var ne;return((ne=p(re))==null?void 0:ne.type)==="bpmn:StartEvent"&&O(re)===0}))return!1}return!0};for(const F of r.filter(I=>I.type==="bpmn:Group")){const U=(((T1=F.businessObject.extensionElements)==null?void 0:T1.values)??[]).find(ce=>ce.$type==="bwl:Members"),K=((U==null?void 0:U.refs)??"").split(" ").filter(Boolean);if(!K.length)continue;const re=K.map(p).filter(ce=>!!ce);if(!re.length||!(w.some(ce=>ce.group.id===F.id)||tn(e,"group.update").some(ce=>ce.id===F.id)||re.some(ce=>{const _e=g.get(ce.id);return!_e||_e.x!==ce.x||_e.y!==ce.y})))continue;const he=new Set(K),fe=[...K];for(;fe.length;){const ce=fe.shift();for(const _e of k.get(ce)??[])he.has(_e)||(he.add(_e),fe.push(_e))}const ye=F.x,Ye=F.x+F.width,Ae=F.y,te=F.y+F.height,se=ce=>{const _e=R.get(ce.id),Ne={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return _e?[Ne,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[Ne]},le=re.flatMap(se),be=Math.min(...le.map(ce=>ce.x)),Ze=Math.max(...le.map(ce=>ce.x+ce.width)),Qe=Math.min(...le.map(ce=>ce.y)),Dt=Math.max(...le.map(ce=>ce.y+ce.height)),Ft={L:be-ye,R:Ye-Ze,T:Qe-Ae,B:te-Dt},xe=r.filter(ce=>Fi(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!he.has(ce.id)&&j(ce.id)&&ce.x<Ye&&ce.x+ce.width>ye&&ce.y<te&&ce.y+ce.height>Ae);if(!xe.length)continue;const ve={L:0,R:0,T:0,B:0};for(const ce of xe){const _e=se(ce),Ne=Math.min(..._e.map(nt=>nt.x)),Ie=Math.max(..._e.map(nt=>nt.x+nt.width)),Ee=Math.min(..._e.map(nt=>nt.y)),rt=Math.max(..._e.map(nt=>nt.y+nt.height)),ft={L:Ie-ye,R:Ye-Ne,T:rt-Ae,B:te-Ee},Jt=["L","R","T","B"].filter(nt=>ft[nt]<=Ft[nt]+.001);if(!Jt.length)continue;const li=Jt.reduce((nt,zt)=>ft[zt]<ft[nt]?zt:nt,Jt[0]);ve[li]=Math.max(ve[li],Math.min(ft[li]+10,Ft[li]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const a1=x=>{const R=x.waypoints;if(R!=null&&R.length){const k=R[Math.floor((R.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const A=x;return{x:A.x,y:A.y,width:A.width,height:A.height}};let hc=0;const s1=12,c1=14,C5=15,M5=300,A5=x=>{const R=x.split(`
7
- `),A=Math.max(...R.map(O=>oa(O,s1))),k=Math.max(100,Math.min(M5,Math.ceil(A)+c1)),L=R.reduce((O,j)=>O+Math.max(1,Math.ceil((oa(j,s1)+c1)/k)),0);return{width:k,height:Math.max(30,L*C5+10)}};for(const x of E){const R=x.association,A=((k1=x.placement)==null?void 0:k1.anchor)??(R?R.source===x.annotation.id?R.target:R.source:void 0),k=A?p(A):void 0,L=k?a1(k):void 0,O=A5(x.annotation.text??"");let j;if(L&&x.placement){const[K,re]=Wc[x.placement.side],ne=x.placement.offset??50;j={x:L.x+L.width/2+K*(L.width/2+O.width/2+ne),y:L.y+L.height/2+re*(L.height/2+O.height/2+ne)}}else L?(j={x:L.x+L.width/2+180+hc%3*260,y:L.y-110-hc%2*95},hc++):(j={x:300+hc*260,y:60},hc++);const F=k?d(k)??u():u(),I=F;L&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=qc(r,L,O,I,x.placement?{placement:x.placement}:{from:j}));const U=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},j,F);if(R){const K=re=>re===x.annotation.id?U:f(re);n.connect(K(R.source),K(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}x.placement&&T(U,"bwl:Placement",D(x.placement))}for(const x of tn(e,"association.add")){const R=x.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}const l1=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of tn(e,"node.update")){let R=f(x.id);if(x.type&&Vc(x.type)!==R.type){const A=R.x+R.width/2,k=R.y+R.height/2,L=l1();R=c.replaceElement(R,{type:Vc(x.type),...x.eventDefinition?{eventDefinitionType:bc[x.eventDefinition]}:{}});const O=l1(),j=[...L].filter(U=>U!==x.id&&!O.has(U));if(j.length)throw new ny({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:j});const F=Math.round(A-(R.x+R.width/2)),I=Math.round(k-(R.y+R.height/2));if(F!==0||I!==0){n.moveShape(R,{x:F,y:I});for(const U of[...R.incoming??[],...R.outgoing??[]])gt(U)}}if(x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(R,{"bwl:band":x.band});const A=R.y+R.height/2,k=d(R),L=x.lane?f(x.lane):((k==null?void 0:k.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);x.band!==void 0&&mt(L==null?void 0:L.id,x.band,k);const O=L?L.y+(x.band===void 0?L.height/2:Math.min(L.height/2,Q)+C(L.id,x.band)*N):x.band!==void 0&&k?k.y+X+C(`pool:${k.id}`,x.band)*N:void 0;if(O!==void 0){const j=O-A;j!==0&&n.moveElements([R],{x:0,y:j})}}}for(const x of tn(e,"sequenceFlow.update")){const R=f(x.id);if(x.source!==void 0||x.target!==void 0){const A=R,k=x.source!==void 0?f(x.source):A.source,L=x.target!==void 0?f(x.target):A.target,O=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,k,L,[O(k),O(L)]);const j=UE.get(A.id),F=L.y+L.height/2;if(j&&L.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:L.x,y:F}]);const I=A.label;if(I&&j.label){const K=Math.abs(j.label.y+I.height/2-j.channelY)<=N/5&&j.label.x+I.width>j.exit.x,re=j.exit.x+6,ne=L.x-6-I.width,he=K?ne>=re?{x:Math.max(re,Math.min(j.label.x,ne)),y:j.label.y+(F-j.channelY)}:void 0:j.label;he&&(he.x!==I.x||he.y!==I.y)&&n.moveElements([I],{x:he.x-I.x,y:he.y-I.y})}}else Math.abs(F-(k.y+k.height/2))>1&&gt(A)}x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(R,{name:((O1=x.condition)==null?void 0:O1.label)??void 0})}for(const x of tn(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of tn(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of tn(e,"annotation.update")){const R=f(x.id);if(x.text!==void 0&&n.updateProperties(R,{text:x.text}),x.placement===null)T(R,"bwl:Placement",null);else if(x.placement){const A=f(x.placement.anchor),k=a1(A),L=d(A)??u(),O=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[j,F]=Wc[x.placement.side],I=x.placement.offset??50,U={x:k.x+k.width/2+j*(k.width/2+R.width/2+I),y:k.y+k.height/2+F*(k.height/2+R.height/2+I)},K=O?qc(r,k,{width:R.width,height:R.height},L,{placement:x.placement,selfId:x.id}):U;n.moveElements([R],{x:K.x-(R.x+R.width/2),y:K.y-(R.y+R.height/2)}),T(R,"bwl:Placement",D(x.placement))}}for(const x of tn(e,"group.update")){const R=f(x.id);if(x.name!==void 0&&n.updateLabel(R,x.name??""),x.members){const A=x.members.map(p).filter(k=>!!k);A.length&&n.resizeShape(R,mg(A,x.id)),T(R,"bwl:Members",{refs:x.members.join(" ")})}}}function rf(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 zC(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>pt(f).filter(d=>!t.has(lt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ve(i),c=r(s),l=[...new Set(c.flatMap(rf))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const ee=d.x+d.width/2,We=d.y+d.height/2;h=i.getAll().find(qe=>{if(qe.type!=="bpmn:Participant")return!1;const Ge=qe;return typeof Ge.x=="number"&&typeof Ge.width=="number"&&ee>=Ge.x&&ee<=Ge.x+Ge.width&&We>=Ge.y&&We<=Ge.y+Ge.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ee=>ee.$type==="bwl:Placement"),b=[...d.incoming??[],...d.outgoing??[]].find(ee=>ee.type==="bpmn:Association"),y=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(b?((p=b.source)==null?void 0:p.id)===f?b.target:b.source:void 0);if(!y)continue;const v=y.waypoints,E=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:y.x,y:y.y,width:y.width,height:y.height},w={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,D=ty(i,E,h),$=[];if(T&&T in Wc&&$.push(qc(i,E,w,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:f})),D&&!Uc(P,w,D))for(const ee of HC)$.push(qc(i,E,w,h,{placement:{side:ee,offset:null},selfId:f}));for(const[ee,We]of[[-1,0],[1,0],[0,-1],[0,1]])for(let qe=1;qe<=jC;qe++)$.push({x:P.x+ee*ey*qe,y:P.y+We*ey*qe});const N={...s,edges:s.edges.filter(ee=>ee.id!==(b==null?void 0:b.id))},H=r(N),X=H.filter(ee=>rf(ee).includes(f)).length;if(!X)continue;let Q;for(const ee of $){const We=ee.x-P.x,qe=ee.y-P.y;if(!We&&!qe||ee.x-w.width/2<h.x||ee.x+w.width/2>h.x+h.width||ee.y-w.height/2<h.y||ee.y+w.height/2>h.y+h.height||D&&!Uc(ee,w,D))continue;const Ge={...N,shapes:N.shapes.map(W=>W.id===f?{...W,x:W.x+We,y:W.y+qe}:W)},Re=r(Ge),Z=Re.filter(W=>rf(W).includes(f)).length;if(Z>=X||Re.length>H.length)continue;const oe=Math.abs(We)+Math.abs(qe);if((!Q||Z<Q.mine||Z===Q.mine&&(Re.length<Q.all||Re.length===Q.all&&oe<Q.dist))&&(Q={x:ee.x,y:ee.y,mine:Z,all:Re.length,dist:oe}),Q.mine===0&&Q.all<H.length)break}Q&&o.moveElements([d],{x:Q.x-P.x,y:Q.y-P.y})}}const GC=60;function af(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 VC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=u=>pt(u).filter(p=>!t.has(lt(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let m=!1;for(const _ of n.shapes)_.type!=="bpmn:Group"||f.has(_.id)||[...d].some(b=>{const y=s.get(b);return y&&c(_,y)})&&(f.add(_.id),m=!0);for(const _ of n.shapes)_.type!=="bpmn:Participant"||d.has(_.id)||[...f].some(b=>{const y=s.get(b);return y&&c(y,_)})&&(d.add(_.id),m=!0);if(!m)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(m=>{const _=s.get(m);return _&&c(_,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ve(i),f=r(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[E,w]=v.pools,P=g.get(E),T=g.get(w);if(!P||!T)continue;const[D,$]=P.x<=T.x?[P,T]:[T,P];if(v.contained)continue;const N=s.get(D.id),H=s.get($.id),X=N&&H?Math.max(H.x-(N.x+N.width),0):GC,Q=D.x+D.width+X-$.x;if(Q<=0)continue;const ee=l($.id).filter(We=>i.get(We));ee.length&&(!h||Q>h.dx)&&(h={movers:ee,dx:Q})}if(!h)return;const m=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!m.length)return;const _=f.length,b=d.length;o.moveElements(m,{x:h.dx,y:0});const y=r(Ve(i));if(!(a(y).length<b&&y.length<=_)){o.moveElements(m,{x:-h.dx,y:0});return}}}const ss=.5,oy=150;function WC(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of UC(n))i.length<n.length&&i.some(r=>qC(e.elementRegistry.get(r.id)))||YC(e,i)}function UC(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)<=ss?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function qC(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 YC(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(b=>b.x+b.width),r=Math.max(...o);if(r-Math.min(...o)>ss)return;const a=t.map(b=>n.get(b.id)).filter(b=>!!b&&typeof b.x=="number");if(a.length<2)return;const s=new Map(t.map(b=>[b.id,b.x]));if(a.some(b=>Math.abs(b.x-s.get(b.id))>ss))return;const c=a.map(b=>b.x+b.width);if(Math.max(...c)-Math.min(...c)<=ss)return;const l=b=>b.x+b.width,u=b=>!!b&&typeof b.width=="number",p=b=>{const y={shapes:[],edges:[],lanes:[]},v=E=>{for(const w of E.children??[]){if("waypoints"in w&&w.waypoints){y.edges.push(w);continue}w.type!=="label"&&(w.type==="bpmn:Lane"?y.lanes.push(w):y.shapes.push(w),v(w))}};return v(b),y},f=new Map(a.map(b=>[b.id,p(b)]));let d=r;for(const b of a){const{shapes:y}=f.get(b.id),v=y.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);v.length&&(d=Math.max(d,Math.max(...v)+oy))}const g=a.filter(b=>Math.abs(l(b)-d)>ss);if(!g.length)return;for(const b of g){const y=l(b),{shapes:v,edges:E,lanes:w}=f.get(b.id);if([...v.flatMap(D=>[l(D),...u(D.label)?[l(D.label)]:[]]),...E.flatMap(D=>[...D.waypoints.map($=>$.x),...u(D.label)?[l(D.label)]:[]])].some(D=>D>d)||[...(b.incoming??[]).map(D=>D.waypoints[D.waypoints.length-1]),...(b.outgoing??[]).map(D=>D.waypoints[0])].some(D=>!D||D.x>d||Math.abs(D.x-y)<1))return;if(d>y){const D={x:y,y:b.y,width:d-y,height:b.height},$=new Set([b.id,...v.map(H=>H.id),...E.map(H=>H.id),...w.map(H=>H.id)]);if(n.getAll().some(H=>{var ee;if("waypoints"in H&&H.waypoints||H.type==="bpmn:Group"||!u(H))return!1;const X=H.type==="label"?(ee=H.labelTarget)==null?void 0:ee.id:H.id;if(!X||$.has(X)||$.has(H.id))return!1;const Q=H;return Q.x<D.x+D.width&&Q.x+Q.width>D.x&&Q.y<D.y+D.height&&Q.y+Q.height>D.y}))return}}const h=()=>new Set(pt(Ve(n)).map(lt)),m=h(),_=g.map(b=>b.width);for(const b of g)af(i,b,d-b.x,{layout:!1});[...h()].every(b=>m.has(b))||g.forEach((b,y)=>af(i,b,_[y],{layout:!1}))}function KC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>pt(l).filter(u=>!t.has(lt(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(w=>w.id!==l.id&&w.type!=="bpmn:Group"&&a(l,w));if(!p.length)continue;const f=p.map(w=>i.get(w.id)).filter(w=>!!w&&typeof w.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),m=g.t+(l.y-d.t),_=g.r+(l.x+l.width-d.r),b=g.b+(l.y+l.height-d.b),y={x:h,y:m,width:_-h,height:b-m};if(y.width<=0||y.height<=0||Math.abs(y.x-u.x)<1&&Math.abs(y.y-u.y)<1&&Math.abs(y.width-u.width)<1&&Math.abs(y.height-u.height)<1)continue;const v=r(Ve(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,y),r(Ve(i)).length>v&&o.resizeShape(u,E)}}const Yc=20,Kc=10;function XC(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(pt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(lt)),s=Ve(o),c=pt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(lt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(d);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const b=h.members.map(Te=>o.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!b.length)continue;const y=Math.min(...b.map(Te=>Te.x)),v=Math.min(...b.map(Te=>Te.y)),E=Math.max(...b.map(Te=>Te.x+Te.width)),w=Math.max(...b.map(Te=>Te.y+Te.height)),P=h.x,T=h.y,D=h.x+h.width,$=h.y+h.height;let N=P,H=T,X=D,Q=$;for(const Te of g){const B=s.edges.find(S=>S.id===Te.edge);if(!B)continue;const C=B.endpoints.some(S=>{const G=s.shapes.find(Me=>Me.id===S);if(!G||G.container)return!1;const q=G.x+G.width/2,ie=G.y+G.height/2;return P<q&&q<D&&T<ie&&ie<$});for(const S of bn(B)){const G=S.axis==="v"?[T,$]:[P,D];Math.min(S.hi,G[1])-Math.max(S.lo,G[0])<jp||(S.axis==="v"?P<S.at&&S.at<D:T<S.at&&S.at<$)&&C||(S.axis==="v"?(Math.abs(S.at-P)<=ra&&(N=Math.max(N,S.at+Yc)),Math.abs(S.at-D)<=ra&&(X=Math.min(X,S.at-Yc))):(Math.abs(S.at-T)<=ra&&(H=Math.max(H,S.at+Yc)),Math.abs(S.at-$)<=ra&&(Q=Math.min(Q,S.at-Yc))))}}if(N>y-Kc&&(N=P),H>v-Kc&&(H=T),X<E+Kc&&(X=D),Q<w+Kc&&(Q=$),N===P&&H===T&&X===D&&Q===$)continue;const ee=o.get(d),We={x:ee.x,y:ee.y,width:ee.width,height:ee.height},qe=Ve(o),Ge=new Set(pt(qe).map(lt)),Re=a(qe);r.resizeShape(ee,{x:N,y:H,width:X-N,height:Q-H});let Z=Ve(o),oe=pt(Z).filter(Te=>!Ge.has(lt(Te)));const W=[];if(oe.length>0&&oe.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&Z.edges.some(B=>B.id===Te.edge))){for(const Te of oe){if(Te.kind!=="label-over-line")continue;const B=Z.edges.find(ie=>ie.id===Te.edge),C=B&&tf(B,Z),S=(f=o.get(Te.edge))==null?void 0:f.label;if(!C||!S)continue;const G=C.x-S.x,q=C.y-S.y;r.moveElements([S],{x:G,y:q}),W.push({label:S,dx:G,dy:q})}Z=Ve(o),oe=pt(Z).filter(Te=>!Ge.has(lt(Te)))}const ae=a(Z),ge=[...ae].some(Te=>!Re.has(Te));if(oe.length||ge||ae.size>=Re.size){for(const Te of W.reverse())r.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});r.resizeShape(ee,We)}}}function ZC(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=bp((o==null?void 0:o.$parent)??o),a=Za(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:xp(u,i,r),requests:Sp(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 ry(e,t,n={}){var H,X;const{i18n:i,lower:o=iy}=n,r=Qm(e),a=bm(r.elementRegistry),s=Zm(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=IC(t,a,i),u=i&&l.writes.size?ZC(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ve(r.elementRegistry),f=new Set(pt(p).map(lt)),d=new Set(pt(p,{includeObservationOnly:!0}).map(lt)),g=new Set(p.edges.map(Q=>Q.id)),h=new Set(t.flatMap(Q=>Q.kind==="sequenceFlow.update"&&(Q.source!==void 0||Q.target!==void 0)?[Q.id]:[])),m=new Set(p.shapes.map(Q=>Q.id)),_=ca(p),b=_.length,y=new Set(_.map(([Q,ee])=>`${Q}|${ee}`)),v=Lo(p),E=new Set(v.map(([Q,ee])=>`${Q}|${ee}`)),w=new Map;for(const Q of r.elementRegistry.filter(ee=>"waypoints"in ee&&!!ee.waypoints))Q.label&&w.set(Q.id,{wps:Q.waypoints.map(ee=>({x:ee.x,y:ee.y})),label:{x:Q.label.x,y:Q.label.y},source:(H=Q.source)==null?void 0:H.id,target:(X=Q.target)==null?void 0:X.id});const P=e.get("commandStack");try{Sg(P,()=>{o(l.ops,r);for(const ee of(u==null?void 0:u.contexts())??[])P.execute(wp,ee);VC(r,f,p),WC(r,p),KC(r,f,p),vC(r,p,h),Am(r,g);const Q=Kp(r,f);wm(r,y,g),$m(r,f,g),km(r,g),SC(r,g,h),Lm(r,f,g),AC(r,f,g),gC(r,E,g),Vm(r,f,g),Gm(r,g,h),Um(r,m),zC(r,f,m),Kp(r,f,Q),XC(r,d,p,g),qm(r,f),zm(r,w)})}catch(Q){return{ok:!1,issues:[Q instanceof ny?Q.issue:{kind:"lower-failed",message:Q instanceof Error?Q.message:String(Q)}],findings:[],stats:c}}const T=Ve(r.elementRegistry),D=pt(T,{includeObservationOnly:!0}).filter(Q=>!d.has(lt(Q))),$=lm(T),N=Lo(T);return{ok:!0,issues:[],findings:D,stats:{edgeCrossings:{before:b,after:$.pairs.length,pairs:$.pairs,solidPairs:$.solidPairs,dashedPairs:$.dashedPairs,mixedPairs:$.mixedPairs,crossPoolMessages:$.crossPoolMessages},sharedEndpointCrossings:{before:v.length,after:N.length,pairs:N}}}}function QC(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function ay(e,t){return typeof e.get=="function"?e.get(t):e[t]}function sy(e,t){const n=ay(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function cy(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function JC(e){return typeof e=="string"&&hp.includes(e)}function Ii(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function ly(e,t={}){const n=e.rootElements??[],i=n.find(Z=>Z.$type==="bpmn:Collaboration"),o=new Map(n.filter(Z=>Z.$type==="bpmn:Process").map(Z=>[Z.id,Z])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],_=[],b=[],y=new Map,v=new Set,E=new Set,w=Z=>{Z&&v.add(Z)},P=Z=>{v.add(Z),E.add(Z)},T=Z=>{const oe=cy(Z,"bwl:Placement");if(!oe)return;const W=typeof oe.anchor=="string"?oe.anchor:void 0;if(!W||!JC(oe.side))return;const Y=typeof oe.offset=="number"?oe.offset:void 0;m.push({owner:Z.id,anchor:W,side:oe.side,...Y!==void 0?{offset:Y}:{}})},D=Z=>{const oe=cy(Z,"bwl:Members"),W=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];W.length&&b.push({owner:Z.id,refs:W})},$=Z=>{var oe;for(const W of Z)switch(w(W.id),W.$type){case"bpmn:TextAnnotation":P(W.id),y.set(W.id,W),c.push({id:W.id,text:typeof W.text=="string"?W.text:""}),T(W);break;case"bpmn:Association":g.push({id:W.id,type:W.$type,source:Ii(W.sourceRef),target:Ii(W.targetRef)});break;case"bpmn:Group":{P(W.id),y.set(W.id,W);const Y=(oe=W.categoryValueRef)==null?void 0:oe.value;l.push({id:W.id,...typeof Y=="string"&&Y?{name:Y}:{}}),D(W);break}default:u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"})}},N=Z=>{for(const oe of Z.flowElements??[])w(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"}),(oe.flowElements??[]).length&&N(oe);for(const oe of Z.artifacts??[])w(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"})},H=(Z,oe)=>{const W=Z.flowElements??[],Y=(Z.laneSets??[]).flatMap(ge=>ge.lanes??[]),ae=new Map;for(const ge of Y){w(ge.id),y.set(ge.id,ge);for(const Te of ge.flowNodeRef??[]){const B=Ii(Te);B&&ae.set(B,ge.id)}}for(const ge of W){if(w(ge.id),y.set(ge.id,ge),ge.$type==="bpmn:SequenceFlow"){f.push({id:ge.id,source:Ii(ge.sourceRef),target:Ii(ge.targetRef),...typeof ge.name=="string"&&ge.name?{name:ge.name}:{}});continue}if(ge.$type==="bpmn:DataStoreReference"){P(ge.id),s.push({id:ge.id,...ge.name?{name:ge.name}:{}});continue}const Te=QC(ge.$type),B=Te==="intermediateCatchEvent"?fp((ge.eventDefinitions??[]).map(q=>q.$type)):void 0;if(!vg(Te)||Te==="intermediateCatchEvent"&&!B){u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"});continue}P(ge.id);const C=Te==="boundaryEvent"?Ii(ge.attachedToRef):void 0;a.push({id:ge.id,type:Te,...ge.name?{name:ge.name}:{},...oe?{participant:oe}:{},...ae.has(ge.id)?{lane:ae.get(ge.id)}:{},...C?{attachedTo:C}:{},...B?{eventDefinition:B}:{}}),Te==="subProcess"&&N(ge);const S=sy(ge,"bwl:band");S!==void 0&&(p.bands[ge.id]=S);const G=ay(ge,"bwl:afterColumn");typeof G=="string"&&G!==""&&_.push([ge.id,G]);for(const q of ge.dataOutputAssociations??[])w(q.id),h.push({id:q.id,type:q.$type,source:ge.id,target:Ii(q.targetRef)});for(const q of ge.dataInputAssociations??[])w(q.id),h.push({id:q.id,type:q.$type,source:Ii((q.sourceRef??[])[0]),target:ge.id})}$(Z.artifacts??[])};if(i){const Z=new Set;for(const oe of i.participants??[]){P(oe.id),y.set(oe.id,oe);const W=Ii(oe.processRef);W&&Z.add(W);const Y=W?o.get(W):void 0,ae=((Y==null?void 0:Y.laneSets)??[]).flatMap(C=>C.lanes??[]),ge=ae.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of ge)P(C.id);const Te=!Y||(Y.flowElements??[]).length===0&&ae.length===0&&(Y.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...Te?{blackBox:!0}:{},...ge.length?{lanes:ge}:{}});const B=sy(oe,"bwl:poolOrder");B!==void 0&&(p.poolOrders[oe.id]=B),Y&&H(Y,oe.id)}for(const oe of i.messageFlows??[])w(oe.id),y.set(oe.id,oe),d.push({id:oe.id,source:Ii(oe.sourceRef),target:Ii(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});$(i.artifacts??[]);for(const[oe,W]of o)!Z.has(oe)&&(W.flowElements??[]).length>0&&u.push({id:oe,type:W.$type,reason:"unreachable-process"})}else for(const Z of o.values())H(Z);const X=[],Q=[],ee=[],We=[],qe=(Z,oe)=>!!Z&&!!oe&&E.has(Z)&&E.has(oe);for(const Z of f){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}X.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),E.add(Z.id)}for(const Z of d){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),E.add(Z.id)}for(const Z of h){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}We.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target}),Z.id&&E.add(Z.id)}for(const Z of g){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}ee.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target})}const Ge=new Map(l.map(Z=>[Z.id,Z]));for(const{owner:Z,refs:oe}of b){const W=oe.filter(ae=>v.has(ae)),Y=Ge.get(Z);Y&&W.length&&(Y.members=W)}for(const Z of m)v.has(Z.anchor)&&(p.placements[Z.owner]={anchor:Z.anchor,side:Z.side,...Z.offset!==void 0?{offset:Z.offset}:{}});for(const[Z,oe]of _)v.has(oe)&&(p.afterColumns[Z]=oe);const Re={...r.length?{participants:r}:{},nodes:a,sequenceFlows:X,...Q.length?{messageFlows:Q}:{},...s.length?{dataStores:s}:{},...We.length?{dataAssociations:We}:{},...c.length?{annotations:c}:{},...ee.length?{associations:ee}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Re,hints:p,omitted:u,i18n:eM(Re,y,e,t.i18n)}:{definition:Re,hints:p,omitted:u}}function eM(e,t,n,i){const o=bp(n),r=Za(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=xp(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Sp(u))r.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function tM(e,t={}){const{definitions:n,warnings:i}=await na(e);return{...ly(n,t),warnings:i}}const nM=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function sf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function iM(e){return sf(e.processRef)!==void 0}function oM(e){const t=new Set,n=o=>{const r=sf(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 rM(e){const t=[],n=i=>{for(const o of i.flowElements??[])nM.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 aM(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 cf(e){const t=[],n=e.rootElements??[],i=oM(e);for(const r of rM(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??[])iM(s)&&aM(r.get(sf(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 sM(e){const{definitions:t,warnings:n}=await na(e);return{issues:cf(t),warnings:n}}const cM=.5,lM=8,uM=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),pa=e=>typeof e=="number"?e:Number(e??NaN),Xc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function pM(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}=${Xc(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=>`${Xc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Xc).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function fM(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?[pa(s.x),pa(s.y),pa(s.width),pa(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=Xc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[pa(f.x),pa(f.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 uy(e){const t=fM(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:")&&!uM.has(s)&&n.set(c,{type:s,props:pM(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 py(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 fy(e,t,n={}){const i=n.moveTolerance??cM,o=uy(e),r=uy(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||py(p.geometry,u.geometry,i)||py(p.label,u.label,n.labelTolerance??lM))&&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 dM(e,t,n={}){const[i,o]=await Promise.all([na(e),na(t)]);return{...fy(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function hM(e){return new Set([...e.added,...e.modified])}function gM(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function dy(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=ry(e,t.ops,{i18n:i});if(!o.ok)return{status:"rejected",issues:o.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:o.findings,stats:o.stats}}const mM=new Set(["lasso","lasso.selection","hand","hand.move"]),hy=1e4,yM="bwl-edit-locked",gy=new WeakMap;function vM(e){const t=gy.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",hy,()=>{var s;if(o)return mM.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"],hy,()=>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(yM,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 gy.set(e,a),a}const bM=Symbol("bpmn-editor"),lf={geometry:[],semantic:[]};function xM(){const e=me.ref(!1),t=me.ref(!0),n=me.ref(!1),i=me.shallowRef(lf),o=me.shallowRef(void 0),r=me.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=lf;return}const _=pt(Ve(c.get("elementRegistry")),{includeObservationOnly:!0}),b=c.getDefinitions();i.value={geometry:_,semantic:b?cf(b):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const _=u();if(!_||!a){r.value=void 0;return}const b=_.locales(),y={};for(const v of b)y[v]={untranslated:_.untranslatedCount(v),reviewRequested:_.reviewRequestedCount(v)};r.value={designLocale:a.designLocale,locales:b,displayLocale:_.getDisplayLocale()??a.designLocale,counts:y}}function f(){const _=u();_&&(_.configure(a),a&&s&&(s=_.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(_,b){vM(_).set(!b)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function m(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(_){a=_,f(),p()},setDisplayLocale(_){var y;s=_;const b=(y=u())==null?void 0:y.setDisplayLocale(_);b&&(s=b),p()},setChangeScope(_){o.value=_===void 0?void 0:new Set(_)},requestFocus(_){if(!c)return;const b=c.get("elementRegistry").get(_);b&&(c.get("canvas").scrollToElement(b,180),c.get("selection").select(b))},describeElement(_){const b=c==null?void 0:c.get("elementRegistry").get(_),y=b==null?void 0:b.businessObject;if(!y)return;const v=typeof y.name=="string"&&y.name.trim()!==""?y.name:y.text;return{name:typeof v=="string"&&v.trim()!==""?v.trim():void 0,type:typeof y.$type=="string"?y.$type:""}},attach(_){c&&this.detach(),c=_,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=lf,o.value=void 0,r.value=void 0},setEditable(_){t.value=_,c&&g(c,_)},async applyAgentBatch(_,b){const y=h();n.value=!0;try{const v=await dy(y,_,{currentVersion:b,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return v.status==="applied"&&(e.value=!1),v}finally{n.value=!1}},async importXml(_){const{warnings:b}=await h().importXML(_);return e.value=!1,o.value=void 0,l(),{warnings:Fp(b)}},async saveXml(){const{xml:_}=await h().saveXML({format:!0});return e.value=!1,_??""},undo:()=>{var _;return(_=m())==null?void 0:_.undo()},redo:()=>{var _;return(_=m())==null?void 0:_.redo()},canUndo:()=>{var _;return((_=m())==null?void 0:_.canUndo())??!1},canRedo:()=>{var _;return((_=m())==null?void 0:_.canRedo())??!1}}}const _M=new RegExp("\\p{Script=Hangul}","u"),wM=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,EM=new RegExp("\\p{Script=Han}","u");function uf(e){const t=_M.test(e),n=wM.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:EM.test(e)?"han":"other"}}function my(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 yy(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=gr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Jr(a).filter(l=>Nn(l))})}return n}const cs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function SM(e){const t=my(e),n=yy(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(m=>(m.body??"")===g.name).map(Nn);if(h.length){const m=[...h].sort().join("+");o[m]=(o[m]??0)+1,i=i?new Set([...i].filter(_=>h.includes(_))):new Set(h)}else g.trs.some(m=>m.body)?r.push(cs(g)):s.push({e:g,inference:uf(g.name)});for(const m of g.trs){const _=Nn(m),b=m.body??"",y=uf(b);y.locale&&y.locale!==_?a.push({...cs(g),locale:_,script:y.script}):_==="ko"&&y.script==="han"&&g.trs.some(v=>v!==m&&v.body===b)&&a.push({...cs(g),locale:_,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...cs(g),locale:h.locale}):d.push({...cs(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function RM(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!my(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(yy(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(f=>f.body))continue;const l=c.trs.find(f=>Nn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Qr,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ce(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function CM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pf={exports:{}},vy;function MM(){if(vy)return pf.exports;vy=1;var e=pf.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},pf.exports}var AM=MM(),PM=CM(AM);function Ui(e){if(!(this instanceof Ui))return new Ui(e);e=e||[128,36,1],this._seed=e.length?PM.rack(e[0],e[1],e[2]):e}Ui.prototype.next=function(e){return this._seed(e||!0)},Ui.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Ui.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ui.prototype.assigned=function(e){return this._seed.get(e)||!1},Ui.prototype.unclaim=function(e){delete this._seed.hats[e]},Ui.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const hn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};hn.td=hn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],hn.option=hn.optgroup=[1,'<select multiple="multiple">',"</select>"],hn.thead=hn.tbody=hn.colgroup=hn.caption=hn.tfoot=[1,"<table>","</table>"],hn.polyline=hn.ellipse=hn.polygon=hn.circle=hn.text=hn.line=hn.path=hn.rect=hn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Nt(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(hn,i)?hn[i]:hn._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 TM(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 zn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function En(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const kM=Object.prototype.toString;function Rt(e){return new Io(e)}function Io(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Io.prototype.add=function(e){return this.list.add(e),this},Io.prototype.remove=function(e){return kM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Io.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},Io.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Io.prototype.array=function(){return Array.from(this.list)},Io.prototype.has=Io.prototype.contains=function(e){return this.list.contains(e)};function Zc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function _r(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function OM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qc={},by;function DM(){if(by)return Qc;by=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Qc.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},Qc.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},Qc}var xy=DM(),LM=OM(xy),Le=TM({__proto__:null,default:LM},[xy]),_y=["focus","blur"];function IM(e,t,n,i,o){return _y.indexOf(n)!==-1&&(o=!0),Le.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=_r(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function BM(e,t,n,i){return _y.indexOf(t)!==-1&&(i=!0),Le.unbind(e,t,n,i)}var ei={bind:IM,unbind:BM};function ff(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function wt(e,t){return t=t||document,t.querySelector(e)}function ls(e,t){return t=t||document,t.querySelectorAll(e)}function qi(e){e.parentNode&&e.parentNode.removeChild(e)}function NM(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function $M(e,t){return t.appendChild(NM(e,t))}function ze(e,t){return $M(t,e),e}var df=2,wy={"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":df,"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":df,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function FM(e,t){return wy[t]?e.style[t]:e.getAttributeNS(null,t)}function Ey(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=wy[i];o?(o===df&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function jM(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Ey(e,o,t[o])}function we(e,t,n){if(typeof t=="string")if(n!==void 0)Ey(e,t,n);else return FM(e,t);else jM(e,t);return e}const HM=Object.prototype.toString;function st(e){return new Bo(e)}function Bo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Bo.prototype.add=function(e){return this.list.add(e),this},Bo.prototype.remove=function(e){return HM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Bo.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},Bo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Bo.prototype.array=function(){return Array.from(this.list)},Bo.prototype.has=Bo.prototype.contains=function(e){return this.list.contains(e)};function us(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function hf(e){return e.cloneNode(!0)}var gf={svg:"http://www.w3.org/2000/svg"},Sy='<svg xmlns="'+gf.svg+'"';function zM(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(gf.svg)===-1&&(e=Sy+e.substring(4)):(e=Sy+">"+e+"</svg>",t=!0);var n=GM(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function GM(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=zM(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(gf.svg,e),t&&we(n,t),n}var mf=null;function Ry(){return mf===null&&(mf=Oe("svg")),mf}function Cy(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function VM(e,t,n,i,o,r){var a=Ry().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Cy(a,e);case 6:return Cy(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function ps(e){return Ry().createSVGTransform()}var My=/([&<>]{1})/g,WM=/([&<>\n\r"]{1})/g,UM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function yf(e,t){function n(i,o){return UM[o]||o}return e.replace(t,n)}function Ay(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(yf(e.textContent,My));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,'="',yf(r.value,WM),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Ay(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",yf(e.nodeValue,My),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function qM(e){for(var t=e.firstChild,n=[];t;)Ay(t,n),t=t.nextSibling;return n.join("")}function Py(e,t){return qM(e)}function rn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function YM(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function KM(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(YM(e,i))}function fs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),KM(n,t)),n.consolidate()}const XM=/^class[ {]/;function ZM(e){return XM.test(e.toString())}function vf(e){return Array.isArray(e)}function bf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Jc(...e){e.length===1&&vf(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const QM=/constructor\s*[^(]*\(\s*([^)]*)\)/m,JM=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,eA=/\/\*([^*]*)\*\//m;function tA(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(ZM(e)?QM:JM);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(eA);return(o&&o[1]||i).trim()})||[]}function Ty(e,t){const n=t||{get:function(y,v){if(i.push(y),v===!1)return null;throw s(`No provider for "${y}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(y){const v=i.join(" -> ");return i.length=0,new Error(v?`${y} (Resolving: ${v})`:y)};function c(y,v){if(!o[y]&&y.includes(".")){const E=y.split(".");let w=c(E.shift());for(;E.length;)w=w[E.shift()];return w}if(bf(r,y))return r[y];if(bf(o,y)){if(i.indexOf(y)!==-1)throw i.push(y),s("Cannot resolve circular dependency!");return i.push(y),r[y]=o[y][0](o[y][1]),i.pop(),r[y]}return n.get(y,v)}function l(y,v){if(typeof v>"u"&&(v={}),typeof y!="function")if(vf(y))y=Jc(y.slice());else throw s(`Cannot invoke "${y}". Expected a function!`);const w=(y.$inject||tA(y)).map(P=>bf(v,P)?v[P]:c(P));return{fn:y,dependencies:w}}function u(y){const{fn:v,dependencies:E}=l(y),w=Function.prototype.bind.call(v,null,...E);return new w}function p(y,v,E){const{fn:w,dependencies:P}=l(y,E);return w.apply(v,P)}function f(y){return Jc(v=>y.get(v))}function d(y,v){if(v&&v.length){const E=Object.create(null),w=Object.create(null),P=[],T=[],D=[];let $,N,H,X;for(let Q in o)$=o[Q],v.indexOf(Q)!==-1&&($[2]==="private"?(N=P.indexOf($[3]),N===-1?(H=$[3].createChild([],v),X=f(H),P.push($[3]),T.push(H),D.push(X),E[Q]=[X,Q,"private",H]):E[Q]=[D[N],Q,"private",T[N]]):E[Q]=[$[2],$[1]],w[Q]=!0),($[2]==="factory"||$[2]==="type")&&$[1].$scope&&v.forEach(ee=>{$[1].$scope.indexOf(ee)!==-1&&(E[Q]=[$[2],$[1]],w[ee]=!0)});v.forEach(Q=>{if(!w[Q])throw new Error('No provider for "'+Q+'". Cannot use provider from the parent!')}),y.unshift(E)}return new Ty(y,a)}const g={factory:p,type:u,value:function(y){return y}};function h(y,v){const E=y.__init__||[];return function(){E.forEach(w=>{typeof w=="string"?v.get(w):v.invoke(w)})}}function m(y){const v=y.__exports__;if(v){const E=y.__modules__,w=Object.keys(y).reduce((N,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(N[H]=y[H]),N),Object.create(null)),P=(E||[]).concat(w),T=d(P),D=Jc(function(N){return T.get(N)});v.forEach(function(N){o[N]=[D,N,"private",T]});const $=(y.__init__||[]).slice();return $.unshift(function(){T.init()}),y=Object.assign({},y,{__init__:$}),h(y,T)}return Object.keys(y).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const w=y[E];if(w[2]==="private"){o[E]=w;return}const P=w[0],T=w[1];o[E]=[g[P],nA(P,T),P]}),h(y,a)}function _(y,v){return y.indexOf(v)!==-1||(y=(v.__depends__||[]).reduce(_,y),y.indexOf(v)!==-1)?y:y.concat(v)}function b(y){const v=y.reduce(_,[]).map(m);let E=!1;return function(){E||(E=!0,v.forEach(w=>w()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=b(e)}function nA(e,t){return e!=="value"&&vf(t)&&(t=Jc(t.slice())),t}var iA=1e3;function uo(e,t){var n=this;t=t||iA,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)})}uo.prototype.canRender=function(e){},uo.prototype.drawShape=function(e,t){},uo.prototype.drawConnection=function(e,t){},uo.prototype.getShapePath=function(e){},uo.prototype.getConnectionPath=function(e){};function wr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function oA(e){return["M",e.x,e.y]}function xf(e){return["L",e.x,e.y]}function rA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function aA(e,t){const n=e.length,i=[oA(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(xf(a));continue}const c=Math.min(t,_f(a.x-r.x,a.y-r.y),_f(s.x-a.x,s.y-a.y));if(!c){i.push(xf(a));continue}const l=el(a,r,c),u=el(a,r,c*.5),p=el(a,s,c),f=el(a,s,c*.5);i.push(xf(l)),i.push(rA(u,f,p))}return i}function el(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=_f(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function _f(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ds(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),wf(i,e)}function wf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return we(e,{d:wr(aA(t,n))}),e}function tl(e){var t=new Set(e);return it(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Er(e,t,n){n=n||0,$e(e)||(e=[e]),z(e,function(i,o){var r=t(i,o,n);$e(r)&&r.length&&Er(r,t,n+1)})}function Ef(e,t,n){var i=new Set,o=new Set;return Er(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 hs(e,t){return Ef(e)}function sA(e,t,n){hr(t)&&(t=!0),dn(t)&&(n=t,t=!0),n=n||{};var i=gs(n.allShapes),o=gs(n.allConnections),r=gs(n.enclosedElements),a=gs(n.enclosedConnections),s=gs(n.topLevel,t&&Xr(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,z(u.incoming,c),z(u.outgoing,c),u.children}return Er(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function an(e,t){t=!!t,$e(e)||(e=[e]);var n,i,o,r;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=an(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 fa(e,t){var n={};return z(e,function(i){var o=i;o.waypoints&&(o=an(o)),!Fe(t.y)&&o.x>t.x&&(n[i.id]=i),!Fe(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Fe(t.width)&&Fe(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function ky(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Oy(e){return!!(e&&e.isFrame)}function gs(e,t){return V({},e||{},t||{})}var cA=1;function No(e,t){uo.call(this,e,cA),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})}Ce(No,uo),No.prototype.canRender=function(){return!0},No.prototype.drawShape=function(t,n,i){var o=Oe("rect");return we(o,{x:0,y:0,width:n.width||0,height:n.height||0}),Oy(n)?we(o,V({},this.FRAME_STYLE,i||{})):we(o,V({},this.SHAPE_STYLE,i||{})),ze(t,o),o},No.prototype.drawConnection=function(t,n,i){var o=ds(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return ze(t,o),o},No.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 wr(a)},No.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 wr(r)},No.$inject=["eventBus","styles"];function lA(){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 V(r,{class:n})},this.style=function(n,i){!$e(n)&&!i&&(i=n,n=[]);var o=Qn(n,function(r,a){return V(r,e[a]||{})},{});return i?V(o,i):o},this.computeStyle=function(n,i,o){return $e(i)||(o=i,i=[]),t.style(i||[],V({},o,n||{}))}}const uA={__init__:["defaultRenderer"],defaultRenderer:["type",No],styles:["type",lA]};function Zt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function nn(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 Sf(e,t){return!e||!t?-1:e.indexOf(t)}function ms(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rf(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=ms(e,t);return Math.abs(o/r)<=i}var pA=2;function po(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(fA(o,n))return r;return!1}function fA(e,t){const n=t[0];return Ao(t,function(i){return Math.abs(n[e]-i[e])<=pA})}function Dy(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 Cf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var dA=/,?([a-z]),?/gi,Ly=parseFloat,sn=Math,$o=sn.PI,Yi=sn.min,Ki=sn.max,Iy=sn.pow,Fo=sn.abs,hA=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,gA=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,By=Array.isArray||function(e){return e instanceof Array};function mA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yA(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 vA(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 mA(o,i)?(yA(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function bA(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(hA,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(gA,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 xA(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 _A(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 Mf(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(dA,"$1")}function wA(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 Ny(e,t,n,i,o,r,a,s,c){var l=1-c,u=Iy(l,3),p=Iy(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*o+d*a,h=u*t+p*3*c*i+l*3*c*c*r+d*s;return{x:nl(g),y:nl(h)}}function $y(e){var t=AA(...e);return Mf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function jo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function EA(e,t){return e=Mf(e),t=Mf(t),jo(t,e.x,e.y)||jo(t,e.x2,e.y)||jo(t,e.x,e.y2)||jo(t,e.x2,e.y2)||jo(e,t.x,t.y)||jo(e,t.x2,t.y)||jo(e,t.x,t.y2)||jo(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 Fy(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 jy(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],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,m=Fy(h,e,n,o,a),_=Fy(h,t,i,r,s),b=m*m+_*_;d+=f[g]*sn.sqrt(b)}return l*d}function SA(e,t,n,i,o,r,a,s){if(!(Ki(e,n)<Yi(o,a)||Yi(e,n)>Ki(o,a)||Ki(t,i)<Yi(r,s)||Yi(t,i)>Ki(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=nl(c/u),f=nl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Yi(e,n).toFixed(2)||d>+Ki(e,n).toFixed(2)||d<+Yi(o,a).toFixed(2)||d>+Ki(o,a).toFixed(2)||g<+Yi(t,i).toFixed(2)||g>+Ki(t,i).toFixed(2)||g<+Yi(r,s).toFixed(2)||g>+Ki(r,s).toFixed(2)))return{x:p,y:f}}}}function nl(e){return Math.round(e*1e11)/1e11}function RA(e,t,n){var i=$y(e),o=$y(t);if(!EA(i,o))return[];var r=jy(...e),a=jy(...t),s=zy(e)?1:~~(r/5)||1,c=zy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=Ny(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=Ny(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=l[d],_=l[d+1],b=u[g],y=u[g+1],v=Fo(_.x-m.x)<.01?"y":"x",E=Fo(y.x-b.x)<.01?"y":"x",w=SA(m.x,m.y,_.x,_.y,b.x,b.y,y.x,y.y),P;if(w){if(P=w.x.toFixed(9)+"#"+w.y.toFixed(9),p[P])continue;p[P]=!0;var T=m.t+Fo((w[v]-m[v])/(_[v]-m[v]))*(_.t-m.t),D=b.t+Fo((w[E]-b[E])/(y[E]-b[E]))*(y.t-b.t);T>=0&&T<=1&&D>=0&&D<=1&&f.push({x:w.x,y:w.y,t1:T,t2:D})}}return f}function Hy(e,t,n){e=Wy(e),t=Wy(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,b=t.length;_<b;_++){var y=t[_];if(y[0]=="M")r=l=y[1],a=u=y[2];else{y[0]=="C"?(f=[r,a,...y.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var v=RA(p,f);{for(var E=0,w=v.length;E<w;E++)v[E].segment1=g,v[E].segment2=_,v[E].bez1=p,v[E].bez2=f;d=d.concat(v)}}}}}return d}function CA(e){return By(e)&&By(e[0])}function MA(e){if(xA(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 f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+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 zy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function il(e,t,n,i){return[e,t,n,i,n,i]}function Gy(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 Vy(e,t,n,i,o,r,a,s,c,l){var u=$o*120/180,p=$o/180*(+o||0),f=[],d,g=vA(function(B,C,S){var G=B*sn.cos(S)-C*sn.sin(S),q=B*sn.sin(S)+C*sn.cos(S);return{x:G,y:q}});if(l)P=l[0],T=l[1],E=l[2],w=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=sn.sqrt(_),n=_*n,i=_*i);var b=n*n,y=i*i,v=(r==a?-1:1)*sn.sqrt(Fo((b*y-b*m*m-y*h*h)/(b*m*m+y*h*h))),E=v*n*m/i+(e+s)/2,w=v*-i*h/n+(t+c)/2,P=sn.asin(((t-w)/i).toFixed(9)),T=sn.asin(((c-w)/i).toFixed(9));P=e<E?$o-P:P,T=s<E?$o-T:T,P<0&&(P=$o*2+P),T<0&&(T=$o*2+T),a&&P>T&&(P=P-$o*2),!a&&T>P&&(T=T-$o*2)}var D=T-P;if(Fo(D)>u){var $=T,N=s,H=c;T=P+u*(a&&T>P?1:-1),s=E+n*sn.cos(T),c=w+i*sn.sin(T),f=Vy(s,c,n,i,o,0,a,N,H,[T,$,E,w])}D=T-P;var X=sn.cos(P),Q=sn.sin(P),ee=sn.cos(T),We=sn.sin(T),qe=sn.tan(D/4),Ge=4/3*n*qe,Re=4/3*i*qe,Z=[e,t],oe=[e+Ge*Q,t-Re*X],W=[s+Ge*We,c-Re*ee],Y=[s,c];if(oe[0]=2*Z[0]-oe[0],oe[1]=2*Z[1]-oe[1],l)return[oe,W,Y].concat(f);f=[oe,W,Y].concat(f).join().split(",");for(var ae=[],ge=0,Te=f.length;ge<Te;ge++)ae[ge]=ge%2?g(f[ge-1],f[ge],p).y:g(f[ge],f[ge+1],p).x;return ae}function AA(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,_,b=0;b<2;++b){if(b==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,f=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,f=3*i-3*t),Fo(u)<1e-12){if(Fo(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,_=sn.sqrt(m),!(m<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 y=c.length,v=y,E;y--;)d=c[y],E=1-d,l[0][y]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][y]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Yi(...l[0]),y0:Yi(...l[1]),x1:Ki(...l[0]),y1:Ki(...l[1])}}function Wy(e){if(CA(e)||(e=bA(e)),_A(e))return e;for(var t=wA(MA(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,m;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Vy(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),f=["C",h,m,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Gy(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Gy(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...il(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...il(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...il(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...il(d.x,d.y,d.X,d.Y)];break}return f},o=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)r[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,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=Ly(u[p-4])||n.x,n.by=Ly(u[p-3])||n.y}return t}function Pt(e){return dn(e)&&Zn(e,"waypoints")}function Je(e){return dn(e)&&Zn(e,"labelTarget")}function PA(e){return dn(e)&&Yr(e.parent)}function Uy(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function fo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function ol(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function TA(e){return fo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function kA(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=LA(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),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 je(e){return Pt(e)?kA(e):TA(e)}function kn(e,t,n){n=n||0,dn(n)||(n={x:n,y:n});var i=Be(e),o=Be(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 ys(e,t,n){var i=OA(e,t);return i.length===1||i.length===2&&ms(i[0],i[1])<1?fo(i[0]):i.length>1?(i=Hi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),fo(i[n?0:i.length-1])):null}function OA(e,t){return Hy(e,t)}function DA(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],ms(n,o)===0||Rf(i,o,n)?e.splice(t,1):t++;return e}function LA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rl(e,t){return Math.round(e*t)/t}function qy(e){return Fe(e)?e+"px":e}function IA(e){for(;e.parent;)e=e.parent;return e}function BA(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),zn(n,{position:"relative",overflow:"hidden",width:qy(e.width),height:qy(e.height)}),t.appendChild(n),n}function Yy(e,t,n){const i=Oe("g");st(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const NA="base",Ky=0,$A=1,FA={shape:["x","y","width","height"],connection:["waypoints"]};function He(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||{})}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){const t=this._eventBus,n=this._container=BA(e),i=this._svg=Oe("svg");we(i,{width:"100%",height:"100%"}),En(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")}),ze(n,i);const o=this._viewport=Yy(i,"viewport");e.deferUpdate&&(this._viewboxChanged=vp(this._viewboxChanged,300)),this._restoreFocus=vp(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)},He.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},He.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},He.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=ky(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},He.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},He.prototype.restoreFocus=function(){this._restoreFocus()},He.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},He.prototype.isFocused=function(){return this._focused},He.prototype.getDefaultLayer=function(){return this.getLayer(NA,Ky)},He.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},He.prototype._getChildIndex=function(e){return Qn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},He.prototype._createLayer=function(e,t){typeof t>"u"&&(t=$A);const n=this._getChildIndex(t);return{group:Yy(this._viewport,"layer-"+e,n),index:t,visible:!0}},He.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},He.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&&(rn(n),t.visible=!1),n},He.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],rn(t.group))},He.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},He.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(IA(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},He.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},He.prototype._findPlaneForRoot=function(e){return Ot(this._planes,function(t){return t.rootElement===e})},He.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},He.prototype._resolveElements=function(e){return $e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},He.prototype.getContainer=function(){return this._container},He.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),st(o).add(t)):(e.markers.delete(t),st(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},He.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,Ky);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},He.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},He.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},He.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)},He.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})},He.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})},He.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=FA[e];if(!Ao(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){nn(t.children,e,n),e.parent=t},He.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},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.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),Zt(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.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);fs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=fs(t),o=a?a.matrix:VM(),s=rl(o.a,1e3),c=rl(-o.e||0,1e3),l=rl(-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},He.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Xy(t,n)}),{x:n.e,y:n.f}},He.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=an(r),s=Be(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Be(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),_=Math.min(0,s.top-f.top);u=g||h,p=m||_}this.scroll({dx:-u*l,dy:-p*l})},He.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)}),rl(i.a,1e3)};function Xy(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.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},He.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=V(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),Xy(this._viewport,u),u},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.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}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var da="data-element-id";function gi(e){this._elements={},this._eventBus=e}gi.$inject=["eventBus"],gi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),we(t,da,i),n&&we(n,da,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},gi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(we(i.gfx,da,""),i.secondaryGfx&&we(i.secondaryGfx,da,""),delete t[n])},gi.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)},gi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&we(t,da,i),t},gi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&we(e,da);var n=this._elements[t];return n&&n.element},gi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},gi.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}},gi.prototype.getAll=function(){return this.filter(function(e){return e})},gi.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)})},gi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},gi.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 jA(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 HA(e){return e.__refs_collection===!0}function zA(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Zy(e,t,n){var i=jA(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 GA(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 xi(e,t){if(!(this instanceof xi))return new xi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xi.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?Zy(this,t,e):GA(this,t,e)},xi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return HA(n)||Zy(this,t,e),n},xi.prototype.ensureBound=function(e,t){zA(e,t)||this.bind(e,t)},xi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Pf=new xi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Qy=new xi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Jy=new xi({name:"attachers",collection:!0},{name:"host"}),ev=new xi({name:"outgoing",collection:!0},{name:"source"}),tv=new xi({name:"incoming",collection:!0},{name:"target"});function ha(){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)}}),Pf.bind(this,"parent"),Qy.bind(this,"labels"),ev.bind(this,"outgoing"),tv.bind(this,"incoming")}function vs(){ha.call(this),Pf.bind(this,"children"),Jy.bind(this,"host"),Jy.bind(this,"attachers")}Ce(vs,ha);function nv(){ha.call(this),Pf.bind(this,"children")}Ce(nv,vs);function iv(){vs.call(this),Qy.bind(this,"labelTarget")}Ce(iv,vs);function ov(){ha.call(this),ev.bind(this,"source"),tv.bind(this,"target")}Ce(ov,ha);var VA={connection:ov,shape:vs,label:iv,root:nv};function WA(e,t){var n=VA[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function UA(e){return e instanceof ha}function ho(){this._uid=12}ho.prototype.createRoot=function(e){return this.create("root",e)},ho.prototype.createLabel=function(e){return this.create("label",e)},ho.prototype.createShape=function(e){return this.create("shape",e)},ho.prototype.createConnection=function(e){return this.create("connection",e)},ho.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),WA(e,t)};var al="__fn",rv=1e3,qA=Array.prototype.slice;function ti(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ti.prototype.on=function(e,t,n,i){if(e=$e(e)?e:[e],vn(t)&&(i=n,n=t,t=rv),!Fe(t))throw new Error("priority must be a number");var o=n;i&&(o=qn(n,i),o[al]=n[al]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ti.prototype.once=function(e,t,n,i){var o=this;if(vn(t)&&(i=n,n=t,t=rv),!Fe(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[al]=n,this.on(e,t,r)},ti.prototype.off=function(e,t){e=$e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ti.prototype.createEvent=function(e){var t=new bs;return t.init(e),t},ti.prototype.fire=function(e,t){var n,i,o,r;if(r=qA.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 bs?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}},ti.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ti.prototype._destroy=function(){this._listeners={}},ti.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ti.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=YA(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},ti.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},ti.prototype._getListeners=function(e){return this._listeners[e]},ti.prototype._setListeners=function(e,t){this._listeners[e]=t},ti.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[al]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function bs(){}bs.prototype.stopPropagation=function(){this.cancelBubble=!0},bs.prototype.preventDefault=function(){this.defaultPrevented=!0},bs.prototype.init=function(e){V(this,e||{})};function YA(e,t){return e.apply(null,t)}function Ho(e){return e.childNodes[0]}function KA(e){return e.parentNode.childNodes[1]}function sl(e,t,n,i,o){var r=ps();r.setTranslate(t,n);var a=ps();a.setRotate(i||0,0,0);var s=ps();s.setScale(1,1),fs(e,[r,a,s])}function On(e,t,n){var i=ps();i.setTranslate(t,n),fs(e,i)}function av(e,t){var n=ps();n.setRotate(t,0,0),fs(e,n)}function mi(e,t){this._eventBus=e,this._elementRegistry=t}mi.$inject=["eventBus","elementRegistry"],mi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=KA(t),n||(n=Oe("g"),st(n).add("djs-children"),ze(t.parentNode,n))):n=t,n},mi.prototype._clear=function(e){var t=Ho(e);return Zc(t),t},mi.prototype._createContainer=function(e,t,n,i){var o=Oe("g");st(o).add("djs-group"),typeof n<"u"?XA(o,t,t.childNodes[n]):ze(t,o);var r=Oe("g");st(r).add("djs-element"),st(r).add("djs-"+e),i&&st(r).add("djs-frame"),ze(o,r);var a=Oe("g");return st(a).add("djs-visual"),ze(r,a),r},mi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Oy(t))},mi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Qn(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),z(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;z(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},mi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},mi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},mi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},mi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},mi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),On(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?we(n,"display","none"):we(n,"display","block")}},mi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);rn(t.parentNode)};function XA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const ZA={__depends__:[uA],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",gi],elementFactory:["type",ho],eventBus:["type",ti],graphicsFactory:["type",mi]};function QA(e){var t=new Ty(e);return t.init(),t}function JA(e){e=e||{};var t={config:["value",e]},n=[t,ZA].concat(e.modules||[]);return QA(n)}function zo(e,t){this._injector=t||JA(e),this.get("eventBus").fire("diagram.init")}zo.prototype.get=function(e,t){return this._injector.get(e,t)},zo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},zo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},zo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Fn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Yn(e,t){return e.$instanceOf(t)}function eP(e){return Ot(e.rootElements,function(t){return Yn(t,"bpmn:Process")||Yn(t,"bpmn:Collaboration")})}function tP(e){var t={},n=[],i={};function o(W,Y){return function(ae){W(ae,Y)}}function r(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var ae=W.gfx;if(ae)throw new Error(`already rendered ${Fn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function l(W,Y){try{var ae=i[W.id]&&s(W,Y);return r(W),ae}catch(ge){u(ge.message,{element:W,error:ge}),console.error(`failed to import ${Fn(W)}`,ge)}}function u(W,Y){e.error(W,Y)}var p=this.registerDi=function(Y){var ae=Y.bpmnElement;ae?i[ae.id]?u(`multiple DI elements defined for ${Fn(ae)}`,{element:ae}):i[ae.id]=Y:u(`no bpmnElement referenced in ${Fn(Y)}`,{element:Y})};function f(W){d(W.plane)}function d(W){p(W),z(W.planeElement,g)}function g(W){p(W)}this.handleDefinitions=function(Y,ae){var ge=Y.diagrams;if(ae&&ge.indexOf(ae)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ae&&ge&&ge.length&&(ae=ge[0]),!ae)throw new Error("no diagram to display");i={},f(ae);var Te=ae.plane;if(!Te)throw new Error(`no plane for ${Fn(ae)}`);var B=Te.bpmnElement;if(!B)if(B=eP(Y),B)u(`correcting missing bpmnElement on ${Fn(Te)} to ${Fn(B)}`),Te.bpmnElement=B,p(Te);else throw new Error("no process or collaboration to display");var C=c(B,Te);if(Yn(B,"bpmn:Process")||Yn(B,"bpmn:SubProcess"))m(B,C);else if(Yn(B,"bpmn:Collaboration"))Z(B,C),_(Y.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Fn(Te)}: ${Fn(B)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function m(W,Y){qe(W,Y),D(W.ioSpecification,Y),T(W.artifacts,Y),r(W)}function _(W,Y){var ae=it(W,function(ge){return!a(ge)&&Yn(ge,"bpmn:Process")&&ge.laneSets});ae.forEach(o(m,Y))}function b(W,Y){l(W,Y)}function y(W,Y){z(W,o(b,Y))}function v(W,Y){l(W,Y)}function E(W,Y){l(W,Y)}function w(W,Y){l(W,Y)}function P(W,Y){l(W,Y)}function T(W,Y){z(W,function(ae){Yn(ae,"bpmn:Association")?n.push(function(){P(ae,Y)}):P(ae,Y)})}function D(W,Y){W&&(z(W.dataInputs,o(E,Y)),z(W.dataOutputs,o(w,Y)))}var $=this.handleSubProcess=function(Y,ae){qe(Y,ae),T(Y.artifacts,ae)};function N(W,Y){var ae=l(W,Y);Yn(W,"bpmn:SubProcess")&&$(W,ae||Y),Yn(W,"bpmn:Activity")&&D(W.ioSpecification,Y),n.push(function(){z(W.dataInputAssociations,o(v,Y)),z(W.dataOutputAssociations,o(v,Y))})}function H(W,Y){l(W,Y)}function X(W,Y){l(W,Y)}function Q(W,Y){n.push(function(){var ae=l(W,Y);W.childLaneSet&&ee(W.childLaneSet,ae||Y),oe(W)})}function ee(W,Y){z(W.lanes,o(Q,Y))}function We(W,Y){z(W,o(ee,Y))}function qe(W,Y){Ge(W.flowElements,Y),W.laneSets&&We(W.laneSets,Y)}function Ge(W,Y){z(W,function(ae){Yn(ae,"bpmn:SequenceFlow")?n.push(function(){H(ae,Y)}):Yn(ae,"bpmn:BoundaryEvent")?n.unshift(function(){N(ae,Y)}):Yn(ae,"bpmn:FlowNode")?N(ae,Y):Yn(ae,"bpmn:DataObject")||(Yn(ae,"bpmn:DataStoreReference")||Yn(ae,"bpmn:DataObjectReference")?X(ae,Y):u(`unrecognized flowElement ${Fn(ae)} in context ${Fn(Y&&Y.businessObject)}`,{element:ae,context:Y}))})}function Re(W,Y){var ae=l(W,Y),ge=W.processRef;ge&&m(ge,ae||Y)}function Z(W,Y){z(W.participants,o(Re,Y)),n.push(function(){y(W.messageFlows,Y)}),T(W.artifacts,Y)}function oe(W){z(W.flowNodeRef,function(Y){var ae=Y.get("lanes");ae&&ae.push(W)})}}function nP(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},f=new tP(p);u=u||l.diagrams&&l.diagrams[0];var d=iP(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;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 iP(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=oP(n));var o;M(i,"bpmn:Collaboration")?o=i:o=Ot(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Ot(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Bn(o.participants,function(l){return l.processRef}),r.push(o));var a=sv(r),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function sv(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(sv(n.flowElements)))}),t}function oP(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var rP='<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>',cv=rP,lv={verticalAlign:"middle"},uv={color:"#404040"},aP={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},sP={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},cP={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"},lP='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+cv+'</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>',Xi;function uP(){Xi=Nt(lP),zn(Xi,aP),zn(wt("svg",Xi),lv),zn(wt(".backdrop",Xi),sP),zn(wt(".notice",Xi),cP),zn(wt(".link",Xi),uv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function pP(){Xi||(uP(),ei.bind(Xi,".backdrop","click",function(e){document.body.removeChild(Xi)})),document.body.appendChild(Xi)}const cl=5,pv="djs-outline-hidden";function Gt(e){e=V({},dP,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),gP(this._container)}Ce(Gt,zo),Gt.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(f){throw this._emit("import.parse.complete",{error:f}),f}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||[]),ll(s,r),s=fP(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Gt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Gt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw ll(r,[]),r}if(typeof t=="string"&&(i=hP(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw ll(r,[]),r}try{this.clear()}catch(r){throw ll(r,[]),r}const{warnings:o}=await nP(this,n,i);return{warnings:o}},Gt.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},Gt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=wt(":scope > defs",i._svg),a=Py(o),s=r?"<defs>"+Py(r)+"</defs>":"",c=i.getContainer();Rt(c).add(pv);let l;try{l=o.getBBox()}finally{Rt(c).remove(pv)}const u=l.x-cl,p=l.y-cl,f=l.width+cl*2,d=l.height+cl*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+E.message;if(P)return a.addWarning({message:H,error:E}),!0;throw Io(H)}function u(E,w){return l(E,w,!0)}function p(){var E=a.elementsById,w=a.references,P,T;for(P=0;T=w[P];P++){var L=T.element,$=E[T.id],N=uo(L).propertiesByName[T.property];if($||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),N.isMany){var H=L.get(N.name),X=H.indexOf(T);X===-1&&(X=H.length),$?H[X]=$:H.splice(X,1)}else L.set(N.name,$)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function m(E){if(d.test(E)){var w=g.exec(E),P=w&&w[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function _(E,w){var P=c.peek();try{c.push(P.handleNode(E))}catch(T){l(T,w,r)&&c.push(new Bp)}}function b(E,w){try{c.peek().handleText(E)}catch(P){u(P,w)}}function y(E,w){E.trim()&&b(E,w)}var v=o.getPackages().reduce(function(E,w){return E[w.uri]=w.prefix,E},Object.entries(Ip).reduce(function(E,[w,P]){return E[P]=w,E},o.config&&o.config.nsMap||{}));return s.ns(v).on("openTag",function(E,w,P,T){var L=E.attrs||{},$=Object.keys(L).reduce(function(H,X){var Q=w(L[X]);return H[X]=Q,H},{}),N={name:E.name,originalName:E.originalName,attributes:$,ns:E.ns};_(N,T)}).on("question",m).on("closeTag",f).on("cdata",b).on("text",function(E,w,P){y(w(E),P)}).on("error",l).on("warn",u),new Promise(function(E,w){var P;try{s.parse(e),p()}catch(H){P=H}var T=i.element;!P&&!T&&(P=Io("failed to parse document as <"+i.type.$descriptor.name+">"));var L=a.warnings,$=a.references,N=a.elementsById;return P?(P.warnings=L,w(P)):E({rootElement:T,elementsById:N,references:$,warnings:L})})},Fp.prototype.handler=function(e){return new $p(this.model,e)};function RS(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var CS=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,MS=/<|>|'|"|&|\n\r|\n/g,Ug=/<|>|&/g;function Vi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Vi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Vi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Vi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Vi.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)},Vi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Vi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Vi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Vi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Vi.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 AS(e){return e.charAt(0).toLowerCase()+e.slice(1)}function PS(e,t){return zg(t)?AS(e):e}function qg(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Yg(e){return Zn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function TS(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 kS(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:PS(t.ns.localName,t.$pkg)},e)}function OS(e,t){return V({localName:t.ns.localName},e)}function DS(e){var t=e.$descriptor;return it(t.properties,function(n){var i=n.name;if(n.isVirtual||!Qn(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var LS={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},IS={"<":"lt",">":"gt","&":"amp"};function Kg(e,t,n){return e=Zn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function BS(e){return Kg(e,MS,LS)}function NS(e){return Kg(e,Ug,IS)}function $S(e){return it(e,function(t){return t.isAttr})}function FS(e){return it(e,function(t){return!t.isAttr})}function jp(e){this.tagName=e}jp.prototype.build=function(e){return this.element=e,this},jp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function xr(){}xr.prototype.serializeValue=xr.prototype.serializeTo=function(e){e.append(this.escape?NS(this.value):this.value)},xr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Ug)!==-1&&(this.escape=!0),this};function Hp(e){this.tagName=e}qg(Hp,xr),Hp.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Ht.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=DS(e),this.parseAttributes($S(o)),this.parseContainments(FS(o))),this.parseGenericAttributes(e,i),this},Ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return kS(t,e)},Ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return OS(t,e)},Ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Ht.prototype.nsAttributeName=function(e){var t;if(Zn(e)?t=$n(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}:V({localName:t.localName},n)},Ht.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}))},Ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new xr().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Ht(this).build(i))})},Ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=$n(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)}},Ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},Ht.prototype.parseGenericAttributes=function(e,t){var n=this;z(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)}})},Ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new xr().build(o,r[0]));else if(Ig(o.type))z(r,function(l){n.push(new Hp(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)z(r,function(l){n.push(new jp(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Vg(o);z(r,function(l){var u;c?c===Gg?u=new Ht(t,o):u=new kc(t,o,c):u=new Ht(t),n.push(u.build(l))})}})},Ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Vi(i):t=i),t},Ht.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},Ht.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},Ht.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];z(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},Ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Yg(e)},Ht.prototype.addAttribute=function(e,t){var n=this.attrs;Zn(t)&&(t=BS(t));var i=Ag(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)},Ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=TS(n).concat(t)),z(t,function(i){e.append(" ").append(Yg(i.name)).append('="').append(i.value).append('"')})},Ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==xr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function kc(e,t,n){Ht.call(this,e,t),this.serialization=n}qg(kc,Ht),kc.prototype.parseNsAttributes=function(e){var t=Ht.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},kc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function jS(){this.value="",this.write=function(e){this.value+=e}}function HS(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 zS(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new jS,r=new HS(o,e.format);e.preamble&&r.append(CS);var a=new Ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(GS(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function GS(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Ip)n[i]=Ip[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 Oc(e,t){vi.call(this,e,t)}Oc.prototype=Object.create(vi.prototype),Oc.prototype.fromXML=function(e,t,n){Zn(t)||(n=t,t="bpmn:Definitions");var i=new Fp(V({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Oc.prototype.toXML=function(e,t){var n=new zS(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var VS="BPMN20",WS="http://www.omg.org/spec/BPMN/20100524/MODEL",US="bpmn",qS=[],YS=[{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"}]}],KS=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],XS={tagAlias:"lowerCase",typePrefix:"t"},ZS={name:VS,uri:WS,prefix:US,associations:qS,types:YS,enumerations:KS,xml:XS},QS="BPMNDI",JS="http://www.omg.org/spec/BPMN/20100524/DI",eR="bpmndi",tR=[{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"]}],nR=[{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"}]}],iR=[],oR={name:QS,uri:JS,prefix:eR,types:tR,enumerations:nR,associations:iR},rR="DC",aR="http://www.omg.org/spec/DD/20100524/DC",sR="dc",cR=[{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}]}],lR=[],uR={name:rR,uri:aR,prefix:sR,types:cR,associations:lR},pR="DI",fR="http://www.omg.org/spec/DD/20100524/DI",dR="di",hR=[{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"}]}],gR=[],mR={tagAlias:"lowerCase"},yR={name:pR,uri:fR,prefix:dR,types:hR,associations:gR,xml:mR},vR="bpmn.io colors for BPMN",bR="http://bpmn.io/schema/bpmn/biocolor/1.0",xR="bioc",_R=[{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"}]}],wR=[],ER=[],SR={name:vR,uri:bR,prefix:xR,types:_R,enumerations:wR,associations:ER},RR="BPMN in Color",CR="http://www.omg.org/spec/BPMN/non-normative/color/1.0",MR="color",AR=[{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"}]}],PR=[],TR=[],kR={name:RR,uri:CR,prefix:MR,types:AR,enumerations:PR,associations:TR};const OR={bpmn:ZS,bpmndi:oR,dc:uR,di:yR,bioc:SR,color:kR};function Xg(e,t){const n=V({},OR,e);return new Oc(n,t)}const DR={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"}},Dc={[Tg]:DR,[mp]:Rg};function Zg(){return Xg(Dc)}const Qg=Zg();async function oa(e){const{rootElement:t,warnings:n}=await Qg.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function LR(e){const{xml:t}=await Qg.toXML(e,{format:!0});return t}function zp(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ra={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},IR=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function BR(e){const t=ra;return IR.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 aa(e,t){let n=0;for(const i of e)n+=t*BR(i);return n}function Jg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&NR(e),$R(e),FR(e),jR(e)}function NR(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:aa(o,r),fontBoundingBoxAscent:r*ra.ascentEm,fontBoundingBoxDescent:r*ra.descentEm,actualBoundingBoxAscent:r*ra.ascentEm,actualBoundingBoxDescent:r*ra.descentEm}}};t.getContext=()=>n}function $R(e){if(e.SVGMatrix)return;class t{constructor(){pi(this,"a",1);pi(this,"b",0);pi(this,"c",0);pi(this,"d",1);pi(this,"e",0);pi(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 FR(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),f=Math.sin(u);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*l,a.f=l-f*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(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 jR(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:aa(n,12),height:14}})}const Lc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),HR=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),zR=1,Ic=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),GR=2;function lt(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 em=20,Bc=5,tm=3,VR=8,sa=15,Gp=50,nm=12,WR=nm*1.2;function Vp(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>aa(r,nm))),o=n.length*WR;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const im=1;function bn(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 _r(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 bn(e))for(const s of bn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>im)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>=em&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Wp(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function om(e,t){const n=_r(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function UR(e,t){let n=0;for(const i of t)i.id!==e.id&&om(e,i)&&n++;return n}function di(e,t){let n=0;for(const i of t)i.id!==e.id&&_r(e,i)&&n++;return n}const rm=15,am=20;function qR(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-am||t.at>n[1]+am)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 Up=20;function Nc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>im)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<em||n.push([o-Up,r+Up])}return n}function $c(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of bn(e)){const r=qR(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Nc(o,bn(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const YR=10,KR=1,XR=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function ZR(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 f=(d,g)=>{if(g===0)return d<=0;const h=d/g;if(g>0){if(h>p)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<p&&(p=h)}return!0};return f(o-e.x,c)&&f(e.x-a,-c)&&f(r-e.y,l)&&f(e.y-s,-l)&&p>u}function qp(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 QR=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,ca=1;function Wi(e,t){const n=e.x+ca,i=e.x+e.width-ca,o=e.y+ca,r=e.y+e.height-ca;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 la(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 sm(e,t){const n=e.label;if(!n)return null;if(bn(e).some(i=>Wi(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(bn(i).some(o=>Wi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(la(i).some(o=>Wi(n,o)))return i.id;return null}function Qt(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(ZR(e.waypoints[r],e.waypoints[r+1],o,GR)){i.push(o);break}}return i}const os=(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))},JR=(e,t,n,i)=>lm(e,t,n,i)?0:Math.min(os(e,n,i),os(t,n,i),os(n,e,t),os(i,e,t)),cm=(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 rs(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,os({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(cm(e,s)||cm(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,JR(e,t,s[l],s[(l+1)%s.length]));return c}function lm(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 Yp=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function um(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(lm(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function as(e,t){let n=0;for(const i of t)i.id===e.id||Yp(e,i)||um(e,i)&&n++;return n}function hi(e,t){let n=0;for(const i of t)i.id===e.id||Yp(e,i)||as(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function pm(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++)as(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function ua(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(as(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 Bo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(Yp(n[i],n[o])&&um(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 fm(e){const t=ua(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:eC(e)}}function eC(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 dm(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Ic.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 hm(e){var n;const t=(n=$t(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=$t(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 gm=e=>e?{members:e}:{},ei=e=>e.shapes.filter(t=>!t.container);function tC(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 nC(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 mm(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(bn(i).some(o=>Wi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(la(i).some(o=>Wi(n,o)))return i.id;return null}function wr(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 ym=3;function vm(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 ss(e,t){const n=[];for(const i of t.shapes){if(i.container||Ic.has(i.type))continue;const o=vm(e,i);o>=ym&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function ft(e,t={}){const n=[],i=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of Qt(y,i))n.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const o=e.shapes.filter(y=>y.container&&HR.has(y.type));if(o.length){const y=(v,E)=>{const w=e.shapes.find(P=>P.id===E);return!!w&&w.x>=v.x&&w.y>=v.y&&w.x+w.width<=v.x+v.width&&w.y+w.height<=v.y+v.height};for(const v of e.edges)for(const E of Qt(v,o))v.endpoints.includes(E.id)||v.endpoints.some(w=>y(E,w))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:E.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const v=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[E,w]of v){if(!E)continue;const P=e.shapes.find(N=>N.id===E);if(!P||P.container)continue;const T=Math.max(P.x-w.x,w.x-(P.x+P.width),0),L=Math.max(P.y-w.y,w.y-(P.y+P.height),0),$=Math.hypot(T,L);$>YR&&n.push({kind:"edge-endpoint-detached",edge:y.id,shape:E,distance:Math.round($)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const E=r[y],w=r[v];if(E.x+E.width<=w.x||w.x+w.width<=E.x||E.y+E.height<=w.y||w.y+w.height<=E.y)continue;const P=(T,L)=>T.x<=L.x&&T.y<=L.y&&T.x+T.width>=L.x+L.width&&T.y+T.height>=L.y+L.height;n.push({kind:"pool-overlap",pools:[E.id,w.id],contained:P(E,w)||P(w,E)})}const a=i.filter(y=>!y.attached);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const E=a[y],w=a[v];if(!qp(E,w,zR))continue;const P=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:"shape-overlap",shapes:P,identical:QR(E,w)})}const s=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<s.length;y++)for(let v=y+1;v<s.length;v++){const E=s[y],w=s[v],P=Math.min(E.x+E.width,w.x+w.width)-Math.max(E.x,w.x),T=Math.min(E.y+E.height,w.y+w.height)-Math.max(E.y,w.y);if(P<=Bc||T<=Bc)continue;const L=E.id<w.id?[E.id,w.id]:[w.id,E.id],$=new Set(w.members);if(E.members.some(H=>$.has(H))){const H=dm(e,s,{x:Math.max(E.x,w.x),y:Math.max(E.y,w.y),right:Math.min(E.x+E.width,w.x+w.width),bottom:Math.min(E.y+E.height,w.y+w.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:L,shapes:H});continue}const N=E.x<=w.x&&E.y<=w.y&&E.x+E.width>=w.x+w.width&&E.y+E.height>=w.y+w.height?E.id:w.x<=E.x&&w.y<=E.y&&w.x+w.width>=E.x+E.width&&w.y+w.height>=E.y+E.height?w.id:void 0;n.push({kind:"group-overlap-unintended",groups:L,...N?{container:N}:{}})}const c=new Set(s.flatMap(y=>[...y.members])),l=y=>e.shapes.filter(v=>!v.container&&!Ic.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of s){const v=l(y);if(!v.length)continue;const E=new Set(y.members),w=v.filter(P=>!E.has(P.id));w.some(P=>c.has(P.id))&&(w.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:w.map(P=>P.id).sort()}))}for(const y of s){const v=new Set(l(y).map($=>$.id)),E=new Set(y.members),w=new Set([...v].filter($=>!E.has($)&&c.has($)));if(!w.size)continue;let P=!1,T=!1,L=!1;for(const $ of e.edges){if($.type!=="bpmn:SequenceFlow"||!$.source||!$.target)continue;const N=w.has($.source),H=w.has($.target);!N&&H&&!v.has($.source)?P=!0:N&&!H&&!v.has($.target)?T=!0:N&&H&&(L=!0)}P&&T&&L&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...w].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let v=y+1;v<u.length;v++)for(let E=v+1;E<u.length;E++){const w=[u[y],u[v],u[E]],P={x:Math.max(...w.map($=>$.x)),y:Math.max(...w.map($=>$.y)),right:Math.min(...w.map($=>$.x+$.width)),bottom:Math.min(...w.map($=>$.y+$.height))};if(P.right-P.x<=Bc||P.bottom-P.y<=Bc)continue;const T=dm(e,[],P);if(!T.length)continue;const L=w.map($=>$.id).sort();n.push({kind:"group-stack-unreadable",groups:L,shapes:T})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Ic.has(v.type)||v.width<=0||v.height<=0)continue;const E=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[w,P,T,L,$]of E){const N=T==="h"?v.x:v.y,H=T==="h"?v.x+v.width:v.y+v.height;if(!(N<$&&L<H))continue;const X=T==="h"?v.y:v.x,Q=T==="h"?v.y+v.height:v.x+v.width;if(!(X<P&&P<Q))continue;const ee=Math.min(P-X,Q-P);ee<VR||n.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:w,depth:ee})}}const p=t.includeObservationOnly?e.shapes.filter(y=>y.type==="bpmn:Group"&&y.width>0&&y.height>0):[];if(p.length){const y=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 E=bn(v);if(E.length)for(const w of p){const P=w.x+w.width,T=w.y+w.height,L=v.endpoints.some(N=>{const H=y.get(N);return!!H&&w.x<H.x&&H.x<P&&w.y<H.y&&H.y<T});let $=null;for(const N of E){const[H,X,Q]=N.axis==="v"?[w.y,T,[["left",w.x],["right",P]]]:[w.x,P,[["top",w.y],["bottom",T]]],ee=Math.min(N.hi,X)-Math.max(N.lo,H);if(ee<Gp)continue;const We=N.axis==="v"?w.x<N.at&&N.at<P:w.y<N.at&&N.at<T;if(!(We&&L))for(const[qe,Ge]of Q){const Se=Math.abs(N.at-Ge);Se<=sa&&(!$||Se<$.distance)&&($={side:qe,inside:We,distance:Se,length:ee})}}$&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:w.id,side:$.side,inside:$.inside,distance:Math.round($.distance),length:Math.round($.length)})}}}const f=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of f){const E=y.x<v.x+v.width&&v.x<y.x+y.width,w=y.y<v.y+v.height&&v.y<y.y+y.height,P=[["top",y.y,v.y,E],["bottom",y.y+y.height,v.y+v.height,E],["left",y.x,v.x,w],["right",y.x+y.width,v.x+v.width,w]];for(const[T,L,$,N]of P)N&&Math.abs(L-$)<=tm&&n.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:T})}const d=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<d.length;y++)for(let v=y+1;v<d.length;v++){const E=d[y],w=d[v],P=E.x<w.x+w.width&&w.x<E.x+E.width,T=E.y<w.y+w.height&&w.y<E.y+E.height,L=[["x",E.x+E.width,w.x,T],["x",w.x+w.width,E.x,T],["y",E.y+E.height,w.y,P],["y",w.y+w.height,E.y,P]];for(const[$,N,H,X]of L)if(X&&Math.abs(N-H)<=tm){n.push({kind:"group-on-group-boundary",groups:E.id<w.id?[E.id,w.id]:[w.id,E.id],axis:$});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const E=e.edges[y],w=e.edges[v],P=_r(E,w);if(!P)continue;const T=E.id<w.id?[E.id,w.id]:[w.id,E.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const y of e.edges){if(!y.label)continue;const v=$c(y,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:y.id,other:v.other,axis:v.axis})}for(const y of e.edges){if(!y.label)continue;const v=sm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}if(t.includeObservationOnly){for(const y of e.edges)if(!(!y.label||y.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:E}of ss(y.label,e))n.push({kind:"label-over-shape",edge:y.id,shape:v,depth:Math.round(E)})}const g=new Set(i.map(y=>y.id)),h=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...i,...h.filter(v=>!g.has(v.id))]){if(!y.label)continue;const v=mm(y,e);v&&n.push({kind:"label-over-line",edge:y.id,line:v})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of h)for(const{owner:v,rect:E}of wr(e))v===y.id||m.has(v)||qp(y.label,E,ca)&&n.push({kind:"pool-name-over-label",pool:y.id,label:v});const _=wr(e);for(const y of i)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:E}of _)v!==y.id&&qp(y,E,ca)&&n.push({kind:"annotation-over-label",annotation:y.id,label:v});const b=new Map(e.shapes.map(y=>[y.id,y]));for(const y of i){const v=y.parent??tC(y,e,b);if(!v)continue;const E=b.get(v);!E||!E.container||XR(E,y,KR)||y.type==="bpmn:TextAnnotation"&&!nC(y,E,e)||n.push({kind:"shape-outside-container",shape:y.id,container:E.id})}return n.sort((y,v)=>lt(y).localeCompare(lt(v)))}const $t=e=>typeof e=="object"&&e!==null?e:void 0,Kt=e=>typeof e=="number"?e:0,po=e=>{const t=$t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function iC(e){const t=$t(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=po(r);a&&n.push(a)}}return n}function oC(e){const t=$t(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:po(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:po(t.targetRef);return n&&i?{source:n,target:i}:{}}function rC(e,t){const n=$t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=po(n);return o?t.get(o):void 0}if(Lc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return po(n)}function bm(e){var a,s,c,l,u;const t=[],n=[],i=((a=$t(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=$t(e))==null?void 0:s.rootElements)??[]){const f=$t(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const g=$t(d),h=po(g),m=po(g==null?void 0:g.processRef);h&&m?o.set(m,h):h&&r.add(h)}}for(const p of i){const f=$t((c=$t(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const g of d){const h=$t(g);if(!h)continue;const m=$t(h.bpmnElement),_=typeof(m==null?void 0:m.id)=="string"?m.id:void 0;if(!_)continue;const b=typeof(m==null?void 0:m.$type)=="string"?m.$type:"",y=$t(h.bounds);if(y){const E=h.isExpanded===!1&&b!=="bpmn:Participant",w=$t((l=$t(h.label))==null?void 0:l.bounds),P={id:_,type:b,x:Kt(y.x),y:Kt(y.y),width:Kt(y.width),height:Kt(y.height),container:Lc.has(b)&&!E,attached:(m==null?void 0:m.attachedToRef)!==void 0,...m?{parent:rC(m,o)}:{},...w?{label:{x:Kt(w.x),y:Kt(w.y),width:Kt(w.width),height:Kt(w.height)}}:{},...b==="bpmn:Group"?gm(hm(m)):{}},T=h.isHorizontal!==!1,L=typeof(m==null?void 0:m.name)=="string"?m.name:"";r.has(_)&&T&&L&&(P.label=Vp(P,L)),t.push(P);continue}const v=h.waypoint;if(Array.isArray(v)){const E=$t((u=$t(h.label))==null?void 0:u.bounds);n.push({id:_,type:b,waypoints:v.map(w=>{var P,T;return{x:Kt((P=$t(w))==null?void 0:P.x),y:Kt((T=$t(w))==null?void 0:T.y)}}),endpoints:iC(m),...oC(m),...E?{label:{x:Kt(E.x),y:Kt(E.y),width:Kt(E.width),height:Kt(E.height)}}:{}})}}}return{shapes:t,edges:n}}function xm(e){return ft(bm(e),{includeObservationOnly:!0})}async function aC(e){const{definitions:t,warnings:n}=await oa(e);return{findings:xm(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=$t(r.label),m=po(r.source),_=po(r.target);n.push({id:r.id,type:a,waypoints:s.map(b=>({x:Kt(b.x),y:Kt(b.y)})),endpoints:[m,_].filter(b=>!!b),...m&&_?{source:m,target:_}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Kt(h.y),width:Kt(h.width),height:Kt(h.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=$t(r.businessObject),l=$t(r.label);let u=$t(r.parent);for(;u&&u.type==="bpmn:Lane";)u=$t(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",f=u&&Lc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:r.id,type:a,x:r.x,y:r.y,width:Kt(r.width),height:Kt(r.height),container:Lc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Kt(l.y),width:Kt(l.width),height:Kt(l.height)}}:{},...a==="bpmn:Group"?gm(hm(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=$t(r.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Vp(d,g)),t.push(d)}return{shapes:t,edges:n}}const sC={"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 cC(e,t){const n=sC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function _m(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function wm(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 cC(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&_m(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?_m(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 gp(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Oo(i.businessObject).map(o=>o.locale)}}}const Kp=20,lC=4,ot=(e,t)=>Math.abs(e-t)<.5;function Fc(e,t,n,i=Kp){if(ot(e.y,t.y)&&!ot(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(ot(e.x,t.x)&&!ot(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 Em(e,t,n,i=Kp){if(n.length<2)return null;if(ot(e.y,t.y)&&!ot(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(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(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[f(u),f(p)]}if(ot(e.x,t.x)&&!ot(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(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(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[f(u),f(p)]}return null}function Sm(e,t,n=Kp){if(e.length!==4)return null;const[i,o,r,a]=e;if(ot(i.y,o.y)&&ot(o.x,r.x)&&ot(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(ot(i.x,o.x)&&ot(o.y,r.y)&&ot(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 Hc=30,uC=[0,-25,25,-40,40];function pC(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const 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+Hc:s-Hc,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return uC.map(f=>[{x:u,y:s},{x:u,y:c},{x:p+f,y:c},{x:p+f,y:l}]).filter(f=>Qt({...e,endpoints:[],waypoints:f},[n]).length===0)}const Xp=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],pa=(e,t,n)=>Qt({...e,waypoints:t},n).length;function Zp(e,t,n,i){let o=[...e.waypoints],r=pa(e,o,t);if(r===0)return null;let a=!1;for(const p of jc(e,t))if(pa(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(bn),c=p=>bn({...e,waypoints:p}).some(f=>Nc(f,s).length>0),l=pC(e,t).filter(p=>pa(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&ot(p.y+p.height/2,f.y+f.height/2)){const d=[o[0],o[o.length-1]];if(ot(d[0].y,d[1].y)&&!ot(d[0].x,d[1].x)){const g=t.filter(b=>!e.endpoints.includes(b.id)&&Qt({...e,waypoints:d},[b]).length>0),h=g.length>=2?Em(d[0],d[1],g):null,_=(h?h.map(b=>[d[0],...b,d[1]]):g.length===1?(Fc(d[0],d[1],g[0])??[]).map(b=>[d[0],...b,d[1]]):g.length===0?[d]:[]).filter(b=>pa(e,b,t)===0&&b.length<=o.length).sort((b,y)=>Number(u(y))-Number(u(b)));if(_.length)return _.find(b=>!c(b))??_[0]}}}for(let p=0;p+1<o.length;p++){const f=o[p],d=o[p+1],g=t.filter(_=>!e.endpoints.includes(_.id)&&Qt({...e,waypoints:[f,d]},[_]).length>0);if(g.length<2)continue;const h=Em(f,d,g);if(!h)continue;const m=h.map(_=>Xp(o,p,_)).filter(_=>pa(e,_,t)===0).sort((_,b)=>Number(u(b))-Number(u(_)));if(m.length)return m.find(_=>!c(_))??m[0]}for(let p=0;p<lC&&r>0;p++){let f=!1;for(let d=0;d+1<o.length&&!f;d++){const g=o[d],h=o[d+1];for(const m of t){if(e.endpoints.includes(m.id)||Qt({...e,waypoints:[g,h]},[m]).length===0)continue;const _=Fc(g,h,m),b=_?_.map(v=>Xp(o,d,v)):Sm(o,m)??[];if(!b.length)continue;const y=[...b].sort((v,E)=>Number(u(E))-Number(u(v)));for(const v of y){const E=pa(e,v,t);if(E<r){o=v,r=E,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&r===0?o:null}function Qp(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=ei(r),s=new Set,c=ft(r).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(lt(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(f=>f.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const f=i.get(u);if(!f)continue;const d=f.parent,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=Qt(p,a);if(!n&&h.length&&h.every(v=>v.type==="bpmn:TextAnnotation")){s.add(u);continue}const m=Zp(p,a,g,r.edges);if(!m){h.some(v=>v.type==="bpmn:TextAnnotation")&&s.add(u);continue}const _=r.edges.filter(v=>v.id!==u),b=di(p,_);di({...p,waypoints:m},_)>b||o.updateWaypoints(f,m)}return s}const fC=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 Jp(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 ef=(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),tf=(e,t)=>as(e,[t])>0;function Rm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=ei(r);let s=r;const c=new Set(ft(r).map(lt));for(const[l,u]of ua(r))if(!t.has(`${l}|${u}`))for(const[p,f]of[[l,u],[u,l]]){if(n.has(p))continue;const d=s.edges.find(P=>P.id===p),g=s.edges.find(P=>P.id===f);if(!d||!g)continue;const h=i.get(p);if(!h)continue;const m=Jp(h),_=fC(g),b=[...jc(d,a)??[]],y=Zp(d,[...a,..._],m,r.edges);y&&b.push(y);for(let P=0;P+1<d.waypoints.length;P++)for(const T of _)for(const L of Fc(d.waypoints[P],d.waypoints[P+1],T)??[])b.push(Xp(d.waypoints,P,L));const v=s.edges.filter(P=>P.id!==p),E=P=>({...s,edges:s.edges.map(T=>T.id===p?{...T,waypoints:P}:T)}),w=b.find(P=>{const T={...d,waypoints:P};return tf(T,g)||!ef(P,m)||v.some(L=>L.id!==f&&!tf(d,L)&&tf(T,L))?!1:ft(E(P)).every(L=>c.has(lt(L)))});if(w){o.updateWaypoints(h,w),s=E(w);break}}}const dC=["top","bottom","left","right"],Cm={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},cs=20,hC=20;function gC(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&&ot(e.y,t.y)&&o.push("top"),n&&ot(e.y,t.y+t.height)&&o.push("bottom"),i&&ot(e.x,t.x)&&o.push("left"),i&&ot(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const mC=(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 Mm(e,t,n,i){const o=Cm[t],r=Cm[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",f=a?"x":"y",d=o[p],g=r[p];if(ot(e[f],n[f]))return d===-g&&d*(n[p]-e[p])>=cs?[e,n]:null;let h;if(d===-g){const _=e[p]+d*cs,b=n[p]-d*cs;if(d*(b-_)<0)return null;h=Math.round((e[p]+n[p])/2)}else h=d>0?Math.max(e[p],n[p])+Hc:Math.min(e[p],n[p])-Hc;const m=(_,b)=>a?{x:b,y:_}:{x:_,y:b};return[e,m(h,e[f]),m(h,n[f]),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>=cs&&u>=cs?[e,c,n]:null}function yC(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?gC(a,r):null;if(!s)return[];const c=[];for(const l of dC){const u=mC(t,l),p=o?Mm(u,l,a,s):Mm(a,s,u,l);p&&c.push(p)}return c}const Am=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 vC(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(ft(r).map(lt));let c=r;for(const[l,u]of Bo(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(L=>L.id===l),f=c.edges.find(L=>L.id===u);if(!p||!f||p.type!=="bpmn:SequenceFlow"||f.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Bo({edges:[p,f]}).length)continue;const d=p.endpoints.find(L=>f.endpoints.includes(L)),g=d?a.get(d):void 0;if(!g||g.container)continue;const h=i.get(l),m=i.get(u);if(!h||!m)continue;const _=L=>n.has(L.id)?[L.waypoints]:[L.waypoints,...yC(L,g,a)],b=L=>L.length-2,y=_(p).flatMap(L=>_(f).map($=>({pa:L,pb:$}))).filter(({pa:L,pb:$})=>L!==p.waypoints||$!==f.waypoints).map(L=>({...L,cost:Am(L.pa)+Am(L.pb)+hC*(b(L.pa)+b(L.pb))})).sort((L,$)=>L.cost-$.cost),v=Jp(h),E=Jp(m),w=Bo(c).length,P=new Set(ua(c).map(([L,$])=>`${L}|${$}`)),T=y.find(({pa:L,pb:$})=>{const N={...p,waypoints:L},H={...f,waypoints:$};if(Bo({edges:[N,H]}).length||_r(N,H)||!ef(L,v)||!ef($,E))return!1;const X={...c,edges:c.edges.map(Q=>Q.id===l?N:Q.id===u?H:Q)};return Bo(X).length>=w||ua(X).some(([Q,ee])=>!P.has(`${Q}|${ee}`))?!1:ft(X).every(Q=>s.has(lt(Q)))});T&&(T.pa!==p.waypoints&&o.updateWaypoints(h,T.pa),T.pb!==f.waypoints&&o.updateWaypoints(m,T.pb),c={...c,edges:c.edges.map(L=>L.id===l?{...p,waypoints:T.pa}:L.id===u?{...f,waypoints:T.pb}:L)})}}const bC=10;function Pm(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 Tm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),o=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!o)return null;const r=Pm(i,n),a=Pm(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(H=>H.id!==r.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,X)=>H.y-X.y);if(!u.length)return null;const p=u[0],f=u[u.length-1],d=(c.y+c.height+p.y)/2,g=(f.y+f.height+l.y)/2,h=s?d:g,m=s?g:d,_=e.waypoints[0],b=e.waypoints[e.waypoints.length-1],y=ei(t),v=t.edges.filter(H=>H.id!==e.id),E=hi(e,v),w=Qt(e,y).length;if(E===0&&w===0||w===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),L=(_.x+b.x)/2,$=H=>H.filter((X,Q)=>Q===0||!(ot(X.x,H[Q-1].x)&&ot(X.y,H[Q-1].y)));let N;for(let H=P;H<=T;H+=bC){const X=$([_,{x:_.x,y:h},{x:H,y:h},{x:H,y:m},{x:b.x,y:m},b]),Q={...e,waypoints:X};if(Qt(Q,y).length>0)continue;const ee=hi(Q,v),We=Math.abs(H-L);(!N||ee<N.cross||ee===N.cross&&We<N.detour)&&(N={pts:X,cross:ee,detour:We})}return N&&(w>0?N.cross<=E:N.cross<E)?N.pts:null}const xC=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function _C(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=ei(a);for(const p of t.edges){if(!xC.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const f=i.get(p.id);if(!(f!=null&&f.waypoints)||((l=f.source)==null?void 0:l.id)!==p.source||((u=f.target)==null?void 0:u.id)!==p.target)continue;const d=r.get(p.source),g=r.get(p.target),h=s.get(p.source),m=s.get(p.target);if(!d||!g||!h||!m||!ot(d.width,h.width)||!ot(d.height,h.height)||!ot(g.width,m.width)||!ot(g.height,m.height))continue;const _=h.x-d.x,b=h.y-d.y;if(ot(_,0)&&ot(b,0)||!ot(m.x-g.x,_)||!ot(m.y-g.y,b))continue;const y=p.waypoints.map(w=>({x:w.x+_,y:w.y+b})),v=f.waypoints.map(w=>({x:w.x,y:w.y}));v.length===y.length&&v.every((w,P)=>ot(w.x,y[P].x)&&ot(w.y,y[P].y))||v.length===2&&(ot(v[0].x,v[1].x)||ot(v[0].y,v[1].y))&&Qt({...p,waypoints:v},c).length===0||Qt({...p,waypoints:y},c).length>0||o.updateWaypoints(f,y)}}function km(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=Tm(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Ui=[25,-25,40,-40],fa=35;function wC(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)-fa:Math.max(e.y+e.height,t.y+t.height)+fa,p=SC(e,t,s,u,n),f=p===null?[[u,0]]:[[u,0],[p,EC]];for(const[d,g]of f)for(const h of[0,...Ui])if(!(Math.abs(h)>=e.width/2-5))for(const m of[0,...Ui]){if(Math.abs(m)>=t.width/2-5)continue;const _=i+h,b=o+m,y=[{x:_,y:c},{x:_,y:d},{x:b,y:d},{x:b,y:l}];g&&Qt({endpoints:[],waypoints:y},a).length||r.push({pts:y,cost:g+Math.abs(m)+Math.abs(h)})}}return r}const EC=45,zc=20;function SC(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(m=>m.container&&(m.type==="bpmn:Lane"||m.type==="bpmn:Participant")&&r>=m.x&&r<=m.x+m.width&&e.y>=m.y&&e.y+e.height<=m.y+m.height).sort((m,_)=>m.width*m.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(m=>!m.container&&m.id!==e.id&&m.id!==t.id),f=p.filter(m=>m.x<c&&m.x+m.width>s&&(n?m.y<l&&m.y+m.height>i:m.y+m.height>l&&m.y<i));if(!f.length)return null;const d=[...p,...p.flatMap(m=>m.label?[m.label]:[])].filter(m=>m.x<c&&m.x+m.width>s);if(n){let m=Math.min(...f.map(b=>b.y));for(let b=!0;b;){b=!1;for(const y of d)y.y<m&&y.y<l&&y.y+y.height>m-zc&&(m=y.y,b=!0)}const _=Math.max(u.y,...d.filter(b=>b.y+b.height<=m).map(b=>b.y+b.height));return m-_>=zc?Math.round((m+_)/2):null}let g=Math.max(...f.map(m=>m.y+m.height));for(let m=!0;m;){m=!1;for(const _ of d)_.y+_.height>g&&_.y+_.height>l&&_.y<g+zc&&(g=_.y+_.height,m=!0)}const h=Math.min(u.y+u.height,...d.filter(m=>m.y>=g).map(m=>m.y));return h-g>=zc?Math.round((g+h)/2):null}function Gc(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 wC(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-fa:n.y+n.height+fa,p=[];for(const b of[0,...Ui]){if(Math.abs(b)>=i.width/2-5)continue;const y=r+b;p.push({pts:[{x:n.x,y:o},{x:y,y:o},{x:y,y:c}],cost:Math.abs(b)});for(const v of[0,...Ui]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:y,y:u},{x:y,y:c}],cost:Math.abs(b)+Math.abs(v)})}}const f=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const b of[0,...Ui]){if(Math.abs(b)>=n.width/2-5)continue;const y=a+b;p.push({pts:[{x:y,y:g},{x:y,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(b)})}const h=60,m=s?i.y+i.height:i.y,_=s?i.y+i.height+fa:i.y-fa;for(const b of[0,...Ui]){if(Math.abs(b)>=i.width/2-5)continue;const y=r+b;for(const v of[0,...Ui]){if(Math.abs(v)>=n.width/2-5)continue;const E=a+v;p.push({pts:[{x:E,y:g},{x:E,y:_},{x:y,y:_},{x:y,y:m}],cost:h+Math.abs(b)+Math.abs(v)})}}return p}const Vc=30;function Om(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],o=e[n+1],r=ot(i.y,o.y)&&!ot(i.x,o.x),a=ot(i.x,o.x)&&!ot(i.y,o.y);if(!(!r&&!a))for(const s of t)if(r){const c=Math.min(i.x,o.x);if(Math.max(i.x,o.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Vc||Math.abs(i.y-(s.y+s.height))<Vc)return!0}else{const c=Math.min(i.y,o.y);if(Math.max(i.y,o.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Vc||Math.abs(i.x-(s.x+s.width))<Vc)return!0}}return!1}const Wc=40;function RC(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-Wc,a=o.x+o.width+Wc,s=o.y-Wc,c=o.y+o.height+Wc;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],f={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},d={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(f.x<a&&d.x>r&&f.y<c&&d.y>s){i++;break}}}return i}function Dm(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),o=ei(t),r=t.edges.filter(w=>w.id!==e.id),a=di(e,r),s=hi(e,r),c=w=>RC(w,t.shapes,e.endpoints)+(Om(w,n)?1:0),l=c(e.waypoints),u=w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.find(L=>L.type==="bpmn:Lane"&&P>=L.x&&P<=L.x+L.width&&T>=L.y&&T<=L.y+L.height)},p=u(i.get(e.endpoints[0]??"")),f=u(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,g=w=>{if(!d||!f)return!1;for(let P=1;P<w.length-2;P++){const T=w[P],L=w[P+1];if(ot(T.y,L.y)&&!ot(T.x,L.x)&&T.y>f.y&&T.y<f.y+f.height)return!0}return!1},h=g(e.waypoints),_=(w=>{if(!w)return;const P=w.x+w.width/2,T=w.y+w.height/2;return n.filter(L=>L.type==="bpmn:Participant"&&P>=L.x&&P<=L.x+L.width&&T>=L.y&&T<=L.y+L.height).sort((L,$)=>L.width*L.height-$.width*$.height)[0]})(i.get(e.endpoints[0]??"")),b=w=>{if(!_)return 0;let P=0;for(let T=1;T<w.length-1;T++){const L=w[T];(L.x<_.x||L.x>_.x+_.width||L.y<_.y||L.y>_.y+_.height)&&P++}return P},y=b(e.waypoints);if(!Om(e.waypoints,n)&&!(d&&!h)&&y===0)return null;const v=w=>w.reduce((P,T,L)=>L?P+Math.abs(T.x-w[L-1].x)+Math.abs(T.y-w[L-1].y):0,0);let E;for(const{pts:w,cost:P}of Gc(e,i)){const T={...e,waypoints:w};if(Qt(T,o).length>0)continue;const L=di(T,r);if(L>a)continue;const $=b(w);if($>y)continue;const N=$<y&&L===0;if(!N&&hi(T,r)>s)continue;const H=c(w),X=g(w);if(!N&&!(X&&!h)&&H>=l)continue;const ee=X?0:1,We=v(w);(!E||$<E.out||$===E.out&&(ee<E.lane||ee===E.lane&&(L<E.opp||L===E.opp&&(H<E.sc||H===E.sc&&(P<E.cost||P===E.cost&&We<E.len)))))&&(E={pts:w,out:$,sc:H,lane:ee,opp:L,cost:P,len:We})}return(E==null?void 0:E.pts)??null}function CC(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 MC(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(m=>m.id===a);if(!c||c.waypoints.length<4)continue;const l=ei(s),u=s.edges.filter(m=>m.id!==a),p=Qt(c,l).length,f=di(c,u),d=hi(c,u),g=n.has(a)?new Set(ft(s).map(lt)):null,h=jc(c,s.shapes);h.length===2&&CC(c,s)&&h.reverse();for(const m of h){if(m.length>=c.waypoints.length)continue;const _={...c,waypoints:m};if(Qt(_,l).length>p||di(_,u)>f||hi(_,u)>d)continue;if(g){const y=new Set(ft({...s,edges:s.edges.map(w=>w.id===a?_:w)}).map(lt)),v=[...y].filter(w=>!g.has(w)).length,E=[...g].filter(w=>!y.has(w)).length;if(v>E)continue}const b=i.get(a);b&&o.updateWaypoints(b,m);break}}}function Lm(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=Dm(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function nf(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=ot(n[0].x,n[1].x)&&!ot(n[0].y,n[1].y),s=ot(n[n.length-1].x,n[n.length-2].x)&&!ot(n[n.length-1].y,n[n.length-2].y);for(const c of Ui){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}function AC(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,f=a?n.x+n.width:n.x,d=r?n.y+n.height:n.y,g=a?i.x:i.x+i.width,h=r?i.y:i.y+i.height,m=[];for(const _ of[0,...Ui])Math.abs(_)<i.width/2-5&&m.push({pts:[{x:f,y:l},{x:u+_,y:l},{x:u+_,y:h}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&m.push({pts:[{x:c,y:d},{x:c,y:p+_},{x:g,y:p+_}],cost:Math.abs(_)});return m}function of(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 f of[0,...Ui]){const d=u+f;d<=o||d>=r||p.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(f)})}return p}function Im(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ei(t),o=t.edges.filter(d=>d.id!==e.id),r=di(e,o);if(r===0)return null;const a=hi(e,o);let s;const c=d=>d.reduce((g,h,m)=>m?g+Math.abs(h.x-d[m-1].x)+Math.abs(h.y-d[m-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],m=Math.hypot(h.x-g.x,h.y-g.y);return m>=1&&c(d)/m>=l?1:0},p=u(e.waypoints),f=[...Gc(e,n),...of(e,n),...nf(e,n)];for(const{pts:d,cost:g}of f){const h={...e,waypoints:d};if(Qt(h,i).length>0)continue;const m=di(h,o),_=hi(h,o),b=r-m+(p-u(d));if(m>=r||_-a>b)continue;const y=c(d);(!s||m<s.opposite||m===s.opposite&&(_<s.cross||_===s.cross&&(g<s.cost||g===s.cost&&y<s.len)))&&(s={pts:d,opposite:m,cross:_,cost:g,len:y})}return(s==null?void 0:s.pts)??null}function Bm(e,t){var i;let n=0;for(const o of t)o.id!==e.id&&((i=_r(e,o))==null?void 0:i.kind)==="unrelated"&&n++;return n}function PC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ei(t),o=t.edges.filter(f=>f.id!==e.id),r=Bm(e,o);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Gc(e,n),...of(e,n),...AC(e,n),...nf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Qt(g,i).length>0)continue;const h=Bm(g,o);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const b=c(f);(!u||h<u.fake||h===u.fake&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&b<u.length))))&&(u={pts:f,fake:h,unreadable:m,cross:_,cost:d,length:b})}return(u==null?void 0:u.pts)??null}function Nm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ft(Ve(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(lt(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(f=>f.id===s);if(!l)continue;const u=PC(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function $m(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 Fm(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=_r(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:$m(e,n)&&$m(t,n)}function jm(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Fm(e,o,n)&&i++;return i}function TC(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=ei(t),o=t.edges.filter(f=>f.id!==e.id),r=jm(e,o,n);if(r===0)return null;const a=di(e,o),s=hi(e,o),c=f=>f.reduce((d,g,h)=>h?d+Math.abs(g.x-f[h-1].x)+Math.abs(g.y-f[h-1].y):0,0),l=2;let u;const p=[...Gc(e,n),...of(e,n),...nf(e,n)];for(const{pts:f,cost:d}of p){const g={...e,waypoints:f};if(Qt(g,i).length>0)continue;const h=jm(g,o,n);if(h>=r)continue;const m=di(g,o);if(m-h>a-r)continue;const _=hi(g,o);if(_-s>(r-h)*l)continue;const b=c(f);(!u||h<u.chain||h===u.chain&&(m<u.unreadable||m===u.unreadable&&(_<u.cross||_===u.cross&&(d<u.cost||d===u.cost&&b<u.length))))&&(u={pts:f,chain:h,unreadable:m,cross:_,cost:d,length:b})}return(u==null?void 0:u.pts)??null}function kC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ft(r).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(lt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,p]=l.edges.map(f=>r.edges.find(d=>d.id===f));if(!(!u||!p||!Fm(u,p,a)))for(const f of l.edges)n.has(f)||c.add(f)}for(const l of[...c].sort()){const u=Ve(i),p=u.edges.find(g=>g.id===l);if(!p)continue;const f=TC(p,u);if(!f)continue;const d=i.get(l);d&&o.updateWaypoints(d,f)}}function Hm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=ft(r).filter(u=>Wp(u)&&!t.has(lt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Wp(u))for(const p of u.edges)n.has(p)||s.add(p);const c=u=>{var p;return((p=r.edges.find(f=>f.id===u))==null?void 0:p.type)??""},l=[...s].sort((u,p)=>{const f=c(u)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:u.localeCompare(p)});for(const u of l){const p=Ve(i),f=p.edges.find(h=>h.id===u);if(!f)continue;const d=Im(f,p);if(!d)continue;const g=i.get(u);g&&o.updateWaypoints(g,d)}}const OC=10,DC=(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 zm(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!$c(e,i))return null;const o=ei(t),r=i.flatMap(bn);for(const a of bn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Nc(a,r))s=s.flatMap(([h,m])=>{const _=[];return d>h&&_.push([h,Math.min(m,d)]),g<m&&_.push([Math.max(h,g),m]),_.filter(([b,y])=>y>b)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+OC*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-rm}:{x:a.at+Pn+n.width/2,y:u},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!$c({...e,label:f},i)&&!o.some(d=>!e.endpoints.includes(d.id)&&DC(f,d)))return f}return null}const Pn=8;function rf(e,t){const n=e.label;if(!n)return null;const i=bn(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=f=>{const d=f.axis==="h"?o:r,g=f.axis==="h"?r-f.at:o-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(g,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(bn),...t.shapes.filter(f=>f.container).flatMap(la)],l=f=>!c.some(d=>Wi(f,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Pn,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const f of[s.at+Pn,s.at-Pn-n.width])for(const d of p){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:f,y:g};if(l(h))return h}else for(const f of[s.at-Pn-n.height,s.at+Pn])for(const d of p){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:f};if(l(h))return h}return null}const Gm=30,LC=(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},Vm=(e,t)=>LC({x:e.x+e.width/2,y:e.y+e.height/2},t);function IC(e,t){const n=e.label;if(!n)return null;const i=bn(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(bn),...t.shapes.filter(c=>c.container).flatMap(la)],r=wr(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=>Wi(c,l))&&!ss(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+Pn,c.at-Pn-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+Pn,c.at-Pn-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 Wm(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(ft(o).map(lt));for(const[c,l]of t){const u=l.wps,p=n.get(c),f=p==null?void 0:p.label;if(!f||!(p!=null&&p.waypoints))continue;const d=p.waypoints[0].x-u[0].x,g=p.waypoints[0].y-u[0].y;if(!(p.waypoints.length===u.length&&p.waypoints.every((w,P)=>w.x-u[P].x===d&&w.y-u[P].y===g))){if(((a=p.source)==null?void 0:a.id)===l.source&&((s=p.target)==null?void 0:s.id)===l.target)continue;const w=o.edges.find(N=>N.id===c);if(!(w!=null&&w.label)||!ss(w.label,o).length)continue;let P={...w.label,x:l.label.x,y:l.label.y};if((ss(P,o).length||Vm(P,w.waypoints)>Gm)&&(P=null),!P&&Vm(w.label,w.waypoints)>Gm&&(P=IC(w,o)),!P)continue;const T=P,L={...o,edges:o.edges.map(N=>N.id===c?{...N,label:T}:N)},$=ft(L);if($.some(N=>!r.has(lt(N))))continue;i.moveElements([f],{x:T.x-f.x,y:T.y-f.y}),o=L,r=new Set($.map(lt));continue}const m=l.label.x+d-f.x,_=l.label.y+g-f.y;if(m===0&&_===0)continue;const b=o.edges.find(w=>w.id===c);if(!(b!=null&&b.label))continue;const y={...b.label,x:b.label.x+m,y:b.label.y+_},v={...o,edges:o.edges.map(w=>w.id===c?{...w,label:y}:w)},E=ft(v);E.some(w=>!r.has(lt(w)))||(i.moveElements([f],{x:m,y:_}),o=v,r=new Set(E.map(lt)))}}function Um(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=rf(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 qm(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=Ve(i),a=ft(r).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(lt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=r.edges.find(f=>f.id===s.edge);if(!c)continue;const l=zm(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 Ym(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(bn),...t.shapes.filter(f=>f.container).flatMap(la)],o=i.filter(f=>Wi(n,f));if(!o.length)return null;const r=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=wr(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Wi(f,d))&&!r.some(d=>s(f,d))&&!a.some(d=>s(f,d)),l=[];for(const f of o)f.axis==="h"?l.push({...n,y:f.at-Pn-n.height},{...n,y:f.at+Pn}):l.push({...n,x:f.at-Pn-n.width},{...n,x:f.at+Pn});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+Pn},{...n,x:u-n.width/2,y:e.y-Pn-n.height},{...n,x:e.x+e.width+Pn,y:p-n.height/2},{...n,x:e.x-Pn-n.width,y:p-n.height/2}),l.find(c)??null}function Km(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=Ym(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 BC(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 Xm(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=Ve(n),r=new Set(ft(o).map(lt));const a=[...new Set(ft(o).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(lt(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,m]of u){const _=h?o.shapes.find(y=>y.id===h):void 0;if(!_)continue;const b=BC(_,l[m]);b.x===l[m].x&&b.y===l[m].y||(l[m]=b,p=!0)}if(!p)continue;const f={...o,edges:o.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=ft(f);if(d.some(h=>!r.has(lt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),o=f,r=new Set(d.map(lt)))}}const af=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Zm(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 NC(e,t,n){const i=[],o=n?es(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 Zm(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(!af(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[d,g]of Object.entries(u))typeof g!="string"||g===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${d}`}),p=!1):o.includes(d)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:d,locales:o}),p=!1);if(!p)continue;const f=o.filter(d=>!(d in u));f.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:f})}}),i}function bi(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function $C(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(af(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=Zm(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,f=bi(c.participant,"name",a(u));c.participant.lanes&&(f.lanes=c.participant.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push({...c,participant:f});break}case"participant.update":{const[u,...p]=l,f=bi(c,"name",a(u));c.lanes&&(f.lanes=c.lanes.map((d,g)=>bi(d,"name",a(p[g])))),s.push(f);break}case"node.add":s.push({...c,node:bi(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:bi(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:bi(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:bi(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:bi(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(bi(c,"text",a(l[0])));break;default:s.push(af(l[0].map)?bi(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const FC=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Qm=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Jm={"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}]},ls=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Uc=e=>typeof e=="string"&&e!=="";function jC(e){const t=[];function n(i,o,r,a){if(a===null){Uc(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ls(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)Uc(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ls(i)||!Uc(i.kind)||!(i.kind in Jm)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of Jm[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let f=i;for(const g of p.slice(0,-1)){if(!ls(f))break;f=f[g]}if(!ls(f))continue;const d=f[p[p.length-1]];if(!(d===void 0&&c.optional)&&!(d===null&&c.optional)){if(!l){n(o,c.path,d,c.shape);continue}if(!Array.isArray(d)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}d.forEach((g,h)=>n(o,`${u}[${h}]`,g,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;ls(c)&&!Uc(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"&&!wg(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&&!Eg(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 ey(e,t,n={}){const i=jC(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(h,m,_){if(!FC.test(m)){o.push({kind:"id-invalid",opIndex:h,id:m});return}if(t.categoryOf(m)!==void 0||r.has(m)){o.push({kind:"id-duplicate",opIndex:h,id:m});return}r.set(m,{..._,opIndex:h})}e.forEach((h,m)=>{var _;switch(h.kind){case"participant.add":s(m,h.participant.id,{category:"participant",lanes:(h.participant.lanes??[]).map(b=>b.id)});for(const b of h.participant.lanes??[])s(m,b.id,{category:"lane"});break;case"node.add":s(m,h.node.id,{category:"flowNode",participant:h.node.participant});break;case"sequenceFlow.add":s(m,h.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(m,h.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(m,h.dataStore.id,{category:"dataStore"});for(const b of h.associations??[])b.id&&s(m,b.id,{category:"dataAssociation"});break;case"dataAssociation.add":h.association.id&&s(m,h.association.id,{category:"dataAssociation"});break;case"association.add":h.association.id&&s(m,h.association.id,{category:"association"});break;case"annotation.add":s(m,h.annotation.id,{category:"annotation"}),(_=h.association)!=null&&_.id&&s(m,h.association.id,{category:"association"});break;case"group.add":s(m,h.group.id,{category:"group"});break;case"participant.update":if(h.lanes){a.set(h.id,h.lanes.map(b=>b.id));for(const b of h.lanes)t.categoryOf(b.id)===void 0&&s(m,b.id,{category:"lane"})}break}});const c=h=>{var m;return((m=r.get(h))==null?void 0:m.category)??t.categoryOf(h)},l=h=>{const m=r.get(h);return m?m.category==="participant"?h:m.participant:t.categoryOf(h)==="participant"?h:t.participantOf(h)};function u(h,m,_,b){const y=c(m);if(y===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:_});return}if(b&&!b.includes(y)){o.push({kind:"ref-category",opIndex:h,ref:m,role:_,expected:b.join("|"),actual:y});return}return y}const p=t.isCollaboration()||e.some(h=>h.kind==="participant.add"),f=new Map;for(const h of e)h.kind==="node.add"?f.set(h.node.id,h.node.eventDefinition):h.kind==="node.update"&&h.type!==void 0&&f.set(h.id,h.eventDefinition);const d=h=>f.has(h)?f.get(h)==="timer":t.eventDefinitionOf(h)==="timer";return e.forEach((h,m)=>{var _;switch(h.kind){case"participant.add":break;case"node.add":{const{participant:b,lane:y}=h.node;if(b===void 0){(p||y!==void 0)&&o.push({kind:"participant-required",opIndex:m,id:h.node.id});break}if(u(m,b,"participant",["participant"])===void 0)break;y!==void 0&&((((_=r.get(b))==null?void 0:_.lanes)??a.get(b)??t.lanesOf(b)).includes(y)||o.push({kind:"lane-unknown",opIndex:m,lane:y,participant:b}));break}case"sequenceFlow.add":{const{id:b,source:y,target:v,name:E,condition:w}=h.flow,P=u(m,y,"source",["flowNode"]),T=u(m,v,"target",["flowNode"]);P&&T&&l(y)!==l(v)&&o.push({kind:"flow-cross-pool",opIndex:m,id:b}),E!==void 0&&w!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:b});break}case"messageFlow.add":{const{id:b,source:y,target:v}=h.flow,E=u(m,y,"source",["flowNode","participant"]),w=u(m,v,"target",["flowNode","participant"]);if(E&&w){const P=l(y),T=l(v);P!==void 0&&P===T&&o.push({kind:"message-flow-same-pool",opIndex:m,id:b})}for(const P of[y,v])d(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:m,id:b,ref:P});break}case"dataStore.add":{for(const b of h.associations??[]){if([b.source,b.target].filter(E=>E===h.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:m,source:b.source,target:b.target});continue}const v=b.source===h.dataStore.id?b.target:b.source;u(m,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:b,target:y}=h.association,v=u(m,b,"source"),E=u(m,y,"target");if(v&&E){const w=new Set([v,E]);w.has("dataStore")&&w.has("flowNode")||o.push({kind:"data-association-ends",opIndex:m,source:b,target:y})}break}case"association.add":{const{id:b,source:y,target:v}=h.association,E=u(m,y,"source"),w=u(m,v,"target");E&&w&&E!=="annotation"&&w!=="annotation"&&o.push({kind:"association-detached",opIndex:m,annotation:b??`${y}->${v}`});break}case"annotation.add":{if(h.association){const{source:b,target:y}=h.association;if(b!==h.annotation.id&&y!==h.annotation.id)o.push({kind:"association-detached",opIndex:m,annotation:h.annotation.id});else{const v=b===h.annotation.id?y:b;u(m,v,"association")}}h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.add":{for(const b of h.group.members??[]){const y=u(m,b,"member");y&&Qm.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:b,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(g(m,h.id,"participant")===void 0)break;if(h.lanes){const b=t.lanesOf(h.id),y=h.lanes.map(E=>E.id);for(const E of b)y.includes(E)||o.push({kind:"lane-shrink-unsupported",opIndex:m,participant:h.id,lane:E});for(const E of y)t.categoryOf(E)!==void 0&&!b.includes(E)&&o.push({kind:"id-duplicate",opIndex:m,id:E});const v=y.filter(E=>b.includes(E));v.length===b.length&&v.some((E,w)=>E!==b[w])&&o.push({kind:"lane-reorder-unsupported",opIndex:m,participant:h.id})}break}case"node.update":{if(g(m,h.id,"flowNode")===void 0)break;if(h.lane!==void 0){const b=t.participantOf(h.id);(b?a.get(b)??t.lanesOf(b):[]).includes(h.lane)||o.push({kind:"lane-unknown",opIndex:m,lane:h.lane,participant:b??""})}break}case"sequenceFlow.update":{if(g(m,h.id,"sequenceFlow")===void 0)break;if(h.name!==void 0&&h.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:m,id:h.id}),h.source!==void 0||h.target!==void 0){const b=h.source===void 0||u(m,h.source,"source",["flowNode"])!==void 0,y=h.target===void 0||u(m,h.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(h.id),E=h.source??(v==null?void 0:v.source),w=h.target??(v==null?void 0:v.target);b&&y&&E!==void 0&&w!==void 0&&new Set([l(E),l(w),l(h.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:m,id:h.id})}break}case"messageFlow.update":g(m,h.id,"messageFlow");break;case"dataStore.update":g(m,h.id,"dataStore");break;case"annotation.update":{if(g(m,h.id,"annotation")===void 0)break;h.placement&&u(m,h.placement.anchor,"anchor");break}case"group.update":{if(g(m,h.id,"group")===void 0)break;for(const b of h.members??[]){const y=u(m,b,"member");y&&Qm.has(y)&&o.push({kind:"ref-category",opIndex:m,ref:b,role:"member",expected:"shape",actual:y})}break}case"translation.confirm":g(m,h.id);break;case"element.remove":{g(m,h.id)==="lane"&&o.push({kind:"ref-category",opIndex:m,ref:h.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...NC(e,t,n.i18n)),o;function g(h,m,_){if(r.has(m)){o.push({kind:"target-added-in-batch",opIndex:h,id:m});return}const b=t.categoryOf(m);if(b===void 0){o.push({kind:"ref-missing",opIndex:h,ref:m,role:"target"});return}if(_&&b!==_){o.push({kind:"ref-category",opIndex:h,ref:m,role:"target",expected:_,actual:b});return}return b}}function ty(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 qc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Yc={"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]},Tn=10,HC=300,zC=160,ny=20,sf=100,iy=40,GC=10,VC=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function oy(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 Kc=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function Xc(e,t,n,i,o){const r=n,a=oy(e,t,i),s=a??i,c=(X,Q,ee=s)=>{const[We,qe]=Yc[X];let Ge={x:t.x+t.width/2+We*(t.width/2+r.width/2+Q),y:t.y+t.height/2+qe*(t.height/2+r.height/2+Q)};const Se=ee.x+Tn+r.width/2,Z=ee.x+ee.width-Tn-r.width/2,oe=ee.y+Tn+r.height/2,W=ee.y+ee.height-Tn-r.height/2,Y={x:Math.min(Z,Math.max(Se,Ge.x)),y:Math.min(W,Math.max(oe,Ge.y))};return(Y.x!==Ge.x||Y.y!==Ge.y)&&(Ge=Math.abs(Y.x-(t.x+t.width/2))<(t.width+r.width)/2+Tn&&Math.abs(Y.y-(t.y+t.height/2))<(t.height+r.height)/2+Tn?{x:t.x+t.width+Tn+r.width/2,y:Y.y}:Y),Ge},l=(i.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="bpmn:Lane"&&X.type!=="label"&&typeof X.x=="number"&&X.id!==o.selfId),u=Ve(e),p=X=>{var ee,We;if(!o.selfId)return!1;const Q=e.get(X);return!!Q&&(((ee=Q.source)==null?void 0:ee.id)===o.selfId||((We=Q.target)==null?void 0:We.id)===o.selfId)},f=u.edges.filter(X=>!p(X.id)).flatMap(bn),d=wr(u).filter(X=>X.owner!==o.selfId).map(X=>X.rect),g=X=>({x0:X.x-r.width/2-Tn,x1:X.x+r.width/2+Tn,y0:X.y-r.height/2-Tn,y1:X.y+r.height/2+Tn}),h=X=>{const Q=g(X);return l.some(ee=>Q.x0<ee.x+ee.width&&Q.x1>ee.x&&Q.y0<ee.y+ee.height&&Q.y1>ee.y)},m=X=>{const Q=g(X);return f.some(ee=>ee.axis==="h"?ee.at>Q.y0&&ee.at<Q.y1&&ee.lo<Q.x1&&ee.hi>Q.x0:ee.at>Q.x0&&ee.at<Q.x1&&ee.lo<Q.y1&&ee.hi>Q.y0)},_=X=>{const Q=g(X);return d.some(ee=>Q.x0<ee.x+ee.width&&Q.x1>ee.x&&Q.y0<ee.y+ee.height&&Q.y1>ee.y)},b=u.shapes.filter(X=>X.type==="bpmn:Group").flatMap(X=>[{axis:"h",at:X.y,lo:X.x,hi:X.x+X.width},{axis:"h",at:X.y+X.height,lo:X.x,hi:X.x+X.width},{axis:"v",at:X.x,lo:X.y,hi:X.y+X.height},{axis:"v",at:X.x+X.width,lo:X.y,hi:X.y+X.height}]),y=X=>{const Q=g(X);return b.some(ee=>ee.axis==="h"?ee.at>Q.y0&&ee.at<Q.y1&&ee.lo<Q.x1&&ee.hi>Q.x0:ee.at>Q.x0&&ee.at<Q.x1&&ee.lo<Q.y1&&ee.hi>Q.y0)},v=X=>h(X)||m(X)||_(X)||y(X),E=X=>X.x-r.width/2>=i.x&&X.x+r.width/2<=i.x+i.width&&X.y-r.height/2>=i.y&&X.y+r.height/2<=i.y+i.height,w=X=>E(X)&&(!a||Kc(X,r,a));if(o.placement){const X=Se=>Se.startsWith("top")?Se.replace(/^top/,"bottom"):Se.replace(/^bottom/,"top"),Q=Se=>Se.endsWith("left")?Se.replace(/left$/,"right"):Se.replace(/right$/,"left"),ee=o.placement.side,We=[ee,X(ee),Q(ee),X(Q(ee)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],qe=o.placement.offset??50;let Ge=c(ee,qe);if(v(Ge)||a&&!Kc(Ge,r,a)){const Se=(Z,oe)=>{const W=new Set;for(const Y of We){if(W.has(Y))continue;W.add(Y);const ae=c(Y,qe,Z);if(oe(ae)&&!v(ae))return Ge=ae,!0}return!1};!Se(s,w)&&a&&Se(i,E)}return Ge}const P=o.from,T=s.x+Tn+r.width/2,L=s.x+s.width-Tn-r.width/2,$=s.y+Tn+r.height/2,N=s.y+s.height-Tn-r.height/2;let H={x:Math.min(L,Math.max(T,P.x)),y:Math.min(N,Math.max($,P.y))};if(v(H)){const X=(t.width+r.width)/2+Tn,ee=[{x:H.x+X,y:H.y},{x:H.x-X,y:H.y},{x:H.x,y:H.y-r.height-Tn},{x:H.x,y:H.y+r.height+Tn}].filter(w).find(We=>!v(We));ee&&(H=ee)}return H}function Jt(e,t){return e.filter(n=>n.kind===t)}class ry extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}function ay(e,t){var d1,h1,g1,m1,y1,v1,b1,x1,_1,w1,E1,S1,R1,C1,M1,A1,P1,T1,k1,O1,D1,L1,I1;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),p=x=>r.get(x),f=x=>{const R=p(x);if(!R)throw new Error(`하강 참조 해소 실패: ${x}`);return R},d=x=>{let R=x.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},g=new Map;for(const x of r.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))g.set(x.id,{x:x.x,y:x.y});const h=Jt(e,"participant.add"),m=Jt(e,"node.add"),_=Jt(e,"sequenceFlow.add"),b=Jt(e,"messageFlow.add"),y=Jt(e,"dataStore.add"),v=Jt(e,"dataAssociation.add"),E=Jt(e,"annotation.add"),w=Jt(e,"group.add"),P=new Map(m.map(x=>[x.node.id,x])),T=(x,R,A)=>{var F;const k=x.businessObject,D=(((F=k.extensionElements)==null?void 0:F.values)??[]).filter(I=>I.$type!==R),O=A?[...D,i.create(R,A)]:D;if(!O.length){k.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const j=i.create("bpmn:ExtensionElements",{values:O});O.forEach(I=>{I.$parent=j}),n.updateProperties(x,{extensionElements:j})},L=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Jt(e,"element.remove")){const R=p(x.id);R&&n.removeElements([R])}const $=x=>r.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===x}).sort((R,A)=>R.y-A.y);for(const x of Jt(e,"participant.update")){const R=f(x.id);if(x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),!x.lanes)continue;const A=$(x.id);if(!A.length){n.splitLane(R,x.lanes.length),$(x.id).forEach((D,O)=>{const j=x.lanes[O];j&&n.updateProperties(D,{id:j.id,name:j.name})});continue}const k=new Set(A.map(D=>D.id));x.lanes.forEach((D,O)=>{if(k.has(D.id)){n.updateProperties(f(D.id),{name:D.name});return}const j=O===0?n.addLane($(x.id)[0],"top"):n.addLane(f(x.lanes[O-1].id),"bottom");n.updateProperties(j,{id:D.id,name:D.name})})}const N=150,H=130,X=80,Q=90,ee=180,We=30,qe=30,Ge=(x,R,A,k,D)=>{const O=A-R.width/2,j=k-R.height/2;return(x.children??[]).find(F=>!("waypoints"in F&&F.waypoints)&&F.type!=="bpmn:Lane"&&F.type!=="label"&&!(D!=null&&D.has(F.id))&&typeof F.x=="number"&&O<F.x+F.width+qe&&O+R.width+qe>F.x&&j<F.y+F.height&&j+R.height>F.y)},Se=new Set;for(const x of h){Se.add(`pool:${x.participant.id}`);for(const R of x.participant.lanes??[])Se.add(R.id)}const Z=new Map;for(const x of m){const R=x.node.lane??`pool:${x.node.participant??""}`;let A=Z.get(R);A||Z.set(R,A=new Set([0])),x.band!==void 0&&A.add(x.band)}const oe=new Map;for(const[x,R]of Z){if(!Se.has(x))continue;const A=[...R].sort((O,j)=>O-j),k=A.map((O,j)=>j===0?0:j%2===1?Math.ceil(j/2):-(j/2)),D=Math.min(...k);oe.set(x,new Map(A.map((O,j)=>[O,k[j]-D])))}{const x=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,k)=>x.set(A.id,k));for(const[R,A]of oe){if(!x.has(R)||A.size<2)continue;const k=x.get(R),D=A.get(0)??0,O=new Set;for(const ne of m){if(ne.node.lane!==R||(ne.band??0)!==0||!ne.node.type.endsWith("Gateway"))continue;const he={in:new Set,out:new Set,cross:new Set};for(const fe of _){const ye=fe.flow.source===ne.node.id;if(!ye&&fe.flow.target!==ne.node.id)continue;const Ye=P.get(ye?fe.flow.target:fe.flow.source);if(!Ye||Ye.node.participant!==ne.node.participant||!Ye.node.lane)continue;let Ae,te=!1;if(Ye.node.lane!==R){const se=x.get(Ye.node.lane);if(se===void 0)continue;Ae=se>k?"down":"up",te=!0}else{const se=A.get(Ye.band??0)??D;Ae=se>D?"down":se<D?"up":void 0}Ae&&(he[ye?"out":"in"].add(Ae),te&&he.cross.add(Ae))}for(const fe of["up","down"])he.in.has(fe)&&he.out.has(fe)&&he.cross.has(fe)&&O.add(fe)}if(O.size!==1)continue;const[j]=O,F=Math.max(...A.values()),I=j==="down"?F:0;if(D===I)continue;const U=[...A.entries()].filter(([ne])=>ne!==0).sort((ne,he)=>ne[1]-he[1]),K=[...Array(F+1).keys()].filter(ne=>ne!==I),re=new Map([[0,I]]);U.forEach(([ne],he)=>re.set(ne,K[he])),oe.set(R,re)}}const W=x=>{var R;return(((R=Z.get(x))==null?void 0:R.size)??0)>1},Y=x=>x.band??(x.node.lane||!W(`pool:${x.node.participant??""}`)?void 0:0),ae=new Map,ge=x=>ae.get(x.node.id)??Y(x),Te=new Set,B=new Set;{const x=new Map;for(const k of _)x.set(k.flow.target,(x.get(k.flow.target)??0)+1);const R=k=>{const D=[],O=new Set([k]),j=[k];for(;j.length;){const F=j.shift();D.push(F);for(const I of _)I.flow.source!==F||O.has(I.flow.target)||(x.get(I.flow.target)??0)!==1||(O.add(I.flow.target),j.push(I.flow.target))}return D},A=(k,D)=>{var O;return((O=oe.get(k))==null?void 0:O.get(D))??D};for(const k of m){if(!k.node.type.endsWith("Gateway"))continue;const D=k.node.lane??`pool:${k.node.participant??""}`,O=oe.get(D);if(!O||O.size<2)continue;const j=ge(k);if(j===void 0||A(D,j)!==A(D,0))continue;const F=A(D,j),I=_.filter(fe=>fe.flow.source===k.node.id).map(fe=>P.get(fe.flow.target)).filter(fe=>!!fe&&(fe.node.lane??`pool:${fe.node.participant??""}`)===D),U=I.filter(fe=>{const ye=ge(fe);return ye!==void 0&&A(D,ye)===F&&(x.get(fe.node.id)??0)===1}),K=I.some(fe=>{const ye=ge(fe);return ye!==void 0&&A(D,ye)>F});if(U.length!==1||!K)continue;const re=new Set(I.flatMap(fe=>R(fe.node.id)));if(!_.some(fe=>fe.flow.target===k.node.id&&re.has(fe.flow.source)))continue;const he=new Map;for(const[fe,ye]of O)he.set(fe,ye+1);he.set(-1,0),oe.set(D,he);for(const fe of R(U[0].node.id))P.has(fe)&&(ae.set(fe,-1),B.add(fe));Te.add(k.node.id)}}const C=(x,R)=>{var A;return((A=oe.get(x))==null?void 0:A.get(R))??R},S=(x,R,A,k)=>{const D=x?p(x):R?p(R):void 0;if(!D)return!1;const O=x?D.y+Math.min(D.height/2,Q):D.y+X;return Math.abs(O+C(x??`pool:${R??""}`,A)*N-k)<=N/2},G=new Map;for(const[x,R]of Z){let A=0;for(const k of R)A=Math.max(A,C(x,k));G.set(x,A)}const q=x=>ee+N*x,ie=(x,R,A)=>{const k=u().children.filter(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="label"&&D.id!==R&&typeof D.y=="number"&&D.y>=x);k.length&&n.moveElements(k,{x:0,y:A})},Me=(x,R,A)=>{const k=x.type==="bpmn:Participant"?x:void 0;if(!k||k.children.some(F=>F.type==="bpmn:Lane"))return;const D=A+R.height/2+We-k.y;if(k.height>=D)return;const O=D-k.height,j=k.y+k.height;n.resizeShape(k,{x:k.x,y:k.y,width:k.width,height:D}),ie(j,k.id,O)},Xe=(x,R)=>{const A=R-x.height;if(A<=0)return;const k=d(x)??x,D=[],O=I=>{D.push(I);for(const U of I.children??[])O(U)};O(k);const j=x.y+x.height-10,F=l.calculateAdjustments(D,"y",A,j);l.makeSpace(F.movingShapes,F.resizingShapes,{x:0,y:A},"s",j)},mt=(x,R,A)=>{if(x){const j=f(x),F=q(R);if(j.height>=F)return;const I=F-j.height,U=d(j),K=U?U.y+U.height:j.y+j.height;Xe(j,F),ie(K,U==null?void 0:U.id,I);return}if(!A)return;const k=N*(R+1);if(A.height>=k)return;const D=k-A.height,O=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:k}),ie(O,A.id,D)},Ut=new Map;for(const x of _)Ut.set(x.flow.target,(Ut.get(x.flow.target)??0)+1);const Mt=x=>(Ut.get(x)??0)<=1,mn=new Set(m.map(x=>x.node.id).filter(x=>Jt(e,"sequenceFlow.update").filter(R=>R.target===x).length===1&&!_.some(R=>R.flow.target===x||R.flow.source===x&&P.has(R.flow.target)))),Rn=new Map,Wn=(x,R)=>{if(!x)return;const A=p(x);if(!A||A.height>=q(R))return;const k=A.y+A.height-10,D=d(A);if(D)return new Set((D.children??[]).filter(O=>O.type!=="bpmn:Lane"&&typeof O.y=="number"&&O.y>k).map(O=>O.id))},At=(x,R,A)=>{if(!x)return!0;const k=p(x);return k?A-R.height/2>=k.y&&A+R.height/2<=k.y+k.height:!0},Zt=h.map((x,R)=>({op:x,declared:R}));Zt.sort((x,R)=>{const A=x.op.order??Number.POSITIVE_INFINITY,k=R.op.order??Number.POSITIVE_INFINITY;return A!==k?A-k:x.declared-R.declared});let _n=80;for(const x of r.getAll())x.parent===u()&&"height"in x&&typeof x.y=="number"&&(_n=Math.max(_n,x.y+x.height+60));for(const{op:x}of Zt){const R=x.participant,A=m.filter(ne=>ne.node.participant===R.id).length,k=((d1=R.lanes)==null?void 0:d1.length)??0,D=Math.max(1200,A*160+300),O=(R.lanes??[]).map(ne=>q(G.get(ne.id)??0)),j=O.reduce((ne,he)=>ne+he,0);k&&j<300&&(O[k-1]+=300-j);const F=Math.max(300,N*((G.get(`pool:${R.id}`)??0)+1)),I=R.blackBox||A+k===0?120:k?Math.max(300,j):F,U=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:D,height:I,isExpanded:!0}),K=n.createShape(U,{x:100+D/2,y:_n+I/2},u()),re=R.lanes??[];if(re.length&&n.splitLane(K,re.length),re.length){const ne=r.filter(he=>{var fe;return he.type==="bpmn:Lane"&&((fe=d(he))==null?void 0:fe.id)===R.id}).sort((he,fe)=>he.y-fe.y);if(ne.forEach((he,fe)=>{const ye=re[fe];ye&&n.updateProperties(he,{id:ye.id,name:ye.name})}),O.some(he=>he!==K.height/k)){let he=K.y;ne.forEach((fe,ye)=>{const Ye=O[ye];n.resizeShape(fe,{x:fe.x,y:he,width:fe.width,height:Ye}),he+=Ye})}}_n=K.y+K.height+60}const Ua=x=>{var k;const R=P.get(x);if(R)return R.node.participant??"";const A=p(x);return A?A.type==="bpmn:Participant"?A.id:((k=d(A))==null?void 0:k.id)??"":""},Un=new Map,Fi=x=>{let R=Un.get(x);return R||Un.set(x,R={nodes:[],flows:[]}),R};for(const x of m)Fi(x.node.participant??"").nodes.push(x);for(const x of _)Fi(Ua(x.flow.source)).flows.push(x);const li=x=>{var R;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((R=x.condition)==null?void 0:R.label)})},tn=(x,R,A)=>o.createShape({type:qc(x.type),...x.eventDefinition?{eventDefinitionType:wc[x.eventDefinition]}:{},businessObject:i.create(qc(x.type),{id:x.id,name:x.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Hr=[...Zt.map(({op:x})=>x.participant.id).filter(x=>Un.has(x)),...[...Un.keys()].filter(x=>!h.some(R=>R.participant.id===x))],qa=x=>x.endsWith("Gateway");for(const x of Hr){const R=Un.get(x),A=x?f(x):void 0,k=A?A.x+150:250;let D=A?A.y+80:120;const O=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,Q)+C(te,se??0)*N}return se!==void 0&&A?A.y+X+C(`pool:${x}`,se)*N:le},j=(te,se,le)=>{if(te){const be=f(te);return be.y+Math.min(be.height/2,Q)+se*N}return A?A.y+X+se*N:le},F=te=>te.participant?f(te.participant):u(),I=(te,se,le,be,Ze,Qe,Dt,Ft)=>{const xe=le!==void 0||be!==void 0,ve=De=>{const Re=()=>mt(le,De,A);Ft?Ft(Re):Re()},ce=C(le??`pool:${x}`,be??0);if((be===void 0||S(le,x,be,Dt??Number.NaN))&&Dt!==void 0&&At(le,se,Dt)&&!Ge(te,se,Ze,Dt))return{x:Ze,y:Dt};if(xe)for(let De=0;De<4;De++){const Re=j(le,ce+De,Qe);if(!Ge(te,se,Ze,Re,Wn(le,ce+De)))return ve(ce+De),{x:Ze,y:Re}}const _e=O(le,be,Qe);xe?ve(ce):Ft?Ft(()=>Me(te,se,se.y+se.height/2)):Me(te,se,_e);let Ne=Ze;for(let De=0;De<64;De++){const Re=Ge(te,se,Ne,_e);if(!Re)break;Ne=Re.x+Re.width+H+se.width/2}return{x:Ne,y:_e}},U=new Set(R.flows.map(te=>te.flow.target)),K=new Map,re=te=>{if(te===void 0)return;const se=r.get(te);if(!(!se||typeof se.x!="number"||typeof se.width!="number"))return se.x+se.width+H};for(const te of R.nodes){if(U.has(te.node.id))continue;const se=tn(te.node,te.band,te.afterColumn),le=Y(te),be=te.node.lane?`${te.node.lane}|${le??""}`:le!==void 0?`band:${le}`:"",Ze=F(te.node),Qe=K.get(be)??k,Dt=re(te.afterColumn),Ft=Dt===void 0?Qe:Math.max(Qe,Dt);let xe;const ve=I(Ze,se,te.node.lane,le,Ft,D,void 0,mn.has(te.node.id)&&te.node.participant!==void 0?ce=>xe=ce:void 0);if(xe?n.createShape(se,ve,Ze,{autoResize:!1}):n.createShape(se,ve,Ze),xe){const ce=te.node.lane?f(te.node.lane):Ze;Rn.set(te.node.id,{container:ce,relCy:ve.y-ce.y,grow:xe})}K.set(be,ve.x+se.width+H),!te.node.lane&&le===void 0&&(D+=160)}const ne=new Set,he=new Map,fe=new Map,ye=new Map;if(x&&Se.has(`pool:${x}`)){const te=new Map;for(const xe of R.flows)te.set(xe.flow.target,(te.get(xe.flow.target)??0)+1);const se=xe=>O(xe.node.lane,ge(xe),Number.NaN),le=new Set,be=xe=>{var _e;const ve=(_e=P.get(xe))==null?void 0:_e.node.participant;if(ve)return p(ve);const ce=p(xe);if(ce)return ce.type==="bpmn:Participant"?ce:d(ce)},Ze=xe=>{const ve=[],ce=new Set([xe]),_e=[xe];for(;_e.length;){const Ne=_e.shift(),De=P.get(Ne);De&&ve.push(De);for(const Re of R.flows)Re.flow.source!==Ne||ce.has(Re.flow.target)||(te.get(Re.flow.target)??0)!==1||(ce.add(Re.flow.target),_e.push(Re.flow.target))}return ve},Qe=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of b){if(!ve.has(Ne.flow.source))continue;const De=be(Ne.flow.target);!De||De.id===A.id||(De.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!qa(xe.node.type))continue;const ve=O(xe.node.lane,Y(xe),Number.NaN);if(Number.isNaN(ve))continue;const ce=[];for(const Re of R.flows){if(Re.flow.source!==xe.node.id)continue;const at=P.get(Re.flow.target);if(!at||at.node.lane!==xe.node.lane||(te.get(at.node.id)??0)!==1)continue;const ut=Y(at);if(ut===void 0)continue;const nn=O(at.node.lane,ut,Number.NaN);if(Number.isNaN(nn))continue;const Mn=Ze(at.node.id),yt=Qe(Mn);yt&&ce.push({subtree:Mn,band:ut,row:nn,dir:yt})}if(!ce.some(Re=>Re.dir==="up")||!ce.some(Re=>Re.dir==="down")||!ce.some(Re=>Re.dir==="up"&&ce.some(at=>at.dir==="down"&&at.row<Re.row)))continue;const Ne=[...ce].sort((Re,at)=>Re.row-at.row);[...ce.filter(Re=>Re.dir==="up"),...ce.filter(Re=>Re.dir==="down")].sort((Re,at)=>Re.dir===at.dir?Re.row-at.row:Re.dir==="up"?-1:1).forEach((Re,at)=>{const ut=Ne[at].band;if(ut!==Re.band){le.add(xe.node.id);for(const nn of Re.subtree)Y(nn)===Re.band&&ae.set(nn.node.id,ut)}})}const Dt=xe=>{if(!A)return;const ve=new Set(xe.map(Ne=>Ne.node.id));let ce=!1,_e=!1;for(const Ne of b){if(!ve.has(Ne.flow.target))continue;const De=be(Ne.flow.source);!De||De.id===A.id||(De.y<A.y?ce=!0:_e=!0)}return ce&&!_e?"up":_e&&!ce?"down":void 0};for(const xe of R.nodes){if(!qa(xe.node.type))continue;const ve=xe.node.lane??`pool:${x}`,ce=oe.get(ve);if(!ce||ce.size<2)continue;const _e=ce.get(0);if(_e===void 0)continue;const Ne=Math.max(...ce.values()),De=_e===Ne&&_e!==0?"down":void 0;if(!De)continue;const Re=[];for(const yt of R.flows){if(yt.flow.source!==xe.node.id)continue;const Hn=P.get(yt.flow.target);if(!Hn||Hn.node.lane!==xe.node.lane||(te.get(Hn.node.id)??0)!==1)continue;const Xa=ge(Hn);Xa!==void 0&&Re.push({t:Hn,subtree:Ze(Hn.node.id),band:Xa})}const at=Re.find(yt=>(ce.get(yt.band)??yt.band)===_e);if(!at||Dt(at.subtree)===De||Qe(at.subtree)===De)continue;const ut=Re.find(yt=>yt!==at&&Dt(yt.subtree)===De);if(!ut)continue;const nn=at.band,Mn=ut.band;for(const yt of at.subtree)ge(yt)===nn&&ae.set(yt.node.id,Mn);for(const yt of ut.subtree)ge(yt)===Mn&&ae.set(yt.node.id,nn);le.add(xe.node.id)}for(const xe of R.nodes){if(!qa(xe.node.type))continue;const ve=se(xe);if(Number.isNaN(ve)||E.some(Re=>{var at,ut;return(((at=Re.placement)==null?void 0:at.anchor)??(Re.association?Re.association.source===Re.annotation.id?Re.association.target:Re.association.source:void 0))===xe.node.id&&((ut=Re.placement)==null?void 0:ut.side.startsWith("bottom"))}))continue;let _e,Ne=!1,De;for(const Re of R.flows){if(Re.flow.source!==xe.node.id)continue;const at=P.get(Re.flow.target);if(!at||!at.node.lane&&Y(at)===void 0)continue;const ut=se(at);Number.isNaN(ut)||(Math.abs(ut-ve)<.5&&(Ne=!0),ut>ve?!_e||ut>_e.row?_e={id:at.node.id,row:ut,count:1}:ut===_e.row&&_e.count++:ut<ve&&at.node.lane===xe.node.lane&&(!De||ut>De.row?De={op:at,row:ut,count:1}:ut===De.row&&De.count++))}_e&&_e.count===1&&(te.get(_e.id)??0)===1&&!le.has(xe.node.id)&&ne.add(_e.id),!Ne&&De&&De.count===1&&(te.get(De.op.node.id)??0)===1&&!Te.has(xe.node.id)&&he.set(De.op.node.id,{lane:xe.node.lane,band:ge(xe)})}const Ft=new Map;for(const xe of b)Ft.set(xe.flow.target,[...Ft.get(xe.flow.target)??[],xe]);for(const xe of R.nodes){const ve=Ft.get(xe.node.id);if(!ve||ve.length!==1||!te.get(xe.node.id)||!xe.node.lane&&Y(xe)===void 0||B.has(xe.node.id))continue;const ce=(h1=P.get(ve[0].flow.source))==null?void 0:h1.node.participant,_e=ce?p(ce):void 0;if(!_e||!A||_e.id===A.id)continue;const Ne=xe.node.lane??`pool:${x}`,De=oe.get(Ne);if(!De)continue;const Re=De.get(0)??0,at=(De.get(ge(xe)??0)??Re)-Re;if(at===0)continue;const ut=_e.y<A.y;if(ut&&at<0||!ut&&at>0)continue;let nn;for(const[Mn,yt]of De){const Hn=yt-Re;(ut&&Hn<0&&(!nn||Hn<nn.row)||!ut&&Hn>0&&(!nn||Hn>nn.row))&&(nn={band:Mn,row:Hn})}nn&&fe.set(xe.node.id,{lane:xe.node.lane,band:nn.band})}}const Ye=new Set;let Ae=0;for(;Ae++<R.nodes.length+2;){for(let le=0;le<R.nodes.length+R.flows.length+2;le++){let be=!1;for(const Ze of R.flows){const Qe=Ze.flow;if(Ye.has(Qe.id))continue;const Dt=p(Qe.source);if(!Dt)continue;const Ft=p(Qe.target),xe=P.get(Qe.target);if(!Ft&&xe){const ve=tn(xe.node,xe.band),ce=ge(xe);if(xe.node.lane||ce!==void 0){const _e=F(xe.node),Ne=Dt,De=Ne.x+(ye.get(Qe.source)??0)+Ne.width+H,Re=he.get(Qe.target)??fe.get(Qe.target),at=I(_e,ve,Re?Re.lane:xe.node.lane,Re?Re.band:ce,ne.has(Qe.target)?Ne.x+Ne.width/2:De,Number.NaN,Re||!Mt(Qe.target)?void 0:Ne.y+Ne.height/2),ut=n.createShape(ve,at,_e);ne.has(Qe.target)&&ye.set(Qe.target,De-(ut.x+ut.width/2)),n.connect(Dt,ut,{type:"bpmn:SequenceFlow",businessObject:li(Qe)})}else s.append(Dt,ve,{connection:{type:"bpmn:SequenceFlow",businessObject:li(Qe)}})}else if(Ft)n.connect(Dt,Ft,{type:"bpmn:SequenceFlow",businessObject:li(Qe)});else continue;Ye.add(Qe.id),be=!0}if(!be)break}const te=R.nodes.filter(le=>!p(le.node.id));if(!te.length)break;const se=te[0];{const le=tn(se.node,se.band),be=F(se.node),Ze=Y(se);n.createShape(le,I(be,le,se.node.lane,Ze,k,D),be),!se.node.lane&&Ze===void 0&&(D+=160)}}}const Cn=40,gt=x=>{const R=K=>K.kind==="label-over-line"||K.kind==="label-over-shape"||K.kind==="label-on-shared-segment"?K.edge===x.id:K.kind==="annotation-over-label"||K.kind==="pool-name-over-label"?K.label===x.id:!1,A=()=>new Set(ft(Ve(r)).filter(K=>!R(K)).map(K=>lt(K))),k=A(),D=x.waypoints.map(K=>({x:K.x,y:K.y})),O=x.label,j=O&&{x:O.x,y:O.y};n.layoutConnection(x,{waypoints:[]});const F=A(),I=[...F].filter(K=>!k.has(K)).length,U=[...k].filter(K=>!F.has(K)).length;I<=U||(n.updateWaypoints(x,D),O&&j&&(O.x!==j.x||O.y!==j.y)&&n.moveElements([O],{x:j.x-O.x,y:j.y-O.y}))},St=5,Oi=10,jE=200,hc=new Set([..._.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)),i5=(x,R,A,k,D,O)=>{const j=new Set(x.map(te=>te.id)),F=Math.min(...x.map(te=>te.x))+R-Oi,I=Math.max(...x.map(te=>te.x+te.width))+R+jE+Oi,U=Math.min(...x.map(te=>te.y+Math.min(0,...A)))-Oi,K=Math.max(...x.map(te=>te.y+te.height+Math.max(0,...A)))+Oi,re=r.getAll().filter(te=>{if(te.type!=="bpmn:SequenceFlow"&&te.type!=="bpmn:MessageFlow")return!1;const se=te;return hc.has(se.id)||!se.waypoints||se.waypoints.length<2||[se.source,se.target].some(be=>!be||j.has(be.id)||be.x>=k)?!1:se.waypoints.some((be,Ze)=>{const Qe=se.waypoints[Ze+1];return!!Qe&&Math.max(be.x,Qe.x)>=F&&Math.min(be.x,Qe.x)<=I&&Math.max(be.y,Qe.y)>=U&&Math.min(be.y,Qe.y)<=K})});if(!re.length)return 0;const ne=te=>{const se=new Map;for(const le of x)for(const be of A){const Ze={id:le.id,type:le.type,x:le.x+R+te,y:le.y+be,width:le.width,height:le.height};for(const Qe of re){let Dt=1/0;for(let xe=0;xe+1<Qe.waypoints.length;xe++)Dt=Math.min(Dt,rs(Qe.waypoints[xe],Qe.waypoints[xe+1],Ze));const Ft=`${Qe.id}|${le.id}`;se.set(Ft,Math.min(se.get(Ft)??1/0,Dt))}}return se},he=[...ne(0)].filter(([,te])=>te<=St).map(([te])=>te);if(!he.length)return 0;let fe=0;for(let te=1;te<=jE;te++){const se=ne(te);if([...se.values()].every(le=>le>St)&&he.every(le=>(se.get(le)??1/0)>=Oi)){fe=te;break}}if(!fe)return 0;const ye=Math.min(...x.map(te=>te.x))+R+fe,Ye=new Set(he.map(te=>te.slice(0,te.indexOf("|"))));return re.some(te=>te.type==="bpmn:SequenceFlow"&&Ye.has(te.id)&&te.waypoints.some((se,le)=>{const be=te.waypoints[le+1];if(!be||Math.min(se.y,be.y)>O||Math.max(se.y,be.y)<O||se.y===be.y)return!1;const Ze=se.x+(O-se.y)*(be.x-se.x)/(be.y-se.y);return Ze>D&&Ze<ye}))?0:fe},zr=(x,R=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],D=new Set([x]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.target;if(F.flow.source!==j||D.has(I)||!P.has(I))continue;D.add(I);const U=p(I);U&&R(U)&&k.push(U)}}return k},o5=(x,R=()=>!0)=>{const A=p(x);if(!A)return[];const k=[A],D=new Set([x]);for(let O=0;O<k.length;O++){const j=k[O].id;for(const F of _){const I=F.flow.source;if(F.flow.target!==j||D.has(I)||!P.has(I))continue;D.add(I);const U=p(I);U&&R(U)&&k.push(U)}}return k},Di=30,Li=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",sp=(x,R)=>lf(n,x,R),gc=(x,R,A=!1)=>{const k=new Set(x.flatMap(I=>I.subtree.map(U=>U.id)));for(const I of x){const U=(I.pool.children??[]).filter(Li).filter(re=>!k.has(re.id));if(I.subtree.some(re=>U.some(ne=>re.x+R<ne.x+ne.width+Di&&re.x+R+re.width+Di>ne.x&&re.y<ne.y+ne.height&&re.y+re.height>ne.y)))return null}const D=x.map(I=>I.pool.width),O=A?r.filter(I=>Array.isArray(I.waypoints)).map(I=>({c:I,wps:I.waypoints.map(U=>({x:U.x,y:U.y}))})):[],j=r.filter(I=>I.type==="label").map(I=>({label:I,x:I.x,y:I.y}));n.moveElements(x.flatMap(I=>I.subtree),{x:R,y:0});const F=x.map(I=>{const K=Math.max(...I.subtree.map(re=>re.x+re.width))+sy-(I.pool.x+I.pool.width);return K>0&&sp(I.pool,I.pool.width+K),K});return()=>{n.moveElements(x.flatMap(I=>I.subtree),{x:-R,y:0}),x.forEach((I,U)=>{F[U]>0&&sp(I.pool,D[U])});for(const{c:I,wps:U}of O){const K=I.waypoints??[];K.length===U.length&&K.every((ne,he)=>Math.abs(ne.x-U[he].x)<=.5&&Math.abs(ne.y-U[he].y)<=.5)||n.updateWaypoints(I,U.map(ne=>({x:ne.x,y:ne.y})))}for(let I=0;I<3;I++){let U=0;for(const K of j){const re=K.x-K.label.x,ne=K.y-K.label.y;Math.abs(re)<=.5&&Math.abs(ne)<=.5||(n.moveElements([K.label],{x:re,y:ne}),U++)}if(!U)break}}},fg=x=>{var D,O;const R=new Map,A=new Map;for(const j of r.getAll()){if(j.type!=="bpmn:Participant")continue;const F=j;(F.children??[]).length||(R.set(F.id,F),A.set(F.id,[]))}for(const j of r.getAll()){if(j.type!=="bpmn:MessageFlow")continue;const F=j,I=(D=F.source)==null?void 0:D.id,U=(O=F.target)==null?void 0:O.id;I&&U&&A.has(I)&&A.get(I).push(U),I&&U&&A.has(U)&&A.get(U).push(I)}const k=[];for(const[j,F]of A)F.length&&F.every(I=>x.has(I))&&k.push(R.get(j));return k},HE=(x,R)=>{if(!x.length)return null;const A=new Set(x.map(K=>K.id)),k=r.getAll().filter(K=>K.type==="bpmn:Participant"&&!A.has(K.id)),D=Math.min(...k.filter(K=>(K.children??[]).length>0).map(K=>K.x)),O=new Set(x.filter(K=>Math.abs(K.x-D)<=2).map(K=>K.id));if(x.some(K=>{const re=O.has(K.id)?K.x:K.x+R,ne=O.has(K.id)?K.width+R:K.width;return k.some(he=>re<he.x+he.width+Di&&re+ne+Di>he.x&&K.y<he.y+he.height&&K.y+K.height>he.y)}))return null;const F=r.filter(K=>K.type==="label").map(K=>({label:K,x:K.x,y:K.y})),I=x.filter(K=>!O.has(K.id)),U=x.filter(K=>O.has(K.id)).map(K=>({pool:K,was:{x:K.x,y:K.y,width:K.width,height:K.height}}));I.length&&n.moveElements(I,{x:R,y:0});for(const{pool:K,was:re}of U)n.resizeShape(K,{...re,width:re.width+R});return()=>{for(const{pool:K,was:re}of U)n.resizeShape(K,re);I.length&&n.moveElements(I,{x:-R,y:0});for(let K=0;K<3;K++){let re=0;for(const ne of F){const he=ne.x-ne.label.x,fe=ne.y-ne.label.y;Math.abs(he)<=.5&&Math.abs(fe)<=.5||(n.moveElements([ne.label],{x:he,y:fe}),re++)}if(!re)break}}},zE=(x,R,A)=>{const k=A.x+A.width/2,D=R.y>A.y,O=D?A.y+A.height:A.y,j=D?R.y:R.y+R.height,F=x.source===R?[{x:k,y:j},{x:k,y:O}]:[{x:k,y:O},{x:k,y:j}],I=Ve(r),U={...I.edges.find(K=>K.id===x.id),waypoints:F};return Qt(U,ei(I)).length?!1:(n.updateWaypoints(x,F),!0)},r5=()=>{const x=r.filter(D=>D.type==="bpmn:Participant"),R=Math.min(...x.filter(D=>(D.children??[]).length>0).map(D=>D.x)),A=D=>!!D&&D.type==="bpmn:Participant"&&!(D.children??[]).length&&Math.abs(D.x-R)<=2&&!h.some(O=>O.participant.id===D.id),k=new Set;for(const D of r.getAll()){if(D.type!=="bpmn:MessageFlow")continue;const O=D;if((O.waypoints??[]).length!==2)continue;const j=[O.source,O.target].find(I=>A(I)),F=j===O.source?O.target:O.source;j&&F&&F.type!=="bpmn:Participant"&&k.add(O.id)}return k},a5=x=>{var A;const R=new Map;for(const k of x){const D=r.get(k);if(!D||(D.waypoints??[]).length===2)continue;const O=((A=D.source)==null?void 0:A.type)==="bpmn:Participant"?D.source:D.target,j=O===D.source?D.target:D.source;if(j.x+j.width/2<=O.x+O.width)continue;const F=R.get(O.id)??{pool:O,msgs:[]};F.msgs.push({conn:D,other:j}),R.set(O.id,F)}for(const{pool:k,msgs:D}of R.values()){const O=Math.max(...D.map(({other:fe})=>fe.x+fe.width/2))+sf;if(r.getAll().some(fe=>{if(fe.type!=="bpmn:Participant"||fe.id===k.id)return!1;const ye=fe;return k.x<ye.x+ye.width+Di&&O+Di>ye.x&&k.y<ye.y+ye.height&&k.y+k.height>ye.y}))continue;const F={x:k.x,y:k.y,width:k.width,height:k.height},I=[...k.incoming??[],...k.outgoing??[]],U=I.map(fe=>({c:fe,wps:(fe.waypoints??[]).map(ye=>({x:ye.x,y:ye.y}))})),K=I.flatMap(fe=>{const ye=fe.label;return ye?[{label:ye,x:ye.x,y:ye.y}]:[]}),re=fr();n.resizeShape(k,{...F,width:O-k.x});const ne=D.filter(({conn:fe,other:ye})=>zE(fe,k,ye)).length,he=fr();if(!(ne>0&&he.messages>re.messages&&he.lines>=re.lines)){n.resizeShape(k,F);for(const{c:fe,wps:ye}of U){const Ye=fe.waypoints??[];Ye.length===ye.length&&Ye.every((te,se)=>Math.abs(te.x-ye[se].x)<=.5&&Math.abs(te.y-ye[se].y)<=.5)||n.updateWaypoints(fe,ye.map(te=>({x:te.x,y:te.y})))}for(let fe=0;fe<3;fe++){let ye=0;for(const Ye of K){const Ae=Ye.x-Ye.label.x,te=Ye.y-Ye.label.y;Math.abs(Ae)<=.5&&Math.abs(te)<=.5||(n.moveElements([Ye.label],{x:Ae,y:te}),ye++)}if(!ye)break}}}},GE=()=>{let x=0;for(const R of r.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},VE=()=>{let x=0;for(const R of r.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let k=1;k<A.length;k++)x+=Math.hypot(A[k].x-A[k-1].x,A[k].y-A[k-1].y)}return x},s5=x=>{const R=[];for(const A of r.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const k=A;if(x.has(k.id))continue;const O=[...k.incoming??[],...k.outgoing??[]].filter(I=>I.type==="bpmn:Association").map(I=>I.source===k?I.target:I.source);if(!O.length||O.some(I=>I===void 0))continue;const j=I=>{if(!("waypoints"in I&&I.waypoints))return[I.id];const U=I,K=[U.source,U.target];return K.some(re=>!re)?[]:K.map(re=>re.id)},F=O.flatMap(I=>j(I));F.length&&F.every(I=>x.has(I))&&R.push(k)}return R},WE=()=>ft(Ve(r)).filter(x=>x.kind==="edge-crosses-shape").length,UE=x=>{const R=(x.children??[]).filter(Li);let A=0;for(let k=0;k<R.length;k++)for(let D=k+1;D<R.length;D++){const O=R[k],j=R[D];O.x<j.x+j.width&&O.x+O.width>j.x&&O.y<j.y+j.height&&O.y+O.height>j.y&&A++}return A},fr=()=>{const x=Ve(r),R=A=>A.length>=2&&(A.every(k=>Math.abs(k.x-A[0].x)<.01)||A.every(k=>Math.abs(k.y-A[0].y)<.01));return{messages:x.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:x.edges.filter(A=>R(A.waypoints)).length}},qE=x=>{const R=new Map;for(const k of r.getAll()){if(k.type!=="bpmn:MessageFlow")continue;const D=k;if(!D.waypoints||D.waypoints.length!==2)continue;const O=D.source,j=D.target;if(!O||!j)continue;const F=x.has(O.id);if(F===x.has(j.id))continue;const I=F?j:O,U=d(I);if(!U||x.has(I.id))continue;const K=R.get(U.id);K?I.x<K.minX&&(K.minX=I.x):R.set(U.id,{pool:U,minX:I.x})}const A=[];for(const{pool:k,minX:D}of R.values()){const O=(k.children??[]).filter(j=>Li(j)&&!x.has(j.id)&&j.x>=D);O.length&&A.push({subtree:O,pool:k})}return A},c5=(x,R,A)=>{const k=new Map(R.map(j=>[j.pool.id,{subtree:[...j.subtree],pool:j.pool}])),D=new Set(x);for(const j of R)for(const F of j.subtree)D.add(F.id);let O=!1;for(;;){let j=0;for(const F of qE(D)){if(F.pool===A)continue;const I=k.get(F.pool.id);I?I.subtree.push(...F.subtree):k.set(F.pool.id,{subtree:[...F.subtree],pool:F.pool});for(const U of F.subtree)D.add(U.id);j+=F.subtree.length}if(!j)break;O=!0}return O?[...k.values()]:null},l5=(x,R)=>{const A=new Map;for(const D of r.getAll()){if(D.type!=="bpmn:DataInputAssociation"&&D.type!=="bpmn:DataOutputAssociation")continue;const O=D,j=O.waypoints;if(!j||j.length<2||!j.every(he=>Math.abs(he.x-j[0].x)<1))continue;const F=O.source,I=O.target;if(!F||!I)continue;const U=x.has(F.id);if(U===x.has(I.id))continue;const K=U?I:F,re=d(K);if(!re||re===R||re===d(U?F:I))continue;const ne=A.get(re.id);ne?K.x<ne.minX&&(ne.minX=K.x):A.set(re.id,{pool:re,minX:K.x})}const k=[];for(const{pool:D,minX:O}of A.values()){const j=(D.children??[]).filter(F=>Li(F)&&!x.has(F.id)&&F.x>=O);j.length&&k.push({subtree:j,pool:D})}return k},YE=x=>{const R=Ve(r),A=R.shapes.filter(D=>x.has(D.id)),k=new Set;for(const D of R.edges)if(!(D.type!=="bpmn:SequenceFlow"&&D.type!=="bpmn:MessageFlow"))for(const O of Qt(D,A))k.add(`${D.id}|${O.id}`);return k},KE=new Map;for(const x of Jt(e,"sequenceFlow.update")){if(x.target===void 0)continue;const R=P.get(x.target);if(!R)continue;const A=p(x.target),k=p(x.id);if(!A||!k)continue;const D=x.source!==void 0?p(x.source):k.source,O=k.target;if(!D||!O||O.id===A.id)continue;const j=k.waypoints&&k.waypoints.length>=3&&Math.abs(k.waypoints[0].x-k.waypoints[1].x)<1&&Math.abs(k.waypoints[0].y-k.waypoints[1].y)>1?{x:k.waypoints[0].x,y:k.waypoints[0].y}:void 0,F=j?k.waypoints[1].y:void 0,I=j&&k.label?{x:k.label.x,y:k.label.y}:void 0,U=I&&k.label&&Math.abs(I.y+k.label.height/2-F)<=N/5&&I.x+k.label.width>j.x?I.x+k.label.width+6:void 0,K=(D.outgoing??[]).filter(Pe=>Pe.type==="bpmn:SequenceFlow"&&Pe.id!==k.id&&Pe.target&&!hc.has(Pe.id)),re=new Set(K.map(Pe=>Pe.target.id)),ne=Pe=>{const wt={type:"bpmn:Task",x:Pe.x+2,y:Pe.y+2,width:Pe.width-4,height:Pe.height-4};return K.find(vt=>(vt.waypoints??[]).some((yn,Je)=>!!vt.waypoints[Je+1]&&rs(yn,vt.waypoints[Je+1],wt)===0))},he=zr(x.target),fe=new Set(he.map(Pe=>Pe.id)),ye=Rn.has(x.target)?{autoResize:!1}:void 0,Ye=Math.min(...he.map(Pe=>Pe.x)),Ae=Math.max(...he.map(Pe=>Pe.x+Pe.width)),te=D.x+D.width,se=O.x+O.width<=D.x,le=(()=>{if(!se)return;const Pe=d(A),wt=((Pe==null?void 0:Pe.children)??[]).filter(tt=>Li(tt)&&!fe.has(tt.id)&&tt.type!=="bpmn:Group"&&tt.type!=="bpmn:Participant"),vt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],yn=r.getAll().filter(tt=>{if(!vt.includes(tt.type))return!1;const jt=tt;return jt.id===k.id||hc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Bt=>!Bt||fe.has(Bt.id))}),Je=(tt,jt)=>he.every(Bt=>{var Ur;const xt={id:Bt.id,type:Bt.type,x:Bt.x+tt,y:Bt.y+jt,width:Bt.width,height:Bt.height};return Pe&&(xt.x<Pe.x||xt.x+xt.width>Pe.x+Pe.width||xt.y<Pe.y||xt.y+xt.height>Pe.y+Pe.height)||!At((Ur=P.get(Bt.id))==null?void 0:Ur.node.lane,Bt,Bt.y+jt+Bt.height/2)||wt.some(qn=>xt.x<qn.x+qn.width+Oi&&xt.x+xt.width+Oi>qn.x&&xt.y<qn.y+qn.height+Oi&&xt.y+xt.height+Oi>qn.y)?!1:yn.every(qn=>{for(let co=0;co+1<qn.waypoints.length;co++)if(rs(qn.waypoints[co],qn.waypoints[co+1],xt)<Oi)return!1;return!0})}),pt=D.x+D.width/2,Lt=D.y+D.height/2,ke=k.waypoints??[],Rt=ke.length>=2&&Math.abs(ke[0].y-ke[1].y)<1&&ke[1].x<ke[0].x;return[...F!==void 0?[{cx:pt,cy:F}]:[],...Rt?[{cx:D.x-Cn-A.width/2,cy:ke[0].y}]:[],{cx:pt,cy:Lt+N},{cx:pt,cy:Lt-N}].find(tt=>Je(tt.cx-(A.x+A.width/2),tt.cy-(A.y+A.height/2)))})(),be=se&&!le?te:O.x,Ze=A.y+A.height/2,Qe=i5(he,te+Cn-Ye,[0,D.y+D.height/2-Ze,O.y+O.height/2-Ze],be,te,D.y+D.height/2),Dt=te+Cn+Qe,Ft=(()=>{if(U===void 0)return 0;const Pe=te+Cn,wt=D.y+D.height/2-A.height/2,vt={x:Pe,y:wt,width:Ae-Ye,height:A.height},yn=d(D);return((yn==null?void 0:yn.children)??[]).some(pt=>Li(pt)&&!fe.has(pt.id)&&pt.id!==D.id&&pt.id!==O.id&&pt.type!=="bpmn:Group"&&pt.type!=="bpmn:Participant"&&pt.x<vt.x+vt.width&&pt.x+pt.width>vt.x&&pt.y<vt.y+vt.height&&pt.y+pt.height>vt.y)||ne(vt)?Math.max(0,U-Pe):0})(),xe=le?0:Ae-Ye+Cn*2+Qe+Ft-(se?0:O.x-te);let ve=[];if(xe>0){const Pe=d(A),wt=(Pe==null?void 0:Pe.children)??[],vt=ke=>ke.type==="bpmn:Lane";ve=(()=>{const ke=new Set;for(const Le of wt)Li(Le)&&!fe.has(Le.id)&&Le.id!==D.id&&Le.x>=be&&ke.add(Le.id);const Rt=[];for(const Le of wt){if(Le.type!=="bpmn:DataStoreReference"&&Le.type!=="bpmn:DataObjectReference")continue;const tt=Le,Bt=[...tt.incoming??[],...tt.outgoing??[]].filter(xt=>xt.type==="bpmn:DataInputAssociation"||xt.type==="bpmn:DataOutputAssociation").map(xt=>xt.source===tt?xt.target:xt.source);Bt.length&&Bt.every(xt=>xt!==void 0&&ke.has(xt.id))&&Rt.push(tt)}return Rt})();const Je=wt.filter(ke=>!("waypoints"in ke&&ke.waypoints)&&!vt(ke)&&ke.type!=="label"&&!fe.has(ke.id)&&ke.id!==D.id&&ke.x>=be),pt=Je.flatMap(ke=>ke.labels??[]),Lt=Pe?[Pe,...wt.filter(ke=>vt(ke))]:[];if(Je.length){const ke=new Set(Je.map(Ke=>Ke.id)),Rt=qE(ke),Le=Rt.length?c5(ke,Rt,Pe):null,tt=Ke=>{const _t=new Set(ke);for(const It of Ke)for(const Po of It.subtree)_t.add(Po.id);return s5(_t)},jt=tt(Rt),Bt=Le?tt(Le):jt,xt=fg(ke),Ur=new Set(ke);for(const Ke of Rt)for(const _t of Ke.subtree)Ur.add(_t.id);const qn=Rt.length?fg(Ur):xt,co=(()=>{if(!Le)return[];const Ke=new Set(ke);for(const _t of Le)for(const It of _t.subtree)Ke.add(It.id);return fg(Ke)})(),Za=Le??Rt,qr=(()=>{const Ke=new Set(ke);for(const _t of Za)for(const It of _t.subtree)Ke.add(It.id);return l5(Ke,Pe)})(),xg=qr.length?tt([...Za,...qr]):jt,Hi=new Set([...Je,...Lt].map(Ke=>Ke.id)),bt=wt.filter(Ke=>{const _t=Ke.labelTarget;return Ke.type==="label"&&!!_t&&"waypoints"in _t&&!!_t.source&&!!_t.target&&Hi.has(_t.source.id)&&Hi.has(_t.target.id)}),wn=r5();n.createSpace([...Je,...pt,...bt],Lt,{x:xe,y:0},"e",be-1);const qt=(Ke,_t,It)=>{const Po=fr(),fp=It?YE(It):null,dp=gc(Ke,xe,!!It);if(!dp)return!1;const vc=_t.length?HE(_t,xe):null,hp=fr(),Yt=!!It&&!!fp&&[...YE(It)].some(Kr=>!fp.has(Kr));return hp.messages>Po.messages&&hp.lines>=Po.lines&&!Yt?!0:(vc==null||vc(),dp(),!1)},ui=qr.length>0&&qt([...Za,...qr],Le?co:qn,new Set(qr.flatMap(Ke=>Ke.subtree.map(_t=>_t.id)))),Yr=!ui&&Le?qt(Le,co):!1;let lo=ui||Yr;!lo&&Rt.length&&(lo=qt(Rt,qn));const Qa=ui?xg:Yr?Bt:jt;if(!lo){for(const Ke of Rt){const _t=fr(),It=gc([Ke],xe);if(!It)continue;const Po=fr();(Po.messages<=_t.messages||Po.lines<_t.lines)&&It()}if(xt.length){const Ke=fr(),_t=HE(xt,xe);if(_t){const It=fr();(It.messages<=Ke.messages||It.lines<Ke.lines)&&_t()}}}if(a5(wn),Qa.length){const Ke=()=>new Set(ft(Ve(r)).map(It=>lt(It))),_t=It=>{const Po=VE(),fp=Ke(),dp=It.map(Yt=>({a:Yt,x:Yt.x,y:Yt.y})),vc=r.filter(Yt=>Yt.type==="label").map(Yt=>({label:Yt,x:Yt.x,y:Yt.y}));n.moveElements(It,{x:xe,y:0});const hp=[...Ke()].filter(Yt=>!fp.has(Yt));if(VE()<Po&&hp.length===0)return!0;for(const{a:Yt,x:Kr,y:bc}of dp)(Yt.x!==Kr||Yt.y!==bc)&&n.moveElements([Yt],{x:Kr-Yt.x,y:bc-Yt.y});for(const Yt of vc){const Kr=Yt.x-Yt.label.x,bc=Yt.y-Yt.label.y;(Kr!==0||bc!==0)&&n.moveElements([Yt.label],{x:Kr,y:bc})}return!1};if(!_t(Qa)&&Qa.length>1)for(const It of Qa)_t([It])}}}const ce=R.node.lane!==void 0?p(R.node.lane):R.node.participant!==void 0?p(R.node.participant):void 0,_e=Pe=>{if(!ce)return!0;const wt=Pe.y+Pe.height/2;return wt>=ce.y&&wt<=ce.y+ce.height},Ne=!_e(D)&&_e(O),De=Pe=>Pe.y+Pe.height/2,Re=()=>{const Pe=D.x+D.width,wt=O.x,vt=De(O)-A.height/2,yn=De(O)+A.height/2;return!r.getAll().some(Je=>Li(Je)&&Je.type!=="bpmn:Participant"&&Je.type!=="bpmn:Group"&&Je.type!=="bpmn:TextAnnotation"&&Je.id!==D.id&&Je.id!==O.id&&Je.id!==A.id&&Je.x<wt&&Je.x+Je.width>Pe&&Je.y<yn&&Je.y+Je.height>vt)},at=!Ne&&R.band!==void 0&&_e(O)&&!S(R.node.lane,R.node.participant,R.band,De(D))&&S(R.node.lane,R.node.participant,R.band,De(O))&&O.x>=D.x+D.width&&Re(),ut=Ne||at?O:D,nn=ut.y+ut.height/2,Mn=nn-(A.y+A.height/2),yt=R.band!==void 0,Hn=yt?[A]:he,Xa=(R.band===void 0||S(R.node.lane,R.node.participant,R.band,nn))&&Mt(x.target)&&Hn.every(Pe=>{var wt;return At((wt=P.get(Pe.id))==null?void 0:wt.node.lane,Pe,Pe.y+Pe.height/2+Mn)}),O5=Pe=>Math.abs(Pe.y+Pe.height/2-(A.y+A.height/2))<=N/2;if(Xa&&yt){const Pe=Math.abs(Mn)<=N/2?he.filter(wt=>wt.id!==A.id&&O5(wt)):[];if(n.moveElements(he,{x:Dt-Ye,y:0},void 0,ye),n.moveElements([A],{x:0,y:Mn},void 0,ye),Pe.length){const wt=()=>new Set(ft(Ve(r)).map(ke=>lt(ke))),vt=wt(),yn=r.filter(ke=>ke.type==="label").map(ke=>({label:ke,x:ke.x,y:ke.y}));n.moveElements(Pe,{x:0,y:Mn});const Je=wt(),pt=[...Je].filter(ke=>!vt.has(ke)).length,Lt=[...vt].filter(ke=>!Je.has(ke)).length;if(pt>Lt){n.moveElements(Pe,{x:0,y:-Mn});for(const ke of yn){const Rt=ke.x-ke.label.x,Le=ke.y-ke.label.y;(Rt!==0||Le!==0)&&n.moveElements([ke.label],{x:Rt,y:Le})}}}}else n.moveElements(he,{x:Dt-Ye,y:Xa?Mn:0},void 0,ye);const ji=d(A);if(!Xa&&R.node.lane===void 0&&R.band!==void 0&&ji){const Pe=ji.y+X+C(`pool:${R.node.participant??""}`,R.band)*N,wt=Pe-(A.y+A.height/2);wt!==0&&!Ge(ji,A,A.x+A.width/2,Pe,fe)&&n.moveElements([A],{x:0,y:wt},void 0,ye)}if(le)n.moveElements(he,{x:le.cx-(A.x+A.width/2),y:le.cy-(A.y+A.height/2)},void 0,ye);else if(ji){const Pe=(ji.children??[]).filter(Je=>Li(Je)&&!fe.has(Je.id)&&Je.type!=="bpmn:Group"&&Je.type!=="bpmn:Participant"),wt=(Je,pt,Lt,ke,Rt)=>Je.x+pt<Rt.x+Rt.width+ke&&Je.x+pt+Je.width+ke>Rt.x&&Je.y+Lt<Rt.y+Rt.height+ke&&Je.y+Lt+Je.height+ke>Rt.y,vt=Pe.find(Je=>wt(A,0,0,0,Je)),yn=vt?void 0:ne(A);if(vt||yn){const Je=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],pt=r.getAll().filter(bt=>{if(!Je.includes(bt.type))return!1;const wn=bt;return hc.has(wn.id)||!wn.waypoints||wn.waypoints.length<2?!1:![wn.source,wn.target].some(qt=>!qt||fe.has(qt.id))}),Lt=(bt,wn,qt)=>{var ui;return At((ui=P.get(bt.id))==null?void 0:ui.node.lane,bt,bt.y+qt+bt.height/2)&&bt.x+wn>=ji.x&&bt.x+wn+bt.width<=ji.x+ji.width&&bt.y+qt>=ji.y&&bt.y+qt+bt.height<=ji.y+ji.height},ke=(bt,wn)=>he.every(qt=>Lt(qt,bt,wn)&&!Pe.some(ui=>wt(qt,bt,wn,Oi,ui))&&pt.every(ui=>{const Yr={id:qt.id,type:qt.type,x:qt.x+bt,y:qt.y+wn,width:qt.width,height:qt.height};for(let lo=0;lo+1<ui.waypoints.length;lo++)if(rs(ui.waypoints[lo],ui.waypoints[lo+1],Yr)<Oi)return!1;return!0})),Rt=A.y+A.height/2,Le=[F,O.y+O.height/2].filter(bt=>bt!==void 0&&Math.abs(bt-Rt)>=1),tt=vt&&re.has(vt.id)?vt:yn==null?void 0:yn.target,jt=tt?tt.x-A.x:0,Bt=Math.max(...he.map(bt=>bt.x+bt.width)),xt=[...jt!==0?[jt]:[],...Qe!==0?[-Qe]:[],0],Ur=U===void 0?[]:xt.map(bt=>Math.max(bt,U-A.x)),qn=bt=>Bt+bt+Cn<=O.x,co=[...new Set([...Ur,...xt])].filter(qn),Za=vt&&re.has(vt.id)?[vt.x+vt.width+Cn-A.x]:[],qr=U===void 0?[]:Za.map(bt=>Math.max(bt,U-A.x)),xg=[...new Set([...qr,...Za])].filter(bt=>qn(bt)&&!co.includes(bt));let Hi;for(const bt of[co,xg]){for(const wn of Le){for(const qt of bt)if(ke(qt,wn-Rt)){Hi={dx:qt,dy:wn-Rt};break}if(Hi)break}if(Hi)break}if(Hi){const bt=Ke=>{const _t=Ke;return[_t.edge,_t.other,...Array.isArray(_t.edges)?_t.edges:[]].some(It=>typeof It=="string"&&hc.has(It))},wn=()=>new Set(ft(Ve(r)).filter(Ke=>!bt(Ke)).map(Ke=>lt(Ke))),qt=wn(),ui=r.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y}));n.moveElements(he,{x:Hi.dx,y:Hi.dy},void 0,ye);const Yr=wn(),lo=[...Yr].filter(Ke=>!qt.has(Ke)).length,Qa=[...qt].filter(Ke=>!Yr.has(Ke)).length;if(lo>Qa){n.moveElements(he,{x:-Hi.dx,y:-Hi.dy},void 0,ye);for(const Ke of ui){const _t=Ke.x-Ke.label.x,It=Ke.y-Ke.label.y;(_t!==0||It!==0)&&n.moveElements([Ke.label],{x:_t,y:It})}}else j&&KE.set(k.id,{exit:j,channelY:F,label:I})}}}{const Pe=new Set(he.map(pt=>pt.id)),wt=new Set(_.map(pt=>pt.flow.id)),vt=20,yn=pt=>{const Lt=pt.source,ke=pt.target,Rt=Math.min(Lt.x,ke.x)-vt,Le=Math.max(Lt.x+Lt.width,ke.x+ke.width)+vt,tt=Math.min(Lt.y,ke.y)-vt,jt=Math.max(Lt.y+Lt.height,ke.y+ke.height)+vt;return pt.waypoints.some(Bt=>Bt.x<Rt||Bt.x>Le||Bt.y<tt||Bt.y>jt)},Je=new Map;for(const pt of he)for(const Lt of[...pt.incoming??[],...pt.outgoing??[]])Lt.id!==x.id&&wt.has(Lt.id)&&!(Pe.has(Lt.source.id)&&Pe.has(Lt.target.id))&&Je.set(Lt.id,Lt);for(const pt of Je.values())yn(pt)&&gt(pt)}const so=ve.length?d(ve[0]):void 0;if(so){const Pe={assoc:GE(),overlaps:UE(so),crosses:WE()},wt=ve.map(Le=>({st:Le,x:Le.x})),vt=r.filter(Le=>Le.type==="label").map(Le=>({label:Le,x:Le.x,y:Le.y})),yn=Math.min(...ve.flatMap(Le=>[...Le.incoming??[],...Le.outgoing??[]].filter(tt=>tt.type==="bpmn:DataInputAssociation"||tt.type==="bpmn:DataOutputAssociation").map(tt=>(tt.source===Le?tt.target:tt.source).x))),Je=new Set(ve.map(Le=>Le.id)),pt=(so.children??[]).filter(Li).filter(Le=>!Je.has(Le.id));let Lt=yn;for(const Le of[...ve].sort((tt,jt)=>tt.x-jt.x)){let tt=Lt;for(let jt=0;jt<100;jt++){const Bt=pt.find(xt=>tt<xt.x+xt.width+Di&&tt+Le.width+Di>xt.x&&Le.y<xt.y+xt.height&&Le.y+Le.height>xt.y);if(!Bt)break;tt=Bt.x+Bt.width+Di}tt!==Le.x&&n.moveElements([Le],{x:tt-Le.x,y:0}),Lt=tt+Le.width+Di}const ke=Lt+150-(so.x+so.width);ke>0&&sp(so,so.width+ke);const Rt={assoc:GE(),overlaps:UE(so),crosses:WE()};if(Rt.assoc>=Pe.assoc||Rt.overlaps>Pe.overlaps||Rt.crosses>Pe.crosses){for(const{st:Le,x:tt}of wt)Le.x!==tt&&n.moveElements([Le],{x:tt-Le.x,y:0});ke>0&&sp(so,so.width-ke);for(const Le of vt){const tt=Le.x-Le.label.x,jt=Le.y-Le.label.y;(tt!==0||jt!==0)&&n.moveElements([Le.label],{x:tt,y:jt})}}}}for(const[x,R]of Rn){const A=p(x);if(!A)continue;const k=R.container,D=Math.abs(A.y+A.height/2-k.y-R.relCy)>=.5,O=A.label,j=Math.min(A.y,O&&!O.hidden?O.y:A.y),F=Math.max(A.y+A.height,O&&!O.hidden?O.y+O.height:0);if(D&&j>=k.y&&F<=k.y+k.height)continue;const I=A.y;R.grow(),A.y!==I&&n.moveElements([A],{x:0,y:I-A.y},void 0,{autoResize:!1})}const XE=(x,R)=>{const A=R.target===x,k=f(R.source),D=f(R.target),O=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(k,D,R.id?{type:O,businessObject:i.create(O,{id:R.id})}:{type:O})},ZE=x=>{for(const R of h){if(!R.participant.blackBox)continue;const A=p(R.participant.id);if(!A)continue;const k=[];for(const O of b){const j=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,F=j?p(j):void 0;F&&typeof F.x=="number"&&F.type!=="bpmn:Participant"&&k.push(F)}if(!k.length)continue;if(!x&&R.order===void 0){const O=(()=>{var F;const j=new Map;for(const I of k){const U=d(I);if(!U)continue;const K=j.get(U.id);K?K.n+=1:j.set(U.id,{shape:U,n:1})}return(F=[...j.values()].sort((I,U)=>U.n-I.n)[0])==null?void 0:F.shape})();if(O){const j=U=>U.reduce((K,re)=>K+re,0)/U.length,F=j(k.map(U=>U.y+U.height/2))<O.y+O.height/2,I=r.filter(U=>U.type==="bpmn:Participant"&&U.id!==R.participant.id&&U.id!==O.id).filter(U=>F?U.y+U.height<=O.y+5:U.y>=O.y+O.height-5);if(I.length){const U=[...I.reduce((le,be)=>le.set(be.y,(le.get(be.y)??0)+1),new Map)].sort((le,be)=>be[1]-le[1]||(F?be[0]-le[0]:le[0]-be[0]))[0][0],K=Math.min(A.width,HC),re=zC,ne=k.map(le=>le.x+le.width/2),he=Math.round(j(ne)-K/2),fe=Math.max(...ne)+sf,ye=le=>({x:le,width:Math.max(K,fe-le)}),Ye=I.filter(le=>Math.min(le.y+le.height,U+re)-Math.max(le.y,U)>0),Ae=le=>{const be=ye(le);return Ye.some(Ze=>Ze.x<be.x+be.width&&be.x<Ze.x+Ze.width)},te=le=>{const be=ye(le);return ne.filter(Ze=>Ze>=be.x+10&&Ze<=be.x+be.width-10).length},se=(()=>{if(!Ae(he))return he;const le=te(he);return Ye.flatMap(be=>[be.x+be.width+ny,be.x-ny-K]).map(be=>Math.round(be)).filter(be=>!Ae(be)&&te(be)>=le).sort((be,Ze)=>Math.abs(be-he)-Math.abs(Ze-he))[0]??he})();if(se!==A.x||U!==A.y||K!==A.width||re!==A.height){const le=()=>new Set(ft(Ve(r)).map(xe=>lt(xe))),be=le(),Ze={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:se,y:U,width:K,height:re});const Qe=le(),Dt=[...Qe].filter(xe=>!be.has(xe)).length,Ft=[...be].filter(xe=>!Qe.has(xe)).length;Dt>Ft&&n.resizeShape(A,Ze)}}}}const D=Math.max(...k.map(O=>O.x+O.width/2))+sf;if(D>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:D-A.x,height:A.height}),!!x)for(const O of b){const j=p(O.flow.id),F=O.flow.source===R.participant.id?O.flow.target:O.flow.target===R.participant.id?O.flow.source:void 0,I=F?p(F):void 0;if(!j||!I||I.type==="bpmn:Participant")continue;const U=I.x+I.width/2;U<A.x+10||U>A.x+A.width-10||zE(j,A,I)}}};ZE(!1);for(const x of b){const R=x.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([..._.map(I=>I.flow.id),...b.map(I=>I.flow.id)].filter(I=>!!I)),k=r.filter(I=>!!I.waypoints),D=(I,U)=>Math.abs(U.x-I.x)<2?"L":Math.abs(U.x-(I.x+I.width))<2?"R":Math.abs(U.y-I.y)<2?"T":Math.abs(U.y-(I.y+I.height))<2?"B":void 0,O=new Map,j=(I,U,K)=>{if(!I||!U||typeof I.x!="number")return;const re=D(I,U);if(!re)return;let ne=O.get(I.id);ne||O.set(I.id,ne=new Map),ne.set(re,[...ne.get(re)??[],K])};for(const I of k){const U=I.waypoints;!U||U.length<2||(j(I.source,U[0],{id:I.id,dir:"out"}),j(I.target,U[U.length-1],{id:I.id,dir:"in"}))}const F=new Set;for(const[I,U]of O){const K=p(I);if(!K||typeof K.x!="number"||![...U.values()].some(Ae=>{const te=Ae.filter(se=>se.dir==="in");return Ae.length>=3&&te.length>=1&&Ae.some(se=>se.dir==="out")&&te.some(se=>A.has(se.id))}))continue;const ne=d(K);if(!ne||F.has(ne.id)||(ne.children??[]).some(Ae=>Ae.type==="bpmn:Lane"))continue;const he=(g1=U.get("T"))!=null&&g1.length?(m1=U.get("B"))!=null&&m1.length?void 0:"B":"T";if(!he||(he==="T"?K.y-ne.y:ne.y+ne.height-(K.y+K.height))>=N)continue;const ye=(ne.children??[]).filter(Ae=>!("waypoints"in Ae&&Ae.waypoints)&&Ae.type!=="label"&&typeof Ae.x=="number"),Ye=ne.y+ne.height;n.resizeShape(ne,{x:ne.x,y:ne.y,width:ne.width,height:ne.height+N}),ie(Ye,ne.id,N),he==="T"&&ye.length&&n.moveElements(ye,{x:0,y:N}),F.add(ne.id)}}const dg=20,QE=4,u5=3,p5=2,f5=[10,30,80],dr=()=>{const x=Ve(r);return{bad:ft(x).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:pm(x),straight:x.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Ya=x=>{const R=Ve(r),A=R.edges.find(k=>k.id===x);return A?Qt(A,ei(R)).length:0},cp=x=>Ya(x)>0,lp=x=>Ve(r).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==x&&R.waypoints.length===2).length,d5=(x,R,A)=>gc([{subtree:x,pool:R}],A),JE=(x,R)=>R.bad>x.bad||R.crossings>x.crossings&&R.straight<=x.straight&&R.bad>=x.bad,Ka=(x,R)=>JE(x,R)||R.straight<x.straight,Gr=(x,R,A=()=>!0,k=JE,D=!1)=>{const O=dr(),j=gc(x,R,D);if(!j)return!1;const F=dr();return k(O,F)||!A()?(j(),!1):!0},h5=(x,R,A,k=()=>!0)=>Gr([{subtree:x,pool:R}],A,k),Vr=x=>{var R;return!!((R=P.get(x))!=null&&R.node.participant)},mc=new Map;for(const x of b){if(!Vr(x.flow.target))continue;const R=mc.get(x.flow.target)??[];R.push(x),mc.set(x.flow.target,R)}const up=[...mc.keys()],hg=new Set(_.map(x=>x.flow.target)),e1=x=>Zt.findIndex(({op:R})=>R.participant.id===x);up.sort((x,R)=>{var D,O;const A=hg.has(x)?1:0,k=hg.has(R)?1:0;return A!==k?A-k:e1((D=P.get(x))==null?void 0:D.node.participant)-e1((O=P.get(R))==null?void 0:O.node.participant)});const hr=x=>x.x+x.width/2,g5=x=>{const R=new Map;for(const D of r.getAll()){const O=D;if(!O.waypoints||!O.source||!O.target)continue;(R.get(O.source.id)??R.set(O.source.id,[]).get(O.source.id)).push(O.target.id)}const A=new Set([x]),k=[x];for(let D=0;D<k.length;D++)for(const O of R.get(k[D])??[])A.has(O)||(A.add(O),k.push(O));return A},m5=(x,R)=>{const A=g5(R);let k;for(const D of r.getAll()){const O=D;if(O.type!=="bpmn:MessageFlow"||!O.source||!O.target||O.target.id!==x||A.has(O.source.id))continue;const j=O.source;if(typeof j.x!="number"||j.type==="bpmn:Participant")continue;const F=hr(j);(k===void 0||F>k)&&(k=F)}return k},gg=(x,R)=>{const A=p(x.flow.source);if(A)return A.type==="bpmn:Participant"?m5(A.id,R):hr(A)},t1=x=>{let R;for(const A of mc.get(x)??[]){const k=gg(A,x);k!==void 0&&(!R||k>R.cx)&&(R={op:A,cx:k})}return R==null?void 0:R.op},y5=x=>{const R=t1(x),A=p(x),k=R?gg(R,x):void 0;return A&&k!==void 0?k-hr(A):void 0},v5=x=>{const R=y5(x);return R!==void 0&&Math.abs(R)<dg},mg=(x,R,A,k,D)=>{var O;for(let j=!0;j;){j=!1;for(const F of b){if(F.flow.id===A)continue;const I=R.has(F.flow.source),U=R.has(F.flow.target);if(I===U||k(I?F.flow.source:F.flow.target))continue;const K=I?F.flow.target:F.flow.source;if(D(K)||!Vr(K))continue;const re=p(F.flow.id);if(!(re!=null&&re.waypoints)||re.waypoints.length!==2)continue;const ne=p(K),he=(O=P.get(K))==null?void 0:O.node.participant;if(!ne||!he)continue;const fe=zr(K,ye=>ye.x>=ne.x).filter(ye=>!R.has(ye.id));if(!(!fe.length||fe.some(ye=>D(ye.id)))){for(const ye of fe)R.add(ye.id);x.set(he,[...x.get(he)??[],...fe]),j=!0}}}return[...x].map(([j,F])=>({subtree:F,pool:f(j)}))},n1=(x,R,A,k,D)=>mg(new Map([[R,[...x]]]),new Set(x.map(O=>O.id)),k,O=>O===A,O=>O===D),yg=x=>{const R=t1(x);if(!R)return null;const A=p(x),k=p(R.flow.source),D=gg(R,x);if(!A||!k||D===void 0)return null;const O=D-hr(A);if(O>=dg){const j=P.get(x).node.participant,F=zr(x,I=>I.x>=A.x);return{groups:n1(F,j,x,R.flow.id,R.flow.source),dx:O}}if(-O>=dg&&Vr(R.flow.source)){const j=P.get(R.flow.source).node.participant,F=zr(R.flow.source,I=>I.x>=k.x&&!v5(I.id));return{groups:n1(F,j,R.flow.source,R.flow.id,x),dx:-O}}return null},i1=()=>up.map(x=>({id:x,plan:yg(x)})).filter(x=>!!x.plan).sort((x,R)=>Math.min(...x.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(k=>k.x)))).map(x=>x.id);for(let x=0;x<3;x++){const R=dr(),A=[];for(const D of i1()){const O=yg(D);if(!O)continue;const j=gc(O.groups,O.dx);j&&A.push(j)}if(!A.length)break;if(!Ka(R,dr()))continue;for(const D of A.reverse())D();let k=!1;for(const D of i1()){const O=yg(D);O&&Gr(O.groups,O.dx,()=>!0,Ka)&&(k=!0)}if(!k)break}for(const x of up){if(hg.has(x))continue;const R=P.get(x);if(!R||R.node.lane!==void 0)continue;const A=Y(R);if(A===void 0)continue;const k=p(x),D=k?d(k):void 0;if(!k||!D)continue;const O=D.y+X+C(`pool:${R.node.participant??""}`,A)*N,j=O-(k.y+k.height/2);j!==0&&!Ge(D,k,k.x+k.width/2,O)&&n.moveElements([k],{x:0,y:j})}const o1=new Set;for(let x=0,R=!0;R&&x<u5;x++){R=!1;for(const A of up.flatMap(k=>mc.get(k)??[])){if(o1.has(A.flow.id)||!cp(A.flow.id))continue;const k=p(A.flow.target);if(!k)continue;const D=f(P.get(A.flow.target).node.participant),O=zr(A.flow.target,U=>U.x>=k.x),j=k.width+H,F=Ya(A.flow.id),I=lp(A.flow.id);for(let U=1;U<=QE;U++){const K=()=>Ya(A.flow.id)<F&&lp(A.flow.id)>=I;if(h5(O,D,j*U,K)){o1.add(A.flow.id),R=!0;break}}}}const vg=b.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),r1=new Set(vg.map(x=>x.id));for(const x of r.filter(R=>R.type==="bpmn:MessageFlow"))r1.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&vg.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of vg){if(!cp(x.id))continue;const R=p(x.source),A=p(x.target);if(!R||!A)continue;let k,D,O;if(x.preexisting){const[F,I]=R.type==="bpmn:Participant"?[A,R]:[R,A];if(k=hr(F),k<I.x||k>I.x+I.width)continue;[D,O]=F.y<I.y?[F.y+F.height,I.y]:[I.y+I.height,F.y]}else{if(R.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(k=R.x+R.width/2,Math.abs(k-(A.x+A.width/2))>15))continue;[D,O]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y]}const j=[...P.values()].map(F=>p(F.node.id)).filter(F=>!!F&&F.id!==R.id&&F.id!==A.id).filter(F=>F.x<=k&&k<=F.x+F.width&&F.y+F.height>D&&F.y<O).sort((F,I)=>F.x-I.x);for(const F of j){const I=(y1=P.get(F.id))==null?void 0:y1.node.participant,U=I?p(I):void 0;if(!I||!U)continue;const K=[...P.values()].filter(se=>se.node.participant===I).map(se=>se.node.id),re=se=>se.map(le=>p(le)).filter(le=>!!le),he=[o5(F.id,se=>{var le;return((le=P.get(se.id))==null?void 0:le.node.participant)===I}),re(K)].filter(se=>se.length).map(se=>[{subtree:se,pool:U}]);if(x.preexisting){const se=re(K);se.length&&he.push(mg(new Map([[I,[...se]]]),new Set(se.map(le=>le.id)),x.id,()=>!1,le=>le===R.id||le===A.id))}const fe=F.width+H,ye=Ya(x.id),Ye=lp(x.id),Ae=()=>Ya(x.id)<ye&&lp(x.id)>=Ye;let te=!1;for(const se of he){for(let le=1;le<=QE;le++)if(Gr(se,fe*le,Ae)){te=!0;break}if(te)break}if(!cp(x.id))break}}const pp=()=>{var R;const x=new Set;for(const A of ft(Ve(r)))A.kind!=="edge-crosses-shape"||r1.has(A.edge)||((R=p(A.edge))==null?void 0:R.type)==="bpmn:MessageFlow"&&x.add(`${A.edge}>${A.shape}`);return x},b5=(x,R)=>dr().bad>=x&&[...pp()].some(A=>!R.has(A)),a1=x=>{var R,A;return Ya(x)===0&&((A=(R=p(x))==null?void 0:R.waypoints)==null?void 0:A.length)===2},x5=(x,R,A)=>{const k=new Set(x.flatMap(O=>O.subtree.map(j=>j.id))),D=[...pp()].filter(O=>!A.has(O)).map(O=>O.split(">")[1]);return[...new Set(D)].filter(O=>k.has(O)&&O!==R.source&&O!==R.target)},_5=(x,R,A,k,D)=>{const O=x.map(U=>({...U,subtree:U.subtree.filter(K=>!D.includes(K.id))})).filter(U=>U.subtree.length),j=new Set(O.flatMap(U=>U.subtree.map(K=>K.id))),F=()=>D.every(U=>{const K=p(U);return!!K&&_.filter(re=>re.flow.target===U&&j.has(re.flow.source)).every(re=>{const ne=p(re.flow.source);return!!ne&&ne.x+ne.width<=K.x})});return Gr(O,R,()=>a1(A.id)&&[...pp()].every(U=>k.has(U))&&F(),Ka,!0)};for(const x of b){if(!cp(x.flow.id))continue;const R=p(x.flow.id);if(((v1=R==null?void 0:R.waypoints)==null?void 0:v1.length)!==2)continue;const A=p(x.flow.source),k=p(x.flow.target);if(!A||!k||A.type==="bpmn:Participant"||k.type==="bpmn:Participant"||!Vr(x.flow.source)||!Vr(x.flow.target)||Math.abs(hr(A)-hr(k))>p5)continue;const D=hr(A),O=R.waypoints.map(ye=>ye.y),[j,F]=[Math.min(...O),Math.max(...O)],I=ei(Ve(r)).filter(ye=>ye.id!==A.id&&ye.id!==k.id&&ye.x<D&&D<ye.x+ye.width&&j<ye.y+ye.height&&ye.y<F);if(!I.length)continue;const U=(b1=P.get(x.flow.source))==null?void 0:b1.node.participant,K=(x1=P.get(x.flow.target))==null?void 0:x1.node.participant;if(!U||!K)continue;const re=new Map;for(const[ye,Ye,Ae]of[[x.flow.source,A,U],[x.flow.target,k,K]]){const te=re.get(Ae)??[],se=zr(ye,le=>le.x>=Ye.x).filter(le=>!te.some(be=>be.id===le.id));re.set(Ae,[...te,...se])}const ne=new Set([...re.values()].flat().map(ye=>ye.id)),he=mg(re,ne,x.flow.id,ye=>ye===x.flow.source||ye===x.flow.target,()=>!1),fe=Math.max(...I.map(ye=>ye.x+ye.width));for(const ye of f5){const Ye=fe+ye-D;if(Ye<=0)continue;const Ae=dr().bad,te=pp();let se=[],le=!0;const be=()=>!a1(x.flow.id)||le&&(se=x5(he,x.flow,te),se.length)?!1:!b5(Ae,te);if(Gr(he,Ye,be,Ka))break;if(se.length&&(_5(he,Ye,x.flow,te,se)||(le=!1,Gr(he,Ye,be,Ka))))break}}{const x=A=>A.y+A.height/2,R=[];for(const A of P.keys()){if(!Vr(A))continue;const k=_.filter(j=>j.flow.target===A);if(k.length!==1)continue;const D=p(k[0].flow.source),O=p(A);!D||!O||!P.has(D.id)||Math.abs(x(D)-x(O))>1||O.x-(D.x+D.width)<=H+1||R.push({id:A,pred:D,node:O})}R.sort((A,k)=>A.node.x-k.node.x);for(const{id:A}of R){const k=P.get(A),D=p(A),O=p(_.find(ne=>ne.flow.target===A).flow.source);if(!D||!O)continue;const j=D.x-(O.x+O.width);if(j<=H+1)continue;const F=f(k.node.participant),I=zr(A,ne=>ne.x>=D.x),U=dr(),K=d5(I,F,-(j-H));if(!K)continue;const re=dr();(re.bad>U.bad||re.crossings>=U.crossings||re.straight<U.straight)&&K()}}ZE(!0);const w5=10,E5=400,S5=x=>[...x.incoming??[],...x.outgoing??[]].filter(R=>R.type==="bpmn:DataInputAssociation"||R.type==="bpmn:DataOutputAssociation").map(R=>R.source===x?R.target:R.source).filter(R=>!!R&&typeof R.y=="number"),R5=r.filter(x=>x.type==="bpmn:DataStoreReference"&&g.has(x.id)),C5=(x,R)=>{const A=x.x+x.width/2,k=x.y+x.height/2;let D;for(const O of R5){if((d(O)??u())!==R||O.y<x.y+x.height)continue;const j=Math.abs(O.x+O.width/2-A);j>E5||j<O.width||!S5(O).some(I=>I.height===x.height&&Math.abs(I.y+I.height/2-k)<=w5&&O.y>=I.y+I.height)||(!D||j<D.dx||j===D.dx&&O.id<D.id)&&(D={dx:j,id:O.id,cy:O.y+O.height/2})}return D==null?void 0:D.cy};for(const x of y){const R=x.associations??[],A=R.map(O=>O.source===x.dataStore.id?O.target:O.source).map(p).find(Boolean),k=A?d(A)??u():u(),D=A?{x:A.x+A.width/2,y:C5(A,k)??A.y+A.height+110}:{x:200,y:_n+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},D,k);for(const O of R)XE(x.dataStore.id,O)}for(const x of v){const A=f(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;XE(A,x.association)}let s1=0;const Wr=10,c1=40,M5=(x,R)=>{const A=R.map(I=>d(I)).filter(I=>!!I);for(const I of A){const U=Wr,K=I.y,re=I.y+I.height,ne=I.x,he=I.x+I.width;if(Math.abs(x.y-K)<U){const fe=K+U-x.y;x.y+=fe,x.height-=fe}if(Math.abs(x.y+x.height-re)<U&&(x.height=re-U-x.y),Math.abs(x.x-ne)<U){const fe=ne+U-x.x;x.x+=fe,x.width-=fe}Math.abs(x.x+x.width-he)<U&&(x.width=he-U-x.x)}if(!A.length)return;const k=Math.min(...A.map(I=>I.y)),D=Math.max(...A.map(I=>I.y+I.height)),O=k-x.y,j=x.y+x.height-D,F=c1-Wr;if(O>0!=j>0)if(O>0&&O<F){const I=O+Wr;x.y+=I,x.height-=I}else j>0&&j<F&&(x.height-=j+Wr)},A5=(x,R)=>{const A=Wr,k=30,D=r.filter(O=>O.type==="bpmn:Group"&&O.id!==R);for(const O of D){const j=O.x,F=O.x+O.width,I=O.y,U=O.y+O.height,K=x.y<U&&I<x.y+x.height,re=x.x<F&&j<x.x+x.width;if(K){if(Math.abs(x.x-F)<A){const ne=Math.min(F+A-x.x,k);ne>0&&x.width-ne>0&&(x.x+=ne,x.width-=ne)}if(Math.abs(x.x+x.width-j)<A){const ne=Math.min(x.x+x.width-(j-A),k);ne>0&&x.width-ne>0&&(x.width-=ne)}}if(re){if(Math.abs(x.y-U)<A){const ne=Math.min(U+A-x.y,k);ne>0&&x.height-ne>0&&(x.y+=ne,x.height-=ne)}if(Math.abs(x.y+x.height-I)<A){const ne=Math.min(x.y+x.height-(I-A),k);ne>0&&x.height-ne>0&&(x.height-=ne)}}}},bg=(x,R)=>{const A=c1,k=Math.min(...x.map(I=>I.x))-A,D=Math.min(...x.map(I=>I.y))-A,O=Math.max(...x.map(I=>I.x+I.width))+A,j=Math.max(...x.map(I=>I.y+I.height))+A,F={x:k,y:D,width:O-k,height:j-D};return M5(F,x),A5(F,R),F};for(const x of w){const R=(x.group.members??[]).map(p).filter(D=>!!D);let A;R.length?A=bg(R,x.group.id):(A={x:300+s1*350,y:40,width:300,height:200},s1++);const k=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());x.group.name&&n.updateLabel(k,x.group.name),(_1=x.group.members)!=null&&_1.length&&T(k,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(D=>!!D.waypoints),R=new Map,A=(D,O)=>{!D||!O||(R.has(D)||R.set(D,new Set),R.get(D).add(O))};for(const D of x){const O=(w1=D.source)==null?void 0:w1.id,j=(E1=D.target)==null?void 0:E1.id;A(O,j),((S1=D.type)!=null&&S1.includes("DataOutputAssociation")||(R1=D.type)!=null&&R1.includes("DataInputAssociation")||D.type==="bpmn:Association")&&A(j,O)}const k=r.filter(D=>D.type==="bpmn:Group");for(const D of k){const j=(((C1=D.businessObject.extensionElements)==null?void 0:C1.values)??[]).find(Ae=>Ae.$type==="bwl:Members"),F=((j==null?void 0:j.refs)??"").split(" ").filter(Boolean);if(!F.length)continue;const I=new Set(F),U=[...F];for(;U.length;){const Ae=U.shift();for(const te of R.get(Ae)??[])I.has(te)||(I.add(te),U.push(te))}const K=D.x,re=D.x+D.width,ne=D.y,he=D.y+D.height,fe=Ae=>_.filter(te=>te.flow.target===Ae).length,ye=Ae=>{var se;const te=((se=p(Ae))==null?void 0:se.type)??"";if(te==="bpmn:StartEvent"&&fe(Ae)===0)return!1;if(te.endsWith("Gateway")){const le=_.filter(be=>be.flow.target===Ae).map(be=>be.flow.source);if(le.length&&le.every(be=>{var Ze;return((Ze=p(be))==null?void 0:Ze.type)==="bpmn:StartEvent"&&fe(be)===0}))return!1}return!0},Ye=r.filter(Ae=>Li(Ae)).filter(Ae=>Ae.type!=="bpmn:Group"&&Ae.type!=="bpmn:Participant"&&Ae.type!=="bpmn:TextAnnotation"&&!I.has(Ae.id)&&Vr(Ae.id)&&ye(Ae.id)&&Ae.x<re&&Ae.x+Ae.width>K&&Ae.y<he&&Ae.y+Ae.height>ne);if(Ye.length)for(const Ae of[-1,1]){const te=Ye.filter(ve=>(ve.x+ve.width-K<=re-ve.x?-1:1)===Ae);if(!te.length)continue;const se=[];for(const ve of te){const ce=se.find(_e=>_e.some(Ne=>ve.y<Ne.y+Ne.height&&ve.y+ve.height>Ne.y));ce?ce.push(ve):se.push([ve])}const le=new Map;for(const ve of se){let ce=Ae<0?K-Wr:re+Wr;for(const _e of[...ve].sort((Ne,De)=>Ae<0?De.x-Ne.x:Ne.x-De.x)){const Ne=Ae<0?Math.min(_e.x,ce-_e.width):Math.max(_e.x,ce);ce=Ae<0?Ne-Di:Ne+_e.width+Di,Ne!==_e.x&&Math.sign(Ne-_e.x)===Ae&&le.set(_e.id,Ne-_e.x)}}const be=new Map,Ze=ve=>be.get(ve)===ve||!be.get(ve)?ve:Ze(be.get(ve));for(const ve of te)be.set(ve.id,ve.id);for(const ve of b){const ce=le.has(ve.flow.source)?ve.flow.source:void 0,_e=le.has(ve.flow.target)?ve.flow.target:void 0;if(!ce||!_e)continue;const Ne=p(ve.flow.id);((M1=Ne==null?void 0:Ne.waypoints)==null?void 0:M1.length)===2&&be.set(Ze(ce),Ze(_e))}const Qe=new Map;for(const ve of te){if(!le.has(ve.id))continue;const ce=Ze(ve.id);Qe.set(ce,[...Qe.get(ce)??[],ve])}const Dt=[...Qe.values()].sort((ve,ce)=>Ae<0?Math.min(...ve.map(_e=>_e.x))-Math.min(...ce.map(_e=>_e.x)):Math.max(...ce.map(_e=>_e.x))-Math.max(...ve.map(_e=>_e.x))),Ft=[];let xe=!0;for(const ve of Dt){const ce=ve.map(De=>le.get(De.id)??0).reduce((De,Re)=>Math.abs(Re)>Math.abs(De)?Re:De,0),_e=new Map;let Ne=!0;for(const De of ve){const Re=d(De);if(!Re){Ne=!1;break}_e.has(Re.id)||_e.set(Re.id,{subtree:[],pool:Re}),_e.get(Re.id).subtree.push(De)}Ne&&Gr([..._e.values()],ce,()=>!0,Ka)?Ft.push({shapes:ve,dx:ce}):xe=!1}if(!xe)for(const ve of Ft.reverse())n.moveElements(ve.shapes,{x:-ve.dx,y:0})}}}{const x=new Set([...w.map(R=>R.group.id),...Jt(e,"group.update").map(R=>R.id)]);for(const R of r.filter(A=>A.type==="bpmn:Group")){if(x.has(R.id))continue;const k=(((A1=R.businessObject.extensionElements)==null?void 0:A1.values)??[]).find(F=>F.$type==="bwl:Members"),D=((k==null?void 0:k.refs)??"").split(" ").filter(Boolean).map(p).filter(F=>!!F);!D.length||!D.some(F=>{const I=g.get(F.id);return!I||I.x!==F.x||I.y!==F.y})||!D.some(F=>F.x<R.x||F.y<R.y||F.x+F.width>R.x+R.width||F.y+F.height>R.y+R.height)||n.resizeShape(R,bg(D,R.id))}}{const R=new Map(wr(Ve(r)).map(F=>[F.owner,F.rect])),A=r.filter(F=>!!F.waypoints),k=new Map,D=(F,I)=>{!F||!I||(k.has(F)||k.set(F,new Set),k.get(F).add(I))};for(const F of A){const I=(P1=F.source)==null?void 0:P1.id,U=(T1=F.target)==null?void 0:T1.id;D(I,U),((k1=F.type)!=null&&k1.includes("DataOutputAssociation")||(O1=F.type)!=null&&O1.includes("DataInputAssociation")||F.type==="bpmn:Association")&&D(U,I)}const O=F=>_.filter(I=>I.flow.target===F).length,j=F=>{var U;const I=((U=p(F))==null?void 0:U.type)??"";if(I==="bpmn:StartEvent"&&O(F)===0)return!1;if(I.endsWith("Gateway")){const K=_.filter(re=>re.flow.target===F).map(re=>re.flow.source);if(K.length&&K.every(re=>{var ne;return((ne=p(re))==null?void 0:ne.type)==="bpmn:StartEvent"&&O(re)===0}))return!1}return!0};for(const F of r.filter(I=>I.type==="bpmn:Group")){const U=(((D1=F.businessObject.extensionElements)==null?void 0:D1.values)??[]).find(ce=>ce.$type==="bwl:Members"),K=((U==null?void 0:U.refs)??"").split(" ").filter(Boolean);if(!K.length)continue;const re=K.map(p).filter(ce=>!!ce);if(!re.length||!(w.some(ce=>ce.group.id===F.id)||Jt(e,"group.update").some(ce=>ce.id===F.id)||re.some(ce=>{const _e=g.get(ce.id);return!_e||_e.x!==ce.x||_e.y!==ce.y})))continue;const he=new Set(K),fe=[...K];for(;fe.length;){const ce=fe.shift();for(const _e of k.get(ce)??[])he.has(_e)||(he.add(_e),fe.push(_e))}const ye=F.x,Ye=F.x+F.width,Ae=F.y,te=F.y+F.height,se=ce=>{const _e=R.get(ce.id),Ne={x:ce.x,y:ce.y,width:ce.width,height:ce.height};return _e?[Ne,{x:_e.x,y:_e.y,width:_e.width,height:_e.height}]:[Ne]},le=re.flatMap(se),be=Math.min(...le.map(ce=>ce.x)),Ze=Math.max(...le.map(ce=>ce.x+ce.width)),Qe=Math.min(...le.map(ce=>ce.y)),Dt=Math.max(...le.map(ce=>ce.y+ce.height)),Ft={L:be-ye,R:Ye-Ze,T:Qe-Ae,B:te-Dt},xe=r.filter(ce=>Li(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!he.has(ce.id)&&j(ce.id)&&ce.x<Ye&&ce.x+ce.width>ye&&ce.y<te&&ce.y+ce.height>Ae);if(!xe.length)continue;const ve={L:0,R:0,T:0,B:0};for(const ce of xe){const _e=se(ce),Ne=Math.min(..._e.map(yt=>yt.x)),De=Math.max(..._e.map(yt=>yt.x+yt.width)),Re=Math.min(..._e.map(yt=>yt.y)),at=Math.max(..._e.map(yt=>yt.y+yt.height)),ut={L:De-ye,R:Ye-Ne,T:at-Ae,B:te-Re},nn=["L","R","T","B"].filter(yt=>ut[yt]<=Ft[yt]+.001);if(!nn.length)continue;const Mn=nn.reduce((yt,Hn)=>ut[Hn]<ut[yt]?Hn:yt,nn[0]);ve[Mn]=Math.max(ve[Mn],Math.min(ut[Mn]+10,Ft[Mn]))}!ve.L&&!ve.R&&!ve.T&&!ve.B||n.resizeShape(F,{x:F.x+ve.L,y:F.y+ve.T,width:F.width-ve.L-ve.R,height:F.height-ve.T-ve.B})}}const l1=x=>{const R=x.waypoints;if(R!=null&&R.length){const k=R[Math.floor((R.length-1)/2)];return{x:k.x,y:k.y,width:0,height:0}}const A=x;return{x:A.x,y:A.y,width:A.width,height:A.height}};let yc=0;const u1=12,p1=14,P5=15,T5=300,k5=x=>{const R=x.split(`
7
+ `),A=Math.max(...R.map(O=>aa(O,u1))),k=Math.max(100,Math.min(T5,Math.ceil(A)+p1)),D=R.reduce((O,j)=>O+Math.max(1,Math.ceil((aa(j,u1)+p1)/k)),0);return{width:k,height:Math.max(30,D*P5+10)}};for(const x of E){const R=x.association,A=((L1=x.placement)==null?void 0:L1.anchor)??(R?R.source===x.annotation.id?R.target:R.source:void 0),k=A?p(A):void 0,D=k?l1(k):void 0,O=k5(x.annotation.text??"");let j;if(D&&x.placement){const[K,re]=Yc[x.placement.side],ne=x.placement.offset??50;j={x:D.x+D.width/2+K*(D.width/2+O.width/2+ne),y:D.y+D.height/2+re*(D.height/2+O.height/2+ne)}}else D?(j={x:D.x+D.width/2+180+yc%3*260,y:D.y-110-yc%2*95},yc++):(j={x:300+yc*260,y:60},yc++);const F=k?d(k)??u():u(),I=F;D&&typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant"&&(j=Xc(r,D,O,I,x.placement?{placement:x.placement}:{from:j}));const U=n.createShape({type:"bpmn:TextAnnotation",width:O.width,height:O.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},j,F);if(R){const K=re=>re===x.annotation.id?U:f(re);n.connect(K(R.source),K(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}x.placement&&T(U,"bwl:Placement",L(x.placement))}for(const x of Jt(e,"association.add")){const R=x.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}const f1=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Jt(e,"node.update")){let R=f(x.id);if(x.type&&qc(x.type)!==R.type){const A=R.x+R.width/2,k=R.y+R.height/2,D=f1();R=c.replaceElement(R,{type:qc(x.type),...x.eventDefinition?{eventDefinitionType:wc[x.eventDefinition]}:{}});const O=f1(),j=[...D].filter(U=>U!==x.id&&!O.has(U));if(j.length)throw new ry({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:j});const F=Math.round(A-(R.x+R.width/2)),I=Math.round(k-(R.y+R.height/2));if(F!==0||I!==0){n.moveShape(R,{x:F,y:I});for(const U of[...R.incoming??[],...R.outgoing??[]])gt(U)}}if(x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(R,{"bwl:band":x.band});const A=R.y+R.height/2,k=d(R),D=x.lane?f(x.lane):((k==null?void 0:k.children)??[]).find(j=>j.type==="bpmn:Lane"&&A>=j.y&&A<=j.y+j.height);x.band!==void 0&&mt(D==null?void 0:D.id,x.band,k);const O=D?D.y+(x.band===void 0?D.height/2:Math.min(D.height/2,Q)+C(D.id,x.band)*N):x.band!==void 0&&k?k.y+X+C(`pool:${k.id}`,x.band)*N:void 0;if(O!==void 0){const j=O-A;j!==0&&n.moveElements([R],{x:0,y:j})}}}for(const x of Jt(e,"sequenceFlow.update")){const R=f(x.id);if(x.source!==void 0||x.target!==void 0){const A=R,k=x.source!==void 0?f(x.source):A.source,D=x.target!==void 0?f(x.target):A.target,O=I=>({x:I.x+I.width/2,y:I.y+I.height/2});n.reconnect(A,k,D,[O(k),O(D)]);const j=KE.get(A.id),F=D.y+D.height/2;if(j&&D.x>j.exit.x&&Math.abs(F-j.exit.y)>1){n.updateWaypoints(A,[j.exit,{x:j.exit.x,y:F},{x:D.x,y:F}]);const I=A.label;if(I&&j.label){const K=Math.abs(j.label.y+I.height/2-j.channelY)<=N/5&&j.label.x+I.width>j.exit.x,re=j.exit.x+6,ne=D.x-6-I.width,he=K?ne>=re?{x:Math.max(re,Math.min(j.label.x,ne)),y:j.label.y+(F-j.channelY)}:void 0:j.label;he&&(he.x!==I.x||he.y!==I.y)&&n.moveElements([I],{x:he.x-I.x,y:he.y-I.y})}}else Math.abs(F-(k.y+k.height/2))>1&&gt(A)}x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(R,{name:((I1=x.condition)==null?void 0:I1.label)??void 0})}for(const x of Jt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of Jt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(f(x.id),{name:x.name??void 0});for(const x of Jt(e,"annotation.update")){const R=f(x.id);if(x.text!==void 0&&n.updateProperties(R,{text:x.text}),x.placement===null)T(R,"bwl:Placement",null);else if(x.placement){const A=f(x.placement.anchor),k=l1(A),D=d(A)??u(),O=typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant",[j,F]=Yc[x.placement.side],I=x.placement.offset??50,U={x:k.x+k.width/2+j*(k.width/2+R.width/2+I),y:k.y+k.height/2+F*(k.height/2+R.height/2+I)},K=O?Xc(r,k,{width:R.width,height:R.height},D,{placement:x.placement,selfId:x.id}):U;n.moveElements([R],{x:K.x-(R.x+R.width/2),y:K.y-(R.y+R.height/2)}),T(R,"bwl:Placement",L(x.placement))}}for(const x of Jt(e,"group.update")){const R=f(x.id);if(x.name!==void 0&&n.updateLabel(R,x.name??""),x.members){const A=x.members.map(p).filter(k=>!!k);A.length&&n.resizeShape(R,bg(A,x.id)),T(R,"bwl:Members",{refs:x.members.join(" ")})}}}function cf(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 WC(e,t,n){var u,p;const{elementRegistry:i}=e,o=e.modeling,r=f=>ft(f).filter(d=>!t.has(lt(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Ve(i),c=r(s),l=[...new Set(c.flatMap(cf))].filter(f=>n.has(f)&&a(f));if(l.length)for(const f of l){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const ee=d.x+d.width/2,We=d.y+d.height/2;h=i.getAll().find(qe=>{if(qe.type!=="bpmn:Participant")return!1;const Ge=qe;return typeof Ge.x=="number"&&typeof Ge.width=="number"&&ee>=Ge.x&&ee<=Ge.x+Ge.width&&We>=Ge.y&&We<=Ge.y+Ge.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const _=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ee=>ee.$type==="bwl:Placement"),b=[...d.incoming??[],...d.outgoing??[]].find(ee=>ee.type==="bpmn:Association"),y=(_!=null&&_.anchor?i.get(_.anchor):void 0)??(b?((p=b.source)==null?void 0:p.id)===f?b.target:b.source:void 0);if(!y)continue;const v=y.waypoints,E=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:y.x,y:y.y,width:y.width,height:y.height},w={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=_==null?void 0:_.side,L=oy(i,E,h),$=[];if(T&&T in Yc&&$.push(Xc(i,E,w,h,{placement:{side:T,offset:(_==null?void 0:_.offset)??null},selfId:f})),L&&!Kc(P,w,L))for(const ee of VC)$.push(Xc(i,E,w,h,{placement:{side:ee,offset:null},selfId:f}));for(const[ee,We]of[[-1,0],[1,0],[0,-1],[0,1]])for(let qe=1;qe<=GC;qe++)$.push({x:P.x+ee*iy*qe,y:P.y+We*iy*qe});const N={...s,edges:s.edges.filter(ee=>ee.id!==(b==null?void 0:b.id))},H=r(N),X=H.filter(ee=>cf(ee).includes(f)).length;if(!X)continue;let Q;for(const ee of $){const We=ee.x-P.x,qe=ee.y-P.y;if(!We&&!qe||ee.x-w.width/2<h.x||ee.x+w.width/2>h.x+h.width||ee.y-w.height/2<h.y||ee.y+w.height/2>h.y+h.height||L&&!Kc(ee,w,L))continue;const Ge={...N,shapes:N.shapes.map(W=>W.id===f?{...W,x:W.x+We,y:W.y+qe}:W)},Se=r(Ge),Z=Se.filter(W=>cf(W).includes(f)).length;if(Z>=X||Se.length>H.length)continue;const oe=Math.abs(We)+Math.abs(qe);if((!Q||Z<Q.mine||Z===Q.mine&&(Se.length<Q.all||Se.length===Q.all&&oe<Q.dist))&&(Q={x:ee.x,y:ee.y,mine:Z,all:Se.length,dist:oe}),Q.mine===0&&Q.all<H.length)break}Q&&o.moveElements([d],{x:Q.x-P.x,y:Q.y-P.y})}}const UC=60;function lf(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 qC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=u=>ft(u).filter(p=>!t.has(lt(p))),a=u=>u.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,p)=>p.x>=u.x&&p.y>=u.y&&p.x+p.width<=u.x+u.width&&p.y+p.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const f=new Set,d=new Set([u]);for(let h=0;h<4;h++){let m=!1;for(const _ of n.shapes)_.type!=="bpmn:Group"||f.has(_.id)||[...d].some(b=>{const y=s.get(b);return y&&c(_,y)})&&(f.add(_.id),m=!0);for(const _ of n.shapes)_.type!=="bpmn:Participant"||d.has(_.id)||[...f].some(b=>{const y=s.get(b);return y&&c(y,_)})&&(d.add(_.id),m=!0);if(!m)break}const g=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(m=>{const _=s.get(m);return _&&c(_,h)})).map(h=>h.id);return[...d,...f,...g]};for(let u=0;u<6;u++){const p=Ve(i),f=r(p),d=a(f);if(!d.length)return;const g=new Map(p.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[E,w]=v.pools,P=g.get(E),T=g.get(w);if(!P||!T)continue;const[L,$]=P.x<=T.x?[P,T]:[T,P];if(v.contained)continue;const N=s.get(L.id),H=s.get($.id),X=N&&H?Math.max(H.x-(N.x+N.width),0):UC,Q=L.x+L.width+X-$.x;if(Q<=0)continue;const ee=l($.id).filter(We=>i.get(We));ee.length&&(!h||Q>h.dx)&&(h={movers:ee,dx:Q})}if(!h)return;const m=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!m.length)return;const _=f.length,b=d.length;o.moveElements(m,{x:h.dx,y:0});const y=r(Ve(i));if(!(a(y).length<b&&y.length<=_)){o.moveElements(m,{x:-h.dx,y:0});return}}}const us=.5,sy=150;function YC(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of KC(n))i.length<n.length&&i.some(r=>XC(e.elementRegistry.get(r.id)))||ZC(e,i)}function KC(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)<=us?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function XC(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 ZC(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(b=>b.x+b.width),r=Math.max(...o);if(r-Math.min(...o)>us)return;const a=t.map(b=>n.get(b.id)).filter(b=>!!b&&typeof b.x=="number");if(a.length<2)return;const s=new Map(t.map(b=>[b.id,b.x]));if(a.some(b=>Math.abs(b.x-s.get(b.id))>us))return;const c=a.map(b=>b.x+b.width);if(Math.max(...c)-Math.min(...c)<=us)return;const l=b=>b.x+b.width,u=b=>!!b&&typeof b.width=="number",p=b=>{const y={shapes:[],edges:[],lanes:[]},v=E=>{for(const w of E.children??[]){if("waypoints"in w&&w.waypoints){y.edges.push(w);continue}w.type!=="label"&&(w.type==="bpmn:Lane"?y.lanes.push(w):y.shapes.push(w),v(w))}};return v(b),y},f=new Map(a.map(b=>[b.id,p(b)]));let d=r;for(const b of a){const{shapes:y}=f.get(b.id),v=y.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);v.length&&(d=Math.max(d,Math.max(...v)+sy))}const g=a.filter(b=>Math.abs(l(b)-d)>us);if(!g.length)return;for(const b of g){const y=l(b),{shapes:v,edges:E,lanes:w}=f.get(b.id);if([...v.flatMap(L=>[l(L),...u(L.label)?[l(L.label)]:[]]),...E.flatMap(L=>[...L.waypoints.map($=>$.x),...u(L.label)?[l(L.label)]:[]])].some(L=>L>d)||[...(b.incoming??[]).map(L=>L.waypoints[L.waypoints.length-1]),...(b.outgoing??[]).map(L=>L.waypoints[0])].some(L=>!L||L.x>d||Math.abs(L.x-y)<1))return;if(d>y){const L={x:y,y:b.y,width:d-y,height:b.height},$=new Set([b.id,...v.map(H=>H.id),...E.map(H=>H.id),...w.map(H=>H.id)]);if(n.getAll().some(H=>{var ee;if("waypoints"in H&&H.waypoints||H.type==="bpmn:Group"||!u(H))return!1;const X=H.type==="label"?(ee=H.labelTarget)==null?void 0:ee.id:H.id;if(!X||$.has(X)||$.has(H.id))return!1;const Q=H;return Q.x<L.x+L.width&&Q.x+Q.width>L.x&&Q.y<L.y+L.height&&Q.y+Q.height>L.y}))return}}const h=()=>new Set(ft(Ve(n)).map(lt)),m=h(),_=g.map(b=>b.width);for(const b of g)lf(i,b,d-b.x,{layout:!1});[...h()].every(b=>m.has(b))||g.forEach((b,y)=>lf(i,b,_[y],{layout:!1}))}function QC(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ft(l).filter(u=>!t.has(lt(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(w=>w.id!==l.id&&w.type!=="bpmn:Group"&&a(l,w));if(!p.length)continue;const f=p.map(w=>i.get(w.id)).filter(w=>!!w&&typeof w.x=="number");if(f.length!==p.length)continue;const d=s(p),g=s(f),h=g.l+(l.x-d.l),m=g.t+(l.y-d.t),_=g.r+(l.x+l.width-d.r),b=g.b+(l.y+l.height-d.b),y={x:h,y:m,width:_-h,height:b-m};if(y.width<=0||y.height<=0||Math.abs(y.x-u.x)<1&&Math.abs(y.y-u.y)<1&&Math.abs(y.width-u.width)<1&&Math.abs(y.height-u.height)<1)continue;const v=r(Ve(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,y),r(Ve(i)).length>v&&o.resizeShape(u,E)}}const Zc=20,Qc=10;function JC(e,t,n,i){var p,f;const{elementRegistry:o}=e,r=e.modeling,a=d=>new Set(ft(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(lt)),s=Ve(o),c=ft(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(lt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Te=>Te.id===d);if(!((p=h==null?void 0:h.members)!=null&&p.length))continue;const m=l.get(d);if(!(!m||Math.abs(m.x-h.x)>=.5||Math.abs(m.y-h.y)>=.5||Math.abs(m.width-h.width)>=.5||Math.abs(m.height-h.height)>=.5))continue;const b=h.members.map(Te=>o.get(Te)).filter(Te=>!!Te&&typeof Te.x=="number");if(!b.length)continue;const y=Math.min(...b.map(Te=>Te.x)),v=Math.min(...b.map(Te=>Te.y)),E=Math.max(...b.map(Te=>Te.x+Te.width)),w=Math.max(...b.map(Te=>Te.y+Te.height)),P=h.x,T=h.y,L=h.x+h.width,$=h.y+h.height;let N=P,H=T,X=L,Q=$;for(const Te of g){const B=s.edges.find(S=>S.id===Te.edge);if(!B)continue;const C=B.endpoints.some(S=>{const G=s.shapes.find(Me=>Me.id===S);if(!G||G.container)return!1;const q=G.x+G.width/2,ie=G.y+G.height/2;return P<q&&q<L&&T<ie&&ie<$});for(const S of bn(B)){const G=S.axis==="v"?[T,$]:[P,L];Math.min(S.hi,G[1])-Math.max(S.lo,G[0])<Gp||(S.axis==="v"?P<S.at&&S.at<L:T<S.at&&S.at<$)&&C||(S.axis==="v"?(Math.abs(S.at-P)<=sa&&(N=Math.max(N,S.at+Zc)),Math.abs(S.at-L)<=sa&&(X=Math.min(X,S.at-Zc))):(Math.abs(S.at-T)<=sa&&(H=Math.max(H,S.at+Zc)),Math.abs(S.at-$)<=sa&&(Q=Math.min(Q,S.at-Zc))))}}if(N>y-Qc&&(N=P),H>v-Qc&&(H=T),X<E+Qc&&(X=L),Q<w+Qc&&(Q=$),N===P&&H===T&&X===L&&Q===$)continue;const ee=o.get(d),We={x:ee.x,y:ee.y,width:ee.width,height:ee.height},qe=Ve(o),Ge=new Set(ft(qe).map(lt)),Se=a(qe);r.resizeShape(ee,{x:N,y:H,width:X-N,height:Q-H});let Z=Ve(o),oe=ft(Z).filter(Te=>!Ge.has(lt(Te)));const W=[];if(oe.length>0&&oe.every(Te=>Te.kind==="label-over-line"&&!i.has(Te.edge)&&Z.edges.some(B=>B.id===Te.edge))){for(const Te of oe){if(Te.kind!=="label-over-line")continue;const B=Z.edges.find(ie=>ie.id===Te.edge),C=B&&rf(B,Z),S=(f=o.get(Te.edge))==null?void 0:f.label;if(!C||!S)continue;const G=C.x-S.x,q=C.y-S.y;r.moveElements([S],{x:G,y:q}),W.push({label:S,dx:G,dy:q})}Z=Ve(o),oe=ft(Z).filter(Te=>!Ge.has(lt(Te)))}const ae=a(Z),ge=[...ae].some(Te=>!Se.has(Te));if(oe.length||ge||ae.size>=Se.size){for(const Te of W.reverse())r.moveElements([Te.label],{x:-Te.dx,y:-Te.dy});r.resizeShape(ee,We)}}}function eM(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=wp((o==null?void 0:o.$parent)??o),a=es(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:Ep(u,i,r),requests:Mp(u)}:{texts:{},requests:[]})}return{contexts:()=>[...e].flatMap(([l,u])=>{const p=t.get(l);return p?[{element:p,...u.texts!==void 0?{texts:u.texts}:{},...u.confirm?{confirm:u.confirm}:{},designLocale:i.designLocale,locales:a,...r?{rootLang:r}:{},before:s.get(l)}]:[]})}}function cy(e,t,n={}){var H,X;const{i18n:i,lower:o=ay}=n,r=ty(e),a=wm(r.elementRegistry),s=ey(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=$C(t,a,i),u=i&&l.writes.size?eM(l.writes,r.elementRegistry,r.canvas,i):void 0,p=Ve(r.elementRegistry),f=new Set(ft(p).map(lt)),d=new Set(ft(p,{includeObservationOnly:!0}).map(lt)),g=new Set(p.edges.map(Q=>Q.id)),h=new Set(t.flatMap(Q=>Q.kind==="sequenceFlow.update"&&(Q.source!==void 0||Q.target!==void 0)?[Q.id]:[])),m=new Set(p.shapes.map(Q=>Q.id)),_=ua(p),b=_.length,y=new Set(_.map(([Q,ee])=>`${Q}|${ee}`)),v=Bo(p),E=new Set(v.map(([Q,ee])=>`${Q}|${ee}`)),w=new Map;for(const Q of r.elementRegistry.filter(ee=>"waypoints"in ee&&!!ee.waypoints))Q.label&&w.set(Q.id,{wps:Q.waypoints.map(ee=>({x:ee.x,y:ee.y})),label:{x:Q.label.x,y:Q.label.y},source:(H=Q.source)==null?void 0:H.id,target:(X=Q.target)==null?void 0:X.id});const P=e.get("commandStack");try{Mg(P,()=>{o(l.ops,r);for(const ee of(u==null?void 0:u.contexts())??[])P.execute(Rp,ee);qC(r,f,p),YC(r,p),QC(r,f,p),_C(r,p,h),km(r,g);const Q=Qp(r,f);Rm(r,y,g),Hm(r,f,g),Lm(r,g),MC(r,g,h),Nm(r,f,g),kC(r,f,g),vC(r,E,g),qm(r,f,g),Um(r,g,h),Km(r,m),WC(r,f,m),Qp(r,f,Q),JC(r,d,p,g),Xm(r,f),Wm(r,w)})}catch(Q){return{ok:!1,issues:[Q instanceof ry?Q.issue:{kind:"lower-failed",message:Q instanceof Error?Q.message:String(Q)}],findings:[],stats:c}}const T=Ve(r.elementRegistry),L=ft(T,{includeObservationOnly:!0}).filter(Q=>!d.has(lt(Q))),$=fm(T),N=Bo(T);return{ok:!0,issues:[],findings:L,stats:{edgeCrossings:{before:b,after:$.pairs.length,pairs:$.pairs,solidPairs:$.solidPairs,dashedPairs:$.dashedPairs,mixedPairs:$.mixedPairs,crossPoolMessages:$.crossPoolMessages},sharedEndpointCrossings:{before:v.length,after:N.length,pairs:N}}}}function tM(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function ly(e,t){return typeof e.get=="function"?e.get(t):e[t]}function uy(e,t){const n=ly(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function py(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function nM(e){return typeof e=="string"&&yp.includes(e)}function Bi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function fy(e,t={}){const n=e.rootElements??[],i=n.find(Z=>Z.$type==="bpmn:Collaboration"),o=new Map(n.filter(Z=>Z.$type==="bpmn:Process").map(Z=>[Z.id,Z])),r=[],a=[],s=[],c=[],l=[],u=[],p={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],d=[],g=[],h=[],m=[],_=[],b=[],y=new Map,v=new Set,E=new Set,w=Z=>{Z&&v.add(Z)},P=Z=>{v.add(Z),E.add(Z)},T=Z=>{const oe=py(Z,"bwl:Placement");if(!oe)return;const W=typeof oe.anchor=="string"?oe.anchor:void 0;if(!W||!nM(oe.side))return;const Y=typeof oe.offset=="number"?oe.offset:void 0;m.push({owner:Z.id,anchor:W,side:oe.side,...Y!==void 0?{offset:Y}:{}})},L=Z=>{const oe=py(Z,"bwl:Members"),W=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];W.length&&b.push({owner:Z.id,refs:W})},$=Z=>{var oe;for(const W of Z)switch(w(W.id),W.$type){case"bpmn:TextAnnotation":P(W.id),y.set(W.id,W),c.push({id:W.id,text:typeof W.text=="string"?W.text:""}),T(W);break;case"bpmn:Association":g.push({id:W.id,type:W.$type,source:Bi(W.sourceRef),target:Bi(W.targetRef)});break;case"bpmn:Group":{P(W.id),y.set(W.id,W);const Y=(oe=W.categoryValueRef)==null?void 0:oe.value;l.push({id:W.id,...typeof Y=="string"&&Y?{name:Y}:{}}),L(W);break}default:u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"})}},N=Z=>{for(const oe of Z.flowElements??[])w(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"}),(oe.flowElements??[]).length&&N(oe);for(const oe of Z.artifacts??[])w(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"})},H=(Z,oe)=>{const W=Z.flowElements??[],Y=(Z.laneSets??[]).flatMap(ge=>ge.lanes??[]),ae=new Map;for(const ge of Y){w(ge.id),y.set(ge.id,ge);for(const Te of ge.flowNodeRef??[]){const B=Bi(Te);B&&ae.set(B,ge.id)}}for(const ge of W){if(w(ge.id),y.set(ge.id,ge),ge.$type==="bpmn:SequenceFlow"){f.push({id:ge.id,source:Bi(ge.sourceRef),target:Bi(ge.targetRef),...typeof ge.name=="string"&&ge.name?{name:ge.name}:{}});continue}if(ge.$type==="bpmn:DataStoreReference"){P(ge.id),s.push({id:ge.id,...ge.name?{name:ge.name}:{}});continue}const Te=tM(ge.$type),B=Te==="intermediateCatchEvent"?gp((ge.eventDefinitions??[]).map(q=>q.$type)):void 0;if(!_g(Te)||Te==="intermediateCatchEvent"&&!B){u.push({id:ge.id,type:ge.$type,reason:"type-outside-mvp"});continue}P(ge.id);const C=Te==="boundaryEvent"?Bi(ge.attachedToRef):void 0;a.push({id:ge.id,type:Te,...ge.name?{name:ge.name}:{},...oe?{participant:oe}:{},...ae.has(ge.id)?{lane:ae.get(ge.id)}:{},...C?{attachedTo:C}:{},...B?{eventDefinition:B}:{}}),Te==="subProcess"&&N(ge);const S=uy(ge,"bwl:band");S!==void 0&&(p.bands[ge.id]=S);const G=ly(ge,"bwl:afterColumn");typeof G=="string"&&G!==""&&_.push([ge.id,G]);for(const q of ge.dataOutputAssociations??[])w(q.id),h.push({id:q.id,type:q.$type,source:ge.id,target:Bi(q.targetRef)});for(const q of ge.dataInputAssociations??[])w(q.id),h.push({id:q.id,type:q.$type,source:Bi((q.sourceRef??[])[0]),target:ge.id})}$(Z.artifacts??[])};if(i){const Z=new Set;for(const oe of i.participants??[]){P(oe.id),y.set(oe.id,oe);const W=Bi(oe.processRef);W&&Z.add(W);const Y=W?o.get(W):void 0,ae=((Y==null?void 0:Y.laneSets)??[]).flatMap(C=>C.lanes??[]),ge=ae.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of ge)P(C.id);const Te=!Y||(Y.flowElements??[]).length===0&&ae.length===0&&(Y.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...Te?{blackBox:!0}:{},...ge.length?{lanes:ge}:{}});const B=uy(oe,"bwl:poolOrder");B!==void 0&&(p.poolOrders[oe.id]=B),Y&&H(Y,oe.id)}for(const oe of i.messageFlows??[])w(oe.id),y.set(oe.id,oe),d.push({id:oe.id,source:Bi(oe.sourceRef),target:Bi(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});$(i.artifacts??[]);for(const[oe,W]of o)!Z.has(oe)&&(W.flowElements??[]).length>0&&u.push({id:oe,type:W.$type,reason:"unreachable-process"})}else for(const Z of o.values())H(Z);const X=[],Q=[],ee=[],We=[],qe=(Z,oe)=>!!Z&&!!oe&&E.has(Z)&&E.has(oe);for(const Z of f){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}X.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),E.add(Z.id)}for(const Z of d){if(!qe(Z.source,Z.target)){u.push({id:Z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}Q.push({id:Z.id,source:Z.source,target:Z.target,...Z.name?{name:Z.name}:{}}),E.add(Z.id)}for(const Z of h){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}We.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target}),Z.id&&E.add(Z.id)}for(const Z of g){if(!qe(Z.source,Z.target)){u.push({id:Z.id??"",type:Z.type,reason:"endpoint-outside-mvp"});continue}ee.push({...Z.id?{id:Z.id}:{},source:Z.source,target:Z.target})}const Ge=new Map(l.map(Z=>[Z.id,Z]));for(const{owner:Z,refs:oe}of b){const W=oe.filter(ae=>v.has(ae)),Y=Ge.get(Z);Y&&W.length&&(Y.members=W)}for(const Z of m)v.has(Z.anchor)&&(p.placements[Z.owner]={anchor:Z.anchor,side:Z.side,...Z.offset!==void 0?{offset:Z.offset}:{}});for(const[Z,oe]of _)v.has(oe)&&(p.afterColumns[Z]=oe);const Se={...r.length?{participants:r}:{},nodes:a,sequenceFlows:X,...Q.length?{messageFlows:Q}:{},...s.length?{dataStores:s}:{},...We.length?{dataAssociations:We}:{},...c.length?{annotations:c}:{},...ee.length?{associations:ee}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:Se,hints:p,omitted:u,i18n:iM(Se,y,e,t.i18n)}:{definition:Se,hints:p,omitted:u}}function iM(e,t,n,i){const o=wp(n),r=es(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Ep(u,i,o);Object.keys(p).length&&(c[l]=p);for(const f of Mp(u))r.includes(f.locale)&&a.push({id:c.id,...f})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function oM(e,t={}){const{definitions:n,warnings:i}=await oa(e);return{...fy(n,t),warnings:i}}const rM=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function uf(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function aM(e){return uf(e.processRef)!==void 0}function sM(e){const t=new Set,n=o=>{const r=uf(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 cM(e){const t=[],n=i=>{for(const o of i.flowElements??[])rM.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 lM(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 pf(e){const t=[],n=e.rootElements??[],i=sM(e);for(const r of cM(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??[])aM(s)&&lM(r.get(uf(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 uM(e){const{definitions:t,warnings:n}=await oa(e);return{issues:pf(t),warnings:n}}const pM=.5,fM=8,dM=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),da=e=>typeof e=="number"?e:Number(e??NaN),Jc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function hM(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}=${Jc(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=>`${Jc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(Jc).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function gM(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?[da(s.x),da(s.y),da(s.width),da(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=Jc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(f=>[da(f.x),da(f.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 dy(e){const t=gM(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:")&&!dM.has(s)&&n.set(c,{type:s,props:hM(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 hy(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 gy(e,t,n={}){const i=n.moveTolerance??pM,o=dy(e),r=dy(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||hy(p.geometry,u.geometry,i)||hy(p.label,u.label,n.labelTolerance??fM))&&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 mM(e,t,n={}){const[i,o]=await Promise.all([oa(e),oa(t)]);return{...gy(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function yM(e){return new Set([...e.added,...e.modified])}function vM(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function my(e,t,{currentVersion:n,i18n:i}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const o=cy(e,t.ops,{i18n:i});if(!o.ok)return{status:"rejected",issues:o.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:o.findings,stats:o.stats}}const bM=new Set(["lasso","lasso.selection","hand","hand.move"]),yy=1e4,xM="bwl-edit-locked",vy=new WeakMap;function _M(e){const t=vy.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",yy,()=>{var s;if(o)return bM.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"],yy,()=>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(xM,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 vy.set(e,a),a}const wM=Symbol("bpmn-editor"),ff={geometry:[],semantic:[]};function EM(){const e=me.ref(!1),t=me.ref(!0),n=me.ref(!1),i=me.shallowRef(ff),o=me.shallowRef(void 0),r=me.shallowRef(void 0);let a,s,c;const l=()=>{if(p(),!c){i.value=ff;return}const _=ft(Ve(c.get("elementRegistry")),{includeObservationOnly:!0}),b=c.getDefinitions();i.value={geometry:_,semantic:b?pf(b):[]}};function u(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function p(){const _=u();if(!_||!a){r.value=void 0;return}const b=_.locales(),y={};for(const v of b)y[v]={untranslated:_.untranslatedCount(v),reviewRequested:_.reviewRequestedCount(v)};r.value={designLocale:a.designLocale,locales:b,displayLocale:_.getDisplayLocale()??a.designLocale,counts:y}}function f(){const _=u();_&&(_.configure(a),a&&s&&(s=_.setDisplayLocale(s)))}const d=()=>{e.value=!0,l()};function g(_,b){_M(_).set(!b)}function h(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function m(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:l,changeScope:o,i18n:r,configureI18n(_){a=_,f(),p()},setDisplayLocale(_){var y;s=_;const b=(y=u())==null?void 0:y.setDisplayLocale(_);b&&(s=b),p()},setChangeScope(_){o.value=_===void 0?void 0:new Set(_)},requestFocus(_){if(!c)return;const b=c.get("elementRegistry").get(_);b&&(c.get("canvas").scrollToElement(b,180),c.get("selection").select(b))},describeElement(_){const b=c==null?void 0:c.get("elementRegistry").get(_),y=b==null?void 0:b.businessObject;if(!y)return;const v=typeof y.name=="string"&&y.name.trim()!==""?y.name:y.text;return{name:typeof v=="string"&&v.trim()!==""?v.trim():void 0,type:typeof y.$type=="string"?y.$type:""}},attach(_){c&&this.detach(),c=_,c.get("eventBus").on("commandStack.changed",d),t.value||g(c,!1),f(),l()},detach(){c==null||c.get("eventBus").off("commandStack.changed",d),c&&!t.value&&g(c,!0),c=void 0,i.value=ff,o.value=void 0,r.value=void 0},setEditable(_){t.value=_,c&&g(c,_)},async applyAgentBatch(_,b){const y=h();n.value=!0;try{const v=await my(y,_,{currentVersion:b,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return v.status==="applied"&&(e.value=!1),v}finally{n.value=!1}},async importXml(_){const{warnings:b}=await h().importXML(_);return e.value=!1,o.value=void 0,l(),{warnings:zp(b)}},async saveXml(){const{xml:_}=await h().saveXML({format:!0});return e.value=!1,_??""},undo:()=>{var _;return(_=m())==null?void 0:_.undo()},redo:()=>{var _;return(_=m())==null?void 0:_.redo()},canUndo:()=>{var _;return((_=m())==null?void 0:_.canUndo())??!1},canRedo:()=>{var _;return((_=m())==null?void 0:_.canRedo())??!1}}}const SM=new RegExp("\\p{Script=Hangul}","u"),RM=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,CM=new RegExp("\\p{Script=Han}","u");function df(e){const t=SM.test(e),n=RM.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:CM.test(e)?"han":"other"}}function by(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 xy(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=yr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:ta(a).filter(l=>Nn(l))})}return n}const ps=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function MM(e){const t=by(e),n=xy(e);let i;const o={},r=[],a=[],s=[];for(const g of n){const h=g.trs.filter(m=>(m.body??"")===g.name).map(Nn);if(h.length){const m=[...h].sort().join("+");o[m]=(o[m]??0)+1,i=i?new Set([...i].filter(_=>h.includes(_))):new Set(h)}else g.trs.some(m=>m.body)?r.push(ps(g)):s.push({e:g,inference:df(g.name)});for(const m of g.trs){const _=Nn(m),b=m.body??"",y=df(b);y.locale&&y.locale!==_?a.push({...ps(g),locale:_,script:y.script}):_==="ko"&&y.script==="han"&&g.trs.some(v=>v!==m&&v.body===b)&&a.push({...ps(g),locale:_,script:"han"})}}const c=new Set(s.map(g=>g.inference.locale).filter(Boolean));let l,u;if(t)u="kept";else if(i&&i.size===1)[l,u]=[[...i][0],"matched"];else if(i&&i.size>1){const g=c.size===1?[...c][0]:void 0;g&&i.has(g)?[l,u]=[g,"matched"]:u="ambiguous"}else i?u="mixed":c.size===1?[l,u]=[[...c][0],"script"]:u=c.size>1?"mixed":"no-evidence";const p=t??l,f=[],d=[];for(const{e:g,inference:h}of s)h.locale?h.locale!==p&&f.push({...ps(g),locale:h.locale}):d.push({...ps(g),script:h.script});return{root:{current:t,proposed:l,reason:u},additions:f,undecided:d,drift:r,matchedBy:o,scriptMismatch:a}}function AM(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!by(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(xy(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(f=>f.body))continue;const l=c.trs.find(f=>Nn(f)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(ea,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Ce(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function PM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hf={exports:{}},_y;function TM(){if(_y)return hf.exports;_y=1;var e=hf.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},hf.exports}var kM=TM(),OM=PM(kM);function qi(e){if(!(this instanceof qi))return new qi(e);e=e||[128,36,1],this._seed=e.length?OM.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 dn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};dn.td=dn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],dn.option=dn.optgroup=[1,'<select multiple="multiple">',"</select>"],dn.thead=dn.tbody=dn.colgroup=dn.caption=dn.tfoot=[1,"<table>","</table>"],dn.polyline=dn.ellipse=dn.polygon=dn.circle=dn.text=dn.line=dn.path=dn.rect=dn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Nt(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(dn,i)?dn[i]:dn._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 DM(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 Gn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(o,r){n[r]=o})}),e}function En(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const LM=Object.prototype.toString;function Ct(e){return new No(e)}function No(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}No.prototype.add=function(e){return this.list.add(e),this},No.prototype.remove=function(e){return LM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},No.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},No.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},No.prototype.array=function(){return Array.from(this.list)},No.prototype.has=No.prototype.contains=function(e){return this.list.contains(e)};function el(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Er(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function IM(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var tl={},wy;function BM(){if(wy)return tl;wy=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return tl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},tl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},tl}var Ey=BM(),NM=IM(Ey),Ie=DM({__proto__:null,default:NM},[Ey]),Sy=["focus","blur"];function $M(e,t,n,i,o){return Sy.indexOf(n)!==-1&&(o=!0),Ie.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Er(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function FM(e,t,n,i){return Sy.indexOf(t)!==-1&&(i=!0),Ie.unbind(e,t,n,i)}var ti={bind:$M,unbind:FM};function gf(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Et(e,t){return t=t||document,t.querySelector(e)}function fs(e,t){return t=t||document,t.querySelectorAll(e)}function Yi(e){e.parentNode&&e.parentNode.removeChild(e)}function jM(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function HM(e,t){return t.appendChild(jM(e,t))}function ze(e,t){return HM(t,e),e}var mf=2,Ry={"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":mf,"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":mf,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function zM(e,t){return Ry[t]?e.style[t]:e.getAttributeNS(null,t)}function Cy(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Ry[i];o?(o===mf&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function GM(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Cy(e,o,t[o])}function we(e,t,n){if(typeof t=="string")if(n!==void 0)Cy(e,t,n);else return zM(e,t);else GM(e,t);return e}const VM=Object.prototype.toString;function st(e){return new $o(e)}function $o(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}$o.prototype.add=function(e){return this.list.add(e),this},$o.prototype.remove=function(e){return VM.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},$o.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},$o.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},$o.prototype.array=function(){return Array.from(this.list)},$o.prototype.has=$o.prototype.contains=function(e){return this.list.contains(e)};function ds(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function yf(e){return e.cloneNode(!0)}var vf={svg:"http://www.w3.org/2000/svg"},My='<svg xmlns="'+vf.svg+'"';function WM(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(vf.svg)===-1&&(e=My+e.substring(4)):(e=My+">"+e+"</svg>",t=!0);var n=UM(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function UM(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=WM(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(vf.svg,e),t&&we(n,t),n}var bf=null;function Ay(){return bf===null&&(bf=Oe("svg")),bf}function Py(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function qM(e,t,n,i,o,r){var a=Ay().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Py(a,e);case 6:return Py(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function hs(e){return Ay().createSVGTransform()}var Ty=/([&<>]{1})/g,YM=/([&<>\n\r"]{1})/g,KM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function xf(e,t){function n(i,o){return KM[o]||o}return e.replace(t,n)}function ky(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(xf(e.textContent,Ty));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,'="',xf(r.value,YM),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ky(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",xf(e.nodeValue,Ty),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function XM(e){for(var t=e.firstChild,n=[];t;)ky(t,n),t=t.nextSibling;return n.join("")}function Oy(e,t){return XM(e)}function on(e){var t=e.parentNode;return t&&t.removeChild(e),e}function ZM(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function QM(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(ZM(e,i))}function gs(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),QM(n,t)),n.consolidate()}const JM=/^class[ {]/;function eA(e){return JM.test(e.toString())}function _f(e){return Array.isArray(e)}function wf(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function nl(...e){e.length===1&&_f(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const tA=/constructor\s*[^(]*\(\s*([^)]*)\)/m,nA=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,iA=/\/\*([^*]*)\*\//m;function oA(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(eA(e)?tA:nA);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(iA);return(o&&o[1]||i).trim()})||[]}function Dy(e,t){const n=t||{get:function(y,v){if(i.push(y),v===!1)return null;throw s(`No provider for "${y}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(y){const v=i.join(" -> ");return i.length=0,new Error(v?`${y} (Resolving: ${v})`:y)};function c(y,v){if(!o[y]&&y.includes(".")){const E=y.split(".");let w=c(E.shift());for(;E.length;)w=w[E.shift()];return w}if(wf(r,y))return r[y];if(wf(o,y)){if(i.indexOf(y)!==-1)throw i.push(y),s("Cannot resolve circular dependency!");return i.push(y),r[y]=o[y][0](o[y][1]),i.pop(),r[y]}return n.get(y,v)}function l(y,v){if(typeof v>"u"&&(v={}),typeof y!="function")if(_f(y))y=nl(y.slice());else throw s(`Cannot invoke "${y}". Expected a function!`);const w=(y.$inject||oA(y)).map(P=>wf(v,P)?v[P]:c(P));return{fn:y,dependencies:w}}function u(y){const{fn:v,dependencies:E}=l(y),w=Function.prototype.bind.call(v,null,...E);return new w}function p(y,v,E){const{fn:w,dependencies:P}=l(y,E);return w.apply(v,P)}function f(y){return nl(v=>y.get(v))}function d(y,v){if(v&&v.length){const E=Object.create(null),w=Object.create(null),P=[],T=[],L=[];let $,N,H,X;for(let Q in o)$=o[Q],v.indexOf(Q)!==-1&&($[2]==="private"?(N=P.indexOf($[3]),N===-1?(H=$[3].createChild([],v),X=f(H),P.push($[3]),T.push(H),L.push(X),E[Q]=[X,Q,"private",H]):E[Q]=[L[N],Q,"private",T[N]]):E[Q]=[$[2],$[1]],w[Q]=!0),($[2]==="factory"||$[2]==="type")&&$[1].$scope&&v.forEach(ee=>{$[1].$scope.indexOf(ee)!==-1&&(E[Q]=[$[2],$[1]],w[ee]=!0)});v.forEach(Q=>{if(!w[Q])throw new Error('No provider for "'+Q+'". Cannot use provider from the parent!')}),y.unshift(E)}return new Dy(y,a)}const g={factory:p,type:u,value:function(y){return y}};function h(y,v){const E=y.__init__||[];return function(){E.forEach(w=>{typeof w=="string"?v.get(w):v.invoke(w)})}}function m(y){const v=y.__exports__;if(v){const E=y.__modules__,w=Object.keys(y).reduce((N,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(N[H]=y[H]),N),Object.create(null)),P=(E||[]).concat(w),T=d(P),L=nl(function(N){return T.get(N)});v.forEach(function(N){o[N]=[L,N,"private",T]});const $=(y.__init__||[]).slice();return $.unshift(function(){T.init()}),y=Object.assign({},y,{__init__:$}),h(y,T)}return Object.keys(y).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const w=y[E];if(w[2]==="private"){o[E]=w;return}const P=w[0],T=w[1];o[E]=[g[P],rA(P,T),P]}),h(y,a)}function _(y,v){return y.indexOf(v)!==-1||(y=(v.__depends__||[]).reduce(_,y),y.indexOf(v)!==-1)?y:y.concat(v)}function b(y){const v=y.reduce(_,[]).map(m);let E=!1;return function(){E||(E=!0,v.forEach(w=>w()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=d,this.init=b(e)}function rA(e,t){return e!=="value"&&_f(t)&&(t=nl(t.slice())),t}var aA=1e3;function fo(e,t){var n=this;t=t||aA,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)})}fo.prototype.canRender=function(e){},fo.prototype.drawShape=function(e,t){},fo.prototype.drawConnection=function(e,t){},fo.prototype.getShapePath=function(e){},fo.prototype.getConnectionPath=function(e){};function Sr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function sA(e){return["M",e.x,e.y]}function Ef(e){return["L",e.x,e.y]}function cA(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function lA(e,t){const n=e.length,i=[sA(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(Ef(a));continue}const c=Math.min(t,Sf(a.x-r.x,a.y-r.y),Sf(s.x-a.x,s.y-a.y));if(!c){i.push(Ef(a));continue}const l=il(a,r,c),u=il(a,r,c*.5),p=il(a,s,c),f=il(a,s,c*.5);i.push(Ef(l)),i.push(cA(u,f,p))}return i}function il(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=Sf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function Sf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ms(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),Rf(i,e)}function Rf(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return we(e,{d:Sr(lA(t,n))}),e}function ol(e){var t=new Set(e);return it(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Rr(e,t,n){n=n||0,$e(e)||(e=[e]),z(e,function(i,o){var r=t(i,o,n);$e(r)&&r.length&&Rr(r,t,n+1)})}function Cf(e,t,n){var i=new Set,o=new Set;return Rr(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 ys(e,t){return Cf(e)}function uA(e,t,n){mr(t)&&(t=!0),fn(t)&&(n=t,t=!0),n=n||{};var i=vs(n.allShapes),o=vs(n.allConnections),r=vs(n.enclosedElements),a=vs(n.enclosedConnections),s=vs(n.topLevel,t&&Qr(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,z(u.incoming,c),z(u.outgoing,c),u.children}return Rr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function rn(e,t){t=!!t,$e(e)||(e=[e]);var n,i,o,r;return z(e,function(a){var s=a;a.waypoints&&!t&&(s=rn(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+p>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 ha(e,t){var n={};return z(e,function(i){var o=i;o.waypoints&&(o=rn(o)),!Fe(t.y)&&o.x>t.x&&(n[i.id]=i),!Fe(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(Fe(t.width)&&Fe(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function Ly(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Iy(e){return!!(e&&e.isFrame)}function vs(e,t){return V({},e||{},t||{})}var pA=1;function Fo(e,t){fo.call(this,e,pA),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})}Ce(Fo,fo),Fo.prototype.canRender=function(){return!0},Fo.prototype.drawShape=function(t,n,i){var o=Oe("rect");return we(o,{x:0,y:0,width:n.width||0,height:n.height||0}),Iy(n)?we(o,V({},this.FRAME_STYLE,i||{})):we(o,V({},this.SHAPE_STYLE,i||{})),ze(t,o),o},Fo.prototype.drawConnection=function(t,n,i){var o=ms(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return ze(t,o),o},Fo.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 Sr(a)},Fo.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 Sr(r)},Fo.$inject=["eventBus","styles"];function fA(){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 V(r,{class:n})},this.style=function(n,i){!$e(n)&&!i&&(i=n,n=[]);var o=Jn(n,function(r,a){return V(r,e[a]||{})},{});return i?V(o,i):o},this.computeStyle=function(n,i,o){return $e(i)||(o=i,i=[]),t.style(i||[],V({},o,n||{}))}}const dA={__init__:["defaultRenderer"],defaultRenderer:["type",Fo],styles:["type",fA]};function Xt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function en(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 Mf(e,t){return!e||!t?-1:e.indexOf(t)}function bs(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Af(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=bs(e,t);return Math.abs(o/r)<=i}var hA=2;function ho(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(gA(o,n))return r;return!1}function gA(e,t){const n=t[0];return To(t,function(i){return Math.abs(n[e]-i[e])<=hA})}function By(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 Pf(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var mA=/,?([a-z]),?/gi,Ny=parseFloat,an=Math,jo=an.PI,Ki=an.min,Xi=an.max,$y=an.pow,Ho=an.abs,yA=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,vA=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Fy=Array.isArray||function(e){return e instanceof Array};function bA(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function xA(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 _A(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 bA(o,i)?(xA(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function wA(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(yA,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(vA,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=kf,n}function EA(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 SA(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 Tf(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 kf(){return this.join(",").replace(mA,"$1")}function RA(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=kf,t}function jy(e,t,n,i,o,r,a,s,c){var l=1-c,u=$y(l,3),p=$y(l,2),f=c*c,d=f*c,g=u*e+p*3*c*n+l*3*c*c*o+d*a,h=u*t+p*3*c*i+l*3*c*c*r+d*s;return{x:rl(g),y:rl(h)}}function Hy(e){var t=kA(...e);return Tf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function zo(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function CA(e,t){return e=Tf(e),t=Tf(t),zo(t,e.x,e.y)||zo(t,e.x2,e.y)||zo(t,e.x,e.y2)||zo(t,e.x2,e.y2)||zo(e,t.x,t.y)||zo(e,t.x2,t.y)||zo(e,t.x,t.y2)||zo(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 zy(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 Gy(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],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,g=0;g<u;g++){var h=l*p[g]+l,m=zy(h,e,n,o,a),_=zy(h,t,i,r,s),b=m*m+_*_;d+=f[g]*an.sqrt(b)}return l*d}function MA(e,t,n,i,o,r,a,s){if(!(Xi(e,n)<Ki(o,a)||Ki(e,n)>Xi(o,a)||Xi(t,i)<Ki(r,s)||Ki(t,i)>Xi(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=rl(c/u),f=rl(l/u),d=+p.toFixed(2),g=+f.toFixed(2);if(!(d<+Ki(e,n).toFixed(2)||d>+Xi(e,n).toFixed(2)||d<+Ki(o,a).toFixed(2)||d>+Xi(o,a).toFixed(2)||g<+Ki(t,i).toFixed(2)||g>+Xi(t,i).toFixed(2)||g<+Ki(r,s).toFixed(2)||g>+Xi(r,s).toFixed(2)))return{x:p,y:f}}}}function rl(e){return Math.round(e*1e11)/1e11}function AA(e,t,n){var i=Hy(e),o=Hy(t);if(!CA(i,o))return[];var r=Gy(...e),a=Gy(...t),s=Wy(e)?1:~~(r/5)||1,c=Wy(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},f=[],d,g;for(d=0;d<s+1;d++){var h=jy(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=jy(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var m=l[d],_=l[d+1],b=u[g],y=u[g+1],v=Ho(_.x-m.x)<.01?"y":"x",E=Ho(y.x-b.x)<.01?"y":"x",w=MA(m.x,m.y,_.x,_.y,b.x,b.y,y.x,y.y),P;if(w){if(P=w.x.toFixed(9)+"#"+w.y.toFixed(9),p[P])continue;p[P]=!0;var T=m.t+Ho((w[v]-m[v])/(_[v]-m[v]))*(_.t-m.t),L=b.t+Ho((w[E]-b[E])/(y[E]-b[E]))*(y.t-b.t);T>=0&&T<=1&&L>=0&&L<=1&&f.push({x:w.x,y:w.y,t1:T,t2:L})}}return f}function Vy(e,t,n){e=Yy(e),t=Yy(t);for(var i,o,r,a,s,c,l,u,p,f,d=n?0:[],g=0,h=e.length;g<h;g++){var m=e[g];if(m[0]=="M")i=s=m[1],o=c=m[2];else{m[0]=="C"?(p=[i,o,...m.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,b=t.length;_<b;_++){var y=t[_];if(y[0]=="M")r=l=y[1],a=u=y[2];else{y[0]=="C"?(f=[r,a,...y.slice(1)],r=f[6],a=f[7]):(f=[r,a,r,a,l,u,l,u],r=l,a=u);var v=AA(p,f);{for(var E=0,w=v.length;E<w;E++)v[E].segment1=g,v[E].segment2=_,v[E].bez1=p,v[E].bez2=f;d=d.concat(v)}}}}}return d}function PA(e){return Fy(e)&&Fy(e[0])}function TA(e){if(EA(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 f=1,d=l.length;f<d;f++)c[f]=+l[f]+(f%2?n:i)}else for(var g=0,h=l.length;g<h;g++)c[g]=l[g];switch(s=s.toUpperCase(),c[0]){case"Z":n=+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=kf,t}function Wy(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function al(e,t,n,i){return[e,t,n,i,n,i]}function Uy(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 qy(e,t,n,i,o,r,a,s,c,l){var u=jo*120/180,p=jo/180*(+o||0),f=[],d,g=_A(function(B,C,S){var G=B*an.cos(S)-C*an.sin(S),q=B*an.sin(S)+C*an.cos(S);return{x:G,y:q}});if(l)P=l[0],T=l[1],E=l[2],w=l[3];else{d=g(e,t,-p),e=d.x,t=d.y,d=g(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,m=(t-c)/2,_=h*h/(n*n)+m*m/(i*i);_>1&&(_=an.sqrt(_),n=_*n,i=_*i);var b=n*n,y=i*i,v=(r==a?-1:1)*an.sqrt(Ho((b*y-b*m*m-y*h*h)/(b*m*m+y*h*h))),E=v*n*m/i+(e+s)/2,w=v*-i*h/n+(t+c)/2,P=an.asin(((t-w)/i).toFixed(9)),T=an.asin(((c-w)/i).toFixed(9));P=e<E?jo-P:P,T=s<E?jo-T:T,P<0&&(P=jo*2+P),T<0&&(T=jo*2+T),a&&P>T&&(P=P-jo*2),!a&&T>P&&(T=T-jo*2)}var L=T-P;if(Ho(L)>u){var $=T,N=s,H=c;T=P+u*(a&&T>P?1:-1),s=E+n*an.cos(T),c=w+i*an.sin(T),f=qy(s,c,n,i,o,0,a,N,H,[T,$,E,w])}L=T-P;var X=an.cos(P),Q=an.sin(P),ee=an.cos(T),We=an.sin(T),qe=an.tan(L/4),Ge=4/3*n*qe,Se=4/3*i*qe,Z=[e,t],oe=[e+Ge*Q,t-Se*X],W=[s+Ge*We,c-Se*ee],Y=[s,c];if(oe[0]=2*Z[0]-oe[0],oe[1]=2*Z[1]-oe[1],l)return[oe,W,Y].concat(f);f=[oe,W,Y].concat(f).join().split(",");for(var ae=[],ge=0,Te=f.length;ge<Te;ge++)ae[ge]=ge%2?g(f[ge-1],f[ge],p).y:g(f[ge],f[ge+1],p).x;return ae}function kA(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,f,d,g,h,m,_,b=0;b<2;++b){if(b==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,f=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,f=3*i-3*t),Ho(u)<1e-12){if(Ho(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}m=p*p-4*f*u,_=an.sqrt(m),!(m<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 y=c.length,v=y,E;y--;)d=c[y],E=1-d,l[0][y]=E*E*E*e+3*E*E*d*n+3*E*d*d*o+d*d*d*a,l[1][y]=E*E*E*t+3*E*E*d*i+3*E*d*d*r+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Ki(...l[0]),y0:Ki(...l[1]),x1:Xi(...l[0]),y1:Xi(...l[1])}}function Yy(e){if(PA(e)||(e=wA(e)),SA(e))return e;for(var t=RA(TA(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,g){var h,m;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...qy(d.x,d.y,...f.slice(1))];break;case"S":g=="C"||g=="S"?(h=d.x*2-d.bx,m=d.y*2-d.by):(h=d.x,m=d.y),f=["C",h,m,...f.slice(1)];break;case"T":g=="Q"||g=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Uy(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Uy(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...al(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...al(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...al(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...al(d.x,d.y,d.X,d.Y)];break}return f},o=function(f,d){if(f[d].length>7){f[d].shift();for(var g=f[d];g.length;)r[d]="A",f.splice(d++,0,["C",...g.splice(0,6)]);f.splice(d,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=Ny(u[p-4])||n.x,n.by=Ny(u[p-3])||n.y}return t}function Pt(e){return fn(e)&&Qn(e,"waypoints")}function et(e){return fn(e)&&Qn(e,"labelTarget")}function OA(e){return fn(e)&&Xr(e.parent)}function Ky(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function go(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Be(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function sl(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function DA(e){return go({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function LA(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var f=t[p-1];if(f){var d=l[l.length-1],g=d&&d.endLength||0,h=NA(f,u);l.push({start:f,end:u,startLength:g,endLength:g+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.length},0),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 je(e){return Pt(e)?LA(e):DA(e)}function kn(e,t,n){n=n||0,fn(n)||(n={x:n,y:n});var i=Be(e),o=Be(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 xs(e,t,n){var i=IA(e,t);return i.length===1||i.length===2&&bs(i[0],i[1])<1?go(i[0]):i.length>1?(i=zi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),go(i[n?0:i.length-1])):null}function IA(e,t){return Vy(e,t)}function BA(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],bs(n,o)===0||Af(i,o,n)?e.splice(t,1):t++;return e}function NA(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cl(e,t){return Math.round(e*t)/t}function Xy(e){return Fe(e)?e+"px":e}function $A(e){for(;e.parent;)e=e.parent;return e}function FA(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Gn(n,{position:"relative",overflow:"hidden",width:Xy(e.width),height:Xy(e.height)}),t.appendChild(n),n}function Zy(e,t,n){const i=Oe("g");st(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const jA="base",Qy=0,HA=1,zA={shape:["x","y","width","height"],connection:["waypoints"]};function He(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||{})}He.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],He.prototype._init=function(e){const t=this._eventBus,n=this._container=FA(e),i=this._svg=Oe("svg");we(i,{width:"100%",height:"100%"}),En(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")}),ze(n,i);const o=this._viewport=Zy(i,"viewport");e.deferUpdate&&(this._viewboxChanged=_p(this._viewboxChanged,300)),this._restoreFocus=_p(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)},He.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},He.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},He.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Ly(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},He.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},He.prototype.restoreFocus=function(){this._restoreFocus()},He.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},He.prototype.isFocused=function(){return this._focused},He.prototype.getDefaultLayer=function(){return this.getLayer(jA,Qy)},He.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},He.prototype._getChildIndex=function(e){return Jn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},He.prototype._createLayer=function(e,t){typeof t>"u"&&(t=HA);const n=this._getChildIndex(t);return{group:Zy(this._viewport,"layer-"+e,n),index:t,visible:!0}},He.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},He.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&&(on(n),t.visible=!1),n},He.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],on(t.group))},He.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},He.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot($A(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},He.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},He.prototype._findPlaneForRoot=function(e){return Ot(this._planes,function(t){return t.rootElement===e})},He.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},He.prototype._resolveElements=function(e){return $e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},He.prototype.getContainer=function(){return this._container},He.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),st(o).add(t)):(e.markers.delete(t),st(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},He.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},He.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},He.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},He.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},He.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},He.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,Qy);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},He.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},He.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},He.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)},He.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})},He.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})},He.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=zA[e];if(!To(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},He.prototype._setParent=function(e,t,n){en(t.children,e,n),e.parent=t},He.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},He.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},He.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},He.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),Xt(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},He.prototype.removeShape=function(e){return this._removeElement(e,"shape")},He.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},He.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},He.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},He.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},He.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);gs(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=gs(t),o=a?a.matrix:qM(),s=cl(o.a,1e3),c=cl(-o.e||0,1e3),l=cl(-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},He.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Jy(t,n)}),{x:n.e,y:n.f}},He.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=rn(r),s=Be(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const f=Be(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const g=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),m=Math.max(0,s.bottom-f.bottom),_=Math.min(0,s.top-f.top);u=g||h,p=m||_}this.scroll({dx:-u*l,dy:-p*l})},He.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)}),cl(i.a,1e3)};function Jy(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}He.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},He.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=V(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),Jy(this._viewport,u),u},He.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},He.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}},He.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var ga="data-element-id";function gi(e){this._elements={},this._eventBus=e}gi.$inject=["eventBus"],gi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),we(t,ga,i),n&&we(n,ga,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},gi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(we(i.gfx,ga,""),i.secondaryGfx&&we(i.secondaryGfx,ga,""),delete t[n])},gi.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)},gi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&we(t,ga,i),t},gi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&we(e,ga);var n=this._elements[t];return n&&n.element},gi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},gi.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}},gi.prototype.getAll=function(){return this.filter(function(e){return e})},gi.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)})},gi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},gi.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 GA(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 VA(e){return e.__refs_collection===!0}function WA(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ev(e,t,n){var i=GA(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 UA(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 xi(e,t){if(!(this instanceof xi))return new xi(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}xi.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?ev(this,t,e):UA(this,t,e)},xi.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return VA(n)||ev(this,t,e),n},xi.prototype.ensureBound=function(e,t){WA(e,t)||this.bind(e,t)},xi.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},xi.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Of=new xi({name:"children",enumerable:!0,collection:!0},{name:"parent"}),tv=new xi({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),nv=new xi({name:"attachers",collection:!0},{name:"host"}),iv=new xi({name:"outgoing",collection:!0},{name:"source"}),ov=new xi({name:"incoming",collection:!0},{name:"target"});function ma(){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)}}),Of.bind(this,"parent"),tv.bind(this,"labels"),iv.bind(this,"outgoing"),ov.bind(this,"incoming")}function _s(){ma.call(this),Of.bind(this,"children"),nv.bind(this,"host"),nv.bind(this,"attachers")}Ce(_s,ma);function rv(){ma.call(this),Of.bind(this,"children")}Ce(rv,_s);function av(){_s.call(this),tv.bind(this,"labelTarget")}Ce(av,_s);function sv(){ma.call(this),iv.bind(this,"source"),ov.bind(this,"target")}Ce(sv,ma);var qA={connection:sv,shape:_s,label:av,root:rv};function YA(e,t){var n=qA[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function KA(e){return e instanceof ma}function mo(){this._uid=12}mo.prototype.createRoot=function(e){return this.create("root",e)},mo.prototype.createLabel=function(e){return this.create("label",e)},mo.prototype.createShape=function(e){return this.create("shape",e)},mo.prototype.createConnection=function(e){return this.create("connection",e)},mo.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),YA(e,t)};var ll="__fn",cv=1e3,XA=Array.prototype.slice;function ni(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}ni.prototype.on=function(e,t,n,i){if(e=$e(e)?e:[e],vn(t)&&(i=n,n=t,t=cv),!Fe(t))throw new Error("priority must be a number");var o=n;i&&(o=Yn(n,i),o[ll]=n[ll]||n);var r=this;e.forEach(function(a){r._addListener(a,{priority:t,callback:o,next:null})})},ni.prototype.once=function(e,t,n,i){var o=this;if(vn(t)&&(i=n,n=t,t=cv),!Fe(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[ll]=n,this.on(e,t,r)},ni.prototype.off=function(e,t){e=$e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},ni.prototype.createEvent=function(e){var t=new ws;return t.init(e),t},ni.prototype.fire=function(e,t){var n,i,o,r;if(r=XA.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 ws?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}},ni.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},ni.prototype._destroy=function(){this._listeners={}},ni.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},ni.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=ZA(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},ni.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},ni.prototype._getListeners=function(e){return this._listeners[e]},ni.prototype._setListeners=function(e,t){this._listeners[e]=t},ni.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[ll]===t)&&(o?o.next=i:this._setListeners(e,i)),o=n,n=i};function ws(){}ws.prototype.stopPropagation=function(){this.cancelBubble=!0},ws.prototype.preventDefault=function(){this.defaultPrevented=!0},ws.prototype.init=function(e){V(this,e||{})};function ZA(e,t){return e.apply(null,t)}function Go(e){return e.childNodes[0]}function QA(e){return e.parentNode.childNodes[1]}function ul(e,t,n,i,o){var r=hs();r.setTranslate(t,n);var a=hs();a.setRotate(i||0,0,0);var s=hs();s.setScale(1,1),gs(e,[r,a,s])}function On(e,t,n){var i=hs();i.setTranslate(t,n),gs(e,i)}function lv(e,t){var n=hs();n.setRotate(t,0,0),gs(e,n)}function mi(e,t){this._eventBus=e,this._elementRegistry=t}mi.$inject=["eventBus","elementRegistry"],mi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=QA(t),n||(n=Oe("g"),st(n).add("djs-children"),ze(t.parentNode,n))):n=t,n},mi.prototype._clear=function(e){var t=Go(e);return el(t),t},mi.prototype._createContainer=function(e,t,n,i){var o=Oe("g");st(o).add("djs-group"),typeof n<"u"?JA(o,t,t.childNodes[n]):ze(t,o);var r=Oe("g");st(r).add("djs-element"),st(r).add("djs-"+e),i&&st(r).add("djs-frame"),ze(o,r);var a=Oe("g");return st(a).add("djs-visual"),ze(r,a),r},mi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Iy(t))},mi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Jn(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),z(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;z(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},mi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},mi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},mi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},mi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},mi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),On(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?we(n,"display","none"):we(n,"display","block")}},mi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);on(t.parentNode)};function JA(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const eP={__depends__:[dA],__init__:["canvas"],canvas:["type",He],elementRegistry:["type",gi],elementFactory:["type",mo],eventBus:["type",ni],graphicsFactory:["type",mi]};function tP(e){var t=new Dy(e);return t.init(),t}function nP(e){e=e||{};var t={config:["value",e]},n=[t,eP].concat(e.modules||[]);return tP(n)}function Vo(e,t){this._injector=t||nP(e),this.get("eventBus").fire("diagram.init")}Vo.prototype.get=function(e,t){return this._injector.get(e,t)},Vo.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Vo.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Vo.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Fn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Kn(e,t){return e.$instanceOf(t)}function iP(e){return Ot(e.rootElements,function(t){return Kn(t,"bpmn:Process")||Kn(t,"bpmn:Collaboration")})}function oP(e){var t={},n=[],i={};function o(W,Y){return function(ae){W(ae,Y)}}function r(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var ae=W.gfx;if(ae)throw new Error(`already rendered ${Fn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function l(W,Y){try{var ae=i[W.id]&&s(W,Y);return r(W),ae}catch(ge){u(ge.message,{element:W,error:ge}),console.error(`failed to import ${Fn(W)}`,ge)}}function u(W,Y){e.error(W,Y)}var p=this.registerDi=function(Y){var ae=Y.bpmnElement;ae?i[ae.id]?u(`multiple DI elements defined for ${Fn(ae)}`,{element:ae}):i[ae.id]=Y:u(`no bpmnElement referenced in ${Fn(Y)}`,{element:Y})};function f(W){d(W.plane)}function d(W){p(W),z(W.planeElement,g)}function g(W){p(W)}this.handleDefinitions=function(Y,ae){var ge=Y.diagrams;if(ae&&ge.indexOf(ae)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ae&&ge&&ge.length&&(ae=ge[0]),!ae)throw new Error("no diagram to display");i={},f(ae);var Te=ae.plane;if(!Te)throw new Error(`no plane for ${Fn(ae)}`);var B=Te.bpmnElement;if(!B)if(B=iP(Y),B)u(`correcting missing bpmnElement on ${Fn(Te)} to ${Fn(B)}`),Te.bpmnElement=B,p(Te);else throw new Error("no process or collaboration to display");var C=c(B,Te);if(Kn(B,"bpmn:Process")||Kn(B,"bpmn:SubProcess"))m(B,C);else if(Kn(B,"bpmn:Collaboration"))Z(B,C),_(Y.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Fn(Te)}: ${Fn(B)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function m(W,Y){qe(W,Y),L(W.ioSpecification,Y),T(W.artifacts,Y),r(W)}function _(W,Y){var ae=it(W,function(ge){return!a(ge)&&Kn(ge,"bpmn:Process")&&ge.laneSets});ae.forEach(o(m,Y))}function b(W,Y){l(W,Y)}function y(W,Y){z(W,o(b,Y))}function v(W,Y){l(W,Y)}function E(W,Y){l(W,Y)}function w(W,Y){l(W,Y)}function P(W,Y){l(W,Y)}function T(W,Y){z(W,function(ae){Kn(ae,"bpmn:Association")?n.push(function(){P(ae,Y)}):P(ae,Y)})}function L(W,Y){W&&(z(W.dataInputs,o(E,Y)),z(W.dataOutputs,o(w,Y)))}var $=this.handleSubProcess=function(Y,ae){qe(Y,ae),T(Y.artifacts,ae)};function N(W,Y){var ae=l(W,Y);Kn(W,"bpmn:SubProcess")&&$(W,ae||Y),Kn(W,"bpmn:Activity")&&L(W.ioSpecification,Y),n.push(function(){z(W.dataInputAssociations,o(v,Y)),z(W.dataOutputAssociations,o(v,Y))})}function H(W,Y){l(W,Y)}function X(W,Y){l(W,Y)}function Q(W,Y){n.push(function(){var ae=l(W,Y);W.childLaneSet&&ee(W.childLaneSet,ae||Y),oe(W)})}function ee(W,Y){z(W.lanes,o(Q,Y))}function We(W,Y){z(W,o(ee,Y))}function qe(W,Y){Ge(W.flowElements,Y),W.laneSets&&We(W.laneSets,Y)}function Ge(W,Y){z(W,function(ae){Kn(ae,"bpmn:SequenceFlow")?n.push(function(){H(ae,Y)}):Kn(ae,"bpmn:BoundaryEvent")?n.unshift(function(){N(ae,Y)}):Kn(ae,"bpmn:FlowNode")?N(ae,Y):Kn(ae,"bpmn:DataObject")||(Kn(ae,"bpmn:DataStoreReference")||Kn(ae,"bpmn:DataObjectReference")?X(ae,Y):u(`unrecognized flowElement ${Fn(ae)} in context ${Fn(Y&&Y.businessObject)}`,{element:ae,context:Y}))})}function Se(W,Y){var ae=l(W,Y),ge=W.processRef;ge&&m(ge,ae||Y)}function Z(W,Y){z(W.participants,o(Se,Y)),n.push(function(){y(W.messageFlows,Y)}),T(W.artifacts,Y)}function oe(W){z(W.flowNodeRef,function(Y){var ae=Y.get("lanes");ae&&ae.push(W)})}}function rP(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(h,m){return i.add(h,m)},element:function(h,m,_){return i.add(h,m,_)},error:function(h,m){s.push({message:h,context:m})}},f=new oP(p);u=u||l.diagrams&&l.diagrams[0];var d=aP(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){f.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;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 aP(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!M(n,"bpmn:Process")&&!M(n,"bpmn:Collaboration")&&(i=sP(n));var o;M(i,"bpmn:Collaboration")?o=i:o=Ot(e.rootElements,function(l){if(M(l,"bpmn:Collaboration"))return Ot(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=Bn(o.participants,function(l){return l.processRef}),r.push(o));var a=uv(r),s=[t],c=[n];return z(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function uv(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(uv(n.flowElements)))}),t}function sP(e){for(var t=e;t;){if(M(t,"bpmn:Process"))return t;t=t.$parent}}var cP='<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>',pv=cP,fv={verticalAlign:"middle"},dv={color:"#404040"},lP={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},uP={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},pP={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"},fP='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+pv+'</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>',Zi;function dP(){Zi=Nt(fP),Gn(Zi,lP),Gn(Et("svg",Zi),fv),Gn(Et(".backdrop",Zi),uP),Gn(Et(".notice",Zi),pP),Gn(Et(".link",Zi),dv,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function hP(){Zi||(dP(),ti.bind(Zi,".backdrop","click",function(e){document.body.removeChild(Zi)})),document.body.appendChild(Zi)}const pl=5,hv="djs-outline-hidden";function zt(e){e=V({},mP,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),vP(this._container)}Ce(zt,Vo),zt.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(f){throw this._emit("import.parse.complete",{error:f}),f}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||[]),fl(s,r),s=gP(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},zt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},zt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw fl(r,[]),r}if(typeof t=="string"&&(i=yP(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw fl(r,[]),r}try{this.clear()}catch(r){throw fl(r,[]),r}const{warnings:o}=await rP(this,n,i);return{warnings:o}},zt.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},zt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Et(":scope > defs",i._svg),a=Oy(o),s=r?"<defs>"+Oy(r)+"</defs>":"",c=i.getContainer();Ct(c).add(hv);let l;try{l=o.getBBox()}finally{Ct(c).remove(hv)}const u=l.x-pl,p=l.y-pl,f=l.width+pl*2,d=l.height+pl*2;t=`<?xml version="1.0" encoding="utf-8"?>
8
8
  <!-- created with bpmn-js / http://bpmn.io -->
9
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
10
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Gt.prototype._setDefinitions=function(e){this._definitions=e},Gt.prototype.getModules=function(){return this._modules},Gt.prototype.clear=function(){this.getDefinitions()&&zo.prototype.clear.call(this)},Gt.prototype.destroy=function(){zo.prototype.destroy.call(this),qi(this._container)},Gt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Gt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Gt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=wt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Gt.prototype.getDefinitions=function(){return this._definitions},Gt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Gt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=V(zi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});zo.call(this,s),n&&n.container&&this.attachTo(n.container)},Gt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Gt.prototype._createContainer=function(e){const t=Nt('<div class="bjs-container"></div>');return zn(t,{width:fv(e.width),height:fv(e.height),position:e.position}),t},Gt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new qg(t)},Gt.prototype._modules=[];function ll(e,t){return e.warnings=t,e}function fP(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 dP={width:"100%",height:"100%",position:"relative"};function fv(e){return e+(Fe(e)?"px":"")}function hP(e,t){return t&&Ot(e.diagrams,function(n){return n.id===t})||null}function gP(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+cv+"</a>",i=Nt(n);zn(wt("svg",i),lv),zn(i,uv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Le.bind(i,"click",function(o){pP(),o.preventDefault()})}function ga(e){Gt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ce(ga,Gt),ga.prototype._createModdle=function(e){var t=Gt.prototype._createModdle.call(this,e);return t.ids=new Ui([32,36,1]),t},ga.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 ct(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||dt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!de(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=dt(e).isHorizontal;return t===void 0?!0:t}}function mP(e){return e&&de(e).isInterrupting!==!1}function jn(e){return e&&!!de(e).triggeredByEvent}function ma(e,t){var n=de(e).eventDefinitions;return Po(n,function(i){return M(i,t)})}function yP(e){return ma(e,"bpmn:ErrorEventDefinition")}function vP(e){return ma(e,"bpmn:EscalationEventDefinition")}function bP(e){return ma(e,"bpmn:CompensateEventDefinition")}var Sr={width:90,height:20},dv=15;function Go(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function ul(e){return Je(e.label)}function xP(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=_P(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-=dv:a+=dv,{x:a,y:s}}function _P(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 Tf(e){return e.waypoints?xP(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Sr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Sr.height/2}}function wP(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Sr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Tf(t),i=Sr),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function hv(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function EP(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=hv(t);if(n)return n==="categoryValueRef"?EP(t):t[n]||""}function SP(e,t){var n=e.businessObject,i=hv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function RP(e){return Je(e)&&Go(e.labelTarget)}var ya=7;function gv(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function xs(e){const t=new Map;return z(Ef(e),n=>{z(gv(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 kf="hsl(225, 10%, 15%)",CP="white";function Zi(e,t){return Po(e.eventDefinitions,function(n){return n.$type===t})}function MP(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function AP(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=dt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||CP}function Se(e,t,n){var i=dt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||kf}function _s(e,t,n,i){var o=dt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Se(e,n)}function mv(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 wr(o)}function Of(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 wr(a)}function PP(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 wr(s)}function TP(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 wr(r)}function ws(e,t={}){return{width:_i(e,t),height:ni(e,t)}}function _i(e,t={}){return Zn(t,"width")?t.width:e.width}function ni(e,t={}){return Zn(t,"height")?t.height:e.height}var kP=new Ui,OP=10,pl=3,DP=1.5,fl=10,LP=4,va=.95,IP=1,BP=.25;function Rr(e,t,n,i,o,r,a){uo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:kf,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:kf,strokeWidth:2})}function f(B,C){var{ref:S={x:0,y:0},scale:G=1,element:q,parentGfx:ie=o._svg}=C,Me=Oe("marker",{id:B,viewBox:"0 0 20 20",refX:S.x,refY:S.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Me,q);var Xe=wt(":scope > defs",ie);Xe||(Xe=Oe("defs"),ze(ie,Xe)),ze(Xe,Me)}function d(B,C,S,G){var q=kP.nextPrefixed("marker-");return g(B,q,C,S,G),"url(#"+q+")"}function g(B,C,S,G,q){if(S==="sequenceflow-end"){var ie=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:q,stroke:q,strokeWidth:1})});f(C,{element:ie,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(S==="messageflow-start"){var Me=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Me,ref:{x:6,y:6},parentGfx:B})}if(S==="messageflow-end"){var Xe=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Xe,ref:{x:8.5,y:5},parentGfx:B})}if(S==="association-start"){var mt=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(S==="association-end"){var qt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:qt,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(S==="conditional-flow-marker"){var Ct=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:q})});f(C,{element:Ct,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(S==="conditional-default-flow-marker"){var yn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:q,fill:"none"})});f(C,{element:yn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,C,S,G,q={}){dn(G)&&(q=G,G=0),G=G||0,q=u(q);var ie=C/2,Me=S/2,Xe=Oe("circle",{cx:ie,cy:Me,r:Math.round((C+S)/4-G),...q});return ze(B,Xe),Xe}function m(B,C,S,G,q,ie){dn(q)&&(ie=q,q=0),q=q||0,ie=u(ie);var Me=Oe("rect",{x:q,y:q,width:C-q*2,height:S-q*2,rx:G,ry:G,...ie});return ze(B,Me),Me}function _(B,C,S,G){var q=C/2,ie=S/2,Me=[{x:q,y:0},{x:C,y:ie},{x:q,y:S},{x:0,y:ie}],Xe=Me.map(function(qt){return qt.x+","+qt.y}).join(" ");G=u(G);var mt=Oe("polygon",{...G,points:Xe});return ze(B,mt),mt}function b(B,C,S,G){S=p(S);var q=ds(C,S,G);return ze(B,q),q}function y(B,C,S){return b(B,C,S,5)}function v(B,C,S){S=p(S);var G=Oe("path",{...S,d:C});return ze(B,G),G}function E(B,C,S,G){return v(C,S,V({"data-marker":B},G))}function w(B){return Te[B]}function P(B){return function(C,S,G){return w(B)(C,S,G)}}var T={"bpmn:MessageEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.235,my:.315}}),ie=G?Se(C,c,S.stroke):at(C,s,S.fill),Me=G?at(C,s,S.fill):Se(C,c,S.stroke),Xe=v(B,q,{fill:ie,stroke:Me,strokeWidth:1});return Xe},"bpmn:TimerEventDefinition":function(B,C,S={}){var G=S.width||C.width,q=S.height||C.height,ie=S.width?1:2,Me=h(B,G,q,.2*q,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:ie}),Xe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}});v(B,Xe,{stroke:Se(C,c,S.stroke),strokeWidth:ie});for(var mt=0;mt<12;mt++){var qt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}}),Ct=G/2,yn=q/2;v(B,qt,{strokeWidth:1,stroke:Se(C,c,S.stroke),transform:"rotate("+mt*30+","+yn+","+Ct+")"})}return Me},"bpmn:EscalationEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),ie=G?Se(C,c,S.stroke):at(C,s,S.fill);return v(B,q,{fill:ie,stroke:Se(C,c,S.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,C,S={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.222}});return v(B,G,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ie=G?Se(C,c,S.stroke):at(C,s,S.fill);return v(B,q,{fill:ie,stroke:Se(C,c,S.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.2,my:.722}}),ie=G?Se(C,c,S.stroke):at(C,s,S.fill);return v(B,q,{fill:ie,stroke:Se(C,c,S.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ie=G?Se(C,c,S.stroke):"none",Me=v(B,q,{fill:ie,stroke:Se(C,c,S.stroke),strokeWidth:1});return av(Me,45),Me},"bpmn:CompensateEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.22,my:.5}}),ie=G?Se(C,c,S.stroke):at(C,s,S.fill);return v(B,q,{fill:ie,stroke:Se(C,c,S.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),ie=G?Se(C,c,S.stroke):at(C,s,S.fill);return v(B,q,{strokeWidth:1,fill:ie,stroke:Se(C,c,S.stroke)})},"bpmn:MultipleEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.211,my:.36}}),ie=G?Se(C,c,S.stroke):at(C,s,S.fill);return v(B,q,{fill:ie,stroke:Se(C,c,S.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,C,S={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.458,my:.194}});return v(B,G,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,C,S={}){var G=h(B,C.width,C.height,8,{fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke),strokeWidth:4});return G}};function D(B,C,S={},G){var q=de(B),ie=MP(q),Me=G||B;return q.get("eventDefinitions")&&q.get("eventDefinitions").length>1?q.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](C,Me,S,ie):T["bpmn:MultipleEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](C,Me,S,ie):Zi(q,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](C,Me,S,ie):null}var $={ParticipantMultiplicityMarker:function(B,C,S={}){var G=_i(C,S),q=ni(C,S),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2-6)/G,my:(q-15)/q}});E("participant-multiplicity",B,ie,{strokeWidth:2,fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke)})},SubProcessMarker:function(B,C,S={}){var G=m(B,14,14,0,{strokeWidth:1,fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke)});On(G,C.width/2-7.5,C.height-20);var q=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});E("sub-process",B,q,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke)})},ParallelMarker:function(B,C,S){var G=_i(C,S),q=ni(C,S),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+S.parallel)/G,my:(q-20)/q}});E("parallel",B,ie,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke)})},SequentialMarker:function(B,C,S){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",B,G,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke)})},CompensationMarker:function(B,C,S){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",B,G,{strokeWidth:1,fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke)})},LoopMarker:function(B,C,S){var G=_i(C,S),q=ni(C,S),ie=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+S.loop)/G,my:(q-7)/q}});E("loop",B,ie,{strokeWidth:1.5,fill:"none",stroke:Se(C,c,S.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,C,S){var G=_i(C,S),q=ni(C,S),ie=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+S.adhoc)/G,my:(q-15)/q}});E("adhoc",B,ie,{strokeWidth:1,fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke)})}};function N(B,C,S,G){$[B](C,S,G)}function H(B,C,S=[],G={}){G={fill:G.fill,stroke:G.stroke,width:_i(C,G),height:ni(C,G)};var q=de(C),ie=S.includes("SubProcessMarker");ie?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},q.get("isForCompensation")&&S.push("CompensationMarker"),M(q,"bpmn:AdHocSubProcess")&&(S.push("AdhocMarker"),ie||V(G,{compensation:G.compensation-18}));var Me=q.get("loopCharacteristics"),Xe=Me&&Me.get("isSequential");Me&&(V(G,{compensation:G.compensation-18}),S.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),Xe===void 0&&S.push("LoopMarker"),Xe===!1&&S.push("ParallelMarker"),Xe===!0&&S.push("SequentialMarker")),S.includes("CompensationMarker")&&S.length===1&&V(G,{compensation:-8}),z(S,function(mt){N(mt,B,C,G)})}function X(B,C,S={}){S=V({size:{width:100}},S);var G=r.createText(C||"",S);return st(G).add("djs-label"),ze(B,G),G}function Q(B,C,S,G={}){var q=de(C),ie=ws({x:C.x,y:C.y,width:C.width,height:C.height},G);return X(B,q.name,{align:S,box:ie,padding:7,style:{fill:_s(C,l,c,G.stroke)}})}function ee(B,C,S={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return X(B,yi(C),{box:G,style:V({},r.getExternalStyle(),{fill:_s(C,l,c,S.stroke)})})}function We(B,C,S,G={}){var q=xn(S),ie=X(B,C,{box:{height:30,width:q?ni(S,G):_i(S,G)},align:"center-middle",style:{fill:_s(S,l,c,G.stroke)}});if(q){var Me=-1*ni(S,G);sl(ie,0,-Me,270)}}function qe(B,C,S={}){var{width:G,height:q}=ws(C,S);return m(B,G,q,fl,{...S,fill:at(C,s,S.fill),fillOpacity:va,stroke:Se(C,c,S.stroke)})}function Ge(B,C,S={}){var G=de(C),q=at(C,s,S.fill),ie=Se(C,c,S.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(S.markerEnd=d(B,"association-end",q,ie)),G.get("associationDirection")==="Both"&&(S.markerStart=d(B,"association-start",q,ie)),S=ht(S,["markerStart","markerEnd"]),y(B,C.waypoints,{...S,stroke:ie,strokeDasharray:"0, 5"})}function Re(B,C,S={}){var G=at(C,s,S.fill),q=Se(C,c,S.stroke),ie=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Me=v(B,ie,{fill:G,fillOpacity:va,stroke:q}),Xe=de(C);if(AP(Xe)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});v(B,mt,{strokeWidth:2,fill:G,stroke:q})}return Me}function Z(B,C,S={}){return h(B,C.width,C.height,{fillOpacity:va,...S,fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke)})}function oe(B,C,S={}){return _(B,C.width,C.height,{fill:at(C,s,S.fill),fillOpacity:va,stroke:Se(C,c,S.stroke)})}function W(B,C,S={}){var G=m(B,_i(C,S),ni(C,S),0,{fill:at(C,s,S.fill),fillOpacity:S.fillOpacity||va,stroke:Se(C,c,S.stroke),strokeWidth:1.5}),q=de(C);if(M(q,"bpmn:Lane")){var ie=q.get("name");We(B,ie,C,S)}return G}function Y(B,C,S={}){var G=qe(B,C,S),q=ct(C);if(jn(C)&&(we(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!q)){var ie=de(C).flowElements||[],Me=ie.filter(Xe=>M(Xe,"bpmn:StartEvent"));Me.length===1&&ae(Me[0],B,S,C)}return Q(B,C,q?"center-top":"center-middle",S),q?H(B,C,void 0,S):H(B,C,["SubProcessMarker"],S),G}function ae(B,C,S,G){var q=22,ie={fill:at(G,s,S.fill),stroke:Se(G,c,S.stroke),width:q,height:q},Me=de(B).isInterrupting,Xe=Me?0:3,mt=Me?1:1.2,qt=20,Ct=(q-qt)/2,yn="translate("+Ct+","+Ct+")";h(C,qt,qt,{fill:ie.fill,stroke:ie.stroke,strokeWidth:mt,strokeDasharray:Xe,transform:yn}),D(B,C,ie,G)}function ge(B,C,S={}){var G=qe(B,C,S);return Q(B,C,"center-middle",S),H(B,C,void 0,S),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function(B,C,S={}){return ct(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]),Y(B,C,S)},"bpmn:Association":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Ge(B,C,S)},"bpmn:BoundaryEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=de(C),ie=q.get("cancelActivity");S={strokeWidth:1.5,fill:at(C,s,S.fill),fillOpacity:IP,stroke:Se(C,c,S.stroke)},ie||(S.strokeDasharray="6");var Me=Z(B,C,S);return h(B,C.width,C.height,pl,{...S,fill:"none"}),G&&D(C,B,S),Me},"bpmn:BusinessRuleTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ie=v(B,q);we(ie,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1});var Me=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Xe=v(B,Me);return we(Xe,{fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Y(B,C,{strokeWidth:5,...S})},"bpmn:ComplexGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S),q=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return v(B,q,{fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Re(B,C,S);return v(B,G,{fill:"none",stroke:Se(C,c,S.stroke),strokeWidth:1}),q},"bpmn:DataInputAssociation":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Ge(B,C,{...S,markerEnd:d(B,"association-end",at(C,s,S.fill),Se(C,c,S.stroke))})},"bpmn:DataObject":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Re(B,C,S)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Re(B,C,S);return v(B,G,{strokeWidth:1,fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke)}),q},"bpmn:DataOutputAssociation":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Ge(B,C,{...S,markerEnd:d(B,"association-end",at(C,s,S.fill),Se(C,c,S.stroke))})},"bpmn:DataStoreReference":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return v(B,G,{fill:at(C,s,S.fill),fillOpacity:va,stroke:Se(C,c,S.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=Z(B,C,{...S,strokeWidth:4});return G&&D(C,B,S),q},"bpmn:EventBasedGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=de(C),q=oe(B,C,S);h(B,C.width,C.height,C.height*.2,{fill:at(C,"none",S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1});var ie=G.get("eventGatewayType"),Me=!!G.get("instantiate");function Xe(){var qt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});v(B,qt,{fill:"none",stroke:Se(C,c,S.stroke),strokeWidth:2})}if(ie==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});v(B,mt,{fill:"none",stroke:Se(C,c,S.stroke),strokeWidth:1})}else ie==="Exclusive"&&(Me||h(B,C.width,C.height,C.height*.26,{fill:"none",stroke:Se(C,c,S.stroke),strokeWidth:1}),Xe());return q},"bpmn:ExclusiveGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S),q=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ie=dt(C);return ie.get("isMarkerVisible")&&v(B,q,{fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,C,S={}){return S=ht(S,["fill","stroke"]),oe(B,C,S)},"bpmn:Group":function(B,C,S={}){return S=ht(S,["fill","stroke","width","height"]),m(B,C.width,C.height,fl,{stroke:Se(C,c,S.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,S),height:ni(C,S)})},"bpmn:InclusiveGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S);return h(B,C.width,C.height,C.height*.24,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=Z(B,C,{...S,strokeWidth:1.5});return h(B,C.width,C.height,pl,{fill:"none",stroke:Se(C,c,S.stroke),strokeWidth:1.5}),G&&D(C,B,S),q},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,C,S={}){return S=ht(S,["fill","stroke","width","height"]),W(B,C,{...S,fillOpacity:BP})},"bpmn:ManualTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(B,q,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=de(C),q=dt(C),ie=at(C,s,S.fill),Me=Se(C,c,S.stroke),Xe=y(B,C.waypoints,{markerEnd:d(B,"messageflow-end",ie,Me),markerStart:d(B,"messageflow-start",ie,Me),stroke:Me,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=Xe.getPointAtLength(Xe.getTotalLength()/2),qt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Ct={strokeWidth:1};q.get("messageVisibleKind")==="initiating"?(Ct.fill=ie,Ct.stroke=Me):(Ct.fill=Me,Ct.stroke=ie);var yn=v(B,qt,Ct),Rn=G.get("messageRef"),Vn=Rn.get("name"),At=X(B,Vn,{align:"center-top",fitBox:!0,style:{fill:Me}}),Qt=yn.getBBox(),_n=At.getBBox(),Va=mt.x-_n.width/2,Wn=mt.y+Qt.height/2+OP;sl(At,Va,Wn,0)}return Xe},"bpmn:ParallelGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S),q=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return v(B,q,{fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,C,S={}){S=ht(S,["fill","stroke","width","height"]);var G=W(B,C,S),q=ct(C),ie=xn(C),Me=de(C),Xe=Me.get("name");if(q){var mt=ie?[{x:30,y:0},{x:30,y:ni(C,S)}]:[{x:0,y:30},{x:_i(C,S),y:30}];b(B,mt,{stroke:Se(C,c,S.stroke),strokeWidth:DP}),We(B,Xe,C,S)}else{var qt=ws(C,S);ie||(qt.height=_i(C,S),qt.width=ni(C,S));var Ct=X(B,Xe,{box:qt,align:"center-middle",style:{fill:_s(C,l,c,S.stroke)}});if(!ie){var yn=-1*ni(C,S);sl(Ct,0,-yn,270)}}return Me.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",B,C,S),G},"bpmn:ReceiveTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=de(C),q=ge(B,C,S),ie;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1}),ie=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ie=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v(B,ie,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1}),q},"bpmn:ScriptTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(B,q,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(B,q,{fill:Se(C,c,S.stroke),stroke:at(C,s,S.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=at(C,s,S.fill),q=Se(C,c,S.stroke),ie=y(B,C.waypoints,{markerEnd:d(B,"sequenceflow-end",G,q),stroke:q}),Me=de(C),{source:Xe}=C;if(Xe){var mt=de(Xe);Me.get("conditionExpression")&&M(mt,"bpmn:Activity")&&we(ie,{markerStart:d(B,"conditional-flow-marker",G,q)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Me&&we(ie,{markerStart:d(B,"conditional-default-flow-marker",G,q)})}return ie},"bpmn:ServiceTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S);h(B,10,10,{fill:at(C,s,S.fill),stroke:"none",transform:"translate(6, 6)"});var q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(B,q,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1}),h(B,10,10,{fill:at(C,s,S.fill),stroke:"none",transform:"translate(11, 10)"});var ie=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(B,ie,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=de(C);q.get("isInterrupting")||(S={...S,strokeDasharray:"6"});var ie=Z(B,C,S);return G&&D(C,B,S),ie},"bpmn:SubProcess":function(B,C,S={}){return ct(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]),Y(B,C,S)},"bpmn:Task":function(B,C,S={}){return S=ht(S,["fill","stroke"]),ge(B,C,S)},"bpmn:TextAnnotation":function(B,C,S={}){S=ht(S,["fill","stroke"]);var{width:G,height:q}=ws(C,S),ie=m(B,G,q,0,0,{fill:"none",stroke:"none"}),Me=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:0,my:0}});v(B,Me,{stroke:Se(C,c,S.stroke)});var Xe=de(C),mt=Xe.get("text")||"";return X(B,mt,{align:"left-top",box:ws(C,S),padding:ya,style:{fill:_s(C,l,c,S.stroke)}}),ie},"bpmn:Transaction":function(B,C,S={}){ct(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]);var G=Y(B,C,{strokeWidth:1.5,...S}),q=n.style(["no-fill","no-events"],{stroke:Se(C,c,S.stroke),strokeWidth:1.5}),ie=ct(C);return ie||(S={}),m(B,_i(C,S),ni(C,S),fl-pl,pl,q),G},"bpmn:UserTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=15,ie=12,Me=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:q,y:ie}});v(B,Me,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:q,y:ie}});v(B,Xe,{fill:at(C,s,S.fill),stroke:Se(C,c,S.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:q,y:ie}});return v(B,mt,{fill:Se(C,c,S.stroke),stroke:Se(C,c,S.stroke),strokeWidth:.5}),G},label:function(B,C,S={}){return ee(B,C,S)}};this._drawPath=v,this._renderer=w}Ce(Rr,uo),Rr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Rr.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},Rr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Rr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Rr.prototype.getShapePath=function(e){return Je(e)?Of(e,LP):M(e,"bpmn:Event")?mv(e):M(e,"bpmn:Activity")?Of(e,fl):M(e,"bpmn:Gateway")?PP(e):TP(e)};function ht(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var NP=0,$P={width:150,height:50};function FP(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function jP(e){return dn(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Df=null;function HP(){return Df||(Df=document.createElement("canvas").getContext("2d")),Df}function zP(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(yv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function yv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function GP(e,t){var n=HP();if(!n)return{width:0,height:0};n.font=zP(t),"letterSpacing"in n&&(n.letterSpacing=yv(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 VP(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=GP(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return WP(e,o,i,r);o=qP(o,r.width,t)}}function WP(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 vv="­";function UP(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===vv)&&o.pop();break}var a=o[o.length-1];return a&&a===vv&&(o[o.length-1]="-"),o.join("")}function qP(e,t,n){var i=Math.max(e.length*(n/t),1),o=UP(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function dl(e){this._config=V({},{size:$P,padding:NP,style:{},align:"center-top"},e||{})}dl.prototype.createText=function(e,t){return this.layoutText(e,t).element},dl.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},dl.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),o=FP(t.align||this._config.align),r=jP(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=YP(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(VP(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=Qn(l,function(m,_,b){return m+(s||_.height)},0)+r.top+r.bottom,f=Qn(l,function(m,_,b){return _.width>m?_.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");we(g,i),z(l,function(m){var _;switch(d+=s||m.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?f:u)-r.right-m.width;break;default:_=Math.max(((a?f:u)-m.width)/2+r.left,0)}var b=Oe("tspan");we(b,{x:_,y:d}),b.textContent=m.text,ze(g,b)});var h={width:f,height:p};return{dimensions:h,element:g}};function YP(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var KP=12,XP=1.2,ZP=40;function bv(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:KP,fontWeight:"normal",lineHeight:XP},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),o=new dl({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Sr.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:ya});return{x:a.x,y:a.y,width:a.width,height:Math.max(ZP,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}bv.$inject=["config.textRenderer"];function QP(){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=nT(i.d,{mx:o,my:r,e:a});return p}}var JP=/\{([^{}]+)\}/g,eT=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function tT(e,t,n){var i=n;return t.replace(eT,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 nT(e,t){return String(e).replace(JP,function(n,i){return tT(n,i,t)})}const iT={__init__:["bpmnRenderer"],bpmnRenderer:["type",Rr],textRenderer:["type",bv],pathMap:["type",QP]};function oT(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Es={translate:["value",oT]};function hl(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function rT(e,t,n){var i=e.waypoint;return!i||i.length<2?[je(t),je(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function xv(e,t,n){return new Error(`element ${Fn(t)} referenced by ${Fn(e)}#${n} not yet drawn`)}function go(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}go.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],go.prototype.add=function(e,t,n){var i,o,r;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(hl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!ct(e,t),c=sT(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(hl(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})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(r=0),M(e,"bpmn:DataStoreReference")&&(aT(n,je(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(hl(e,t,{hidden:o,source:u,target:p,waypoints:rT(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Fn(t)} for element ${Fn(e)}`);return Go(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},go.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Fn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw xv(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},go.prototype.addLabel=function(e,t,n){var i,o,r;return i=wP(t,n),o=yi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(hl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!yi(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)},go.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?xv(e,i,t+"Ref"):new Error(`${Fn(e)}#${t} Ref not specified`)},go.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},go.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},go.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function aT(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 sT(e){return M(e,"bpmn:Group")}const _v={__depends__:[iT,{__depends__:[Es],bpmnImporter:["type",go]}]};function Ss(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Bi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Lf(e){return Math.log(e)/Math.log(10)}var cT=1e3;function pe(e){this._eventBus=e}pe.$inject=["eventBus"];function lT(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}pe.prototype.on=function(e,t,n,i,o,r){if((vn(t)||Fe(t))&&(r=o,o=i,i=n,n=t,t=null),vn(n)&&(r=o,o=i,i=n,n=cT),dn(o)&&(r=o,o=!1),!vn(i))throw new Error("handlerFn must be a function");$e(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?lT(i,r):i,r)})},pe.prototype.canExecute=mo("canExecute"),pe.prototype.preExecute=mo("preExecute"),pe.prototype.preExecuted=mo("preExecuted"),pe.prototype.execute=mo("execute"),pe.prototype.executed=mo("executed"),pe.prototype.postExecute=mo("postExecute"),pe.prototype.postExecuted=mo("postExecuted"),pe.prototype.revert=mo("revert"),pe.prototype.reverted=mo("reverted");function mo(e){return function(n,i,o,r,a){(vn(n)||Fe(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var If=["top","bottom","left","right"],gl=10;function Bf(e,t){pe.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(ul(o)&&!Pt(o)){var r=fT(o);r&&i(o,r)}}function i(o,r){var a=je(o),s=o.label,c=je(s);if(s.parent){var l=Be(o),u;switch(r){case"top":u={x:a.x,y:l.top-gl-s.height/2};break;case"left":u={x:l.left-gl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+gl+s.height/2};break;case"right":u={x:l.right+gl+s.width/2,y:a.y};break}var p=Bi(u,c);t.moveShape(s,p)}}}Ce(Bf,pe),Bf.$inject=["eventBus","modeling"];function uT(e){var t=e.host,n=je(e),i=kn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=If.filter(function(a){return o.indexOf(a)===-1});return r}function pT(e){var t=je(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 wv(t,i)});return n}function fT(e){var t=je(e.label),n=je(e),i=wv(n,t);if(dT(i)){var o=pT(e);if(e.host){var r=uT(e);o=o.concat(r)}var a=If.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?kn(e.label,e)!=="intersect"?void 0:i:a[0]}}function wv(e,t){return kn(t,e,5)}function dT(e){return If.indexOf(e)!==-1}function Nf(e){pe.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ce(Nf,pe),Nf.$inject=["eventBus"];var hT=1500;function $f(e,t,n){e.invoke(pe,this),this.preExecute("elements.delete",hT,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=it(o,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(r,l=>{const u=new Set(Kr(fa(Array.from(s),an(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ce($f,pe),$f.$inject=["injector","eventBus","canvas"];function Ff(e,t){e.invoke(pe,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=it(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ce(Ff,pe),Ff.$inject=["injector","modeling"];function ba(e,t){for(Xn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function Ev(e,t){var n=ba(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ba(e,i),n)return xn(n);if(tt(e,i))return xn(e);var o;for(o=de(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=de(a);return s&&s.get("processRef")===o});return r?xn(r):!0}var Sv=500;function ml(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Sv,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Rv(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",Sv,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Rv(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}ml.$inject=["bpmnReplace","injector"],Ce(ml,pe),ml.prototype._replaceShape=function(e,t){var n=gT(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function gT(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function Rv(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function jf(e,t){pe.call(this,e);function n(i){return it(i.attachers,function(o){return M(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);M(o,"bpmn:EventBasedGateway")&&M(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;M(o,"bpmn:Gateway")&&M(r,"bpmn:EventBasedGateway")&&z(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}jf.$inject=["eventBus","modeling"],Ce(jf,pe);function Cv(e){return e.create("bpmn:Category")}function mT(e){return e.create("bpmn:CategoryValue")}function Mv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=mT(e)),n.$parent||(n.$parent=Cv(e)),n}function yT(e,t,n){return nn(t.get("categoryValue"),e),e.$parent=t,nn(n.get("rootElements"),t),t.$parent=n,e}function vT(e){var t=e.$parent;return t&&(Zt(t.get("categoryValue"),e),e.$parent=null),e}function bT(e){var t=e.$parent;return t&&(Zt(t.get("rootElements"),e),e.$parent=null),e}var xT=500;function Hf(e,t,n){n.invoke(pe,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(de).filter(function(l){return l!==c})}function 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&&yT(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&bT(l),c&&!o(c,u)&&vT(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.executed(["shape.move","shape.resize"],xT,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,de(l))},!0),this.executed("group.updateRefs",function(c){Av(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Av(c).forEach(function(l){s(l.categoryValue,l.category,de(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Hf.$inject=["bpmnjs","elementRegistry","injector"],Ce(Hf,pe);function Av(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function zf(e,t,n){pe.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(m){const _=m.source,b=m.target;xa(_)&&Rs(b)&&u(b)}function o(m){const _=m.connection,b=m.source,y=m.target;xa(b)&&yl(y)&&(l(y),f(b,[_]))}function r(m){const _=m.newTarget,b=m.oldSource,y=m.oldTarget;if(y!==_){const v=b;Rs(y)&&u(y),xa(v)&&yl(_)&&l(_)}}function a(m){const{element:_}=m;Rs(_)?(p(_),d(_)):yl(_)&&g(_)}function s(m){const{newData:_,oldShape:b}=m;if(xa(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const y=b.outgoing.find(({target:v})=>Rs(v));y&&y.target&&(m._connectionTarget=y.target)}else if(!xa(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const y=b.outgoing.find(({target:v})=>yl(v));y&&y.target&&(m._connectionTarget=y.target),h(b)}}function c(m){const{_connectionTarget:_,newShape:b}=m;_&&t.connect(b,_)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function f(m,_){m.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>Rs(v.target)&&!_.includes(v)).forEach(v=>t.removeConnection(v))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(b=>xa(b.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(b=>M(b,"bpmn:SequenceFlow"));t.removeElements(_)}}Ce(zf,pe),zf.$inject=["eventBus","modeling","bpmnRules"];function Rs(e){const t=de(e);return t&&t.get("isForCompensation")}function xa(e){return e&&M(e,"bpmn:BoundaryEvent")&&ma(e,"bpmn:CompensateEventDefinition")}function yl(e){return e&&M(e,"bpmn:Activity")&&!jn(e)}function Gf(e){e.invoke(pe,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;M(i,"bpmn:Lane")&&!M(o,"bpmn:Lane")&&(n.parent=ba(i,"bpmn:Participant"))})}Gf.$inject=["injector"],Ce(Gf,pe);function Vf(e,t){pe.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(M(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}})}Vf.$inject=["eventBus","bpmnFactory"],Ce(Vf,pe);var Wf=20,Uf=20,Pv=30,vl=2e3;function qf(e,t,n){pe.call(this,t),t.on(["create.start","shape.move.start"],vl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!Je(p)&&!Pt(p)});if(c.length){var l=an(c),u=_T(a,l);V(a,u),r.createConstraints=wT(a,l)}}}),t.on("create.start",vl,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}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",vl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return M(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",vl,function(o){var r=o.elements,a=o.parent,s=ET(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=de(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;M(a,"bpmn:Participant")&&M(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=de(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)&&de(s).set("processRef",de(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)&&de(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)}qf.$inject=["canvas","eventBus","modeling"],Ce(qf,pe);function _T(e,t){t={width:t.width+Wf*2+Pv,height:t.height+Uf*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 wT(e,t){return t=Be(t),{bottom:t.top+e.height/2-Uf,left:t.right-e.width/2+Wf,top:t.bottom-e.height/2+Uf,right:t.left+e.width/2-Wf-Pv}}function ET(e){return Ot(e,function(t){return M(t,"bpmn:Participant")})}var Tv="__targetRef_placeholder";function Yf(e,t){pe.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],kv(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],kv(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ot(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ot(c,function(u){return u.name===Tv});return!l&&s&&(l=t.create("bpmn:Property",{name:Tv}),nn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||Zt(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(_=i(p,!0),m.targetRef=_):m.targetRef=null}}Yf.$inject=["eventBus","bpmnFactory"],Ce(Yf,pe);function kv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function bl(e){this._bpmnUpdater=e}bl.$inject=["bpmnUpdater"],bl.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),[]},bl.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 Kf(e,t,n,i){pe.call(this,i),t.registerHandler("dataStore.updateContainment",bl);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&de(s).processRef})[0]}function r(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:dt(s),newSemanticParent:u.processRef||u,newDiParent:dt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:RT(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return ST(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(f){M(u,"bpmn:Process")&&a(f,u)})})}Kf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ce(Kf,pe);function ST(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 RT(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var xl=Math.max,_l=Math.min,CT=20;function Ov(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function MT(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 AT(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 wl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Fe(o)&&(i=(/top|left/.test(e)?_l:xl)(i,o)),Fe(r)&&(i=(/top|left/.test(e)?xl:_l)(i,r)),i}function PT(e,t){if(!t)return e;var n=Be(e);return ol({top:wl("top",n,t),right:wl("right",n,t),bottom:wl("bottom",n,t),left:wl("left",n,t)})}function TT(e,t,n,i){var o=Be(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?Be(i):r,s={top:_l(r.top,a.top),left:_l(r.left,a.left),bottom:xl(r.bottom,a.bottom),right:xl(r.right,a.right)};return ol(s)}function Cs(e,t){return typeof e<"u"?e:CT}function kT(e,t){var n,i,o,r;return typeof t=="object"?(n=Cs(t.left),i=Cs(t.right),o=Cs(t.top),r=Cs(t.bottom)):n=i=o=r=Cs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function OT(e){return!(e.waypoints||e.type==="label")}function Dv(e,t){var n;if(e.length===void 0?n=it(e.children,OT):n=e,n.length)return kT(an(n),t)}var Vo=Math.abs;function DT(e,t){return Ov(Be(t),Be(e))}var LT=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function El(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(El(n,t),t.push(n))}),t}function Wo(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ei(e){return ba(e,LT)||e}function IT(e,t){var n=Ei(e),i=M(n,"bpmn:Process")?[]:[n],o=El(n,i),r=Be(e),a=Be(t),s=DT(e,t),c=[],l=xn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Be(u);s.top&&(Vo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Vo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Vo(h.right-r.left)<10&&(f=a.left-h.right),Vo(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Vo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Vo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Vo(h.left-r.right)<10&&(g=a.right-h.left),Vo(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:AT(u,{top:p,right:f,bottom:d,left:g})})}}),c}var BT=500;function Xf(e,t){pe.call(this,e);function n(i,o){var r=xn(i),a=Wo(o),s=[],c=[],l=[],u=[];if(Er(a,function(m){return r?m.y>i.y?c.push(m):s.push(m):m.x>i.x?u.push(m):l.push(m),m.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 f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",BT,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;M(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Xf.$inject=["eventBus","spaceTool"],Ce(Xf,pe);var Lv=500;function Sl(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Lv,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return Iv(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Lv,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;Iv(a,$T(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Sl.$inject=["bpmnReplace","injector"],Ce(Sl,pe),Sl.prototype._replaceShape=function(e){var t=NT(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function NT(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function Iv(e,t){return!Je(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function $T(e,t){return e.indexOf(t)!==-1}var Rl=Math.round,FT=Math.max;function jT(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 HT(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Bv=10;function zT(e,t){var n,i;for(n=0;i=e[n];n++)if(ms(i,t)<=Bv)return{point:e[n],bendpoint:!0,index:n};return null}function GT(e,t){var n=Hy(jT(t,Bv),HT(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=FT(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Rl(i.x+o.x)/2,y:Rl(i.y+o.y)/2},index:i.segment2}:{point:{x:Rl(i.x),y:Rl(i.y)},index:i.segment2}:null}function Zf(e,t){return zT(e,t)||GT(e,t)}function Qf(e,t,n){pe.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,g,h=o.outgoing.slice(),m=o.incoming.slice(),_;Fe(a.width)?_=je(a):_=a;var b=Zf(s,_);if(b){if(c=s.slice(0,b.index),l=s.slice(b.index+(b.bendpoint?1:0)),!c.length||!l.length)return;u=b.bendpoint?s[b.index]:_,(c.length===1||!Nv(o,c[c.length-1]))&&c.push($v(u)),(l.length===1||!Nv(o,l[0]))&&l.unshift($v(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),g=r));var y=[].concat(d&&it(m,function(v){return v.source===d.source})||[],g&&it(h,function(v){return v.target===g.target})||[]);y.length&&n.removeElements(y)}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=je(c),u={x:l.x+s.x,y:l.y+s.y},p=Ot(r.children,function(f){var d=t.canInsert(a,f);return d&&Zf(f.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)}Ce(Qf,pe),Qf.$inject=["eventBus","bpmnRules","modeling"];function Nv(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 $v(e){return V({},e)}function Jf(e,t){pe.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)&&_a(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&_a(l)):c=a.incoming.filter(l=>l!==o&&_a(l)&&M(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(M(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(_a).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(_a).forEach(function(s){const c=a.incoming.filter(_a).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}Jf.$inject=["eventBus","modeling"],Ce(Jf,pe);function _a(e){return M(e,"bpmn:SequenceFlow")}var Cl=1500,Fv=2e3;function jv(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"],Cl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!tt(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||tt(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"],Cl,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Cl,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Cl,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ei(r)||r)}),t.on("shape.move.start",Fv,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ei(o)||o)}),t.on("spaceTool.move",Fv,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ei(o))})}jv.$inject=["elementRegistry","eventBus","canvas"];var Hv=770;function ed(e,t,n,i){n.invoke(pe,this);function o(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef;u||(u=Mv(e,l));var p=c.category||u.$parent||Cv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=de(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=de(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||de(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Hv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=de(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Hv,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})}ed.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ce(ed,pe);function td(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 zv(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=td(i,o,r,a),l=td(i,o,r,s),u;c&&l?Gv(c,r)>Gv(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],je(i.source)),t(o[o.length-1],o[o.length-2],je(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}zv.$inject=["eventBus"];function Gv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function nd(e){pe.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=de(i),r=dt(i);if(tt(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}nd.$inject=["eventBus"],Ce(nd,pe);function Vv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Wv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function VT(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 WT(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 id(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=WT([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 Uv(e,t){var n=id(e,t),i={x:n.x-e.x,y:n.y-e.y};return Vv(i)}function Ms(e,t){return Vv({x:e.x-t.x,y:e.y-t.y})}var qv=Math.sqrt,Yv=Math.min,UT=Math.max,Kv=Math.abs;function Xv(e){return Math.pow(e,2)}function As(e,t){return qv(Xv(e.x-t.x)+Xv(e.y-t.y))}function qT(e,t){var n=0,i,o,r,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],Qv(i,o)?l=[i]:(r=As(e,i),a=As(e,o),c=Yv(r,a),l=YT(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:Qv(i,l[0])?n:n+1}),l.length===2&&(s=XT(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:As(i,s)/As(i,o)}),p=As(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function YT(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,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=qv(d),h=-p+g,m=-p-g,_={x:e.x-o*h,y:e.y-r*h};if(d===0)return[_];var b={x:e.x-o*m,y:e.y-r*m};return[_,b].filter(function(y){return KT(y,e,t)})}function KT(e,t,n){return Zv(e.x,t.x,n.x)&&Zv(e.y,t.y,n.y)}function Zv(e,t,n){return e>=Yv(t,n)-Ml&&e<=UT(t,n)+Ml}function XT(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ml=.1;function Qv(e,t){return Kv(e.x-t.x)<=Ml&&Kv(e.y-t.y)<=Ml}function ZT(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 Jv(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=qT(e,n),c=s.segmentIndex,l=ZT(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=tb(n,c),p=tb(t,l),f=s.position,d=JT(u,f),g=QT(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var b=t[m];return o=b.x-s.position.x,r=b.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(d=eb(n,m))}var y={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=VT({x:e.x-f.x,y:e.y-f.y},g);return o=y.x+v.x-e.x,r=y.y+v.y-e.y,{point:fo(y),delta:fo({x:o,y:r})}}function eb(e,t){var n=Ms(e[t-1],e[t]),i=Ms(e[t],e[t+1]),o=n/(n+i);return o}function QT(e,t){var n=Wv(e),i=Wv(t);return i-n}function tb(e,t){return[e[t],e[t+1]]}function JT(e,t){var n=Ms(e[0],e[1]),i=Ms(e[0],t);return n===0?0:i/n}function ek(e,t,n,i){var o=je(e);return Jv(o,t,n,i).delta}function Ps(e,t,n){var i=Ss(t),o=Ss(n),r=Bi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return fo({x:o.x+a.x,y:o.y+a.y})}function nb(e,t,n){var i=Ss(e),o=Ss(t),r=Ss(n),a=Bi(e,i),s=Bi(i,o),c=tk(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 fo({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function tk(e,t,n){var i=Be(t),o=Be(n);if(nk(i,o))return null;var r=kn(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=kn(n,s),c!==r?null:a}function nk(e,t){return ik(e,t)||ok(e,t)}function ik(e,t){return e.right!==t.right&&e.left!==t.left}function ok(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var ib="name",ob="text";function od(e,t,n,i){pe.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{de(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(ib in l&&t.updateLabel(c,l[ib]),ob in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[ob]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Je(l)||!Go(l)||yi(l)&&t.updateLabel(l,yi(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=V({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),ek(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=de(c);u&&Go(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Je(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(yi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(ul(c)){var p=c.label,f=je(p),d=sk(u),g=ak(f,d),h=rk(g,u,l);t.moveShape(p,h)}})}Ce(od,pe),od.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function rk(e,t,n){var i=Ps(e,t,n);return fo(Bi(i,e))}function ak(e,t){if(t.length){var n=ck(e,t);return id(e,n)}}function sk(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 ck(e,t){var n=t.map(function(o){return{line:o,distance:Uv(e,o)}}),i=Hi(n,"distance");return i[0].line}function lk(e,t,n,i){return Jv(e,t,n,i).point}function rd(e,t){pe.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=V({},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),lk(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},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ce(rd,pe),rd.$inject=["eventBus","modeling"];function Al(e,t,n){var i=Tl(e),o=ab(i,t),r=i[0];return o.length?o[o.length-1]:Ps(r.original||r,n,t)}function Pl(e,t,n){var i=Tl(e),o=ab(i,t),r=i[i.length-1];return o.length?o[0]:Ps(r.original||r,n,t)}function ad(e,t,n){var i=Tl(e),o=rb(t,n),r=i[0];return Ps(r.original||r,o,t)}function sd(e,t,n){var i=Tl(e),o=rb(t,n),r=i[i.length-1];return Ps(r.original||r,o,t)}function rb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Tl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ab(e,t){var n=Bn(e,pk);return it(n,function(i){return uk(i,t)})}function uk(e,t){return kn(t,e,1)==="intersect"}function pk(e){return e.original||e}function cd(e,t){pe.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(fk(i,o)){var r=dk(i);r.incoming.forEach(function(a){var s=Pl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Al(a,o,i);t.reconnectStart(a,o,s)})}},!0)}cd.$inject=["eventBus","modeling"],Ce(cd,pe);function fk(e,t){return M(e,"bpmn:Participant")&&ct(e)&&M(t,"bpmn:Participant")&&!ct(t)}function dk(e){var t=hs([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){M(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){M(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const hk=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function sb(e){const t=de(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&jn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:hk.some(i=>M(n[0],i))}function cb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function ld(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!sb(o))return;const a=cb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=de(i).get(a),l=de(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}ld.$inject=["injector","modeling"],Ce(ld,pe);function ud(e,t){pe.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=dt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ce(ud,pe),ud.$inject=["eventBus","modeling"];function pd(e,t,n){pe.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(!(!M(r,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=gk(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ce(pd,pe),pd.$inject=["eventBus","bpmnRules","modeling"];function wa(e){return e.original||e}function gk(e,t){var n=td(wa(e[e.length-2]),wa(e[e.length-1]),wa(t[1]),wa(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[wa(e[0]),wa(t[t.length-1])]}function fd(e,t){pe.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;M(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)}fd.$inject=["eventBus","modeling"],Ce(fd,pe);function dd(e,t,n,i){pe.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 f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Ot(p.outgoing,Zr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ce(dd,pe),dd.$inject=["eventBus","modeling","bpmnRules","injector"];function kl(e,t,n,i,o,r){i.invoke(pe,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=Qn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){jn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Ce(kl,pe),kl.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;z(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 mk=1500,yk={width:140,height:120},hd={width:300,height:60},gd={width:60,height:300},Ol={width:300,height:150},Dl={width:150,height:300},lb={width:140,height:120},ub={width:100,height:40};function pb(e){e.on("resize.start",mk,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=wk(i,o,r)),M(i,"bpmn:SubProcess")&&ct(i)&&(n.minDimensions=lb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=ub)})}pb.$inject=["eventBus"];var Uo=Math.abs,vk=Math.min,bk=Math.max;function fb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ea(e,t,n){return fb(e,t,n,vk)}function Sa(e,t,n){return fb(e,t,n,bk)}var xk={top:20,left:50,right:20,bottom:20},_k={top:50,left:20,right:20,bottom:20};function wk(e,t,n){var i=Ei(e),o=!0,r=!0,a=El(i,[i]),s=Be(e),c={},l={},u=xn(e),p=u?hd:gd;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Be(g);u?(h.top<s.top-10&&(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&&Uo(s.top-h.bottom)<10&&Sa(c,"top",h.top+p.height),Uo(s.top-h.top)<5&&Ea(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Uo(s.right-h.left)<10&&Ea(c,"right",h.right-p.width),Uo(s.right-h.right)<5&&Sa(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Uo(s.bottom-h.top)<10&&Ea(c,"bottom",h.bottom-p.height),Uo(s.bottom-h.bottom)<5&&Sa(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Uo(s.left-h.right)<10&&Sa(c,"left",h.left+p.width),Uo(s.left-h.left)<5&&Ea(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?xk:_k;return f.forEach(function(g){var h=Be(g);/n/.test(t)&&(!u||o)&&Ea(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Sa(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Sa(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Ea(l,"left",h.left-d.left)}),{min:l,max:c}}function db(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ra(e){return e.originalEvent||e.srcEvent}function md(e){db(e),db(Ra(e))}function Cr(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 hb(){return/mac/i.test(navigator.platform)}function gb(e,t){return(Ra(e)||e).button===t}function qo(e){return gb(e,0)}function Ek(e){return gb(e,1)}function Ts(e){var t=Ra(e)||e;return qo(e)?hb()?t.metaKey:t.ctrlKey:!1}function Ll(e){var t=Ra(e)||e;return qo(e)&&t.shiftKey}var mb=1001;function yb(e,t){e.on("resize.start",mb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!Ts(n))}),e.on("resize.end",mb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))return r&&(a=Uy(a),t.resizeLane(o,a,i.balanced)),!1})}yb.$inject=["eventBus","modeling"];var Sk=500;function yd(e,t,n,i,o){n.invoke(pe,this);function r(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||Rk(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Ot(f,Zr({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(tt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var f=de(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),nn(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Zt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=de(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",Sk,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,o.create(d.$type))),l(f,d),delete p.referencedRootElement)})}yd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ce(yd,pe);function Rk(e,t){return $e(t)||(t=[t]),Po(t,function(n){return ma(e,n)})}var vb=Math.max;function bb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=Mk(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=xn(a)?hd:gd),M(a,"bpmn:SubProcess")&&ct(a)&&(r[s]=lb),M(a,"bpmn:TextAnnotation")&&(r[s]=ub),M(a,"bpmn:Group")&&(r[s]=yk)}),r})}bb.$inject=["eventBus"];function Ck(e){return e==="x"}function Mk(e,t,n){var i=xn(e);if(!Tk(e))return i?Ol:Dl;var o=Ck(t),r={};return o?i?r=Ol:r={width:Pk(e,n,o),height:Dl.height}:i?r={width:Ol.width,height:Ak(e,n,o)}:r=Dl,r}function Ak(e,t,n){var i;return i=kk(e,t,n),vb(Ol.height,i)}function Pk(e,t,n){var i;return i=Ok(e,t,n),vb(Dl.width,i)}function Tk(e){return!!Wo(e).length}function kk(e,t,n){var i=Wo(e),o;return o=vd(i,t,n),e.height-o.height+hd.height}function Ok(e,t,n){var i=Wo(e),o;return o=vd(i,t,n),e.width-o.width+gd.width}function vd(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=Wo(o),r.length?vd(r,t,n):o}var xb="_plane";function _b(e){var t=e.id;return Dk(t)}function Qi(e){var t=e.id;return M(e,"bpmn:SubProcess")?wb(t):t}function Mr(e){return wb(e)}function Il(e){var t=dt(e);return M(t,"bpmndi:BPMNPlane")}function wb(e){return e+xb}function Dk(e){return e.replace(new RegExp(xb+"$"),"")}var Eb=400,Lk=600,Sb={x:180,y:160};function yo(e,t,n,i,o,r,a){pe.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 M(p,"bpmn:SubProcess")&&!ct(p)}function l(p){var f=p.shape,d=p.newRootElement,g=de(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=de(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Qi(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;z(f,function(d){if(c(d)){var g=a.get(Qi(d));if(!(!g||!d.children||!d.children.length)){var h=Rb(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!ct(f)||z(xs([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Qi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Qi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Qi(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(Il(f)){a.updateId(f,Mr(m)),a.updateId(h,m);return}var _=a.get(Mr(h));_&&a.updateId(Mr(h),Mr(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if(Il(f)){a.updateId(f,Mr(h)),a.updateId(m,h);return}var _=a.get(Mr(m));_&&a.updateId(_,Mr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Il(f)){var d=f,g=a.get(_b(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Eb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ct(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Eb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ct(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Lk,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ct(f))s._moveChildrenToShape(d.children.slice(),f),z(xs(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Rb(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Qi(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,m=M(dt(h),"bpmndi:BPMNPlane");if(m){var _=_b(h),b=Ot(g,function(y){return y.id===_});b&&(f.parent=b.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ce(yo,pe),yo.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=an(i),r;if(!t.x)r={x:Sb.x-o.x,y:Sb.y-o.y};else{var a=je(t),s=je(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},yo.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(gv(e).map(i=>i.annotation));n.size&&z(xs(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},yo.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},yo.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},yo.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:Qi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},yo.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ot(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},yo.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function Ik(e){var t=[];return z(xs(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Rb(e){return e.children.slice().concat(Ik(e.children)).concat(Bk(e))}function Bk(e){return Ef(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function bd(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!M(o,"bpmn:SubProcess")||M(o,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!ct(o))){var r=Nk(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}bd.$inject=["injector","modeling"],Ce(bd,pe);function Nk(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function xd(e,t){pe.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!M(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,yi(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}}})}Ce(xd,pe),xd.$inject=["eventBus","textRenderer"];function _d(e,t){pe.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ct(i))return;var o=hs(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){r(l,!0)}),z(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,je(i)):t.reconnectStart(a,i,je(i)))}},!0)}Ce(_d,pe),_d.$inject=["eventBus","modeling"];var wd=500;function Ed(e,t,n){pe.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=$k(c).concat([a]),p=Dv(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"],wd,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?dt(c).isExpanded=!1:(i(c.children),dt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],wd,function(a){var s=a.context,c=s.shape;c.collapsed?dt(c).isExpanded=!1:dt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],wd,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"})})}Ce(Ed,pe),Ed.$inject=["eventBus","elementFactory","modeling"];function $k(e){return e.filter(function(t){return!t.hidden})}function Sd(e,t,n,i){t.invoke(pe,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;Je(a)||(M(a,"bpmn:Participant")&&ct(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;M(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ce(Sd,pe),Sd.$inject=["canvas","injector","moddle","modeling"];function Rd(e,t){pe.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;Fk(o,r)&&t.updateProperties(r,{default:null})})}Ce(Rd,pe),Rd.$inject=["eventBus","modeling"];function Fk(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=de(t),i=de(e);return n.get("default")===i}var jk=500,Hk=5e3,Cb=["shape.create","shape.delete","shape.move","shape.resize"],Mb=[...Cb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Cd(e,t){pe.call(this,e);var n;function i(){return n=n||new zk,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(Mb,Hk,function(){i()}),this.postExecuted(Mb,jk,function(){r()}),this.preExecute(Cb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Cd.$inject=["eventBus","modeling"],Ce(Cd,pe);function zk(){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 Gk=500,Vk=5e3,Ab=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Pb=[...Ab,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Md(e,t){pe.call(this,e);var n;function i(){return n=n||new Wk,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(Pb,Vk,function(){i()}),this.postExecuted(Pb,Gk,function(){r()}),this.preExecute(Ab,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&o().addGroup(s)})}Md.$inject=["eventBus","modeling"],Ce(Md,pe);function Wk(){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 Ad(e,t){pe.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)Uk(r)&&!Yk(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ce(Ad,pe),Ad.$inject=["eventBus","modeling"];function Uk(e){const t=de(e);return t&&t.isForCompensation}function qk(e){return e&&M(e,"bpmn:BoundaryEvent")&&ma(e,"bpmn:CompensateEventDefinition")}function Yk(e){return e.incoming.filter(n=>qk(n.source)).length>0}const Kk={__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",Bf],appendBehavior:["type",Nf],associationBehavior:["type",Ff],attachEventBehavior:["type",ml],artifactBehavior:["type",$f],boundaryEventBehavior:["type",jf],categoryRootElementReferenceBehavior:["type",Hf],compensateBoundaryEventBehaviour:["type",zf],createBehavior:["type",Gf],createDataObjectBehavior:["type",Vf],createParticipantBehavior:["type",qf],dataInputAssociationBehavior:["type",Yf],dataStoreBehavior:["type",Kf],deleteLaneBehavior:["type",Xf],detachEventBehavior:["type",Sl],dropOnFlowBehavior:["type",Qf],eventBasedGatewayBehavior:["type",Jf],fixHoverBehavior:["type",jv],groupBehavior:["type",ed],importDockingFix:["type",zv],isHorizontalFix:["type",nd],labelBehavior:["type",od],layoutConnectionBehavior:["type",rd],messageFlowBehavior:["type",cd],nonInterruptingBehavior:["type",ld],removeElementBehavior:["type",pd],removeEmbeddedLabelBoundsBehavior:["type",ud],removeParticipantBehavior:["type",fd],replaceConnectionBehavior:["type",dd],replaceElementBehaviour:["type",kl],resizeBehavior:["type",pb],resizeLaneBehavior:["type",yb],rootElementReferenceBehavior:["type",yd],spaceToolBehavior:["type",bb],subProcessPlaneBehavior:["type",yo],subProcessStartEventBehavior:["type",bd],textAnnotationBehavior:["type",xd],toggleCollapseConnectionBehaviour:["type",_d],toggleElementCollapseBehaviour:["type",Ed],unclaimIdBehavior:["type",Sd],unsetDefaultFlowBehavior:["type",Rd],updateFlowNodeRefsBehavior:["type",Cd],updateCategoryValueRefsBehavior:["type",Md],setCompensationActivityAfterPasteBehavior:["type",Ad]};function Pd(e){this._commandStack=e.get("commandStack",!1)}Pd.$inject=["injector"],Pd.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Ji={__init__:["rules"],rules:["type",Pd]};function Si(e){pe.call(this,e),this.init()}Si.$inject=["eventBus"],Ce(Si,pe),Si.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)})},Si.prototype.init=function(){};function Tb(e,t){var n=kn(e,t,-15);return n!=="intersect"?n:null}function Dn(e){Si.call(this,e)}Ce(Dn,Si),Dn.$inject=["eventBus"],Dn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return Xk(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 Nl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Nl(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 Gb(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Pt(i)&&!$l(t,i)?!1:Ao(t,function(o){return Pt(o)?Nl(o.source,o.target,o):o.host?ks(o,o.host,null,n):Dd(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 Nb(a)&&!n.includes(a.host)})?!1:ks(n,t,null,i)||Hb(n,t,i)||zb(n,t)||$l(n,t)}),this.addRule("shape.create",function(e){return Dd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ks(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Yb(n,t)})},Dn.prototype.canConnectMessageFlow=Ub,Dn.prototype.canConnectSequenceFlow=qb,Dn.prototype.canConnectDataAssociation=Ld,Dn.prototype.canConnectAssociation=Vb,Dn.prototype.canConnectCompensationAssociation=Wb,Dn.prototype.canMove=zb,Dn.prototype.canAttach=ks,Dn.prototype.canReplace=Hb,Dn.prototype.canDrop=Ca,Dn.prototype.canInsert=$l,Dn.prototype.canCreate=Dd,Dn.prototype.canConnect=Nl,Dn.prototype.canResize=Gb,Dn.prototype.canCopy=Yb;function Xk(e){return Td(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Td(e){return!e||Je(e)}function kb(e){do{if(M(e,"bpmn:Process"))return de(e);if(M(e,"bpmn:Participant"))return de(e).processRef||de(e)}while(e=e.parent)}function kd(e){return M(e,"bpmn:TextAnnotation")}function Od(e){return M(e,"bpmn:Group")&&!e.labelTarget}function Ob(e){return M(e,"bpmn:BoundaryEvent")&&eo(e,"bpmn:CompensateEventDefinition")}function Bl(e){return de(e).isForCompensation}function Zk(e,t){var n=kb(e),i=kb(t);return n===i}function Qk(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&Ib(e,"bpmn:MessageEventDefinition"))}function Jk(e){return M(e,"bpmn:InteractionNode")&&!Bl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&Ib(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!eo(e,"bpmn:MessageEventDefinition"))}function Db(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return de(t);if(M(t,"bpmn:Participant"))return de(t).processRef}return null}function Lb(e,t){var n=Db(e),i=Db(t);return n===i}function eo(e,t){var n=de(e);return!!Ot(n.eventDefinitions||[],function(i){return M(i,t)})}function Ib(e,t){var n=de(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function e2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&eo(e,"bpmn:LinkEventDefinition"))&&!Ob(e)&&!Bl(e)}function t2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&eo(e,"bpmn:LinkEventDefinition"))&&!Bl(e)}function n2(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(eo(e,"bpmn:MessageEventDefinition")||eo(e,"bpmn:TimerEventDefinition")||eo(e,"bpmn:ConditionalEventDefinition")||eo(e,"bpmn:SignalEventDefinition"))}function i2(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Bb(e,t){var n=i2(t);return n.indexOf(e)!==-1}function Nl(e,t,n){if(Td(e)||Td(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Ub(e,t))return{type:"bpmn:MessageFlow"};if(qb(e,t))return{type:"bpmn:SequenceFlow"}}var i=Ld(e,t);return i||(Wb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Vb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ca(e,t){return Je(e)||Od(e)?!0:M(t,"bpmn:Participant")&&!ct(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):tt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!o2(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?ct(t):tt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?Po(de(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function o2(e){return de(e).cancelActivity&&($b(e)||Fb(e))}function Nb(e){return!Je(e)&&M(e,"bpmn:BoundaryEvent")}function r2(e){return M(e,"bpmn:Lane")}function a2(e){return Nb(e)||M(e,"bpmn:IntermediateThrowEvent")&&$b(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&Fb(e)}function $b(e){var t=de(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Fb(e){return jb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function jb(e,t){return t.some(function(n){return eo(e,n)})}function s2(e){return M(e,"bpmn:ReceiveTask")&&Ot(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function ks(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return Je(o)||!a2(o)||jn(t)||!M(t,"bpmn:Activity")||Bl(t)||i&&!Tb(i,t)||s2(t)?!1:"attach"}function Hb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){jn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&Ca(o,t)&&(mP(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(yP(o)||vP(o)||bP(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),jb(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||eo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&Ca(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&ks(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function zb(e,t){return Po(e,r2)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ca(n,t)})}function Dd(e,t,n,i){return t?Je(e)||Od(e)?!0:Ca(e,t)||$l(e,t):!1}function Gb(e,t,n){return M(e,"bpmn:SubProcess")?ct(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:kd(e)?n?n==="e"||n==="w":!0:Od(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function c2(e,t){var n=kd(e),i=kd(t);return(n||i)&&n!==i}function Vb(e,t){return Bb(t,e)||Bb(e,t)?!1:c2(e,t)?!0:!!Ld(e,t)}function Wb(e,t){return Lb(e,t)&&Ob(e)&&M(t,"bpmn:Activity")&&!u2(t,e)&&!jn(t)}function Ub(e,t){return Xb(e)&&!Xb(t)?!1:Qk(e)&&Jk(t)&&!Zk(e,t)}function qb(e,t){return e2(e)&&t2(t)&&Lb(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!n2(t))}function Ld(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function $l(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Ca(e,t.parent)}function Id(e,t){return e&&t&&e.indexOf(t)!==-1}function Yb(e,t){return Je(t)?!0:!(M(t,"bpmn:Lane")&&!Id(e,t.parent)||M(t,"bpmn:MessageFlow")&&!l2(e,t))}function l2(e,t){var n=Kb(t.source),i=Kb(t.target);return Id(e,n)&&Id(e,i)}function Kb(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Xb(e){return ba(e,"bpmn:Process")||ba(e,"bpmn:Collaboration")}function u2(e,t){return e.attachers.includes(t)}const p2={__depends__:[Ji],__init__:["bpmnRules"],bpmnRules:["type",Dn]};var f2=2e3;function Zb(e,t){e.on("saveXML.start",f2,n);function n(){var i=t.getRootElements();z(i,function(o){var r=dt(o),a,s;a=hs([o]),a=it(a,function(c){return c!==o&&!c.labelTarget}),s=Bn(a,dt),r.set("planeElement",s)})}}Zb.$inject=["eventBus","canvas"];const d2={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Zb]};function Fl(e){pe.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)})}Fl.prototype.getOrdering=function(e,t){return null},Ce(Fl,pe);function Bd(e,t){Fl.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=Ot(n,function(c){return tt(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&&!tt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=Rg(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}}}Bd.$inject=["eventBus","canvas"],Ce(Bd,Fl);const h2={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Bd]};function Os(){}Os.prototype.get=function(){return this._data},Os.prototype.set=function(e){this._data=e},Os.prototype.clear=function(){var e=this._data;return delete this._data,e},Os.prototype.isEmpty=function(){return!this._data};const g2={clipboard:["type",Os]};var Qb=1500;function Jb(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",Qb,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Qb,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=Cr(a),c=document.elementFromPoint(s.x,s.y),m2(c)}}Jb.$inject=["elementRegistry","eventBus","injector"];function m2(e){return _r(e,"svg, .djs-element",!0)}const y2={__init__:["hoverFix"],hoverFix:["type",Jb]};function v2(e){return!0}function jl(e){return qo(e)||Ek(e)}var ex=500;function tx(e,t,n){var i=this;function o(T,D,$){if(!s(T,D)){var N,H,X;$?H=t.getGraphics($):(N=D.delegateTarget||D.target,N&&(H=N,$=t.get(H))),!(!H||!$)&&(X=e.fire(T,{element:$,gfx:H,originalEvent:D}),X===!1&&(D.stopPropagation(),D.preventDefault()))}}var r={};function a(T){return r[T]}function s(T,D){var $=l[T]||qo;return!$(D)}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":v2,"element.mousedown":jl,"element.mouseup":jl,"element.click":jl,"element.dblclick":jl};function u(T,D,$){var N=c[T];if(!N)throw new Error("unmapped DOM event name <"+T+">");return o(N,D,$)}var p="svg, .djs-element";function f(T,D,$,N){var H=r[$]=function(X){o($,X)};N&&(l[$]=N),H.$delegate=ei.bind(T,p,D,H)}function d(T,D,$){var N=a($);N&&ei.unbind(T,D,N.$delegate)}function g(T){z(c,function(D,$){f(T,$,D)})}function h(T){z(c,function(D,$){d(T,$,D)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var D=T.element,$=T.gfx;e.fire("interactionEvents.createHit",{element:D,gfx:$})}),e.on(["shape.changed","connection.changed"],ex,function(T){var D=T.element,$=T.gfx;e.fire("interactionEvents.updateHit",{element:D,gfx:$})}),e.on("interactionEvents.createHit",ex,function(T){var D=T.element,$=T.gfx;i.createDefaultHit(D,$)}),e.on("interactionEvents.updateHit",function(T){var D=T.element,$=T.gfx;i.updateDefaultHit(D,$)});var m=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),b=E("djs-hit djs-hit-all"),y=E("djs-hit djs-hit-no-move"),v={all:b,"click-stroke":_,stroke:m,"no-move":y};function E(T,D){return D=V({stroke:"white",strokeWidth:15},D||{}),n.cls(T,["no-fill","no-border"],D)}function w(T,D){var $=v[D];if(!$)throw new Error("invalid hit type <"+D+">");return we(T,$),T}function P(T,D){ze(T,D)}this.removeHits=function(T){var D=ls(".djs-hit",T);z(D,rn)},this.createDefaultHit=function(T,D){var $=T.waypoints,N=T.isFrame,H;return $?this.createWaypointsHit(D,$):(H=N?"stroke":"all",this.createBoxHit(D,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,D){var $=ds(D);return w($,"stroke"),P(T,$),$},this.createBoxHit=function(T,D,$){$=V({x:0,y:0},$);var N=Oe("rect");return w(N,D),we(N,$),P(T,N),N},this.updateDefaultHit=function(T,D){var $=wt(".djs-hit",D);if($)return T.waypoints?wf($,T.waypoints):we($,{width:T.width,height:T.height}),$},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}tx.$inject=["eventBus","elementRegistry","styles"];const Hl={__init__:["interactionEvents"],interactionEvents:["type",tx]};function Ma(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)})}Ma.$inject=["eventBus","canvas"],Ma.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()})}},Ma.prototype.get=function(){return Array.from(this._selectedElements)},Ma.prototype.isSelected=function(e){return this._selectedElements.has(e)},Ma.prototype.select=function(e,t){var n=this.get();$e(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?z(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var nx="hover",ix="selected";function ox(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,nx)}),t.on("element.out",function(o){i(o.element,nx)}),t.on("selection.changed",function(o){function r(l){i(l,ix)}function a(l){n(l,ix)}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)})}ox.$inject=["canvas","eventBus"];function rx(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;$e(l)?t.select(l):t.select(s.filter(b2))}}),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=Ot(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(qo(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Ll(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}rx.$inject=["eventBus","selection","canvas","elementRegistry"];function b2(e){return!e.hidden}const Ri={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Hl],selection:["type",Ma],selectionVisuals:["type",ox],selectionBehavior:["type",rx]};var x2=/^djs-cursor-.*$/;function zl(e){var t=Rt(document.body);t.removeMatching(x2),e&&t.add("djs-cursor-"+e)}function ax(){zl(null)}var _2=5e3;function sx(e,t){t=t||"element.click";function n(){return!1}return e.once(t,_2,n),function(){e.off(t,n)}}var w2=["c","C"],E2=["v","V"],S2=["d","D"],R2=["x","X"],C2=["y","Y"],cx=["z","Z"];function M2(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function ii(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function gn(e,t){return e=$e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Nd(e){return e.shiftKey}function A2(e){return ii(e)&&gn(w2,e)}function P2(e){return ii(e)&&gn(E2,e)}function T2(e){return ii(e)&&gn(S2,e)}function k2(e){return ii(e)&&gn(R2,e)}function O2(e){return ii(e)&&!Nd(e)&&gn(cx,e)}function D2(e){return ii(e)&&(gn(C2,e)||gn(cx,e)&&Nd(e))}var Aa=Math.round,lx="djs-drag-active";function Ar(e){e.preventDefault()}function L2(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function I2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ux(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(y){var v=t.viewbox(),E=t._container.getBoundingClientRect();return{x:v.x+(y.x-E.left)/v.scale,y:v.y+(y.y-E.top)/v.scale}}function s(y,v){v=v||r;var E=e.createEvent(V({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+y,E)===!1?!1:e.fire(v.prefix+"."+y,E)}function c(y){var v=y.filter(function(E){return i.get(E.id)});v.length&&n.select(v)}function l(y,v){var E=r.payload,w=r.displacement,P=r.globalStart,T=Cr(y),D=Bi(T,P),$=r.localStart,N=a(T),H=Bi(N,$);if(!r.active&&(v||I2(D)>r.threshold)){if(V(E,{x:Aa($.x+w.x),y:Aa($.y+w.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&zl(r.cursor),t.addMarker(t.getRootElement(),lx)}md(y),r.active&&(V(E,{x:Aa(N.x+w.x),y:Aa(N.y+w.y),dx:Aa(H.x),dy:Aa(H.y)},{originalEvent:y}),s("move"))}function u(y){var v,E=!0;r.active&&(y&&(r.payload.originalEvent=y,md(y)),E=s("end")),E===!1&&s("rejected"),v=_(E!==!0),s("ended",v)}function p(y){gn("Escape",y)&&(Ar(y),m())}function f(y){var v;r.active&&(v=sx(e),setTimeout(v,400),Ar(y)),u(y)}function d(y){l(y)}function g(y){var v=r.payload;v.hoverGfx=y.gfx,v.hover=y.element,s("hover")}function h(y){s("out");var v=r.payload;v.hoverGfx=null,v.hover=null}function m(y){var v;if(r){var E=r.active;E&&s("cancel"),v=_(y),E&&s("canceled",v)}}function _(y){var v,E;s("cleanup"),ax(),r.trapClick?E=f:E=u,Le.unbind(document,"mousemove",l),Le.unbind(document,"dragstart",Ar),Le.unbind(document,"selectstart",Ar),Le.unbind(document,"mousedown",E,!0),Le.unbind(document,"mouseup",E,!0),Le.unbind(document,"keyup",p),Le.unbind(document,"touchstart",d,!0),Le.unbind(document,"touchcancel",m,!0),Le.unbind(document,"touchmove",l,!0),Le.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),lx);var w=r.payload.previousSelection;return y!==!1&&w&&!n.get().length&&c(w),v=r,r=null,v}function b(y,v,E,w){r&&m(!1),typeof v=="string"&&(w=E,E=v,v=null),w=V({},o,w||{});var P=w.data||{},T,D,$,N,H;if(w.trapClick?N=f:N=u,y?(T=Ra(y)||y,D=Cr(y),md(y),T.type==="dragstart"&&Ar(T)):(T=null,D={x:0,y:0}),$=a(D),v||(v=$),H=L2(T),r=V({prefix:E,data:P,payload:{},globalStart:D,displacement:Bi(v,$),localStart:$,isTouch:H},w),w.manual||(H?(Le.bind(document,"touchstart",d,!0),Le.bind(document,"touchcancel",m,!0),Le.bind(document,"touchmove",l,!0),Le.bind(document,"touchend",u,!0)):(Le.bind(document,"mousemove",l),Le.bind(document,"dragstart",Ar),Le.bind(document,"selectstart",Ar),Le.bind(document,"mousedown",N,!0),Le.bind(document,"mouseup",N,!0)),Le.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;w.autoActivate&&l(y,!0)}e.on("diagram.destroy",m),this.init=b,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(y){V(o,y)}}ux.$inject=["eventBus","canvas","selection","elementRegistry"];const vo={__depends__:[y2,Ri],dragging:["type",ux]};function Pr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Pr.prototype.next=function(){return this._prefix+ ++this._counter};const B2=new Pr("ps");var N2=["marker-start","marker-mid","marker-end"],$2=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Yo(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Yo.$inject=["elementRegistry","eventBus","canvas","styles"],Yo.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")},Yo.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Yo.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=hf(n);return this._cloneMarkers(Ho(o),i),we(o,this._styles.cls(i,[])),ze(t,o),we(o,"data-preview-support-element-id",e.id),o},Yo.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),we(n,"data-preview-support-element-id",e.id),n},Yo.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),z2(e)&&N2.forEach(function(o){if(we(e,o)){var r=F2(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},Yo.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,B2.next()].join("-"),a=wt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||hf(n);s.id=r,st(s).add(o);var c=wt(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=H2(s.id);we(t,i,l)};function F2(e,t,n){var i=j2(we(e,t));return wt("marker#"+i,n||document)}function j2(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function H2(e){return"url(#"+e+")"}function z2(e){return $2.indexOf(e.nodeName)!==-1}const Pa={__init__:["previewSupport"],previewSupport:["type",Yo]};var G2="drop-ok",px="drop-not-ok",fx="attach-ok",dx="new-parent",hx="create",V2=2e3;function gx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=it(c,function(b){var y=b.labelTarget;return!b.parent&&!(Je(b)&&c.indexOf(y)!==-1)});var d=Ot(c,function(b){return!Pt(b)}),g=!1,h=!1,m=!1;yx(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(yx(c)?m=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:_===p?d:p,target:_===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[fx,G2,px,dx].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}mx(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,fx):a(p,h?dx:px))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,m=g&&g.connect,_=l.hints||{};if(g===!1||!d)return!1;mx(c);var b={x:c.x,y:c.y};m?p=i.appendShape(u,p,b,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(f=i.createElements(f,b,d,V({},_,{attach:h})),p=Ot(f,function(y){return!Pt(y)})),V(l,{elements:f,shape:p}),V(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===hx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],V2,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){$e(l)||(l=[l]);var p=Ot(l,function(g){return!Pt(g)});if(p){u=V({elements:l,hints:{},shape:p},u||{}),z(l,function(g){Fe(g.x)||(g.x=0),Fe(g.y)||(g.y=0)});var f=it(l,function(g){return!g.hidden}),d=an(f);z(l,function(g){Pt(g)&&(g.waypoints=Bn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,hx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}gx.$inject=["canvas","dragging","eventBus","modeling","rules"];function mx(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 yx(e){return e&&e.length===1&&!Pt(e[0])}var W2=750;function vx(e,t,n,i,o){function r(a){var s=Oe("g");we(s,o.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Ho(u),l)):(u=n._createContainer("shape",c),n.drawShape(Ho(u),l),On(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",W2,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(),ze(p,u)),On(u,a.x,a.y)):rn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&rn(c)})}vx.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Gl={__depends__:[vo,Pa,Ji,Ri],__init__:["create","createPreview"],create:["type",gx],createPreview:["type",vx]};function $d(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)})}$d.$inject=["eventBus"],$d.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||U2(0,0)};function U2(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 Ds={__init__:["mouse"],mouse:["type",$d]};var bx=2e3;function oi(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),q2(u)&&(l.priority=2,l.host=u.host.id),Pt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=Y2(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){Fe(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",bx,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",bx,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;V(l,{createElementsBehavior:!1})})}oi.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],oi.prototype.copy=function(e,t={}){var n,i;return $e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree($e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},oi.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})}}},oi.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},oi.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},oi.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},oi.prototype._paste=function(e,t,n,i){z(e,function(r){Fe(r.x)||(r.x=0),Fe(r.y)||(r.y=0)});var o=an(e);return z(e,function(r){Pt(r)&&(r.waypoints=Bn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),V(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,V({},i))},oi.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return z(e,function(r,a){r=Hi(r,"priority"),z(r,function(s){var c=V({},zi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Pt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(Je(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},oi.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(zi(e,["id"]));return t},oi.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(zi(e,["id"]));return t},oi.prototype.createShape=function(e){var t=this._elementFactory.createShape(zi(e,["id"]));return t},oi.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Pt(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},oi.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=tl(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=r.get(p);if(!d){var g={element:p,depth:f};o.push(g),r.set(p,g);return}if(d.depth<f){o=l(d,o);var h={element:d.element,depth:f};o.push(h),r.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Er(a,function(p,f,d){if(Je(p))return;z(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&z(m,function(_){z(_.labels,function(b){c(b,d)}),c(_,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Bn(o,function(p){return p.element});var u=new Set(e);return o=Bn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Hi(o,function(p){return p.descriptor.priority}),e=Bn(o,function(p){return p.element}),z(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){_x(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){_x(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function q2(e){return!!e.host}function Y2(e){return Bn(e.waypoints,function(t){return t=xx(t),t.original&&(t.original=xx(t.original)),t})}function xx(e){return V({},e)}function _x(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const K2={__depends__:[g2,Gl,Ds,Ji],__init__:["copyPaste"],copyPaste:["type",oi]};function Fd(e,t,n){$e(n)||(n=[n]),z(n,function(i){hr(e[i])||(t[i]=e[i])})}var jd=750;function wx(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",jd,function(c){var l=c.descriptor,u=c.element,p=de(u);if(Je(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(dt(u),!0);d.bpmnElement=f,Fd(f,l,"name"),Fd(d,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=de(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(de(c).attachedToRef=de(l[c.host])),zi(u,Qn(u,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(Je(u)){u.businessObject=de(l[u.labelTarget]),u.di=dt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,Fd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",jd,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=de(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&z(xs(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",jd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}wx.$inject=["bpmnFactory","eventBus","moddleCopy"];const X2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],Z2=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ls(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 Hi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=dn(o)&&o.$descriptor;if(a&&Z2.includes(a))return r;if(a&&X2.includes(a)||a&&s&&!Ot(s.properties,Zr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(M(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Ls.$inject=["eventBus","bpmnFactory","moddle"],Ls.prototype.copyElement=function(e,t,n,i=!1){n&&!$e(n)&&(n=[n]),n=n||Hd(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||($e(o)&&(n=o),z(n,r=>{let a;Zn(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!fn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Ls.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 dn(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):$e(e)?Qn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):dn(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},Ls.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 Hd(e,t){return Qn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Ex={__depends__:[K2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",wx],moddleCopy:["type",Ls]};var Sx=Math.round;function zd(e,t){this._modeling=e,this._eventBus=t}zd.$inject=["modeling","eventBus"],zd.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=Sx(s+r/2),u=Sx(c+a/2),p=i.replaceShape(e,V({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Rx(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Rx.$inject=["selection","eventBus"];const Q2={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Rx],replace:["type",zd]};function J2(e,t,n){$e(n)||(n=[n]),z(n,function(i){hr(e[i])||(t[i]=e[i])})}var eO=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function tO(e,t){var n=e&&Zn(e,"collapsed")?e.collapsed:!ct(e),i;return t&&(Zn(t,"collapsed")||Zn(t,"isExpanded"))?i=Zn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Cx(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(Vl(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&tO(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),J2(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Hd(p.$descriptor),h=Hd(f.$descriptor,!0),m=nO(g,h);V(f,Li(c,eO));var _=it(m,function(v){return v==="eventDefinitions"?Mx(s,c.eventDefinitionType):v==="loopCharacteristics"?!jn(f):Zn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!jn(f):!0});if(f=n.copyElement(p,f,_),c.eventDefinitionType&&(Mx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(Vl(p))d.isExpanded=ct(s);else if(c&&Zn(c,"isExpanded")){d.isExpanded=c.isExpanded;var b=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=b.width,d.height=b.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ct(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Vl(p)&&!Vl(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var y=xn(s);dt(s).isHorizontal||(dt(d).isHorizontal=y),d.width=y?s.width:t.getDefaultSize(d).width,d.height=y?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,tt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),o.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Cx.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Vl(e){return M(e,"bpmn:SubProcess")}function Mx(e,t){var n=de(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function nO(e,t){return e.filter(function(n){return t.includes(n)})}const Ax={__depends__:[Ex,Q2,Ri],bpmnReplace:["type",Cx]};var iO=250;function Tr(e){this._eventBus=e,this._tools=[],this._active=null}Tr.$inject=["eventBus"],Tr.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)},Tr.prototype.isActive=function(e){return e&&this._active===e},Tr.prototype.length=function(e){return this._tools.length},Tr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Tr.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),z(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,iO,function(o){this._active&&(oO(o)||this.setActive(null))},this)};function oO(e){var t=e.originalEvent&&e.originalEvent.target;return t&&_r(t,'.group[data-group="tools"]')}const Wl={__depends__:[vo],__init__:["toolManager"],toolManager:["type",Tr]};function rO(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 aO(e,t){var n=[],i=new Set(e);z(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;z(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 sO(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 Gd=Math.abs,cO=Math.round,bo={x:"width",y:"height"},Px="crosshair",Ko={n:"top",w:"left",s:"bottom",e:"right"},lO=1500,Ul={n:"s",w:"e",s:"n",e:"w"},ql=20;function Ci(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",lO,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&kx(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){kx(c);var h={x:0,y:0};h[u]=cO(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ci.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ci.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Px,data:{context:{reactivate:n}},trapClick:!1})},Ci.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Px,data:{context:{}}})},Ci.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ci.prototype.init=function(e,t){var n=Gd(e.dx)>Gd(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Gd(i)<5)return!1;i<0&&(i*=-1),Ts(e)&&(i*=-1);var r=rO(n,i),a=this._canvas.getRootElement();!Ll(e)&&e.hover&&(a=e.hover);var s=[...hs(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=uO(c,n,r,o,l);return V(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),zl("resize-"+(n==="x"?"ew":"ns")),!0},Ci.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),r.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||Je(d))){if(Pt(d)){u.push(d);return}var g=d[t],h=g+d[bo[t]];if(pO(d)&&(n>0&&je(d)[t]>i||n<0&&je(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:d})){f(d);return}}}),z(r,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:r,resizingShapes:a}},Ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ci.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Tx(e){return{top:e.top-ql,right:e.right+ql,bottom:e.bottom+ql,left:e.left-ql}}function kx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Fe(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function uO(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 z(a,function(f){var d=f.attachers,g=f.children,h=Be(f),m=it(g,function(H){return!Pt(H)&&!Je(H)&&!u.has(H)&&!p.has(H)}),_=it(g,function(H){return!Pt(H)&&!Je(H)&&u.has(H)}),b,y,v,E=[],w=[],P,T,D,$;m.length&&(y=Tx(Be(an(m))),b=i-h[Ko[n]]+y[Ko[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,b):b:n==="w"?s.right=l=Fe(l)?Math.min(l,b):b:n==="s"?s.top=c=Fe(c)?Math.max(c,b):b:n==="e"&&(s.left=c=Fe(c)?Math.max(c,b):b)),_.length&&(v=Tx(Be(an(_))),b=i-v[Ko[Ul[n]]]+h[Ko[Ul[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,b):b:n==="w"?s.right=l=Fe(l)?Math.min(l,b):b:n==="s"?s.top=c=Fe(c)?Math.max(c,b):b:n==="e"&&(s.left=c=Fe(c)?Math.max(c,b):b)),d&&d.length&&(d.forEach(function(H){u.has(H)?E.push(H):w.push(H)}),E.length&&(P=Be(an(E.map(je))),T=h[Ko[Ul[n]]]-(P[Ko[Ul[n]]]-i)),w.length&&(D=Be(an(w.map(je))),$=D[Ko[n]]-(h[Ko[n]]-i)),n==="n"?(b=Math.min(T||1/0,$||1/0),s.bottom=l=Fe(l)?Math.min(l,b):b):n==="w"?(b=Math.min(T||1/0,$||1/0),s.right=l=Fe(l)?Math.min(l,b):b):n==="s"?(b=Math.max(T||-1/0,$||-1/0),s.top=c=Fe(c)?Math.max(c,b):b):n==="e"&&(b=Math.max(T||-1/0,$||-1/0),s.left=c=Fe(c)?Math.max(c,b):b));var N=o&&o[f.id];N&&(n==="n"?(b=i+f[bo[t]]-N[bo[t]],s.bottom=l=Fe(l)?Math.min(l,b):b):n==="w"?(b=i+f[bo[t]]-N[bo[t]],s.right=l=Fe(l)?Math.min(l,b):b):n==="s"?(b=i-f[bo[t]]+N[bo[t]],s.top=c=Fe(c)?Math.max(c,b):b):n==="e"&&(b=i-f[bo[t]]+N[bo[t]],s.left=c=Fe(c)?Math.max(c,b):b))}),s}}function pO(e){return!!e.host}var Vd="djs-dragging",Ox="djs-resizing",fO=250,Yl=Math.max;function Dx(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,Vd)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");we(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var p=Oe("path");we(p,"d",l.x),st(p).add("djs-crosshair"),ze(u,p);var f=Oe("path");we(f,"d",l.y),st(f).add("djs-crosshair"),ze(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;On(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&rn(c)}),e.on("spaceTool.move",fO,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),we(c,"d","M0,0 L0,0"),st(c).add("djs-crosshair"),ze(f,c),s.line=c;var d=Oe("g");we(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(w){g.add(w)});var h=new Set,m=s.movingConnections=[];g.forEach(function(w){z(w.outgoing,function(P){h.has(P)||!Pt(P)||!g.has(P.target)||(h.add(P),m.push(P))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Oe("g");we(_,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),_);var b=[];z(p,function(w){var P=o.addFrame(w,_),T=P.getBBox();b.push({element:P,initialBounds:T}),n.addMarker(w,Ox)}),s.frameGroup=_,s.frames=b}var y={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};we(c,{d:y[l]});var v={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[v[s.axis]]=0,On(s.dragGroup,E.x,E.y),z(s.frames,function(w){var P=w.element,T=w.initialBounds,D,$;s.direction==="e"?we(P,{width:Yl(T.width+E.x,5)}):(D=Yl(T.width-E.x,5),we(P,{width:D,x:T.x+T.width-D})),s.direction==="s"?we(P,{height:Yl(T.height+E.y,5)}):($=Yl(T.height-E.y,5),we(P,{height:$,y:T.y+T.height-$}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,Vd)}),z(l,function(g){n.removeMarker(g,Vd)}),f&&(rn(p),rn(f)),z(u,function(g){n.removeMarker(g,Ox)}),d&&rn(d)})}Dx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const dO={__init__:["spaceToolPreview"],__depends__:[vo,Ji,Wl,Pa,Ds],spaceTool:["type",Ci],spaceToolPreview:["type",Dx]};function Kl(e,t){e.invoke(Ci,this),this._canvas=t}Kl.$inject=["injector","canvas"],Ce(Kl,Ci),Kl.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=Kr(fa(o.children.filter(l=>M(l,"bpmn:Artifact")),an(r))));const s=[...e,...a];var c=Ci.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||hO(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function hO(e){return M(e,"bpmn:Participant")&&!de(e).processRef}const Lx={__depends__:[dO],spaceTool:["type",Kl]};function Vt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Vt.$inject=["eventBus","injector"],Vt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Vt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let o=this._fire(e,"canExecute",n);if(o===void 0){if(!i)return!1;i.canExecute&&(o=i.canExecute(t))}return o},Vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Vt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Vt.prototype.register=function(e,t){this._setHandler(e,t)},Vt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Vt.prototype.canUndo=function(){return!!this._getUndoAction()},Vt.prototype.canRedo=function(){return!!this._getRedoAction()},Vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Vt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Vt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let o;n=this._eventBus.createEvent(n);for(const r of i)if(o=this._eventBus.fire("commandStack."+r,n),n.cancelBubble)break;return o},Vt.prototype._createId=function(){return this._uid++},Vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Vt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,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()},Vt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Vt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Cg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=$e(e)?e:[e],t.dirty=t.dirty.concat(e))},Vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Vt.prototype._revertedAction=function(e){this._stackIdx--},Vt.prototype._getHandler=function(e){return this._handlerMap[e]},Vt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const gO={commandStack:["type",Vt]};function Xo(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 mO=250,Ix=1400;function Wd(e,t,n){pe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ix,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=Bx(a),r.validatedShapes=Bx(s)}),i&&t.on("shape.move.start",mO,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",Ix,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;Xo(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=Sf(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&&(nn(s.labels,a,c),a.labelTarget=s)})}Ce(Wd,pe),Wd.$inject=["injector","eventBus","modeling"];function Bx(e){var t=new Set(e);return it(e,function(n){return!t.has(n.labelTarget)})}const yO={__init__:["labelSupport"],labelSupport:["type",Wd]};var vO=251,Nx=1401,$x="attach-ok";function Ud(e,t,n,i,o){pe.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",Nx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=bO(c),s.validatedShapes=xO(l)}),r&&t.on("shape.move.start",vO,function(a){var s=a.context,c=s.shapes,l=qd(c);z(l,function(u){r.makeDraggable(s,u,!0),z(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,$x),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,$x)}))}}),this.preExecuted("elements.move",Nx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=qd(l);z(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=it(c,function(p){var f=p.host;return _O(p)&&!wO(c,f)}),z(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),z(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;Xo(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&&z(l.attachers,function(u){var p=nb(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,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=nb(d,l,u);o.moveShape(d,g,d.parent),z(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Xo(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ce(Ud,pe),Ud.$inject=["injector","eventBus","canvas","rules","modeling"];function qd(e){return mp(Bn(e,function(t){return t.attachers||[]}))}function bO(e){var t=qd(e);return F1("id",e,t)}function xO(e){var t=Xr(e,"id");return it(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function _O(e){return!!e.host}function wO(e,t){return e.indexOf(t)!==-1}const EO={__depends__:[Ji],__init__:["attachSupport"],attachSupport:["type",Ud]};function Fx(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(ky(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)})}Fx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Yd={__init__:["changeSupport"],changeSupport:["type",Fx]};function Mi(e){this._model=e}Mi.$inject=["moddle"],Mi.prototype._needsId=function(e){return tt(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":tt(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},Mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Mi.prototype.createDiWaypoints=function(e){var t=this;return Bn(e,function(n){return t.createDiWaypoint(n)})},Mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Li(e,["x","y"]))},Mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function ri(e,t,n){pe.call(this,e),this._bpmnFactory=t;var i=this;function o(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function r(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ai(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],ai(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;z(m,function(_){M(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],ai(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],ai(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],ai(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],ai(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],ai(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],ai(u)),this.executed("connection.reconnect",ai(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,b=de(h),y=de(m),v=de(_);b.conditionExpression&&!tt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=b.conditionExpression,delete b.conditionExpression),m!==_&&y.default===b&&(g.oldDefault=y.default,delete y.default)})),this.reverted("connection.reconnect",ai(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,b=de(h),y=de(m),v=de(_);g.oldConditionExpression&&(b.conditionExpression=g.oldConditionExpression),g.oldDefault&&(y.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],ai(p)),this.reverted(["element.updateAttachment"],ai(p)),this.executed("element.updateLabel",ai(f)),this.reverted("element.updateLabel",ai(f));function f(d){const{element:g}=d.context,h=yi(g),m=dt(g),_=m&&m.get("label");Go(g)||Il(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}Ce(ri,pe),ri.$inject=["eventBus","bpmnFactory","connectionDocking"],ri.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ri.prototype.updateParent=function(e,t){if(!Je(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=dt(e),r=n&&n.businessObject,a=dt(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),M(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},ri.prototype.updateBounds=function(e){var t=dt(e),n=RO(e);if(n){var i=Bi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var o=Je(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),V(r,{x:e.x,y:e.y,width:e.width,height:e.height})},ri.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Zt(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),nn(o,e))}},ri.prototype.updateDiConnection=function(e,t,n){var i=dt(e),o=dt(t),r=dt(n);i.sourceElement&&i.sourceElement.bpmnElement!==de(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==de(n)&&(i.targetElement=n&&r)},ri.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Zt(n,e),e.$parent=null)}};function SO(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ri.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},ri.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=SO(e.$parent||t),e.$parent&&(Zt(r.get("rootElements"),o),o.$parent=null),t&&(nn(r.get("rootElements"),o),o.$parent=r))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Zt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Zt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ri.prototype.updateConnectionWaypoints=function(e){var t=dt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ri.prototype.updateConnection=function(e){var t=e.connection,n=de(t),i=t.source,o=de(i),r=t.target,a=de(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(Zt(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(Zt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,r)},ri.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function ai(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function RO(e){if(M(e,"bpmn:Activity")){var t=dt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Zo(e,t){ho.call(this),this._bpmnFactory=e,this._moddle=t}Ce(Zo,ho),Zo.$inject=["bpmnFactory","moddle"],Zo.prototype._baseCreate=ho.prototype.create,Zo.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Sr,t))}return this.createElement(e,t)},Zo.prototype.createElement=function(e,t){t=V({},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(!MO(o)){var r=V({},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)}M(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=CO(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Kd(o,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Kd(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!ct(i,o)),M(i,"bpmn:ExclusiveGateway")&&(Zn(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),fn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),fn(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=V({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},Zo.prototype.getDefaultSize=function(e,t){var n=de(e);if(t=t||dt(e),M(n,"bpmn:SubProcess"))return ct(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return ct(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Zo.prototype.createParticipantShape=function(e){return dn(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function CO(e,t,n){return z(n,function(i){t=Kd(e,t,i)}),t}function Kd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],zi(t,[n]))}function MO(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Xl(e,t){this._modeling=e,this._canvas=t}Xl.$inject=["modeling","canvas"],Xl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(o){var r={x:0,y:0};fn(i.left)?r.x=i.left-o.x:fn(i.right)?r.x=i.right-o.width-o.x:fn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:fn(i.top)?r.y=i.top-o.y:fn(i.bottom)?r.y=i.bottom-o.height-o.y:fn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},Xl.prototype.postExecute=function(e){};function Zl(e){this._modeling=e}Zl.$inject=["modeling"],Zl.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},Zl.prototype.postExecute=function(e){var t=e.hints||{};AO(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 AO(e,t){return Po(e.outgoing,function(n){return n.target===t})}function Ql(e,t){this._canvas=e,this._layouter=t}Ql.$inject=["canvas","layouter"],Ql.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},Ql.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Jl=Math.round;function Xd(e){this._modeling=e}Xd.$inject=["modeling"],Xd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;z(t,function(p){Fe(p.x)||(p.x=0),Fe(p.y)||(p.y=0)});var s=it(t,function(p){return!p.hidden}),c=an(s);z(t,function(p){Pt(p)&&(p.waypoints=Bn(p.waypoints,function(f){return{x:Jl(f.x-c.x-c.width/2+o.x),y:Jl(f.y-c.y-c.height/2+o.y)}})),V(p,{x:Jl(p.x-c.x-c.width/2+o.x),y:Jl(p.y-c.y-c.height/2+o.y)})});var l=new Set(tl(t)),u={};z(t,function(p){if(Pt(p)){u[p.id]=Fe(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 f=V({},r);l.has(p)||(f.autoResize=!1),Je(p)&&(f=zi(f,["attach"])),u[p.id]=Fe(i)?a.createShape(p,Li(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Li(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Kr(u)};var jx=Math.round;function Qo(e){this._canvas=e}Qo.$inject=["canvas"],Qo.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?V(t,n):V(t,{x:n.x-jx(t.width/2),y:n.y-jx(t.height/2)}),this._canvas.addShape(t,i,o),t},Qo.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Is(e){Qo.call(this,e)}Ce(Is,Qo),Is.$inject=["canvas"];var PO=Qo.prototype.execute;Is.prototype.execute=function(e){var t=e.shape;return kO(t),t.labelTarget=e.labelTarget,PO.call(this,e)};var TO=Qo.prototype.revert;Is.prototype.revert=function(e){return e.shape.labelTarget=null,TO.call(this,e)};function kO(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Bs(e,t){this._canvas=e,this._modeling=t}Bs.$inject=["canvas","modeling"],Bs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Xo(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Xo(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Bs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Sf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Bs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,nn(n.children,t,i),this._canvas.addConnection(t,n),t};function Zd(e,t){this._modeling=e,this._elementRegistry=t}Zd.$inject=["modeling","elementRegistry"],Zd.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function Ns(e,t){this._canvas=e,this._modeling=t}Ns.$inject=["canvas","modeling"],Ns.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Xo(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Xo(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Xo(n.children,function(i){Pt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ns.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Sf(i.children,n),t.removeShape(n),n},Ns.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return nn(i.children,n,o),t.addShape(n,i),n};function eu(e){this._modeling=e}eu.$inject=["modeling"];var Hx={x:"y",y:"x"};eu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,_){var b={y:0};b[i]=m-a(_),b[i]&&(b[Hx[i]]=0,t.moveElements([_],b,_.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(m,_){var b,y,v;if(m.elements.length<2){_&&_!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}b=Hi(m.elements,i),y=b[0],_===p&&(y=b[s(b)]),v=a(y),m.range=null,z(b,function(E){if(l(v,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),_&&_!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(m,_){var b={},y;m===u||m===f||(y=n[_-1],m.range.max=0,z(m.elements,function(v,E){b[Hx[i]]=0,b[i]=y.range.max-v[i]+d,m.range.min!==v[i]&&(b[i]+=v[i]-m.range.min),b[i]&&t.moveElements([v],b,v.parent),m.range.max=Math.max(v[i]+v[o],E?m.range.max:0)}))})},eu.prototype.postExecute=function(e){};function tu(e,t){this._layouter=e,this._canvas=t}tu.$inject=["layouter","canvas"],tu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},tu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Qd(){}Qd.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=Zt(r.children,t),nn(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Qd.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Zt(n.children,t),nn(i.children,t,o),t.parent=i,z(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 Jd(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Jd.prototype.add=function(e,t){return this.addAll([e],t)},Jd.prototype.addAll=function(e,t){var n=sA(e,!!t,this);return V(this,n),this};function $s(e){this._modeling=e}$s.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},$s.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),z(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&ad(p,p.source,t),connectionEnd:d&&sd(p,p.target,t)})})},$s.prototype.getClosure=function(e){return new Jd().addAll(e,!0)};function nu(e){this._helper=new $s(e)}nu.$inject=["modeling"],nu.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},nu.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 kr(e){this._modeling=e,this._helper=new $s(e)}kr.$inject=["modeling"],kr.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=Li(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Zt(r.children,t),nn(i.children,t,o),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},kr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(z(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:sd(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:ad(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},kr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return nn(n.children,t,i),V(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},kr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},kr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Fs(e){this._modeling=e}Fs.$inject=["modeling"],Fs.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 $e(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},Fs.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||zx($e(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||zx($e(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},Fs.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 zx(e){return e.original||e}function xo(e,t){this._modeling=e,this._rules=t}xo.$inject=["modeling","rules"],xo.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,m){return i.allowed("connection.reconnect",{connection:m,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 f=o.incoming.slice(),d=o.outgoing.slice();z(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,Pl(g,s,u),a)}),z(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,Al(g,s,u),a)})},xo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},xo.prototype.execute=function(e){},xo.prototype.revert=function(e){},xo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},xo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},xo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function js(e){this._modeling=e}js.$inject=["modeling"],js.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},js.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(z(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Pl(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Al(r,n,i)})}))},js.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Jo(e){this._modeling=e}Jo.$inject=["modeling"],Jo.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),z(o,function(s){a[s.id]=DO(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(aO(i,o),t,n,r,i,o,a)},Jo.prototype.execute=function(){},Jo.prototype.revert=function(){},Jo.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Jo.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=sO(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Jo.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);z(e,function(u){var p=u.source,f=u.target,d=OO(u),g=Vx(n),h={},m=c.has(p)||l.has(p),_=c.has(f)||l.has(f);m&&_?(d=Bn(d,function(b){return Wx(b,i,n)&&(b[g]=b[g]+t[g]),b.original&&Wx(b.original,i,n)&&(b.original[g]=b.original[g]+t[g]),b}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||_)&&(c.has(p)?h.connectionStart=ad(u,p,t):c.has(f)?h.connectionEnd=sd(u,f,t):l.has(p)?h.connectionStart=Al(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Pl(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Gx(e){return V({},e)}function OO(e){return Bn(e.waypoints,function(t){return t=Gx(t),t.original&&(t.original=Gx(t.original)),t})}function Vx(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Wx(e,t,n){var i=Vx(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function DO(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function iu(e){this._modeling=e}iu.$inject=["modeling"],iu.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Ux(n),t.collapsed=!t.collapsed;var i=qx(n,t.collapsed);return[t].concat(i)},iu.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=Yx(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function Ux(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,Ux(n.children)))}),t}function qx(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(qx(i.children,i.collapsed||t)))}),n}function Yx(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Yx(i.children,t)))}),n}function ou(e){this._modeling=e}ou.$inject=["modeling"],ou.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Kx(i,t),Xx(n,t),t.host=n,t},ou.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Kx(n,t),Xx(i,t,o),t};function Kx(e,t){return Zt(e&&e.attachers,t)}function Xx(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),nn(i,t,n)}}function eh(){}eh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},eh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Tt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Tt.$inject=["eventBus","elementFactory","commandStack"],Tt.prototype.getHandlers=function(){return{"shape.append":Zl,"shape.create":Qo,"shape.delete":Ns,"shape.move":kr,"shape.resize":js,"shape.replace":xo,"shape.toggleCollapse":iu,spaceTool:Jo,"label.create":Is,"connection.create":Ql,"connection.delete":Bs,"connection.move":Qd,"connection.layout":tu,"connection.updateWaypoints":eh,"connection.reconnect":Fs,"elements.create":Xd,"elements.move":nu,"elements.delete":Zd,"elements.distribute":eu,"elements.align":Xl,"element.updateAttachment":ou}},Tt.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Tt.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)},Tt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Tt.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)},Tt.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)},Tt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Tt.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},Tt.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},Tt.prototype.createElements=function(e,t,n,i,o){$e(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},Tt.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},Tt.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},Tt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Tt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Tt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Tt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Tt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Tt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Tt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Tt.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)},Tt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Tt.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)},Tt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},Tt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},Tt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Tt.prototype._create=function(e,t){return UA(t)?t:this._elementFactory.create(e,t)},Tt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Hs(e){this._elementRegistry=e}Hs.$inject=["elementRegistry"],Hs.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||LO(n,wc(i));return Zx(n,i),e.oldProperties=r,e.changed=o,o},Hs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Zx(n,t),i},Hs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?IO(e,t):[]};function LO(e,t){return Qn(t,function(n,i){return n[i]=e.get(i),n},{})}function Zx(e,t){z(t,function(n,i){e.set(i,n)})}function IO(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&de(n).dataObjectRef===e})}var zs="default",_o="id",Qx="di",BO={width:0,height:0};function Gs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Gs.$inject=["elementRegistry","moddle","modeling","textRenderer"],Gs.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=HO(e.properties),s=e.oldProperties||NO(t,a);return Jx(a,r)&&(o.unclaim(r[_o]),i.updateId(t,a[_o]),o.claim(a[_o],r)),zs in a&&(a[zs]&&n.push(i.get(a[zs].id)),r[zs]&&n.push(i.get(r[zs].id))),e_(t,a),e.oldProperties=s,e.changed=n,n},Gs.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&de(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,BO)}},Gs.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),Jx(n,o)&&(a.unclaim(n[_o]),r.updateId(t,i[_o]),a.claim(i[_o],o)),e.changed};function Jx(e,t){return _o in e&&e[_o]!==t[_o]}function NO(e,t){var n=wc(t),i=e.businessObject,o=dt(e);return Qn(n,function(r,a){return a!==Qx?r[a]=i.get(a):r[a]=$O(o,wc(t.di)),r},{})}function $O(e,t){return Qn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function e_(e,t){var n=e.businessObject,i=dt(e);z(t,function(o,r){r!==Qx?n.set(r,o):i&&FO(i,o)})}function FO(e,t){z(t,function(n,i){e.set(i,n)})}var jO=["default"];function HO(e){var t=V({},e);return jO.forEach(function(n){n in e&&(t[n]=de(t[n]))}),t}function ru(e,t){this._canvas=e,this._modeling=t}ru.$inject=["canvas","modeling"],ru.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=dt(o);return t.setRootElement(n),t.removeRootElement(o),nn(a.rootElements,i),i.$parent=a,Zt(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},ru.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=dt(n);return t.setRootElement(o),t.removeRootElement(n),Zt(a.rootElements,i),i.$parent=null,nn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function th(e,t){this._modeling=e,this._spaceTool=t}th.$inject=["modeling","spaceTool"],th.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ei(i),a=r===i,s=a?i:i.parent,c=Wo(s),l=xn(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+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Er(r,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:it(v.children,function(E){return E!==i})});var f,d,g,h,m;o==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(p,m,f,g),b=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,b,h,g);var y=l?{x:i.x+(a?wi:0),y:d-(o==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},y,s)};function nh(e){this._modeling=e}nh.$inject=["modeling"],nh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=Wo(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function Vs(e,t){this._modeling=e,this._spaceTool=t}Vs.$inject=["modeling","spaceTool"],Vs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Vs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=IT(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},Vs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Be(e),o=Be(t),r=Ov(o,i),a=Ei(e),s=[],c=[];Er(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(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",f=r.top>0||r.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.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",f=r.left>0||r.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Ws="flowNodeRef",ih="lanes";function au(){}au.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=Be(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ei(u);return o[p.id]||(o[p.id]=El(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ei(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(ih),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Ws).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},au.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){Zt(o,r),Zt(r.get(Ws),i)}),n.add.forEach(function(r){nn(o,r),nn(r.get(Ws),i)})}),[]},au.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){Zt(o,r),Zt(r.get(Ws),i)}),n.remove.forEach(function(r){nn(o,r),nn(r.get(Ws),i)})}),[]};var oh="categoryValueRef";function Us(e,t){this._bpmnFactory=e,this._elementRegistry=t}Us.$inject=["bpmnFactory","elementRegistry"],Us.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(b,y,v){if(y){var E=a.get(b);E||(E={},a.set(b,E)),!(v&&E.present)&&(!v&&E.past||(v?E.present={categoryValue:y,root:rh(b)}:E.past={categoryValue:y}))}}function c(b){o.set(b,de(b))}function l(){n.filter(function(b){return M(b,"bpmn:FlowElement")&&!Je(b)&&b.parent}).forEach(c)}function u(b){var y=de(b),v=y.get("categoryValueRef");return v||(v=Mv(i,y),r.push(zO(b,v))),v}function p(b){return b.reduce(function(y,v){var E=rh(v),w=y.get(E);return w||(w=[],y.set(E,w)),w.push(v),y},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(b){return M(b,"bpmn:Group")&&!Je(b)&&b.parent}).forEach(function(b){var y=de(b).get("categoryValueRef");if(!y){var v=rh(b),E=f.get(v)||[],w=fa(E,b),P=Object.keys(w).length>0;P&&(y=u(b))}s(b,y,!0)}),t.forEach(function(b){s(b.groupShape,b.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(b,y){return y.present&&b.add(y.present.categoryValue),y.past&&b.add(y.past.categoryValue),b},new Set),h=new Map,m=p(d);a.forEach(function(b,y){var v=b.present;if(v){var E=m.get(v.root)||[],w=fa(E,y);E.forEach(function(P){if(w[P.id]){var T=h.get(P);T||(T=new Set,h.set(P,T)),T.add(v.categoryValue)}})}});var _=d.reduce(function(b,y){var v=o.get(y),E=v.get(oh),w=new Set(E),P=h.get(y)||new Set,T=Array.from(P).filter(function($){return!w.has($)}),D=E.filter(function($){return g.has($)&&!P.has($)});return(T.length||D.length)&&b.push({businessObject:v,categoryValuesToAdd:T,categoryValuesToRemove:D}),b},[]);return{flowElements:_,groups:r}},Us.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),GO(t.groups),WO(t.flowElements),[]},Us.prototype.revert=function(e){var t=e.updates;return UO(t.flowElements),VO(t.groups),[]};function zO(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function GO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function VO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=null})}function WO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(oh);t.categoryValuesToRemove.forEach(function(o){Zt(i,o)}),t.categoryValuesToAdd.forEach(function(o){nn(i,o,!0)})})}function UO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(oh);t.categoryValuesToAdd.forEach(function(o){Zt(i,o)}),t.categoryValuesToRemove.forEach(function(o){nn(i,o,!0)})})}function rh(e){for(;e.parent;)e=e.parent;return e}function su(e){this._moddle=e}su.$inject=["moddle"],su.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),[]},su.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 qO={fill:void 0,stroke:void 0};function ah(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Xn(t)){var n=YO(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}ah.$inject=["commandStack"],ah.prototype.postExecute=function(e){var t=e.elements,n=e.colors||qO,i=this,o={};"fill"in n&&V(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=Pt(r)?Li(o,["border-color"]):o,s=dt(r);if(KO(a),Je(r)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function YO(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 KO(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var XO={width:0,height:0};function t_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return SP(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!Je(l)&&Go(l)&&!ul(l)&&!n_(p)){var f=7,d=Tf(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=yi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Je(u)&&!M(u,"bpmn:TextAnnotation"))){if(Je(u)&&n_(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=yi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,XO)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}t_.$inject=["modeling","textRenderer","bpmnFactory"];function n_(e){return!e||!e.trim()}function Ln(e,t,n,i){Tt.call(this,e,t,n),this._bpmnRules=i}Ce(Ln,Tt),Ln.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ln.prototype.getHandlers=function(){var e=Tt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Hs,e["element.updateProperties"]=Gs,e["canvas.updateRoot"]=ru,e["lane.add"]=th,e["lane.resize"]=Vs,e["lane.split"]=nh,e["lane.updateRefs"]=au,e["group.updateRefs"]=Us,e["id.updateClaim"]=su,e["element.setColor"]=ah,e["element.updateLabel"]=t_,e},Ln.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Ln.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)},Ln.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ln.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ln.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ln.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ln.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ln.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ln.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Ln.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ln.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ln.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function i_(){}i_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||je(t.source||e.source),t.connectionEnd||je(t.target||e.target)]};var cu=20,ZO=5,lu=Math.round,o_=20,QO={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function JO(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function eD(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function r_(e,t,n){var i=kn(t,e,ZO),o=n.split(":")[0],r=lu((t.x-e.x)/2+e.x),a=lu((t.y-e.y)/2+e.y),s,c,l=eD(o,i),u=/h|r|l/.test(o),p=!1,f=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=JO(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+cu*(/l/.test(o)?-1:1),y:f?a+cu:a}):(f=r===e.x,s={x:f?r+cu:r,y:e.y+cu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:sh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function tD(e,t,n){return r_(e,t,n)}function nD(e,t,n){var i=r_(t,e,a_(n));return{waypoints:i.waypoints.slice().reverse(),directions:a_(i.directions),turnNextDirections:i.turnNextDirections}}function iD(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=sh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function a_(e){return e.split(":").reverse().join(":")}function oD(e,t,n){var i=lu((t.x-e.x)/2+e.x),o=lu((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 sh(e,t,n){if(n=n||"h:h",!dD(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(c_(n)){var i=tD(e,t,n),o=nD(e,t,n),r=iD(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return oD(e,t,n)}function rD(e,t,n){var i=sh(e,t,n);return i.unshift(e),i.push(t),u_(i)}function aD(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=N1(r,"straight")[0]||"h:h",s=QO[a]||0,c=kn(e,t,s),l=fD(c,a);n=n||je(e),i=i||je(t);var u=l.split(":"),p=l_(n,e,u[0],hD(c)),f=l_(i,t,u[1],c);return rD(p,f,l)}function sD(e,t,n,i,o,r){$e(n)&&(o=n,r=i,n=je(e),i=je(t)),r=V({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&lD(e,t,n,i,r),c||(c=r.connectionEnd&&pD(t,e,i,o),c)||(c=r.connectionStart&&uD(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:aD(e,t,n,i,r)}function cD(e,t,n){return e>=t&&e<=n}function s_(e,t,n){var i={x:"width",y:"height"};return cD(t[e],n[e],n[e]+n[i[e]])}function lD(e,t,n,i,o){var r={},a,s;return s=kn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?s_(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:s_(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 uD(e,t,n,i){return ch(e,t,n,i)}function pD(e,t,n,i){var o=i.slice().reverse();return o=ch(e,t,n,o),o?o.reverse():null}function ch(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ot(u,function(p,f){var d=u[f-1];return d&&ms(p,d)<3})}function r(u,p,f){var d=po(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(Dy(u[d],p,o_)||Dy(u[d],f,o_))return u.slice(d);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=ch(e,t,n,l)),c&&po(c)?null:c}function fD(e,t){if(c_(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 dD(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function c_(e){return e&&/t|r|b|l/.test(e)}function hD(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 l_(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 u_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return Rf(o,r,n,0)||t.push(n),t},[])}var gD=-10,mD=40,yD={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},vD={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},lh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},qs={top:"t",right:"r",bottom:"b",left:"l"};function uu(e){this._elementRegistry=e}Ce(uu,i_),uu.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=p_(o&&o[0],n)),a||(a=p_(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!f_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Ev(n,s)?yD:vD;return M(e,"bpmn:MessageFlow")?c=xD(n,i,u):(M(e,"bpmn:SequenceFlow")||f_(n,i))&&(n===i?c={preferredLayouts:CD(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:MD(n,i,a,u)}:Ys(n)||Ys(i)?c={preferredLayouts:u.subProcess,preserveDocking:wD(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=V(c,t),l=u_(sD(n,i,r,a,o,c))),l||[r,a]};function bD(e){var t=e.host;return kn(je(e),t,gD)}function xD(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:_D(e,t)}}function _D(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Ys(t)?"source":Ys(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function wD(e){return Ys(e)?"target":"source"}function p_(e,t){return e?e.original||e:je(t)}function f_(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ys(e){return M(e,"bpmn:SubProcess")&&ct(e)}function Or(e,t){return e===t}function ED(e,t){return t.indexOf(e)!==-1}function Ta(e){var t=/right|left/.exec(e);return t&&t[0]}function ka(e){var t=/top|bottom/.exec(e);return t&&t[0]}function d_(e,t){return lh[e]===t}function SD(e,t){var n=Ta(e),i=lh[n];return t.indexOf(i)!==-1}function RD(e,t){var n=ka(e),i=lh[n];return t.indexOf(i)!==-1}function h_(e){return e==="right"||e==="left"}function CD(e,t,n){var i=t.waypoints,o=i&&i.length&&kn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function MD(e,t,n,i){var o=je(e),r=je(t),a=bD(e),s,c,l=Or(e.host,t),u=ED(a,["top","right","bottom","left"]),p=kn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?AD(a,u,e,t,n,i):(s=PD(a,p,u,i.isHorizontal),c=TD(a,p,u,i.isHorizontal),[s+":"+c])}function AD(e,t,n,i,o,r){var a=t?e:r.isHorizontal?ka(e):Ta(e),s=qs[a],c;return t?h_(e)?c=g_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=g_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function g_(e,t,n,i){var o=mD;return!(uh(e,i,n,o)||uh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||uh(e,i,je(t),o))}function uh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function PD(e,t,n,i){if(n)return qs[e];var o=ka(e),r=Ta(e),a=ka(t),s=Ta(t);if(i){if(Or(o,a)||d_(r,s))return qs[o]}else if(Or(r,s)||d_(o,a))return qs[r];return qs[i?r:o]}function TD(e,t,n,i){if(n)return h_(e)?SD(e,t)||Or(e,t)?"h":"v":RD(e,t)||Or(e,t)?"v":"h";var o=ka(e),r=Ta(e),a=ka(t),s=Ta(t);return a&&!s?"v":s&&!a?"h":i?Or(o,a)?"h":"v":Or(r,s)?"v":"h"}uu.$inject=["elementRegistry"];function m_(e){return V({original:e.point.original||e.point},e.actual)}function er(e,t){this._elementRegistry=e,this._graphicsFactory=t}er.$inject=["elementRegistry","graphicsFactory"],er.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},er.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}},er.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return ys(i,o,n)},er.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},er.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},er.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const ph={__init__:["modeling","bpmnUpdater"],__depends__:[Kk,p2,d2,h2,Ax,gO,yO,EO,Ri,Yd,Lx],bpmnFactory:["type",Mi],bpmnUpdater:["type",ri],elementFactory:["type",Zo],modeling:["type",Ln],layouter:["type",uu],connectionDocking:["type",er]};var kD=10,y_=50,OD=250;function fh(e,t,n,i){for(var o;o=DD(e,n,t);)n=i(t,n,o);return n}function dh(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 DD(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=ID(e);return Ot(o,function(r){if(r===n)return!1;var a=kn(r,i,kD);return a==="intersect"})}function LD(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||y_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||OD,c=t.reference||"start";r||(r=$D);function l(g,h){return o==="n"?c==="start"?Be(g).top-Be(h).bottom:c==="center"?Be(g).top-je(h).y:Be(g).top-Be(h).top:o==="w"?c==="start"?Be(g).left-Be(h).right:c==="center"?Be(g).left-je(h).x:Be(g).left-Be(h).left:o==="s"?c==="start"?Be(h).top-Be(g).bottom:c==="center"?je(h).y-Be(g).bottom:Be(h).bottom-Be(g).bottom:c==="start"?Be(h).left-Be(g).right:c==="center"?je(h).x-Be(g).right:Be(h).right-Be(g).right}var u=e.incoming.filter(r).map(function(g){var h=a(g),m=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:m,weight:h}}),p=e.outgoing.filter(r).map(function(g){var h=a(g),m=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:m,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Qn(f,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function ID(e){var t=hh(e);return e.host&&(t=t.concat(hh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(hh(i))},[]))),t}function hh(e){return ND(e).concat(BD(e))}function BD(e){return e.incoming.map(function(t){return t.source})}function ND(e){return e.outgoing.map(function(t){return t.target})}function $D(){return!0}var FD=100;function v_(e,t,n){e.on("autoPlace",FD,function(i){var o=i.shape,r=i.source;return jD(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}}v_.$inject=["eventBus","modeling","canvas"];function jD(e,t,n){n||(n={});var i=n.defaultDistance||y_,o=je(e),r=Be(e);return{x:r.right+i+t.width/2,y:o.y}}function b_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}b_.$inject=["eventBus","selection"];const HD={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",v_],autoPlaceSelectionBehavior:["type",b_]};function x_(e,t,n){var i=Ev(e,n);if(M(t,"bpmn:TextAnnotation"))return GD(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return VD(e,t,i);if(M(t,"bpmn:FlowNode"))return zD(e,t,i)}function zD(e,t,n){var i=Be(e),o=je(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=LD(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=kn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+__(l,c,r)}:{x:o.x+__(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return fh(e,t,u,dh(f))}function __(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function GD(e,t,n){var i=Be(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};Pt(e)&&(o=je(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 fh(e,t,o,dh(a))}function VD(e,t,n){var i=Be(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 fh(e,t,o,dh(a))}function w_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return x_(o,i,t)})}w_.$inject=["eventBus","elementRegistry"];const pu={__depends__:[HD],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",w_]},E_=[_v,Es,ph,pu,Cp];function WD(e={}){Xg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ga({container:t,moddleExtensions:e.moddleExtensions??Tc,additionalModules:[...E_,...e.additionalModules??[]]})}const S_={"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":"풀"},UD={이:["이","가"],을:["을","를"],와:["과","와"]};function qD(e,t){const[n,i]=UD[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 YD={"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":"연관선"},KD="요소";function gh(e){return(e&&YD[e.type])??KD}const R_=20;function XD(e){const t=e.replace(/\s+/g," ").trim();return t.length>R_?`${t.slice(0,R_)}…`:t}function fu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:XD(o.name),a=r===void 0?i+gh(o):r,s=r===void 0?a:`「${r}」`;return n?s+qD(a,n).slice(a.length):s}function ZD(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&&gh(r)===gh(a);return[fu(e,t,i),fu(e,n,o,s?"다른 ":"")]}function QD(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 JD(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 du={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function eL(e,t){const n=(o,r)=>fu(t,o,r),i=(o,r,a,s)=>ZD(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)}의 ${du[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)}의 ${du[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${du[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${du[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 tL(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${fu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const C_="기타",mh={error:0,warning:1,info:2};function M_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${lt(i)}`,source:"geometry",code:i.kind,severity:QD(i),targetRefs:JD(i),category:S_[i.kind]??C_,message:eL(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:S_[i.ruleId]??C_,message:tL(i,t)});return n}function A_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Oa(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function yh(e,t){if(t===void 0||e.length===0)return!1;const n=Oa(e[0],t);return e.some(i=>Oa(i,t)!==n)}function P_(e,t){const n=yh(e,t);return e.slice().sort((i,o)=>(n?Number(Oa(o,t))-Number(Oa(i,t)):0)||mh[i.severity]-mh[o.severity])}const T_="i18n-untranslated",k_="i18n-review-requested",vh="i18nDisplay.redrawn",O_=[["untranslated",T_],["reviewRequested",k_]];class bh{constructor(t,n,i,o,r,a,s,c){pi(this,"config");pi(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=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>u(f));const p=r.update.bind(r);r.update=(f,d,g,h)=>{const m=this.resolve(f);if(!m||m.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(Sc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(Sc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,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=gr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Jr(n).filter(f=>Nn(f)),s=f=>f.body??"",c=a.find(f=>Nn(f)===o&&s(f)),l=To(n).some(f=>f.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===r).map(Nn);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 f;if(!this.config)return n();const o=this.resolve(t),r=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(r)for(const[d,g]of O_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=gr((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 d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height: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 O_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(vh)}}pi(bh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const D_={__depends__:[Cp],__init__:["i18nDisplay"],i18nDisplay:["type",bh]};var nL=new Pr("ov"),iL=500;function Sn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=nL,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=oL(n.getContainer()),this._init()}Sn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Sn.prototype.get=function(e){if(Xn(e)&&(e={id:e}),Xn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?it(t.overlays,Zr({type:e.type})):t.overlays.slice():[]}else return e.type?it(this._overlays,Zr({type:e.type})):e.id?this._overlays[e.id]:null},Sn.prototype.add=function(e,t,n){if(dn(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=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Sn.prototype.remove=function(e){var t=this.get(e)||[];$e(t)||(t=[t]);var n=this;z(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(qi(i.html),qi(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)}})},Sn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Sn.prototype.show=function(){hu(this._overlayRoot)},Sn.prototype.hide=function(){hu(this._overlayRoot,!1)},Sn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Zc(this._overlayRoot)},Sn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=an(t);i=r.x,o=r.y}L_(n,i,o),En(e.html,"data-container-id",t.id)},Sn.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=an(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=an(i).height:s=i.height,r=t.bottom*-1+s}L_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._createOverlayContainer=function(e){var t=Nt('<div class="djs-overlays" />');zn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Sn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";I_(this._overlayRoot,n)},Sn.prototype._getOverlayContainer=function(e,t){var n=Ot(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Sn.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)),Xn(i)&&(i=Nt(i)),r=this._getOverlayContainer(n),o=Nt('<div class="djs-overlay" data-overlay-id="'+t+'">'),zn(o,{position:"absolute"}),o.appendChild(i),e.type&&Rt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();hu(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())},Sn.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&&(fn(o)&&o>t.scale||fn(r)&&r<t.scale))&&(c=!1),hu(a,c),this._updateOverlayScale(e,t)},Sn.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),fn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),fn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),fn(a)&&(s="scale("+a+","+a+")"),I_(r,s)},Sn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Sn.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});z(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){qi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",iL,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(z(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&&Rt(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 oL(e){var t=Nt('<div class="djs-overlay-container" />');return zn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function L_(e,t,n){zn(e,{left:t+"px",top:n+"px"})}function hu(e,t){e.style.display=t===!1?"none":""}function I_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const gu={__init__:["overlays"],overlays:["type",Sn]};function xh(e,t){t.invoke(pe,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ce(xh,pe),xh.$inject=["canvas","injector"];const rL={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",xh]};function Dr(e){return CSS.escape(e)}var aL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function B_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return aL[t]})}var sL="bjs-breadcrumbs-shown";function N_(e,t,n){var i=Nt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Rt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=de(l),p=Ot(a,function(f){return f===u});p&&s()});function s(c){c&&(a=cL(c));var l=a.flatMap(function(p){var f=n.findRoot(Qi(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(m){var _=de(m);return _&&_.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=B_(p.name||p.id),h=Nt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(sL,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}N_.$inject=["eventBus","elementRegistry","canvas"];function cL(e){for(var t=de(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function $_(e,t){var n=null,i=new lL;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,!(!M(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})}$_.$inject=["eventBus","canvas"];function lL(){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 F_={x:180,y:160};function Lr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Lr.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)})}},Lr.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;M(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),pL(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},Lr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=uL(e),i={x:n.x-F_.x,y:n.y-F_.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)})},Lr.prototype._moveToDiPlane=function(e,t){var n=j_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Lr.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},Lr.$inject=["eventBus","moddle"];function j_(e){return M(e,"bpmndi:BPMNDiagram")?e:j_(e.$parent)}function uL(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),ol(t)}function pL(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var mu=250,fL='<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>',dL="bjs-drilldown-empty";function tr(e,t,n,i,o){pe.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",mu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",mu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],mu,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"],mu,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)})})}Ce(tr,pe),tr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},tr.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(Qi(e))},tr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=de(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Rt(i.html).toggle(dL,!o)}},tr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=de(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Nt('<button type="button" class="bjs-drilldown">'+fL+"</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(Qi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},tr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},tr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const hL={__depends__:[gu,Yd,rL],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",N_],drilldownCentering:["type",$_],drilldownOverlayBehavior:["type",tr],subprocessCompatibility:["type",Lr]};function nr(e){Gt.call(this,e)}Ce(nr,Gt),nr.prototype._modules=[_v,hL,gu,Ri,Es],nr.prototype._moddleExtensions={};var yu="keyboard.keydown",gL="keyboard.keyup",mL=1e3,H_="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function Gn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(H_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Gn.$inject=["config.keyboard","eventBus"],Gn.prototype._keydownHandler=function(e){this._keyHandler(e,yu)},Gn.prototype._keyupHandler=function(e){this._keyHandler(e,gL)},Gn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||yu,i),n&&e.preventDefault()}},Gn.prototype._isEventIgnored=function(e){return!1},Gn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(H_)),this.unbind(),e=this._node=this._target,Le.bind(e,"keydown",this._keydownHandler),Le.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Gn.prototype.getBinding=function(){return this._node},Gn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Le.unbind(e,"keydown",this._keydownHandler),Le.unbind(e,"keyup",this._keyupHandler)),this._node=null},Gn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Gn.prototype.addListener=function(e,t,n){vn(e)&&(n=t,t=e,e=mL),this._eventBus.on(n||yu,e,t)},Gn.prototype.removeListener=function(e,t){this._eventBus.off(t||yu,e)},Gn.prototype.hasModifier=M2,Gn.prototype.isCmd=ii,Gn.prototype.isShift=Nd,Gn.prototype.isKey=gn;var yL=500;function Da(e,t){var n=this;e.on("editorActions.init",yL,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Da.$inject=["eventBus","keyboard"],Da.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(O2(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(D2(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(A2(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(P2(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(T2(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(k2(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(gn(["+","Add","="],o)&&ii(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(gn(["-","Subtract"],o)&&ii(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(gn("0",o)&&ii(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(gn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const _h={__init__:["keyboard","keyboardBindings"],keyboard:["type",Gn],keyboardBindings:["type",Da]};var vL={moveSpeed:50,moveSpeedAccelerated:200};function z_(e,t,n){var i=this;this._config=V({},vL,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})}}z_.$inject=["config.keyboardMove","keyboard","canvas"];const G_={__depends__:[_h],__init__:["keyboardMove"],keyboardMove:["type",z_]};var bL=15;function V_(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=Cr(s),p=Bi(u,c);if(!n.dragging&&xL(p)>bL&&(n.dragging=!0,l===0&&sx(e),zl("grab")),n.dragging){var f=n.last||n.start;p=Bi(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Le.unbind(document,"mousemove",o),Le.unbind(document,"mouseup",r),n=null,ax()}function a(s){if(!_r(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Cr(s)},Le.bind(document,"mousemove",o),Le.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}V_.$inject=["eventBus","canvas"];function xL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const W_={__init__:["moveCanvas"],moveCanvas:["type",V_]};function U_(e,t){var n=Lf(e.min),i=Lf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function _L(e,t){return Math.max(e.min,Math.min(e.max,t))}var wL=Math.sign||function(e){return e>=0?1:-1},wh={min:.2,max:4},q_=10,EL=.1,SL=.75;function to(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=qn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||SL;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}to.$inject=["config.zoomScroll","eventBus","canvas"],to.prototype.scroll=function(t){this._canvas.scroll(t)},to.prototype.reset=function(){this._canvas.zoom("fit-viewport")},to.prototype.zoom=function(t,n){var i=U_(wh,q_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>EL&&(this._zoom(t,n,i),this._totalDelta=0)},to.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||hb()&&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))*wL(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)}},to.prototype.stepZoom=function(t,n){var i=U_(wh,q_);this._zoom(t,n,i)},to.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Lf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(_L(wh,s),t)},to.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Le[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},to.prototype._init=function(e){this.toggle(e)};const Y_={__init__:["zoomScroll"],zoomScroll:["type",to]};function Ks(e){nr.call(this,e)}Ce(Ks,nr),Ks.prototype._navigationModules=[G_,W_,Y_],Ks.prototype._modules=[].concat(nr.prototype._modules,Ks.prototype._navigationModules);function Eh(e){return e&&e[e.length-1]}function K_(e){return e.y}function X_(e){return e.x}var RL={left:X_,center:X_,right:function(e){return e.x+e.width},top:K_,middle:K_,bottom:function(e){return e.y+e.height}};function La(e,t){this._modeling=e,this._rules=t}La.$inject=["modeling","rules"],La.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}},La.prototype._isType=function(e,t){return t.indexOf(e)!==-1},La.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(f,d){return Math.round((f[i]+d[i]+d[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Eh(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[o]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=Hi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=Eh(c).center,r;l=t[0],t=Hi(t,function(f){return f[i]+f[o]}),u=Eh(t),r[e]=p(l,u)}return r},La.prototype.trigger=function(e,t){var n=this._modeling,i,o=it(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),$e(i)&&(o=i),!(o.length<2||!i)){var r=RL[t],a=Hi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const CL={__init__:["alignElements"],alignElements:["type",La]},ML=new Pr;function Ia(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ia.$inject=["eventBus"],Ia.prototype.schedule=function(e,t=ML.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ia.prototype._schedule=function(e,t){const n=AL();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}},Ia.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ia.prototype._cancel=function(e){clearTimeout(e.executionId)};function AL(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const PL={scheduler:["type",Ia]};var TL="djs-element-hidden",vu=".entry",kL=1e3,Z_=8,OL=300;function cn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}cn.$inject=["canvas","elementRegistry","eventBus","scheduler"],cn.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=$e(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=$e(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},cn.prototype._createContainer=function(){var e=Nt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},cn.prototype.registerProvider=function(e,t){t||(t=e,e=kL),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},cn.prototype.getEntries=function(e){var t=this._getProviders(),n=$e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(o){if(vn(o[n])){var r=o[n](e);vn(r)?i=r(i):z(r,function(a,s){i[s]=a})}}),i},cn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=En(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},OL);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},cn.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(vn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},cn.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))}},cn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},cn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(o,r){var a=o.group||"default",s=Nt(o.html||'<div class="entry" draggable="true"></div>'),c;En(s,"data-action",r),c=wt("[data-group="+Dr(a)+"]",n),c||(c=Nt('<div class="group"></div>'),En(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&DL(s,o.className),o.title&&En(s,"title",o.title),o.imageUrl&&(i=Nt("<img>"),En(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Rt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},cn.prototype._createHtml=function(e){var t=this,n=Nt('<div class="djs-context-pad"></div>');return ei.bind(n,vu,"click",function(i){t.trigger("click",i)}),ei.bind(n,vu,"dragstart",function(i){t.trigger("dragstart",i)}),ei.bind(n,vu,"mouseover",function(i){t.trigger("mouseover",i)}),ei.bind(n,vu,"mouseout",function(i){t.trigger("mouseout",i)}),Le.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},cn.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()&&IL(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},cn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},cn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return $e(e)!==$e(n)?!1:$e(e)?e.length===n.length&&Ao(e,function(i){return n.includes(i)}):n===e},cn.prototype.isShown=function(){return this.isOpen()&&Rt(this._current.html).has("open")},cn.prototype.show=function(){this.isOpen()&&(Rt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},cn.prototype.hide=function(){this.isOpen()&&(Rt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},cn.prototype._getPosition=function(e){if(!$e(e)&&Pt(e)){var t=this._canvas.viewbox(),n=LL(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+Z_*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Z_*this._canvas.zoom(),top:s.top-a.top}},cn.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")},cn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=$e(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,TL)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},cn.prototype._getTargetBounds=function(e){var t=this,n=$e(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 DL(e,t){var n=Rt(e);t=$e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function LL(e){return e.waypoints[e.waypoints.length-1]}function IL(e,t){return e=$e(e)?e:[e],t=$e(t)?t:[t],e.length===t.length&&Ao(e,function(n){return t.includes(n)})}const Q_={__depends__:[Hl,PL,gu],contextPad:["type",cn]};var bu,Wt,J_,ir,ew,tw,nw,Sh,xu,Xs,iw,Rh,Ch,Mh,_u={},wu=[],BL=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Eu=Array.isArray;function wo(e,t){for(var n in t)e[n]=t[n];return e}function Ah(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ow(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?bu.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 Su(e,a,i,o,null)}function Su(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??++J_,__i:-1,__u:0};return o==null&&Wt.vnode!=null&&Wt.vnode(r),r}function Ru(e){return e.children}function Cu(e,t){this.props=e,this.context=t}function Ir(e,t){if(t==null)return e.__?Ir(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"?Ir(e):null}function NL(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=wo({},t);r.__v=t.__v+1,Wt.vnode&&Wt.vnode(r),Ph(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Ir(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,fw(i,r,o),t.__e=t.__=null,r.__e!=n&&rw(r)}}function rw(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}),rw(e)}function aw(e){(!e.__d&&(e.__d=!0)&&ir.push(e)&&!Mu.__r++||ew!=Wt.debounceRendering)&&((ew=Wt.debounceRendering)||tw)(Mu)}function Mu(){try{for(var e,t=1;ir.length;)ir.length>t&&ir.sort(nw),e=ir.shift(),t=ir.length,NL(e)}finally{ir.length=Mu.__r=0}}function sw(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,_=i&&i.__k||wu,b=t.length;for(c=$L(n,t,_,c,b),p=0;p<b;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&_[d.__i]||_u,d.__i=p,m=Ph(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Th(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=cw(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function $L(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,f=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]=Su(null,a,null,null,null):Eu(a)?a=e.__k[r]=Su(Ru,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Su(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=FL(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?f--:o<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Ir(s)),hw(s,s));return i}function cw(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=cw(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Ir(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function FL(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 lw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||BL.test(t)?n:n+"px"}function Au(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||lw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||lw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(iw,"$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[Xs]=i[Xs]:(n[Xs]=Rh,e.addEventListener(t,r?Mh:Ch,r)):e.removeEventListener(t,r?Mh:Ch,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 uw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[xu]==null)t[xu]=Rh++;else if(t[xu]<n[Xs])return;return n(Wt.event?Wt.event(t):t)}}}function Ph(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,_,b,y,v,E,w,P,T,D,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Wt.__b)&&u(t);e:if(typeof $=="function"){p=a.length;try{if(b=t.props,y=$.prototype&&$.prototype.render,v=(u=$.contextType)&&i[u.__c],E=u?v?v.props.value:u.__:i,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new $(b,E):(t.__c=f=new Cu(b,E),f.constructor=$,f.render=HL),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&$.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=wo({},f.__s)),wo(f.__s,$.getDerivedStateFromProps(b,f.__s))),g=f.props,h=f.state,f.__v=t,d)y&&$.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&$.getDerivedStateFromProps==null&&b!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,E)===!1){t.__v!=n.__v&&(f.props=b,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),wu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Ir(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,E),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=b,f.__P=e,f.__e=!1,w=Wt.__r,P=0,y)f.state=f.__s,f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),wu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=wo(wo({},i),f.getChildContext())),y&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),T=u!=null&&u.type===Ru&&u.key==null?dw(u.props.children):u,s=sw(e,Eu(T)?T:[T],t,n,i,o,r,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),_&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,c||r!=null){if(N.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(D=r.length;D--;)Ah(r[D])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||pw(t),Wt.__e(N,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=jL(n.__e,t,n,i,o,r,a,c,l);return(u=Wt.diffed)&&u(t),128&t.__u?void 0:s}function pw(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(pw))}function fw(e,t,n){for(var i=0;i<n.length;i++)Th(n[i],n[++i],n[++i]);Wt.__c&&Wt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Wt.__e(r,o.__v)}})}function dw(e){return typeof e!="object"||e==null||e.__b>0?e:Eu(e)?e.map(dw):e.constructor!==void 0?null:wo({},e)}function jL(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||_u,_=t.props,b=t.type;if(b=="svg"?o="http://www.w3.org/2000/svg":b=="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((d=r[l])&&"setAttribute"in d==!!b&&(b?d.localName==b:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(b==null)return document.createTextNode(_);e=document.createElementNS(o,b,_.is&&_),s&&(Wt.__m&&Wt.__m(t,r),s=!1),r=null}if(b==null)m===_||s&&e.data==_||(e.data=_);else{if(r=b=="textarea"&&_.defaultValue!=null?null:r&&bu.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(d=e.attributes[l]).name]=d.value;for(l in m)d=m[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||Au(e,l,null,d,o);for(l in _)d=_[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||Au(e,l,d,m[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=""),sw(t.type=="template"?e.content:e,Eu(f)?f:[f],t,n,i,b=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Ir(n,0),s,c),r!=null)for(l=r.length;l--;)Ah(r[l]);s&&b!="textarea"||(l="value",b=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||b=="progress"&&!g||b=="option"&&g!=m[l])&&Au(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&Au(e,l,h,m[l],o))}return e}function Th(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){Wt.__e(o,n)}}function hw(e,t,n){var i,o;if(Wt.unmount&&Wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Th(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Wt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&hw(i[o],t,n||typeof e.type!="function");n||Ah(e.__e),e.__c=e.__=e.__e=void 0}function HL(e,t,n){return this.constructor(e,n)}function gw(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Wt.__&&Wt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Ph(t,e=t.__k=ow(Ru,null,[e]),o||_u,_u,t.namespaceURI,o?null:t.firstChild?bu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),fw(r,e,a),e.props.children=null}bu=wu.slice,Wt={__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}},J_=0,Cu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=wo({},this.state),typeof e=="function"&&(e=e(wo({},n),this.props)),e&&wo(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),aw(this))},Cu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),aw(this))},Cu.prototype.render=Ru,ir=[],tw=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,nw=function(e,t){return e.__v.__b-t.__v.__b},Mu.__r=0,Sh=Math.random().toString(8),xu="__d"+Sh,Xs="__a"+Sh,iw=/(PointerCapture)$|Capture$/i,Rh=0,Ch=uw(!1),Mh=uw(!0);var mw=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,mw(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},yw=new Map;function zL(e){var t=yw.get(this);return t||(t=new Map,yw.set(this,t)),(t=mw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(f){r===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):r===3&&(f||a)?(c.push(3,f,a),r=2):r===2&&a==="..."&&f?c.push(4,f,0):r===2&&a&&!f?c.push(5,0,!0,a):r>=5&&((a||!f&&r===5)&&(c.push(r,0,a,o),r=6),f&&(c.push(r,f,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 kt=zL.bind(ow),Ba,ln,kh,vw,Zs=0,bw=[],mn=Wt,xw=mn.__b,_w=mn.__r,ww=mn.diffed,Ew=mn.__c,Sw=mn.unmount,Rw=mn.__;function Pu(e,t){mn.__h&&mn.__h(ln,e,Zs||t),Zs=0;var n=ln.__H||(ln.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Oh(e){return Zs=1,GL(Mw,e)}function GL(e,t,n){var i=Pu(Ba++,2);if(i.t=e,!i.__c&&(i.__=[Mw(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=ln,!ln.__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(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),r){var f=r.call(this,s,c,l);return u?f||p:f}return!u||p};ln.__f=!0;var r=ln.shouldComponentUpdate,a=ln.componentWillUpdate;ln.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)},ln.shouldComponentUpdate=o}return i.__N||i.__}function Tu(e,t){var n=Pu(Ba++,3);!mn.__s&&Ih(n.__H,t)&&(n.__=e,n.u=t,ln.__H.__h.push(n))}function Dh(e,t){var n=Pu(Ba++,4);!mn.__s&&Ih(n.__H,t)&&(n.__=e,n.u=t,ln.__h.push(n))}function ku(e){return Zs=5,Eo(function(){return{current:e}},[])}function Eo(e,t){var n=Pu(Ba++,7);return Ih(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Qs(e,t){return Zs=8,Eo(function(){return e},t)}function VL(){for(var e;e=bw.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ou),t.__h.some(Lh),t.__h=[]}catch(n){t.__h=[],mn.__e(n,e.__v)}}}mn.__b=function(e){ln=null,xw&&xw(e)},mn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Rw&&Rw(e,t)},mn.__r=function(e){_w&&_w(e),Ba=0;var t=(ln=e.__c).__H;t&&(kh===ln?(t.__h=[],ln.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Ou),t.__h.some(Lh),t.__h=[],Ba=0)),kh=ln},mn.diffed=function(e){ww&&ww(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(bw.push(t)!==1&&vw===mn.requestAnimationFrame||((vw=mn.requestAnimationFrame)||WL)(VL)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),kh=ln=null},mn.__c=function(e,t){t.some(function(n){try{n.__h.some(Ou),n.__h=n.__h.filter(function(i){return!i.__||Lh(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],mn.__e(i,n.__v)}}),Ew&&Ew(e,t)},mn.unmount=function(e){Sw&&Sw(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Ou(i)}catch(o){t=o}}),n.__H=void 0,t&&mn.__e(t,n.__v))};var Cw=typeof requestAnimationFrame=="function";function WL(e){var t,n=function(){clearTimeout(i),Cw&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Cw&&(t=requestAnimationFrame(n))}function Ou(e){var t=ln,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ln=t}function Lh(e){var t=ln;e.__c=e.__(),ln=t}function Ih(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Mw(e,t){return typeof t=="function"?t(e):t}function UL(e){const{navigationStack:t,setNavigationStack:n}=e,i=Eo(()=>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 kt`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+u+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},zt.prototype._setDefinitions=function(e){this._definitions=e},zt.prototype.getModules=function(){return this._modules},zt.prototype.clear=function(){this.getDefinitions()&&Vo.prototype.clear.call(this)},zt.prototype.destroy=function(){Vo.prototype.destroy.call(this),Yi(this._container)},zt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},zt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},zt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Et(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},zt.prototype.getDefinitions=function(){return this._definitions},zt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},zt.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=V(Gi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});Vo.call(this,s),n&&n.container&&this.attachTo(n.container)},zt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},zt.prototype._createContainer=function(e){const t=Nt('<div class="bjs-container"></div>');return Gn(t,{width:gv(e.width),height:gv(e.height),position:e.position}),t},zt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new Xg(t)},zt.prototype._modules=[];function fl(e,t){return e.warnings=t,e}function gP(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 mP={width:"100%",height:"100%",position:"relative"};function gv(e){return e+(Fe(e)?"px":"")}function yP(e,t){return t&&Ot(e.diagrams,function(n){return n.id===t})||null}function vP(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+pv+"</a>",i=Nt(n);Gn(Et("svg",i),fv),Gn(i,dv,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ie.bind(i,"click",function(o){hP(),o.preventDefault()})}function ya(e){zt.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)}Ce(ya,zt),ya.prototype._createModdle=function(e){var t=zt.prototype._createModdle.call(this,e);return t.ids=new qi([32,36,1]),t},ya.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 ct(e,t){return M(e,"bpmn:CallActivity")?!1:M(e,"bpmn:SubProcess")?(t=t||dt(e),t&&M(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):M(e,"bpmn:Participant")?!!de(e).processRef:!0}function xn(e){if(!(!M(e,"bpmn:Participant")&&!M(e,"bpmn:Lane"))){var t=dt(e).isHorizontal;return t===void 0?!0:t}}function bP(e){return e&&de(e).isInterrupting!==!1}function jn(e){return e&&!!de(e).triggeredByEvent}function va(e,t){var n=de(e).eventDefinitions;return ko(n,function(i){return M(i,t)})}function xP(e){return va(e,"bpmn:ErrorEventDefinition")}function _P(e){return va(e,"bpmn:EscalationEventDefinition")}function wP(e){return va(e,"bpmn:CompensateEventDefinition")}var Cr={width:90,height:20},mv=15;function Wo(e){return M(e,"bpmn:Event")||M(e,"bpmn:Gateway")||M(e,"bpmn:DataStoreReference")||M(e,"bpmn:DataObjectReference")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:Group")}function dl(e){return et(e.label)}function EP(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=SP(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-=mv:a+=mv,{x:a,y:s}}function SP(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 Df(e){return e.waypoints?EP(e.waypoints):M(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Cr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Cr.height/2}}function RP(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Cr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=Df(t),i=Cr),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function yv(e){if(M(e,"bpmn:FlowElement")||M(e,"bpmn:Participant")||M(e,"bpmn:Lane")||M(e,"bpmn:SequenceFlow")||M(e,"bpmn:MessageFlow")||M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))return"name";if(M(e,"bpmn:TextAnnotation"))return"text";if(M(e,"bpmn:Group"))return"categoryValueRef"}function CP(e){var t=e.categoryValueRef;return t&&t.value||""}function yi(e){var t=e.businessObject,n=yv(t);if(n)return n==="categoryValueRef"?CP(t):t[n]||""}function MP(e,t){var n=e.businessObject,i=yv(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function AP(e){return et(e)&&Wo(e.labelTarget)}var ba=7;function vv(e){let t=[];return z(e.incoming,n=>{M(n,"bpmn:Association")&&M(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(e.outgoing,n=>{M(n,"bpmn:Association")&&M(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Es(e){const t=new Map;return z(Cf(e),n=>{z(vv(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%)",PP="white";function Qi(e,t){return ko(e.eventDefinitions,function(n){return n.$type===t})}function TP(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function kP(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function rt(e,t,n){var i=dt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||PP}function Ee(e,t,n){var i=dt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Lf}function Ss(e,t,n,i){var o=dt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Ee(e,n)}function bv(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 Sr(o)}function If(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 Sr(a)}function OP(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 Sr(s)}function DP(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 Sr(r)}function Rs(e,t={}){return{width:_i(e,t),height:ii(e,t)}}function _i(e,t={}){return Qn(t,"width")?t.width:e.width}function ii(e,t={}){return Qn(t,"height")?t.height:e.height}var LP=new qi,IP=10,hl=3,BP=1.5,gl=10,NP=4,xa=.95,$P=1,FP=.25;function Mr(e,t,n,i,o,r,a){fo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(B){return n.computeStyle(B,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Lf,strokeWidth:2,fill:"white"})}function p(B){return n.computeStyle(B,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Lf,strokeWidth:2})}function f(B,C){var{ref:S={x:0,y:0},scale:G=1,element:q,parentGfx:ie=o._svg}=C,Me=Oe("marker",{id:B,viewBox:"0 0 20 20",refX:S.x,refY:S.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});ze(Me,q);var Xe=Et(":scope > defs",ie);Xe||(Xe=Oe("defs"),ze(ie,Xe)),ze(Xe,Me)}function d(B,C,S,G){var q=LP.nextPrefixed("marker-");return g(B,q,C,S,G),"url(#"+q+")"}function g(B,C,S,G,q){if(S==="sequenceflow-end"){var ie=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:q,stroke:q,strokeWidth:1})});f(C,{element:ie,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(S==="messageflow-start"){var Me=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Me,ref:{x:6,y:6},parentGfx:B})}if(S==="messageflow-end"){var Xe=Oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:q,strokeWidth:1,strokeDasharray:[1e4,1]})});f(C,{element:Xe,ref:{x:8.5,y:5},parentGfx:B})}if(S==="association-start"){var mt=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:mt,ref:{x:1,y:10},scale:.5,parentGfx:B})}if(S==="association-end"){var Ut=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:q,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(C,{element:Ut,ref:{x:11,y:10},scale:.5,parentGfx:B})}if(S==="conditional-flow-marker"){var Mt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:q})});f(C,{element:Mt,ref:{x:-1,y:10},scale:.5,parentGfx:B})}if(S==="conditional-default-flow-marker"){var mn=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:q,fill:"none"})});f(C,{element:mn,ref:{x:0,y:10},scale:.5,parentGfx:B})}}function h(B,C,S,G,q={}){fn(G)&&(q=G,G=0),G=G||0,q=u(q);var ie=C/2,Me=S/2,Xe=Oe("circle",{cx:ie,cy:Me,r:Math.round((C+S)/4-G),...q});return ze(B,Xe),Xe}function m(B,C,S,G,q,ie){fn(q)&&(ie=q,q=0),q=q||0,ie=u(ie);var Me=Oe("rect",{x:q,y:q,width:C-q*2,height:S-q*2,rx:G,ry:G,...ie});return ze(B,Me),Me}function _(B,C,S,G){var q=C/2,ie=S/2,Me=[{x:q,y:0},{x:C,y:ie},{x:q,y:S},{x:0,y:ie}],Xe=Me.map(function(Ut){return Ut.x+","+Ut.y}).join(" ");G=u(G);var mt=Oe("polygon",{...G,points:Xe});return ze(B,mt),mt}function b(B,C,S,G){S=p(S);var q=ms(C,S,G);return ze(B,q),q}function y(B,C,S){return b(B,C,S,5)}function v(B,C,S){S=p(S);var G=Oe("path",{...S,d:C});return ze(B,G),G}function E(B,C,S,G){return v(C,S,V({"data-marker":B},G))}function w(B){return Te[B]}function P(B){return function(C,S,G){return w(B)(C,S,G)}}var T={"bpmn:MessageEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.235,my:.315}}),ie=G?Ee(C,c,S.stroke):rt(C,s,S.fill),Me=G?rt(C,s,S.fill):Ee(C,c,S.stroke),Xe=v(B,q,{fill:ie,stroke:Me,strokeWidth:1});return Xe},"bpmn:TimerEventDefinition":function(B,C,S={}){var G=S.width||C.width,q=S.height||C.height,ie=S.width?1:2,Me=h(B,G,q,.2*q,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:ie}),Xe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}});v(B,Xe,{stroke:Ee(C,c,S.stroke),strokeWidth:ie});for(var mt=0;mt<12;mt++){var Ut=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:q,position:{mx:.5,my:.5}}),Mt=G/2,mn=q/2;v(B,Ut,{strokeWidth:1,stroke:Ee(C,c,S.stroke),transform:"rotate("+mt*30+","+mn+","+Mt+")"})}return Me},"bpmn:EscalationEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),ie=G?Ee(C,c,S.stroke):rt(C,s,S.fill);return v(B,q,{fill:ie,stroke:Ee(C,c,S.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(B,C,S={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.222}});return v(B,G,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),ie=G?Ee(C,c,S.stroke):rt(C,s,S.fill);return v(B,q,{fill:ie,stroke:Ee(C,c,S.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.2,my:.722}}),ie=G?Ee(C,c,S.stroke):rt(C,s,S.fill);return v(B,q,{fill:ie,stroke:Ee(C,c,S.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),ie=G?Ee(C,c,S.stroke):"none",Me=v(B,q,{fill:ie,stroke:Ee(C,c,S.stroke),strokeWidth:1});return lv(Me,45),Me},"bpmn:CompensateEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.22,my:.5}}),ie=G?Ee(C,c,S.stroke):rt(C,s,S.fill);return v(B,q,{fill:ie,stroke:Ee(C,c,S.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.5,my:.2}}),ie=G?Ee(C,c,S.stroke):rt(C,s,S.fill);return v(B,q,{strokeWidth:1,fill:ie,stroke:Ee(C,c,S.stroke)})},"bpmn:MultipleEventDefinition":function(B,C,S={},G){var q=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.211,my:.36}}),ie=G?Ee(C,c,S.stroke):rt(C,s,S.fill);return v(B,q,{fill:ie,stroke:Ee(C,c,S.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(B,C,S={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:S.width||C.width,containerHeight:S.height||C.height,position:{mx:.458,my:.194}});return v(B,G,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(B,C,S={}){var G=h(B,C.width,C.height,8,{fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke),strokeWidth:4});return G}};function L(B,C,S={},G){var q=de(B),ie=TP(q),Me=G||B;return q.get("eventDefinitions")&&q.get("eventDefinitions").length>1?q.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](C,Me,S,ie):T["bpmn:MultipleEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](C,Me,S,ie):Qi(q,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](C,Me,S,ie):null}var $={ParticipantMultiplicityMarker:function(B,C,S={}){var G=_i(C,S),q=ii(C,S),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2-6)/G,my:(q-15)/q}});E("participant-multiplicity",B,ie,{strokeWidth:2,fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke)})},SubProcessMarker:function(B,C,S={}){var G=m(B,14,14,0,{strokeWidth:1,fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke)});On(G,C.width/2-7.5,C.height-20);var q=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2-7.5)/C.width,my:(C.height-20)/C.height}});E("sub-process",B,q,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke)})},ParallelMarker:function(B,C,S){var G=_i(C,S),q=ii(C,S),ie=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+S.parallel)/G,my:(q-20)/q}});E("parallel",B,ie,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke)})},SequentialMarker:function(B,C,S){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",B,G,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke)})},CompensationMarker:function(B,C,S){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+S.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",B,G,{strokeWidth:1,fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke)})},LoopMarker:function(B,C,S){var G=_i(C,S),q=ii(C,S),ie=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+S.loop)/G,my:(q-7)/q}});E("loop",B,ie,{strokeWidth:1.5,fill:"none",stroke:Ee(C,c,S.stroke),strokeMiterlimit:.5})},AdhocMarker:function(B,C,S){var G=_i(C,S),q=ii(C,S),ie=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:(G/2+S.adhoc)/G,my:(q-15)/q}});E("adhoc",B,ie,{strokeWidth:1,fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke)})}};function N(B,C,S,G){$[B](C,S,G)}function H(B,C,S=[],G={}){G={fill:G.fill,stroke:G.stroke,width:_i(C,G),height:ii(C,G)};var q=de(C),ie=S.includes("SubProcessMarker");ie?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},q.get("isForCompensation")&&S.push("CompensationMarker"),M(q,"bpmn:AdHocSubProcess")&&(S.push("AdhocMarker"),ie||V(G,{compensation:G.compensation-18}));var Me=q.get("loopCharacteristics"),Xe=Me&&Me.get("isSequential");Me&&(V(G,{compensation:G.compensation-18}),S.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),Xe===void 0&&S.push("LoopMarker"),Xe===!1&&S.push("ParallelMarker"),Xe===!0&&S.push("SequentialMarker")),S.includes("CompensationMarker")&&S.length===1&&V(G,{compensation:-8}),z(S,function(mt){N(mt,B,C,G)})}function X(B,C,S={}){S=V({size:{width:100}},S);var G=r.createText(C||"",S);return st(G).add("djs-label"),ze(B,G),G}function Q(B,C,S,G={}){var q=de(C),ie=Rs({x:C.x,y:C.y,width:C.width,height:C.height},G);return X(B,q.name,{align:S,box:ie,padding:7,style:{fill:Ss(C,l,c,G.stroke)}})}function ee(B,C,S={}){var G={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return X(B,yi(C),{box:G,style:V({},r.getExternalStyle(),{fill:Ss(C,l,c,S.stroke)})})}function We(B,C,S,G={}){var q=xn(S),ie=X(B,C,{box:{height:30,width:q?ii(S,G):_i(S,G)},align:"center-middle",style:{fill:Ss(S,l,c,G.stroke)}});if(q){var Me=-1*ii(S,G);ul(ie,0,-Me,270)}}function qe(B,C,S={}){var{width:G,height:q}=Rs(C,S);return m(B,G,q,gl,{...S,fill:rt(C,s,S.fill),fillOpacity:xa,stroke:Ee(C,c,S.stroke)})}function Ge(B,C,S={}){var G=de(C),q=rt(C,s,S.fill),ie=Ee(C,c,S.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(S.markerEnd=d(B,"association-end",q,ie)),G.get("associationDirection")==="Both"&&(S.markerStart=d(B,"association-start",q,ie)),S=ht(S,["markerStart","markerEnd"]),y(B,C.waypoints,{...S,stroke:ie,strokeDasharray:"0, 5"})}function Se(B,C,S={}){var G=rt(C,s,S.fill),q=Ee(C,c,S.stroke),ie=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Me=v(B,ie,{fill:G,fillOpacity:xa,stroke:q}),Xe=de(C);if(kP(Xe)){var mt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.33,my:(C.height-18)/C.height}});v(B,mt,{strokeWidth:2,fill:G,stroke:q})}return Me}function Z(B,C,S={}){return h(B,C.width,C.height,{fillOpacity:xa,...S,fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke)})}function oe(B,C,S={}){return _(B,C.width,C.height,{fill:rt(C,s,S.fill),fillOpacity:xa,stroke:Ee(C,c,S.stroke)})}function W(B,C,S={}){var G=m(B,_i(C,S),ii(C,S),0,{fill:rt(C,s,S.fill),fillOpacity:S.fillOpacity||xa,stroke:Ee(C,c,S.stroke),strokeWidth:1.5}),q=de(C);if(M(q,"bpmn:Lane")){var ie=q.get("name");We(B,ie,C,S)}return G}function Y(B,C,S={}){var G=qe(B,C,S),q=ct(C);if(jn(C)&&(we(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!q)){var ie=de(C).flowElements||[],Me=ie.filter(Xe=>M(Xe,"bpmn:StartEvent"));Me.length===1&&ae(Me[0],B,S,C)}return Q(B,C,q?"center-top":"center-middle",S),q?H(B,C,void 0,S):H(B,C,["SubProcessMarker"],S),G}function ae(B,C,S,G){var q=22,ie={fill:rt(G,s,S.fill),stroke:Ee(G,c,S.stroke),width:q,height:q},Me=de(B).isInterrupting,Xe=Me?0:3,mt=Me?1:1.2,Ut=20,Mt=(q-Ut)/2,mn="translate("+Mt+","+Mt+")";h(C,Ut,Ut,{fill:ie.fill,stroke:ie.stroke,strokeWidth:mt,strokeDasharray:Xe,transform:mn}),L(B,C,ie,G)}function ge(B,C,S={}){var G=qe(B,C,S);return Q(B,C,"center-middle",S),H(B,C,void 0,S),G}var Te=this.handlers={"bpmn:AdHocSubProcess":function(B,C,S={}){return ct(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]),Y(B,C,S)},"bpmn:Association":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Ge(B,C,S)},"bpmn:BoundaryEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=de(C),ie=q.get("cancelActivity");S={strokeWidth:1.5,fill:rt(C,s,S.fill),fillOpacity:$P,stroke:Ee(C,c,S.stroke)},ie||(S.strokeDasharray="6");var Me=Z(B,C,S);return h(B,C.width,C.height,hl,{...S,fill:"none"}),G&&L(C,B,S),Me},"bpmn:BusinessRuleTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),ie=v(B,q);we(ie,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1});var Me=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Xe=v(B,Me);return we(Xe,{fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Y(B,C,{strokeWidth:5,...S})},"bpmn:ComplexGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S),q=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return v(B,q,{fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Se(B,C,S);return v(B,G,{fill:"none",stroke:Ee(C,c,S.stroke),strokeWidth:1}),q},"bpmn:DataInputAssociation":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Ge(B,C,{...S,markerEnd:d(B,"association-end",rt(C,s,S.fill),Ee(C,c,S.stroke))})},"bpmn:DataObject":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Se(B,C,S)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),q=Se(B,C,S);return v(B,G,{strokeWidth:1,fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke)}),q},"bpmn:DataOutputAssociation":function(B,C,S={}){return S=ht(S,["fill","stroke"]),Ge(B,C,{...S,markerEnd:d(B,"association-end",rt(C,s,S.fill),Ee(C,c,S.stroke))})},"bpmn:DataStoreReference":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return v(B,G,{fill:rt(C,s,S.fill),fillOpacity:xa,stroke:Ee(C,c,S.stroke),strokeWidth:2})},"bpmn:EndEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=Z(B,C,{...S,strokeWidth:4});return G&&L(C,B,S),q},"bpmn:EventBasedGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=de(C),q=oe(B,C,S);h(B,C.width,C.height,C.height*.2,{fill:rt(C,"none",S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1});var ie=G.get("eventGatewayType"),Me=!!G.get("instantiate");function Xe(){var Ut=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});v(B,Ut,{fill:"none",stroke:Ee(C,c,S.stroke),strokeWidth:2})}if(ie==="Parallel"){var mt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});v(B,mt,{fill:"none",stroke:Ee(C,c,S.stroke),strokeWidth:1})}else ie==="Exclusive"&&(Me||h(B,C.width,C.height,C.height*.26,{fill:"none",stroke:Ee(C,c,S.stroke),strokeWidth:1}),Xe());return q},"bpmn:ExclusiveGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S),q=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),ie=dt(C);return ie.get("isMarkerVisible")&&v(B,q,{fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(B,C,S={}){return S=ht(S,["fill","stroke"]),oe(B,C,S)},"bpmn:Group":function(B,C,S={}){return S=ht(S,["fill","stroke","width","height"]),m(B,C.width,C.height,gl,{stroke:Ee(C,c,S.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:_i(C,S),height:ii(C,S)})},"bpmn:InclusiveGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S);return h(B,C.width,C.height,C.height*.24,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=Z(B,C,{...S,strokeWidth:1.5});return h(B,C.width,C.height,hl,{fill:"none",stroke:Ee(C,c,S.stroke),strokeWidth:1.5}),G&&L(C,B,S),q},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(B,C,S={}){return S=ht(S,["fill","stroke","width","height"]),W(B,C,{...S,fillOpacity:FP})},"bpmn:ManualTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(B,q,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=de(C),q=dt(C),ie=rt(C,s,S.fill),Me=Ee(C,c,S.stroke),Xe=y(B,C.waypoints,{markerEnd:d(B,"messageflow-end",ie,Me),markerStart:d(B,"messageflow-start",ie,Me),stroke:Me,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var mt=Xe.getPointAtLength(Xe.getTotalLength()/2),Ut=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:mt.x,y:mt.y}}),Mt={strokeWidth:1};q.get("messageVisibleKind")==="initiating"?(Mt.fill=ie,Mt.stroke=Me):(Mt.fill=Me,Mt.stroke=ie);var mn=v(B,Ut,Mt),Rn=G.get("messageRef"),Wn=Rn.get("name"),At=X(B,Wn,{align:"center-top",fitBox:!0,style:{fill:Me}}),Zt=mn.getBBox(),_n=At.getBBox(),Ua=mt.x-_n.width/2,Un=mt.y+Zt.height/2+IP;ul(At,Ua,Un,0)}return Xe},"bpmn:ParallelGateway":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=oe(B,C,S),q=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return v(B,q,{fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke),strokeWidth:1}),G},"bpmn:Participant":function(B,C,S={}){S=ht(S,["fill","stroke","width","height"]);var G=W(B,C,S),q=ct(C),ie=xn(C),Me=de(C),Xe=Me.get("name");if(q){var mt=ie?[{x:30,y:0},{x:30,y:ii(C,S)}]:[{x:0,y:30},{x:_i(C,S),y:30}];b(B,mt,{stroke:Ee(C,c,S.stroke),strokeWidth:BP}),We(B,Xe,C,S)}else{var Ut=Rs(C,S);ie||(Ut.height=_i(C,S),Ut.width=ii(C,S));var Mt=X(B,Xe,{box:Ut,align:"center-middle",style:{fill:Ss(C,l,c,S.stroke)}});if(!ie){var mn=-1*ii(C,S);ul(Mt,0,-mn,270)}}return Me.get("participantMultiplicity")&&N("ParticipantMultiplicityMarker",B,C,S),G},"bpmn:ReceiveTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=de(C),q=ge(B,C,S),ie;return G.get("instantiate")?(h(B,28,28,20*.22,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1}),ie=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):ie=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),v(B,ie,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1}),q},"bpmn:ScriptTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(B,q,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(B,q,{fill:Ee(C,c,S.stroke),stroke:rt(C,s,S.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=rt(C,s,S.fill),q=Ee(C,c,S.stroke),ie=y(B,C.waypoints,{markerEnd:d(B,"sequenceflow-end",G,q),stroke:q}),Me=de(C),{source:Xe}=C;if(Xe){var mt=de(Xe);Me.get("conditionExpression")&&M(mt,"bpmn:Activity")&&we(ie,{markerStart:d(B,"conditional-flow-marker",G,q)}),mt.get("default")&&(M(mt,"bpmn:Gateway")||M(mt,"bpmn:Activity"))&&mt.get("default")===Me&&we(ie,{markerStart:d(B,"conditional-default-flow-marker",G,q)})}return ie},"bpmn:ServiceTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S);h(B,10,10,{fill:rt(C,s,S.fill),stroke:"none",transform:"translate(6, 6)"});var q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(B,q,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1}),h(B,10,10,{fill:rt(C,s,S.fill),stroke:"none",transform:"translate(11, 10)"});var ie=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(B,ie,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(B,C,S={}){var{renderIcon:G=!0}=S;S=ht(S,["fill","stroke"]);var q=de(C);q.get("isInterrupting")||(S={...S,strokeDasharray:"6"});var ie=Z(B,C,S);return G&&L(C,B,S),ie},"bpmn:SubProcess":function(B,C,S={}){return ct(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]),Y(B,C,S)},"bpmn:Task":function(B,C,S={}){return S=ht(S,["fill","stroke"]),ge(B,C,S)},"bpmn:TextAnnotation":function(B,C,S={}){S=ht(S,["fill","stroke"]);var{width:G,height:q}=Rs(C,S),ie=m(B,G,q,0,0,{fill:"none",stroke:"none"}),Me=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:q,position:{mx:0,my:0}});v(B,Me,{stroke:Ee(C,c,S.stroke)});var Xe=de(C),mt=Xe.get("text")||"";return X(B,mt,{align:"left-top",box:Rs(C,S),padding:ba,style:{fill:Ss(C,l,c,S.stroke)}}),ie},"bpmn:Transaction":function(B,C,S={}){ct(C)?S=ht(S,["fill","stroke","width","height"]):S=ht(S,["fill","stroke"]);var G=Y(B,C,{strokeWidth:1.5,...S}),q=n.style(["no-fill","no-events"],{stroke:Ee(C,c,S.stroke),strokeWidth:1.5}),ie=ct(C);return ie||(S={}),m(B,_i(C,S),ii(C,S),gl-hl,hl,q),G},"bpmn:UserTask":function(B,C,S={}){S=ht(S,["fill","stroke"]);var G=ge(B,C,S),q=15,ie=12,Me=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:q,y:ie}});v(B,Me,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:q,y:ie}});v(B,Xe,{fill:rt(C,s,S.fill),stroke:Ee(C,c,S.stroke),strokeWidth:.5});var mt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:q,y:ie}});return v(B,mt,{fill:Ee(C,c,S.stroke),stroke:Ee(C,c,S.stroke),strokeWidth:.5}),G},label:function(B,C,S={}){return ee(B,C,S)}};this._drawPath=v,this._renderer=w}Ce(Mr,fo),Mr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Mr.prototype.canRender=function(e){return M(e,"bpmn:BaseElement")},Mr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Mr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Mr.prototype.getShapePath=function(e){return et(e)?If(e,NP):M(e,"bpmn:Event")?bv(e):M(e,"bpmn:Activity")?If(e,gl):M(e,"bpmn:Gateway")?OP(e):DP(e)};function ht(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var jP=0,HP={width:150,height:50};function zP(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function GP(e){return fn(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Bf=null;function VP(){return Bf||(Bf=document.createElement("canvas").getContext("2d")),Bf}function WP(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(xv(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function xv(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function UP(e,t){var n=VP();if(!n)return{width:0,height:0};n.font=WP(t),"letterSpacing"in n&&(n.letterSpacing=xv(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 qP(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=UP(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return YP(e,o,i,r);o=XP(o,r.width,t)}}function YP(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 _v="­";function KP(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===_v)&&o.pop();break}var a=o[o.length-1];return a&&a===_v&&(o[o.length-1]="-"),o.join("")}function XP(e,t,n){var i=Math.max(e.length*(n/t),1),o=KP(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function ml(e){this._config=V({},{size:HP,padding:jP,style:{},align:"center-top"},e||{})}ml.prototype.createText=function(e,t){return this.layoutText(e,t).element},ml.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ml.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),o=zP(t.align||this._config.align),r=GP(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=ZP(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(qP(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=Jn(l,function(m,_,b){return m+(s||_.height)},0)+r.top+r.bottom,f=Jn(l,function(m,_,b){return _.width>m?_.width:m},0),d=r.top;o.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||l[0].height)/4;var g=Oe("text");we(g,i),z(l,function(m){var _;switch(d+=s||m.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?f:u)-r.right-m.width;break;default:_=Math.max(((a?f:u)-m.width)/2+r.left,0)}var b=Oe("tspan");we(b,{x:_,y:d}),b.textContent=m.text,ze(g,b)});var h={width:f,height:p};return{dimensions:h,element:g}};function ZP(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var QP=12,JP=1.2,eT=40;function wv(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:QP,fontWeight:"normal",lineHeight:JP},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),o=new ml({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Cr.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:ba});return{x:a.x,y:a.y,width:a.width,height:Math.max(eT,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}wv.$inject=["config.textRenderer"];function tT(){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=rT(i.d,{mx:o,my:r,e:a});return p}}var nT=/\{([^{}]+)\}/g,iT=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function oT(e,t,n){var i=n;return t.replace(iT,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 rT(e,t){return String(e).replace(nT,function(n,i){return oT(n,i,t)})}const aT={__init__:["bpmnRenderer"],bpmnRenderer:["type",Mr],textRenderer:["type",wv],pathMap:["type",tT]};function sT(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Cs={translate:["value",sT]};function yl(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function cT(e,t,n){var i=e.waypoint;return!i||i.length<2?[je(t),je(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Ev(e,t,n){return new Error(`element ${Fn(t)} referenced by ${Fn(e)}#${n} not yet drawn`)}function yo(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}yo.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],yo.prototype.add=function(e,t,n){var i,o,r;if(M(t,"bpmndi:BPMNPlane")){var a=M(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(yl(e,t,a)),this._canvas.addRootElement(i)}else if(M(t,"bpmndi:BPMNShape")){var s=!ct(e,t),c=uT(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(yl(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})),M(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),M(e,"bpmn:Lane")&&(r=0),M(e,"bpmn:DataStoreReference")&&(lT(n,je(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(M(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(yl(e,t,{hidden:o,source:u,target:p,waypoints:cT(t,u,p)})),M(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Fn(t)} for element ${Fn(e)}`);return Wo(e)&&yi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},yo.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Fn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Ev(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},yo.prototype.addLabel=function(e,t,n){var i,o,r;return i=RP(t,n),o=yi(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(yl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!yi(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)},yo.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?Ev(e,i,t+"Ref"):new Error(`${Fn(e)}#${t} Ref not specified`)},yo.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},yo.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},yo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function lT(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 uT(e){return M(e,"bpmn:Group")}const Sv={__depends__:[aT,{__depends__:[Cs],bpmnImporter:["type",yo]}]};function Ms(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ni(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Nf(e){return Math.log(e)/Math.log(10)}var pT=1e3;function pe(e){this._eventBus=e}pe.$inject=["eventBus"];function fT(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}pe.prototype.on=function(e,t,n,i,o,r){if((vn(t)||Fe(t))&&(r=o,o=i,i=n,n=t,t=null),vn(n)&&(r=o,o=i,i=n,n=pT),fn(o)&&(r=o,o=!1),!vn(i))throw new Error("handlerFn must be a function");$e(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?fT(i,r):i,r)})},pe.prototype.canExecute=vo("canExecute"),pe.prototype.preExecute=vo("preExecute"),pe.prototype.preExecuted=vo("preExecuted"),pe.prototype.execute=vo("execute"),pe.prototype.executed=vo("executed"),pe.prototype.postExecute=vo("postExecute"),pe.prototype.postExecuted=vo("postExecuted"),pe.prototype.revert=vo("revert"),pe.prototype.reverted=vo("reverted");function vo(e){return function(n,i,o,r,a){(vn(n)||Fe(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var $f=["top","bottom","left","right"],vl=10;function Ff(e,t){pe.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(dl(o)&&!Pt(o)){var r=gT(o);r&&i(o,r)}}function i(o,r){var a=je(o),s=o.label,c=je(s);if(s.parent){var l=Be(o),u;switch(r){case"top":u={x:a.x,y:l.top-vl-s.height/2};break;case"left":u={x:l.left-vl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+vl+s.height/2};break;case"right":u={x:l.right+vl+s.width/2,y:a.y};break}var p=Ni(u,c);t.moveShape(s,p)}}}Ce(Ff,pe),Ff.$inject=["eventBus","modeling"];function dT(e){var t=e.host,n=je(e),i=kn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=$f.filter(function(a){return o.indexOf(a)===-1});return r}function hT(e){var t=je(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 Rv(t,i)});return n}function gT(e){var t=je(e.label),n=je(e),i=Rv(n,t);if(mT(i)){var o=hT(e);if(e.host){var r=dT(e);o=o.concat(r)}var a=$f.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?kn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Rv(e,t){return kn(t,e,5)}function mT(e){return $f.indexOf(e)!==-1}function jf(e){pe.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(M(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ce(jf,pe),jf.$inject=["eventBus"];var yT=1500;function Hf(e,t,n){e.invoke(pe,this),this.preExecute("elements.delete",yT,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=it(o,l=>M(l,"bpmn:Participant")||M(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>M(l,"bpmn:Artifact"))),c=new Set;return z(r,l=>{const u=new Set(Zr(ha(Array.from(s),rn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ce(Hf,pe),Hf.$inject=["injector","eventBus","canvas"];function zf(e,t){e.invoke(pe,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=it(o.incoming.concat(o.outgoing),function(a){return M(a,"bpmn:Association")});z(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ce(zf,pe),zf.$inject=["injector","modeling"];function _a(e,t){for(Zn(t)&&(t=[t]);e=e.parent;)if(nt(e,t))return e;return null}function Cv(e,t){var n=_a(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=_a(e,i),n)return xn(n);if(nt(e,i))return xn(e);var o;for(o=de(e);o&&!M(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=de(a);return s&&s.get("processRef")===o});return r?xn(r):!0}var Mv=500;function bl(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Mv,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return Av(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",Mv,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];Av(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}bl.$inject=["bpmnReplace","injector"],Ce(bl,pe),bl.prototype._replaceShape=function(e,t){var n=vT(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function vT(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function Av(e,t){return!et(e)&&nt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Gf(e,t){pe.call(this,e);function n(i){return it(i.attachers,function(o){return M(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);M(o,"bpmn:EventBasedGateway")&&M(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;M(o,"bpmn:Gateway")&&M(r,"bpmn:EventBasedGateway")&&z(r.outgoing,function(a){var s=a.target,c=n(s);M(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Gf.$inject=["eventBus","modeling"],Ce(Gf,pe);function Pv(e){return e.create("bpmn:Category")}function bT(e){return e.create("bpmn:CategoryValue")}function Tv(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=bT(e)),n.$parent||(n.$parent=Pv(e)),n}function xT(e,t,n){return en(t.get("categoryValue"),e),e.$parent=t,en(n.get("rootElements"),t),t.$parent=n,e}function _T(e){var t=e.$parent;return t&&(Xt(t.get("categoryValue"),e),e.$parent=null),e}function wT(e){var t=e.$parent;return t&&(Xt(t.get("rootElements"),e),e.$parent=null),e}var ET=500;function Vf(e,t,n){n.invoke(pe,this);function i(c){return t.filter(function(l){return M(l,"bpmn:Group")&&!l.labelTarget}).map(de).filter(function(l){return l!==c})}function 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&&xT(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&wT(l),c&&!o(c,u)&&_T(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.executed(["shape.move","shape.resize"],ET,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,de(l))},!0),this.executed("group.updateRefs",function(c){kv(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){kv(c).forEach(function(l){s(l.categoryValue,l.category,de(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,de(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Vf.$inject=["bpmnjs","elementRegistry","injector"],Ce(Vf,pe);function kv(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Wf(e,t,n){pe.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(m){const _=m.source,b=m.target;wa(_)&&As(b)&&u(b)}function o(m){const _=m.connection,b=m.source,y=m.target;wa(b)&&xl(y)&&(l(y),f(b,[_]))}function r(m){const _=m.newTarget,b=m.oldSource,y=m.oldTarget;if(y!==_){const v=b;As(y)&&u(y),wa(v)&&xl(_)&&l(_)}}function a(m){const{element:_}=m;As(_)?(p(_),d(_)):xl(_)&&g(_)}function s(m){const{newData:_,oldShape:b}=m;if(wa(m.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const y=b.outgoing.find(({target:v})=>As(v));y&&y.target&&(m._connectionTarget=y.target)}else if(!wa(m.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const y=b.outgoing.find(({target:v})=>xl(v));y&&y.target&&(m._connectionTarget=y.target),h(b)}}function c(m){const{_connectionTarget:_,newShape:b}=m;_&&t.connect(b,_)}function l(m){t.updateProperties(m,{isForCompensation:!0})}function u(m){t.updateProperties(m,{isForCompensation:void 0})}function p(m){for(const _ of m.incoming)n.canConnect(_.source,m)||t.removeConnection(_);for(const _ of m.outgoing)n.canConnect(m,_.target)||t.removeConnection(_)}function f(m,_){m.outgoing.filter(v=>M(v,"bpmn:Association")).filter(v=>As(v.target)&&!_.includes(v)).forEach(v=>t.removeConnection(v))}function d(m){const _=m.attachers.slice();_.length&&t.removeElements(_)}function g(m){const _=m.incoming.filter(b=>wa(b.source));t.removeElements(_)}function h(m){const _=m.outgoing.filter(b=>M(b,"bpmn:SequenceFlow"));t.removeElements(_)}}Ce(Wf,pe),Wf.$inject=["eventBus","modeling","bpmnRules"];function As(e){const t=de(e);return t&&t.get("isForCompensation")}function wa(e){return e&&M(e,"bpmn:BoundaryEvent")&&va(e,"bpmn:CompensateEventDefinition")}function xl(e){return e&&M(e,"bpmn:Activity")&&!jn(e)}function Uf(e){e.invoke(pe,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;M(i,"bpmn:Lane")&&!M(o,"bpmn:Lane")&&(n.parent=_a(i,"bpmn:Participant"))})}Uf.$inject=["injector"],Ce(Uf,pe);function qf(e,t){pe.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(M(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}})}qf.$inject=["eventBus","bpmnFactory"],Ce(qf,pe);var Yf=20,Kf=20,Ov=30,_l=2e3;function Xf(e,t,n){pe.call(this,t),t.on(["create.start","shape.move.start"],_l,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!M(a,"bpmn:Participant")||!M(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!M(p,"bpmn:Group")&&!et(p)&&!Pt(p)});if(c.length){var l=rn(c),u=ST(a,l);V(a,u),r.createConstraints=RT(a,l)}}}),t.on("create.start",_l,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}M(a,"bpmn:Participant")&&M(s,"bpmn:Process")&&(t.on("element.hover",_l,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return M(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",_l,function(o){var r=o.elements,a=o.parent,s=CT(r),c;s&&M(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=de(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;M(a,"bpmn:Participant")&&M(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=de(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)&&de(s).set("processRef",de(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)&&de(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)}Xf.$inject=["canvas","eventBus","modeling"],Ce(Xf,pe);function ST(e,t){t={width:t.width+Yf*2+Ov,height:t.height+Kf*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 RT(e,t){return t=Be(t),{bottom:t.top+e.height/2-Kf,left:t.right-e.width/2+Yf,top:t.bottom-e.height/2+Kf,right:t.left+e.width/2-Yf-Ov}}function CT(e){return Ot(e,function(t){return M(t,"bpmn:Participant")})}var Dv="__targetRef_placeholder";function Zf(e,t){pe.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Lv(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Lv(r));function n(a,s,c){var l=a.get("dataInputAssociations");return Ot(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=Ot(c,function(u){return u.name===Dv});return!l&&s&&(l=t.create("bpmn:Property",{name:Dv}),en(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||Xt(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,f=s.newTarget,d=f&&f.businessObject,g=s.oldTarget||s.target,h=g&&g.businessObject,m=c.businessObject,_;h&&h!==p&&o(h,l),d&&d!==p&&o(d,l),p?(_=i(p,!0),m.targetRef=_):m.targetRef=null}}Zf.$inject=["eventBus","bpmnFactory"],Ce(Zf,pe);function Lv(e){return function(t){var n=t.context,i=n.connection;if(M(i,"bpmn:DataInputAssociation"))return e(t)}}function wl(e){this._bpmnUpdater=e}wl.$inject=["bpmnUpdater"],wl.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),[]},wl.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 Qf(e,t,n,i){pe.call(this,i),t.registerHandler("dataStore.updateContainment",wl);function o(){return n.filter(function(s){return M(s,"bpmn:Participant")&&de(s).processRef})[0]}function r(s){return s.children.filter(function(c){return M(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:dt(s),newSemanticParent:u.processRef||u,newDiParent:dt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return M(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!M(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!M(u,"bpmn:Collaboration")&&M(l,"bpmn:DataStoreReference")&&l.type!=="label"&&M(p,"bpmn:Collaboration")){var f=M(u,"bpmn:Participant")?u:AT(u,"bpmn:Participant");a(l,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();nt(l,["bpmn:Participant","bpmn:SubProcess"])&&M(u,"bpmn:Collaboration")&&r(u).filter(function(p){return MT(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(f){M(u,"bpmn:Process")&&a(f,u)})})}Qf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ce(Qf,pe);function MT(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 AT(e,t){for(;e.parent;){if(M(e.parent,t))return e.parent;e=e.parent}}var El=Math.max,Sl=Math.min,PT=20;function Iv(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function TT(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 kT(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 Rl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return Fe(o)&&(i=(/top|left/.test(e)?Sl:El)(i,o)),Fe(r)&&(i=(/top|left/.test(e)?El:Sl)(i,r)),i}function OT(e,t){if(!t)return e;var n=Be(e);return sl({top:Rl("top",n,t),right:Rl("right",n,t),bottom:Rl("bottom",n,t),left:Rl("left",n,t)})}function DT(e,t,n,i){var o=Be(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?Be(i):r,s={top:Sl(r.top,a.top),left:Sl(r.left,a.left),bottom:El(r.bottom,a.bottom),right:El(r.right,a.right)};return sl(s)}function Ps(e,t){return typeof e<"u"?e:PT}function LT(e,t){var n,i,o,r;return typeof t=="object"?(n=Ps(t.left),i=Ps(t.right),o=Ps(t.top),r=Ps(t.bottom)):n=i=o=r=Ps(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function IT(e){return!(e.waypoints||e.type==="label")}function Bv(e,t){var n;if(e.length===void 0?n=it(e.children,IT):n=e,n.length)return LT(rn(n),t)}var Uo=Math.abs;function BT(e,t){return Iv(Be(t),Be(e))}var NT=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],wi=30;function Cl(e,t){return t=t||[],e.children.filter(function(n){M(n,"bpmn:Lane")&&(Cl(n,t),t.push(n))}),t}function qo(e){return e.children.filter(function(t){return M(t,"bpmn:Lane")})}function Ei(e){return _a(e,NT)||e}function $T(e,t){var n=Ei(e),i=M(n,"bpmn:Process")?[]:[n],o=Cl(n,i),r=Be(e),a=Be(t),s=BT(e,t),c=[],l=xn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,f=l?s.right:0,d=l?0:s.bottom,g=l?s.left:0,h=Be(u);s.top&&(Uo(h.bottom-r.top)<10&&(d=a.top-h.bottom),Uo(h.top-r.top)<5&&(p=a.top-h.top)),s.left&&(Uo(h.right-r.left)<10&&(f=a.left-h.right),Uo(h.left-r.left)<5&&(g=a.left-h.left)),s.bottom&&(Uo(h.top-r.bottom)<10&&(p=a.bottom-h.top),Uo(h.bottom-r.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Uo(h.left-r.right)<10&&(g=a.right-h.left),Uo(h.right-r.right)<5&&(f=a.right-h.right)),(p||f||d||g)&&c.push({shape:u,newBounds:kT(u,{top:p,right:f,bottom:d,left:g})})}}),c}var FT=500;function Jf(e,t){pe.call(this,e);function n(i,o){var r=xn(i),a=qo(o),s=[],c=[],l=[],u=[];if(Rr(a,function(m){return r?m.y>i.y?c.push(m):s.push(m):m.x>i.x?u.push(m):l.push(m),m.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 f,d,g,h;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),l.length&&(g=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:p,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",FT,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;M(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Jf.$inject=["eventBus","spaceTool"],Ce(Jf,pe);var Nv=500;function Ml(e,t){t.invoke(pe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Nv,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return $v(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",Nv,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;$v(a,HT(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Ml.$inject=["bpmnReplace","injector"],Ce(Ml,pe),Ml.prototype._replaceShape=function(e){var t=jT(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function jT(e){var t=de(e),n=t.eventDefinitions;return n&&n[0]}function $v(e,t){return!et(e)&&M(e,"bpmn:BoundaryEvent")&&!t}function HT(e,t){return e.indexOf(t)!==-1}var Al=Math.round,zT=Math.max;function GT(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 VT(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Fv=10;function WT(e,t){var n,i;for(n=0;i=e[n];n++)if(bs(i,t)<=Fv)return{point:e[n],bendpoint:!0,index:n};return null}function UT(e,t){var n=Vy(GT(t,Fv),VT(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=zT(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:Al(i.x+o.x)/2,y:Al(i.y+o.y)/2},index:i.segment2}:{point:{x:Al(i.x),y:Al(i.y)},index:i.segment2}:null}function ed(e,t){return WT(e,t)||UT(e,t)}function td(e,t,n){pe.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,f,d,g,h=o.outgoing.slice(),m=o.incoming.slice(),_;Fe(a.width)?_=je(a):_=a;var b=ed(s,_);if(b){if(c=s.slice(0,b.index),l=s.slice(b.index+(b.bendpoint?1:0)),!c.length||!l.length)return;u=b.bendpoint?s[b.index]:_,(c.length===1||!jv(o,c[c.length-1]))&&c.push(Hv(u)),(l.length===1||!jv(o,l[0]))&&l.unshift(Hv(u))}p=r.source,f=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),d=r),t.canConnect(o,f,r)&&(d?g=n.connect(o,f,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),g=r));var y=[].concat(d&&it(m,function(v){return v.source===d.source})||[],g&&it(h,function(v){return v.target===g.target})||[]);y.length&&n.removeElements(y)}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=je(c),u={x:l.x+s.x,y:l.y+s.y},p=Ot(r.children,function(f){var d=t.canInsert(a,f);return d&&ed(f.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)}Ce(td,pe),td.$inject=["eventBus","bpmnRules","modeling"];function jv(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 Hv(e){return V({},e)}function nd(e,t){pe.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)&&Ea(o)){var c=[];M(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Ea(l)):c=a.incoming.filter(l=>l!==o&&Ea(l)&&M(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(M(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Ea).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Ea).forEach(function(s){const c=a.incoming.filter(Ea).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}nd.$inject=["eventBus","modeling"],Ce(nd,pe);function Ea(e){return M(e,"bpmn:SequenceFlow")}var Pl=1500,zv=2e3;function Gv(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"],Pl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;M(a,"bpmn:Lane")&&!nt(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||nt(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"],Pl,function(i){var o=i.hover;M(o,"bpmn:Lane")&&(i.hover=Ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Pl,function(i){var o=i.context,r=i.hover,a=o.type;M(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Pl,function(i){var o=i.context,r=o.start;M(r,"bpmn:Lane")&&(o.start=Ei(r)||r)}),t.on("shape.move.start",zv,function(i){var o=i.shape;M(o,"bpmn:Lane")&&(i.shape=Ei(o)||o)}),t.on("spaceTool.move",zv,function(i){var o=i.hover;o&&M(o,"bpmn:Lane")&&(i.hover=Ei(o))})}Gv.$inject=["elementRegistry","eventBus","canvas"];var Vv=770;function id(e,t,n,i){n.invoke(pe,this);function o(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef;u||(u=Tv(e,l));var p=c.category||u.$parent||Pv(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=de(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;M(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=de(l);if(!(!M(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,f=de(l);p&&(f.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!M(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!de(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||de(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!M(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",Vv,function(s){var c=s.descriptor,l=s.element;if(!(!M(l,"bpmn:Group")||l.labelTarget)){var u=de(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Vv,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})}id.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ce(id,pe);function od(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 Wv(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=od(i,o,r,a),l=od(i,o,r,s),u;c&&l?Uv(c,r)>Uv(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],je(i.source)),t(o[o.length-1],o[o.length-2],je(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}Wv.$inject=["eventBus"];function Uv(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rd(e){pe.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=de(i),r=dt(i);if(nt(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}rd.$inject=["eventBus"],Ce(rd,pe);function qv(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Yv(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function qT(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 YT(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 ad(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=YT([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 Kv(e,t){var n=ad(e,t),i={x:n.x-e.x,y:n.y-e.y};return qv(i)}function Ts(e,t){return qv({x:e.x-t.x,y:e.y-t.y})}var Xv=Math.sqrt,Zv=Math.min,KT=Math.max,Qv=Math.abs;function Jv(e){return Math.pow(e,2)}function ks(e,t){return Xv(Jv(e.x-t.x)+Jv(e.y-t.y))}function XT(e,t){var n=0,i,o,r,a,s,c,l,u,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],tb(i,o)?l=[i]:(r=ks(e,i),a=ks(e,o),c=Zv(r,a),l=ZT(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:tb(i,l[0])?n:n+1}),l.length===2&&(s=JT(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:ks(i,s)/ks(i,o)}),p=ks(u.position,e),(!d||f>p)&&(d=u,f=p)}return d}function ZT(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,f=u/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var g=Xv(d),h=-p+g,m=-p-g,_={x:e.x-o*h,y:e.y-r*h};if(d===0)return[_];var b={x:e.x-o*m,y:e.y-r*m};return[_,b].filter(function(y){return QT(y,e,t)})}function QT(e,t,n){return eb(e.x,t.x,n.x)&&eb(e.y,t.y,n.y)}function eb(e,t,n){return e>=Zv(t,n)-Tl&&e<=KT(t,n)+Tl}function JT(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Tl=.1;function tb(e,t){return Qv(e.x-t.x)<=Tl&&Qv(e.y-t.y)<=Tl}function ek(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=ib(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 nb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=XT(e,n),c=s.segmentIndex,l=ek(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=ob(n,c),p=ob(t,l),f=s.position,d=nk(u,f),g=tk(u,p);if(s.type==="bendpoint"){var h=t.length-n.length,m=s.bendpointIndex,_=n[m];if(t.indexOf(_)!==-1)return a;if(h===0){var b=t[m];return o=b.x-s.position.x,r=b.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}h<0&&m!==0&&m<n.length-1&&(d=ib(n,m))}var y={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},v=qT({x:e.x-f.x,y:e.y-f.y},g);return o=y.x+v.x-e.x,r=y.y+v.y-e.y,{point:go(y),delta:go({x:o,y:r})}}function ib(e,t){var n=Ts(e[t-1],e[t]),i=Ts(e[t],e[t+1]),o=n/(n+i);return o}function tk(e,t){var n=Yv(e),i=Yv(t);return i-n}function ob(e,t){return[e[t],e[t+1]]}function nk(e,t){var n=Ts(e[0],e[1]),i=Ts(e[0],t);return n===0?0:i/n}function ik(e,t,n,i){var o=je(e);return nb(o,t,n,i).delta}function Os(e,t,n){var i=Ms(t),o=Ms(n),r=Ni(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return go({x:o.x+a.x,y:o.y+a.y})}function rb(e,t,n){var i=Ms(e),o=Ms(t),r=Ms(n),a=Ni(e,i),s=Ni(i,o),c=ok(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 go({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function ok(e,t,n){var i=Be(t),o=Be(n);if(rk(i,o))return null;var r=kn(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=kn(n,s),c!==r?null:a}function rk(e,t){return ak(e,t)||sk(e,t)}function ak(e,t){return e.right!==t.right&&e.left!==t.left}function sk(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var ab="name",sb="text";function sd(e,t,n,i){pe.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{de(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(ab in l&&t.updateLabel(c,l[ab]),sb in l&&M(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[sb]||"");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;et(l)||!Wo(l)||yi(l)&&t.updateLabel(l,yi(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=V({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),ik(l,p,f,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=de(c);u&&Wo(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(!(!et(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(yi(c)||"",{box:u,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:f,x:u.x,y:d?g-f:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(dl(c)){var p=c.label,f=je(p),d=uk(u),g=lk(f,d),h=ck(g,u,l);t.moveShape(p,h)}})}Ce(sd,pe),sd.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function ck(e,t,n){var i=Os(e,t,n);return go(Ni(i,e))}function lk(e,t){if(t.length){var n=pk(e,t);return ad(e,n)}}function uk(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 pk(e,t){var n=t.map(function(o){return{line:o,distance:Kv(e,o)}}),i=zi(n,"distance");return i[0].line}function fk(e,t,n,i){return nb(e,t,n,i).point}function cd(e,t){pe.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=V({},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),fk(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},f=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,f)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},f=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,f)})})}Ce(cd,pe),cd.$inject=["eventBus","modeling"];function kl(e,t,n){var i=Dl(e),o=lb(i,t),r=i[0];return o.length?o[o.length-1]:Os(r.original||r,n,t)}function Ol(e,t,n){var i=Dl(e),o=lb(i,t),r=i[i.length-1];return o.length?o[0]:Os(r.original||r,n,t)}function ld(e,t,n){var i=Dl(e),o=cb(t,n),r=i[0];return Os(r.original||r,o,t)}function ud(e,t,n){var i=Dl(e),o=cb(t,n),r=i[i.length-1];return Os(r.original||r,o,t)}function cb(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Dl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function lb(e,t){var n=Bn(e,hk);return it(n,function(i){return dk(i,t)})}function dk(e,t){return kn(t,e,1)==="intersect"}function hk(e){return e.original||e}function pd(e,t){pe.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(gk(i,o)){var r=mk(i);r.incoming.forEach(function(a){var s=Ol(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=kl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}pd.$inject=["eventBus","modeling"],Ce(pd,pe);function gk(e,t){return M(e,"bpmn:Participant")&&ct(e)&&M(t,"bpmn:Participant")&&!ct(t)}function mk(e){var t=ys([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){M(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){M(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const yk=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ub(e){const t=de(e);if(!M(t,"bpmn:BoundaryEvent")&&!(M(t,"bpmn:StartEvent")&&jn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:yk.some(i=>M(n[0],i))}function pb(e){return M(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function fd(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!ub(o))return;const a=pb(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=de(i).get(a),l=de(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}fd.$inject=["injector","modeling"],Ce(fd,pe);function dd(e,t){pe.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=dt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ce(dd,pe),dd.$inject=["eventBus","modeling"];function hd(e,t,n){pe.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(!(!M(r,"bpmn:SequenceFlow")||!M(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=vk(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ce(hd,pe),hd.$inject=["eventBus","bpmnRules","modeling"];function Sa(e){return e.original||e}function vk(e,t){var n=od(Sa(e[e.length-2]),Sa(e[e.length-1]),Sa(t[1]),Sa(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Sa(e[0]),Sa(t[t.length-1])]}function gd(e,t){pe.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;M(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)}gd.$inject=["eventBus","modeling"],Ce(gd,pe);function md(e,t,n,i){pe.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 f,d;M(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(f="bpmn:MessageFlow")),M(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(l,u,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,f=l.newTarget||u.target,d,g;d=n.canConnect(p,f),!(!d||d.type===u.type)&&(g=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,o&&s(u,g))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;z(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,f=p.businessObject,d;u.default&&(d=Ot(p.outgoing,Jr({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}Ce(md,pe),md.$inject=["eventBus","modeling","bpmnRules","injector"];function Ll(e,t,n,i,o,r){i.invoke(pe,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=Jn(l,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];z(s.closure.topLevel,function(f){jn(f)?u=u.concat(f.children):u=u.concat(f)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Ce(Ll,pe),Ll.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;z(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)},Ll.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var bk=1500,xk={width:140,height:120},yd={width:300,height:60},vd={width:60,height:300},Il={width:300,height:150},Bl={width:150,height:300},fb={width:140,height:120},db={width:100,height:40};function hb(e){e.on("resize.start",bk,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(M(i,"bpmn:Lane")||M(i,"bpmn:Participant"))&&(n.resizeConstraints=Rk(i,o,r)),M(i,"bpmn:SubProcess")&&ct(i)&&(n.minDimensions=fb),M(i,"bpmn:TextAnnotation")&&(n.minDimensions=db)})}hb.$inject=["eventBus"];var Yo=Math.abs,_k=Math.min,wk=Math.max;function gb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ra(e,t,n){return gb(e,t,n,_k)}function Ca(e,t,n){return gb(e,t,n,wk)}var Ek={top:20,left:50,right:20,bottom:20},Sk={top:50,left:20,right:20,bottom:20};function Rk(e,t,n){var i=Ei(e),o=!0,r=!0,a=Cl(i,[i]),s=Be(e),c={},l={},u=xn(e),p=u?yd:vd;/n/.test(t)?l.top=s.bottom-p.height:/e/.test(t)?l.right=s.left+p.width:/s/.test(t)?l.bottom=s.top+p.height:/w/.test(t)&&(l.left=s.right-p.width),a.forEach(function(g){var h=Be(g);u?(h.top<s.top-10&&(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&&Yo(s.top-h.bottom)<10&&Ca(c,"top",h.top+p.height),Yo(s.top-h.top)<5&&Ra(l,"top",h.bottom-p.height)),/e/.test(t)&&(n&&Yo(s.right-h.left)<10&&Ra(c,"right",h.right-p.width),Yo(s.right-h.right)<5&&Ca(l,"right",h.left+p.width)),/s/.test(t)&&(n&&Yo(s.bottom-h.top)<10&&Ra(c,"bottom",h.bottom-p.height),Yo(s.bottom-h.bottom)<5&&Ca(l,"bottom",h.top+p.height)),/w/.test(t)&&(n&&Yo(s.left-h.right)<10&&Ca(c,"left",h.left+p.width),Yo(s.left-h.left)<5&&Ra(l,"left",h.right-p.width))});var f=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(M(g,"bpmn:FlowElement")||M(g,"bpmn:Artifact"))}),d=u?Ek:Sk;return f.forEach(function(g){var h=Be(g);/n/.test(t)&&(!u||o)&&Ra(l,"top",h.top-d.top),/e/.test(t)&&(u||r)&&Ca(l,"right",h.right+d.right),/s/.test(t)&&(!u||r)&&Ca(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||o)&&Ra(l,"left",h.left-d.left)}),{min:l,max:c}}function mb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ma(e){return e.originalEvent||e.srcEvent}function bd(e){mb(e),mb(Ma(e))}function Ar(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 yb(){return/mac/i.test(navigator.platform)}function vb(e,t){return(Ma(e)||e).button===t}function Ko(e){return vb(e,0)}function Ck(e){return vb(e,1)}function Ds(e){var t=Ma(e)||e;return Ko(e)?yb()?t.metaKey:t.ctrlKey:!1}function Nl(e){var t=Ma(e)||e;return Ko(e)&&t.shiftKey}var bb=1001;function xb(e,t){e.on("resize.start",bb+500,function(n){var i=n.context,o=i.shape;(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))&&(i.balanced=!Ds(n))}),e.on("resize.end",bb,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(M(o,"bpmn:Lane")||M(o,"bpmn:Participant"))return r&&(a=Ky(a),t.resizeLane(o,a,i.balanced)),!1})}xb.$inject=["eventBus","modeling"];var Mk=500;function xd(e,t,n,i,o){n.invoke(pe,this);function r(u){return nt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||Ak(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),f=p.get("rootElements");return!!Ot(f,Jr({id:u.id}))}function s(u){if(M(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(M(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(M(u,"bpmn:MessageEventDefinition"))return"messageRef";if(M(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(nt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),f=p[0];return f.get(s(f))}function l(u,p){if(nt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var f=u.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var f=de(p),d=c(f),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),en(g,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");Xt(f,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,f=u.element;if(!(f.labelTarget||!r(f))){var d=de(f),g=c(d);g&&(p.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",Mk,function(u){var p=u.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,o.create(d.$type))),l(f,d),delete p.referencedRootElement)})}xd.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ce(xd,pe);function Ak(e,t){return $e(t)||(t=[t]),ko(t,function(n){return va(e,n)})}var _b=Math.max;function wb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return z(n,function(a){var s=a.id;M(a,"bpmn:Participant")&&(r[s]=Tk(a,i,o)),M(a,"bpmn:Lane")&&(r[s]=xn(a)?yd:vd),M(a,"bpmn:SubProcess")&&ct(a)&&(r[s]=fb),M(a,"bpmn:TextAnnotation")&&(r[s]=db),M(a,"bpmn:Group")&&(r[s]=xk)}),r})}wb.$inject=["eventBus"];function Pk(e){return e==="x"}function Tk(e,t,n){var i=xn(e);if(!Dk(e))return i?Il:Bl;var o=Pk(t),r={};return o?i?r=Il:r={width:Ok(e,n,o),height:Bl.height}:i?r={width:Il.width,height:kk(e,n,o)}:r=Bl,r}function kk(e,t,n){var i;return i=Lk(e,t,n),_b(Il.height,i)}function Ok(e,t,n){var i;return i=Ik(e,t,n),_b(Bl.width,i)}function Dk(e){return!!qo(e).length}function Lk(e,t,n){var i=qo(e),o;return o=_d(i,t,n),e.height-o.height+yd.height}function Ik(e,t,n){var i=qo(e),o;return o=_d(i,t,n),e.width-o.width+vd.width}function _d(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=qo(o),r.length?_d(r,t,n):o}var Eb="_plane";function Sb(e){var t=e.id;return Bk(t)}function Ji(e){var t=e.id;return M(e,"bpmn:SubProcess")?Rb(t):t}function Pr(e){return Rb(e)}function $l(e){var t=dt(e);return M(t,"bpmndi:BPMNPlane")}function Rb(e){return e+Eb}function Bk(e){return e.replace(new RegExp(Eb+"$"),"")}var Cb=400,Nk=600,Mb={x:180,y:160};function bo(e,t,n,i,o,r,a){pe.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 M(p,"bpmn:SubProcess")&&!ct(p)}function l(p){var f=p.shape,d=p.newRootElement,g=de(f);d=s._addDiagram(d||g),p.newRootElement=e.addRootElement(d)}function u(p){var f=p.shape,d=de(f);s._removeDiagram(d);var g=p.newRootElement=a.get(Ji(d));e.removeRootElement(g)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;z(f,function(d){if(c(d)){var g=a.get(Ji(d));if(!(!g||!d.children||!d.children.length)){var h=Ab(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!M(f,"bpmn:SubProcess")||!ct(f)||z(Es([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(Ji(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(Ji(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,g=e.findRoot(Ji(f));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if($l(f)){a.updateId(f,Pr(m)),a.updateId(h,m);return}var _=a.get(Pr(h));_&&a.updateId(Pr(h),Pr(m))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(M(f,"bpmn:SubProcess")){var d=p.properties,g=p.oldProperties,h=g.id,m=d.id;if(h!==m){if($l(f)){a.updateId(f,Pr(h)),a.updateId(m,h);return}var _=a.get(Pr(m));_&&a.updateId(_,Pr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if($l(f)){var d=f,g=a.get(Sb(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",Cb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ct(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Cb,function(p){var f=p.shape;M(f,"bpmn:SubProcess")&&(ct(f)?u(p):(l(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",Nk,function(p){var f=p.shape;if(M(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(ct(f))s._moveChildrenToShape(d.children.slice(),f),z(Es(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),z(h.associations,m=>{n.moveConnection(m,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var g=Ab(f);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var g=Ji(f),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,g=p.elements,h=d.parent,m=M(dt(h),"bpmndi:BPMNPlane");if(m){var _=Sb(h),b=Ot(g,function(y){return y.id===_});b&&(f.parent=b.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}Ce(bo,pe),bo.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=rn(i),r;if(!t.x)r={x:Mb.x-o.x,y:Mb.y-o.y};else{var a=je(t),s=je(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},bo.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(vv(e).map(i=>i.annotation));n.size&&z(Es(e.children),i=>{n.has(i.annotation)&&z(i.associations,o=>{t.removeConnection(o)})})},bo.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},bo.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},bo.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:Ji(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},bo.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Ot(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},bo.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function $k(e){var t=[];return z(Es(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Ab(e){return e.children.slice().concat($k(e.children)).concat(Fk(e))}function Fk(e){return Cf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function wd(e,t){e.invoke(pe,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!M(o,"bpmn:SubProcess")||M(o,"bpmn:AdHocSubProcess")||!(M(i,"bpmn:Task")||M(i,"bpmn:CallActivity"))||!ct(o))){var r=jk(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}wd.$inject=["injector","modeling"],Ce(wd,pe);function jk(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ed(e,t){pe.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;M(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&M(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!M(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,yi(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}}})}Ce(Ed,pe),Ed.$inject=["eventBus","textRenderer"];function Sd(e,t){pe.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(ct(i))return;var o=ys(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){r(l,!0)}),z(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||M(a,"bpmn:Association")&&(M(a.source,"bpmn:TextAnnotation")||M(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,je(i)):t.reconnectStart(a,i,je(i)))}},!0)}Ce(Sd,pe),Sd.$inject=["eventBus","modeling"];var Rd=500;function Cd(e,t,n){pe.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=Hk(c).concat([a]),p=Bv(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"],Rd,function(a){var s=a.context,c=s.shape;M(c,"bpmn:SubProcess")&&(c.collapsed?dt(c).isExpanded=!1:(i(c.children),dt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Rd,function(a){var s=a.context,c=s.shape;c.collapsed?dt(c).isExpanded=!1:dt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Rd,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"})})}Ce(Cd,pe),Cd.$inject=["eventBus","elementFactory","modeling"];function Hk(e){return e.filter(function(t){return!t.hidden})}function Md(e,t,n,i){t.invoke(pe,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;et(a)||(M(a,"bpmn:Participant")&&ct(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;M(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ce(Md,pe),Md.$inject=["canvas","injector","moddle","modeling"];function Ad(e,t){pe.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;zk(o,r)&&t.updateProperties(r,{default:null})})}Ce(Ad,pe),Ad.$inject=["eventBus","modeling"];function zk(e,t){if(!M(e,"bpmn:SequenceFlow"))return!1;var n=de(t),i=de(e);return n.get("default")===i}var Gk=500,Vk=5e3,Pb=["shape.create","shape.delete","shape.move","shape.resize"],Tb=[...Pb,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Pd(e,t){pe.call(this,e);var n;function i(){return n=n||new Wk,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(Tb,Vk,function(){i()}),this.postExecuted(Tb,Gk,function(){r()}),this.preExecute(Pb,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(M(c,"bpmn:Lane")&&l.addLane(c),M(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}Pd.$inject=["eventBus","modeling"],Ce(Pd,pe);function Wk(){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 Uk=500,qk=5e3,kb=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Ob=[...kb,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Td(e,t){pe.call(this,e);var n;function i(){return n=n||new Yk,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(Ob,qk,function(){i()}),this.postExecuted(Ob,Uk,function(){r()}),this.preExecute(kb,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(M(s,"bpmn:FlowElement")&&c.addFlowElement(s),M(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;M(s,"bpmn:Group")&&o().addGroup(s)})}Td.$inject=["eventBus","modeling"],Ce(Td,pe);function Yk(){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 kd(e,t){pe.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)Kk(r)&&!Zk(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ce(kd,pe),kd.$inject=["eventBus","modeling"];function Kk(e){const t=de(e);return t&&t.isForCompensation}function Xk(e){return e&&M(e,"bpmn:BoundaryEvent")&&va(e,"bpmn:CompensateEventDefinition")}function Zk(e){return e.incoming.filter(n=>Xk(n.source)).length>0}const Qk={__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",jf],associationBehavior:["type",zf],attachEventBehavior:["type",bl],artifactBehavior:["type",Hf],boundaryEventBehavior:["type",Gf],categoryRootElementReferenceBehavior:["type",Vf],compensateBoundaryEventBehaviour:["type",Wf],createBehavior:["type",Uf],createDataObjectBehavior:["type",qf],createParticipantBehavior:["type",Xf],dataInputAssociationBehavior:["type",Zf],dataStoreBehavior:["type",Qf],deleteLaneBehavior:["type",Jf],detachEventBehavior:["type",Ml],dropOnFlowBehavior:["type",td],eventBasedGatewayBehavior:["type",nd],fixHoverBehavior:["type",Gv],groupBehavior:["type",id],importDockingFix:["type",Wv],isHorizontalFix:["type",rd],labelBehavior:["type",sd],layoutConnectionBehavior:["type",cd],messageFlowBehavior:["type",pd],nonInterruptingBehavior:["type",fd],removeElementBehavior:["type",hd],removeEmbeddedLabelBoundsBehavior:["type",dd],removeParticipantBehavior:["type",gd],replaceConnectionBehavior:["type",md],replaceElementBehaviour:["type",Ll],resizeBehavior:["type",hb],resizeLaneBehavior:["type",xb],rootElementReferenceBehavior:["type",xd],spaceToolBehavior:["type",wb],subProcessPlaneBehavior:["type",bo],subProcessStartEventBehavior:["type",wd],textAnnotationBehavior:["type",Ed],toggleCollapseConnectionBehaviour:["type",Sd],toggleElementCollapseBehaviour:["type",Cd],unclaimIdBehavior:["type",Md],unsetDefaultFlowBehavior:["type",Ad],updateFlowNodeRefsBehavior:["type",Pd],updateCategoryValueRefsBehavior:["type",Td],setCompensationActivityAfterPasteBehavior:["type",kd]};function Od(e){this._commandStack=e.get("commandStack",!1)}Od.$inject=["injector"],Od.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const eo={__init__:["rules"],rules:["type",Od]};function Si(e){pe.call(this,e),this.init()}Si.$inject=["eventBus"],Ce(Si,pe),Si.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)})},Si.prototype.init=function(){};function Db(e,t){var n=kn(e,t,-15);return n!=="intersect"?n:null}function Dn(e){Si.call(this,e)}Ce(Dn,Si),Dn.$inject=["eventBus"],Dn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return Jk(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 jl(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return jl(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 Ub(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Pt(i)&&!Hl(t,i)?!1:To(t,function(o){return Pt(o)?jl(o.source,o.target,o):o.host?Ls(o,o.host,null,n):Bd(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 jb(a)&&!n.includes(a.host)})?!1:Ls(n,t,null,i)||Vb(n,t,i)||Wb(n,t)||Hl(n,t)}),this.addRule("shape.create",function(e){return Bd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ls(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Zb(n,t)})},Dn.prototype.canConnectMessageFlow=Kb,Dn.prototype.canConnectSequenceFlow=Xb,Dn.prototype.canConnectDataAssociation=Nd,Dn.prototype.canConnectAssociation=qb,Dn.prototype.canConnectCompensationAssociation=Yb,Dn.prototype.canMove=Wb,Dn.prototype.canAttach=Ls,Dn.prototype.canReplace=Vb,Dn.prototype.canDrop=Aa,Dn.prototype.canInsert=Hl,Dn.prototype.canCreate=Bd,Dn.prototype.canConnect=jl,Dn.prototype.canResize=Ub,Dn.prototype.canCopy=Zb;function Jk(e){return Dd(e)?null:nt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Dd(e){return!e||et(e)}function Lb(e){do{if(M(e,"bpmn:Process"))return de(e);if(M(e,"bpmn:Participant"))return de(e).processRef||de(e)}while(e=e.parent)}function Ld(e){return M(e,"bpmn:TextAnnotation")}function Id(e){return M(e,"bpmn:Group")&&!e.labelTarget}function Ib(e){return M(e,"bpmn:BoundaryEvent")&&to(e,"bpmn:CompensateEventDefinition")}function Fl(e){return de(e).isForCompensation}function e2(e,t){var n=Lb(e),i=Lb(t);return n===i}function t2(e){return M(e,"bpmn:InteractionNode")&&!M(e,"bpmn:BoundaryEvent")&&(!M(e,"bpmn:Event")||M(e,"bpmn:ThrowEvent")&&$b(e,"bpmn:MessageEventDefinition"))}function n2(e){return M(e,"bpmn:InteractionNode")&&!Fl(e)&&(!M(e,"bpmn:Event")||M(e,"bpmn:CatchEvent")&&$b(e,"bpmn:MessageEventDefinition"))&&!(M(e,"bpmn:BoundaryEvent")&&!to(e,"bpmn:MessageEventDefinition"))}function Bb(e){for(var t=e;t=t.parent;){if(M(t,"bpmn:FlowElementsContainer"))return de(t);if(M(t,"bpmn:Participant"))return de(t).processRef}return null}function Nb(e,t){var n=Bb(e),i=Bb(t);return n===i}function to(e,t){var n=de(e);return!!Ot(n.eventDefinitions||[],function(i){return M(i,t)})}function $b(e,t){var n=de(e);return(n.eventDefinitions||[]).every(function(i){return M(i,t)})}function i2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:EndEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateThrowEvent")&&to(e,"bpmn:LinkEventDefinition"))&&!Ib(e)&&!Fl(e)}function o2(e){return M(e,"bpmn:FlowNode")&&!M(e,"bpmn:StartEvent")&&!M(e,"bpmn:BoundaryEvent")&&!jn(e)&&!(M(e,"bpmn:IntermediateCatchEvent")&&to(e,"bpmn:LinkEventDefinition"))&&!Fl(e)}function r2(e){return M(e,"bpmn:ReceiveTask")||M(e,"bpmn:IntermediateCatchEvent")&&(to(e,"bpmn:MessageEventDefinition")||to(e,"bpmn:TimerEventDefinition")||to(e,"bpmn:ConditionalEventDefinition")||to(e,"bpmn:SignalEventDefinition"))}function a2(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Fb(e,t){var n=a2(t);return n.indexOf(e)!==-1}function jl(e,t,n){if(Dd(e)||Dd(t))return null;if(!M(n,"bpmn:DataAssociation")){if(Kb(e,t))return{type:"bpmn:MessageFlow"};if(Xb(e,t))return{type:"bpmn:SequenceFlow"}}var i=Nd(e,t);return i||(Yb(e,t)?{type:"bpmn:Association",associationDirection:"One"}:qb(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Aa(e,t){return et(e)||Id(e)?!0:M(t,"bpmn:Participant")&&!ct(t)?!1:M(e,"bpmn:Participant")?M(t,"bpmn:Process")||M(t,"bpmn:Collaboration"):nt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:M(e,"bpmn:Lane")?M(t,"bpmn:Participant")||M(t,"bpmn:Lane"):M(e,"bpmn:BoundaryEvent")&&!s2(e)?!1:M(e,"bpmn:FlowElement")&&!M(e,"bpmn:DataStoreReference")?M(t,"bpmn:FlowElementsContainer")?ct(t):nt(t,["bpmn:Participant","bpmn:Lane"]):M(e,"bpmn:DataStoreReference")&&M(t,"bpmn:Collaboration")?ko(de(t).get("participants"),function(n){return!!n.get("processRef")}):nt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?nt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):M(e,"bpmn:MessageFlow")?M(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function s2(e){return de(e).cancelActivity&&(Hb(e)||zb(e))}function jb(e){return!et(e)&&M(e,"bpmn:BoundaryEvent")}function c2(e){return M(e,"bpmn:Lane")}function l2(e){return jb(e)||M(e,"bpmn:IntermediateThrowEvent")&&Hb(e)?!0:M(e,"bpmn:IntermediateCatchEvent")&&zb(e)}function Hb(e){var t=de(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function zb(e){return Gb(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Gb(e,t){return t.some(function(n){return to(e,n)})}function u2(e){return M(e,"bpmn:ReceiveTask")&&Ot(e.incoming,function(t){return M(t.source,"bpmn:EventBasedGateway")})}function Ls(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return et(o)||!l2(o)||jn(t)||!M(t,"bpmn:Activity")||Fl(t)||i&&!Db(i,t)||u2(t)?!1:"attach"}function Vb(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(o){jn(t)||M(o,"bpmn:StartEvent")&&o.type!=="label"&&Aa(o,t)&&(bP(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(xP(o)||_P(o)||wP(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),Gb(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&M(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),M(t,"bpmn:Transaction")||to(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(M(o,"bpmn:EndEvent")&&Aa(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),M(o,"bpmn:BoundaryEvent")&&Ls(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Wb(e,t){return ko(e,c2)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Aa(n,t)})}function Bd(e,t,n,i){return t?et(e)||Id(e)?!0:Aa(e,t)||Hl(e,t):!1}function Ub(e,t,n){return M(e,"bpmn:SubProcess")?ct(e)&&(!t||t.width>=100&&t.height>=80):M(e,"bpmn:Lane")||M(e,"bpmn:Participant")?!0:Ld(e)?n?n==="e"||n==="w":!0:Id(e)?!0:et(e)?n?n==="e"||n==="w":!0:!1}function p2(e,t){var n=Ld(e),i=Ld(t);return(n||i)&&n!==i}function qb(e,t){return Fb(t,e)||Fb(e,t)?!1:p2(e,t)?!0:!!Nd(e,t)}function Yb(e,t){return Nb(e,t)&&Ib(e)&&M(t,"bpmn:Activity")&&!d2(t,e)&&!jn(t)}function Kb(e,t){return Jb(e)&&!Jb(t)?!1:t2(e)&&n2(t)&&!e2(e,t)}function Xb(e,t){return i2(e)&&o2(t)&&Nb(e,t)&&!(M(e,"bpmn:EventBasedGateway")&&!r2(t))}function Nd(e,t){return nt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&nt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:nt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&nt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Hl(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:nt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!et(t)&&M(e,"bpmn:FlowNode")&&!M(e,"bpmn:BoundaryEvent")&&Aa(e,t.parent)}function $d(e,t){return e&&t&&e.indexOf(t)!==-1}function Zb(e,t){return et(t)?!0:!(M(t,"bpmn:Lane")&&!$d(e,t.parent)||M(t,"bpmn:MessageFlow")&&!f2(e,t))}function f2(e,t){var n=Qb(t.source),i=Qb(t.target);return $d(e,n)&&$d(e,i)}function Qb(e){for(;e;e=e.parent)if(M(e,"bpmn:Participant"))return e;return null}function Jb(e){return _a(e,"bpmn:Process")||_a(e,"bpmn:Collaboration")}function d2(e,t){return e.attachers.includes(t)}const h2={__depends__:[eo],__init__:["bpmnRules"],bpmnRules:["type",Dn]};var g2=2e3;function ex(e,t){e.on("saveXML.start",g2,n);function n(){var i=t.getRootElements();z(i,function(o){var r=dt(o),a,s;a=ys([o]),a=it(a,function(c){return c!==o&&!c.labelTarget}),s=Bn(a,dt),r.set("planeElement",s)})}}ex.$inject=["eventBus","canvas"];const m2={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",ex]};function zl(e){pe.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)})}zl.prototype.getOrdering=function(e,t){return null},Ce(zl,pe);function Fd(e,t){zl.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=Ot(n,function(c){return nt(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&&!nt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||M(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=Ag(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}}}Fd.$inject=["eventBus","canvas"],Ce(Fd,zl);const y2={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Fd]};function Is(){}Is.prototype.get=function(){return this._data},Is.prototype.set=function(e){this._data=e},Is.prototype.clear=function(){var e=this._data;return delete this._data,e},Is.prototype.isEmpty=function(){return!this._data};const v2={clipboard:["type",Is]};var tx=1500;function nx(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",tx,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",tx,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=Ar(a),c=document.elementFromPoint(s.x,s.y),b2(c)}}nx.$inject=["elementRegistry","eventBus","injector"];function b2(e){return Er(e,"svg, .djs-element",!0)}const x2={__init__:["hoverFix"],hoverFix:["type",nx]};function _2(e){return!0}function Gl(e){return Ko(e)||Ck(e)}var ix=500;function ox(e,t,n){var i=this;function o(T,L,$){if(!s(T,L)){var N,H,X;$?H=t.getGraphics($):(N=L.delegateTarget||L.target,N&&(H=N,$=t.get(H))),!(!H||!$)&&(X=e.fire(T,{element:$,gfx:H,originalEvent:L}),X===!1&&(L.stopPropagation(),L.preventDefault()))}}var r={};function a(T){return r[T]}function s(T,L){var $=l[T]||Ko;return!$(L)}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":_2,"element.mousedown":Gl,"element.mouseup":Gl,"element.click":Gl,"element.dblclick":Gl};function u(T,L,$){var N=c[T];if(!N)throw new Error("unmapped DOM event name <"+T+">");return o(N,L,$)}var p="svg, .djs-element";function f(T,L,$,N){var H=r[$]=function(X){o($,X)};N&&(l[$]=N),H.$delegate=ti.bind(T,p,L,H)}function d(T,L,$){var N=a($);N&&ti.unbind(T,L,N.$delegate)}function g(T){z(c,function(L,$){f(T,$,L)})}function h(T){z(c,function(L,$){d(T,$,L)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var L=T.element,$=T.gfx;e.fire("interactionEvents.createHit",{element:L,gfx:$})}),e.on(["shape.changed","connection.changed"],ix,function(T){var L=T.element,$=T.gfx;e.fire("interactionEvents.updateHit",{element:L,gfx:$})}),e.on("interactionEvents.createHit",ix,function(T){var L=T.element,$=T.gfx;i.createDefaultHit(L,$)}),e.on("interactionEvents.updateHit",function(T){var L=T.element,$=T.gfx;i.updateDefaultHit(L,$)});var m=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),b=E("djs-hit djs-hit-all"),y=E("djs-hit djs-hit-no-move"),v={all:b,"click-stroke":_,stroke:m,"no-move":y};function E(T,L){return L=V({stroke:"white",strokeWidth:15},L||{}),n.cls(T,["no-fill","no-border"],L)}function w(T,L){var $=v[L];if(!$)throw new Error("invalid hit type <"+L+">");return we(T,$),T}function P(T,L){ze(T,L)}this.removeHits=function(T){var L=fs(".djs-hit",T);z(L,on)},this.createDefaultHit=function(T,L){var $=T.waypoints,N=T.isFrame,H;return $?this.createWaypointsHit(L,$):(H=N?"stroke":"all",this.createBoxHit(L,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,L){var $=ms(L);return w($,"stroke"),P(T,$),$},this.createBoxHit=function(T,L,$){$=V({x:0,y:0},$);var N=Oe("rect");return w(N,L),we(N,$),P(T,N),N},this.updateDefaultHit=function(T,L){var $=Et(".djs-hit",L);if($)return T.waypoints?Rf($,T.waypoints):we($,{width:T.width,height:T.height}),$},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}ox.$inject=["eventBus","elementRegistry","styles"];const Vl={__init__:["interactionEvents"],interactionEvents:["type",ox]};function Pa(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)})}Pa.$inject=["eventBus","canvas"],Pa.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()})}},Pa.prototype.get=function(){return Array.from(this._selectedElements)},Pa.prototype.isSelected=function(e){return this._selectedElements.has(e)},Pa.prototype.select=function(e,t){var n=this.get();$e(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?z(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var rx="hover",ax="selected";function sx(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,rx)}),t.on("element.out",function(o){i(o.element,rx)}),t.on("selection.changed",function(o){function r(l){i(l,ax)}function a(l){n(l,ax)}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)})}sx.$inject=["canvas","eventBus"];function cx(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;$e(l)?t.select(l):t.select(s.filter(w2))}}),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=Ot(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(Ko(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=Nl(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}cx.$inject=["eventBus","selection","canvas","elementRegistry"];function w2(e){return!e.hidden}const Ri={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Vl],selection:["type",Pa],selectionVisuals:["type",sx],selectionBehavior:["type",cx]};var E2=/^djs-cursor-.*$/;function Wl(e){var t=Ct(document.body);t.removeMatching(E2),e&&t.add("djs-cursor-"+e)}function lx(){Wl(null)}var S2=5e3;function ux(e,t){t=t||"element.click";function n(){return!1}return e.once(t,S2,n),function(){e.off(t,n)}}var R2=["c","C"],C2=["v","V"],M2=["d","D"],A2=["x","X"],P2=["y","Y"],px=["z","Z"];function T2(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function oi(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function hn(e,t){return e=$e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function jd(e){return e.shiftKey}function k2(e){return oi(e)&&hn(R2,e)}function O2(e){return oi(e)&&hn(C2,e)}function D2(e){return oi(e)&&hn(M2,e)}function L2(e){return oi(e)&&hn(A2,e)}function I2(e){return oi(e)&&!jd(e)&&hn(px,e)}function B2(e){return oi(e)&&(hn(P2,e)||hn(px,e)&&jd(e))}var Ta=Math.round,fx="djs-drag-active";function Tr(e){e.preventDefault()}function N2(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function $2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function dx(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(y){var v=t.viewbox(),E=t._container.getBoundingClientRect();return{x:v.x+(y.x-E.left)/v.scale,y:v.y+(y.y-E.top)/v.scale}}function s(y,v){v=v||r;var E=e.createEvent(V({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+y,E)===!1?!1:e.fire(v.prefix+"."+y,E)}function c(y){var v=y.filter(function(E){return i.get(E.id)});v.length&&n.select(v)}function l(y,v){var E=r.payload,w=r.displacement,P=r.globalStart,T=Ar(y),L=Ni(T,P),$=r.localStart,N=a(T),H=Ni(N,$);if(!r.active&&(v||$2(L)>r.threshold)){if(V(E,{x:Ta($.x+w.x),y:Ta($.y+w.y),dx:0,dy:0},{originalEvent:y}),s("start")===!1)return m();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&Wl(r.cursor),t.addMarker(t.getRootElement(),fx)}bd(y),r.active&&(V(E,{x:Ta(N.x+w.x),y:Ta(N.y+w.y),dx:Ta(H.x),dy:Ta(H.y)},{originalEvent:y}),s("move"))}function u(y){var v,E=!0;r.active&&(y&&(r.payload.originalEvent=y,bd(y)),E=s("end")),E===!1&&s("rejected"),v=_(E!==!0),s("ended",v)}function p(y){hn("Escape",y)&&(Tr(y),m())}function f(y){var v;r.active&&(v=ux(e),setTimeout(v,400),Tr(y)),u(y)}function d(y){l(y)}function g(y){var v=r.payload;v.hoverGfx=y.gfx,v.hover=y.element,s("hover")}function h(y){s("out");var v=r.payload;v.hoverGfx=null,v.hover=null}function m(y){var v;if(r){var E=r.active;E&&s("cancel"),v=_(y),E&&s("canceled",v)}}function _(y){var v,E;s("cleanup"),lx(),r.trapClick?E=f:E=u,Ie.unbind(document,"mousemove",l),Ie.unbind(document,"dragstart",Tr),Ie.unbind(document,"selectstart",Tr),Ie.unbind(document,"mousedown",E,!0),Ie.unbind(document,"mouseup",E,!0),Ie.unbind(document,"keyup",p),Ie.unbind(document,"touchstart",d,!0),Ie.unbind(document,"touchcancel",m,!0),Ie.unbind(document,"touchmove",l,!0),Ie.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),fx);var w=r.payload.previousSelection;return y!==!1&&w&&!n.get().length&&c(w),v=r,r=null,v}function b(y,v,E,w){r&&m(!1),typeof v=="string"&&(w=E,E=v,v=null),w=V({},o,w||{});var P=w.data||{},T,L,$,N,H;if(w.trapClick?N=f:N=u,y?(T=Ma(y)||y,L=Ar(y),bd(y),T.type==="dragstart"&&Tr(T)):(T=null,L={x:0,y:0}),$=a(L),v||(v=$),H=N2(T),r=V({prefix:E,data:P,payload:{},globalStart:L,displacement:Ni(v,$),localStart:$,isTouch:H},w),w.manual||(H?(Ie.bind(document,"touchstart",d,!0),Ie.bind(document,"touchcancel",m,!0),Ie.bind(document,"touchmove",l,!0),Ie.bind(document,"touchend",u,!0)):(Ie.bind(document,"mousemove",l),Ie.bind(document,"dragstart",Tr),Ie.bind(document,"selectstart",Tr),Ie.bind(document,"mousedown",N,!0),Ie.bind(document,"mouseup",N,!0)),Ie.bind(document,"keyup",p),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return m(),!1;w.autoActivate&&l(y,!0)}e.on("diagram.destroy",m),this.init=b,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=m,this.context=function(){return r},this.setOptions=function(y){V(o,y)}}dx.$inject=["eventBus","canvas","selection","elementRegistry"];const xo={__depends__:[x2,Ri],dragging:["type",dx]};function kr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}kr.prototype.next=function(){return this._prefix+ ++this._counter};const F2=new kr("ps");var j2=["marker-start","marker-mid","marker-end"],H2=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Xo(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Xo.$inject=["elementRegistry","eventBus","canvas","styles"],Xo.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")},Xo.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Xo.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=yf(n);return this._cloneMarkers(Go(o),i),we(o,this._styles.cls(i,[])),ze(t,o),we(o,"data-preview-support-element-id",e.id),o},Xo.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ze(t,n),we(n,"data-preview-support-element-id",e.id),n},Xo.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),W2(e)&&j2.forEach(function(o){if(we(e,o)){var r=z2(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},Xo.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,F2.next()].join("-"),a=Et("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||yf(n);s.id=r,st(s).add(o);var c=Et(":scope > defs",e);c||(c=Oe("defs"),ze(e,c)),ze(c,s);var l=V2(s.id);we(t,i,l)};function z2(e,t,n){var i=G2(we(e,t));return Et("marker#"+i,n||document)}function G2(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function V2(e){return"url(#"+e+")"}function W2(e){return H2.indexOf(e.nodeName)!==-1}const ka={__init__:["previewSupport"],previewSupport:["type",Xo]};var U2="drop-ok",hx="drop-not-ok",gx="attach-ok",mx="new-parent",yx="create",q2=2e3;function vx(e,t,n,i,o){function r(c,l,u,p,f){if(!l)return!1;c=it(c,function(b){var y=b.labelTarget;return!b.parent&&!(et(b)&&c.indexOf(y)!==-1)});var d=Ot(c,function(b){return!Pt(b)}),g=!1,h=!1,m=!1;xx(c)&&(g=o.allowed("shape.attach",{position:u,shape:d,target:l})),g||(xx(c)?m=o.allowed("shape.create",{position:u,shape:d,source:p,target:l}):m=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=f.connectionTarget;return m||g?(d&&p&&(h=o.allowed("connection.create",{source:_===p?d:p,target:_===p?p:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):m===null||g===null?null:!1}function a(c,l){[gx,U2,hx,mx].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,f=l.source,d=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}bx(c);var g={x:c.x,y:c.y},h=l.canExecute=p&&r(u,p,g,f,d);p&&h!==null&&(l.target=p,h&&h.attach?a(p,gx):a(p,h?mx:hx))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,f=l.elements,d=l.target,g=l.canExecute,h=g&&g.attach,m=g&&g.connect,_=l.hints||{};if(g===!1||!d)return!1;bx(c);var b={x:c.x,y:c.y};m?p=i.appendShape(u,p,b,d,{attach:h,connection:m===!0?{}:m,connectionTarget:_.connectionTarget}):(f=i.createElements(f,b,d,V({},_,{attach:h})),p=Ot(f,function(y){return!Pt(y)})),V(l,{elements:f,shape:p}),V(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===yx&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],q2,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){$e(l)||(l=[l]);var p=Ot(l,function(g){return!Pt(g)});if(p){u=V({elements:l,hints:{},shape:p},u||{}),z(l,function(g){Fe(g.x)||(g.x=0),Fe(g.y)||(g.y=0)});var f=it(l,function(g){return!g.hidden}),d=rn(f);z(l,function(g){Pt(g)&&(g.waypoints=Bn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,yx,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}vx.$inject=["canvas","dragging","eventBus","modeling","rules"];function bx(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 xx(e){return e&&e.length===1&&!Pt(e[0])}var Y2=750;function _x(e,t,n,i,o){function r(a){var s=Oe("g");we(s,o.cls("djs-drag-group",["no-events"]));var c=Oe("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(Go(u),l)):(u=n._createContainer("shape",c),n.drawShape(Go(u),l),On(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",Y2,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(),ze(p,u)),On(u,a.x,a.y)):on(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&on(c)})}_x.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Ul={__depends__:[xo,ka,eo,Ri],__init__:["create","createPreview"],create:["type",vx],createPreview:["type",_x]};function Hd(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)})}Hd.$inject=["eventBus"],Hd.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||K2(0,0)};function K2(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 Bs={__init__:["mouse"],mouse:["type",Hd]};var wx=2e3;function ri(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),X2(u)&&(l.priority=2,l.host=u.host.id),Pt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=Z2(u)),et(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(f){Fe(u[f])&&(l[f]=u[f])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",wx,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",wx,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;V(l,{createElementsBehavior:!1})})}ri.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ri.prototype.copy=function(e,t={}){var n,i;return $e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree($e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ri.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})}}},ri.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ri.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},ri.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},ri.prototype._paste=function(e,t,n,i){z(e,function(r){Fe(r.x)||(r.x=0),Fe(r.y)||(r.y=0)});var o=rn(e);return z(e,function(r){Pt(r)&&(r.waypoints=Bn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),V(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,V({},i))},ri.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return z(e,function(r,a){r=zi(r,"priority"),z(r,function(s){var c=V({},Gi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Pt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(et(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},ri.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Gi(e,["id"]));return t},ri.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Gi(e,["id"]));return t},ri.prototype.createShape=function(e){var t=this._elementFactory.createShape(Gi(e,["id"]));return t},ri.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Pt(e)&&(!n.has(e.source)||!n.has(e.target))||et(e)&&!n.has(e.labelTarget))},ri.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=ol(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=r.get(p);if(!d){var g={element:p,depth:f};o.push(g),r.set(p,g);return}if(d.depth<f){o=l(d,o);var h={element:d.element,depth:f};o.push(h),r.set(p,h)}}function l(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Rr(a,function(p,f,d){if(et(p))return;z(p.labels,function(m){c(m,d)});function g(m){m&&m.length&&z(m,function(_){z(_.labels,function(b){c(b,d)}),c(_,d)})}z([p.attachers,p.incoming,p.outgoing],g),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=Bn(o,function(p){return p.element});var u=new Set(e);return o=Bn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=zi(o,function(p){return p.descriptor.priority}),e=Bn(o,function(p){return p.element}),z(o,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,u)){Sx(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Sx(p.element,e),u.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function X2(e){return!!e.host}function Z2(e){return Bn(e.waypoints,function(t){return t=Ex(t),t.original&&(t.original=Ex(t.original)),t})}function Ex(e){return V({},e)}function Sx(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const Q2={__depends__:[v2,Ul,Bs,eo],__init__:["copyPaste"],copyPaste:["type",ri]};function zd(e,t,n){$e(n)||(n=[n]),z(n,function(i){mr(e[i])||(t[i]=e[i])})}var Gd=750;function Rx(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Gd,function(c){var l=c.descriptor,u=c.element,p=de(u);if(et(u))return l;var f=l.businessObject=i(p,!0),d=l.di=i(dt(u),!0);d.bpmnElement=f,zd(f,l,"name"),zd(d,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=de(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(de(c).attachedToRef=de(l[c.host])),Gi(u,Jn(u,function(f,d,g){var h=d.element,m=d.property;return g===c.id&&(h.set(m,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,f=u.di;if(et(u)){u.businessObject=de(l[u.labelTarget]),u.di=dt(l[u.labelTarget]);return}p=u.businessObject=i(p),f=u.di=i(f),f.bpmnElement=p,zd(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",Gd,function(c){var l=c.descriptor,u=c.element;if(M(u,"bpmn:Participant")){var p=de(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;M(l,"bpmn:SubProcess")&&z(Es(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",Gd,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Rx.$inject=["bpmnFactory","eventBus","moddleCopy"];const J2=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],eO=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ns(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 zi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=fn(o)&&o.$descriptor;if(a&&eO.includes(a))return r;if(a&&J2.includes(a)||a&&s&&!Ot(s.properties,Jr({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(M(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Ns.$inject=["eventBus","bpmnFactory","moddle"],Ns.prototype.copyElement=function(e,t,n,i=!1){n&&!$e(n)&&(n=[n]),n=n||Vd(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||($e(o)&&(n=o),z(n,r=>{let a;Qn(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!pn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Ns.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 fn(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):$e(e)?Jn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):fn(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},Ns.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 Vd(e,t){return Jn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Cx={__depends__:[Q2],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Rx],moddleCopy:["type",Ns]};var Mx=Math.round;function Wd(e,t){this._modeling=e,this._eventBus=t}Wd.$inject=["modeling","eventBus"],Wd.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=Mx(s+r/2),u=Mx(c+a/2),p=i.replaceShape(e,V({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Ax(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}Ax.$inject=["selection","eventBus"];const tO={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ax],replace:["type",Wd]};function nO(e,t,n){$e(n)||(n=[n]),z(n,function(i){mr(e[i])||(t[i]=e[i])})}var iO=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function oO(e,t){var n=e&&Qn(e,"collapsed")?e.collapsed:!ct(e),i;return t&&(Qn(t,"collapsed")||Qn(t,"isExpanded"))?i=Qn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Px(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(ql(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&oO(s,c))return i.toggleCollapse(s),s;var f=e.create(u),d={type:u,businessObject:f};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),nO(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Vd(p.$descriptor),h=Vd(f.$descriptor,!0),m=rO(g,h);V(f,Ii(c,iO));var _=it(m,function(v){return v==="eventDefinitions"?Tx(s,c.eventDefinitionType):v==="loopCharacteristics"?!jn(f):Qn(f,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!jn(f):!0});if(f=n.copyElement(p,f,_),c.eventDefinitionType&&(Tx(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),M(p,"bpmn:Activity")){if(ql(p))d.isExpanded=ct(s);else if(c&&Qn(c,"isExpanded")){d.isExpanded=c.isExpanded;var b=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=b.width,d.height=b.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}ct(s)&&!M(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(ql(p)&&!ql(f)&&(l.moveChildren=!1),M(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var y=xn(s);dt(s).isHorizontal||(dt(d).isHorizontal=y),d.width=y?s.width:t.getDefaultSize(d).width,d.height=y?t.getDefaultSize(d).height:s.height}return r.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,nt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&nt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!M(p,"bpmn:BoundaryEvent")&&M(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),o.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Px.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function ql(e){return M(e,"bpmn:SubProcess")}function Tx(e,t){var n=de(e);return t&&n.get("eventDefinitions").some(function(i){return M(i,t)})}function rO(e,t){return e.filter(function(n){return t.includes(n)})}const kx={__depends__:[Cx,tO,Ri],bpmnReplace:["type",Px]};var aO=250;function Or(e){this._eventBus=e,this._tools=[],this._active=null}Or.$inject=["eventBus"],Or.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)},Or.prototype.isActive=function(e){return e&&this._active===e},Or.prototype.length=function(e){return this._tools.length},Or.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Or.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),z(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,aO,function(o){this._active&&(sO(o)||this.setActive(null))},this)};function sO(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Er(t,'.group[data-group="tools"]')}const Yl={__depends__:[xo],__init__:["toolManager"],toolManager:["type",Or]};function cO(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 lO(e,t){var n=[],i=new Set(e);z(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;z(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 uO(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 Ud=Math.abs,pO=Math.round,_o={x:"width",y:"height"},Ox="crosshair",Zo={n:"top",w:"left",s:"bottom",e:"right"},fO=1500,Kl={n:"s",w:"e",s:"n",e:"w"},Xl=20;function Ci(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",fO,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Lx(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,f=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){Lx(c);var h={x:0,y:0};h[u]=pO(c["d"+u]),s.makeSpace(f,d,h,p,g),n.once("spaceTool.ended",function(m){s.activateSelection(m.originalEvent,!0,!0)})}})}Ci.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Ci.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ox,data:{context:{reactivate:n}},trapClick:!1})},Ci.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ox,data:{context:{}}})},Ci.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},Ci.prototype.init=function(e,t){var n=Ud(e.dx)>Ud(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Ud(i)<5)return!1;i<0&&(i*=-1),Ds(e)&&(i*=-1);var r=cO(n,i),a=this._canvas.getRootElement();!Nl(e)&&e.hover&&(a=e.hover);var s=[...ys(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=dO(c,n,r,o,l);return V(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),Wl("resize-"+(n==="x"?"ew":"ns")),!0},Ci.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(d){s.has(d)||(s.add(d),r.push(d));var g=d.label;g&&!s.has(g)&&(s.add(g),r.push(g))}function f(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||et(d))){if(Pt(d)){u.push(d);return}var g=d[t],h=g+d[_o[t]];if(hO(d)&&(n>0&&je(d)[t]>i||n<0&&je(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){p(d);return}if(g<i&&h>i&&o.allowed("shape.resize",{shape:d})){f(d);return}}}),z(r,function(d){var g=d.attachers;g&&z(g,function(h){p(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&p(d)}),z(u,function(d){var g=d.source,h=d.target,m=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&m&&p(m)}),{movingShapes:r,resizingShapes:a}},Ci.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ci.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Dx(e){return{top:e.top-Xl,right:e.right+Xl,bottom:e.bottom+Xl,left:e.left-Xl}}function Lx(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),Fe(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function dO(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 z(a,function(f){var d=f.attachers,g=f.children,h=Be(f),m=it(g,function(H){return!Pt(H)&&!et(H)&&!u.has(H)&&!p.has(H)}),_=it(g,function(H){return!Pt(H)&&!et(H)&&u.has(H)}),b,y,v,E=[],w=[],P,T,L,$;m.length&&(y=Dx(Be(rn(m))),b=i-h[Zo[n]]+y[Zo[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,b):b:n==="w"?s.right=l=Fe(l)?Math.min(l,b):b:n==="s"?s.top=c=Fe(c)?Math.max(c,b):b:n==="e"&&(s.left=c=Fe(c)?Math.max(c,b):b)),_.length&&(v=Dx(Be(rn(_))),b=i-v[Zo[Kl[n]]]+h[Zo[Kl[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,b):b:n==="w"?s.right=l=Fe(l)?Math.min(l,b):b:n==="s"?s.top=c=Fe(c)?Math.max(c,b):b:n==="e"&&(s.left=c=Fe(c)?Math.max(c,b):b)),d&&d.length&&(d.forEach(function(H){u.has(H)?E.push(H):w.push(H)}),E.length&&(P=Be(rn(E.map(je))),T=h[Zo[Kl[n]]]-(P[Zo[Kl[n]]]-i)),w.length&&(L=Be(rn(w.map(je))),$=L[Zo[n]]-(h[Zo[n]]-i)),n==="n"?(b=Math.min(T||1/0,$||1/0),s.bottom=l=Fe(l)?Math.min(l,b):b):n==="w"?(b=Math.min(T||1/0,$||1/0),s.right=l=Fe(l)?Math.min(l,b):b):n==="s"?(b=Math.max(T||-1/0,$||-1/0),s.top=c=Fe(c)?Math.max(c,b):b):n==="e"&&(b=Math.max(T||-1/0,$||-1/0),s.left=c=Fe(c)?Math.max(c,b):b));var N=o&&o[f.id];N&&(n==="n"?(b=i+f[_o[t]]-N[_o[t]],s.bottom=l=Fe(l)?Math.min(l,b):b):n==="w"?(b=i+f[_o[t]]-N[_o[t]],s.right=l=Fe(l)?Math.min(l,b):b):n==="s"?(b=i-f[_o[t]]+N[_o[t]],s.top=c=Fe(c)?Math.max(c,b):b):n==="e"&&(b=i-f[_o[t]]+N[_o[t]],s.left=c=Fe(c)?Math.max(c,b):b))}),s}}function hO(e){return!!e.host}var qd="djs-dragging",Ix="djs-resizing",gO=250,Zl=Math.max;function Bx(e,t,n,i,o){function r(a,s){z(a,function(c){o.addDragger(c,s),n.addMarker(c,qd)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Oe("g");we(u,i.cls("djs-crosshair-group",["no-events"])),ze(s,u);var p=Oe("path");we(p,"d",l.x),st(p).add("djs-crosshair"),ze(u,p);var f=Oe("path");we(f,"d",l.y),st(f).add("djs-crosshair"),ze(u,f),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;On(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&on(c)}),e.on("spaceTool.move",gO,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Oe("path"),we(c,"d","M0,0 L0,0"),st(c).add("djs-crosshair"),ze(f,c),s.line=c;var d=Oe("g");we(d,i.cls("djs-drag-group",["no-events"])),ze(n.getActiveLayer(),d),r(u,d);var g=new Set(u);z(p,function(w){g.add(w)});var h=new Set,m=s.movingConnections=[];g.forEach(function(w){z(w.outgoing,function(P){h.has(P)||!Pt(P)||!g.has(P.target)||(h.add(P),m.push(P))})}),r(m,d),s.dragGroup=d}if(!s.frameGroup){var _=Oe("g");we(_,i.cls("djs-frame-group",["no-events"])),ze(n.getActiveLayer(),_);var b=[];z(p,function(w){var P=o.addFrame(w,_),T=P.getBBox();b.push({element:P,initialBounds:T}),n.addMarker(w,Ix)}),s.frameGroup=_,s.frames=b}var y={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};we(c,{d:y[l]});var v={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[v[s.axis]]=0,On(s.dragGroup,E.x,E.y),z(s.frames,function(w){var P=w.element,T=w.initialBounds,L,$;s.direction==="e"?we(P,{width:Zl(T.width+E.x,5)}):(L=Zl(T.width-E.x,5),we(P,{width:L,x:T.x+T.width-L})),s.direction==="s"?we(P,{height:Zl(T.height+E.y,5)}):($=Zl(T.height-E.y,5),we(P,{height:$,y:T.y+T.height-$}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;z(c,function(g){n.removeMarker(g,qd)}),z(l,function(g){n.removeMarker(g,qd)}),f&&(on(p),on(f)),z(u,function(g){n.removeMarker(g,Ix)}),d&&on(d)})}Bx.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const mO={__init__:["spaceToolPreview"],__depends__:[xo,eo,Yl,ka,Bs],spaceTool:["type",Ci],spaceToolPreview:["type",Bx]};function Ql(e,t){e.invoke(Ci,this),this._canvas=t}Ql.$inject=["injector","canvas"],Ce(Ql,Ci),Ql.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=Zr(ha(o.children.filter(l=>M(l,"bpmn:Artifact")),rn(r))));const s=[...e,...a];var c=Ci.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(M(l,"bpmn:TextAnnotation")||yO(l)&&(t==="y"&&xn(l)||t==="x"&&!xn(l)))}),c};function yO(e){return M(e,"bpmn:Participant")&&!de(e).processRef}const Nx={__depends__:[mO],spaceTool:["type",Ql]};function Gt(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)}Gt.$inject=["eventBus","injector"],Gt.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()},Gt.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},Gt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Gt.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()}},Gt.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()}},Gt.prototype.register=function(e,t){this._setHandler(e,t)},Gt.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)},Gt.prototype.canUndo=function(){return!!this._getUndoAction()},Gt.prototype.canRedo=function(){return!!this._getRedoAction()},Gt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Gt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Gt.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)})},Gt.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},Gt.prototype._createId=function(){return this._uid++},Gt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Gt.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()},Gt.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)},Gt.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:Pg("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Gt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=$e(e)?e:[e],t.dirty=t.dirty.concat(e))},Gt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Gt.prototype._revertedAction=function(e){this._stackIdx--},Gt.prototype._getHandler=function(e){return this._handlerMap[e]},Gt.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 vO={commandStack:["type",Gt]};function Qo(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 bO=250,$x=1400;function Yd(e,t,n){pe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",$x,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=Fx(a),r.validatedShapes=Fx(s)}),i&&t.on("shape.move.start",bO,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",$x,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];z(s,function(l){z(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(o){var r=o.context,a=r.connection||r.shape;Qo(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=Mf(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&&(en(s.labels,a,c),a.labelTarget=s)})}Ce(Yd,pe),Yd.$inject=["injector","eventBus","modeling"];function Fx(e){var t=new Set(e);return it(e,function(n){return!t.has(n.labelTarget)})}const xO={__init__:["labelSupport"],labelSupport:["type",Yd]};var _O=251,jx=1401,Hx="attach-ok";function Kd(e,t,n,i,o){pe.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",jx,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=wO(c),s.validatedShapes=EO(l)}),r&&t.on("shape.move.start",_O,function(a){var s=a.context,c=s.shapes,l=Xd(c);z(l,function(u){r.makeDraggable(s,u,!0),z(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,Hx),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Hx)}))}}),this.preExecuted("elements.move",jx,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Xd(l);z(u,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=it(c,function(p){var f=p.host;return SO(p)&&!RO(c,f)}),z(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),z(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;Qo(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&&z(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,f=s.hints||{};f.attachSupport!==!1&&z(p,function(d){var g=rb(d,l,u);o.moveShape(d,g,d.parent),z(d.labels,function(h){o.moveShape(h,g,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Qo(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ce(Kd,pe),Kd.$inject=["injector","eventBus","canvas","rules","modeling"];function Xd(e){return bp(Bn(e,function(t){return t.attachers||[]}))}function wO(e){var t=Xd(e);return z1("id",e,t)}function EO(e){var t=Qr(e,"id");return it(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function SO(e){return!!e.host}function RO(e,t){return e.indexOf(t)!==-1}const CO={__depends__:[eo],__init__:["attachSupport"],attachSupport:["type",Kd]};function zx(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(Ly(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)})}zx.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Zd={__init__:["changeSupport"],changeSupport:["type",zx]};function Mi(e){this._model=e}Mi.$inject=["moddle"],Mi.prototype._needsId=function(e){return nt(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"])},Mi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;M(e,"bpmn:Activity")?t="Activity":M(e,"bpmn:Event")?t="Event":M(e,"bpmn:Gateway")?t="Gateway":nt(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))},Mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},Mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Mi.prototype.createDiWaypoints=function(e){var t=this;return Bn(e,function(n){return t.createDiWaypoint(n)})},Mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ii(e,["x","y"]))},Mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function ai(e,t,n){pe.call(this,e),this._bpmnFactory=t;var i=this;function o(d){var g=d.context,h=g.hints||{},m;!g.cropped&&h.createElementsBehavior!==!1&&(m=g.connection,m.waypoints=n.getCroppedWaypoints(m),g.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function r(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,m=g.parent||g.newParent;i.updateParent(h,m)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],si(a));function s(d){var g=d.context,h=g.oldRoot,m=h.children;z(m,function(_){M(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;M(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],si(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],si(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],si(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],si(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],si(u)),this.executed("connection.reconnect",si(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,b=de(h),y=de(m),v=de(_);b.conditionExpression&&!nt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=b.conditionExpression,delete b.conditionExpression),m!==_&&y.default===b&&(g.oldDefault=y.default,delete y.default)})),this.reverted("connection.reconnect",si(function(d){var g=d.context,h=g.connection,m=g.oldSource,_=g.newSource,b=de(h),y=de(m),v=de(_);g.oldConditionExpression&&(b.conditionExpression=g.oldConditionExpression),g.oldDefault&&(y.default=g.oldDefault,delete v.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],si(p)),this.reverted(["element.updateAttachment"],si(p)),this.executed("element.updateLabel",si(f)),this.reverted("element.updateLabel",si(f));function f(d){const{element:g}=d.context,h=yi(g),m=dt(g),_=m&&m.get("label");Wo(g)||$l(g)||(h&&!_?m.set("label",t.create("bpmndi:BPMNLabel")):!h&&_&&m.set("label",void 0))}}Ce(ai,pe),ai.$inject=["eventBus","bpmnFactory","connectionDocking"],ai.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},ai.prototype.updateParent=function(e,t){if(!et(e)&&!(M(e,"bpmn:DataStoreReference")&&e.parent&&M(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=dt(e),r=n&&n.businessObject,a=dt(n);M(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),M(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),M(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),M(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},ai.prototype.updateBounds=function(e){var t=dt(e),n=AO(e);if(n){var i=Ni(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var o=et(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),V(r,{x:e.x,y:e.y,width:e.width,height:e.height})},ai.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;M(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Xt(i,e)),M(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),en(o,e))}},ai.prototype.updateDiConnection=function(e,t,n){var i=dt(e),o=dt(t),r=dt(n);i.sourceElement&&i.sourceElement.bpmnElement!==de(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==de(n)&&(i.targetElement=n&&r)},ai.prototype.updateDiParent=function(e,t){if(t&&!M(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Xt(n,e),e.$parent=null)}};function MO(e){for(;e&&!M(e,"bpmn:Definitions");)e=e.$parent;return e}ai.prototype.getLaneSet=function(e){var t,n;return M(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(M(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},ai.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((M(e,"bpmn:DataInput")||M(e,"bpmn:DataOutput"))&&(M(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(M(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(M(e,"bpmn:FlowElement")){if(t){if(M(t,"bpmn:Participant"))t=t.processRef;else if(M(t,"bpmn:Lane"))do t=t.$parent.$parent;while(M(t,"bpmn:Lane"))}i="flowElements"}else if(M(e,"bpmn:Artifact")){for(;t&&!M(t,"bpmn:Process")&&!M(t,"bpmn:SubProcess")&&!M(t,"bpmn:Collaboration");)if(M(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(M(e,"bpmn:MessageFlow"))i="messageFlows";else if(M(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=MO(e.$parent||t),e.$parent&&(Xt(r.get("rootElements"),o),o.$parent=null),t&&(en(r.get("rootElements"),o),o.$parent=r))}else M(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":M(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Xt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Xt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},ai.prototype.updateConnectionWaypoints=function(e){var t=dt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},ai.prototype.updateConnection=function(e){var t=e.connection,n=de(t),i=t.source,o=de(i),r=t.target,a=de(t.target),s;if(M(n,"bpmn:DataAssociation"))M(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):M(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=M(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(Xt(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(Xt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,r)},ai.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function si(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;M(i,"bpmn:BaseElement")&&e(t)}}function AO(e){if(M(e,"bpmn:Activity")){var t=dt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Jo(e,t){mo.call(this),this._bpmnFactory=e,this._moddle=t}Ce(Jo,mo),Jo.$inject=["bpmnFactory","moddle"],Jo.prototype._baseCreate=mo.prototype.create,Jo.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Cr,t))}return this.createElement(e,t)},Jo.prototype.createElement=function(e,t){t=V({},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(!TO(o)){var r=V({},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)}M(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=PO(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Qd(o,t,"isExpanded")),nt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Qd(o,t,"isHorizontal")),M(i,"bpmn:SubProcess")&&(t.collapsed=!ct(i,o)),M(i,"bpmn:ExclusiveGateway")&&(Qn(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),pn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),pn(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=V({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},Jo.prototype.getDefaultSize=function(e,t){var n=de(e);if(t=t||dt(e),M(n,"bpmn:SubProcess"))return ct(n,t)?{width:350,height:200}:{width:100,height:80};if(M(n,"bpmn:Task"))return{width:100,height:80};if(M(n,"bpmn:Gateway"))return{width:50,height:50};if(M(n,"bpmn:Event"))return{width:36,height:36};if(M(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return ct(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return M(n,"bpmn:Lane")?{width:400,height:100}:M(n,"bpmn:DataObjectReference")?{width:36,height:50}:M(n,"bpmn:DataStoreReference")?{width:50,height:50}:M(n,"bpmn:TextAnnotation")?{width:100,height:40}:M(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},Jo.prototype.createParticipantShape=function(e){return fn(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function PO(e,t,n){return z(n,function(i){t=Qd(e,t,i)}),t}function Qd(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Gi(t,[n]))}function TO(e){return nt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Jl(e,t){this._modeling=e,this._canvas=t}Jl.$inject=["modeling","canvas"],Jl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(n,function(o){var r={x:0,y:0};pn(i.left)?r.x=i.left-o.x:pn(i.right)?r.x=i.right-o.width-o.x:pn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:pn(i.top)?r.y=i.top-o.y:pn(i.bottom)?r.y=i.bottom-o.height-o.y:pn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},Jl.prototype.postExecute=function(e){};function eu(e){this._modeling=e}eu.$inject=["modeling"],eu.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},eu.prototype.postExecute=function(e){var t=e.hints||{};kO(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 kO(e,t){return ko(e.outgoing,function(n){return n.target===t})}function tu(e,t){this._canvas=e,this._layouter=t}tu.$inject=["canvas","layouter"],tu.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},tu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var nu=Math.round;function Jd(e){this._modeling=e}Jd.$inject=["modeling"],Jd.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;z(t,function(p){Fe(p.x)||(p.x=0),Fe(p.y)||(p.y=0)});var s=it(t,function(p){return!p.hidden}),c=rn(s);z(t,function(p){Pt(p)&&(p.waypoints=Bn(p.waypoints,function(f){return{x:nu(f.x-c.x-c.width/2+o.x),y:nu(f.y-c.y-c.height/2+o.y)}})),V(p,{x:nu(p.x-c.x-c.width/2+o.x),y:nu(p.y-c.y-c.height/2+o.y)})});var l=new Set(ol(t)),u={};z(t,function(p){if(Pt(p)){u[p.id]=Fe(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 f=V({},r);l.has(p)||(f.autoResize=!1),et(p)&&(f=Gi(f,["attach"])),u[p.id]=Fe(i)?a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Ii(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Zr(u)};var Gx=Math.round;function er(e){this._canvas=e}er.$inject=["canvas"],er.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?V(t,n):V(t,{x:n.x-Gx(t.width/2),y:n.y-Gx(t.height/2)}),this._canvas.addShape(t,i,o),t},er.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function $s(e){er.call(this,e)}Ce($s,er),$s.$inject=["canvas"];var OO=er.prototype.execute;$s.prototype.execute=function(e){var t=e.shape;return LO(t),t.labelTarget=e.labelTarget,OO.call(this,e)};var DO=er.prototype.revert;$s.prototype.revert=function(e){return e.shape.labelTarget=null,DO.call(this,e)};function LO(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Fs(e,t){this._canvas=e,this._modeling=t}Fs.$inject=["canvas","modeling"],Fs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Qo(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Qo(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Fs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Mf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Fs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,en(n.children,t,i),this._canvas.addConnection(t,n),t};function eh(e,t){this._modeling=e,this._elementRegistry=t}eh.$inject=["modeling","elementRegistry"],eh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function js(e,t){this._canvas=e,this._modeling=t}js.$inject=["canvas","modeling"],js.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Qo(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Qo(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Qo(n.children,function(i){Pt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},js.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Mf(i.children,n),t.removeShape(n),n},js.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return en(i.children,n,o),t.addShape(n,i),n};function iu(e){this._modeling=e}iu.$inject=["modeling"];var Vx={x:"y",y:"x"};iu.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(m,_){m.range.min=Math.min(_[i],m.range.min),m.range.max=Math.max(_[i]+_[o],m.range.max)}function a(m){return m[i]+m[o]/2}function s(m){return m.length-1}function c(m){return m.max-m.min}function l(m,_){var b={y:0};b[i]=m-a(_),b[i]&&(b[Vx[i]]=0,t.moveElements([_],b,_.parent))}var u=n[0],p=s(n),f=n[p],d,g,h=0;z(n,function(m,_){var b,y,v;if(m.elements.length<2){_&&_!==n.length-1&&(r(m,m.elements[0]),h+=c(m.range));return}b=zi(m.elements,i),y=b[0],_===p&&(y=b[s(b)]),v=a(y),m.range=null,z(b,function(E){if(l(v,E),m.range===null){m.range={min:E[i],max:E[i]+E[o]};return}r(m,E)}),_&&_!==n.length-1&&(h+=c(m.range))}),g=Math.abs(f.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(m,_){var b={},y;m===u||m===f||(y=n[_-1],m.range.max=0,z(m.elements,function(v,E){b[Vx[i]]=0,b[i]=y.range.max-v[i]+d,m.range.min!==v[i]&&(b[i]+=v[i]-m.range.min),b[i]&&t.moveElements([v],b,v.parent),m.range.max=Math.max(v[i]+v[o],E?m.range.max:0)}))})},iu.prototype.postExecute=function(e){};function ou(e,t){this._layouter=e,this._canvas=t}ou.$inject=["layouter","canvas"],ou.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},ou.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function th(){}th.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=Xt(r.children,t),en(i.children,t,o),t.parent=i,z(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},th.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return Xt(n.children,t),en(i.children,t,o),t.parent=i,z(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 nh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}nh.prototype.add=function(e,t){return this.addAll([e],t)},nh.prototype.addAll=function(e,t){var n=uA(e,!!t,this);return V(this,n),this};function Hs(e){this._modeling=e}Hs.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Hs.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),z(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),z(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:f&&ld(p,p.source,t),connectionEnd:d&&ud(p,p.target,t)})})},Hs.prototype.getClosure=function(e){return new nh().addAll(e,!0)};function ru(e){this._helper=new Hs(e)}ru.$inject=["modeling"],ru.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},ru.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 Dr(e){this._modeling=e,this._helper=new Hs(e)}Dr.$inject=["modeling"],Dr.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=Ii(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=Xt(r.children,t),en(i.children,t,o),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Dr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(z(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:ud(r,t,n)})}),z(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:ld(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Dr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return en(n.children,t,i),V(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Dr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Dr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function zs(e){this._modeling=e}zs.$inject=["modeling"],zs.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 $e(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},zs.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||Wx($e(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||Wx($e(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},zs.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 Wx(e){return e.original||e}function wo(e,t){this._modeling=e,this._rules=t}wo.$inject=["modeling","rules"],wo.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,m){return i.allowed("connection.reconnect",{connection:m,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 f=o.incoming.slice(),d=o.outgoing.slice();z(f,function(g){var h=g.source,m=c(h,s,g);m&&t.reconnectEnd(g,s,Ol(g,s,u),a)}),z(d,function(g){var h=g.target,m=c(s,h,g);m&&t.reconnectStart(g,s,kl(g,s,u),a)})},wo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},wo.prototype.execute=function(e){},wo.prototype.revert=function(e){},wo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},wo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},wo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Gs(e){this._modeling=e}Gs.$inject=["modeling"],Gs.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Gs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(z(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Ol(r,n,i)})}),z(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:kl(r,n,i)})}))},Gs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function tr(e){this._modeling=e}tr.$inject=["modeling"],tr.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),z(o,function(s){a[s.id]=BO(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(lO(i,o),t,n,r,i,o,a)},tr.prototype.execute=function(){},tr.prototype.revert=function(){},tr.prototype.moveShapes=function(e,t){var n=this;z(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},tr.prototype.resizeShapes=function(e,t,n){var i=this;z(e,function(o){var r=uO(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},tr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);z(e,function(u){var p=u.source,f=u.target,d=IO(u),g=qx(n),h={},m=c.has(p)||l.has(p),_=c.has(f)||l.has(f);m&&_?(d=Bn(d,function(b){return Yx(b,i,n)&&(b[g]=b[g]+t[g]),b.original&&Yx(b.original,i,n)&&(b.original[g]=b.original[g]+t[g]),b}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(m||_)&&(c.has(p)?h.connectionStart=ld(u,p,t):c.has(f)?h.connectionEnd=ud(u,f,t):l.has(p)?h.connectionStart=kl(u,p,a[p.id]):l.has(f)&&(h.connectionEnd=Ol(u,f,a[f.id])),s._modeling.layoutConnection(u,h))})};function Ux(e){return V({},e)}function IO(e){return Bn(e.waypoints,function(t){return t=Ux(t),t.original&&(t.original=Ux(t.original)),t})}function qx(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Yx(e,t,n){var i=qx(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function BO(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function au(e){this._modeling=e}au.$inject=["modeling"],au.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Kx(n),t.collapsed=!t.collapsed;var i=Xx(n,t.collapsed);return[t].concat(i)},au.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=Zx(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function Kx(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,Kx(n.children)))}),t}function Xx(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Xx(i.children,i.collapsed||t)))}),n}function Zx(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Zx(i.children,t)))}),n}function su(e){this._modeling=e}su.$inject=["modeling"],su.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Qx(i,t),Jx(n,t),t.host=n,t},su.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,Qx(n,t),Jx(i,t,o),t};function Qx(e,t){return Xt(e&&e.attachers,t)}function Jx(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),en(i,t,n)}}function ih(){}ih.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ih.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Tt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Tt.$inject=["eventBus","elementFactory","commandStack"],Tt.prototype.getHandlers=function(){return{"shape.append":eu,"shape.create":er,"shape.delete":js,"shape.move":Dr,"shape.resize":Gs,"shape.replace":wo,"shape.toggleCollapse":au,spaceTool:tr,"label.create":$s,"connection.create":tu,"connection.delete":Fs,"connection.move":th,"connection.layout":ou,"connection.updateWaypoints":ih,"connection.reconnect":zs,"elements.create":Jd,"elements.move":ru,"elements.delete":eh,"elements.distribute":iu,"elements.align":Jl,"element.updateAttachment":su}},Tt.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Tt.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)},Tt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Tt.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)},Tt.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)},Tt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Tt.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},Tt.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},Tt.prototype.createElements=function(e,t,n,i,o){$e(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},Tt.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},Tt.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},Tt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Tt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Tt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Tt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Tt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Tt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Tt.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},Tt.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)},Tt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Tt.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)},Tt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},Tt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},Tt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Tt.prototype._create=function(e,t){return KA(t)?t:this._elementFactory.create(e,t)},Tt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Vs(e){this._elementRegistry=e}Vs.$inject=["elementRegistry"],Vs.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||NO(n,Rc(i));return e_(n,i),e.oldProperties=r,e.changed=o,o},Vs.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return e_(n,t),i},Vs.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return M(e,"bpmn:DataObject")?$O(e,t):[]};function NO(e,t){return Jn(t,function(n,i){return n[i]=e.get(i),n},{})}function e_(e,t){z(t,function(n,i){e.set(i,n)})}function $O(e,t){return t.filter(function(n){return M(n,"bpmn:DataObjectReference")&&de(n).dataObjectRef===e})}var Ws="default",Eo="id",t_="di",FO={width:0,height:0};function Us(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Us.$inject=["elementRegistry","moddle","modeling","textRenderer"],Us.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=VO(e.properties),s=e.oldProperties||jO(t,a);return n_(a,r)&&(o.unclaim(r[Eo]),i.updateId(t,a[Eo]),o.claim(a[Eo],r)),Ws in a&&(a[Ws]&&n.push(i.get(a[Ws].id)),r[Ws]&&n.push(i.get(r[Ws].id))),i_(t,a),e.oldProperties=s,e.changed=n,n},Us.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&de(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,FO)}},Us.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 i_(t,i),n_(n,o)&&(a.unclaim(n[Eo]),r.updateId(t,i[Eo]),a.claim(i[Eo],o)),e.changed};function n_(e,t){return Eo in e&&e[Eo]!==t[Eo]}function jO(e,t){var n=Rc(t),i=e.businessObject,o=dt(e);return Jn(n,function(r,a){return a!==t_?r[a]=i.get(a):r[a]=HO(o,Rc(t.di)),r},{})}function HO(e,t){return Jn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function i_(e,t){var n=e.businessObject,i=dt(e);z(t,function(o,r){r!==t_?n.set(r,o):i&&zO(i,o)})}function zO(e,t){z(t,function(n,i){e.set(i,n)})}var GO=["default"];function VO(e){var t=V({},e);return GO.forEach(function(n){n in e&&(t[n]=de(t[n]))}),t}function cu(e,t){this._canvas=e,this._modeling=t}cu.$inject=["canvas","modeling"],cu.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=t.getRootElement(),r=o.businessObject,a=r.$parent,s=dt(o);return t.setRootElement(n),t.removeRootElement(o),en(a.rootElements,i),i.$parent=a,Xt(a.rootElements,r),r.$parent=null,o.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=o,[]},cu.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,o=e.oldRoot,r=o.businessObject,a=i.$parent,s=dt(n);return t.setRootElement(o),t.removeRootElement(n),Xt(a.rootElements,i),i.$parent=null,en(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=Ei(i),a=r===i,s=a?i:i.parent,c=qo(s),l=xn(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+wi,y:i.y,width:i.width-wi,height:i.height}:{x:i.x,y:i.y+wi,width:i.width,height:i.height-wi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Rr(r,function(v){return p.push(v),v.label&&p.push(v.label),v===i?[]:it(v.children,function(E){return E!==i})});var f,d,g,h,m;o==="top"?(f=-120,d=i.y,g=d+10,h="n",m="y"):o==="left"?(f=-120,d=i.x,g=d+10,h="w",m="x"):o==="bottom"?(f=120,d=i.y+i.height,g=d-10,h="s",m="y"):o==="right"&&(f=120,d=i.x+i.width,g=d-10,h="e",m="x");var _=t.calculateAdjustments(p,m,f,g),b=l?{x:0,y:f}:{x:f,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,b,h,g);var y=l?{x:i.x+(a?wi:0),y:d-(o==="top"?120:0),width:i.width-(a?wi:0),height:120}:{x:d-(o==="left"?120:0),y:i.y+(a?wi:0),width:120,height:i.height-(a?wi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},y,s)};function rh(e){this._modeling=e}rh.$inject=["modeling"],rh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=qo(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=xn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,f;for(f=0;f<i;f++)f===i-1?l=s-c*f:l=c,u=a?{x:n.x+wi,y:n.y+f*c,width:n.width-wi,height:l}:{x:n.x+f*c,y:n.y+wi,width:l,height:n.height-wi},f<r?t.resizeShape(o[f],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function qs(e,t){this._modeling=e,this._spaceTool=t}qs.$inject=["modeling","spaceTool"],qs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},qs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=$T(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},qs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Be(e),o=Be(t),r=Iv(o,i),a=Ei(e),s=[],c=[];Rr(a,function(g){return s.push(g),(M(g,"bpmn:Lane")||M(g,"bpmn:Participant"))&&c.push(g),g.children});var l,u,p,f,d;(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",f=r.top>0||r.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",f,u),n.makeSpace(d.movingShapes,d.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",f=r.left>0||r.right<0?-l:l,d=n.calculateAdjustments(c,"x",f,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},p))};var Ys="flowNodeRef",ah="lanes";function lu(){}lu.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var f=Be(p),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ei(u);return o[p.id]||(o[p.id]=Cl(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(f){return a(u,f)}).map(function(f){return f.businessObject})}return t.forEach(function(u){var p=Ei(u);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return M(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,f=p.get(ah),d=f.slice(),g=l(u);i.push({flowNode:p,remove:d,add:g})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(Ys).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},lu.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(ah);n.remove.forEach(function(r){Xt(o,r),Xt(r.get(Ys),i)}),n.add.forEach(function(r){en(o,r),en(r.get(Ys),i)})}),[]},lu.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(ah);n.add.forEach(function(r){Xt(o,r),Xt(r.get(Ys),i)}),n.remove.forEach(function(r){en(o,r),en(r.get(Ys),i)})}),[]};var sh="categoryValueRef";function Ks(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ks.$inject=["bpmnFactory","elementRegistry"],Ks.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(b,y,v){if(y){var E=a.get(b);E||(E={},a.set(b,E)),!(v&&E.present)&&(!v&&E.past||(v?E.present={categoryValue:y,root:ch(b)}:E.past={categoryValue:y}))}}function c(b){o.set(b,de(b))}function l(){n.filter(function(b){return M(b,"bpmn:FlowElement")&&!et(b)&&b.parent}).forEach(c)}function u(b){var y=de(b),v=y.get("categoryValueRef");return v||(v=Tv(i,y),r.push(WO(b,v))),v}function p(b){return b.reduce(function(y,v){var E=ch(v),w=y.get(E);return w||(w=[],y.set(E,w)),w.push(v),y},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&l(),e.forEach(c),n.filter(function(b){return M(b,"bpmn:Group")&&!et(b)&&b.parent}).forEach(function(b){var y=de(b).get("categoryValueRef");if(!y){var v=ch(b),E=f.get(v)||[],w=ha(E,b),P=Object.keys(w).length>0;P&&(y=u(b))}s(b,y,!0)}),t.forEach(function(b){s(b.groupShape,b.categoryValue,!1)}),r.length&&l();var d=Array.from(o.keys()),g=Array.from(a.values()).reduce(function(b,y){return y.present&&b.add(y.present.categoryValue),y.past&&b.add(y.past.categoryValue),b},new Set),h=new Map,m=p(d);a.forEach(function(b,y){var v=b.present;if(v){var E=m.get(v.root)||[],w=ha(E,y);E.forEach(function(P){if(w[P.id]){var T=h.get(P);T||(T=new Set,h.set(P,T)),T.add(v.categoryValue)}})}});var _=d.reduce(function(b,y){var v=o.get(y),E=v.get(sh),w=new Set(E),P=h.get(y)||new Set,T=Array.from(P).filter(function($){return!w.has($)}),L=E.filter(function($){return g.has($)&&!P.has($)});return(T.length||L.length)&&b.push({businessObject:v,categoryValuesToAdd:T,categoryValuesToRemove:L}),b},[]);return{flowElements:_,groups:r}},Ks.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),UO(t.groups),YO(t.flowElements),[]},Ks.prototype.revert=function(e){var t=e.updates;return KO(t.flowElements),qO(t.groups),[]};function WO(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function UO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function qO(e){e.forEach(function(t){de(t.groupShape).categoryValueRef=null})}function YO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(sh);t.categoryValuesToRemove.forEach(function(o){Xt(i,o)}),t.categoryValuesToAdd.forEach(function(o){en(i,o,!0)})})}function KO(e){e.forEach(function(t){var n=t.businessObject,i=n.get(sh);t.categoryValuesToAdd.forEach(function(o){Xt(i,o)}),t.categoryValuesToRemove.forEach(function(o){en(i,o,!0)})})}function ch(e){for(;e.parent;)e=e.parent;return e}function uu(e){this._moddle=e}uu.$inject=["moddle"],uu.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),[]},uu.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 XO={fill:void 0,stroke:void 0};function lh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Zn(t)){var n=ZO(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}lh.$inject=["commandStack"],lh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||XO,i=this,o={};"fill"in n&&V(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(o,{"border-color":this._normalizeColor(n.stroke)}),z(t,function(r){var a=Pt(r)?Ii(o,["border-color"]):o,s=dt(r);if(QO(a),et(r)){if(!s||!M(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!nt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function ZO(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 QO(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var JO={width:0,height:0};function o_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return MP(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!et(l)&&Wo(l)&&!dl(l)&&!r_(p)){var f=7,d=Df(l);d={x:d.x,y:d.y+f},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=yi(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!et(u)&&!M(u,"bpmn:TextAnnotation"))){if(et(u)&&r_(p)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=yi(l);typeof f>"u"&&(f=t.getExternalLabelBounds(u,g)),f&&e.resizeShape(u,f,JO)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}o_.$inject=["modeling","textRenderer","bpmnFactory"];function r_(e){return!e||!e.trim()}function Ln(e,t,n,i){Tt.call(this,e,t,n),this._bpmnRules=i}Ce(Ln,Tt),Ln.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ln.prototype.getHandlers=function(){var e=Tt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Vs,e["element.updateProperties"]=Us,e["canvas.updateRoot"]=cu,e["lane.add"]=oh,e["lane.resize"]=qs,e["lane.split"]=rh,e["lane.updateRefs"]=lu,e["group.updateRefs"]=Ks,e["id.updateClaim"]=uu,e["element.setColor"]=lh,e["element.updateLabel"]=o_,e},Ln.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Ln.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)},Ln.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ln.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ln.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ln.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ln.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ln.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ln.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ln.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Ln.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ln.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ln.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function a_(){}a_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||je(t.source||e.source),t.connectionEnd||je(t.target||e.target)]};var pu=20,eD=5,fu=Math.round,s_=20,tD={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function nD(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function iD(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function c_(e,t,n){var i=kn(t,e,eD),o=n.split(":")[0],r=fu((t.x-e.x)/2+e.x),a=fu((t.y-e.y)/2+e.y),s,c,l=iD(o,i),u=/h|r|l/.test(o),p=!1,f=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=nD(i,o),c=u?"h:v":"v:h",p?u?(f=a===e.y,s={x:e.x+pu*(/l/.test(o)?-1:1),y:f?a+pu:a}):(f=r===e.x,s={x:f?r+pu:r,y:e.y+pu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:uh(e,s,c).concat(s),directions:c,turnNextDirections:f}}function oD(e,t,n){return c_(e,t,n)}function rD(e,t,n){var i=c_(t,e,l_(n));return{waypoints:i.waypoints.slice().reverse(),directions:l_(i.directions),turnNextDirections:i.turnNextDirections}}function aD(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=uh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function l_(e){return e.split(":").reverse().join(":")}function sD(e,t,n){var i=fu((t.x-e.x)/2+e.x),o=fu((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 uh(e,t,n){if(n=n||"h:h",!mD(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(p_(n)){var i=oD(e,t,n),o=rD(e,t,n),r=aD(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return sD(e,t,n)}function cD(e,t,n){var i=uh(e,t,n);return i.unshift(e),i.push(t),d_(i)}function lD(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=j1(r,"straight")[0]||"h:h",s=tD[a]||0,c=kn(e,t,s),l=gD(c,a);n=n||je(e),i=i||je(t);var u=l.split(":"),p=f_(n,e,u[0],yD(c)),f=f_(i,t,u[1],c);return cD(p,f,l)}function uD(e,t,n,i,o,r){$e(n)&&(o=n,r=i,n=je(e),i=je(t)),r=V({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&fD(e,t,n,i,r),c||(c=r.connectionEnd&&hD(t,e,i,o),c)||(c=r.connectionStart&&dD(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:lD(e,t,n,i,r)}function pD(e,t,n){return e>=t&&e<=n}function u_(e,t,n){var i={x:"width",y:"height"};return pD(t[e],n[e],n[e]+n[i[e]])}function fD(e,t,n,i,o){var r={},a,s;return s=kn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?u_(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:u_(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 dD(e,t,n,i){return ph(e,t,n,i)}function hD(e,t,n,i){var o=i.slice().reverse();return o=ph(e,t,n,o),o?o.reverse():null}function ph(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!Ot(u,function(p,f){var d=u[f-1];return d&&bs(p,d)<3})}function r(u,p,f){var d=ho(p,u);switch(d){case"v":return{x:f.x,y:u.y};case"h":return{x:u.x,y:f.y}}return{x:u.x,y:u.y}}function a(u,p,f){var d;for(d=u.length-2;d!==0;d--)if(By(u[d],p,s_)||By(u[d],f,s_))return u.slice(d);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=ph(e,t,n,l)),c&&ho(c)?null:c}function gD(e,t){if(p_(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 mD(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function p_(e){return e&&/t|r|b|l/.test(e)}function yD(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 f_(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 Af(o,r,n,0)||t.push(n),t},[])}var vD=-10,bD=40,xD={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},_D={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},fh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Xs={top:"t",right:"r",bottom:"b",left:"l"};function du(e){this._elementRegistry=e}Ce(du,a_),du.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=h_(o&&o[0],n)),a||(a=h_(o&&o[o.length-1],i)),(M(e,"bpmn:Association")||M(e,"bpmn:DataAssociation"))&&o&&!g_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Cv(n,s)?xD:_D;return M(e,"bpmn:MessageFlow")?c=ED(n,i,u):(M(e,"bpmn:SequenceFlow")||g_(n,i))&&(n===i?c={preferredLayouts:PD(n,e,u)}:M(n,"bpmn:BoundaryEvent")?c={preferredLayouts:TD(n,i,a,u)}:Zs(n)||Zs(i)?c={preferredLayouts:u.subProcess,preserveDocking:RD(n)}:M(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:M(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=V(c,t),l=d_(uD(n,i,r,a,o,c))),l||[r,a]};function wD(e){var t=e.host;return kn(je(e),t,vD)}function ED(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:SD(e,t)}}function SD(e,t){return M(t,"bpmn:Participant")?"source":M(e,"bpmn:Participant")?"target":Zs(t)?"source":Zs(e)||M(t,"bpmn:Event")?"target":M(e,"bpmn:Event")?"source":null}function RD(e){return Zs(e)?"target":"source"}function h_(e,t){return e?e.original||e:je(t)}function g_(e,t){return M(t,"bpmn:Activity")&&M(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Zs(e){return M(e,"bpmn:SubProcess")&&ct(e)}function Lr(e,t){return e===t}function CD(e,t){return t.indexOf(e)!==-1}function Oa(e){var t=/right|left/.exec(e);return t&&t[0]}function Da(e){var t=/top|bottom/.exec(e);return t&&t[0]}function m_(e,t){return fh[e]===t}function MD(e,t){var n=Oa(e),i=fh[n];return t.indexOf(i)!==-1}function AD(e,t){var n=Da(e),i=fh[n];return t.indexOf(i)!==-1}function y_(e){return e==="right"||e==="left"}function PD(e,t,n){var i=t.waypoints,o=i&&i.length&&kn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function TD(e,t,n,i){var o=je(e),r=je(t),a=wD(e),s,c,l=Lr(e.host,t),u=CD(a,["top","right","bottom","left"]),p=kn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?kD(a,u,e,t,n,i):(s=OD(a,p,u,i.isHorizontal),c=DD(a,p,u,i.isHorizontal),[s+":"+c])}function kD(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Da(e):Oa(e),s=Xs[a],c;return t?y_(e)?c=v_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=v_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function v_(e,t,n,i){var o=bD;return!(dh(e,i,n,o)||dh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||dh(e,i,je(t),o))}function dh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function OD(e,t,n,i){if(n)return Xs[e];var o=Da(e),r=Oa(e),a=Da(t),s=Oa(t);if(i){if(Lr(o,a)||m_(r,s))return Xs[o]}else if(Lr(r,s)||m_(o,a))return Xs[r];return Xs[i?r:o]}function DD(e,t,n,i){if(n)return y_(e)?MD(e,t)||Lr(e,t)?"h":"v":AD(e,t)||Lr(e,t)?"v":"h";var o=Da(e),r=Oa(e),a=Da(t),s=Oa(t);return a&&!s?"v":s&&!a?"h":i?Lr(o,a)?"h":"v":Lr(r,s)?"v":"h"}du.$inject=["elementRegistry"];function b_(e){return V({original:e.point.original||e.point},e.actual)}function nr(e,t){this._elementRegistry=e,this._graphicsFactory=t}nr.$inject=["elementRegistry","graphicsFactory"],nr.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(b_(i)),r.push(b_(o)),r},nr.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}},nr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return xs(i,o,n)},nr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},nr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},nr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const hh={__init__:["modeling","bpmnUpdater"],__depends__:[Qk,h2,m2,y2,kx,vO,xO,CO,Ri,Zd,Nx],bpmnFactory:["type",Mi],bpmnUpdater:["type",ai],elementFactory:["type",Jo],modeling:["type",Ln],layouter:["type",du],connectionDocking:["type",nr]};var LD=10,x_=50,ID=250;function gh(e,t,n,i){for(var o;o=BD(e,n,t);)n=i(t,n,o);return n}function mh(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 BD(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=$D(e);return Ot(o,function(r){if(r===n)return!1;var a=kn(r,i,LD);return a==="intersect"})}function ND(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||x_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||ID,c=t.reference||"start";r||(r=HD);function l(g,h){return o==="n"?c==="start"?Be(g).top-Be(h).bottom:c==="center"?Be(g).top-je(h).y:Be(g).top-Be(h).top:o==="w"?c==="start"?Be(g).left-Be(h).right:c==="center"?Be(g).left-je(h).x:Be(g).left-Be(h).left:o==="s"?c==="start"?Be(h).top-Be(g).bottom:c==="center"?je(h).y-Be(g).bottom:Be(h).bottom-Be(g).bottom:c==="start"?Be(h).left-Be(g).right:c==="center"?je(h).x-Be(g).right:Be(h).right-Be(g).right}var u=e.incoming.filter(r).map(function(g){var h=a(g),m=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:m,weight:h}}),p=e.outgoing.filter(r).map(function(g){var h=a(g),m=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:m,weight:h}}),f=u.concat(p).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Jn(f,function(g,h){var m=h.distance,_=h.weight;return m<0||m>s||(g[String(m)]||(g[String(m)]=0),g[String(m)]+=1*_,(!g.distance||g[g.distance]<g[String(m)])&&(g.distance=m)),g},{});return d.distance||i}function $D(e){var t=yh(e);return e.host&&(t=t.concat(yh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(yh(i))},[]))),t}function yh(e){return jD(e).concat(FD(e))}function FD(e){return e.incoming.map(function(t){return t.source})}function jD(e){return e.outgoing.map(function(t){return t.target})}function HD(){return!0}var zD=100;function __(e,t,n){e.on("autoPlace",zD,function(i){var o=i.shape,r=i.source;return GD(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}}__.$inject=["eventBus","modeling","canvas"];function GD(e,t,n){n||(n={});var i=n.defaultDistance||x_,o=je(e),r=Be(e);return{x:r.right+i+t.width/2,y:o.y}}function w_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}w_.$inject=["eventBus","selection"];const VD={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",__],autoPlaceSelectionBehavior:["type",w_]};function E_(e,t,n){var i=Cv(e,n);if(M(t,"bpmn:TextAnnotation"))return UD(e,t,i);if(nt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return qD(e,t,i);if(M(t,"bpmn:FlowNode"))return WD(e,t,i)}function WD(e,t,n){var i=Be(e),o=je(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=ND(e,{filter:function(d){return M(d,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;M(e,"bpmn:BoundaryEvent")&&(l=kn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+S_(l,c,r)}:{x:o.x+S_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return gh(e,t,u,mh(f))}function S_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function UD(e,t,n){var i=Be(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};Pt(e)&&(o=je(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,mh(a))}function qD(e,t,n){var i=Be(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,mh(a))}function R_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return E_(o,i,t)})}R_.$inject=["eventBus","elementRegistry"];const hu={__depends__:[VD],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",R_]},C_=[Sv,Cs,hh,hu,Pp];function YD(e={}){Jg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ya({container:t,moddleExtensions:e.moddleExtensions??Dc,additionalModules:[...C_,...e.additionalModules??[]]})}const M_={"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":"풀"},KD={이:["이","가"],을:["을","를"],와:["과","와"]};function XD(e,t){const[n,i]=KD[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 ZD={"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":"연관선"},QD="요소";function vh(e){return(e&&ZD[e.type])??QD}const A_=20;function JD(e){const t=e.replace(/\s+/g," ").trim();return t.length>A_?`${t.slice(0,A_)}…`:t}function gu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:JD(o.name),a=r===void 0?i+vh(o):r,s=r===void 0?a:`「${r}」`;return n?s+XD(a,n).slice(a.length):s}function eL(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&&vh(r)===vh(a);return[gu(e,t,i),gu(e,n,o,s?"다른 ":"")]}function tL(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 nL(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 mu={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function iL(e,t){const n=(o,r)=>gu(t,o,r),i=(o,r,a,s)=>eL(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)}의 ${mu[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)}의 ${mu[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${mu[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${mu[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 oL(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${gu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const P_="기타",bh={error:0,warning:1,info:2};function T_(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${lt(i)}`,source:"geometry",code:i.kind,severity:tL(i),targetRefs:nL(i),category:M_[i.kind]??P_,message:iL(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:M_[i.ruleId]??P_,message:oL(i,t)});return n}function k_(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function La(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=La(e[0],t);return e.some(i=>La(i,t)!==n)}function O_(e,t){const n=xh(e,t);return e.slice().sort((i,o)=>(n?Number(La(o,t))-Number(La(i,t)):0)||bh[i.severity]-bh[o.severity])}const D_="i18n-untranslated",L_="i18n-review-requested",_h="i18nDisplay.redrawn",I_=[["untranslated",D_],["reviewRequested",L_]];class wh{constructor(t,n,i,o,r,a,s,c){pi(this,"config");pi(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=(f,d,g)=>this.withDisplayText(d,()=>l(f,d,g),f);const u=r.activate.bind(r);r.activate=f=>this.withDisplayText(f,()=>u(f));const p=r.update.bind(r);r.update=(f,d,g,h)=>{const m=this.resolve(f);if(!m||m.native)return p(f,d,g,h);(d??"").trim()!==(g??"").trim()&&i.execute(Mc,{element:f.labelTarget??f,locale:this.displayLocale,text:d,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",f=>{if(!this.config)return;const{element:d,newLabel:g,oldLabel:h}=f.context;(g??"")!==(h??"")&&i.execute(Mc,{element:d.labelTarget??d,locale:this.displayLocale,text:g??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:h??""})})}configure(t){!t&&!this.config||(this.config=t,this.displayLocale=t==null?void 0:t.designLocale,this.rerenderAll())}locales(){if(!this.config)return[];const{designLocale:t,companionLocales:n}=this.config;return[t,...n.filter(i=>i!==t)]}setDisplayLocale(t){if(this.config)return this.displayLocale=this.locales().includes(t)?t:this.config.designLocale,this.rerenderAll(),this.displayLocale}getDisplayLocale(){return this.displayLocale}rootLang(){var i,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=yr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=ta(n).filter(f=>Nn(f)),s=f=>f.body??"",c=a.find(f=>Nn(f)===o&&s(f)),l=Oo(n).some(f=>f.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(f=>s(f)===r).map(Nn);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 f;if(!this.config)return n();const o=this.resolve(t),r=(f=i==null?void 0:i.parentNode)==null?void 0:f.classList;if(r)for(const[d,g]of I_)r.toggle(g,(o==null?void 0:o.status)===d);if(!o||o.native)return n();const{target:a,key:s}=yr((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 d=n();return p&&(d!=null&&d.setAttribute)&&d.setAttribute("transform",`translate(${p.dx}, 0)`),d}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height: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 I_)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(_h)}}pi(wh,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const B_={__depends__:[Pp],__init__:["i18nDisplay"],i18nDisplay:["type",wh]};var rL=new kr("ov"),aL=500;function Sn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=rL,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=sL(n.getContainer()),this._init()}Sn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Sn.prototype.get=function(e){if(Zn(e)&&(e={id:e}),Zn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?it(t.overlays,Jr({type:e.type})):t.overlays.slice():[]}else return e.type?it(this._overlays,Jr({type:e.type})):e.id?this._overlays[e.id]:null},Sn.prototype.add=function(e,t,n){if(fn(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=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Sn.prototype.remove=function(e){var t=this.get(e)||[];$e(t)||(t=[t]);var n=this;z(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(Yi(i.html),Yi(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)}})},Sn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Sn.prototype.show=function(){yu(this._overlayRoot)},Sn.prototype.hide=function(){yu(this._overlayRoot,!1)},Sn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],el(this._overlayRoot)},Sn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=rn(t);i=r.x,o=r.y}N_(n,i,o),En(e.html,"data-container-id",t.id)},Sn.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=rn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=rn(i).height:s=i.height,r=t.bottom*-1+s}N_(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Sn.prototype._createOverlayContainer=function(e){var t=Nt('<div class="djs-overlays" />');Gn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Sn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";$_(this._overlayRoot,n)},Sn.prototype._getOverlayContainer=function(e,t){var n=Ot(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Sn.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)),Zn(i)&&(i=Nt(i)),r=this._getOverlayContainer(n),o=Nt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Gn(o,{position:"absolute"}),o.appendChild(i),e.type&&Ct(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();yu(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())},Sn.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&&(pn(o)&&o>t.scale||pn(r)&&r<t.scale))&&(c=!1),yu(a,c),this._updateOverlayScale(e,t)},Sn.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),pn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),pn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),pn(a)&&(s="scale("+a+","+a+")"),$_(r,s)},Sn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Sn.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});z(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){Yi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",aL,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(z(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&&Ct(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 sL(e){var t=Nt('<div class="djs-overlay-container" />');return Gn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function N_(e,t,n){Gn(e,{left:t+"px",top:n+"px"})}function yu(e,t){e.style.display=t===!1?"none":""}function $_(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const vu={__init__:["overlays"],overlays:["type",Sn]};function Eh(e,t){t.invoke(pe,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ce(Eh,pe),Eh.$inject=["canvas","injector"];const cL={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Eh]};function Ir(e){return CSS.escape(e)}var lL={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function F_(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return lL[t]})}var uL="bjs-breadcrumbs-shown";function j_(e,t,n){var i=Nt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Ct(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=de(l),p=Ot(a,function(f){return f===u});p&&s()});function s(c){c&&(a=pL(c));var l=a.flatMap(function(p){var f=n.findRoot(Ji(p))||n.findRoot(p.id);if(!f&&M(p,"bpmn:Process")){var d=t.find(function(m){var _=de(m);return _&&_.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var g=F_(p.name||p.id),h=Nt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var u=l.length>1;r.toggle(uL,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}j_.$inject=["eventBus","elementRegistry","canvas"];function pL(e){for(var t=de(e),n=[],i=t;i;i=i.$parent)(M(i,"bpmn:SubProcess")||M(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function H_(e,t){var n=null,i=new fL;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,!(!M(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})}H_.$inject=["eventBus","canvas"];function fL(){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 z_={x:180,y:160};function Br(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}Br.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)})}},Br.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;M(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),hL(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},Br.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=dL(e),i={x:n.x-z_.x,y:n.y-z_.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)})},Br.prototype._moveToDiPlane=function(e,t){var n=G_(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Br.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},Br.$inject=["eventBus","moddle"];function G_(e){return M(e,"bpmndi:BPMNDiagram")?e:G_(e.$parent)}function dL(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Be(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),sl(t)}function hL(e,t){var n=e.$parent;return!(!M(n,"bpmn:SubProcess")||n===t.bpmnElement||nt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var bu=250,gL='<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>',mL="bjs-drilldown-empty";function ir(e,t,n,i,o){pe.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",bu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",bu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],bu,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"],bu,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)})})}Ce(ir,pe),ir.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},ir.prototype._canDrillDown=function(e){var t=this._canvas;return M(e,"bpmn:SubProcess")&&t.findRoot(Ji(e))},ir.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=de(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Ct(i.html).toggle(mL,!o)}},ir.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=de(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Nt('<button type="button" class="bjs-drilldown">'+gL+"</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(Ji(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},ir.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},ir.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const yL={__depends__:[vu,Zd,cL],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",j_],drilldownCentering:["type",H_],drilldownOverlayBehavior:["type",ir],subprocessCompatibility:["type",Br]};function or(e){zt.call(this,e)}Ce(or,zt),or.prototype._modules=[Sv,yL,vu,Ri,Cs],or.prototype._moddleExtensions={};var xu="keyboard.keydown",vL="keyboard.keyup",bL=1e3,V_="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 Vn(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(V_));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Vn.$inject=["config.keyboard","eventBus"],Vn.prototype._keydownHandler=function(e){this._keyHandler(e,xu)},Vn.prototype._keyupHandler=function(e){this._keyHandler(e,vL)},Vn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||xu,i),n&&e.preventDefault()}},Vn.prototype._isEventIgnored=function(e){return!1},Vn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(V_)),this.unbind(),e=this._node=this._target,Ie.bind(e,"keydown",this._keydownHandler),Ie.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Vn.prototype.getBinding=function(){return this._node},Vn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ie.unbind(e,"keydown",this._keydownHandler),Ie.unbind(e,"keyup",this._keyupHandler)),this._node=null},Vn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Vn.prototype.addListener=function(e,t,n){vn(e)&&(n=t,t=e,e=bL),this._eventBus.on(n||xu,e,t)},Vn.prototype.removeListener=function(e,t){this._eventBus.off(t||xu,e)},Vn.prototype.hasModifier=T2,Vn.prototype.isCmd=oi,Vn.prototype.isShift=jd,Vn.prototype.isKey=hn;var xL=500;function Ia(e,t){var n=this;e.on("editorActions.init",xL,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ia.$inject=["eventBus","keyboard"],Ia.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(I2(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(B2(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(k2(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(O2(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(D2(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(L2(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(hn(["+","Add","="],o)&&oi(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(hn(["-","Subtract"],o)&&oi(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(hn("0",o)&&oi(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(hn(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const Sh={__init__:["keyboard","keyboardBindings"],keyboard:["type",Vn],keyboardBindings:["type",Ia]};var _L={moveSpeed:50,moveSpeedAccelerated:200};function W_(e,t,n){var i=this;this._config=V({},_L,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})}}W_.$inject=["config.keyboardMove","keyboard","canvas"];const U_={__depends__:[Sh],__init__:["keyboardMove"],keyboardMove:["type",W_]};var wL=15;function q_(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=Ar(s),p=Ni(u,c);if(!n.dragging&&EL(p)>wL&&(n.dragging=!0,l===0&&ux(e),Wl("grab")),n.dragging){var f=n.last||n.start;p=Ni(u,f),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ie.unbind(document,"mousemove",o),Ie.unbind(document,"mouseup",r),n=null,lx()}function a(s){if(!Er(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Ar(s)},Ie.bind(document,"mousemove",o),Ie.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}q_.$inject=["eventBus","canvas"];function EL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Y_={__init__:["moveCanvas"],moveCanvas:["type",q_]};function K_(e,t){var n=Nf(e.min),i=Nf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function SL(e,t){return Math.max(e.min,Math.min(e.max,t))}var RL=Math.sign||function(e){return e>=0?1:-1},Rh={min:.2,max:4},X_=10,CL=.1,ML=.75;function no(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Yn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||ML;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}no.$inject=["config.zoomScroll","eventBus","canvas"],no.prototype.scroll=function(t){this._canvas.scroll(t)},no.prototype.reset=function(){this._canvas.zoom("fit-viewport")},no.prototype.zoom=function(t,n){var i=K_(Rh,X_*2);this._totalDelta+=t,Math.abs(this._totalDelta)>CL&&(this._zoom(t,n,i),this._totalDelta=0)},no.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||yb()&&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))*RL(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)}},no.prototype.stepZoom=function(t,n){var i=K_(Rh,X_);this._zoom(t,n,i)},no.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=Nf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(SL(Rh,s),t)},no.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ie[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},no.prototype._init=function(e){this.toggle(e)};const Z_={__init__:["zoomScroll"],zoomScroll:["type",no]};function Qs(e){or.call(this,e)}Ce(Qs,or),Qs.prototype._navigationModules=[U_,Y_,Z_],Qs.prototype._modules=[].concat(or.prototype._modules,Qs.prototype._navigationModules);function Ch(e){return e&&e[e.length-1]}function Q_(e){return e.y}function J_(e){return e.x}var AL={left:J_,center:J_,right:function(e){return e.x+e.width},top:Q_,middle:Q_,bottom:function(e){return e.y+e.height}};function Ba(e,t){this._modeling=e,this._rules=t}Ba.$inject=["modeling","rules"],Ba.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}},Ba.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Ba.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(f,d){return Math.round((f[i]+d[i]+d[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=Ch(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(z(t,function(f){var d=f[i]+Math.round(f[o]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=zi(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return r[e]=Ch(c).center,r;l=t[0],t=zi(t,function(f){return f[i]+f[o]}),u=Ch(t),r[e]=p(l,u)}return r},Ba.prototype.trigger=function(e,t){var n=this._modeling,i,o=it(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),$e(i)&&(o=i),!(o.length<2||!i)){var r=AL[t],a=zi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const PL={__init__:["alignElements"],alignElements:["type",Ba]},TL=new kr;function Na(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Na.$inject=["eventBus"],Na.prototype.schedule=function(e,t=TL.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Na.prototype._schedule=function(e,t){const n=kL();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}},Na.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Na.prototype._cancel=function(e){clearTimeout(e.executionId)};function kL(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const OL={scheduler:["type",Na]};var DL="djs-element-hidden",_u=".entry",LL=1e3,ew=8,IL=300;function sn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}sn.$inject=["canvas","elementRegistry","eventBus","scheduler"],sn.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=$e(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=$e(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},sn.prototype._createContainer=function(){var e=Nt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},sn.prototype.registerProvider=function(e,t){t||(t=e,e=LL),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},sn.prototype.getEntries=function(e){var t=this._getProviders(),n=$e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(o){if(vn(o[n])){var r=o[n](e);vn(r)?i=r(i):z(r,function(a,s){i[s]=a})}}),i},sn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=En(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},IL);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},sn.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(vn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},sn.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))}},sn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},sn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;z(t,function(o,r){var a=o.group||"default",s=Nt(o.html||'<div class="entry" draggable="true"></div>'),c;En(s,"data-action",r),c=Et("[data-group="+Ir(a)+"]",n),c||(c=Nt('<div class="group"></div>'),En(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&BL(s,o.className),o.title&&En(s,"title",o.title),o.imageUrl&&(i=Nt("<img>"),En(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ct(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},sn.prototype._createHtml=function(e){var t=this,n=Nt('<div class="djs-context-pad"></div>');return ti.bind(n,_u,"click",function(i){t.trigger("click",i)}),ti.bind(n,_u,"dragstart",function(i){t.trigger("dragstart",i)}),ti.bind(n,_u,"mouseover",function(i){t.trigger("mouseover",i)}),ti.bind(n,_u,"mouseout",function(i){t.trigger("mouseout",i)}),Ie.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},sn.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()&&$L(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},sn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},sn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return $e(e)!==$e(n)?!1:$e(e)?e.length===n.length&&To(e,function(i){return n.includes(i)}):n===e},sn.prototype.isShown=function(){return this.isOpen()&&Ct(this._current.html).has("open")},sn.prototype.show=function(){this.isOpen()&&(Ct(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},sn.prototype.hide=function(){this.isOpen()&&(Ct(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},sn.prototype._getPosition=function(e){if(!$e(e)&&Pt(e)){var t=this._canvas.viewbox(),n=NL(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+ew*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+ew*this._canvas.zoom(),top:s.top-a.top}},sn.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")},sn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=$e(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,DL)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},sn.prototype._getTargetBounds=function(e){var t=this,n=$e(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 BL(e,t){var n=Ct(e);t=$e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function NL(e){return e.waypoints[e.waypoints.length-1]}function $L(e,t){return e=$e(e)?e:[e],t=$e(t)?t:[t],e.length===t.length&&To(e,function(n){return t.includes(n)})}const tw={__depends__:[Vl,OL,vu],contextPad:["type",sn]};var wu,Vt,nw,rr,iw,ow,rw,Mh,Eu,Js,aw,Ah,Ph,Th,Su={},Ru=[],FL=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Cu=Array.isArray;function So(e,t){for(var n in t)e[n]=t[n];return e}function kh(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function sw(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 Mu(e,a,i,o,null)}function Mu(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??++nw,__i:-1,__u:0};return o==null&&Vt.vnode!=null&&Vt.vnode(r),r}function Au(e){return e.children}function Pu(e,t){this.props=e,this.context=t}function Nr(e,t){if(t==null)return e.__?Nr(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"?Nr(e):null}function jL(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=So({},t);r.__v=t.__v+1,Vt.vnode&&Vt.vnode(r),Oh(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Nr(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,gw(i,r,o),t.__e=t.__=null,r.__e!=n&&cw(r)}}function cw(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}),cw(e)}function lw(e){(!e.__d&&(e.__d=!0)&&rr.push(e)&&!Tu.__r++||iw!=Vt.debounceRendering)&&((iw=Vt.debounceRendering)||ow)(Tu)}function Tu(){try{for(var e,t=1;rr.length;)rr.length>t&&rr.sort(rw),e=rr.shift(),t=rr.length,jL(e)}finally{rr.length=Tu.__r=0}}function uw(e,t,n,i,o,r,a,s,c,l,u){var p,f,d,g,h,m,_=i&&i.__k||Ru,b=t.length;for(c=HL(n,t,_,c,b),p=0;p<b;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&_[d.__i]||Su,d.__i=p,m=Oh(e,d,f,o,r,a,s,c,l,u),g=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Dh(f.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=pw(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&m!==void 0?c=m:g&&(c=g.nextSibling),d.__u&=-7);return n.__e=h,c}function HL(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,f=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]=Mu(null,a,null,null,null):Cu(a)?a=e.__k[r]=Mu(Au,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Mu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+f,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=zL(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?f--:o<u&&f++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Nr(s)),yw(s,s));return i}function pw(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=pw(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Nr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function zL(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 fw(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||FL.test(t)?n:n+"px"}function ku(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||fw(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||fw(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(aw,"$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[Js]=i[Js]:(n[Js]=Ah,e.addEventListener(t,r?Th:Ph,r)):e.removeEventListener(t,r?Th:Ph,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 dw(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Eu]==null)t[Eu]=Ah++;else if(t[Eu]<n[Js])return;return n(Vt.event?Vt.event(t):t)}}}function Oh(e,t,n,i,o,r,a,s,c,l){var u,p,f,d,g,h,m,_,b,y,v,E,w,P,T,L,$=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Vt.__b)&&u(t);e:if(typeof $=="function"){p=a.length;try{if(b=t.props,y=$.prototype&&$.prototype.render,v=(u=$.contextType)&&i[u.__c],E=u?v?v.props.value:u.__:i,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new $(b,E):(t.__c=f=new Pu(b,E),f.constructor=$,f.render=VL),v&&v.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&$.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=So({},f.__s)),So(f.__s,$.getDerivedStateFromProps(b,f.__s))),g=f.props,h=f.state,f.__v=t,d)y&&$.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&$.getDerivedStateFromProps==null&&b!==g&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(b,E),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(b,f.__s,E)===!1){t.__v!=n.__v&&(f.props=b,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(N){N&&(N.__=t)}),Ru.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Nr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(b,f.__s,E),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(g,h,m)})}if(f.context=E,f.props=b,f.__P=e,f.__e=!1,w=Vt.__r,P=0,y)f.state=f.__s,f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),Ru.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,w&&w(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++P<25);f.state=f.__s,f.getChildContext!=null&&(i=So(So({},i),f.getChildContext())),y&&!d&&f.getSnapshotBeforeUpdate!=null&&(m=f.getSnapshotBeforeUpdate(g,h)),T=u!=null&&u.type===Au&&u.key==null?mw(u.props.children):u,s=uw(e,Cu(T)?T:[T],t,n,i,o,r,a,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),_&&(f.__E=f.__=null)}catch(N){if(a.length=p,t.__v=null,c||r!=null){if(N.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(L=r.length;L--;)kh(r[L])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),N.then||hw(t),Vt.__e(N,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=GL(n.__e,t,n,i,o,r,a,c,l);return(u=Vt.diffed)&&u(t),128&t.__u?void 0:s}function hw(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(hw))}function gw(e,t,n){for(var i=0;i<n.length;i++)Dh(n[i],n[++i],n[++i]);Vt.__c&&Vt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Vt.__e(r,o.__v)}})}function mw(e){return typeof e!="object"||e==null||e.__b>0?e:Cu(e)?e.map(mw):e.constructor!==void 0?null:So({},e)}function GL(e,t,n,i,o,r,a,s,c){var l,u,p,f,d,g,h,m=n.props||Su,_=t.props,b=t.type;if(b=="svg"?o="http://www.w3.org/2000/svg":b=="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((d=r[l])&&"setAttribute"in d==!!b&&(b?d.localName==b:d.nodeType==3)){e=d,r[l]=null;break}}if(e==null){if(b==null)return document.createTextNode(_);e=document.createElementNS(o,b,_.is&&_),s&&(Vt.__m&&Vt.__m(t,r),s=!1),r=null}if(b==null)m===_||s&&e.data==_||(e.data=_);else{if(r=b=="textarea"&&_.defaultValue!=null?null:r&&wu.call(e.childNodes),!s&&r!=null)for(m={},l=0;l<e.attributes.length;l++)m[(d=e.attributes[l]).name]=d.value;for(l in m)d=m[l],l=="dangerouslySetInnerHTML"?p=d:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||ku(e,l,null,d,o);for(l in _)d=_[l],l=="children"?f=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||m[l]===d||ku(e,l,d,m[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=""),uw(t.type=="template"?e.content:e,Cu(f)?f:[f],t,n,i,b=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&Nr(n,0),s,c),r!=null)for(l=r.length;l--;)kh(r[l]);s&&b!="textarea"||(l="value",b=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||b=="progress"&&!g||b=="option"&&g!=m[l])&&ku(e,l,g,m[l],o),l="checked",h!=null&&h!=e[l]&&ku(e,l,h,m[l],o))}return e}function Dh(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){Vt.__e(o,n)}}function yw(e,t,n){var i,o;if(Vt.unmount&&Vt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Dh(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Vt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&yw(i[o],t,n||typeof e.type!="function");n||kh(e.__e),e.__c=e.__=e.__e=void 0}function VL(e,t,n){return this.constructor(e,n)}function vw(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Vt.__&&Vt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],Oh(t,e=t.__k=sw(Au,null,[e]),o||Su,Su,t.namespaceURI,o?null:t.firstChild?wu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),gw(r,e,a),e.props.children=null}wu=Ru.slice,Vt={__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}},nw=0,Pu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=So({},this.state),typeof e=="function"&&(e=e(So({},n),this.props)),e&&So(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),lw(this))},Pu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),lw(this))},Pu.prototype.render=Au,rr=[],ow=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,rw=function(e,t){return e.__v.__b-t.__v.__b},Tu.__r=0,Mh=Math.random().toString(8),Eu="__d"+Mh,Js="__a"+Mh,aw=/(PointerCapture)$|Capture$/i,Ah=0,Ph=dw(!1),Th=dw(!0);var bw=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,bw(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},xw=new Map;function WL(e){var t=xw.get(this);return t||(t=new Map,xw.set(this,t)),(t=bw(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(f){r===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):r===3&&(f||a)?(c.push(3,f,a),r=2):r===2&&a==="..."&&f?c.push(4,f,0):r===2&&a&&!f?c.push(5,0,!0,a):r>=5&&((a||!f&&r===5)&&(c.push(r,0,a,o),r=6),f&&(c.push(r,f,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 kt=WL.bind(sw),$a,cn,Lh,_w,ec=0,ww=[],gn=Vt,Ew=gn.__b,Sw=gn.__r,Rw=gn.diffed,Cw=gn.__c,Mw=gn.unmount,Aw=gn.__;function Ou(e,t){gn.__h&&gn.__h(cn,e,ec||t),ec=0;var n=cn.__H||(cn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Ih(e){return ec=1,UL(Tw,e)}function UL(e,t,n){var i=Ou($a++,2);if(i.t=e,!i.__c&&(i.__=[Tw(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=cn,!cn.__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(d){if(d.__N){u=!0;var g=d.__[0];d.__=d.__N,d.__N=void 0,g!==d.__[0]&&(p=!0)}}),r){var f=r.call(this,s,c,l);return u?f||p:f}return!u||p};cn.__f=!0;var r=cn.shouldComponentUpdate,a=cn.componentWillUpdate;cn.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)},cn.shouldComponentUpdate=o}return i.__N||i.__}function Du(e,t){var n=Ou($a++,3);!gn.__s&&$h(n.__H,t)&&(n.__=e,n.u=t,cn.__H.__h.push(n))}function Bh(e,t){var n=Ou($a++,4);!gn.__s&&$h(n.__H,t)&&(n.__=e,n.u=t,cn.__h.push(n))}function Lu(e){return ec=5,Ro(function(){return{current:e}},[])}function Ro(e,t){var n=Ou($a++,7);return $h(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function tc(e,t){return ec=8,Ro(function(){return e},t)}function qL(){for(var e;e=ww.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Iu),t.__h.some(Nh),t.__h=[]}catch(n){t.__h=[],gn.__e(n,e.__v)}}}gn.__b=function(e){cn=null,Ew&&Ew(e)},gn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Aw&&Aw(e,t)},gn.__r=function(e){Sw&&Sw(e),$a=0;var t=(cn=e.__c).__H;t&&(Lh===cn?(t.__h=[],cn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Iu),t.__h.some(Nh),t.__h=[],$a=0)),Lh=cn},gn.diffed=function(e){Rw&&Rw(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ww.push(t)!==1&&_w===gn.requestAnimationFrame||((_w=gn.requestAnimationFrame)||YL)(qL)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Lh=cn=null},gn.__c=function(e,t){t.some(function(n){try{n.__h.some(Iu),n.__h=n.__h.filter(function(i){return!i.__||Nh(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],gn.__e(i,n.__v)}}),Cw&&Cw(e,t)},gn.unmount=function(e){Mw&&Mw(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Iu(i)}catch(o){t=o}}),n.__H=void 0,t&&gn.__e(t,n.__v))};var Pw=typeof requestAnimationFrame=="function";function YL(e){var t,n=function(){clearTimeout(i),Pw&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Pw&&(t=requestAnimationFrame(n))}function Iu(e){var t=cn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),cn=t}function Nh(e){var t=cn;e.__c=e.__(),cn=t}function $h(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Tw(e,t){return typeof t=="function"?t(e):t}function KL(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ro(()=>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 kt`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${o&&kt`
14
14
  <button
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function Aw(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=Aw(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Du(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Aw(e))&&(i&&(i+=" "),i+=t);return i}function qL(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Eo(()=>YL(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return kt`
44
+ `}function kw(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=kw(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Bu(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=kw(e))&&(i&&(i+=" "),i+=t);return i}function XL(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Ro(()=>ZL(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return kt`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${r}>${r}</h3>
47
47
  ${a.map(l=>kt`
@@ -50,7 +50,7 @@
50
50
  ${l.entries.map(u=>kt`
51
51
  <li key=${u.id}>
52
52
  <${s(u)?"button":"span"}
53
- class=${KL(u,u===i)}
53
+ class=${QL(u,u===i)}
54
54
  onClick=${p=>c(p,u)}
55
55
  title=${u.title||u.label}
56
56
  data-id=${u.id}
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function YL(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 KL(e,t){return Du("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Pw(e,t){return`${e}-entry-${t.id}`}function XL(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 kt`
73
+ `}function ZL(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 QL(e,t){return Bu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Ow(e,t){return`${e}-entry-${t.id}`}function JL(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 kt`
74
74
  <li
75
- class=${Du("entry",{selected:i,disabled:n.disabled})}
75
+ class=${Bu("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${Pw(t,n)}
77
+ id=${Ow(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -88,7 +88,7 @@
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${Du("djs-popup-entry-name",n.className)}
91
+ class=${Bu("djs-popup-entry-name",n.className)}
92
92
  >
93
93
  ${n.imageUrl&&kt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&kt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function ZL(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=ku();Dh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&QL(m)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return kt`
134
+ `}function eI(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=Lu();Bh(()=>{if(!o||!o.current)return;const h=p.current;if(!h)return;const m=h.querySelector(".selected");m&&tI(m)},[t]);const f=()=>{o.current=!1},d=h=>{o.current||n(h)},g=()=>{o.current||n(null)};return kt`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${p}
@@ -144,7 +144,7 @@
144
144
  >
145
145
  ${i.map(h=>kt`
146
146
  ${h.name&&kt`
147
- <div key=${h.id} id=${Tw(r,h)} class="entry-header" title=${h.name}>
147
+ <div key=${h.id} id=${Dw(r,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?Tw(r,h):void 0}
155
+ aria-labelledby=${h.name?Dw(r,h):void 0}
156
156
  >
157
157
  ${h.entries.map(m=>kt`
158
- <${XL}
158
+ <${JL}
159
159
  key=${m.id}
160
160
  idPrefix=${r}
161
161
  entry=${m}
@@ -168,10 +168,10 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Tw(e,t){return`${e}-group-${t.id}`}function QL(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const JL=new Pr("djs-popup");function eI(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:f,onOpened:d,onClosed:g}=e,[h,m]=Oh([]);Tu(()=>{m([])},[f]);const[_,b]=Oh(""),y=_.trim().length>0,v=Eo(()=>iI(f),[f]),E=Eo(()=>fn(l)?v.length>5:!1,[l,v]),w=Eo(()=>{const W=h.length?h[h.length-1].entries:f;return E?y?p(v.filter(({searchable:Y})=>Y!==!1),_,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[E,y,v,_,p,h,f]),P=Eo(()=>y?w.length?[{id:"default",entries:w}]:[]:oI(w),[w,y]),[T,D]=Oh(w[0]),$=ku(null),N=ku(!1),H=Eo(()=>JL.next(),[]),X=`${H}-results`,Q=T&&Pw(H,T);Tu(()=>{const W=$.current;W&&w.includes(W)?D(W):D(w[0]),$.current=null},[w]);const ee=Qs(W=>{const Y=nI(P);let ge=Y.indexOf(T)+W;ge<0&&(ge=Y.length-1),ge>=Y.length&&(ge=0),N.current=!0,D(Y[ge])},[P,T]),We=Qs(W=>{W>0&&T&&T.entries&&(N.current=!0,m(Y=>[...Y,T])),W<0&&h.length>0&&(N.current=!0,$.current=h[h.length+W],m(Y=>Y.slice(0,W)))},[T,h]),qe=Qs((W,Y,ae)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),We(1)):n(W,Y,ae)},[n,We]),Ge=Qs(W=>{if(W.key==="Enter"&&T){const Y=W.target;return!!_r(Y,"a, button",!0)||T.disabled?void 0:qe(W,T)}if(W.key==="Backspace"){const Y=W.target;if(!(ff(Y,"input")&&Y.value!==""))return We(-1),W.preventDefault()}if(W.key==="ArrowUp")return ee(-1),W.preventDefault();if(W.key==="ArrowDown")return ee(1),W.preventDefault();if(W.key==="ArrowRight")return We(1),W.preventDefault();if(W.key==="ArrowLeft")return We(-1),W.preventDefault()},[T,ee,We,qe]),Re=Qs(W=>{ff(W.target,"input")&&b(()=>W.target.value)},[b]);Tu(()=>(d(),()=>{g()}),[]);const Z=!y&&h.length>0,oe=(a||o.length>0)&&!Z;return kt`
172
- <${kw}
171
+ `}function Dw(e,t){return`${e}-group-${t.id}`}function tI(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const nI=new kr("djs-popup");function iI(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:f,onOpened:d,onClosed:g}=e,[h,m]=Ih([]);Du(()=>{m([])},[f]);const[_,b]=Ih(""),y=_.trim().length>0,v=Ro(()=>aI(f),[f]),E=Ro(()=>pn(l)?v.length>5:!1,[l,v]),w=Ro(()=>{const W=h.length?h[h.length-1].entries:f;return E?y?p(v.filter(({searchable:Y})=>Y!==!1),_,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[E,y,v,_,p,h,f]),P=Ro(()=>y?w.length?[{id:"default",entries:w}]:[]:sI(w),[w,y]),[T,L]=Ih(w[0]),$=Lu(null),N=Lu(!1),H=Ro(()=>nI.next(),[]),X=`${H}-results`,Q=T&&Ow(H,T);Du(()=>{const W=$.current;W&&w.includes(W)?L(W):L(w[0]),$.current=null},[w]);const ee=tc(W=>{const Y=rI(P);let ge=Y.indexOf(T)+W;ge<0&&(ge=Y.length-1),ge>=Y.length&&(ge=0),N.current=!0,L(Y[ge])},[P,T]),We=tc(W=>{W>0&&T&&T.entries&&(N.current=!0,m(Y=>[...Y,T])),W<0&&h.length>0&&(N.current=!0,$.current=h[h.length+W],m(Y=>Y.slice(0,W)))},[T,h]),qe=tc((W,Y,ae)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),We(1)):n(W,Y,ae)},[n,We]),Ge=tc(W=>{if(W.key==="Enter"&&T){const Y=W.target;return!!Er(Y,"a, button",!0)||T.disabled?void 0:qe(W,T)}if(W.key==="Backspace"){const Y=W.target;if(!(gf(Y,"input")&&Y.value!==""))return We(-1),W.preventDefault()}if(W.key==="ArrowUp")return ee(-1),W.preventDefault();if(W.key==="ArrowDown")return ee(1),W.preventDefault();if(W.key==="ArrowRight")return We(1),W.preventDefault();if(W.key==="ArrowLeft")return We(-1),W.preventDefault()},[T,ee,We,qe]),Se=tc(W=>{gf(W.target,"input")&&b(()=>W.target.value)},[b]);Du(()=>(d(),()=>{g()}),[]);const Z=!y&&h.length>0,oe=(a||o.length>0)&&!Z;return kt`
172
+ <${Lw}
173
173
  onClose=${t}
174
- onKeyup=${Re}
174
+ onKeyup=${Se}
175
175
  onKeydown=${Ge}
176
176
  className=${i}
177
177
  position=${r}
@@ -180,16 +180,16 @@
180
180
  navigationStack=${h}
181
181
  >
182
182
  ${oe&&kt`
183
- <${qL}
183
+ <${XL}
184
184
  headerEntries=${o}
185
185
  onSelect=${n}
186
186
  selectedEntry=${T}
187
- setSelectedEntry=${D}
187
+ setSelectedEntry=${L}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
191
  ${Z&&kt`
192
- <${UL}
192
+ <${KL}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${m}
195
195
  />
@@ -221,10 +221,10 @@
221
221
  </div>
222
222
  `}
223
223
 
224
- <${ZL}
224
+ <${eI}
225
225
  groupedEntries=${P}
226
226
  selectedEntry=${T}
227
- setSelectedEntry=${D}
227
+ setSelectedEntry=${L}
228
228
  keyboardSelection=${N}
229
229
  onAction=${qe}
230
230
  idPrefix=${H}
@@ -257,11 +257,11 @@
257
257
  ${u&&w.length===0&&kt`
258
258
  <div class="djs-popup-no-results">${vn(u)?u(_):u}</div>
259
259
  `}
260
- </${kw}>
261
- `}function kw(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=ku();return Dh(()=>{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]),Dh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Tu(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!_r(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)}},[]),kt`
260
+ </${Lw}>
261
+ `}function Lw(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=Lu();return Bh(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),Bh(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Du(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Er(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)}},[]),kt`
262
262
  <div
263
- class=${Du("djs-popup",o)}
264
- style=${tI(e)}
263
+ class=${Bu("djs-popup",o)}
264
+ style=${oI(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,8 +269,8 @@
269
269
  >
270
270
  ${r}
271
271
  </div>
272
- `}function tI(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:fn(t)?n:void 0,maxWidth:fn(t)?"unset":void 0,"transform-origin":"top left"}}function nI(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function iI(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function oI(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 rI="data-id",Ow=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],aI=1e3;function Ut(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=fn(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()})}Ut.$inject=["config.popupMenu","eventBus","canvas","search"],Ut.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=Dw(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);gw(kt`
273
- <${eI}
272
+ `}function oI(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:pn(t)?n:void 0,maxWidth:pn(t)?"unset":void 0,"transform-origin":"top left"}}function rI(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function aI(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function sI(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 cI="data-id",Iw=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],lI=1e3;function Wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=pn(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()})}Wt.$inject=["config.popupMenu","eventBus","canvas","search"],Wt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=Bw(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),l=this._updateScale(this._current.container);vw(kt`
273
+ <${iI}
274
274
  onClose=${f=>this.close(f)}
275
275
  onSelect=${(f,d,g)=>this.trigger(f,d,g)}
276
276
  position=${c}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...r}}
286
286
  />
287
- `,this._current.container)},Ut.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var 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()},Ut.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()},Ut.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),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)}},Ut.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ut.prototype.reset=function(){const e=this._current.container;gw(null,e),qi(e)},Ut.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Ut.prototype._onOpened=function(){this._emit("opened")},Ut.prototype._onClosed=function(){this._emit("closed")},Ut.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Nt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Ut.prototype._bindAutoClose=function(){this._eventBus.once(Ow,this.close,this)},Ut.prototype._unbindAutoClose=function(){this._eventBus.off(Ow,this.close,this)},Ut.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),fn(n)&&e<n&&(o=n),fn(i)&&e>i&&(o=i)),o},Ut.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}},Ut.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},Ut.prototype.registerProvider=function(e,t,n){n||(n=t,t=aI),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Ut.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Ut.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=zi(r,["id"])});return}var o=i.getPopupMenuEntries(e);vn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Ut.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=zi(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);vn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Ut.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>vn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Ut.prototype.isOpen=function(){return!!this._current},Ut.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=_r(e.delegateTarget||e.target,".entry",!0),r=En(o,rI);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(vn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Ut.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function Dw(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=Dw(o.entries,[...t,...Lw(o.search)]):t.length&&(o.search=[...t,...Lw(o.search)]),o})}function Lw(e){return e?$e(e)?e:[e]:[]}function sI(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=cI(r,o,i);return a?{item:r,tokens:a}:[]}).sort(lI(i))}function cI(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=$e(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=Fw(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Fw(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function lI(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=uI(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=Iw;continue}const s=pI(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=Iw;continue}}return i}}function uI(e,t){return Bw(t)-Bw(e)}const Iw=.5,Na={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Bw(e){const t=e.reduce((s,c)=>s+Nw(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 Nw(e){if($e(e))return Math.max(...e.map(Nw));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Na.FULL:e.wordEnd?Na.START_FULL_WORD:Na.START_WORD_PART:e.wordStart?Na.WORD_START:Na.WORD_PART)*t:Na.NO_MATCH*t}function $w(e=""){return $e(e)?e.join(", "):e}function pI(e,t){return $w(e).localeCompare($w(t))}function Fw(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(fI),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,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),m=d||/\s/.test(e.charAt(p-1)),_=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:m,wordEnd:_,start:d,end:g,all:h});const b=h?t:[u];for(const y of b)i[y.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function fI(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const jw={search:["value",sI]},Bh={__depends__:[jw],__init__:["popupMenu"],popupMenu:["type",Ut]};var Hw={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},Wt.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()},Wt.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()},Wt.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)}},Wt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Wt.prototype.reset=function(){const e=this._current.container;vw(null,e),Yi(e)},Wt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Wt.prototype._onOpened=function(){this._emit("opened")},Wt.prototype._onClosed=function(){this._emit("closed")},Wt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Nt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Wt.prototype._bindAutoClose=function(){this._eventBus.once(Iw,this.close,this)},Wt.prototype._unbindAutoClose=function(){this._eventBus.off(Iw,this.close,this)},Wt.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),pn(n)&&e<n&&(o=n),pn(i)&&e>i&&(o=i)),o},Wt.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}},Wt.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},Wt.prototype.registerProvider=function(e,t,n){n||(n=t,t=lI),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Wt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Wt.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=Gi(r,["id"])});return}var o=i.getPopupMenuEntries(e);vn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Wt.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(r){var a=r.id;if(!a)throw new Error("entry ID is missing");n[a]=Gi(r,["id"])});return}var o=i.getPopupMenuHeaderEntries(e);vn(o)?n=o(n):z(o,function(r,a){n[a]=r})}),n},Wt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>vn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Wt.prototype.isOpen=function(){return!!this._current},Wt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Er(e.delegateTarget||e.target,".entry",!0),r=En(o,cI);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(vn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Wt.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 Bw(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=Bw(o.entries,[...t,...Nw(o.search)]):t.length&&(o.search=[...t,...Nw(o.search)]),o})}function Nw(e){return e?$e(e)?e:[e]:[]}function uI(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=pI(r,o,i);return a?{item:r,tokens:a}:[]}).sort(fI(i))}function pI(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=$e(s)?s.reduce((u,p)=>{const{tokens:f,matchedWords:d}=zw(p,t);return{tokens:[...u.tokens,f],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):zw(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function fI(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=dI(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=$w;continue}const s=hI(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=$w;continue}}return i}}function dI(e,t){return Fw(t)-Fw(e)}const $w=.5,Fa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Fw(e){const t=e.reduce((s,c)=>s+jw(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 jw(e){if($e(e))return Math.max(...e.map(jw));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Fa.FULL:e.wordEnd?Fa.START_FULL_WORD:Fa.START_WORD_PART:e.wordStart?Fa.WORD_START:Fa.WORD_PART)*t:Fa.NO_MATCH*t}function Hw(e=""){return $e(e)?e.join(", "):e}function hI(e,t){return Hw(e).localeCompare(Hw(t))}function zw(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(gI),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,f=s.index+u.length,d=p===0,g=f===e.length,h=!!((l=s.groups)!=null&&l.all),m=d||/\s/.test(e.charAt(p-1)),_=g||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:m,wordEnd:_,start:d,end:g,all:h});const b=h?t:[u];for(const y of b)i[y.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function gI(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Gw={search:["value",uI]},Fh={__depends__:[Gw],__init__:["popupMenu"],popupMenu:["type",Wt]};var Vw={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
288
288
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
289
289
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
290
290
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -312,8 +312,8 @@
312
312
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
313
313
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
314
314
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
315
- </svg>`},dI=900;function $a(e,t,n,i){e.registerProvider(dI,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}$a.$inject=["contextPad","popupMenu","translate","canvas"],$a.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},$a.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},$a.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Hw.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},$a.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 hI=["left","center","right","top","middle","bottom"];function Js(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Js.$inject=["popupMenu","alignElements","translate","rules"],Js.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Js.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Js.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(hI,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:Hw[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Lu(e){Si.call(this,e)}Lu.$inject=["eventBus"],Ce(Lu,Si),Lu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=it(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=tl(n),n.length<2?!1:n})};const gI={__depends__:[CL,Q_,Bh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",$a],alignElementsMenuProvider:["type",Js],bpmnAlignElements:["type",Lu]};function So(e,t,n,i){pe.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=mp(Kr(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Xr(s,function(p){return p.parent.id});z(u,function(p,f){$e(l)&&(p=p.filter(function(d){return Ot(l,Zr({id:d.id}))})),o._expand(p,f)})}}),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)})}So.$inject=["eventBus","elementRegistry","modeling","rules"],Ce(So,pe),So.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Be(an(e)),r=Be(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),ol(V({},r,a))},So.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(mI(i,t)){var o=yI(Li(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},So.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},So.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},So.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function mI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function yI(e,t){var n="";return e=Be(e),t=Be(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Iu(e){e.invoke(So,this)}Iu.$inject=["injector"],Ce(Iu,So),Iu.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ec(e){Si.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ec.$inject=["eventBus"],Ce(ec,Si),ec.prototype.canResize=function(e,t){return!1};function Bu(e,t){ec.call(this,e),this._modeling=t}Ce(Bu,ec),Bu.$inject=["eventBus","modeling"],Bu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const vI={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Iu],bpmnAutoResizeProvider:["type",Bu]};function Fa(e,t,n){this._canvas=n,this._opts=V({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()})}Fa.$inject=["config.autoScroll","eventBus","canvas"],Fa.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++)bI(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 bI(e,t,n){return t<e&&e<n}Fa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Fa.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Fa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Cr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const xI={__depends__:[vo],__init__:["autoScroll"],autoScroll:["type",Fa]};var zw="djs-bendpoint",Gw="djs-segment-dragger";function _I(e,t){var n=Cr(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 Nh(e,t,n){var i=_I(e,n),o=Zf(t,i);return o}function $h(e,t){var n=Oe("g");st(n).add(zw),ze(e,n);var i=Oe("circle");we(i,{cx:0,cy:0,r:4}),st(i).add("djs-visual"),ze(n,i);var o=Oe("circle");return we(o,{cx:0,cy:0,r:10}),st(o).add("djs-hit"),ze(n,o),t&&st(n).add(t),n}function wI(e,t,n,i){var o=Oe("g");ze(e,o);var r=18,a=6,s=11,c=SI(t,n,i),l=a+s,u=Oe("rect");we(u,{x:-r/2,y:-a/2,width:r,height:a}),st(u).add("djs-visual"),ze(o,u);var p=Oe("rect");return we(p,{x:-c/2,y:-l/2,width:c,height:l}),st(p).add("djs-hit"),ze(o,p),av(o,i==="v"?90:0),o}function Vw(e,t,n){var i=Oe("g"),o=Cf(t,n),r=po(t,n);return ze(e,i),wI(i,t,n,r),st(i).add(Gw),st(i).add(r==="h"?"horizontal":"vertical"),On(i,o.x,o.y),i}function Fh(e){return Math.abs(Math.round(e*2/3))}function EI(e,t){var n=RI(e,t);return id(e,n)}function SI(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Fh(n==="h"?i:o)}function RI(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=Uv(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function Ww(e,t,n,i,o){function r(y,v,E){var w=y.index,P=y.point,T,D,$,N,H,X;return w<=0||y.bendpoint?!1:(T=v[w-1],D=v[w],$=Cf(T,D),N=po(T,D),H=Math.abs(P.x-$.x),X=Math.abs(P.y-$.y),N&&H<=E&&X<=E)}function a(y,v){var E=y.waypoints,w,P,T,D;return v.index<=0||v.bendpoint||(w={start:E[v.index-1],end:E[v.index]},P=po(w.start,w.end),!P)?null:(P==="h"?T=w.end.x-w.start.x:T=w.end.y-w.start.y,D=Fh(T)/2,D)}function s(y,v){var E=v.waypoints,w=Nh(t,E,y),P;if(w){P=a(v,w);var T;if(r(w,E,P)?T=o.start(y,v,w.index):T=i.start(y,v,w.index,!w.bendpoint),T!==!1)return!0}}function c(y,v,E){Le.bind(y,v,function(w){n.triggerMouseEvent(v,w,E),w.stopPropagation()})}function l(y,v){var E=t.getLayer("overlays"),w=wt('.djs-bendpoints[data-element-id="'+Dr(y.id)+'"]',E);return!w&&v&&(w=Oe("g"),we(w,{"data-element-id":y.id}),st(w).add("djs-bendpoints"),ze(E,w),c(w,"mousedown",y),c(w,"click",y),c(w,"dblclick",y)),w}function u(y,v){return wt('.djs-segment-dragger[data-segment-idx="'+y+'"]',v)}function p(y,v){v.waypoints.forEach(function(E,w){var P=$h(y);ze(y,P),On(P,E.x,E.y)}),$h(y,"floating")}function f(y,v){for(var E=v.waypoints,w,P,T,D=1;D<E.length;D++)w=E[D-1],P=E[D],po(w,P)&&(T=Vw(y,w,P),we(T,{"data-segment-idx":D}),c(T,"mousemove",v))}function d(y){z(ls("."+zw,y),function(v){rn(v)})}function g(y){z(ls("."+Gw,y),function(v){rn(v)})}function h(y){var v=l(y);return v||(v=l(y,!0),p(v,y),f(v,y)),v}function m(y){var v=l(y);v&&(g(v),d(v),f(v,y),p(v,y))}function _(y,v){var E=wt(".floating",y),w=v.point;E&&(On(E,w.x,w.y),st(E).add("positioned"))}function b(y,v,E){var w=u(v.index,y),P=E[v.index-1],T=E[v.index],D=v.point,$=Cf(P,T),N=po(P,T),H,X;w&&(H=CI(w),X={x:D.x-$.x,y:D.y-$.y},N==="v"&&(X={x:X.y,y:X.x}),On(H,X.x,X.y))}e.on("connection.changed",function(y){m(y.element)}),e.on("connection.remove",function(y){var v=l(y.element);v&&rn(v)}),e.on("element.marker.update",function(y){var v=y.element,E;v.waypoints&&(E=h(v),y.add?st(E).add(y.marker):st(E).remove(y.marker))}),e.on("element.mousemove",function(y){var v=y.element,E=v.waypoints,w,P;if(E){if(w=l(v,!0),P=Nh(t,E,y.originalEvent),!P)return;_(w,P),P.bendpoint||b(w,P,E)}}),e.on("element.mousedown",function(y){if(qo(y)){var v=y.originalEvent,E=y.element;if(E.waypoints)return s(v,E)}}),e.on("selection.changed",function(y){var v=y.newSelection,E=v[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(y){var v=y.element;v.waypoints&&h(v)}),e.on("element.out",function(y){var v=y.element;if(v.waypoints){var E=l(v);if(E){var w=wt(".floating",E);w&&st(w).remove("positioned")}}}),e.on("element.updateId",function(y){var v=y.element,E=y.newId;if(v.waypoints){var w=l(v);w&&we(w,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}Ww.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function CI(e){return wt(".djs-visual",e)}var Uw=Math.round,Br="reconnectStart",Nr="reconnectEnd",tc="updateWaypoints";function jh(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=Br:!l&&c===d.length-1?g=Nr:g=tc;var h=g===tc?"connection.updateWaypoints":"connection.reconnect",m=o.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=o.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===tc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===Br?p:l,target:f===Nr?p:u}),d){s.source=f===Br?p:l,s.target=f===Nr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Nr?p:u,target:f===Br?p:l})),d&&(s.source=f===Nr?p:u,s.target=f===Br?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!==tc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},_={x:Uw(a.x),y:Uw(a.y)};if(!c)return!1;h===tc?(p?f.splice(l,0,_):f[l]=_,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,DA(f),m)):(h===Br?(m.docking="source",Nu(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Nr&&(m.docking="target",Nu(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,_,m))},this)}jh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],jh.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 Nu(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===Br)return t&&i&&t===i&&n!==i;if(o===Nr)return t&&n&&t===n&&n!==i}var MI="reconnectStart",AI="reconnectEnd",qw="updateWaypoints",nc="connect-ok",$u="connect-not-ok",Yw="connect-hover",Kw="djs-updating",Xw="djs-dragging",Zw=1100;function Qw(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 f=a.draggerGfx=$h(i.getLayer("overlays"));st(f).add("djs-dragging"),i.addMarker(c,Xw),i.addMarker(c,Kw)}),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,Yw),l===qw)return;s?(i.removeMarker(c,$u),i.addMarker(c,nc)):s===!1&&(i.removeMarker(c,nc),i.addMarker(c,$u))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Zw,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Yw),i.removeMarker(s,c?nc:$u))}),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,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:r.x,y:r.y},_=a.hints||{},b={};o&&(_.connectionStart&&(b.connectionStart=_.connectionStart),_.connectionEnd&&(b.connectionEnd=_.connectionEnd),p===MI?Nu(a)?(b.connectionEnd=b.connectionEnd||m,b.source=g,b.target=u||d,h=h.reverse()):(b.connectionStart=b.connectionStart||m,b.source=u||d,b.target=g):p===AI?Nu(a)?(b.connectionStart=b.connectionStart||m,b.source=u||g,b.target=d,h=h.reverse()):(b.connectionEnd=b.connectionEnd||m,b.source=d,b.target=u||g):(b.noCropping=!0,b.noLayout=!0,h[c]=m),p===qw&&(h=e.cropWaypoints(f,h)),b.waypoints=h,o.drawPreview(a,s,b)),On(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Zw,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,rn(c),i.removeMarker(s,Kw),i.removeMarker(s,Xw),l&&(i.removeMarker(l,nc),i.removeMarker(l,u?nc:$u)),o&&o.cleanUp(a)})}Qw.$inject=["bendpointMove","injector","eventBus","canvas"];var Jw="connect-hover",e0="djs-updating";function t0(e,t,n){return Hh(e,t,e[t]+n)}function Hh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function PI(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 Hh(t,i,s)}function n0(e){return e==="x"?"y":"x"}function i0(e,t,n){var i,o;return e.original?e.original:(i=je(t),o=n0(n),Hh(e,o,i[o]))}function o0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,_=d,b=f.waypoints,y=b[m],v=b[_],E=Nh(n,b,p),w,P,T;if(w=po(y,v),!!w)return P=w==="v"?"x":"y",m===0&&(y=i0(y,f.source,P)),_===b.length-1&&(v=i0(v,f.target,P)),E?T=E.point:T={x:(y.x+v.x)/2,y:(y.y+v.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:_,segmentStart:y,segmentEnd:v,axis:P,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:P==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],_=p.segmentEndIndex+f,b=g[_],y=n0(p.axis),v=PI(d,m,b,y);On(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Rf(p[m-1],p[m+1],h)?(d=m<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=Vw(g,f.segmentStart,f.segmentEnd),st(f.draggerGfx).add("djs-dragging"),n.addMarker(d,e0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,_=f.segmentEnd,b=f.axis,y=f.originalWaypoints.slice(),v=t0(m,b,p["d"+b]),E=t0(_,b,p["d"+b]),w=y.length,P=0;y[g]=v,y[h]=E;var T,D;g<2&&(T=kn(d.source,v),g===1?T==="intersect"&&(y.shift(),y[0]=v,P--):T!=="intersect"&&(y.unshift(m),P++)),h>w-3&&(D=kn(d.target,E),h===w-2?D==="intersect"&&(y.pop(),y[y.length-1]=E):D!=="intersect"&&y.push(_)),f.newWaypoints=d.waypoints=s(d,y),l(f,P,p),f.newSegmentStartIndex=g+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Jw)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Jw)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&rn(f.draggerGfx),n.removeMarker(d,e0)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(g,h),_=m.waypoints,b=s(d,_),y=m.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+y}};r.updateWaypoints(d,b,v)})}o0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var TI=Math.abs,r0=Math.round;function kI(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],TI(o-e)<=n)return o}function a0(e){return{x:e.x,y:e.y}}function s0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ai(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:r0(e.x+e.width/2),y:r0(e.y+e.height/2)}}function ja(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function un(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 c0(e){return e.children||[]}var OI=Math.abs,l0=Math.round,zh=10;function u0(e){function t(r,a){if($e(r)){for(var s=r.length;s--;)if(OI(r[s]-a)<=zh)return r[s]}else{r=+r;var c=a%r;if(c<zh)return a-c;if(c>r-zh)return a-c+r}return a}function n(r,a){if(r.waypoints)return EI(a,r);if(r.width)return{x:l0(r.width/2+r.x),y:l0(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,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,r)),d>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(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,f=c-u;V(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&un(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&un(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:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!Pt(s)||!c||!c.x||!c.y||(un(r,"x",c.x),un(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,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;V(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&un(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&un(r,"y",d)}})}u0.$inject=["eventBus"];const DI={__depends__:[vo,Ji],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Ww],bendpointMove:["type",jh],bendpointMovePreview:["type",Qw],connectionSegmentMove:["type",o0],bendpointSnapping:["type",u0]};function p0(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),!Yr(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!Yr(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Gh(s)?u:l,connectionEnd:Gh(s)?l:u};dn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){dn(c)||(l=c,c=je(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}p0.$inject=["eventBus","dragging","modeling","rules"];function Gh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var LI=1100,II=900,f0="connect-ok",d0="connect-not-ok";function h0(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,f=r.connectionStart||u,d=r.connectionEnd||{x:o.x,y:o.y},g=f,h=d;Gh(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",II,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?f0:d0)}),t.on(["connect.out","connect.cleanup"],LI,function(o){var r=o.hover;r&&(n.removeMarker(r,f0),n.removeMarker(r,d0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}h0.$inject=["injector","eventBus","canvas"];const Vh={__depends__:[Ri,Ji,vo],__init__:["connectPreview"],connect:["type",p0],connectPreview:["type",h0]};var BI="djs-dragger";function Ro(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)}Ro.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ro.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,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),us(i),o||(o=e.getConnection=NI(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?je(r):c,a?je(a):l]),this._connectionDocking&&(r||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,r,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Ro.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||je(n),r=t.connectionEnd||je(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ze(e,s)},Ro.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&&ys(r,s,!0)||e,t=i&&ys(a,s,!1)||t,[e,t]},Ro.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&rn(e.connectionPreviewGfx)},Ro.prototype.getConnection=function(e){var t=$I(e);return this._elementFactory.createConnection(t)},Ro.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return we(e,{pointerEvents:"none"}),st(e).add(BI),ze(this._canvas.getActiveLayer(),e),e},Ro.prototype.createNoopConnection=function(e,t){return ds([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function NI(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 $I(e){return dn(e)?e:{}}const FI={__init__:["connectionPreview"],connectionPreview:["type",Ro]},Fu="complex-preview";class g0{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(Fu);n.filter(s=>!jI(s)).forEach(s=>{let c;Pt(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(Ho(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(Ho(c),s),On(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);Pt(s)?On(l,c.x,c.y):On(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",Oe("g"));this._graphicsFactory.drawShape(Ho(l),s,{width:c.width,height:c.height}),On(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){us(this._canvas.getLayer(Fu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Fu)}hide(){this._canvas.hideLayer(Fu)}}g0.$inject=["canvas","graphicsFactory","previewSupport"];function jI(e){return e.hidden}const HI={__depends__:[Pa],__init__:["complexPreview"],complexPreview:["type",g0]},m0=Math.round;function ju(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}ju.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(V({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;V(l,{x:u.x-m0(l.width/2),y:u.y-m0(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=r.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=o.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Yr(d))})},ju.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ju.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const zI={__depends__:[pu,HI,ph],__init__:["appendPreview"],appendPreview:["type",ju]};var y0=Math.min,v0=Math.max;function Wh(e){e.preventDefault()}function ic(e){e.stopPropagation()}function GI(e){return e.nodeType===Node.TEXT_NODE}function VI(e){return[].slice.call(e)}function Ni(e){this.container=e.container,this.parent=Nt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=wt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=qn(this.autoResize,this),this.handlePaste=qn(this.handlePaste,this)}Ni.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=Li(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(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=Li(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Le.bind(a,"keydown",this.keyHandler),Le.bind(a,"mousedown",ic),Le.bind(a,"paste",o.handlePaste),Le.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Le.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Ni.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var o=this.autoResize(n);o&&this.resizeHandler(o)}},Ni.prototype.insertText=function(e){e=WI(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Ni.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=VI(a.childNodes),c,l;if(GI(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 f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&qi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Ni.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),o=t.scrollHeight;e.style.height=o+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:o-i.height})}},Ni.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=Nt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Wh(g),ic(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Le.bind(document,"mousemove",f),Le.bind(document,"mouseup",d)},f=function(g){Wh(g),ic(g);var h=y0(v0(l+g.clientX-s,i),r),m=y0(v0(u+g.clientY-c,o),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Wh(g),ic(g),Le.unbind(document,"mousemove",f,!1),Le.unbind(document,"mouseup",d,!1)};Le.bind(n,"mousedown",p)}V(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Ni.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Le.unbind(t,"keydown",this.keyHandler),Le.unbind(t,"mousedown",ic),Le.unbind(t,"input",this.autoResize),Le.unbind(t,"paste",this.handlePaste),Le.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),qi(n)),qi(e)},Ni.prototype.getValue=function(){return this.content.innerText.trim()},Ni.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Ni.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function WI(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function si(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ni({container:t.getContainer(),keyHandler:qn(this._handleKey,this),resizeHandler:qn(this._handleResize,this),focusoutHandler:qn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}si.$inject=["eventBus","canvas"],si.prototype.registerProvider=function(e){this._providers.push(e)},si.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},si.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},si.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},si.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},si.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},si.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()}},si.prototype.getValue=function(){return this._textbox.getValue()},si.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()},si.prototype._handleResize=function(e){this._fire("resize",e)},si.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},si.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ot(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const b0={__depends__:[Hl],__init__:["directEditing"],directEditing:["type",si]};function UI(e){return function(t){var n=t.target,i=de(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===ct(e);return!r||!a||!s||!c}}const qI={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function ue(e,t={}){var n=qI[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var YI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start")],KI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"})],XI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("timer-intermediate-catch"),ue("escalation-intermediate-throw"),ue("conditional-intermediate-catch"),ue("link-intermediate-catch"),ue("link-intermediate-throw"),ue("compensation-intermediate-throw"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw")],ZI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-end"),ue("escalation-end"),ue("error-end"),ue("cancel-end"),ue("compensation-end"),ue("signal-end"),ue("terminate-end")],QI=[ue("exclusive-gateway"),ue("parallel-gateway"),ue("inclusive-gateway"),ue("complex-gateway"),ue("event-based-gateway")],JI=[ue("transaction"),ue("event-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("collapsed-subprocess")],eB=[ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("transaction"),ue("event-subprocess"),ue("collapsed-ad-hoc-subprocess")],x0=[ue("transaction"),ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("event-subprocess")],tB=x0,_0=[ue("task"),ue("user-task"),ue("service-task"),ue("send-task"),ue("receive-task"),ue("manual-task"),ue("rule-task"),ue("script-task"),ue("call-activity"),ue("collapsed-subprocess"),ue("expanded-subprocess"),ue("collapsed-ad-hoc-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],nB=[ue("data-store-reference")],iB=[ue("data-object-reference")],oB=[ue("message-boundary"),ue("timer-boundary"),ue("escalation-boundary"),ue("conditional-boundary"),ue("error-boundary"),ue("cancel-boundary"),ue("signal-boundary"),ue("compensation-boundary"),ue("non-interrupting-message-boundary"),ue("non-interrupting-timer-boundary"),ue("non-interrupting-escalation-boundary"),ue("non-interrupting-conditional-boundary"),ue("non-interrupting-signal-boundary")],rB=[ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start"),ue("error-start"),ue("escalation-start"),ue("compensation-start"),ue("non-interrupting-message-start"),ue("non-interrupting-timer-start"),ue("non-interrupting-conditional-start"),ue("non-interrupting-signal-start"),ue("non-interrupting-escalation-start")],aB=[{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"}],sB=[ue("expanded-pool"),ue("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],cB={"bpmn:MessageEventDefinition":[ue("message-start"),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("message-end")],"bpmn:TimerEventDefinition":[ue("timer-start"),ue("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ue("conditional-start"),ue("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ue("signal-start"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw"),ue("signal-end")],"bpmn:ErrorEventDefinition":[ue("error-start"),ue("error-end")],"bpmn:EscalationEventDefinition":[ue("escalation-start"),ue("escalation-intermediate-throw"),ue("escalation-end")],"bpmn:CompensateEventDefinition":[ue("compensation-start"),ue("compensation-intermediate-throw"),ue("compensation-end")]};const w0={"start-event-non-interrupting":`
315
+ </svg>`},mI=900;function ja(e,t,n,i){e.registerProvider(mI,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}ja.$inject=["contextPad","popupMenu","translate","canvas"],ja.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},ja.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},ja.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Vw.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},ja.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 yI=["left","center","right","top","middle","bottom"];function nc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}nc.$inject=["popupMenu","alignElements","translate","rules"],nc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},nc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},nc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return z(yI,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:Vw[r],action:function(){t.trigger(e,r),i.close()}}}),o};function Nu(e){Si.call(this,e)}Nu.$inject=["eventBus"],Ce(Nu,Si),Nu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=it(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=ol(n),n.length<2?!1:n})};const vI={__depends__:[PL,tw,Fh],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",ja],alignElementsMenuProvider:["type",nc],bpmnAlignElements:["type",Nu]};function Co(e,t,n,i){pe.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=bp(Zr(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Qr(s,function(p){return p.parent.id});z(u,function(p,f){$e(l)&&(p=p.filter(function(d){return Ot(l,Jr({id:d.id}))})),o._expand(p,f)})}}),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)})}Co.$inject=["eventBus","elementRegistry","modeling","rules"],Ce(Co,pe),Co.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Be(rn(e)),r=Be(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),sl(V({},r,a))},Co.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(bI(i,t)){var o=xI(Ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Co.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Co.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Co.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function bI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function xI(e,t){var n="";return e=Be(e),t=Be(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function $u(e){e.invoke(Co,this)}$u.$inject=["injector"],Ce($u,Co),$u.prototype.resize=function(e,t,n){M(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function ic(e){Si.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ic.$inject=["eventBus"],Ce(ic,Si),ic.prototype.canResize=function(e,t){return!1};function Fu(e,t){ic.call(this,e),this._modeling=t}Ce(Fu,ic),Fu.$inject=["eventBus","modeling"],Fu.prototype.canResize=function(e,t){if(M(t.di,"bpmndi:BPMNPlane")||!M(t,"bpmn:Participant")&&!M(t,"bpmn:Lane")&&!M(t,"bpmn:SubProcess"))return!1;var n=!0;return z(e,function(i){if(M(i,"bpmn:Lane")||et(i)){n=!1;return}}),n};const _I={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",$u],bpmnAutoResizeProvider:["type",Fu]};function Ha(e,t,n){this._canvas=n,this._opts=V({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()})}Ha.$inject=["config.autoScroll","eventBus","canvas"],Ha.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++)wI(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 wI(e,t,n){return t<e&&e<n}Ha.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ha.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Ha.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Ar(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const EI={__depends__:[xo],__init__:["autoScroll"],autoScroll:["type",Ha]};var Ww="djs-bendpoint",Uw="djs-segment-dragger";function SI(e,t){var n=Ar(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 jh(e,t,n){var i=SI(e,n),o=ed(t,i);return o}function Hh(e,t){var n=Oe("g");st(n).add(Ww),ze(e,n);var i=Oe("circle");we(i,{cx:0,cy:0,r:4}),st(i).add("djs-visual"),ze(n,i);var o=Oe("circle");return we(o,{cx:0,cy:0,r:10}),st(o).add("djs-hit"),ze(n,o),t&&st(n).add(t),n}function RI(e,t,n,i){var o=Oe("g");ze(e,o);var r=18,a=6,s=11,c=MI(t,n,i),l=a+s,u=Oe("rect");we(u,{x:-r/2,y:-a/2,width:r,height:a}),st(u).add("djs-visual"),ze(o,u);var p=Oe("rect");return we(p,{x:-c/2,y:-l/2,width:c,height:l}),st(p).add("djs-hit"),ze(o,p),lv(o,i==="v"?90:0),o}function qw(e,t,n){var i=Oe("g"),o=Pf(t,n),r=ho(t,n);return ze(e,i),RI(i,t,n,r),st(i).add(Uw),st(i).add(r==="h"?"horizontal":"vertical"),On(i,o.x,o.y),i}function zh(e){return Math.abs(Math.round(e*2/3))}function CI(e,t){var n=AI(e,t);return ad(e,n)}function MI(e,t,n){var i=t.x-e.x,o=t.y-e.y;return zh(n==="h"?i:o)}function AI(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=Kv(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function Yw(e,t,n,i,o){function r(y,v,E){var w=y.index,P=y.point,T,L,$,N,H,X;return w<=0||y.bendpoint?!1:(T=v[w-1],L=v[w],$=Pf(T,L),N=ho(T,L),H=Math.abs(P.x-$.x),X=Math.abs(P.y-$.y),N&&H<=E&&X<=E)}function a(y,v){var E=y.waypoints,w,P,T,L;return v.index<=0||v.bendpoint||(w={start:E[v.index-1],end:E[v.index]},P=ho(w.start,w.end),!P)?null:(P==="h"?T=w.end.x-w.start.x:T=w.end.y-w.start.y,L=zh(T)/2,L)}function s(y,v){var E=v.waypoints,w=jh(t,E,y),P;if(w){P=a(v,w);var T;if(r(w,E,P)?T=o.start(y,v,w.index):T=i.start(y,v,w.index,!w.bendpoint),T!==!1)return!0}}function c(y,v,E){Ie.bind(y,v,function(w){n.triggerMouseEvent(v,w,E),w.stopPropagation()})}function l(y,v){var E=t.getLayer("overlays"),w=Et('.djs-bendpoints[data-element-id="'+Ir(y.id)+'"]',E);return!w&&v&&(w=Oe("g"),we(w,{"data-element-id":y.id}),st(w).add("djs-bendpoints"),ze(E,w),c(w,"mousedown",y),c(w,"click",y),c(w,"dblclick",y)),w}function u(y,v){return Et('.djs-segment-dragger[data-segment-idx="'+y+'"]',v)}function p(y,v){v.waypoints.forEach(function(E,w){var P=Hh(y);ze(y,P),On(P,E.x,E.y)}),Hh(y,"floating")}function f(y,v){for(var E=v.waypoints,w,P,T,L=1;L<E.length;L++)w=E[L-1],P=E[L],ho(w,P)&&(T=qw(y,w,P),we(T,{"data-segment-idx":L}),c(T,"mousemove",v))}function d(y){z(fs("."+Ww,y),function(v){on(v)})}function g(y){z(fs("."+Uw,y),function(v){on(v)})}function h(y){var v=l(y);return v||(v=l(y,!0),p(v,y),f(v,y)),v}function m(y){var v=l(y);v&&(g(v),d(v),f(v,y),p(v,y))}function _(y,v){var E=Et(".floating",y),w=v.point;E&&(On(E,w.x,w.y),st(E).add("positioned"))}function b(y,v,E){var w=u(v.index,y),P=E[v.index-1],T=E[v.index],L=v.point,$=Pf(P,T),N=ho(P,T),H,X;w&&(H=PI(w),X={x:L.x-$.x,y:L.y-$.y},N==="v"&&(X={x:X.y,y:X.x}),On(H,X.x,X.y))}e.on("connection.changed",function(y){m(y.element)}),e.on("connection.remove",function(y){var v=l(y.element);v&&on(v)}),e.on("element.marker.update",function(y){var v=y.element,E;v.waypoints&&(E=h(v),y.add?st(E).add(y.marker):st(E).remove(y.marker))}),e.on("element.mousemove",function(y){var v=y.element,E=v.waypoints,w,P;if(E){if(w=l(v,!0),P=jh(t,E,y.originalEvent),!P)return;_(w,P),P.bendpoint||b(w,P,E)}}),e.on("element.mousedown",function(y){if(Ko(y)){var v=y.originalEvent,E=y.element;if(E.waypoints)return s(v,E)}}),e.on("selection.changed",function(y){var v=y.newSelection,E=v[0];E&&E.waypoints&&h(E)}),e.on("element.hover",function(y){var v=y.element;v.waypoints&&h(v)}),e.on("element.out",function(y){var v=y.element;if(v.waypoints){var E=l(v);if(E){var w=Et(".floating",E);w&&st(w).remove("positioned")}}}),e.on("element.updateId",function(y){var v=y.element,E=y.newId;if(v.waypoints){var w=l(v);w&&we(w,{"data-element-id":E})}}),this.addHandles=h,this.updateHandles=m,this.getBendpointsContainer=l,this.getSegmentDragger=u}Yw.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function PI(e){return Et(".djs-visual",e)}var Kw=Math.round,$r="reconnectStart",Fr="reconnectEnd",oc="updateWaypoints";function Gh(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,g;!l&&c===0?g=$r:!l&&c===d.length-1?g=Fr:g=oc;var h=g===oc?"connection.updateWaypoints":"connection.reconnect",m=o.allowed(h,{connection:s,source:p,target:f});if(m===!1&&(m=o.allowed(h,{connection:s,source:f,target:p})),m!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:m,bendpointIndex:c,connection:s,source:p,target:f,insert:l,type:g}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var g=f===oc?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=o.allowed(g,{connection:c,source:f===$r?p:l,target:f===Fr?p:u}),d){s.source=f===$r?p:l,s.target=f===Fr?p:u;return}d===!1&&(d=s.allowed=o.allowed(g,{connection:c,source:f===Fr?p:u,target:f===$r?p:l})),d&&(s.source=f===Fr?p:u,s.target=f===$r?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!==oc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,f=u.waypoints.slice(),d=s.source,g=s.target,h=s.type,m=s.hints||{},_={x:Kw(a.x),y:Kw(a.y)};if(!c)return!1;h===oc?(p?f.splice(l,0,_):f[l]=_,m.bendpointMove={insert:p,bendpointIndex:l},f=this.cropWaypoints(u,f),r.updateWaypoints(u,BA(f),m)):(h===$r?(m.docking="source",ju(s)&&(m.docking="target",m.newWaypoints=f.reverse())):h===Fr&&(m.docking="target",ju(s)&&(m.docking="source",m.newWaypoints=f.reverse())),r.reconnect(u,d,g,_,m))},this)}Gh.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Gh.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 ju(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===$r)return t&&i&&t===i&&n!==i;if(o===Fr)return t&&n&&t===n&&n!==i}var TI="reconnectStart",kI="reconnectEnd",Xw="updateWaypoints",rc="connect-ok",Hu="connect-not-ok",Zw="connect-hover",Qw="djs-updating",Jw="djs-dragging",e0=1100;function t0(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 f=a.draggerGfx=Hh(i.getLayer("overlays"));st(f).add("djs-dragging"),i.addMarker(c,Jw),i.addMarker(c,Qw)}),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,Zw),l===Xw)return;s?(i.removeMarker(c,Hu),i.addMarker(c,rc)):s===!1&&(i.removeMarker(c,rc),i.addMarker(c,Hu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],e0,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Zw),i.removeMarker(s,c?rc:Hu))}),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,f=a.connection,d=f.source,g=f.target,h=f.waypoints.slice(),m={x:r.x,y:r.y},_=a.hints||{},b={};o&&(_.connectionStart&&(b.connectionStart=_.connectionStart),_.connectionEnd&&(b.connectionEnd=_.connectionEnd),p===TI?ju(a)?(b.connectionEnd=b.connectionEnd||m,b.source=g,b.target=u||d,h=h.reverse()):(b.connectionStart=b.connectionStart||m,b.source=u||d,b.target=g):p===kI?ju(a)?(b.connectionStart=b.connectionStart||m,b.source=u||g,b.target=d,h=h.reverse()):(b.connectionEnd=b.connectionEnd||m,b.source=d,b.target=u||g):(b.noCropping=!0,b.noLayout=!0,h[c]=m),p===Xw&&(h=e.cropWaypoints(f,h)),b.waypoints=h,o.drawPreview(a,s,b)),On(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],e0,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,on(c),i.removeMarker(s,Qw),i.removeMarker(s,Jw),l&&(i.removeMarker(l,rc),i.removeMarker(l,u?rc:Hu)),o&&o.cleanUp(a)})}t0.$inject=["bendpointMove","injector","eventBus","canvas"];var n0="connect-hover",i0="djs-updating";function o0(e,t,n){return Vh(e,t,e[t]+n)}function Vh(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function OI(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 Vh(t,i,s)}function r0(e){return e==="x"?"y":"x"}function a0(e,t,n){var i,o;return e.original?e.original:(i=je(t),o=r0(n),Vh(e,o,i[o]))}function s0(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var g,h=n.getGraphics(f),m=d-1,_=d,b=f.waypoints,y=b[m],v=b[_],E=jh(n,b,p),w,P,T;if(w=ho(y,v),!!w)return P=w==="v"?"x":"y",m===0&&(y=a0(y,f.source,P)),_===b.length-1&&(v=a0(v,f.target,P)),E?T=E.point:T={x:(y.x+v.x)/2,y:(y.y+v.y)/2},g={connection:f,segmentStartIndex:m,segmentEndIndex:_,segmentStart:y,segmentEnd:v,axis:P,dragPosition:T},i.init(p,T,"connectionSegment.move",{cursor:P==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:g}})};function s(p,f){if(!a)return f;var d=p.waypoints,g;return p.waypoints=f,g=a.getCroppedWaypoints(p),p.waypoints=d,g}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,f,d){var g=p.newWaypoints,h=p.segmentStartIndex+f,m=g[h],_=p.segmentEndIndex+f,b=g[_],y=r0(p.axis),v=OI(d,m,b,y);On(p.draggerGfx,v.x,v.y)}function u(p,f){var d=0,g=p.filter(function(h,m){return Af(p[m-1],p[m+1],h)?(d=m<=f?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,g=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=qw(g,f.segmentStart,f.segmentEnd),st(f.draggerGfx).add("djs-dragging"),n.addMarker(d,i0)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,g=f.segmentStartIndex,h=f.segmentEndIndex,m=f.segmentStart,_=f.segmentEnd,b=f.axis,y=f.originalWaypoints.slice(),v=o0(m,b,p["d"+b]),E=o0(_,b,p["d"+b]),w=y.length,P=0;y[g]=v,y[h]=E;var T,L;g<2&&(T=kn(d.source,v),g===1?T==="intersect"&&(y.shift(),y[0]=v,P--):T!=="intersect"&&(y.unshift(m),P++)),h>w-3&&(L=kn(d.target,E),h===w-2?L==="intersect"&&(y.pop(),y[y.length-1]=E):L!=="intersect"&&y.push(_)),f.newWaypoints=d.waypoints=s(d,y),l(f,P,p),f.newSegmentStartIndex=g+P,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,n0)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,n0)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&on(f.draggerGfx),n.removeMarker(d,i0)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,g=f.newWaypoints,h=f.newSegmentStartIndex;g=g.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var m=u(g,h),_=m.waypoints,b=s(d,_),y=m.segmentOffset,v={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+y}};r.updateWaypoints(d,b,v)})}s0.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var DI=Math.abs,c0=Math.round;function LI(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],DI(o-e)<=n)return o}function l0(e){return{x:e.x,y:e.y}}function u0(e){return{x:e.x+e.width,y:e.y+e.height}}function Ai(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:c0(e.x+e.width/2),y:c0(e.y+e.height/2)}}function za(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function ln(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 p0(e){return e.children||[]}var II=Math.abs,f0=Math.round,Wh=10;function d0(e){function t(r,a){if($e(r)){for(var s=r.length;s--;)if(II(r[s]-a)<=Wh)return r[s]}else{r=+r;var c=a%r;if(c<Wh)return a-c;if(c>r-Wh)return a-c+r}return a}function n(r,a){if(r.waypoints)return CI(a,r);if(r.width)return{x:f0(r.width/2+r.x),y:f0(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,f=a.segmentEnd,d=a.segmentEndIndex,g=a.axis;if(s)return s;var h=[l[p-1],u,f,l[d+1]];return p<2&&h.unshift(n(c.source,r)),d>l.length-3&&h.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},z(h,function(m){m&&(m=m.original||m,g==="y"&&s.horizontal.push(m.y),g==="x"&&s.vertical.push(m.x))}),s}e.on("connectionSegment.move.move",1500,function(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,f=c-u;V(r,{dx:r.dx-p,dy:r.dy-f,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&ln(r,"x",l),(f||a.horizontal.indexOf(c)!==-1)&&ln(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:[]},z(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(r){var a=r.context,s=a.hover,c=s&&n(s,r);!Pt(s)||!c||!c.x||!c.y||(ln(r,"x",c.x),ln(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,f,d;if(s){f=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var g=u-f,h=p-d;V(r,{dx:r.dx-g,dy:r.dy-h,x:r.x-g,y:r.y-h}),(g||s.vertical.indexOf(u)!==-1)&&ln(r,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&ln(r,"y",d)}})}d0.$inject=["eventBus"];const BI={__depends__:[xo,eo],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Yw],bendpointMove:["type",Gh],bendpointMovePreview:["type",t0],connectionSegmentMove:["type",s0],bendpointSnapping:["type",d0]};function h0(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),!Xr(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!Xr(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,g={connectionStart:Uh(s)?u:l,connectionEnd:Uh(s)?l:u};fn(c)&&(d=c),s.connection=n.connect(p,f,d,g)}),this.start=function(a,s,c,l){fn(c)||(l=c,c=je(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}h0.$inject=["eventBus","dragging","modeling","rules"];function Uh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var NI=1100,$I=900,g0="connect-ok",m0="connect-not-ok";function y0(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,f=r.connectionStart||u,d=r.connectionEnd||{x:o.x,y:o.y},g=f,h=d;Uh(r)&&(g=d,h=f),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",$I,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?g0:m0)}),t.on(["connect.out","connect.cleanup"],NI,function(o){var r=o.hover;r&&(n.removeMarker(r,g0),n.removeMarker(r,m0))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}y0.$inject=["injector","eventBus","canvas"];const qh={__depends__:[Ri,eo,xo],__init__:["connectPreview"],connect:["type",h0],connectPreview:["type",y0]};var FI="djs-dragger";function Mo(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)}Mo.$inject=["injector","canvas","graphicsFactory","elementFactory"],Mo.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,f=n.noNoop,d,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),ds(i),o||(o=e.getConnection=jI(function(h,m,_){return g.getConnection(h,m,_)})),t&&(d=o(t,r,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[r?je(r):c,a?je(a):l]),this._connectionDocking&&(r||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,r,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Mo.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||je(n),r=t.connectionEnd||je(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ze(e,s)},Mo.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&&xs(r,s,!0)||e,t=i&&xs(a,s,!1)||t,[e,t]},Mo.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&on(e.connectionPreviewGfx)},Mo.prototype.getConnection=function(e){var t=HI(e);return this._elementFactory.createConnection(t)},Mo.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return we(e,{pointerEvents:"none"}),st(e).add(FI),ze(this._canvas.getActiveLayer(),e),e},Mo.prototype.createNoopConnection=function(e,t){return ms([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function jI(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 HI(e){return fn(e)?e:{}}const zI={__init__:["connectionPreview"],connectionPreview:["type",Mo]},zu="complex-preview";class v0{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(zu);n.filter(s=>!GI(s)).forEach(s=>{let c;Pt(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(Go(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(Go(c),s),On(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);Pt(s)?On(l,c.x,c.y):On(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",Oe("g"));this._graphicsFactory.drawShape(Go(l),s,{width:c.width,height:c.height}),On(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){ds(this._canvas.getLayer(zu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(zu)}hide(){this._canvas.hideLayer(zu)}}v0.$inject=["canvas","graphicsFactory","previewSupport"];function GI(e){return e.hidden}const VI={__depends__:[ka],__init__:["complexPreview"],complexPreview:["type",v0]},b0=Math.round;function Gu(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}Gu.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(V({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;V(l,{x:u.x-b0(l.width/2),y:u.y-b0(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let f=null;p&&(f=r.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:l}),f.waypoints=o.getCroppedWaypoints(f,e,l)),i.create({created:[l,f].filter(d=>!Xr(d))})},Gu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Gu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const WI={__depends__:[hu,VI,hh],__init__:["appendPreview"],appendPreview:["type",Gu]};var x0=Math.min,_0=Math.max;function Yh(e){e.preventDefault()}function ac(e){e.stopPropagation()}function UI(e){return e.nodeType===Node.TEXT_NODE}function qI(e){return[].slice.call(e)}function $i(e){this.container=e.container,this.parent=Nt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Et("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Yn(this.autoResize,this),this.handlePaste=Yn(this.handlePaste,this)}$i.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=Ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(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=Ii(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ie.bind(a,"keydown",this.keyHandler),Ie.bind(a,"mousedown",ac),Ie.bind(a,"paste",o.handlePaste),Ie.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ie.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},$i.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)}},$i.prototype.insertText=function(e){e=YI(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},$i.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=qI(a.childNodes),c,l;if(UI(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 f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(g,h){h===f?g.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):h>f&&h<=d&&Yi(g)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},$i.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})}},$i.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=Nt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(g){Yh(g),ac(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ie.bind(document,"mousemove",f),Ie.bind(document,"mouseup",d)},f=function(g){Yh(g),ac(g);var h=x0(_0(l+g.clientX-s,i),r),m=x0(_0(u+g.clientY-c,o),a);t.style.width=h+"px",t.style.height=m+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Yh(g),ac(g),Ie.unbind(document,"mousemove",f,!1),Ie.unbind(document,"mouseup",d,!1)};Ie.bind(n,"mousedown",p)}V(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)},$i.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ie.unbind(t,"keydown",this.keyHandler),Ie.unbind(t,"mousedown",ac),Ie.unbind(t,"input",this.autoResize),Ie.unbind(t,"paste",this.handlePaste),Ie.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Yi(n)),Yi(e)},$i.prototype.getValue=function(){return this.content.innerText.trim()},$i.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},$i.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 YI(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function ci(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new $i({container:t.getContainer(),keyHandler:Yn(this._handleKey,this),resizeHandler:Yn(this._handleResize,this),focusoutHandler:Yn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}ci.$inject=["eventBus","canvas"],ci.prototype.registerProvider=function(e){this._providers.push(e)},ci.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},ci.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},ci.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},ci.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},ci.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},ci.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()}},ci.prototype.getValue=function(){return this._textbox.getValue()},ci.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()},ci.prototype._handleResize=function(e){this._fire("resize",e)},ci.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},ci.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Ot(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const w0={__depends__:[Vl],__init__:["directEditing"],directEditing:["type",ci]};function KI(e){return function(t){var n=t.target,i=de(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===ct(e);return!r||!a||!s||!c}}const XI={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function ue(e,t={}){var n=XI[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var ZI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start")],QI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing"),ue("none-end-event",{actionName:"replace-with-none-end"})],JI=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("timer-intermediate-catch"),ue("escalation-intermediate-throw"),ue("conditional-intermediate-catch"),ue("link-intermediate-catch"),ue("link-intermediate-throw"),ue("compensation-intermediate-throw"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw")],eB=[ue("none-start-event",{actionName:"replace-with-none-start"}),ue("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ue("none-end-event",{actionName:"replace-with-none-end"}),ue("message-end"),ue("escalation-end"),ue("error-end"),ue("cancel-end"),ue("compensation-end"),ue("signal-end"),ue("terminate-end")],tB=[ue("exclusive-gateway"),ue("parallel-gateway"),ue("inclusive-gateway"),ue("complex-gateway"),ue("event-based-gateway")],nB=[ue("transaction"),ue("event-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("collapsed-subprocess")],iB=[ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("transaction"),ue("event-subprocess"),ue("collapsed-ad-hoc-subprocess")],E0=[ue("transaction"),ue("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ue("event-subprocess")],oB=E0,S0=[ue("task"),ue("user-task"),ue("service-task"),ue("send-task"),ue("receive-task"),ue("manual-task"),ue("rule-task"),ue("script-task"),ue("call-activity"),ue("collapsed-subprocess"),ue("expanded-subprocess"),ue("collapsed-ad-hoc-subprocess"),ue("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],rB=[ue("data-store-reference")],aB=[ue("data-object-reference")],sB=[ue("message-boundary"),ue("timer-boundary"),ue("escalation-boundary"),ue("conditional-boundary"),ue("error-boundary"),ue("cancel-boundary"),ue("signal-boundary"),ue("compensation-boundary"),ue("non-interrupting-message-boundary"),ue("non-interrupting-timer-boundary"),ue("non-interrupting-escalation-boundary"),ue("non-interrupting-conditional-boundary"),ue("non-interrupting-signal-boundary")],cB=[ue("message-start"),ue("timer-start"),ue("conditional-start"),ue("signal-start"),ue("error-start"),ue("escalation-start"),ue("compensation-start"),ue("non-interrupting-message-start"),ue("non-interrupting-timer-start"),ue("non-interrupting-conditional-start"),ue("non-interrupting-signal-start"),ue("non-interrupting-escalation-start")],lB=[{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"}],uB=[ue("expanded-pool"),ue("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],pB={"bpmn:MessageEventDefinition":[ue("message-start"),ue("message-intermediate-catch"),ue("message-intermediate-throw"),ue("message-end")],"bpmn:TimerEventDefinition":[ue("timer-start"),ue("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ue("conditional-start"),ue("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ue("signal-start"),ue("signal-intermediate-catch"),ue("signal-intermediate-throw"),ue("signal-end")],"bpmn:ErrorEventDefinition":[ue("error-start"),ue("error-end")],"bpmn:EscalationEventDefinition":[ue("escalation-start"),ue("escalation-intermediate-throw"),ue("escalation-end")],"bpmn:CompensateEventDefinition":[ue("compensation-start"),ue("compensation-intermediate-throw"),ue("compensation-end")]};const R0={"start-event-non-interrupting":`
317
317
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
318
318
  <g transform="translate(0 995.64)">
319
319
  <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
@@ -324,7 +324,7 @@
324
324
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
325
325
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
326
326
  </g>
327
- </svg>`};function Pi(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()}Pi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Pi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if($e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=UI(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,nB):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,iB):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=cB[o]||[],!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=it(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=it(YI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=it(sB,function(c){return ct(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&jn(t.$parent)?(r=it(rB.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)):M(t,"bpmn:StartEvent")&&!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=it(KI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=it(ZI.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):M(t,"bpmn:BoundaryEvent")?(r=it(oB,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(r=it(XI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=it(QI,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=it(x0,a),this._createEntries(e,r)):jn(t)&&ct(e)?(r=it(tB,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&ct(e)?(r=it(eB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&ct(e)?(r=it(JI,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!ct(e)?(r=it(_0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,aB):M(t,"bpmn:FlowNode")?(r=it(_0,a),this._createEntries(e,r)):{})},Pi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!jn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),sb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Pi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Pi.prototype._createSequenceFlowEntries=function(e,t){var n=de(e),i={},o=this._modeling,r=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Pi.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}},Pi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=de(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"}}}},Pi.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}}},Pi.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}}},Pi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=de(e),i=this,o=cb(e),r=M(e,"bpmn:BoundaryEvent")?w0["intermediate-event-non-interrupting"]:w0["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 lB={__depends__:[Bh,Ax,pu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Pi]};function oc(e,t,n,i,o,r,a,s,c,l,u,p,f){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=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!Ts(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}oc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],oc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},oc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return $e(t)?Ao(e,n=>t.includes(n)):t},oc.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])&&V(u,g()),u;var p=e.businessObject;function f(y,v){o.start(y,v)}function d(y,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(y){var v=5,E=t.getPad(y).html,w=E.getBoundingClientRect(),P={x:w.left,y:w.bottom+v};return P}function m(y,v,E,w){function P($,N){var H=i.createShape(V({type:y},w));r.start($,H,{source:N})}var T=s?function($,N){var H=i.createShape(V({type:y},w));s.append(N,H)}:P,D=s?function($,N){return l.create(N,y,w),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:E,action:{dragstart:P,click:T,hover:D}}}function _(y){return function(v,E){n.splitLane(E,y),t.open(E,!0)}}if(tt(p,["bpmn:Lane","bpmn:Participant"])&&ct(e)){var b=Wo(e);V(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(y,v){n.addLane(v,"top")}}}}),b.length<2&&((xn(e)?e.height>=120:e.width>=120)&&V(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&V(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),V(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(y,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?V(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):E0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!E0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jn(p)&&V(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(y,v){var E=V(h(v),{cursor:{x:y.x,y:y.y}});a.open(v,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),tt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),M(p,"bpmn:TextAnnotation")&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),tt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(u,g()),u};function E0(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return z(r,function(a){a.$type===n&&(o=!0)}),i&&o}const uB={__depends__:[zI,b0,Q_,Ri,Vh,Gl,lB],__init__:["contextPadProvider"],contextPadProvider:["type",oc]};var pB={horizontal:["x","width"],vertical:["y","height"]},S0=5;function Co(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return $e(i)?i:i?n:[]})}Co.$inject=["modeling","rules"],Co.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Co.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},Co.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(z(t,function(r){o=r(o,n,i)}),o):e},Co.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=Hi(e,i);return z(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},Co.prototype._setOrientation=function(e){var t=pB[e];this._axis=t[0],this._dimension=t[1]},Co.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)},Co.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+S0,max:t+n-S0}};const fB={__init__:["distributeElements"],distributeElements:["type",Co]};function Hu(e){Si.call(this,e)}Hu.$inject=["eventBus"],Ce(Hu,Si),Hu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=it(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=tl(t),t.length<3?!1:t})};var R0={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Pi(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()}Pi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Pi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if($e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=KI(e);return M(t,"bpmn:DataObjectReference")?this._createEntries(e,rB):M(t,"bpmn:DataStoreReference")&&!M(e.parent,"bpmn:Collaboration")?this._createEntries(e,aB):(M(t,"bpmn:Event")&&!M(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=pB[o]||[],!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")&&(i=it(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),M(t,"bpmn:StartEvent")&&!M(t.$parent,"bpmn:SubProcess")?(r=it(ZI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Participant")?(r=it(uB,function(c){return ct(e)!==c.target.isExpanded}),this._createEntries(e,r)):M(t,"bpmn:StartEvent")&&jn(t.$parent)?(r=it(cB.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)):M(t,"bpmn:StartEvent")&&!jn(t.$parent)&&M(t.$parent,"bpmn:SubProcess")?(r=it(QI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:EndEvent")?(r=it(eB.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):M(t,"bpmn:BoundaryEvent")?(r=it(sB,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!M(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):M(t,"bpmn:IntermediateCatchEvent")||M(t,"bpmn:IntermediateThrowEvent")?(r=it(JI.concat(i),a),this._createEntries(e,r)):M(t,"bpmn:Gateway")?(r=it(tB,a),this._createEntries(e,r)):M(t,"bpmn:Transaction")?(r=it(E0,a),this._createEntries(e,r)):jn(t)&&ct(e)?(r=it(oB,a),this._createEntries(e,r)):M(t,"bpmn:AdHocSubProcess")&&ct(e)?(r=it(iB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&ct(e)?(r=it(nB,a),this._createEntries(e,r)):M(t,"bpmn:SubProcess")&&!ct(e)?(r=it(S0,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):M(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,lB):M(t,"bpmn:FlowNode")?(r=it(S0,a),this._createEntries(e,r)):{})},Pi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return M(e,"bpmn:Activity")&&!jn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),M(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),M(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ub(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Pi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Pi.prototype._createSequenceFlowEntries=function(e,t){var n=de(e),i={},o=this._modeling,r=this._moddle,a=this;return z(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&M(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:M(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(M(n.sourceRef,"bpmn:ExclusiveGateway")||M(n.sourceRef,"bpmn:InclusiveGateway")||M(n.sourceRef,"bpmn:ComplexGateway")||M(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Pi.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}},Pi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&M(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=de(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"}}}},Pi.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}}},Pi.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}}},Pi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=de(e),i=this,o=pb(e),r=M(e,"bpmn:BoundaryEvent")?R0["intermediate-event-non-interrupting"]:R0["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 fB={__depends__:[Fh,kx,hu],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Pi]};function sc(e,t,n,i,o,r,a,s,c,l,u,p,f){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=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var g=d.context,h=g.shape;if(!(!Ds(d)||!i.isOpen(h))){var m=i.getEntries(h);m.replace&&m.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}sc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],sc.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},sc.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return $e(t)?To(e,n=>t.includes(n)):t},sc.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])&&V(u,g()),u;var p=e.businessObject;function f(y,v){o.start(y,v)}function d(y,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(y){var v=5,E=t.getPad(y).html,w=E.getBoundingClientRect(),P={x:w.left,y:w.bottom+v};return P}function m(y,v,E,w){function P($,N){var H=i.createShape(V({type:y},w));r.start($,H,{source:N})}var T=s?function($,N){var H=i.createShape(V({type:y},w));s.append(N,H)}:P,L=s?function($,N){return l.create(N,y,w),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:E,action:{dragstart:P,click:T,hover:L}}}function _(y){return function(v,E){n.splitLane(E,y),t.open(E,!0)}}if(nt(p,["bpmn:Lane","bpmn:Participant"])&&ct(e)){var b=qo(e);V(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(y,v){n.addLane(v,"top")}}}}),b.length<2&&((xn(e)?e.height>=120:e.width>=120)&&V(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(xn(e)?e.height>=180:e.width>=180)&&V(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),V(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(y,v){n.addLane(v,"bottom")}}}})}return M(p,"bpmn:FlowNode")&&(M(p,"bpmn:EventBasedGateway")?V(u,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):C0(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(u,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!M(p,"bpmn:EndEvent")&&!p.isForCompensation&&!C0(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!jn(p)&&V(u,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(y,v){var E=V(h(v),{cursor:{x:y.x,y:y.y}});a.open(v,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),M(p,"bpmn:SequenceFlow")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),M(p,"bpmn:MessageFlow")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),nt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),M(p,"bpmn:TextAnnotation")&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),nt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),M(p,"bpmn:Group")&&V(u,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(u,g()),u};function C0(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return z(r,function(a){a.$type===n&&(o=!0)}),i&&o}const dB={__depends__:[WI,w0,tw,Ri,qh,Ul,fB],__init__:["contextPadProvider"],contextPadProvider:["type",sc]};var hB={horizontal:["x","width"],vertical:["y","height"]},M0=5;function Ao(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return $e(i)?i:i?n:[]})}Ao.$inject=["modeling","rules"],Ao.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ao.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},Ao.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(z(t,function(r){o=r(o,n,i)}),o):e},Ao.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=zi(e,i);return z(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},Ao.prototype._setOrientation=function(e){var t=hB[e];this._axis=t[0],this._dimension=t[1]},Ao.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)},Ao.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+M0,max:t+n-M0}};const gB={__init__:["distributeElements"],distributeElements:["type",Ao]};function Vu(e){Si.call(this,e)}Vu.$inject=["eventBus"],Ce(Vu,Si),Vu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=it(t,function(n){var i=nt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=ol(t),t.length<3?!1:t})};var A0={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
328
328
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
329
329
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
330
330
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -332,7 +332,7 @@
332
332
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
333
333
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
334
334
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
335
- </svg>`},dB=900;function rc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",dB,this)}rc.$inject=["popupMenu","distributeElements","translate","rules"],rc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},rc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},rc.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:R0.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:R0.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const hB={__depends__:[Bh,fB],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Hu],distributeElementsMenuProvider:["type",rc]};var C0="is not a registered action",gB="is already registered";function Ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ti.$inject=["eventBus","injector"],Ti.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 f=$e(p)?p:u;return r.cut(f.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}),f;p!==!1&&($e(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ti.prototype.trigger=function(e,t){if(!this._actions[e])throw Uh(e,C0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,o){n._registerAction(o,i)})},Ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Uh(e,gB);this._actions[e]=t},Ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw Uh(e,C0);this._actions[e]=void 0},Ti.prototype.getActions=function(){return Object.keys(this._actions)},Ti.prototype.isRegistered=function(e){return!!this._actions[e]};function Uh(e,t){return new Error(e+" "+t)}const mB={__init__:["editorActions"],editorActions:["type",Ti]};function zu(e){e.invoke(Ti,this)}Ce(zu,Ti),zu.$inject=["injector"],zu.prototype._registerDefaultActions=function(e){Ti.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),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),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(),m=g.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=it(h,function(b){return!M(b,"bpmn:Lane")}),l.trigger(m,_))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;M(g,"bpmn:Collaboration")?m=n.filter(function(_){return M(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!M(_.parent,"bpmn:SubProcess")}),h=an(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const yB={__depends__:[mB],editorActions:["type",zu]};function M0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}M0.$inject=["eventBus"];function $r(e,t){pe.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;Xn(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}$r.$inject=["eventBus","gridSnapping","modeling"],Ce($r,pe),$r.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},$r.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},$r.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),V(e,r),e},$r.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),V(e,r),e};var vB=2e3;function A0(e,t){e.on(["spaceTool.move","spaceTool.end"],vB,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)}})}A0.$inject=["eventBus","gridSnapping"];const bB={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",$r],gridSnappingSpaceToolBehavior:["type",A0]};var Gu=10;function qh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var xB=1200,_B=800;function or(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",_B,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"],xB,function(r){var a=r.originalEvent;if(!(!o.active||a&&ii(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=EB(r,l,e);p&&(u.offset=p);var f=wB(r,l);f&&V(u,f),ja(r,l)||o.snapEvent(r,l,u)})}})}or.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);un(e,t,i)},or.prototype.getGridSpacing=function(){return Gu},or.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=qh(e,Gu);var i,o;return t&&t.min&&(i=t.min,Fe(i)&&(i=qh(i+n,Gu,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Fe(o)&&(o=qh(o+n,Gu,"floor"),e=Math.min(e,o))),e-=n,e},or.prototype.isActive=function(){return this.active},or.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},or.prototype.toggleActive=function(){this.setActive(!this.active)},or.$inject=["elementRegistry","eventBus","config.gridSnapping"];function wB(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&&(Vu(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&&(Vu(t)?T0(s)?a.x.max=c.left:a.x.min=c.right:P0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Vu(t)?T0(s)?a.x.min=l.left:a.x.max=l.right:P0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function EB(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Fe(s[t])||(s||(s=r.snapOffset={}),Fe(s[t])||(s[t]=0),!o)||(n.get(o.id)||(Vu(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 Vu(e){return e==="x"}function P0(e){return e.indexOf("n")!==-1}function T0(e){return e.indexOf("w")!==-1}const SB={__depends__:[bB],__init__:["gridSnapping"],gridSnapping:["type",or]};var RB=2e3;function k0(e,t,n){e.on("autoPlace",RB,function(i){var o=i.source,r=je(o),a=i.shape,s=x_(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],M(a,"bpmn:TextAnnotation")&&(CB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}k0.$inject=["eventBus","gridSnapping","elementRegistry"];function CB(e){return e==="x"}var MB=1750;function O0(e,t,n){t.on(["create.start","shape.move.start"],MB,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!M(r,"bpmn:Participant")||!M(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}))}})}O0.$inject=["canvas","eventBus","gridSnapping"];var AB=3e3;function Wu(e,t,n){pe.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||PB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Wu.$inject=["eventBus","gridSnapping","modeling"],Ce(Wu,pe),Wu.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 PB(e){return e.length>3}function TB(e){return e==="h"}function kB(e){return e==="v"}function OB(e,t,n){var i=po(t,n),o={};return TB(i)&&(o.y=e.snapValue(t.y)),kB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=V({},t,o),n=V({},n,o)),[t,n]}const DB={__depends__:[SB,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",k0],gridSnappingParticipantBehavior:["type",O0],gridSnappingLayoutConnectionBehavior:["type",Wu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",M0]};var LB=30,D0=30;function ac(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(M(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(M(o,"bpmn:Participant"))return ct(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return ct(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}ac.$inject=["eventBus","interactionEvents"],ac.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},ac.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=xn(e)?{width:LB,height:e.height}:{width:e.width,height:D0};return this._interactionEvents.createBoxHit(t,"all",n),!0},ac.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:D0}),!0};const IB={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",ac]};function Uu(e){e.invoke(Da,this)}Ce(Uu,Da),Uu.$inject=["injector"],Uu.prototype.registerBindings=function(e,t){Da.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 BB={__depends__:[_h],__init__:["keyboardBindings"],keyboardBindings:["type",Uu]};var NB={moveSpeed:1,moveSpeedAccelerated:10},$B=1500,L0="left",I0="up",B0="right",N0="down",FB={ArrowLeft:L0,Left:L0,ArrowUp:I0,Up:I0,ArrowRight:B0,Right:B0,ArrowDown:N0,Down:N0},jB={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 $0(e,t,n,i,o){var r=this;this._config=V({},NB,e||{}),t.addListener($B,function(a){var s=a.keyEvent,c=FB[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=jB[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}$0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const HB={__depends__:[_h,Ri],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",$0]};var F0=10;function sc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=MT(u,p,l),c.newBounds=PT(d,f),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:Be(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Uy(p),!zB(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)})}sc.prototype.canResize=function(e){var t=this._rules,n=Li(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},sc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=V({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,j0(t,r),"resize",{autoActivate:!0,cursor:GB(r),data:{shape:t,context:o}})},sc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:F0,height:F0},o=Dv(t,e.childrenBoxPadding),TT(n,t,i,o)},sc.$inject=["eventBus","rules","modeling","dragging"];function zB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function j0(e,t){var n=je(e),i=Be(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 GB(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 H0="djs-resizing",z0="resize-not-ok",VB=500;function G0(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,H0)),s.width>5&&we(c,{x:s.x,width:s.width}),s.height>5&&we(c,{y:s.y,height:s.height}),r.canExecute?st(c).remove(z0):st(c).add(z0)}function o(r){var a=r.shape,s=r.frame;s&&rn(r.frame),t.removeMarker(a,H0)}e.on("resize.move",VB,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}G0.$inject=["eventBus","canvas","previewSupport"];var qu=-6,Yu=8,Ku=20,cc="djs-resizer",WB=["n","w","s","e","nw","ne","se","sw"];function rr(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&&z(a,qn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}rr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){qo(r)&&i.activate(r,e,n)}Le.bind(t,"mousedown",o),Le.bind(t,"touchstart",o)},rr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=UB(i),a=Oe("g");st(a).add(cc),st(a).add(cc+"-"+e.id),st(a).add(cc+"-"+i),ze(o,a);var s=Oe("rect");we(s,{x:-Yu/2+r.x,y:-Yu/2+r.y,width:Yu,height:Yu}),st(s).add(cc+"-visual"),ze(a,s);var c=Oe("rect");return we(c,{x:-Ku/2+r.x,y:-Ku/2+r.y,width:Ku,height:Ku}),st(c).add(cc+"-hit"),ze(a,c),sl(a,t,n),a},rr.prototype.createResizer=function(e,t){var n=j0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},rr.prototype.addResizer=function(e){var t=this;Pt(e)||z(WB,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},rr.prototype.removeResizers=function(){var e=this._getResizersParent();us(e)},rr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},rr.$inject=["eventBus","canvas","selection","resize"];function UB(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-qu:e.indexOf("w")!==-1&&(t.x=qu),e.indexOf("s")!==-1?t.y=-qu:e.indexOf("n")!==-1&&(t.y=qu),t}const V0={__depends__:[Ji,vo,Pa],__init__:["resize","resizePreview","resizeHandles"],resize:["type",sc],resizePreview:["type",G0],resizeHandles:["type",rr]};var qB=2e3;function lc(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"],qB,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,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}lc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],lc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var o={},r=n.style||{};return V(r,{backgroundColor:null,border:null}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||W0(e))&&V(o,{centerVertically:!0}),Go(e)&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:o,style:r}),n}},lc.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,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||XB(e)){var g=xn(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};V(r,h),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(KB(e)){var m=xn(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};V(r,_),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||W0(e))&&(V(r,{width:i.width,height:i.height}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),YB(e)&&(V(r,{width:i.width,x:i.x}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var b=1,y=i.width+2*b;if(n.labelTarget&&(V(r,{width:y,height:i.height+2*b,x:i.x-b,y:i.y-b}),V(d,{fontSize:l+"px",lineHeight:u})),Go(n)&&!ul(n)&&!Je(n)){var v=Tf(e),E=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),w=l,P=Sr.width*a+2*b;V(r,{width:P,height:w+2*b,x:E.x-P/2,y:E.y-w/2-b}),V(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(V(r,{width:i.width+2*b,height:i.height+2*b,x:i.x-b,y:i.y-b,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:ya*a+"px",paddingBottom:ya*a+"px",paddingLeft:ya*a+"px",paddingRight:ya*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},lc.prototype.update=function(e,t,n,i){var o,r;M(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}),ZB(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function W0(e){return M(e,"bpmn:SubProcess")&&!ct(e)}function YB(e){return M(e,"bpmn:SubProcess")&&ct(e)}function KB(e){return M(e,"bpmn:Participant")&&!ct(e)}function XB(e){return M(e,"bpmn:Participant")&&ct(e)}function ZB(e){return!e||!e.trim()}var U0="djs-element-hidden",q0="djs-label-hidden";function Y0(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,M(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=Oe("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=Oe("path");we(p,{d:u,strokeWidth:2,stroke:QB(r)}),ze(s,p),ze(o,s),On(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,U0):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,q0)}),e.on("directEditing.resize",function(c){if(M(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});we(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,U0),t.removeMarker(r,q0)),r=void 0,a=void 0,s&&(rn(s),s=void 0)})}Y0.$inject=["eventBus","canvas","pathMap"];function QB(e,t){var n=dt(e);return n.get("stroke")||t||"black"}const JB={__depends__:[Yd,V0,b0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",lc],labelEditingPreview:["type",Y0]};var eN=500,tN=1e3;function no(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){PA(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){z(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],eN,function(r){var a=r.element,s=r.gfx,c=wt(".djs-outline",s);c&&i.updateOutline(a,c)})}no.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=wt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ze(t,n),this.updateOutline(e,n)),n},no.prototype._createOutlineGfx=function(){var e=Oe("rect");return we(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},no.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},no.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(o){n=n||o.updateOutline(t,e)}),n||we(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},no.prototype.updateConnectionOutline=function(e,t){var n=an(t);we(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},no.prototype.registerProvider=function(e,t){t||(t=e,e=tN),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},no.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},no.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){vn(i.getOutline)&&(t=t||i.getOutline(e))}),t},no.$inject=["eventBus","styles","elementRegistry"];var Xu=6;function Yh(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)})}Yh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");us(t);var n=e.length>1,i=this._canvas.getContainer();if(st(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=nN(an(e)),r=Oe("rect");we(r,V({rx:3},o)),st(r).add("djs-selection-outline"),ze(t,r)}},Yh.$inject=["eventBus","canvas","selection"];function nN(e){return{x:e.x-Xu,y:e.y-Xu,width:e.width+Xu*2,height:e.height+Xu*2}}const Kh={__depends__:[Ri],__init__:["outline","multiSelectionOutline"],outline:["type",no],multiSelectionOutline:["type",Yh]},K0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],X0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},iN=15,Zu=2;function Z0(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 d;const f=p.filter(g=>tt(g,K0));if(f.length===1){const g=f[0];Je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(Je),h=f.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!tt(p,K0)||!u(p)||(Je(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ds([je(f),je(p)],X0),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),_=ys(m,g);if(!_)return;const y=o.isSelected(f)?c(f):l(f),v=ys(y,g)||je(f);Ms(v,_)<iN||(wf(d,[v,_]),ze(r,d))}function s(){ls(`.${X0.class}`,r).forEach(rn)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+ar(f,"x")-Zu,y:p.y+ar(f,"y")-Zu,width:ar(f,"width")+Zu*2,height:ar(f,"height")+Zu*2};return Of(d,ar(f,"rx"))}if(f.cx){const d=ar(f,"r"),g={x:p.x+ar(f,"cx")-d,y:p.y+ar(f,"cy")-d,width:d*2,height:d*2};return mv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}Z0.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function ar(e,t){return parseFloat(we(e,t)||0)}const oN={__depends__:[Ri,Kh],__init__:["labelLink"],labelLink:["type",Z0]};var rN=new Pr("tt");function aN(e){var t=Nt('<div class="djs-tooltip-container" />');return zn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function sN(e,t,n){zn(e,{left:t+"px",top:n+"px"})}function Xh(e,t){e.style.display=t===!1?"none":""}var Q0="djs-tooltip",Zh="."+Q0;function Kn(e,t){this._eventBus=e,this._canvas=t,this._ids=rN,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=aN(t.getContainer());var n=this;ei.bind(this._tooltipRoot,Zh,"mousedown",function(i){i.stopPropagation()}),ei.bind(this._tooltipRoot,Zh,"mouseover",function(i){n.trigger("mouseover",i)}),ei.bind(this._tooltipRoot,Zh,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Kn.$inject=["eventBus","canvas"],Kn.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Kn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(En(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Kn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Kn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Kn.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)}},Kn.prototype.remove=function(e){var t=this.get(e);t&&(qi(t.html),qi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Kn.prototype.show=function(){Xh(this._tooltipRoot)},Kn.prototype.hide=function(){Xh(this._tooltipRoot,!1)},Kn.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},Kn.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)),Xn(n)&&(n=Nt(n)),i=Nt('<div data-tooltip-id="'+t+'" class="'+Q0+'">'),zn(i,{position:"absolute"}),i.appendChild(n),e.type&&Rt(i).add("djs-tooltip-"+e.type),e.className&&Rt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Kn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;sN(n,t.x,t.y)},Kn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Xh(i,o))})},Kn.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 cN={__init__:["tooltips"],tooltips:["type",Kn]};var lN="flow elements must be children of pools/participants",uN="Data object must be placed within a pool/participant.";function J0(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;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(o,n(lN)):M(a,"bpmn:DataObjectReference")&&i(o,n(uN)))})}J0.$inject=["eventBus","tooltips","translate"];const pN={__depends__:[cN],__init__:["modelingFeedback"],modelingFeedback:["type",J0]};var fN=500,dN=1250,hN=1500,Qu=Math.round;function gN(e){return{x:e.x+Qu(e.width/2),y:e.y+Qu(e.height/2)}}function eE(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",hN,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=mN(u),V(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",dN,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",fN,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=r(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=Qu(l.x),l.y=Qu(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(qo(s)){var c=Ra(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(dn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!st(s.target).has("djs-hit-no-move")){var p=gN(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}eE.$inject=["eventBus","dragging","modeling","selection","rules"];function mN(e){var t=Xr(e,"id");return it(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var tE=499,Qh="djs-dragging",nE="drop-ok",iE="drop-not-ok",oE="new-parent",rE="attach-ok";function aE(e,t,n,i){function o(c){var l=r(c),u=yN(l);return u}function r(c){var l=hs(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[rE,nE,iE,oE].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,Qh),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",tE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Oe("g");we(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();ze(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=mp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,Qh)}),l.allDraggedElements=p,l.differentParents=vN(u)}),e.on("shape.move.move",tE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,rE):l.canExecute&&f&&p.id!==f.id?a(p,oE):a(p,l.canExecute?nE:iE)),On(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,Qh)}),p&&rn(p)}),this.makeDraggable=s}aE.$inject=["eventBus","canvas","styles","previewSupport"];function yN(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=it(e,function(i){return Pt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function vN(e){return $1(Xr(e,function(t){return t.parent&&t.parent.id}))!==1}const bN={__depends__:[Hl,Ri,Kh,Ji,vo,Pa],__init__:["move","movePreview"],move:["type",eE],movePreview:["type",aE]};var sE=".djs-palette-toggle",cE=".entry",xN=sE+", "+cE,Jh="djs-palette-",_N="shown",eg="open",lE="two-column",wN=1e3;function pn(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()})}pn.$inject=["eventBus","canvas"],pn.prototype.registerProvider=function(e,t){t||(t=e,e=wN),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},pn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(SN,{})},pn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},pn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Nt(pn.HTML_MARKUP);n.appendChild(i),Rt(n).add(Jh+_N),ei.bind(i,xN,"click",function(o){var r=o.delegateTarget;if(ff(r,sE))return e.toggle();e.trigger("click",o)}),Le.bind(i,"mousedown",function(o){o.stopPropagation()}),ei.bind(i,cE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},pn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},pn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Rt(n),a=Rt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(lE,o),a.toggle(Jh+lE,o),"open"in e&&(r.toggle(eg,e.open),a.toggle(Jh+eg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},pn.prototype._update=function(){var e=wt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Zc(e),z(t,function(n,i){var o=n.group||"default",r=wt("[data-group="+Dr(o)+"]",e);r||(r=Nt('<div class="group"></div>'),En(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Nt(a);if(r.appendChild(s),!n.separator&&(En(s,"data-action",i),n.title&&En(s,"title",n.title),n.className&&EN(s,n.className),n.imageUrl)){var c=Nt("<img>");En(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},pn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=En(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},pn.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(vn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},pn.prototype._layoutChanged=function(){this._toggleState({})},pn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},pn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},pn.prototype.open=function(){this._toggleState({open:!0})},pn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},pn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=wt(".djs-palette-entries",this._container),this._toolsContainer=wt("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Rt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},pn.prototype.isOpen=function(){return Rt(this._container).has(eg)},pn.prototype._getParentContainer=function(){return this._canvas.getContainer()},pn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function EN(e,t){var n=Rt(e),i=$e(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function SN(e,t){var n=t.getPaletteEntries();return vn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const RN={__init__:["palette"],palette:["type",pn]};var uE="crosshair",pE="selected",CN="djs-dragging-active-lasso";function sr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Oe("rect");we(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ze(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&we(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,pE);for(const m of g)h.has(m)||t.addMarker(m,pE)}},remove:function(p){this.update(p),p.frame&&rn(p.frame),l(!1)}};function l(p){st(t.getContainer()).toggle(CN,p)}function u(p){var f=i.getAll();return new Set(Kr(fa(f,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=fE(p),f.add=Ll(p),f.lastMarked=new Set(o.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=fE(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Ll(p))return s.activateLasso(p.originalEvent),!0})}sr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],sr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:uE,data:{context:{}},keepSelection:!0})},sr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:uE,data:{context:{}},keepSelection:!0})},sr.prototype._select=function(e){this._selection.select(e)},sr.prototype.select=function(e,t,n=[]){var i=Kr(fa(e,t));this._select([...n,...i])},sr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},sr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function fE(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 MN={__depends__:[Wl,Ds],__init__:["lassoTool"],lassoTool:["type",sr]};var tg=1500,dE="grab";function Ha(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",tg,function(c){if(Ts(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(tg,function(c){if(!(!hE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(tg,function(c){!hE(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!Ts(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ha.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ha.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:dE,data:{context:n||{}}})},Ha.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:dE,data:{context:{reactivate:n}}})},Ha.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ha.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function hE(e){return gn("Space",e)}const AN={__depends__:[Wl,Ds],__init__:["handTool"],handTool:["type",Ha]};var gE="connect-ok",mE="connect-not-ok";function za(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?gE:mE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?gE:mE)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}za.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],za.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},za.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},za.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},za.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const PN={__depends__:[Vh,Ji,vo,Wl,Ds],globalConnect:["type",za]};function ng(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)}ng.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],ng.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,f,d,g,h){function m(_){var b=n.createShape(V({type:p},h));t.start(_,b)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return V(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 TN={__depends__:[RN,Gl,Lx,MN,AN,PN,Es],__init__:["paletteProvider"],paletteProvider:["type",ng]};var kN=250;function ig(e,t,n,i,o){pe.call(this,e);function r(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);V(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=wt('[data-element-id="'+Dr(f.id)+'"]',s.dragGroup);g&&we(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=wt('[data-element-id="'+Dr(u)+'"]',s.dragGroup);p&&we(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",kN,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}ig.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ce(ig,pe);const ON={__depends__:[Pa],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",ig]};var DN=1250,og=40,LN=20,IN=10,yE=20,vE=["x","y"],BN=Math.abs;function bE(e){e.on(["connect.hover","connect.move","connect.end"],DN,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&ii(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&NN(t,r,HN(r)),r&&jN(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ai(o),tt(r,["bpmn:Event","bpmn:Gateway"])&&xE(t,Ai(r)),tt(r,["bpmn:Task","bpmn:SubProcess"])&&$N(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&FN(t)):_E(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ai(o)),M(r,"bpmn:Event")&&xE(t,Ai(r))):n.connectionStart=n.initialConnectionStart)})}bE.$inject=["eventBus"];function NN(e,t,n){vE.forEach(function(i){var o=wE(i,t);e[i]<t[i]+n?un(e,i,t[i]+n):e[i]>t[i]+o-n&&un(e,i,t[i]+o-n)})}function $N(e,t){var n=Ai(t);vE.forEach(function(i){zN(e,t,i)&&un(e,i,n[i])})}function FN(e){var t=e.context,n=t.source,i=t.target;if(!GN(t)){var o=Ai(n),r=kn(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;BN(c-o[s])<og&&(c>o[s]?l=o[s]+og:l=o[s]-og,un(e,s,l))})}}function xE(e,t){un(e,"x",t.x),un(e,"y",t.y)}function _E(e,t){return e&&e.type===t}function jN(e,t){return Po(t,function(n){return _E(e,n)})}function wE(e,t){return e==="x"?t.width:t.height}function HN(e){return M(e,"bpmn:Task")?IN:LN}function zN(e,t,n){return e[n]>t[n]+yE&&e[n]<t[n]+wE(n,t)-yE}function GN(e){var t=e.hover,n=e.source;return t&&n&&t===n}function cr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}cr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},cr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},cr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},cr.prototype.getSnapLocations=function(){return this._snapLocations},cr.prototype.setSnapLocations=function(e){this._snapLocations=e},cr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Ju,n.initDefaults(this._defaultSnaps)),n};function Ju(){this._snapValues={}}Ju.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)},Ju.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&kI(e[n],o[n],i)},Ju.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var VN=1250;function io(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"],VN,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&ii(o.originalEvent))&&!(ja(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()})}io.$inject=["elementRegistry","eventBus","snapping"],io.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new cr);var r;t.get(i.id)?r=Ai(i,e):r={x:e.x+Ai(i).x,y:e.y+Ai(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}),Je(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},io.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(o){if(Je(o)){Je(t)&&e.add("mid",Ai(o));return}if(Pt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);z(r,function(a){e.add("mid",a)});return}e.add("mid",Ai(o))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ai(t)),e},io.prototype.getSnapTargets=function(e,t){return c0(t).filter(function(n){return!WN(n)})};function WN(e){return!!e.hidden}var EE=1500;function Ga(e,t){t.invoke(io,this),e.on(["create.move","create.end"],EE,KN),e.on(["create.move","create.end","shape.move.move","shape.move.end"],EE,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!ja(n)&&UN(n,r)})}Ce(Ga,io),Ga.$inject=["eventBus","injector"],Ga.prototype.initSnap=function(e){var t=io.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",RE(r,i,e))}),z(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",RE(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Ga.prototype.addSnapTargetPoints=function(e,t,n){io.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(YN(r)||qN([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",a0(r)),e.add("bottom-right",s0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){SE(i,r.source)||e.add("mid",je(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),z(t.outgoing,function(r){if(o.get(t.id)){SE(i,r.target)||e.add("mid",je(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Ga.prototype.getSnapTargets=function(e,t){return io.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function UN(e,t){var n=Be(t),i=Tb(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=je(r),/top/.test(i)?un(e,"y",n.top-a.y):/bottom/.test(i)&&un(e,"y",n.bottom-a.y),/left/.test(i)?un(e,"x",n.left-a.x):/right/.test(i)&&un(e,"x",n.right-a.x)}function qN(e,t){return e.every(function(n){return M(n,t)})}function YN(e){return M(e,"bpmn:SubProcess")&&ct(e)?!0:M(e,"bpmn:Participant")}function KN(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)&&un(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&un(e,"y",e.y)}}function SE(e,t){return e.indexOf(t)!==-1}function RE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var XN=1250;function uc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],XN,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&ii(i.originalEvent))&&!ja(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),JN(s)&&un(i,"x",i.x),e$(s)&&un(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}uc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new cr);var r=CE(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},uc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",s0(r)),e.add("corner",a0(r))}),e.add("corner",CE(t,i)),e},uc.$inject=["eventBus","snapping"],uc.prototype.getSnapTargets=function(e,t){return c0(t).filter(function(n){return!ZN(n,e)&&!Pt(n)&&!QN(n)&&!Je(n)})};function CE(e,t){var n=je(e),i=Be(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 ZN(e,t){return e.host===t}function QN(e){return!!e.hidden}function JN(e){return e==="n"||e==="s"}function e$(e){return e==="e"||e==="w"}var t$=7,n$=1e3;function lr(e){this._canvas=e,this._asyncHide=vp(qn(this.hide,this),n$)}lr.$inject=["canvas"],lr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:ja(e,"x"),y:ja(e,"y")};z(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,t$),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),z(["x","y"],function(a){var s=r[a];dn(s)&&un(e,a,s.originValue)})},lr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return we(n,{d:"M0,0 L0,0"}),st(n).add("djs-snap-line"),ze(t,n),{update:function(i){Fe(i)?e==="horizontal"?we(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):we(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):we(n,{display:"none"})}}},lr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},lr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},lr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},lr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const i$={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",io],resizeSnapping:["type",uc],snapping:["type",lr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",bE],createMoveSnapping:["type",Ga]};var ME=300;function Ue(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=wt(Ue.INPUT_SELECTOR,this._container),this._resultsContainer=wt(Ue.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ue.$inject=["canvas","eventBus","selection","translate"],Ue.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ei.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ue.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ue.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ue.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ue.INPUT_SELECTOR,"keydown",function(n){gn("ArrowUp",n)&&n.preventDefault(),gn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ue.INPUT_SELECTOR,"keyup",function(n){if(gn("Escape",n))return e.close();if(gn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(gn("ArrowUp",n))return e._scrollToDirection(!0);if(gn("ArrowDown",n))return e._scrollToDirection();gn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ue.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ei.unbind(e.el,e.type,e.listener)})},Ue.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=wt(Ue.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ue.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ue.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)}},Ue.prototype._clearResults=function(){Zc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ue.prototype._getCurrentResult=function(){return wt(Ue.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ue.prototype._createResultNode=function(e,t){var n=Nt(Ue.RESULT_HTML);return e.primaryTokens.length>0&&AE(n,e.primaryTokens,Ue.RESULT_PRIMARY_HTML),AE(n,e.secondaryTokens,Ue.RESULT_SECONDARY_HTML),En(n,Ue.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ue.prototype.registerProvider=function(e){this._searchProvider=e},Ue.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,Rt(this._canvas.getContainer()).add("djs-search-open"),Rt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ue.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,Rt(this._canvas.getContainer()).remove("djs-search-open"),Rt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ue.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ue.prototype.isOpen=function(){return this._open},Ue.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Rt(t).remove(Ue.RESULT_SELECTED_CLASS);var n=En(e,Ue.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Rt(e).add(Ue.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:ME}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ue.prototype._select=function(e){var t=En(e,Ue.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:ME}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ue.prototype._getBoxHtml=function(){const e=Nt(Ue.BOX_HTML),t=wt(Ue.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function AE(e,t,n){var i=o$(t),o=Nt(n);o.innerHTML=i,e.appendChild(o)}function o$(e){var t="";return e.forEach(function(n){var i=B_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+Ue.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ue.CONTAINER_SELECTOR=".djs-search-container",Ue.INPUT_SELECTOR=".djs-search-input input",Ue.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ue.RESULT_SELECTOR=".djs-search-result",Ue.RESULT_SELECTED_CLASS="djs-search-result-selected",Ue.RESULT_SELECTED_SELECTOR="."+Ue.RESULT_SELECTED_CLASS,Ue.RESULT_ID_ATTRIBUTE="data-result-id",Ue.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ue.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},mB=900;function cc(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",mB,this)}cc.$inject=["popupMenu","distributeElements","translate","rules"],cc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},cc.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},cc.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:A0.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:A0.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const yB={__depends__:[Fh,gB],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Vu],distributeElementsMenuProvider:["type",cc]};var P0="is not a registered action",vB="is already registered";function Ti(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ti.$inject=["eventBus","injector"],Ti.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 f=$e(p)?p:u;return r.cut(f.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}),f;p!==!1&&($e(p)?f=p:f=u,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ti.prototype.trigger=function(e,t){if(!this._actions[e])throw Kh(e,P0);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ti.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,o){n._registerAction(o,i)})},Ti.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Kh(e,vB);this._actions[e]=t},Ti.prototype.unregister=function(e){if(!this.isRegistered(e))throw Kh(e,P0);this._actions[e]=void 0},Ti.prototype.getActions=function(){return Object.keys(this._actions)},Ti.prototype.isRegistered=function(e){return!!this._actions[e]};function Kh(e,t){return new Error(e+" "+t)}const bB={__init__:["editorActions"],editorActions:["type",Ti]};function Wu(e){e.invoke(Ti,this)}Ce(Wu,Ti),Wu.$inject=["injector"],Wu.prototype._registerDefaultActions=function(e){Ti.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),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var g=t.getRootElement(),h=n.filter(function(m){return m!==g});return i.select(h),h}),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(),m=g.type;h.length&&c.trigger(h,m)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),m=[],_=g.type;h.length&&(m=it(h,function(b){return!M(b,"bpmn:Lane")}),l.trigger(m,_))}),i&&f&&this._registerAction("setColor",function(g){var h=i.get();h.length&&f.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,m;M(g,"bpmn:Collaboration")?m=n.filter(function(_){return M(_.parent,"bpmn:Collaboration")}):m=n.filter(function(_){return _!==g&&!M(_.parent,"bpmn:SubProcess")}),h=rn(m),f.moveElements(m,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const xB={__depends__:[bB],editorActions:["type",Wu]};function T0(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;nt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}T0.$inject=["eventBus"];function jr(e,t){pe.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;Zn(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}jr.$inject=["eventBus","gridSnapping","modeling"],Ce(jr,pe),jr.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},jr.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},jr.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),V(e,r),e},jr.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),V(e,r),e};var _B=2e3;function k0(e,t){e.on(["spaceTool.move","spaceTool.end"],_B,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)}})}k0.$inject=["eventBus","gridSnapping"];const wB={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",jr],gridSnappingSpaceToolBehavior:["type",k0]};var Uu=10;function Xh(e,t,n){return n||(n="round"),Math[n](e/t)*t}var EB=1200,SB=800;function ar(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",SB,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"],EB,function(r){var a=r.originalEvent;if(!(!o.active||a&&oi(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=CB(r,l,e);p&&(u.offset=p);var f=RB(r,l);f&&V(u,f),za(r,l)||o.snapEvent(r,l,u)})}})}ar.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);ln(e,t,i)},ar.prototype.getGridSpacing=function(){return Uu},ar.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Xh(e,Uu);var i,o;return t&&t.min&&(i=t.min,Fe(i)&&(i=Xh(i+n,Uu,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,Fe(o)&&(o=Xh(o+n,Uu,"floor"),e=Math.min(e,o))),e-=n,e},ar.prototype.isActive=function(){return this.active},ar.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},ar.prototype.toggleActive=function(){this.setActive(!this.active)},ar.$inject=["elementRegistry","eventBus","config.gridSnapping"];function RB(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&&(qu(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&&(qu(t)?D0(s)?a.x.max=c.left:a.x.min=c.right:O0(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(qu(t)?D0(s)?a.x.min=l.left:a.x.max=l.right:O0(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function CB(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&Fe(s[t])||(s||(s=r.snapOffset={}),Fe(s[t])||(s[t]=0),!o)||(n.get(o.id)||(qu(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 qu(e){return e==="x"}function O0(e){return e.indexOf("n")!==-1}function D0(e){return e.indexOf("w")!==-1}const MB={__depends__:[wB],__init__:["gridSnapping"],gridSnapping:["type",ar]};var AB=2e3;function L0(e,t,n){e.on("autoPlace",AB,function(i){var o=i.source,r=je(o),a=i.shape,s=E_(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],M(a,"bpmn:TextAnnotation")&&(PB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}L0.$inject=["eventBus","gridSnapping","elementRegistry"];function PB(e){return e==="x"}var TB=1750;function I0(e,t,n){t.on(["create.start","shape.move.start"],TB,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!M(r,"bpmn:Participant")||!M(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}))}})}I0.$inject=["canvas","eventBus","gridSnapping"];var kB=3e3;function Yu(e,t,n){pe.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],kB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||OB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Yu.$inject=["eventBus","gridSnapping","modeling"],Ce(Yu,pe),Yu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=IB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function OB(e){return e.length>3}function DB(e){return e==="h"}function LB(e){return e==="v"}function IB(e,t,n){var i=ho(t,n),o={};return DB(i)&&(o.y=e.snapValue(t.y)),LB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=V({},t,o),n=V({},n,o)),[t,n]}const BB={__depends__:[MB,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",L0],gridSnappingParticipantBehavior:["type",I0],gridSnappingLayoutConnectionBehavior:["type",Yu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",T0]};var NB=30,B0=30;function lc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(M(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(M(o,"bpmn:Participant"))return ct(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(M(o,"bpmn:SubProcess"))return ct(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}lc.$inject=["eventBus","interactionEvents"],lc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},lc.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=xn(e)?{width:NB,height:e.height}:{width:e.width,height:B0};return this._interactionEvents.createBoxHit(t,"all",n),!0},lc.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:B0}),!0};const $B={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",lc]};function Ku(e){e.invoke(Ia,this)}Ce(Ku,Ia),Ku.$inject=["injector"],Ku.prototype.registerBindings=function(e,t){Ia.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 FB={__depends__:[Sh],__init__:["keyboardBindings"],keyboardBindings:["type",Ku]};var jB={moveSpeed:1,moveSpeedAccelerated:10},HB=1500,N0="left",$0="up",F0="right",j0="down",zB={ArrowLeft:N0,Left:N0,ArrowUp:$0,Up:$0,ArrowRight:F0,Right:F0,ArrowDown:j0,Down:j0},GB={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 H0(e,t,n,i,o){var r=this;this._config=V({},jB,e||{}),t.addListener(HB,function(a){var s=a.keyEvent,c=zB[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=GB[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}H0.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const VB={__depends__:[Sh,Ri],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",H0]};var z0=10;function uc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=l,d=TT(u,p,l),c.newBounds=OT(d,f),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:Be(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=Ky(p),!WB(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)})}uc.prototype.canResize=function(e){var t=this._rules,n=Ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},uc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=V({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,G0(t,r),"resize",{autoActivate:!0,cursor:UB(r),data:{shape:t,context:o}})},uc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:z0,height:z0},o=Bv(t,e.childrenBoxPadding),DT(n,t,i,o)},uc.$inject=["eventBus","rules","modeling","dragging"];function WB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function G0(e,t){var n=je(e),i=Be(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 UB(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 V0="djs-resizing",W0="resize-not-ok",qB=500;function U0(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,V0)),s.width>5&&we(c,{x:s.x,width:s.width}),s.height>5&&we(c,{y:s.y,height:s.height}),r.canExecute?st(c).remove(W0):st(c).add(W0)}function o(r){var a=r.shape,s=r.frame;s&&on(r.frame),t.removeMarker(a,V0)}e.on("resize.move",qB,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}U0.$inject=["eventBus","canvas","previewSupport"];var Xu=-6,Zu=8,Qu=20,pc="djs-resizer",YB=["n","w","s","e","nw","ne","se","sw"];function sr(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&&z(a,Yn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}sr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){Ko(r)&&i.activate(r,e,n)}Ie.bind(t,"mousedown",o),Ie.bind(t,"touchstart",o)},sr.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=KB(i),a=Oe("g");st(a).add(pc),st(a).add(pc+"-"+e.id),st(a).add(pc+"-"+i),ze(o,a);var s=Oe("rect");we(s,{x:-Zu/2+r.x,y:-Zu/2+r.y,width:Zu,height:Zu}),st(s).add(pc+"-visual"),ze(a,s);var c=Oe("rect");return we(c,{x:-Qu/2+r.x,y:-Qu/2+r.y,width:Qu,height:Qu}),st(c).add(pc+"-hit"),ze(a,c),ul(a,t,n),a},sr.prototype.createResizer=function(e,t){var n=G0(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},sr.prototype.addResizer=function(e){var t=this;Pt(e)||z(YB,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},sr.prototype.removeResizers=function(){var e=this._getResizersParent();ds(e)},sr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},sr.$inject=["eventBus","canvas","selection","resize"];function KB(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Xu:e.indexOf("w")!==-1&&(t.x=Xu),e.indexOf("s")!==-1?t.y=-Xu:e.indexOf("n")!==-1&&(t.y=Xu),t}const q0={__depends__:[eo,xo,ka],__init__:["resize","resizePreview","resizeHandles"],resize:["type",uc],resizePreview:["type",U0],resizeHandles:["type",sr]};var XB=2e3;function fc(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"],XB,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,f=c.isTouch;f||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||nt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}fc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],fc.prototype.activate=function(e){var t=yi(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var o={},r=n.style||{};return V(r,{backgroundColor:null,border:null}),(nt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Y0(e))&&V(o,{centerVertically:!0}),Wo(e)&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),M(e,"bpmn:TextAnnotation")&&(V(o,{resizable:!0,autoResize:!0}),V(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:o,style:r}),n}},fc.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,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(M(e,"bpmn:Lane")||JB(e)){var g=xn(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};V(r,h),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?"rotate(-90deg)":null})}if(QB(e)){var m=xn(e),_=m?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};V(r,_),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?null:"rotate(-90deg)"})}(nt(e,["bpmn:Task","bpmn:CallActivity"])||Y0(e))&&(V(r,{width:i.width,height:i.height}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),ZB(e)&&(V(r,{width:i.width,x:i.x}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var b=1,y=i.width+2*b;if(n.labelTarget&&(V(r,{width:y,height:i.height+2*b,x:i.x-b,y:i.y-b}),V(d,{fontSize:l+"px",lineHeight:u})),Wo(n)&&!dl(n)&&!et(n)){var v=Df(e),E=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),w=l,P=Cr.width*a+2*b;V(r,{width:P,height:w+2*b,x:E.x-P/2,y:E.y-w/2-b}),V(d,{fontSize:l+"px",lineHeight:u})}return M(e,"bpmn:TextAnnotation")&&(V(r,{width:i.width+2*b,height:i.height+2*b,x:i.x-b,y:i.y-b,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:ba*a+"px",paddingBottom:ba*a+"px",paddingLeft:ba*a+"px",paddingRight:ba*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:r,style:d}},fc.prototype.update=function(e,t,n,i){var o,r;M(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}),eN(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function Y0(e){return M(e,"bpmn:SubProcess")&&!ct(e)}function ZB(e){return M(e,"bpmn:SubProcess")&&ct(e)}function QB(e){return M(e,"bpmn:Participant")&&!ct(e)}function JB(e){return M(e,"bpmn:Participant")&&ct(e)}function eN(e){return!e||!e.trim()}var K0="djs-element-hidden",X0="djs-label-hidden";function Z0(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,M(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=Oe("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=Oe("path");we(p,{d:u,strokeWidth:2,stroke:tN(r)}),ze(s,p),ze(o,s),On(s,r.x,r.y)}M(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,K0):(M(r,"bpmn:Task")||M(r,"bpmn:CallActivity")||M(r,"bpmn:SubProcess")||M(r,"bpmn:Participant")||M(r,"bpmn:Lane"))&&t.addMarker(r,X0)}),e.on("directEditing.resize",function(c){if(M(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});we(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,K0),t.removeMarker(r,X0)),r=void 0,a=void 0,s&&(on(s),s=void 0)})}Z0.$inject=["eventBus","canvas","pathMap"];function tN(e,t){var n=dt(e);return n.get("stroke")||t||"black"}const nN={__depends__:[Zd,q0,w0],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",fc],labelEditingPreview:["type",Z0]};var iN=500,oN=1e3;function io(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){OA(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){z(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],iN,function(r){var a=r.element,s=r.gfx,c=Et(".djs-outline",s);c&&i.updateOutline(a,c)})}io.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Et(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ze(t,n),this.updateOutline(e,n)),n},io.prototype._createOutlineGfx=function(){var e=Oe("rect");return we(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},io.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},io.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(o){n=n||o.updateOutline(t,e)}),n||we(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},io.prototype.updateConnectionOutline=function(e,t){var n=rn(t);we(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},io.prototype.registerProvider=function(e,t){t||(t=e,e=oN),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},io.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},io.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){vn(i.getOutline)&&(t=t||i.getOutline(e))}),t},io.$inject=["eventBus","styles","elementRegistry"];var Ju=6;function Zh(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)})}Zh.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");ds(t);var n=e.length>1,i=this._canvas.getContainer();if(st(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=rN(rn(e)),r=Oe("rect");we(r,V({rx:3},o)),st(r).add("djs-selection-outline"),ze(t,r)}},Zh.$inject=["eventBus","canvas","selection"];function rN(e){return{x:e.x-Ju,y:e.y-Ju,width:e.width+Ju*2,height:e.height+Ju*2}}const Qh={__depends__:[Ri],__init__:["outline","multiSelectionOutline"],outline:["type",io],multiSelectionOutline:["type",Zh]},Q0=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],J0={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},aN=15,ep=2;function eE(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 d;const f=p.filter(g=>nt(g,Q0));if(f.length===1){const g=f[0];et(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(f.length===2){const g=f.find(et),h=f.find(m=>{var _;return(_=m.labels)==null?void 0:_.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:p}){var f;!nt(p,Q0)||!u(p)||(et(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ms([je(f),je(p)],J0),g=d.getAttribute("d"),m=o.isSelected(p)?c(p):l(p),_=xs(m,g);if(!_)return;const y=o.isSelected(f)?c(f):l(f),v=xs(y,g)||je(f);Ts(v,_)<aN||(Rf(d,[v,_]),ze(r,d))}function s(){fs(`.${J0.class}`,r).forEach(on)}function c(p){const f=i.getOutline(p);if(!f)return l(p);if(f.x){const d={x:p.x+cr(f,"x")-ep,y:p.y+cr(f,"y")-ep,width:cr(f,"width")+ep*2,height:cr(f,"height")+ep*2};return If(d,cr(f,"rx"))}if(f.cx){const d=cr(f,"r"),g={x:p.x+cr(f,"cx")-d,y:p.y+cr(f,"cy")-d,width:d*2,height:d*2};return bv(g)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}eE.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function cr(e,t){return parseFloat(we(e,t)||0)}const sN={__depends__:[Ri,Qh],__init__:["labelLink"],labelLink:["type",eE]};var cN=new kr("tt");function lN(e){var t=Nt('<div class="djs-tooltip-container" />');return Gn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function uN(e,t,n){Gn(e,{left:t+"px",top:n+"px"})}function Jh(e,t){e.style.display=t===!1?"none":""}var tE="djs-tooltip",eg="."+tE;function Xn(e,t){this._eventBus=e,this._canvas=t,this._ids=cN,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=lN(t.getContainer());var n=this;ti.bind(this._tooltipRoot,eg,"mousedown",function(i){i.stopPropagation()}),ti.bind(this._tooltipRoot,eg,"mouseover",function(i){n.trigger("mouseover",i)}),ti.bind(this._tooltipRoot,eg,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Xn.$inject=["eventBus","canvas"],Xn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Xn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(En(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Xn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Xn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Xn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Xn.prototype.remove=function(e){var t=this.get(e);t&&(Yi(t.html),Yi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Xn.prototype.show=function(){Jh(this._tooltipRoot)},Xn.prototype.hide=function(){Jh(this._tooltipRoot,!1)},Xn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Xn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,o=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Zn(n)&&(n=Nt(n)),i=Nt('<div data-tooltip-id="'+t+'" class="'+tE+'">'),Gn(i,{position:"absolute"}),i.appendChild(n),e.type&&Ct(i).add("djs-tooltip-"+e.type),e.className&&Ct(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Xn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;uN(n,t.x,t.y)},Xn.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Jh(i,o))})},Xn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const pN={__init__:["tooltips"],tooltips:["type",Xn]};var fN="flow elements must be children of pools/participants",dN="Data object must be placed within a pool/participant.";function nE(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;M(s,"bpmn:Collaboration")&&(M(a,"bpmn:FlowNode")?i(o,n(fN)):M(a,"bpmn:DataObjectReference")&&i(o,n(dN)))})}nE.$inject=["eventBus","tooltips","translate"];const hN={__depends__:[pN],__init__:["modelingFeedback"],modelingFeedback:["type",nE]};var gN=500,mN=1250,yN=1500,tp=Math.round;function vN(e){return{x:e.x+tp(e.width/2),y:e.y+tp(e.height/2)}}function iE(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",yN,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=bN(u),V(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",mN,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",gN,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=r(l,p,f,u),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",f=c.shapes;if(u===!1)return!1;l.x=tp(l.x),l.y=tp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(f,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(Ko(s)){var c=Ma(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(fn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!st(s.target).has("djs-hit-no-move")){var p=vN(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(f!==!1)return!0}}this.start=a}iE.$inject=["eventBus","dragging","modeling","selection","rules"];function bN(e){var t=Qr(e,"id");return it(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var oE=499,tg="djs-dragging",rE="drop-ok",aE="drop-not-ok",sE="new-parent",cE="attach-ok";function lE(e,t,n,i){function o(c){var l=r(c),u=xN(l);return u}function r(c){var l=ys(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=l.concat(u),f=[...new Set(p)];return f}function a(c,l){[cE,rE,aE,sE].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,tg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",oE,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,f=o(u);if(!l.dragGroup){var d=Oe("g");we(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();ze(g,d),l.dragGroup=d}f.forEach(function(h){i.addDragger(h,l.dragGroup)}),p?p=bp([p,r(u)]):p=r(u),z(p,function(h){t.addMarker(h,tg)}),l.allDraggedElements=p,l.differentParents=_N(u)}),e.on("shape.move.move",oE,function(c){var l=c.context,u=l.dragGroup,p=l.target,f=l.shape.parent,d=l.canExecute;p&&(d==="attach"?a(p,cE):l.canExecute&&f&&p.id!==f.id?a(p,sE):a(p,l.canExecute?rE:aE)),On(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,p=l.dragGroup;z(u,function(f){t.removeMarker(f,tg)}),p&&on(p)}),this.makeDraggable=s}lE.$inject=["eventBus","canvas","styles","previewSupport"];function xN(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=it(e,function(i){return Pt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function _N(e){return H1(Qr(e,function(t){return t.parent&&t.parent.id}))!==1}const wN={__depends__:[Vl,Ri,Qh,eo,xo,ka],__init__:["move","movePreview"],move:["type",iE],movePreview:["type",lE]};var uE=".djs-palette-toggle",pE=".entry",EN=uE+", "+pE,ng="djs-palette-",SN="shown",ig="open",fE="two-column",RN=1e3;function un(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()})}un.$inject=["eventBus","canvas"],un.prototype.registerProvider=function(e,t){t||(t=e,e=RN),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},un.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(MN,{})},un.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},un.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Nt(un.HTML_MARKUP);n.appendChild(i),Ct(n).add(ng+SN),ti.bind(i,EN,"click",function(o){var r=o.delegateTarget;if(gf(r,uE))return e.toggle();e.trigger("click",o)}),Ie.bind(i,"mousedown",function(o){o.stopPropagation()}),ti.bind(i,pE,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},un.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},un.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Ct(n),a=Ct(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(fE,o),a.toggle(ng+fE,o),"open"in e&&(r.toggle(ig,e.open),a.toggle(ng+ig,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},un.prototype._update=function(){var e=Et(".djs-palette-entries",this._container),t=this._entries=this.getEntries();el(e),z(t,function(n,i){var o=n.group||"default",r=Et("[data-group="+Ir(o)+"]",e);r||(r=Nt('<div class="group"></div>'),En(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Nt(a);if(r.appendChild(s),!n.separator&&(En(s,"data-action",i),n.title&&En(s,"title",n.title),n.className&&CN(s,n.className),n.imageUrl)){var c=Nt("<img>");En(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},un.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=En(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},un.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(vn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},un.prototype._layoutChanged=function(){this._toggleState({})},un.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},un.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},un.prototype.open=function(){this._toggleState({open:!0})},un.prototype.toggle=function(){this.isOpen()?this.close():this.open()},un.prototype.isActiveTool=function(e){return e&&this._activeTool===e},un.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Et(".djs-palette-entries",this._container),this._toolsContainer=Et("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Ct(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},un.prototype.isOpen=function(){return Ct(this._container).has(ig)},un.prototype._getParentContainer=function(){return this._canvas.getContainer()},un.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function CN(e,t){var n=Ct(e),i=$e(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function MN(e,t){var n=t.getPaletteEntries();return vn(n)?n(e):(z(n,function(i,o){e[o]=i}),e)}const AN={__init__:["palette"],palette:["type",un]};var dE="crosshair",hE="selected",PN="djs-dragging-active-lasso";function lr(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Oe("rect");we(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ze(f,d),l(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&we(f,{x:d.x,y:d.y,width:d.width,height:d.height});var g=p.marked,h=p.lastMarked;if(g&&h){for(const m of h)g.has(m)||t.removeMarker(m,hE);for(const m of g)h.has(m)||t.addMarker(m,hE)}},remove:function(p){this.update(p),p.frame&&on(p.frame),l(!1)}};function l(p){st(t.getContainer()).toggle(PN,p)}function u(p){var f=i.getAll();return new Set(Zr(ha(f,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=gE(p),f.add=Nl(p),f.lastMarked=new Set(o.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=gE(p),g=u(d),h=f.initialMarked.union(g);f.lastMarked=f.marked,f.marked=h,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(Nl(p))return s.activateLasso(p.originalEvent),!0})}lr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],lr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:dE,data:{context:{}},keepSelection:!0})},lr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:dE,data:{context:{}},keepSelection:!0})},lr.prototype._select=function(e){this._selection.select(e)},lr.prototype.select=function(e,t,n=[]){var i=Zr(ha(e,t));this._select([...n,...i])},lr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},lr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function gE(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 TN={__depends__:[Yl,Bs],__init__:["lassoTool"],lassoTool:["type",lr]};var og=1500,mE="grab";function Ga(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",og,function(c){if(Ds(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(og,function(c){if(!(!yE(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(og,function(c){!yE(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!Ds(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Ga.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ga.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:mE,data:{context:n||{}}})},Ga.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:mE,data:{context:{reactivate:n}}})},Ga.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ga.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function yE(e){return hn("Space",e)}const kN={__depends__:[Yl,Bs],__init__:["handTool"],handTool:["type",Ga]};var vE="connect-ok",bE="connect-not-ok";function Va(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?vE:bE))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?vE:bE)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(u);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}Va.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Va.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Va.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Va.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Va.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const ON={__depends__:[qh,eo,xo,Yl,Bs],globalConnect:["type",Va]};function rg(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)}rg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],rg.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,f,d,g,h){function m(_){var b=n.createShape(V({type:p},h));t.start(_,b)}return{group:f,className:d,title:g,action:{dragstart:m,click:m}}}function l(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function u(p){t.start(p,n.createParticipantShape())}return V(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 DN={__depends__:[AN,Ul,Nx,TN,kN,ON,Cs],__init__:["paletteProvider"],paletteProvider:["type",rg]};var LN=250;function ag(e,t,n,i,o){pe.call(this,e);function r(s){var c=s.canExecute.replacements;z(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var f=t.get(u);V(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var g=Et('[data-element-id="'+Ir(f.id)+'"]',s.dragGroup);g&&we(g,{display:"none"});var h=o.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var p=Et('[data-element-id="'+Ir(u)+'"]',s.dragGroup);p&&we(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",LN,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}ag.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ce(ag,pe);const IN={__depends__:[ka],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",ag]};var BN=1250,sg=40,NN=20,$N=10,xE=20,_E=["x","y"],FN=Math.abs;function wE(e){e.on(["connect.hover","connect.move","connect.end"],BN,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&oi(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&jN(t,r,VN(r)),r&&GN(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Ai(o),nt(r,["bpmn:Event","bpmn:Gateway"])&&EE(t,Ai(r)),nt(r,["bpmn:Task","bpmn:SubProcess"])&&HN(t,r),M(a,"bpmn:BoundaryEvent")&&s===a.host&&zN(t)):SE(i,"bpmn:MessageFlow")?(M(o,"bpmn:Event")&&(n.connectionStart=Ai(o)),M(r,"bpmn:Event")&&EE(t,Ai(r))):n.connectionStart=n.initialConnectionStart)})}wE.$inject=["eventBus"];function jN(e,t,n){_E.forEach(function(i){var o=RE(i,t);e[i]<t[i]+n?ln(e,i,t[i]+n):e[i]>t[i]+o-n&&ln(e,i,t[i]+o-n)})}function HN(e,t){var n=Ai(t);_E.forEach(function(i){WN(e,t,i)&&ln(e,i,n[i])})}function zN(e){var t=e.context,n=t.source,i=t.target;if(!UN(t)){var o=Ai(n),r=kn(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;FN(c-o[s])<sg&&(c>o[s]?l=o[s]+sg:l=o[s]-sg,ln(e,s,l))})}}function EE(e,t){ln(e,"x",t.x),ln(e,"y",t.y)}function SE(e,t){return e&&e.type===t}function GN(e,t){return ko(t,function(n){return SE(e,n)})}function RE(e,t){return e==="x"?t.width:t.height}function VN(e){return M(e,"bpmn:Task")?$N:NN}function WN(e,t,n){return e[n]>t[n]+xE&&e[n]<t[n]+RE(n,t)-xE}function UN(e){var t=e.hover,n=e.source;return t&&n&&t===n}function ur(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}ur.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},ur.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},ur.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},ur.prototype.getSnapLocations=function(){return this._snapLocations},ur.prototype.setSnapLocations=function(e){this._snapLocations=e},ur.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new np,n.initDefaults(this._defaultSnaps)),n};function np(){this._snapValues={}}np.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)},np.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&LI(e[n],o[n],i)},np.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(o){t.add(i,o)})})};var qN=1250;function oo(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"],qN,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&oi(o.originalEvent))&&!(za(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()})}oo.$inject=["elementRegistry","eventBus","snapping"],oo.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new ur);var r;t.get(i.id)?r=Ai(i,e):r={x:e.x+Ai(i).x,y:e.y+Ai(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}),et(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},oo.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(o){if(et(o)){et(t)&&e.add("mid",Ai(o));return}if(Pt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);z(r,function(a){e.add("mid",a)});return}e.add("mid",Ai(o))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Ai(t)),e},oo.prototype.getSnapTargets=function(e,t){return p0(t).filter(function(n){return!YN(n)})};function YN(e){return!!e.hidden}var CE=1500;function Wa(e,t){t.invoke(oo,this),e.on(["create.move","create.end"],CE,QN),e.on(["create.move","create.end","shape.move.move","shape.move.end"],CE,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!za(n)&&KN(n,r)})}Ce(Wa,oo),Wa.$inject=["eventBus","injector"],Wa.prototype.initSnap=function(e){var t=oo.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",AE(r,i,e))}),z(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",AE(r,i,e))}),M(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Wa.prototype.addSnapTargetPoints=function(e,t,n){oo.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(r){(ZN(r)||XN([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",l0(r)),e.add("bottom-right",u0(r)))});var o=this._elementRegistry;return z(t.incoming,function(r){if(o.get(t.id)){ME(i,r.source)||e.add("mid",je(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),z(t.outgoing,function(r){if(o.get(t.id)){ME(i,r.target)||e.add("mid",je(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),M(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Wa.prototype.getSnapTargets=function(e,t){return oo.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!M(n,"bpmn:Lane")})};function KN(e,t){var n=Be(t),i=Db(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=je(r),/top/.test(i)?ln(e,"y",n.top-a.y):/bottom/.test(i)&&ln(e,"y",n.bottom-a.y),/left/.test(i)?ln(e,"x",n.left-a.x):/right/.test(i)&&ln(e,"x",n.right-a.x)}function XN(e,t){return e.every(function(n){return M(n,t)})}function ZN(e){return M(e,"bpmn:SubProcess")&&ct(e)?!0:M(e,"bpmn:Participant")}function QN(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)&&ln(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&ln(e,"y",e.y)}}function ME(e,t){return e.indexOf(t)!==-1}function AE(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var JN=1250;function dc(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],JN,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&oi(i.originalEvent))&&!za(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),n$(s)&&ln(i,"x",i.x),i$(s)&&ln(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}dc.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new ur);var r=PE(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},dc.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return z(o,function(r){e.add("corner",u0(r)),e.add("corner",l0(r))}),e.add("corner",PE(t,i)),e},dc.$inject=["eventBus","snapping"],dc.prototype.getSnapTargets=function(e,t){return p0(t).filter(function(n){return!e$(n,e)&&!Pt(n)&&!t$(n)&&!et(n)})};function PE(e,t){var n=je(e),i=Be(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 e$(e,t){return e.host===t}function t$(e){return!!e.hidden}function n$(e){return e==="n"||e==="s"}function i$(e){return e==="e"||e==="w"}var o$=7,r$=1e3;function pr(e){this._canvas=e,this._asyncHide=_p(Yn(this.hide,this),r$)}pr.$inject=["canvas"],pr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:za(e,"x"),y:za(e,"y")};z(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,o$),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),z(["x","y"],function(a){var s=r[a];fn(s)&&ln(e,a,s.originValue)})},pr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return we(n,{d:"M0,0 L0,0"}),st(n).add("djs-snap-line"),ze(t,n),{update:function(i){Fe(i)?e==="horizontal"?we(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):we(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):we(n,{display:"none"})}}},pr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},pr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},pr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},pr.prototype.hide=function(){z(this._snapLines,function(e){e.update()})};const a$={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",oo],resizeSnapping:["type",dc],snapping:["type",pr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",wE],createMoveSnapping:["type",Wa]};var TE=300;function Ue(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Et(Ue.INPUT_SELECTOR,this._container),this._resultsContainer=Et(Ue.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ue.$inject=["canvas","eventBus","selection","translate"],Ue.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ti.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ue.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ue.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ue.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ue.INPUT_SELECTOR,"keydown",function(n){hn("ArrowUp",n)&&n.preventDefault(),hn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ue.INPUT_SELECTOR,"keyup",function(n){if(hn("Escape",n))return e.close();if(hn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(hn("ArrowUp",n))return e._scrollToDirection(!0);if(hn("ArrowDown",n))return e._scrollToDirection();hn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ue.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ti.unbind(e.el,e.type,e.listener)})},Ue.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=Et(Ue.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ue.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ue.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)}},Ue.prototype._clearResults=function(){el(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ue.prototype._getCurrentResult=function(){return Et(Ue.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ue.prototype._createResultNode=function(e,t){var n=Nt(Ue.RESULT_HTML);return e.primaryTokens.length>0&&kE(n,e.primaryTokens,Ue.RESULT_PRIMARY_HTML),kE(n,e.secondaryTokens,Ue.RESULT_SECONDARY_HTML),En(n,Ue.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ue.prototype.registerProvider=function(e){this._searchProvider=e},Ue.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,Ct(this._canvas.getContainer()).add("djs-search-open"),Ct(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ue.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,Ct(this._canvas.getContainer()).remove("djs-search-open"),Ct(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ue.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ue.prototype.isOpen=function(){return this._open},Ue.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ct(t).remove(Ue.RESULT_SELECTED_CLASS);var n=En(e,Ue.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ct(e).add(Ue.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:TE}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ue.prototype._select=function(e){var t=En(e,Ue.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:TE}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ue.prototype._getBoxHtml=function(){const e=Nt(Ue.BOX_HTML),t=Et(Ue.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function kE(e,t,n){var i=s$(t),o=Nt(n);o.innerHTML=i,e.appendChild(o)}function s$(e){var t="";return e.forEach(function(n){var i=F_(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+Ue.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ue.CONTAINER_SELECTOR=".djs-search-container",Ue.INPUT_SELECTOR=".djs-search-input input",Ue.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ue.RESULT_SELECTOR=".djs-search-result",Ue.RESULT_SELECTED_CLASS="djs-search-result-selected",Ue.RESULT_SELECTED_SELECTOR="."+Ue.RESULT_SELECTED_CLASS,Ue.RESULT_ID_ATTRIBUTE="data-result-id",Ue.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ue.BOX_HTML=`<div class="djs-search-container djs-scrollable">
336
336
  <div class="djs-search-input">
337
337
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
338
338
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -340,4 +340,4 @@
340
340
  <input type="text" spellcheck="false" />
341
341
  </div>
342
342
  <div class="djs-search-results" />
343
- </div>`,Ue.RESULT_HTML='<div class="djs-search-result"></div>',Ue.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ue.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const r$={__depends__:[Es,gu,Ri],searchPad:["type",Ue]};function rg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}rg.$inject=["elementRegistry","searchPad","canvas","search"],rg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:yi(i),id:i.id})),e,{keys:["label","id"]}).map(a$)};function a$(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const s$={__depends__:[r$,jw],__init__:["bpmnSearch"],bpmnSearch:["type",rg]},c$="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",l$="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",u$={width:36,height:50},p$={width:50,height:50};function PE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ki=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(RP(e))return n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:4,width:e.width+ki*2,height:e.height+ki*2},t)),n;if(!Je(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),we(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:14,width:e.width+ki*2,height:e.height+ki*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki},t))):M(e,"bpmn:DataObjectReference")&&TE(e,"bpmn:DataObjectReference")?n=PE(c$,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&TE(e,"bpmn:DataStoreReference")&&(n=PE(l$,{x:-6,y:-6},t)),n},ep.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(we(t,{width:e.width+ki*2,height:e.height+ki*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function TE(e,t){var n;return t==="bpmn:DataObjectReference"?n=u$:t==="bpmn:DataStoreReference"&&(n=p$),e.width===n.width&&e.height===n.height}const f$={__depends__:[Kh],__init__:["outlineProvider"],outlineProvider:["type",ep]};var d$='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function oo(e){ga.call(this,e)}Ce(oo,ga),oo.Viewer=nr,oo.NavigatedViewer=Ks,oo.prototype.createDiagram=function(){return this.importXML(d$)},oo.prototype._interactionModules=[G_,W_,Y_],oo.prototype._modelingModules=[gI,pu,xI,vI,DI,Vh,FI,uB,Ex,Gl,hB,yB,DB,IB,BB,HB,JB,oN,ph,pN,bN,TN,ON,V0,i$,s$,f$],oo.prototype._modules=[].concat(nr.prototype._modules,oo.prototype._interactionModules,oo.prototype._modelingModules);var tp=50,h$=new Pr,kE={min:.2,max:4},g$=10,m$=.1,y$=250,v$=100,b$=2e3;function In(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=h$.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||ip(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=np({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);ag(p,r._canvas),r._update()}function s(u){return function(f){var d=sg(f);(!r._state._svgClientRect||ip(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=np({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=_$(g,h),_=r._viewportDom.getBoundingClientRect(),b={x:d.x-_.left+1,y:d.y-_.top+1};V(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:b,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Le.bind(document,"mousemove",c),Le.bind(document,"mouseup",l)}}function c(u){var p=sg(u);if(r._state.isDragging){(!r._state._svgClientRect||ip(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;V(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=DE(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});V(r._overlay.style,{clipPath:h});var m=np({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);ag({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=sg(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),V(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Le.unbind(document,"mousemove",c),Le.unbind(document,"mouseup",l))}Le.bind(this._viewportDom,"mousedown",s(!1)),Le.bind(this._svg,"mousedown",s(!0)),Le.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||ip(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!C$(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*M$(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>m$){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=A$(kE,g$*2),m=Math.round(g/h)*h;m+=h*d;var _=Math.pow(10,m);i.zoom(P$(kE,_),b),r._state.zoomDelta=0;var b=np({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);ag(b,r._canvas),r._update()}}}),Le.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",y$,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,f=u.newId;r._updateElementId(p,f)}),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(f){r._addElement(f)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}In.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],In.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Rt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Rt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Rt(o).add("map"),n.appendChild(o);var r=this._svg=Oe("svg");we(r,{width:"100%",height:"100%"}),ze(o,r);var a=this._elementsGroup=Oe("g");ze(r,a);var s=this._viewportGroup=Oe("g");ze(r,s);var c=this._viewport=Oe("rect");st(c).add("viewport"),ze(s,c),Le.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Rt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Rt(u).add("overlay"),this._parent.appendChild(u)},In.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Fe(this._config.debounceDelay)?this._config.debounceDelay:v$,n=Fe(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:b$,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)}},In.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)})}},In.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(LE(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-tp,o=o-tp,r=r+tp*2,a=a+tp*2,this._lastViewbox={x:i,y:o,width:r,height:a},we(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),we(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};V(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=DE(l,p);V(this._overlay.style,{clipPath:f})}}},In.prototype.open=function(){V(this._state,{isOpen:!0}),Rt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},In.prototype.close=function(){V(this._state,{isOpen:!1}),Rt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},In.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},In.prototype.isOpen=function(){return this._state.isOpen},In.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)}},In.prototype._updateElementId=function(e,t){try{var n=wt("#"+Dr(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},In.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},In.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=wt("#"+Dr(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=E$(e);return s!==-1?a?S$(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),x$(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),we(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),we(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},In.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&rn(t)},In.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Ho(t),n)){var i=T$(hf(n));return we(i,{id:this._prefixId(e.id)}),i}},In.prototype._clear=function(){us(this._elementsGroup)},In.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function x$(e){return e.waypoints}function _$(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 np(e,t,n){var i=t.getBoundingClientRect(),o=w$(n,i.width/i.height),r=OE(e.x,0,i.width,o.x,o.x+o.width),a=OE(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function ag(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 w$(e,t){var n=e.width/e.height,i=V({},{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;V(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;V(i,{x:s,width:a})}return i}function OE(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function E$(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function S$(e,t,n){var i=R$(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function R$(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function ip(e){return e.width===0&&e.height===0}function C$(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var M$=Math.sign||function(e){return e>=0?1:-1};function A$(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 P$(e,t){return Math.max(e.min,Math.min(e.max,t))}function DE(e,t){var n=[ro(t.left,t.top),ro(t.left+t.width,t.top),ro(t.left+t.width,t.top+t.height),ro(t.left,t.top+t.height),ro(t.left,e.height),ro(e.width,e.height),ro(e.width,0),ro(0,0),ro(0,e.height),ro(t.left,e.height)].join(", ");return"polygon("+n+")"}function ro(e,t){return e+"px "+t+"px"}function LE(e){return Ao(e,function(t){return dn(t)?LE(t):Fe(t)&&isFinite(t)})}function sg(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function T$(e){return ls("[id]",e).forEach(function(t){t.remove()}),e}var k$={__init__:["minimap"],minimap:["type",In]};const IE={closed:"미니맵",open:"접기"};class BE{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(vh,()=>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?IE.open:IE.closed)}}pi(BE,"$inject",["eventBus","minimap","canvas"]);const O$={__depends__:[k$],__init__:["minimapI18n"],minimapI18n:["type",BE]},D$=me.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=me.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=Fp(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 me.onMounted(async()=>{a=new oo({container:r.value,moddleExtensions:Tc,additionalModules:[D_,O$]}),i.xml&&await s(i.xml),o("ready")}),me.watch(()=>i.xml,l=>{l&&a&&s(l)}),me.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(me.openBlock(),me.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),cg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},L$=cg(D$,[["__scopeId","data-v-7847e007"]]),I$=["title","aria-expanded"],B$=["title","onClick"],N$={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},$$={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},F$={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},j$={key:0,class:"bwl-validation__body"},H$={key:0,class:"bwl-validation__empty"},z$={key:1,class:"bwl-validation__empty"},G$={key:2,class:"bwl-validation__list"},V$=["onClick"],W$={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},U$={class:"bwl-validation__msg"},q$=["title"],Y$=cg(me.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=me.computed(()=>M_(n.issues.value,n.describeElement)),o=me.computed(()=>A_(i.value)),r=g=>Oa(g,n.changeScope.value),a=me.computed(()=>yh(i.value,n.changeScope.value)),s=me.ref({error:!0,warning:!0,info:!0}),c=me.computed(()=>P_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=me.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(me.openBlock(),me.createElementBlock("section",{class:me.normalizeClass(["bwl-validation",{"is-open":l.value}])},[me.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[me.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(me.openBlock(),me.createElementBlock("svg",{class:me.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[me.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=me.createElementVNode("span",null,"검증",-1))],8,I$),me.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=me.withModifiers(()=>{},["stop"]))},[(me.openBlock(),me.createElementBlock(me.Fragment,null,me.renderList(u,m=>me.createElementVNode("button",{key:m,type:"button",class:me.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>f(m)},[(me.openBlock(),me.createElementBlock("svg",N$,[h[4]||(h[4]=me.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(me.openBlock(),me.createElementBlock("path",$$)):(me.openBlock(),me.createElementBlock("path",F$))])),me.createElementVNode("span",null,me.toDisplayString(o.value[m]),1)],10,B$)),64))])]),l.value?(me.openBlock(),me.createElementBlock("div",j$,[i.value.length===0?(me.openBlock(),me.createElementBlock("p",H$,"발견된 문제가 없습니다.")):c.value.length===0?(me.openBlock(),me.createElementBlock("p",z$," 선택한 심각도에 해당하는 항목이 없습니다. ")):(me.openBlock(),me.createElementBlock("ul",G$,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(c.value,m=>(me.openBlock(),me.createElementBlock("li",{key:m.key,class:me.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:_=>d(m)},[h[5]||(h[5]=me.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(me.openBlock(),me.createElementBlock("span",W$,"이번 변경")):me.createCommentVNode("",!0),me.createElementVNode("span",U$,me.toDisplayString(m.message),1),me.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},me.toDisplayString(m.category),9,q$)],10,V$))),128))]))])):me.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),K$={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},X$=["aria-checked","title","data-locale","onClick"],Z$={class:"bwl-locale__label"},Q$={key:0,class:"bwl-locale__badge"},J$=cg(me.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=me.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?(me.openBlock(),me.createElementBlock("div",K$,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(o.value,s=>(me.openBlock(),me.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:me.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=>me.unref(n).setDisplayLocale(s.locale)},[me.createElementVNode("span",Z$,me.toDisplayString(s.label),1),s.pending>0?(me.openBlock(),me.createElementBlock("span",Q$,me.toDisplayString(s.pending),1)):me.createCommentVNode("",!0)],10,X$))),128))])):me.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);J.ADDABLE_FLOW_NODE_TYPES=yc,J.APPLY_BPMN_OPS_SCHEMA=sS,J.BPMN_EVENT_DEFINITION_TYPES=bc,J.BPMN_MODDLE_EXTENSIONS=Tc,J.BWL_MODDLE_SCHEMA=wg,J.BWL_NS=_g,J.BWL_PREFIX=dp,J.BWL_REVIEW_REQUEST_TYPE=_c,J.BWL_SIDES=hp,J.BpmnDisplayLocaleSwitcher=J$,J.BpmnModelerView=L$,J.BpmnValidationPanel=Y$,J.EDITOR=bM,J.FLOW_LABEL_INDENT=nm,J.GROUP_BORDER_MIN_RUN=jp,J.GROUP_BORDER_NEAR=ra,J.HEADLESS_BPMN_MODULES=E_,J.HEADLESS_TEXT_METRICS=ia,J.I18N_DISPLAY_REDRAWN_EVENT=vh,J.I18N_NS=G1,J.I18N_PREFIX=Mg,J.I18N_REVIEW_REQUESTED_CLASS=k_,J.I18N_TRANSLATION_TYPE=Qr,J.I18N_UNTRANSLATED_CLASS=T_,J.I18nDisplay=bh,J.I18nDisplayModule=D_,J.IR_EVENT_DEFINITIONS=vc,J.IR_FLOW_NODE_TYPES=dr,J.IR_TEXT_LOCALES=xc,J.LABEL_FORK_MARGIN=Gp,J.LABEL_SHAPE_MIN_DEPTH=hm,J.SET_TRANSLATIONS_COMMAND=wp,J.SEVERITY_ORDER=mh,J.SYMBOLIC_OP_KINDS=Ag,J.SYMBOLIC_OP_SCHEMA=Pg,J.SetTranslationsHandler=Ep,J.TranslationCommands=Rp,J.TranslationCommandsModule=Cp,J.UNDO_EPISODE_COMMAND=gp,J.UPDATE_TRANSLATION_COMMAND=Sc,J.UpdateTranslationHandler=_p,J.applyBpmnOpBatch=dy,J.applyBpmnOps=ry,J.applyLocaleBackfill=RM,J.approximateTextWidth=oa,J.auditBpmnGeometry=ym,J.auditBpmnGeometryXml=iC,J.auditBpmnSemantics=cf,J.auditBpmnSemanticsXml=sM,J.auditGeometry=pt,J.auditTargetsOf=Jn,J.axisSegmentsOf=bn,J.blackBoxNameRect=Hp,J.buildBpmnOpBatch=gM,J.buildRegistryIndex=bm,J.containerBoundarySegments=sa,J.countBySeverity=A_,J.createBpmnEditorController=xM,J.createBpmnModdle=Yg,J.createHeadlessBpmnModeler=WD,J.crossedShapesOf=en,J.crossingCost=hi,J.describeProcess=ly,J.describeProcessXml=tM,J.diffBpmnElements=fy,J.diffBpmnElementsXml=dM,J.documentLocalesOf=Za,J.edgeCrossCount=is,J.edgeCrossingPairsOf=ca,J.edgeCrossingStatsOf=lm,J.executeAsUndoEpisode=Sg,J.followMovedEdgeLabels=zm,J.forwardThreePointCandidates=Nc,J.geometryFindingKey=lt,J.inferScriptLocale=uf,J.installHeadlessBpmnDom=Xg,J.irEventDefinitionOf=fp,J.isAddableFlowNodeType=bg,J.isChangeScopeMixed=yh,J.isEdgeOverlapFinding=zp,J.isInChangeScope=Oa,J.isIrEventDefinition=xg,J.isIrFlowNodeType=vg,J.isIrTextLocale=D1,J.labelRectsOf=xr,J.labelShapeDepth=gm,J.labelSlot=gr,J.lineCrossesLabel=Vi,J.lineThroughLabel=om,J.lineThroughShapeLabel=dm,J.loadBpmnXml=na,J.localeTextsOf=xp,J.lowerOps=iy,J.oppositeOverlapCount=GR,J.oppositeOverlapOf=tm,J.planBackEdgeBoundaryClearance=Tm,J.planCrossPoolRoute=Mm,J.planEdgeRepair=Yp,J.planLabelLineClearance=tf,J.planLabelPlacement=Fm,J.planLocaleBackfill=SM,J.planMiddleSegmentShifts=_m,J.planOppositeOverlapRepair=Om,J.planSegmentDetours=Bc,J.planShapeLabelClearance=Wm,J.redockIntroducedDetachedEndpoints=qm,J.repairIntroducedBoundaryHugging=km,J.repairIntroducedCrossings=Kp,J.repairIntroducedEdgeCrossings=wm,J.repairIntroducedFakeMerges=Lm,J.repairIntroducedLabelLines=Gm,J.repairIntroducedOppositeOverlaps=$m,J.repairIntroducedShapeLabelLines=Um,J.repairIntroducedSharedSegmentLabels=Vm,J.rerouteIntroducedCrossPoolEdges=Am,J.resolverServicesOf=Qm,J.reviewRequestValuesOf=Sp,J.reviewRequestsOf=To,J.rootLangOf=bp,J.saveBpmnXml=kR,J.sceneCrossingCost=cm,J.sceneFromDefinitions=mm,J.sceneFromRegistry=Ve,J.segmentShapeClearance=ns,J.shapesUnderLabel=os,J.sharedEndpointCrossingPairsOf=Lo,J.sharedSegmentUnderLabel=Ic,J.sharedSpansOf=Lc,J.sortPanelIssues=P_,J.toPanelIssues=M_,J.touchedElements=hM,J.translationLocale=Nn,J.translationsOf=Jr,J.unreadableOverlapCount=di,J.unreadableOverlapOf=br,J.validateOps=Zm,J.warningMessages=Fp,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Ue.RESULT_HTML='<div class="djs-search-result"></div>',Ue.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ue.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const c$={__depends__:[Cs,vu,Ri],searchPad:["type",Ue]};function cg(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}cg.$inject=["elementRegistry","searchPad","canvas","search"],cg.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!et(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:yi(i),id:i.id})),e,{keys:["label","id"]}).map(l$)};function l$(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const u$={__depends__:[c$,Gw],__init__:["bpmnSearch"],bpmnSearch:["type",cg]},p$="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",f$="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",d$={width:36,height:50},h$={width:50,height:50};function OE(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ki=5;function ip(e,t){this._styles=t,e.registerProvider(this)}ip.$inject=["outline","styles"],ip.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(AP(e))return n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:4,width:e.width+ki*2,height:e.height+ki*2},t)),n;if(!et(e))return M(e,"bpmn:Gateway")?(n=Oe("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),we(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):nt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),we(n,V({x:-ki,y:-ki,rx:14,width:e.width+ki*2,height:e.height+ki*2},t))):M(e,"bpmn:EndEvent")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki+1},t))):M(e,"bpmn:Event")?(n=Oe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ki},t))):M(e,"bpmn:DataObjectReference")&&DE(e,"bpmn:DataObjectReference")?n=OE(p$,{x:-6,y:-6},t):M(e,"bpmn:DataStoreReference")&&DE(e,"bpmn:DataStoreReference")&&(n=OE(f$,{x:-6,y:-6},t)),n},ip.prototype.updateOutline=function(e,t){if(!et(e))return nt(e,["bpmn:SubProcess","bpmn:Group"])?(we(t,{width:e.width+ki*2,height:e.height+ki*2}),!0):!!nt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function DE(e,t){var n;return t==="bpmn:DataObjectReference"?n=d$:t==="bpmn:DataStoreReference"&&(n=h$),e.width===n.width&&e.height===n.height}const g$={__depends__:[Qh],__init__:["outlineProvider"],outlineProvider:["type",ip]};var m$='<?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 ro(e){ya.call(this,e)}Ce(ro,ya),ro.Viewer=or,ro.NavigatedViewer=Qs,ro.prototype.createDiagram=function(){return this.importXML(m$)},ro.prototype._interactionModules=[U_,Y_,Z_],ro.prototype._modelingModules=[vI,hu,EI,_I,BI,qh,zI,dB,Cx,Ul,yB,xB,BB,$B,FB,VB,nN,sN,hh,hN,wN,DN,IN,q0,a$,u$,g$],ro.prototype._modules=[].concat(or.prototype._modules,ro.prototype._interactionModules,ro.prototype._modelingModules);var op=50,y$=new kr,LE={min:.2,max:4},v$=10,b$=.1,x$=250,_$=100,w$=2e3;function In(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=y$.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||ap(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=rp({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);lg(p,r._canvas),r._update()}function s(u){return function(f){var d=ug(f);(!r._state._svgClientRect||ap(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(d);var g=rp({x:d.x-r._state._svgClientRect.left,y:d.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),h=i.viewbox(),m=S$(g,h),_=r._viewportDom.getBoundingClientRect(),b={x:d.x-_.left+1,y:d.y-_.top+1};V(r._state,{cachedViewbox:h,initialDragPosition:{x:d.x,y:d.y},isDragging:!0,offsetViewport:m,offsetViewportDom:b,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ie.bind(document,"mousemove",c),Ie.bind(document,"mouseup",l)}}function c(u){var p=ug(u);if(r._state.isDragging){(!r._state._svgClientRect||ap(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var f=r._state.offsetViewportDom,d=r._state.viewportClientRect,g=r._state.parentClientRect;V(r._viewportDom.style,{top:p.y-f.y-g.top+"px",left:p.x-f.x-g.left+"px"});var h=BE(g,{top:p.y-f.y-g.top,left:p.x-f.x-g.left,width:d.width,height:d.height});V(r._overlay.style,{clipPath:h});var m=rp({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);lg({x:m.x-r._state.offsetViewport.x,y:m.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=ug(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),V(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ie.unbind(document,"mousemove",c),Ie.unbind(document,"mouseup",l))}Ie.bind(this._viewportDom,"mousedown",s(!1)),Ie.bind(this._svg,"mousedown",s(!0)),Ie.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||ap(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!P$(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,f=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*T$(u.deltaY)*-p;if(r._state.zoomDelta+=f,Math.abs(r._state.zoomDelta)>b$){var d=f>0?1:-1,g=Math.log(i.zoom())/Math.log(10),h=k$(LE,v$*2),m=Math.round(g/h)*h;m+=h*d;var _=Math.pow(10,m);i.zoom(O$(LE,_),b),r._state.zoomDelta=0;var b=rp({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);lg(b,r._canvas),r._update()}}}),Ie.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",x$,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,f=u.newId;r._updateElementId(p,f)}),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(f){r._addElement(f)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}In.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],In.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Ct(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Ct(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Ct(o).add("map"),n.appendChild(o);var r=this._svg=Oe("svg");we(r,{width:"100%",height:"100%"}),ze(o,r);var a=this._elementsGroup=Oe("g");ze(r,a);var s=this._viewportGroup=Oe("g");ze(r,s);var c=this._viewport=Oe("rect");st(c).add("viewport"),ze(s,c),Ie.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Ct(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Ct(u).add("overlay"),this._parent.appendChild(u)},In.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=Fe(this._config.debounceDelay)?this._config.debounceDelay:_$,n=Fe(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:w$,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)}},In.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)})}},In.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(NE(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-op,o=o-op,r=r+op*2,a=a+op*2,this._lastViewbox={x:i,y:o,width:r,height:a},we(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),we(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};V(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var f=BE(l,p);V(this._overlay.style,{clipPath:f})}}},In.prototype.open=function(){V(this._state,{isOpen:!0}),Ct(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},In.prototype.close=function(){V(this._state,{isOpen:!1}),Ct(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};En(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},In.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},In.prototype.isOpen=function(){return this._state.isOpen},In.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)}},In.prototype._updateElementId=function(e,t){try{var n=Et("#"+Ir(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},In.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},In.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=Et("#"+Ir(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=C$(e);return s!==-1?a?M$(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),E$(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),we(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),we(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},In.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&on(t)},In.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=Go(t),n)){var i=D$(yf(n));return we(i,{id:this._prefixId(e.id)}),i}},In.prototype._clear=function(){ds(this._elementsGroup)},In.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function E$(e){return e.waypoints}function S$(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 rp(e,t,n){var i=t.getBoundingClientRect(),o=R$(n,i.width/i.height),r=IE(e.x,0,i.width,o.x,o.x+o.width),a=IE(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function lg(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 R$(e,t){var n=e.width/e.height,i=V({},{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;V(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;V(i,{x:s,width:a})}return i}function IE(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function C$(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function M$(e,t,n){var i=A$(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function A$(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function ap(e){return e.width===0&&e.height===0}function P$(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var T$=Math.sign||function(e){return e>=0?1:-1};function k$(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 O$(e,t){return Math.max(e.min,Math.min(e.max,t))}function BE(e,t){var n=[ao(t.left,t.top),ao(t.left+t.width,t.top),ao(t.left+t.width,t.top+t.height),ao(t.left,t.top+t.height),ao(t.left,e.height),ao(e.width,e.height),ao(e.width,0),ao(0,0),ao(0,e.height),ao(t.left,e.height)].join(", ");return"polygon("+n+")"}function ao(e,t){return e+"px "+t+"px"}function NE(e){return To(e,function(t){return fn(t)?NE(t):Fe(t)&&isFinite(t)})}function ug(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function D$(e){return fs("[id]",e).forEach(function(t){t.remove()}),e}var L$={__init__:["minimap"],minimap:["type",In]};const $E={closed:"미니맵",open:"접기"};class FE{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(_h,()=>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?$E.open:$E.closed)}}pi(FE,"$inject",["eventBus","minimap","canvas"]);const I$={__depends__:[L$],__init__:["minimapI18n"],minimapI18n:["type",FE]},B$=me.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=me.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=zp(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 me.onMounted(async()=>{a=new ro({container:r.value,moddleExtensions:Dc,additionalModules:[B_,I$]}),i.xml&&await s(i.xml),o("ready")}),me.watch(()=>i.xml,l=>{l&&a&&s(l)}),me.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(me.openBlock(),me.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),pg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},N$=pg(B$,[["__scopeId","data-v-7847e007"]]),$$=["title","aria-expanded"],F$=["title","onClick"],j$={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},H$={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},z$={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},G$={key:0,class:"bwl-validation__body"},V$={key:0,class:"bwl-validation__empty"},W$={key:1,class:"bwl-validation__empty"},U$={key:2,class:"bwl-validation__list"},q$=["onClick"],Y$={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},K$={class:"bwl-validation__msg"},X$=["title"],Z$=pg(me.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=me.computed(()=>T_(n.issues.value,n.describeElement)),o=me.computed(()=>k_(i.value)),r=g=>La(g,n.changeScope.value),a=me.computed(()=>xh(i.value,n.changeScope.value)),s=me.ref({error:!0,warning:!0,info:!0}),c=me.computed(()=>O_(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=me.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function f(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(me.openBlock(),me.createElementBlock("section",{class:me.normalizeClass(["bwl-validation",{"is-open":l.value}])},[me.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=m=>l.value=!l.value)},[me.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(me.openBlock(),me.createElementBlock("svg",{class:me.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[me.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=me.createElementVNode("span",null,"검증",-1))],8,$$),me.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=me.withModifiers(()=>{},["stop"]))},[(me.openBlock(),me.createElementBlock(me.Fragment,null,me.renderList(u,m=>me.createElementVNode("button",{key:m,type:"button",class:me.normalizeClass(["bwl-validation__count",[`is-${m}`,{"is-off":!s.value[m]}]]),title:l.value?`${p[m]} ${s.value[m]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>f(m)},[(me.openBlock(),me.createElementBlock("svg",j$,[h[4]||(h[4]=me.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),m==="error"?(me.openBlock(),me.createElementBlock("path",H$)):(me.openBlock(),me.createElementBlock("path",z$))])),me.createElementVNode("span",null,me.toDisplayString(o.value[m]),1)],10,F$)),64))])]),l.value?(me.openBlock(),me.createElementBlock("div",G$,[i.value.length===0?(me.openBlock(),me.createElementBlock("p",V$,"발견된 문제가 없습니다.")):c.value.length===0?(me.openBlock(),me.createElementBlock("p",W$," 선택한 심각도에 해당하는 항목이 없습니다. ")):(me.openBlock(),me.createElementBlock("ul",U$,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(c.value,m=>(me.openBlock(),me.createElementBlock("li",{key:m.key,class:me.normalizeClass(["bwl-validation__item",[`is-${m.severity}`,{"is-clickable":m.targetRefs.length>0}]]),onClick:_=>d(m)},[h[5]||(h[5]=me.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(m)?(me.openBlock(),me.createElementBlock("span",Y$,"이번 변경")):me.createCommentVNode("",!0),me.createElementVNode("span",K$,me.toDisplayString(m.message),1),me.createElementVNode("span",{class:"bwl-validation__cat",title:m.code},me.toDisplayString(m.category),9,X$)],10,q$))),128))]))])):me.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),Q$={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},J$=["aria-checked","title","data-locale","onClick"],e5={class:"bwl-locale__label"},t5={key:0,class:"bwl-locale__badge"},n5=pg(me.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=me.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?(me.openBlock(),me.createElementBlock("div",Q$,[(me.openBlock(!0),me.createElementBlock(me.Fragment,null,me.renderList(o.value,s=>(me.openBlock(),me.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:me.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=>me.unref(n).setDisplayLocale(s.locale)},[me.createElementVNode("span",e5,me.toDisplayString(s.label),1),s.pending>0?(me.openBlock(),me.createElementBlock("span",t5,me.toDisplayString(s.pending),1)):me.createCommentVNode("",!0)],10,J$))),128))])):me.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);J.ADDABLE_FLOW_NODE_TYPES=xc,J.APPLY_BPMN_OPS_SCHEMA=uS,J.BPMN_EVENT_DEFINITION_TYPES=wc,J.BPMN_MODDLE_EXTENSIONS=Dc,J.BWL_MODDLE_SCHEMA=Rg,J.BWL_NS=Sg,J.BWL_PREFIX=mp,J.BWL_REVIEW_REQUEST_TYPE=Sc,J.BWL_SIDES=yp,J.BpmnDisplayLocaleSwitcher=n5,J.BpmnModelerView=N$,J.BpmnValidationPanel=Z$,J.EDITOR=wM,J.FLOW_LABEL_INDENT=rm,J.GROUP_BORDER_MIN_RUN=Gp,J.GROUP_BORDER_NEAR=sa,J.HEADLESS_BPMN_MODULES=C_,J.HEADLESS_TEXT_METRICS=ra,J.I18N_DISPLAY_REDRAWN_EVENT=_h,J.I18N_NS=U1,J.I18N_PREFIX=Tg,J.I18N_REVIEW_REQUESTED_CLASS=L_,J.I18N_TRANSLATION_TYPE=ea,J.I18N_UNTRANSLATED_CLASS=D_,J.I18nDisplay=wh,J.I18nDisplayModule=B_,J.IR_EVENT_DEFINITIONS=_c,J.IR_FLOW_NODE_TYPES=gr,J.IR_TEXT_LOCALES=Ec,J.LABEL_FORK_MARGIN=Up,J.LABEL_SHAPE_MIN_DEPTH=ym,J.SET_TRANSLATIONS_COMMAND=Rp,J.SEVERITY_ORDER=bh,J.SYMBOLIC_OP_KINDS=kg,J.SYMBOLIC_OP_SCHEMA=Og,J.SetTranslationsHandler=Cp,J.TranslationCommands=Ap,J.TranslationCommandsModule=Pp,J.UNDO_EPISODE_COMMAND=vp,J.UPDATE_TRANSLATION_COMMAND=Mc,J.UpdateTranslationHandler=Sp,J.applyBpmnOpBatch=my,J.applyBpmnOps=cy,J.applyLocaleBackfill=AM,J.approximateTextWidth=aa,J.auditBpmnGeometry=xm,J.auditBpmnGeometryXml=aC,J.auditBpmnSemantics=pf,J.auditBpmnSemanticsXml=uM,J.auditGeometry=ft,J.auditTargetsOf=ei,J.axisSegmentsOf=bn,J.blackBoxNameRect=Vp,J.buildBpmnOpBatch=vM,J.buildRegistryIndex=wm,J.containerBoundarySegments=la,J.countBySeverity=k_,J.createBpmnEditorController=EM,J.createBpmnModdle=Zg,J.createHeadlessBpmnModeler=YD,J.crossedShapesOf=Qt,J.crossingCost=hi,J.describeProcess=fy,J.describeProcessXml=oM,J.diffBpmnElements=gy,J.diffBpmnElementsXml=mM,J.documentLocalesOf=es,J.edgeCrossCount=as,J.edgeCrossingPairsOf=ua,J.edgeCrossingStatsOf=fm,J.executeAsUndoEpisode=Mg,J.followMovedEdgeLabels=Wm,J.forwardThreePointCandidates=jc,J.geometryFindingKey=lt,J.inferScriptLocale=df,J.installHeadlessBpmnDom=Jg,J.irEventDefinitionOf=gp,J.isAddableFlowNodeType=wg,J.isChangeScopeMixed=xh,J.isEdgeOverlapFinding=Wp,J.isInChangeScope=La,J.isIrEventDefinition=Eg,J.isIrFlowNodeType=_g,J.isIrTextLocale=B1,J.labelRectsOf=wr,J.labelShapeDepth=vm,J.labelSlot=yr,J.lineCrossesLabel=Wi,J.lineThroughLabel=sm,J.lineThroughShapeLabel=mm,J.loadBpmnXml=oa,J.localeTextsOf=Ep,J.lowerOps=ay,J.oppositeOverlapCount=UR,J.oppositeOverlapOf=om,J.planBackEdgeBoundaryClearance=Dm,J.planCrossPoolRoute=Tm,J.planEdgeRepair=Zp,J.planLabelLineClearance=rf,J.planLabelPlacement=zm,J.planLocaleBackfill=MM,J.planMiddleSegmentShifts=Sm,J.planOppositeOverlapRepair=Im,J.planSegmentDetours=Fc,J.planShapeLabelClearance=Ym,J.redockIntroducedDetachedEndpoints=Xm,J.repairIntroducedBoundaryHugging=Lm,J.repairIntroducedCrossings=Qp,J.repairIntroducedEdgeCrossings=Rm,J.repairIntroducedFakeMerges=Nm,J.repairIntroducedLabelLines=Um,J.repairIntroducedOppositeOverlaps=Hm,J.repairIntroducedShapeLabelLines=Km,J.repairIntroducedSharedSegmentLabels=qm,J.rerouteIntroducedCrossPoolEdges=km,J.resolverServicesOf=ty,J.reviewRequestValuesOf=Mp,J.reviewRequestsOf=Oo,J.rootLangOf=wp,J.saveBpmnXml=LR,J.sceneCrossingCost=pm,J.sceneFromDefinitions=bm,J.sceneFromRegistry=Ve,J.segmentShapeClearance=rs,J.shapesUnderLabel=ss,J.sharedEndpointCrossingPairsOf=Bo,J.sharedSegmentUnderLabel=$c,J.sharedSpansOf=Nc,J.sortPanelIssues=O_,J.toPanelIssues=T_,J.touchedElements=yM,J.translationLocale=Nn,J.translationsOf=ta,J.unreadableOverlapCount=di,J.unreadableOverlapOf=_r,J.validateOps=ey,J.warningMessages=zp,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));