@g1cloud/bpmn-modeler-next 5.0.0-beta.79 → 5.0.0-beta.80

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,13 +1,13 @@
1
- (function(ie,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Se):(ie=typeof globalThis<"u"?globalThis:ie||self,Se(ie.BpmnModeler={},ie.Vue))})(this,(function(ie,Se){"use strict";var v6=Object.defineProperty;var x6=(ie,Se,Pr)=>Se in ie?v6(ie,Se,{enumerable:!0,configurable:!0,writable:!0,value:Pr}):ie[Se]=Pr;var ln=(ie,Se,Pr)=>x6(ie,typeof Se!="symbol"?Se+"":Se,Pr);const Pr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Nc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function dm(e){return Pr.includes(e)}function fm(e){return Nc.includes(e)}const $c=["timer"],Fc={timer:"bpmn:TimerEventDefinition"};function hm(e){return typeof e=="string"&&$c.includes(e)}function $p(e){if(e.length===1)return $c.find(t=>Fc[t]===e[0])}const jc=["ko","en","ja","zh"];function CR(e){return typeof e=="string"&&jc.includes(e)}const gm="http://g1project.net/spec/bpmn/bwl/1.0",Fp="bwl",jp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Hc="bwl:ReviewRequest",mm={name:"bwl-hints",uri:gm,prefix:Fp,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"}]}]},Hp="bwl.undoEpisode",ym=new WeakSet;function AR(e){ym.has(e)||(e.register(Hp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),ym.add(e))}function vm(e,t){AR(e);const n={run:t};if(e.execute(Hp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function xm(e){return e._stackIdx+1}function bm(e,t){const{_stack:n,_stackIdx:i}=e;if(i<t)return 0;const o=n[t].id;for(let r=t;r<=i;r++)n[r].id=o;return i-t+1}function zp(e){return Array.prototype.concat.apply([],e)}const us=Object.prototype.toString,TR=Object.prototype.hasOwnProperty;function kr(e){return e===void 0}function xn(e){return e!==void 0}function fa(e){return e==null}function Qe(e){return us.call(e)==="[object Array]"}function bn(e){return us.call(e)==="[object Object]"}function et(e){return us.call(e)==="[object Number]"}function Sn(e){const t=us.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ri(e){return us.call(e)==="[object String]"}function PR(e){if(!Qe(e))throw new Error("must supply array")}function ai(e,t){return!fa(e)&&TR.call(e,t)}function $t(e,t){const n=Gc(t);let i;return U(e,function(o,r){if(n(o,r))return i=o,!1}),i}function wm(e,t){const n=Gc(t);let i=Qe(e)?-1:void 0;return U(e,function(o,r){if(n(o,r))return i=r,!1}),i}function ft(e,t){const n=Gc(t);let i=[];return U(e,function(o,r){n(o,r)&&i.push(o)}),i}function U(e,t){let n,i;if(kr(e))return;const o=Qe(e)?IR:LR;for(let r in e)if(ai(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function kR(e,t){if(kr(e))return[];PR(e);const n=Gc(t);return e.filter(function(i,o){return!n(i,o)})}function si(e,t,n){return U(e,function(i,o){n=t(n,i,o)}),n}function zo(e,t){return!!si(e,function(n,i,o){return n&&t(i,o)},!0)}function Go(e,t){return!!$t(e,t)}function zn(e,t){let n=[];return U(e,function(i,o){n.push(t(i,o))}),n}function zc(e){return e&&Object.keys(e)||[]}function OR(e){return zc(e).length}function ha(e){return zn(e,t=>t)}function ga(e,t,n={}){return t=Gp(t),U(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function _m(e,...t){e=Gp(e);let n={};return U(t,o=>ga(o,e,n)),zn(n,function(o,r){return o[0]})}const DR=_m;function Xi(e,t){t=Gp(t);let n=[];return U(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)}),zn(n,i=>i.v)}function ma(e){return function(t){return zo(e,function(n,i){return t[i]===n})}}function Gp(e){return Sn(e)?e:t=>t[e]}function Gc(e){return Sn(e)?e:t=>t===e}function LR(e){return e}function IR(e){return Number(e)}function Vp(e,t){let n,i,o,r;function a(p){let d=Date.now(),f=p?0:r+t-d;if(f>0)return s(f);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Qn(e,t){return e.bind(t)}function Z(e,...t){return Object.assign(e,...t)}function BR(e,t,n){let i=e;return U(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];xn(a)&&fa(s)&&(s=i[o]=isNaN(+a)?{}:[]),kr(a)?kr(n)?delete i[o]:i[o]=n:i=s}),e}function ji(e,t){let n={},i=Object(e);return U(t,function(o){o in i&&(n[o]=e[o])}),n}function Zi(e,t){let n={},i=Object(e);return U(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=Ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function dt(e,t){return Go(t,function(n){return A(e,n)})}function Ee(e){return e&&e.businessObject||e}function xt(e){return e&&e.di}const NR="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Em="i18n",Or="i18n:Translation";function Dr(e){if(e){if(A(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(A(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Vo(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,Or)})}function An(e){return e.get("xml:lang")}function Wo(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,Hc)})}function ps(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 Up(e,t,n){const i=Dr(e);if(!i)return{};const o=i.target[i.key]??"",r=Vo(e).filter(u=>An(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(An):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ps(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(d=>An(d)===u&&a(d));p&&(l[u]=a(p))}return l}const Vc="bwl.updateTranslation";class qp{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=Dr(c),u=[];t.undo=u;const p=Vo(c).filter(k=>An(k)),d=s??(l?l.target[l.key]??"":""),f=a??o,g=(k=>{if(!k)return[];const N=p.filter(G=>G.body===k).map(An);return N.length?N:[f]})(d),y=s!==void 0&&d&&!g.includes(t.locale)?g[0]:t.locale,_=k=>{var N;return((N=p.find(G=>An(G)===k&&G.body))==null?void 0:N.body)??(g.includes(k)?d:"")},h=k=>Wo(c).some(N=>N.locale===k),v=_(y);if(v===i)return[];const b=!!v&&!h(y),E=b?r.filter(k=>k!==y&&_(k)&&!h(k)):[],M=()=>{let k=c.extensionElements;return k||(k=this.moddle.create("bpmn:ExtensionElements",{values:[]}),k.$parent=c,c.extensionElements=k,u.push(()=>delete c.extensionElements)),k.get("values")},B=(k,N)=>{const G=M();let q=G.find(Y=>{var re;return((re=Y.$instanceOf)==null?void 0:re.call(Y,Or))&&An(Y)===k});if(q){const Y=q.body;q.body=N,u.push(()=>q.body=Y)}else q=this.moddle.create(Or,{body:N}),q.set("xml:lang",k),q.$parent=c.extensionElements,G.push(q),u.push(()=>G.splice(G.indexOf(q),1))},P=k=>{const N=M(),G=N.indexOf(k);N.splice(G,1),u.push(()=>N.splice(G,0,k))};if(s===void 0){if(y===o&&l){if(d&&!p.some(N=>N.body===d)){const N=a&&a!==o?a:void 0;N&&B(N,d)}const k=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{k?l.target[l.key]=d:delete l.target[l.key]})}B(y,i)}else(p.some(k=>An(k)===y)||!d&&y!==f)&&B(y,i);if(!b)for(const k of Wo(c).filter(N=>N.locale===y))P(k);for(const k of E){const N=M(),G=this.moddle.create(Hc,{locale:k,sourceLocale:y,previous:v});G.$parent=c.extensionElements,N.push(G),u.push(()=>N.splice(N.indexOf(G),1))}for(const k of Wo(c).filter(N=>N.sourceLocale===y&&(N.previous??"")===i))P(k);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ln(qp,"$inject",["moddle"]);const Yp="bwl.setTranslations",$R=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Kp{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,!Dr(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},d=_=>{const h=p(),v=h.indexOf(_);v<0||(h.splice(v,1),u.push(()=>h.splice(v,0,_)))},f=_=>Vo(l).find(h=>An(h)===_);if(i===null)for(const _ of a){const h=f(_);h&&d(h)}else if(i)for(const _ of a){const h=i[_];if(h===void 0)continue;const v=f(_);if(v){if(v.body===h)continue;const M=v.body;v.body=h,u.push(()=>v.body=M);continue}if(_===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(Or,{body:h});E.set("xml:lang",_),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const g=[...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 Wo(l)){const h=g.findIndex(v=>$R(_,v));h>=0?g.splice(h,1):d(_)}for(const _ of g){const h=p(),v=this.moddle.create(Hc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});v.$parent=l.extensionElements,h.push(v),u.push(()=>h.splice(h.indexOf(v),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ln(Kp,"$inject",["moddle"]);function Xp(e){return Wo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Zp{constructor(t){t.registerHandler(Vc,qp),t.registerHandler(Yp,Kp)}}ln(Zp,"$inject",["commandStack"]);const Jp={__init__:["translationCommands"],translationCommands:["type",Zp]},Sm=["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"],FR={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},jR={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(jc.map(e=>[e,{type:"string"}])),additionalProperties:!1},HR={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},zR={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},GR={type:"string",enum:[...$c],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},VR={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Nc]},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},WR={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},UR={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},qR={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},YR={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},KR={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},XR={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},ZR={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},JR={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},QR={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...jp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Dn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const eM={"participant.add":Dn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Dn("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":Dn("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":Dn("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:[...Nc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Dn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Dn("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":Dn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Dn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Dn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Dn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Dn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Dn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Dn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Dn("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":Dn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Dn("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":Dn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...jc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Dn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Rm={anyOf:Sm.map(e=>eM[e])},tM={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:HR,irParticipant:zR,irNode:VR,irFlowCondition:WR,irSequenceFlow:UR,irMessageFlow:qR,irDataStore:YR,irDataAssociation:KR,irTextAnnotation:XR,irAssociation:ZR,irGroup:JR,bwlPlacement:QR,eventDefinition:GR,localeTexts:jR,nullableString:FR,symbolicOp:Rm}};function Qp(){}Qp.prototype.get=function(e){return this.$model.properties.get(this,e)},Qp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Mm(e,t){this.model=e,this.properties=t}Mm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Qp.prototype);U(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}),U(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 nM=Z(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Cm=Z(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function ed(e,t){var n=Cm[e];return n?n(t):t}function td(e){return!!nM[e]}function Am(e){return!!Cm[e]}function Gn(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 vi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}vi.prototype.build=function(){return ji(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},vi.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)},vi.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},vi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=Gn(o[0],i),a=Gn(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},vi.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},vi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},vi.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},vi.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},vi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},vi.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")},vi.prototype.hasProperty=function(e){return this.propertiesByName[e]},vi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(U(e.properties,Qn(function(r){r=Z({},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 Uo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,U(e,Qn(this.registerPackage,this))}Uo.prototype.getPackage=function(e){return this.packageMap[e]},Uo.prototype.getPackages=function(){return this.packages},Uo.prototype.registerPackage=function(e){e=Z({},e);var t=this.packageMap;Tm(t,e,"prefix"),Tm(t,e,"uri"),U(e.types,Qn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Uo.prototype.registerType=function(e,t){e=Z({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Z({},e.meta||{})});var n=Gn(e.name,t.prefix),i=n.name,o=Object.create(null);U(e.properties,Qn(function(r){var a=Gn(r.name,n.prefix),s=a.name;td(r.type)||(r.type=Gn(r.type,a.prefix).name),Z(r,{ns:a,name:s}),o[s]=r},this)),Z(e,{ns:n,name:i,propertiesByName:o}),U(e.extends,Qn(function(r){var a=Gn(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},Uo.prototype.mapTypes=function(e,t,n){var i=td(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=Gn(c,td(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+">");U(i.superClass,n?a:s),t(i,!n),U(i.traits,a)},Uo.prototype.getEffectiveDescriptor=function(e){var t=Gn(e),n=new vi(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},Uo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Tm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Lr(e){this.model=e}Lr.prototype.set=function(e,t,n){if(!ri(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;iM(n)?i?delete e[o]:delete e.$attrs[nd(t)]:i?o in e?e[o]=n:Pm(e,i,n):e.$attrs[nd(t)]=n},Lr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[nd(t)];var i=n.name;return!e[i]&&n.isMany&&Pm(e,n,[]),e[i]},Lr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=Z({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Lr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Lr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Lr.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 iM(e){return typeof e>"u"}function Pm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function nd(e){return e.replace(/^:/,"")}function _i(e,t={}){this.properties=new Lr(this),this.factory=new Mm(this,this.properties),this.registry=new Uo(e,this.properties),this.typeCache=Object.create(null),this.config=t}_i.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},_i.prototype.getType=function(e){var t=this.typeCache,n=ri(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},_i.prototype.createAny=function(e,t,n){var i=Gn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){BR(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}),U(n,function(a,s){bn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},_i.prototype.getPackage=function(e){return this.registry.getPackage(e)},_i.prototype.getPackages=function(){return this.registry.getPackages()},_i.prototype.getElementDescriptor=function(e){return e.$descriptor},_i.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},_i.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},_i.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var km=String.fromCharCode,oM=Object.prototype.hasOwnProperty,rM=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ds={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ds).forEach(function(e){ds[e.toUpperCase()]=ds[e]});function aM(e,t,n,i){return i?oM.call(ds,i)?ds[i]:"&"+i+";":km(t||parseInt(n,16))}function Ir(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(rM,aM):e}var Om="non-whitespace outside of root node";function qo(e){return new Error(e)}function sM(e){return"missing namespace for prefix <"+e+">"}function Wc(e){return{get:e,enumerable:!0}}function cM(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Dm=Symbol("nameCache");function id(e){return e+"$uri"}function lM(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[id(i)]=n;return t}function Uc(){return{line:0,column:0}}function uM(e){throw e}function Lm(e){if(!this)return new Lm(e);var t=e&&e.proxy,n,i,o,r,a=uM,s,c,l,u,p=Uc,d=!1,f=!1,m="",g=!1,y=!1,_=null,h=!1,v,b,E,M;function B(G){G instanceof Error||(G=qo(G)),_=G,a(G,p)}function P(G){s&&(G instanceof Error||(G=qo(G)),s(G,p))}this.on=function(G,q){if(typeof q!="function")throw qo("required args <name, cb>");switch(G){case"openTag":i=q;break;case"text":n=q;break;case"closeTag":o=q;break;case"error":a=q;break;case"warn":s=q;break;case"cdata":r=q;break;case"attention":u=q;break;case"question":l=q;break;case"comment":c=q;break;default:throw qo("unsupported event: "+G)}return this},this.ns=function(G){if(typeof G>"u"&&(G={}),typeof G!="object")throw qo("required args <nsMap={}>");var q=Object.create(null),Y;for(Y in G)q[Y]=G[Y];return y=!0,M=q,this};function k(){v=y?[]:null,b=y?lM(M):null,E=[],p=Uc,h=!1,_=null,f=!1,m=""}this.parse=function(G){if(typeof G!="string")throw qo("required args <xml=string>");if(d)throw qo("parse during stream; call end() first");return k(),N(G),p=Uc,h=!1,_},this.write=function(G){if(typeof G!="string")throw qo("required args <xml=string>");return d||(k(),d=!0),_||(m=N(m+G,!0)||""),this},this.end=function(){return d||k(),d=!1,_||N(m),m="",p=Uc,h=!1,_},this.stop=function(){h=!0};function N(G,q=!1){var Y=null,re=null,K,Ce=0,Ae=!1,Te=!1,de=0,z=0,oe,V,X,ue,be,$e,F,C,R,W="",J=0,fe;function Pe(vt,an){var Mn=vt.indexOf(":");if(Mn===-1)return vt;var kn=b[vt.substring(0,Mn)];return kn?an===kn?vt.substr(Mn+1):kn+vt.substr(Mn):(P(sM(vt.substring(0,Mn))),null)}function ct(){if(fe!==null)return fe;var vt,an,Mn=y&&b.xmlns,kn=y&&g?[]:null,Nt=J,vn=W,On=vn.length,ii,qn,Ni,oi,Wt,Rr={},is=new Set,Zn,_t,At;e:for(;Nt<On;Nt++)if(Zn=!1,_t=vn.charCodeAt(Nt),!(_t===32||_t<14&&_t>8)){for((_t<65||_t>122||_t>90&&_t<97)&&_t!==95&&_t!==58&&(P("illegal first char attribute name"),Zn=!0),At=Nt+1;At<On;At++)if(_t=vn.charCodeAt(At),!(_t>96&&_t<123||_t>64&&_t<91||_t>47&&_t<59||_t===46||_t===45||_t===95)){if(_t===32||_t<14&&_t>8){P("missing attribute value"),Nt=At;continue e}if(_t===61)break;P("illegal attribute name char"),Zn=!0}if(Wt=vn.substring(Nt,At),Wt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Zn=!0),_t=vn.charCodeAt(At+1),_t===34)At=vn.indexOf('"',Nt=At+2),At===-1&&(At=vn.indexOf("'",Nt),At!==-1&&(P("attribute value quote missmatch"),Zn=!0));else if(_t===39)At=vn.indexOf("'",Nt=At+2),At===-1&&(At=vn.indexOf('"',Nt),At!==-1&&(P("attribute value quote missmatch"),Zn=!0));else for(P("missing attribute value quotes"),Zn=!0,At=At+1;At<On&&(_t=vn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++);for(At===-1&&(P("missing closing quotes"),At=On,Zn=!0),Zn||(Ni=vn.substring(Nt,At)),Nt=At;At+1<On&&(_t=vn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++)Nt===At&&(P("illegal character after attribute end"),Zn=!0);if(Nt=At+1,Zn)continue e;if(is.has(Wt)){P("attribute <"+Wt+"> already defined");continue}if(is.add(Wt),!y){Rr[Wt]=Ni;continue}if(g){if(qn=Wt==="xmlns"?"xmlns":Wt.charCodeAt(0)===120&&Wt.substr(0,6)==="xmlns:"?Wt.substr(6):null,qn!==null){if(vt=Ir(Ni),an=id(qn),oi=M[vt],!oi){if(qn==="xmlns"||an in b&&b[an]!==vt)do oi="ns"+Ce++;while(typeof b[oi]<"u");else oi=qn;M[vt]=oi}b[qn]!==oi&&(ii||(b=cM(b),ii=!0),b[qn]=oi,qn==="xmlns"&&(b[id(oi)]=vt,Mn=oi),b[an]=vt),Rr[Wt]=Ni;continue}kn.push(Wt,Ni);continue}Wt=Pe(Wt,Mn),Wt!==null&&(Rr[Wt]=Ni)}if(g)for(Nt=0,On=kn.length;Nt<On;Nt++)Wt=Pe(kn[Nt++],Mn),Ni=kn[Nt],Wt!==null&&(Rr[Wt]=Ni);return fe=Rr}function pt(){for(var vt=/(\r\n|\r|\n)/g,an=0,Mn=0,kn=0,Nt=z,vn,On;de>=kn&&(vn=vt.exec(G),!(!vn||(Nt=vn[0].length+vn.index,Nt>de)));)an+=1,kn=Nt;return de==-1?(Mn=Nt,On=G.substring(z)):z===0?On=G.substring(z,de):(Mn=de-kn,On=z==-1?G.substring(de):G.substring(de,z+1)),{data:On,line:an,column:Mn}}for(p=pt,t&&(R=Object.create({},{name:Wc(function(){return F}),originalName:Wc(function(){return C}),attrs:Wc(ct),ns:Wc(function(){return b})}));z!==-1;){if(G.charCodeAt(z)===60?de=z:de=G.indexOf("<",z),de===-1){if(q)return G.substring(z);if(E.length)return B("unexpected end of file");if(!f)return B("missing start tag");z<G.length&&G.substring(z).trim()&&P(Om);return}if(f||(f=!0),z!==de){if(E.length){if(n&&(n(G.substring(z,de),Ir,p),h))return}else if(G.substring(z,de).trim()&&(P(Om),h))return}if(ue=G.charCodeAt(de+1),ue===33){if(X=G.charCodeAt(de+2),X===91&&G.substr(de+3,6)==="CDATA["){if(z=G.indexOf("]]>",de),z===-1)return q?G.substring(de):B("unclosed cdata");if(r&&(r(G.substring(de+9,z),p),h))return;z+=3;continue}if(X===45&&G.charCodeAt(de+3)===45){if(z=G.indexOf("-->",de),z===-1)return q?G.substring(de):B("unclosed comment");if(c&&(c(G.substring(de+4,z),Ir,p),h))return;z+=3;continue}}if(ue===63){if(z=G.indexOf("?>",de),z===-1)return q?G.substring(de):B("unclosed question");if(l&&(l(G.substring(de,z+2),p),h))return;z+=2;continue}for(oe=de+1;;oe++){if(be=G.charCodeAt(oe),isNaN(be))return q?G.substring(de):(z=-1,B("unclosed tag"));if(be===34)X=G.indexOf('"',oe+1),oe=X!==-1?X:oe;else if(be===39)X=G.indexOf("'",oe+1),oe=X!==-1?X:oe;else if(be===62){z=oe;break}}if(ue===33){if(u&&(u(G.substring(de,z+1),Ir,p),h))return;z+=1;continue}if(fe={},ue===47){if(Ae=!1,Te=!0,!E.length)return B("missing open tag");if(oe=F=E.pop(),X=de+2+oe.length,G.substring(de+2,X)!==oe)return B("closing tag mismatch");for(;X<z;X++)if(ue=G.charCodeAt(X),!(ue===32||ue>8&&ue<14))return B("close tag")}else{if(G.charCodeAt(z-1)===47?(oe=F=G.substring(de+1,z-1),Ae=!0,Te=!0):(oe=F=G.substring(de+1,z),Ae=!0,Te=!1),!(ue>96&&ue<123||ue>64&&ue<91||ue===95||ue===58))return B("illegal first char nodeName");for(X=1,V=oe.length;X<V;X++)if(ue=oe.charCodeAt(X),!(ue>96&&ue<123||ue>64&&ue<91||ue>47&&ue<59||ue===45||ue===95||ue==46)){if(ue===32||ue<14&&ue>8){F=oe.substring(0,X),fe=null;break}return B("invalid nodeName")}Te||E.push(F)}if(y){K=b,Ae&&(Te||v.push(K),fe===null&&(g=oe.indexOf("xmlns",X)!==-1)&&(J=X,W=oe,ct(),g=!1)),C=F,re!==b&&(Y=b[Dm],Y===void 0&&(Y=b[Dm]=Object.create(null)),re=b);var zt=Y[F];if(zt!==void 0)F=zt;else{if(ue=F.indexOf(":"),ue!==-1){if($e=b[F.substring(0,ue)],!$e)return B("missing namespace on <"+C+">");F=F.substr(ue+1)}else $e=b.xmlns;$e&&(F=$e+":"+F),Y[C]=F}}if(Ae&&(J=X,W=oe,i&&(t?i(R,Ir,Te,p):i(F,ct,Ir,Te,p),h)))return;if(Te){if(o&&(o(t?R:F,Ir,Ae,p),h))return;y&&(Ae?b=K:b=v.pop())}z+=1}}}function Im(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var od={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Bm="property";function Nm(e){return e.xml&&e.xml.serialize}function pM(e){const t=Nm(e);return t!==Bm&&(t||null)}function dM(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $m(e,t){return Im(t)?e.prefix+":"+dM(e.localName):e.name}function fM(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 hM(e,t,n){const i=Gn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=Gn(o);var a=n.getPackage(r.prefix);return fM(r,a)}function Yo(e){return new Error(e)}function bo(e){return e.$descriptor}function gM(e){Z(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Yo("expected element");var n=this.elementsById,i=bo(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 Yo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function fs(){}fs.prototype.handleEnd=function(){},fs.prototype.handleText=function(){},fs.prototype.handleNode=function(){};function rd(){}rd.prototype=Object.create(fs.prototype),rd.prototype.handleNode=function(){return this};function ya(){}ya.prototype=Object.create(fs.prototype),ya.prototype.handleText=function(e){this.body=(this.body||"")+e};function hs(e,t){this.property=e,this.context=t}hs.prototype=Object.create(ya.prototype),hs.prototype.handleNode=function(e){if(this.element)throw Yo("expected no sub nodes");return this.element=this.createReference(e),this},hs.prototype.handleEnd=function(){this.element.id=this.body},hs.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function ad(e,t){this.element=t,this.propertyDesc=e}ad.prototype=Object.create(ya.prototype),ad.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ed(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function qc(){}qc.prototype=Object.create(ya.prototype),qc.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 Yn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Yn.prototype=Object.create(qc.prototype),Yn.prototype.addReference=function(e){this.context.addReference(e)},Yn.prototype.handleText=function(e){var t=this.element,n=bo(t),i=n.bodyProperty;if(!i)throw Yo("unexpected body text <"+e+">");ya.prototype.handleText.call(this,e)},Yn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=bo(t),i=n.bodyProperty;i&&e!==void 0&&(e=ed(i.type,e),t.set(i.name,e))},Yn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=bo(n),o=this.context,r=new n({}),a=this.model,s;return U(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),U(p,function(d){o.addReference({element:r,property:u.ns.name,id:d})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=ed(u.type,c):l==="xmlns"?l=":"+l:(s=Gn(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},Yn.prototype.getPropertyForNode=function(e){var t=e.name,n=Gn(t),i=this.type,o=this.model,r=bo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=pM(s);if(l){const u=e.attributes[l];if(u){const p=hM(u,e.ns,o),d=o.getType(p);return Z({},s,{effectiveType:bo(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=$m(n,c),u=o.getType(l);if(s=$t(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return Z({},s,{effectiveType:bo(u).name})}else if(s=$t(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Yo("unrecognized element <"+n.name+">")},Yn.prototype.toString=function(){return"ElementDescriptor["+bo(this.type).name+"]"},Yn.prototype.valueHandler=function(e,t){return new ad(e,t)},Yn.prototype.referenceHandler=function(e){return new hs(e,this.context)},Yn.prototype.handler=function(e){return e==="Element"?new va(this.model,e,this.context):new Yn(this.model,e,this.context)},Yn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Am(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?(Z(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function sd(e,t,n){Yn.call(this,e,t,n)}sd.prototype=Object.create(Yn.prototype),sd.prototype.createElement=function(e){var t=e.name,n=Gn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&$m(n,r)||t;if(!o.hasType(a))throw Yo("unexpected element <"+e.originalName+">");return Yn.prototype.createElement.call(this,e)};function va(e,t,n){this.model=e,this.context=n}va.prototype=Object.create(qc.prototype),va.prototype.createElement=function(e){var t=e.name,n=Gn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},va.prototype.handleChild=function(e){var t=new va(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},va.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function cd(e){e instanceof _i&&(e={model:e}),Z(this,{lax:!1},e)}cd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Yn?(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 gM(Z({},t,{rootHandler:i})),s=new Lm({proxy:!0}),c=mM();i.context=a,c.push(i);function l(E,M,B){var P=M(),k=P.line,N=P.column,G=P.data;G.charAt(0)==="<"&&G.indexOf(" ")!==-1&&(G=G.slice(0,G.indexOf(" "))+">");var q="unparsable content "+(G?G+" ":"")+`detected
1
+ (function(ie,Se){typeof exports=="object"&&typeof module<"u"?Se(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Se):(ie=typeof globalThis<"u"?globalThis:ie||self,Se(ie.BpmnModeler={},ie.Vue))})(this,(function(ie,Se){"use strict";var x6=Object.defineProperty;var b6=(ie,Se,Pr)=>Se in ie?x6(ie,Se,{enumerable:!0,configurable:!0,writable:!0,value:Pr}):ie[Se]=Pr;var ln=(ie,Se,Pr)=>b6(ie,typeof Se!="symbol"?Se+"":Se,Pr);const Pr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent","intermediateCatchEvent"],Nc=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","intermediateCatchEvent"];function dm(e){return Pr.includes(e)}function fm(e){return Nc.includes(e)}const $c=["timer"],Fc={timer:"bpmn:TimerEventDefinition"};function hm(e){return typeof e=="string"&&$c.includes(e)}function $p(e){if(e.length===1)return $c.find(t=>Fc[t]===e[0])}const jc=["ko","en","ja","zh"];function CR(e){return typeof e=="string"&&jc.includes(e)}const gm="http://g1project.net/spec/bpmn/bwl/1.0",Fp="bwl",jp=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Hc="bwl:ReviewRequest",mm={name:"bwl-hints",uri:gm,prefix:Fp,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"}]}]},Hp="bwl.undoEpisode",ym=new WeakSet;function AR(e){ym.has(e)||(e.register(Hp,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),ym.add(e))}function vm(e,t){AR(e);const n={run:t};if(e.execute(Hp,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}function xm(e){return e._stackIdx+1}function bm(e,t){const{_stack:n,_stackIdx:i}=e;if(i<t)return 0;const o=n[t].id;for(let r=t;r<=i;r++)n[r].id=o;return i-t+1}function zp(e){return Array.prototype.concat.apply([],e)}const us=Object.prototype.toString,TR=Object.prototype.hasOwnProperty;function kr(e){return e===void 0}function xn(e){return e!==void 0}function fa(e){return e==null}function Qe(e){return us.call(e)==="[object Array]"}function bn(e){return us.call(e)==="[object Object]"}function et(e){return us.call(e)==="[object Number]"}function Sn(e){const t=us.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function ri(e){return us.call(e)==="[object String]"}function PR(e){if(!Qe(e))throw new Error("must supply array")}function ai(e,t){return!fa(e)&&TR.call(e,t)}function $t(e,t){const n=Gc(t);let i;return U(e,function(o,r){if(n(o,r))return i=o,!1}),i}function wm(e,t){const n=Gc(t);let i=Qe(e)?-1:void 0;return U(e,function(o,r){if(n(o,r))return i=r,!1}),i}function ft(e,t){const n=Gc(t);let i=[];return U(e,function(o,r){n(o,r)&&i.push(o)}),i}function U(e,t){let n,i;if(kr(e))return;const o=Qe(e)?IR:LR;for(let r in e)if(ai(e,r)&&(n=e[r],i=t(n,o(r)),i===!1))return n}function kR(e,t){if(kr(e))return[];PR(e);const n=Gc(t);return e.filter(function(i,o){return!n(i,o)})}function si(e,t,n){return U(e,function(i,o){n=t(n,i,o)}),n}function zo(e,t){return!!si(e,function(n,i,o){return n&&t(i,o)},!0)}function Go(e,t){return!!$t(e,t)}function zn(e,t){let n=[];return U(e,function(i,o){n.push(t(i,o))}),n}function zc(e){return e&&Object.keys(e)||[]}function OR(e){return zc(e).length}function ha(e){return zn(e,t=>t)}function ga(e,t,n={}){return t=Gp(t),U(e,function(i){let o=t(i)||"_",r=n[o];r||(r=n[o]=[]),r.push(i)}),n}function _m(e,...t){e=Gp(e);let n={};return U(t,o=>ga(o,e,n)),zn(n,function(o,r){return o[0]})}const DR=_m;function Xi(e,t){t=Gp(t);let n=[];return U(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)}),zn(n,i=>i.v)}function ma(e){return function(t){return zo(e,function(n,i){return t[i]===n})}}function Gp(e){return Sn(e)?e:t=>t[e]}function Gc(e){return Sn(e)?e:t=>t===e}function LR(e){return e}function IR(e){return Number(e)}function Vp(e,t){let n,i,o,r;function a(p){let d=Date.now(),f=p?0:r+t-d;if(f>0)return s(f);e.apply(o,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=r=i=o=void 0}function l(){n&&a(!0),c()}function u(...p){r=Date.now(),i=p,o=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Qn(e,t){return e.bind(t)}function Z(e,...t){return Object.assign(e,...t)}function BR(e,t,n){let i=e;return U(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];xn(a)&&fa(s)&&(s=i[o]=isNaN(+a)?{}:[]),kr(a)?kr(n)?delete i[o]:i[o]=n:i=s}),e}function ji(e,t){let n={},i=Object(e);return U(t,function(o){o in i&&(n[o]=e[o])}),n}function Zi(e,t){let n={},i=Object(e);return U(i,function(o,r){t.indexOf(r)===-1&&(n[r]=o)}),n}function A(e,t){var n=Ee(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function dt(e,t){return Go(t,function(n){return A(e,n)})}function Ee(e){return e&&e.businessObject||e}function xt(e){return e&&e.di}const NR="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Em="i18n",Or="i18n:Translation";function Dr(e){if(e){if(A(e,"bpmn:TextAnnotation"))return{target:e,key:"text"};if(A(e,"bpmn:Group"))return e.categoryValueRef?{target:e.categoryValueRef,key:"value"}:void 0;if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return{target:e,key:"name"}}}function Vo(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,Or)})}function An(e){return e.get("xml:lang")}function Wo(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,Hc)})}function ps(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 Up(e,t,n){const i=Dr(e);if(!i)return{};const o=i.target[i.key]??"",r=Vo(e).filter(u=>An(u)),a=u=>u.body??"",s=o?r.filter(u=>a(u)===o).map(An):[],c=o?s.length?s:[n??t.designLocale]:[],l={};for(const u of ps(t)){if(c.includes(u)){l[u]=o;continue}const p=r.find(d=>An(d)===u&&a(d));p&&(l[u]=a(p))}return l}const Vc="bwl.updateTranslation";class qp{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=Dr(c),u=[];t.undo=u;const p=Vo(c).filter(k=>An(k)),d=s??(l?l.target[l.key]??"":""),f=a??o,g=(k=>{if(!k)return[];const N=p.filter(G=>G.body===k).map(An);return N.length?N:[f]})(d),y=s!==void 0&&d&&!g.includes(t.locale)?g[0]:t.locale,_=k=>{var N;return((N=p.find(G=>An(G)===k&&G.body))==null?void 0:N.body)??(g.includes(k)?d:"")},h=k=>Wo(c).some(N=>N.locale===k),v=_(y);if(v===i)return[];const b=!!v&&!h(y),E=b?r.filter(k=>k!==y&&_(k)&&!h(k)):[],M=()=>{let k=c.extensionElements;return k||(k=this.moddle.create("bpmn:ExtensionElements",{values:[]}),k.$parent=c,c.extensionElements=k,u.push(()=>delete c.extensionElements)),k.get("values")},B=(k,N)=>{const G=M();let q=G.find(Y=>{var re;return((re=Y.$instanceOf)==null?void 0:re.call(Y,Or))&&An(Y)===k});if(q){const Y=q.body;q.body=N,u.push(()=>q.body=Y)}else q=this.moddle.create(Or,{body:N}),q.set("xml:lang",k),q.$parent=c.extensionElements,G.push(q),u.push(()=>G.splice(G.indexOf(q),1))},P=k=>{const N=M(),G=N.indexOf(k);N.splice(G,1),u.push(()=>N.splice(G,0,k))};if(s===void 0){if(y===o&&l){if(d&&!p.some(N=>N.body===d)){const N=a&&a!==o?a:void 0;N&&B(N,d)}const k=Object.prototype.hasOwnProperty.call(l.target,l.key);l.target[l.key]=i,u.push(()=>{k?l.target[l.key]=d:delete l.target[l.key]})}B(y,i)}else(p.some(k=>An(k)===y)||!d&&y!==f)&&B(y,i);if(!b)for(const k of Wo(c).filter(N=>N.locale===y))P(k);for(const k of E){const N=M(),G=this.moddle.create(Hc,{locale:k,sourceLocale:y,previous:v});G.$parent=c.extensionElements,N.push(G),u.push(()=>N.splice(N.indexOf(G),1))}for(const k of Wo(c).filter(N=>N.sourceLocale===y&&(N.previous??"")===i))P(k);return u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ln(qp,"$inject",["moddle"]);const Yp="bwl.setTranslations",$R=(e,t)=>e.locale===t.locale&&(e.sourceLocale??void 0)===t.sourceLocale&&(e.previous??"")===t.previous;class Kp{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,!Dr(l))return[];const p=()=>{let _=l.extensionElements;return _||(_=this.moddle.create("bpmn:ExtensionElements",{values:[]}),_.$parent=l,l.extensionElements=_,u.push(()=>delete l.extensionElements)),_.get("values")},d=_=>{const h=p(),v=h.indexOf(_);v<0||(h.splice(v,1),u.push(()=>h.splice(v,0,_)))},f=_=>Vo(l).find(h=>An(h)===_);if(i===null)for(const _ of a){const h=f(_);h&&d(h)}else if(i)for(const _ of a){const h=i[_];if(h===void 0)continue;const v=f(_);if(v){if(v.body===h)continue;const M=v.body;v.body=h,u.push(()=>v.body=M);continue}if(_===r&&(s??r)===r)continue;const b=p(),E=this.moddle.create(Or,{body:h});E.set("xml:lang",_),E.$parent=l.extensionElements,b.push(E),u.push(()=>b.splice(b.indexOf(E),1))}const g=[...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 Wo(l)){const h=g.findIndex(v=>$R(_,v));h>=0?g.splice(h,1):d(_)}for(const _ of g){const h=p(),v=this.moddle.create(Hc,{locale:_.locale,..._.sourceLocale?{sourceLocale:_.sourceLocale}:{},previous:_.previous});v.$parent=l.extensionElements,h.push(v),u.push(()=>h.splice(h.indexOf(v),1))}const y=l.extensionElements;return y&&!y.get("values").length&&(delete l.extensionElements,u.push(()=>l.extensionElements=y)),u.length?[n,n.label].filter(Boolean):[]}revert(t){for(const n of[...t.undo].reverse())n();return t.undo.length?[t.element,t.element.label].filter(Boolean):[]}}ln(Kp,"$inject",["moddle"]);function Xp(e){return Wo(e).map(t=>({locale:t.locale,...t.sourceLocale?{sourceLocale:t.sourceLocale}:{},previous:t.previous??""}))}class Zp{constructor(t){t.registerHandler(Vc,qp),t.registerHandler(Yp,Kp)}}ln(Zp,"$inject",["commandStack"]);const Jp={__init__:["translationCommands"],translationCommands:["type",Zp]},Sm=["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"],FR={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},jR={type:"object",description:"다국어 그룹의 문구 — 로케일 → 문구. **그 문서의 문서 언어(설계 + 병기 · describe 의 i18n) 전부**를 담는다(빠지거나 밖의 언어면 거부). 평문 name/text 와 함께 주면 거부. 문서 언어 설정이 없는 문서(describe 에 i18n 이 없다)는 이것 대신 평문을 쓴다.",properties:Object.fromEntries(jc.map(e=>[e,{type:"string"}])),additionalProperties:!1},HR={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},zR={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},GR={type:"string",enum:[...$c],description:"이벤트 정의. **type 이 intermediateCatchEvent 일 때만 쓰고, 그때는 반드시 준다**(다른 타입에 주거나 빠뜨리면 거부). timer = 시한 대기(「30분 경과」·「확정 기간 경과」처럼 시간이 지나야 다음으로 가는 자리). 시한 값은 name 에 쓴다 — 표현식 필드는 없다."},VR={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ). intermediateCatchEvent 는 eventDefinition 과 짝으로만 받는다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Nc]},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},WR={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만. ⚠ 다국어 그룹(describe 에 i18n 이 있다)에서는 쓰지 않는다 — 조건 라벨도 그 플로우의 names 로 준다.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},UR={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},qR={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},YR={type:"object",properties:{id:{type:"string"},name:{type:"string"},names:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},KR={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},XR={type:"object",description:"텍스트 주석. 본문은 text(평문) 또는 texts(다국어 그룹) 중 하나를 반드시 준다.",properties:{id:{type:"string"},text:{type:"string"},texts:{$ref:"#/$defs/localeTexts"}},required:["id"],additionalProperties:!1},ZR={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},JR={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},QR={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...jp]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Dn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const eM={"participant.add":Dn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Dn("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":Dn("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":Dn("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:[...Nc]},eventDefinition:{$ref:"#/$defs/eventDefinition"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Dn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Dn("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":Dn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Dn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataStore.add":Dn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Dn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},names:{$ref:"#/$defs/localeTexts"}},required:["id"]}),"dataAssociation.add":Dn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Dn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Dn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Dn("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":Dn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Dn("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":Dn("translation.confirm",{description:"확인만 — 그 요소의 locale 칸에 걸린 확인 요청(describe 의 i18n.reviewRequests)을 문구를 바꾸지 않고 해소한다. 다른 언어가 고쳐졌지만(sourceLocale · previous → 지금 문구) 이 칸의 번역이 여전히 맞을 때(오타 수준) 쓴다. 번역을 고쳐야 하면 이것 대신 그 요소의 update 에 names/texts(문서 언어 전부)를 준다 — 문구가 실제로 바뀐 칸의 표식만 해소된다. 다국어 그룹에서만 받고, 그 칸에 표식이 없으면 거부한다.",properties:{id:{type:"string",description:"확인 요청이 걸린 요소 id."},locale:{type:"string",enum:[...jc],description:"확인 요청을 받은 칸의 언어(reviewRequests 의 locale)."}},required:["id","locale"]}),"element.remove":Dn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Rm={anyOf:Sm.map(e=>eM[e])},tM={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:HR,irParticipant:zR,irNode:VR,irFlowCondition:WR,irSequenceFlow:UR,irMessageFlow:qR,irDataStore:YR,irDataAssociation:KR,irTextAnnotation:XR,irAssociation:ZR,irGroup:JR,bwlPlacement:QR,eventDefinition:GR,localeTexts:jR,nullableString:FR,symbolicOp:Rm}};function Qp(){}Qp.prototype.get=function(e){return this.$model.properties.get(this,e)},Qp.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Mm(e,t){this.model=e,this.properties=t}Mm.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Qp.prototype);U(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}),U(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 nM=Z(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Cm=Z(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function ed(e,t){var n=Cm[e];return n?n(t):t}function td(e){return!!nM[e]}function Am(e){return!!Cm[e]}function Gn(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 vi(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}vi.prototype.build=function(){return ji(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},vi.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)},vi.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},vi.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,o=t.split("#"),r=Gn(o[0],i),a=Gn(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},vi.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},vi.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},vi.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},vi.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},vi.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},vi.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")},vi.prototype.hasProperty=function(e){return this.propertiesByName[e]},vi.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,o=e.name;o in n||(U(e.properties,Qn(function(r){r=Z({},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 Uo(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,U(e,Qn(this.registerPackage,this))}Uo.prototype.getPackage=function(e){return this.packageMap[e]},Uo.prototype.getPackages=function(){return this.packages},Uo.prototype.registerPackage=function(e){e=Z({},e);var t=this.packageMap;Tm(t,e,"prefix"),Tm(t,e,"uri"),U(e.types,Qn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Uo.prototype.registerType=function(e,t){e=Z({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Z({},e.meta||{})});var n=Gn(e.name,t.prefix),i=n.name,o=Object.create(null);U(e.properties,Qn(function(r){var a=Gn(r.name,n.prefix),s=a.name;td(r.type)||(r.type=Gn(r.type,a.prefix).name),Z(r,{ns:a,name:s}),o[s]=r},this)),Z(e,{ns:n,name:i,propertiesByName:o}),U(e.extends,Qn(function(r){var a=Gn(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},Uo.prototype.mapTypes=function(e,t,n){var i=td(e.name)?{name:e.name}:this.typeMap[e.name],o=this;function r(c,l){var u=Gn(c,td(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+">");U(i.superClass,n?a:s),t(i,!n),U(i.traits,a)},Uo.prototype.getEffectiveDescriptor=function(e){var t=Gn(e),n=new vi(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},Uo.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Tm(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Lr(e){this.model=e}Lr.prototype.set=function(e,t,n){if(!ri(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),o=i&&i.name;iM(n)?i?delete e[o]:delete e.$attrs[nd(t)]:i?o in e?e[o]=n:Pm(e,i,n):e.$attrs[nd(t)]=n},Lr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[nd(t)];var i=n.name;return!e[i]&&n.isMany&&Pm(e,n,[]),e[i]},Lr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=Z({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Lr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Lr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Lr.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 iM(e){return typeof e>"u"}function Pm(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function nd(e){return e.replace(/^:/,"")}function _i(e,t={}){this.properties=new Lr(this),this.factory=new Mm(this,this.properties),this.registry=new Uo(e,this.properties),this.typeCache=Object.create(null),this.config=t}_i.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},_i.prototype.getType=function(e){var t=this.typeCache,n=ri(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},_i.prototype.createAny=function(e,t,n){var i=Gn(e),o={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){BR(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}),U(n,function(a,s){bn(a)&&a.value!==void 0?o[a.name]=a.value:o[s]=a}),o},_i.prototype.getPackage=function(e){return this.registry.getPackage(e)},_i.prototype.getPackages=function(){return this.registry.getPackages()},_i.prototype.getElementDescriptor=function(e){return e.$descriptor},_i.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},_i.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},_i.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var km=String.fromCharCode,oM=Object.prototype.hasOwnProperty,rM=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ds={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ds).forEach(function(e){ds[e.toUpperCase()]=ds[e]});function aM(e,t,n,i){return i?oM.call(ds,i)?ds[i]:"&"+i+";":km(t||parseInt(n,16))}function Ir(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(rM,aM):e}var Om="non-whitespace outside of root node";function qo(e){return new Error(e)}function sM(e){return"missing namespace for prefix <"+e+">"}function Wc(e){return{get:e,enumerable:!0}}function cM(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Dm=Symbol("nameCache");function id(e){return e+"$uri"}function lM(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[id(i)]=n;return t}function Uc(){return{line:0,column:0}}function uM(e){throw e}function Lm(e){if(!this)return new Lm(e);var t=e&&e.proxy,n,i,o,r,a=uM,s,c,l,u,p=Uc,d=!1,f=!1,m="",g=!1,y=!1,_=null,h=!1,v,b,E,M;function B(G){G instanceof Error||(G=qo(G)),_=G,a(G,p)}function P(G){s&&(G instanceof Error||(G=qo(G)),s(G,p))}this.on=function(G,q){if(typeof q!="function")throw qo("required args <name, cb>");switch(G){case"openTag":i=q;break;case"text":n=q;break;case"closeTag":o=q;break;case"error":a=q;break;case"warn":s=q;break;case"cdata":r=q;break;case"attention":u=q;break;case"question":l=q;break;case"comment":c=q;break;default:throw qo("unsupported event: "+G)}return this},this.ns=function(G){if(typeof G>"u"&&(G={}),typeof G!="object")throw qo("required args <nsMap={}>");var q=Object.create(null),Y;for(Y in G)q[Y]=G[Y];return y=!0,M=q,this};function k(){v=y?[]:null,b=y?lM(M):null,E=[],p=Uc,h=!1,_=null,f=!1,m=""}this.parse=function(G){if(typeof G!="string")throw qo("required args <xml=string>");if(d)throw qo("parse during stream; call end() first");return k(),N(G),p=Uc,h=!1,_},this.write=function(G){if(typeof G!="string")throw qo("required args <xml=string>");return d||(k(),d=!0),_||(m=N(m+G,!0)||""),this},this.end=function(){return d||k(),d=!1,_||N(m),m="",p=Uc,h=!1,_},this.stop=function(){h=!0};function N(G,q=!1){var Y=null,re=null,K,Ce=0,Ae=!1,Te=!1,de=0,z=0,oe,V,X,ue,be,$e,F,C,R,W="",J=0,fe;function Pe(vt,an){var Mn=vt.indexOf(":");if(Mn===-1)return vt;var kn=b[vt.substring(0,Mn)];return kn?an===kn?vt.substr(Mn+1):kn+vt.substr(Mn):(P(sM(vt.substring(0,Mn))),null)}function ct(){if(fe!==null)return fe;var vt,an,Mn=y&&b.xmlns,kn=y&&g?[]:null,Nt=J,vn=W,On=vn.length,ii,qn,Ni,oi,Wt,Rr={},is=new Set,Zn,_t,At;e:for(;Nt<On;Nt++)if(Zn=!1,_t=vn.charCodeAt(Nt),!(_t===32||_t<14&&_t>8)){for((_t<65||_t>122||_t>90&&_t<97)&&_t!==95&&_t!==58&&(P("illegal first char attribute name"),Zn=!0),At=Nt+1;At<On;At++)if(_t=vn.charCodeAt(At),!(_t>96&&_t<123||_t>64&&_t<91||_t>47&&_t<59||_t===46||_t===45||_t===95)){if(_t===32||_t<14&&_t>8){P("missing attribute value"),Nt=At;continue e}if(_t===61)break;P("illegal attribute name char"),Zn=!0}if(Wt=vn.substring(Nt,At),Wt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),Zn=!0),_t=vn.charCodeAt(At+1),_t===34)At=vn.indexOf('"',Nt=At+2),At===-1&&(At=vn.indexOf("'",Nt),At!==-1&&(P("attribute value quote missmatch"),Zn=!0));else if(_t===39)At=vn.indexOf("'",Nt=At+2),At===-1&&(At=vn.indexOf('"',Nt),At!==-1&&(P("attribute value quote missmatch"),Zn=!0));else for(P("missing attribute value quotes"),Zn=!0,At=At+1;At<On&&(_t=vn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++);for(At===-1&&(P("missing closing quotes"),At=On,Zn=!0),Zn||(Ni=vn.substring(Nt,At)),Nt=At;At+1<On&&(_t=vn.charCodeAt(At+1),!(_t===32||_t<14&&_t>8));At++)Nt===At&&(P("illegal character after attribute end"),Zn=!0);if(Nt=At+1,Zn)continue e;if(is.has(Wt)){P("attribute <"+Wt+"> already defined");continue}if(is.add(Wt),!y){Rr[Wt]=Ni;continue}if(g){if(qn=Wt==="xmlns"?"xmlns":Wt.charCodeAt(0)===120&&Wt.substr(0,6)==="xmlns:"?Wt.substr(6):null,qn!==null){if(vt=Ir(Ni),an=id(qn),oi=M[vt],!oi){if(qn==="xmlns"||an in b&&b[an]!==vt)do oi="ns"+Ce++;while(typeof b[oi]<"u");else oi=qn;M[vt]=oi}b[qn]!==oi&&(ii||(b=cM(b),ii=!0),b[qn]=oi,qn==="xmlns"&&(b[id(oi)]=vt,Mn=oi),b[an]=vt),Rr[Wt]=Ni;continue}kn.push(Wt,Ni);continue}Wt=Pe(Wt,Mn),Wt!==null&&(Rr[Wt]=Ni)}if(g)for(Nt=0,On=kn.length;Nt<On;Nt++)Wt=Pe(kn[Nt++],Mn),Ni=kn[Nt],Wt!==null&&(Rr[Wt]=Ni);return fe=Rr}function pt(){for(var vt=/(\r\n|\r|\n)/g,an=0,Mn=0,kn=0,Nt=z,vn,On;de>=kn&&(vn=vt.exec(G),!(!vn||(Nt=vn[0].length+vn.index,Nt>de)));)an+=1,kn=Nt;return de==-1?(Mn=Nt,On=G.substring(z)):z===0?On=G.substring(z,de):(Mn=de-kn,On=z==-1?G.substring(de):G.substring(de,z+1)),{data:On,line:an,column:Mn}}for(p=pt,t&&(R=Object.create({},{name:Wc(function(){return F}),originalName:Wc(function(){return C}),attrs:Wc(ct),ns:Wc(function(){return b})}));z!==-1;){if(G.charCodeAt(z)===60?de=z:de=G.indexOf("<",z),de===-1){if(q)return G.substring(z);if(E.length)return B("unexpected end of file");if(!f)return B("missing start tag");z<G.length&&G.substring(z).trim()&&P(Om);return}if(f||(f=!0),z!==de){if(E.length){if(n&&(n(G.substring(z,de),Ir,p),h))return}else if(G.substring(z,de).trim()&&(P(Om),h))return}if(ue=G.charCodeAt(de+1),ue===33){if(X=G.charCodeAt(de+2),X===91&&G.substr(de+3,6)==="CDATA["){if(z=G.indexOf("]]>",de),z===-1)return q?G.substring(de):B("unclosed cdata");if(r&&(r(G.substring(de+9,z),p),h))return;z+=3;continue}if(X===45&&G.charCodeAt(de+3)===45){if(z=G.indexOf("-->",de),z===-1)return q?G.substring(de):B("unclosed comment");if(c&&(c(G.substring(de+4,z),Ir,p),h))return;z+=3;continue}}if(ue===63){if(z=G.indexOf("?>",de),z===-1)return q?G.substring(de):B("unclosed question");if(l&&(l(G.substring(de,z+2),p),h))return;z+=2;continue}for(oe=de+1;;oe++){if(be=G.charCodeAt(oe),isNaN(be))return q?G.substring(de):(z=-1,B("unclosed tag"));if(be===34)X=G.indexOf('"',oe+1),oe=X!==-1?X:oe;else if(be===39)X=G.indexOf("'",oe+1),oe=X!==-1?X:oe;else if(be===62){z=oe;break}}if(ue===33){if(u&&(u(G.substring(de,z+1),Ir,p),h))return;z+=1;continue}if(fe={},ue===47){if(Ae=!1,Te=!0,!E.length)return B("missing open tag");if(oe=F=E.pop(),X=de+2+oe.length,G.substring(de+2,X)!==oe)return B("closing tag mismatch");for(;X<z;X++)if(ue=G.charCodeAt(X),!(ue===32||ue>8&&ue<14))return B("close tag")}else{if(G.charCodeAt(z-1)===47?(oe=F=G.substring(de+1,z-1),Ae=!0,Te=!0):(oe=F=G.substring(de+1,z),Ae=!0,Te=!1),!(ue>96&&ue<123||ue>64&&ue<91||ue===95||ue===58))return B("illegal first char nodeName");for(X=1,V=oe.length;X<V;X++)if(ue=oe.charCodeAt(X),!(ue>96&&ue<123||ue>64&&ue<91||ue>47&&ue<59||ue===45||ue===95||ue==46)){if(ue===32||ue<14&&ue>8){F=oe.substring(0,X),fe=null;break}return B("invalid nodeName")}Te||E.push(F)}if(y){K=b,Ae&&(Te||v.push(K),fe===null&&(g=oe.indexOf("xmlns",X)!==-1)&&(J=X,W=oe,ct(),g=!1)),C=F,re!==b&&(Y=b[Dm],Y===void 0&&(Y=b[Dm]=Object.create(null)),re=b);var zt=Y[F];if(zt!==void 0)F=zt;else{if(ue=F.indexOf(":"),ue!==-1){if($e=b[F.substring(0,ue)],!$e)return B("missing namespace on <"+C+">");F=F.substr(ue+1)}else $e=b.xmlns;$e&&(F=$e+":"+F),Y[C]=F}}if(Ae&&(J=X,W=oe,i&&(t?i(R,Ir,Te,p):i(F,ct,Ir,Te,p),h)))return;if(Te){if(o&&(o(t?R:F,Ir,Ae,p),h))return;y&&(Ae?b=K:b=v.pop())}z+=1}}}function Im(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var od={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Bm="property";function Nm(e){return e.xml&&e.xml.serialize}function pM(e){const t=Nm(e);return t!==Bm&&(t||null)}function dM(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $m(e,t){return Im(t)?e.prefix+":"+dM(e.localName):e.name}function fM(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 hM(e,t,n){const i=Gn(e,t.xmlns),o=`${t[i.prefix]||i.prefix}:${i.localName}`,r=Gn(o);var a=n.getPackage(r.prefix);return fM(r,a)}function Yo(e){return new Error(e)}function bo(e){return e.$descriptor}function gM(e){Z(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Yo("expected element");var n=this.elementsById,i=bo(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 Yo("duplicate ID <"+r+">");n[r]=t}},this.addWarning=function(t){this.warnings.push(t)}}function fs(){}fs.prototype.handleEnd=function(){},fs.prototype.handleText=function(){},fs.prototype.handleNode=function(){};function rd(){}rd.prototype=Object.create(fs.prototype),rd.prototype.handleNode=function(){return this};function ya(){}ya.prototype=Object.create(fs.prototype),ya.prototype.handleText=function(e){this.body=(this.body||"")+e};function hs(e,t){this.property=e,this.context=t}hs.prototype=Object.create(ya.prototype),hs.prototype.handleNode=function(e){if(this.element)throw Yo("expected no sub nodes");return this.element=this.createReference(e),this},hs.prototype.handleEnd=function(){this.element.id=this.body},hs.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function ad(e,t){this.element=t,this.propertyDesc=e}ad.prototype=Object.create(ya.prototype),ad.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ed(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function qc(){}qc.prototype=Object.create(ya.prototype),qc.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 Yn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Yn.prototype=Object.create(qc.prototype),Yn.prototype.addReference=function(e){this.context.addReference(e)},Yn.prototype.handleText=function(e){var t=this.element,n=bo(t),i=n.bodyProperty;if(!i)throw Yo("unexpected body text <"+e+">");ya.prototype.handleText.call(this,e)},Yn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=bo(t),i=n.bodyProperty;i&&e!==void 0&&(e=ed(i.type,e),t.set(i.name,e))},Yn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=bo(n),o=this.context,r=new n({}),a=this.model,s;return U(t,function(c,l){var u=i.propertiesByName[l],p;u&&u.isReference?u.isMany?(p=c.split(" "),U(p,function(d){o.addReference({element:r,property:u.ns.name,id:d})})):o.addReference({element:r,property:u.ns.name,id:c}):(u?c=ed(u.type,c):l==="xmlns"?l=":"+l:(s=Gn(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},Yn.prototype.getPropertyForNode=function(e){var t=e.name,n=Gn(t),i=this.type,o=this.model,r=bo(i),a=n.name,s=r.propertiesByName[a];if(s&&!s.isAttr){const l=pM(s);if(l){const u=e.attributes[l];if(u){const p=hM(u,e.ns,o),d=o.getType(p);return Z({},s,{effectiveType:bo(d).name})}}return s}var c=o.getPackage(n.prefix);if(c){const l=$m(n,c),u=o.getType(l);if(s=$t(r.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&u.hasType(p.type)}),s)return Z({},s,{effectiveType:bo(u).name})}else if(s=$t(r.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw Yo("unrecognized element <"+n.name+">")},Yn.prototype.toString=function(){return"ElementDescriptor["+bo(this.type).name+"]"},Yn.prototype.valueHandler=function(e,t){return new ad(e,t)},Yn.prototype.referenceHandler=function(e){return new hs(e,this.context)},Yn.prototype.handler=function(e){return e==="Element"?new va(this.model,e,this.context):new Yn(this.model,e,this.context)},Yn.prototype.handleChild=function(e){var t,n,i,o;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Am(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?(Z(r,{element:i}),this.context.addReference(r)):r.$parent=i),o};function sd(e,t,n){Yn.call(this,e,t,n)}sd.prototype=Object.create(Yn.prototype),sd.prototype.createElement=function(e){var t=e.name,n=Gn(t),i=this.model,o=this.type,r=i.getPackage(n.prefix),a=r&&$m(n,r)||t;if(!o.hasType(a))throw Yo("unexpected element <"+e.originalName+">");return Yn.prototype.createElement.call(this,e)};function va(e,t,n){this.model=e,this.context=n}va.prototype=Object.create(qc.prototype),va.prototype.createElement=function(e){var t=e.name,n=Gn(t),i=n.prefix,o=e.ns[i+"$uri"],r=e.attributes;return this.model.createAny(t,o,r)},va.prototype.handleChild=function(e){var t=new va(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},va.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function cd(e){e instanceof _i&&(e={model:e}),Z(this,{lax:!1},e)}cd.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Yn?(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 gM(Z({},t,{rootHandler:i})),s=new Lm({proxy:!0}),c=mM();i.context=a,c.push(i);function l(E,M,B){var P=M(),k=P.line,N=P.column,G=P.data;G.charAt(0)==="<"&&G.indexOf(" ")!==-1&&(G=G.slice(0,G.indexOf(" "))+">");var q="unparsable content "+(G?G+" ":"")+`detected
2
2
  line: `+k+`
3
3
  column: `+N+`
4
4
  nested error: `+E.message;if(B)return a.addWarning({message:q,error:E}),!0;throw Yo(q)}function u(E,M){return l(E,M,!0)}function p(){var E=a.elementsById,M=a.references,B,P;for(B=0;P=M[B];B++){var k=P.element,N=E[P.id],G=bo(k).propertiesByName[P.property];if(N||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),G.isMany){var q=k.get(G.name),Y=q.indexOf(P);Y===-1&&(Y=q.length),N?q[Y]=N:q.splice(Y,1)}else k.set(G.name,N)}}function d(){c.pop().handleEnd()}var f=/^<\?xml /i,m=/ encoding="([^"]+)"/i,g=/^utf-8$/i;function y(E){if(f.test(E)){var M=m.exec(E),B=M&&M[1];!B||g.test(B)||a.addWarning({message:"unsupported document encoding <"+B+">, falling back to UTF-8"})}}function _(E,M){var B=c.peek();try{c.push(B.handleNode(E))}catch(P){l(P,M,r)&&c.push(new rd)}}function h(E,M){try{c.peek().handleText(E)}catch(B){u(B,M)}}function v(E,M){E.trim()&&h(E,M)}var b=o.getPackages().reduce(function(E,M){return E[M.uri]=M.prefix,E},Object.entries(od).reduce(function(E,[M,B]){return E[B]=M,E},o.config&&o.config.nsMap||{}));return s.ns(b).on("openTag",function(E,M,B,P){var k=E.attrs||{},N=Object.keys(k).reduce(function(q,Y){var re=M(k[Y]);return q[Y]=re,q},{}),G={name:E.name,originalName:E.originalName,attributes:N,ns:E.ns};_(G,P)}).on("question",y).on("closeTag",d).on("cdata",h).on("text",function(E,M,B){v(M(E),B)}).on("error",l).on("warn",u),new Promise(function(E,M){var B;try{s.parse(e),p()}catch(q){B=q}var P=i.element;!B&&!P&&(B=Yo("failed to parse document as <"+i.type.$descriptor.name+">"));var k=a.warnings,N=a.references,G=a.elementsById;return B?(B.warnings=k,M(B)):E({rootElement:P,elementsById:G,references:N,warnings:k})})},cd.prototype.handler=function(e){return new sd(this.model,e)};function mM(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var yM=`<?xml version="1.0" encoding="UTF-8"?>
5
5
  `,vM=/<|>|'|"|&|\n\r|\n/g,Fm=/<|>|&/g;function Ji(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Ji.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ji.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ji.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ji.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)},Ji.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ji.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ji.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Ji.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ji.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 xM(e){return e.charAt(0).toLowerCase()+e.slice(1)}function bM(e,t){return Im(t)?xM(e):e}function jm(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Hm(e){return ri(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function wM(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 _M(e,t){return t.isGeneric?Z({localName:t.ns.localName},e):Z({localName:bM(t.ns.localName,t.$pkg)},e)}function EM(e,t){return Z({localName:t.ns.localName},e)}function SM(e){var t=e.$descriptor;return ft(t.properties,function(n){var i=n.name;if(n.isVirtual||!ai(e,i))return!1;var o=e[i];return o===n.default||o===null?!1:n.isMany?o.length:!0})}var RM={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},MM={"<":"lt",">":"gt","&":"amp"};function zm(e,t,n){return e=ri(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function CM(e){return zm(e,vM,RM)}function AM(e){return zm(e,Fm,MM)}function TM(e){return ft(e,function(t){return t.isAttr})}function PM(e){return ft(e,function(t){return!t.isAttr})}function ld(e){this.tagName=e}ld.prototype.build=function(e){return this.element=e,this},ld.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Br(){}Br.prototype.serializeValue=Br.prototype.serializeTo=function(e){e.append(this.escape?AM(this.value):this.value)},Br.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Fm)!==-1&&(this.escape=!0),this};function ud(e){this.tagName=e}jm(ud,Br),ud.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function qt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}qt.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=SM(e),this.parseAttributes(TM(o)),this.parseContainments(PM(o))),this.parseGenericAttributes(e,i),this},qt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return _M(t,e)},qt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return EM(t,e)},qt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},qt.prototype.nsAttributeName=function(e){var t;if(ri(e)?t=Gn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:Z({localName:t.localName},n)},qt.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}))},qt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Br().build({type:"String"},t));var n=e.$children;n&&U(n,i=>{this.body.push(new qt(this).build(i))})},qt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,o=Gn(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)}},qt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return U(n,function(o,r){var a=t.parseNsAttribute(e,r,o);a&&i.push(a)}),i},qt.prototype.parseGenericAttributes=function(e,t){var n=this;U(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)}})},qt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;U(e,function(o){var r=i.get(o.name),a=o.isReference,s=o.isMany;if(s||(r=[r]),o.isBody)n.push(new Br().build(o,r[0]));else if(Am(o.type))U(r,function(l){n.push(new ud(t.addTagName(t.nsPropertyTagName(o))).build(o,l))});else if(a)U(r,function(l){n.push(new ld(t.addTagName(t.nsPropertyTagName(o))).build(l))});else{var c=Nm(o);U(r,function(l){var u;c?c===Bm?u=new qt(t,o):u=new Yc(t,o,c):u=new qt(t),n.push(u.build(l))})}})},qt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Ji(i):t=i),t},qt.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},qt.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},qt.prototype.parseAttributes=function(e){var t=this,n=this.element;U(e,function(i){var o=n.get(i.name);if(i.isReference)if(!i.isMany)o=o.id;else{var r=[];U(o,function(a){r.push(a.id)}),o=r.join(" ")}t.addAttribute(t.nsAttributeName(i),o)})},qt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Hm(e)},qt.prototype.addAttribute=function(e,t){var n=this.attrs;ri(t)&&(t=CM(t));var i=wm(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)},qt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=wM(n).concat(t)),U(t,function(i){e.append(" ").append(Hm(i.name)).append('="').append(i.value).append('"')})},qt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Br;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),U(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Yc(e,t,n){qt.call(this,e,t),this.serialization=n}jm(Yc,qt),Yc.prototype.parseNsAttributes=function(e){var t=qt.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},Yc.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function kM(){this.value="",this.write=function(e){this.value+=e}}function OM(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 DM(e){e=Z({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new kM,r=new OM(o,e.format);e.preamble&&r.append(yM);var a=new qt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(LM(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function LM(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in od)n[i]=od[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 Kc(e,t){_i.call(this,e,t)}Kc.prototype=Object.create(_i.prototype),Kc.prototype.fromXML=function(e,t,n){ri(t)||(n=t,t="bpmn:Definitions");var i=new cd(Z({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Kc.prototype.toXML=function(e,t){var n=new DM(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var IM="BPMN20",BM="http://www.omg.org/spec/BPMN/20100524/MODEL",NM="bpmn",$M=[],FM=[{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"}]}],jM=[{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"}]}],HM={tagAlias:"lowerCase",typePrefix:"t"},zM={name:IM,uri:BM,prefix:NM,associations:$M,types:FM,enumerations:jM,xml:HM},GM="BPMNDI",VM="http://www.omg.org/spec/BPMN/20100524/DI",WM="bpmndi",UM=[{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"]}],qM=[{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"}]}],YM=[],KM={name:GM,uri:VM,prefix:WM,types:UM,enumerations:qM,associations:YM},XM="DC",ZM="http://www.omg.org/spec/DD/20100524/DC",JM="dc",QM=[{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}]}],eC=[],tC={name:XM,uri:ZM,prefix:JM,types:QM,associations:eC},nC="DI",iC="http://www.omg.org/spec/DD/20100524/DI",oC="di",rC=[{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"}]}],aC=[],sC={tagAlias:"lowerCase"},cC={name:nC,uri:iC,prefix:oC,types:rC,associations:aC,xml:sC},lC="bpmn.io colors for BPMN",uC="http://bpmn.io/schema/bpmn/biocolor/1.0",pC="bioc",dC=[{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"}]}],fC=[],hC=[],gC={name:lC,uri:uC,prefix:pC,types:dC,enumerations:fC,associations:hC},mC="BPMN in Color",yC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",vC="color",xC=[{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"}]}],bC=[],wC=[],_C={name:mC,uri:yC,prefix:vC,types:xC,enumerations:bC,associations:wC};const EC={bpmn:zM,bpmndi:KM,dc:tC,di:cC,bioc:gC,color:_C};function Gm(e,t){const n=Z({},EC,e);return new Kc(n,t)}const SC={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"}},gs={[Em]:SC,[Fp]:mm};function Vm(){return Gm(gs)}const Wm=Vm();async function xa(e){const{rootElement:t,warnings:n}=await Wm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function RC(e){const{xml:t}=await Wm.toXML(e,{format:!0});return t}function pd(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Qi={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Um=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function MC(e){return Um.test(e)}function CC(e){const t=Qi;return Um.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 Nr(e,t){let n=0;for(const i of e)n+=t*CC(i);return n}function qm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&AC(e),TC(e),PC(e),kC(e)}function AC(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:Nr(o,r),fontBoundingBoxAscent:r*Qi.ascentEm,fontBoundingBoxDescent:r*Qi.descentEm,actualBoundingBoxAscent:r*Qi.ascentEm,actualBoundingBoxDescent:r*Qi.descentEm}}};t.getContext=()=>n}function TC(e){if(e.SVGMatrix)return;class t{constructor(){ln(this,"a",1);ln(this,"b",0);ln(this,"c",0);ln(this,"d",1);ln(this,"e",0);ln(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 PC(e){var r;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,l=0){const u=s*Math.PI/180,p=Math.cos(u),d=Math.sin(u);a.a=p,a.b=d,a.c=-d,a.d=p,a.e=c-p*c+d*l,a.f=l-d*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function kC(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:Nr(n,12),height:14}})}const Xc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),OC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),DC=1,Zc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),LC=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}`;case"merge-before-predecessor":return`mb|${e.merge}|${e.edge}`}}const Ym=20,Jc=5,Km=3,IC=8,ba=15,dd=50,Xm=12,BC=Xm*1.2;function fd(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Nr(r,Xm))),o=n.length*BC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Zm=1;function un(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 un(e))for(const s of un(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Zm)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>=Ym&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function hd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Jm(e,t){const n=$r(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function NC(e,t){let n=0;for(const i of t)i.id!==e.id&&Jm(e,i)&&n++;return n}function ei(e,t){let n=0;for(const i of t)i.id!==e.id&&$r(e,i)&&n++;return n}const Qm=15,ey=20;function $C(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-ey||t.at>n[1]+ey)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 gd=20;function Qc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Zm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<Ym||n.push([o-gd,r+gd])}return n}function el(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of un(e)){const r=$C(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Qc(o,un(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const FC=10,jC=1,HC=(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 zC(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const d=(f,m)=>{if(m===0)return f<=0;const g=f/m;if(m>0){if(g>p)return!1;g>u&&(u=g)}else{if(g<u)return!1;g<p&&(p=g)}return!0};return d(o-e.x,c)&&d(e.x-a,-c)&&d(r-e.y,l)&&d(e.y-s,-l)&&p>u}function md(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 GC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,wa=1;function Hi(e,t){const n=e.x+wa,i=e.x+e.width-wa,o=e.y+wa,r=e.y+e.height-wa;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 _a(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 ty(e,t){const n=e.label;if(!n)return null;if(un(e).some(i=>Hi(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(un(i).some(o=>Hi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(_a(i).some(o=>Hi(n,o)))return i.id;return null}function Ot(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(zC(e.waypoints[r],e.waypoints[r+1],o,LC)){i.push(o);break}}return i}const ms=(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))},VC=(e,t,n,i)=>iy(e,t,n,i)?0:Math.min(ms(e,n,i),ms(t,n,i),ms(n,e,t),ms(i,e,t)),ny=(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 wo(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,ms({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(ny(e,s)||ny(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,VC(e,t,s[l],s[(l+1)%s.length]));return c}function iy(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 yd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function oy(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(iy(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ys(e,t){let n=0;for(const i of t)i.id===e.id||yd(e,i)||oy(e,i)&&n++;return n}function Vn(e,t){let n=0;for(const i of t)i.id===e.id||yd(e,i)||ys(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function ry(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++)ys(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function eo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ys(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 Ei(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(yd(n[i],n[o])&&oy(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 ay(e){const t=eo(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:WC(e)}}function WC(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 sy(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Zc.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 cy(e){var n;const t=(n=Ut(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ut(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 ly=e=>e?{members:e}:{},Ln=e=>e.shapes.filter(t=>!t.container);function UC(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 qC(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 uy(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(un(i).some(o=>Hi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(_a(i).some(o=>Hi(n,o)))return i.id;return null}function Ko(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 py=3;function dy(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 vs(e,t){const n=[];for(const i of t.shapes){if(i.container||Zc.has(i.type))continue;const o=dy(e,i);o>=py&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function vd(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function YC(e){const t=e.edges.filter(s=>s.type==="bpmn:SequenceFlow"&&!!s.source&&!!s.target),n=new Map,i=new Map;for(const s of t)n.set(s.source,[...n.get(s.source)??[],s.target]),i.set(s.target,[...i.get(s.target)??[],s.source]);const o=(s,c)=>{const l=new Set([s]),u=[s];for(;u.length;)for(const p of c.get(u.pop())??[])l.has(p)||(l.add(p),u.push(p));return l},r=new Map(e.shapes.map(s=>[s.id,s])),a=[];for(const[s,c]of i){const l=r.get(s);if(!l)continue;const u=o(s,n),p=[...new Set(c)].filter(f=>!u.has(f)&&r.has(f));if(p.length<2)continue;const d=p.map(f=>o(f,i));if([...d[0]].some(f=>d.every(m=>m.has(f)))){for(const f of p)if(!(l.x+l.width/2>=r.get(f).x))for(const m of t)m.source===f&&m.target===s&&a.push({kind:"merge-before-predecessor",merge:s,edge:m.id})}}return a}function ht(e,t={}){const n=[],i=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const v of Ot(h,i))n.push({kind:"edge-crosses-shape",edge:h.id,shape:v.id});const o=e.shapes.filter(h=>h.container&&OC.has(h.type));if(o.length){const h=(v,b)=>{const E=e.shapes.find(M=>M.id===b);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const b of Ot(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>h(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}for(const h of e.edges){if(h.waypoints.length<2)continue;const v=[[h.source,h.waypoints[0]],[h.target,h.waypoints[h.waypoints.length-1]]];for(const[b,E]of v){if(!b)continue;const M=e.shapes.find(N=>N.id===b);if(!M||M.container)continue;const B=Math.max(M.x-E.x,E.x-(M.x+M.width),0),P=Math.max(M.y-E.y,E.y-(M.y+M.height),0),k=Math.hypot(B,P);k>FC&&n.push({kind:"edge-endpoint-detached",edge:h.id,shape:b,distance:Math.round(k)})}}for(const h of vd(e.shapes))n.push({kind:"pool-overlap",...h});const r=i.filter(h=>!h.attached);for(let h=0;h<r.length;h++)for(let v=h+1;v<r.length;v++){const b=r[h],E=r[v];if(!md(b,E,DC))continue;const M=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:M,identical:GC(b,E)})}const a=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<a.length;h++)for(let v=h+1;v<a.length;v++){const b=a[h],E=a[v],M=Math.min(b.x+b.width,E.x+E.width)-Math.max(b.x,E.x),B=Math.min(b.y+b.height,E.y+E.height)-Math.max(b.y,E.y);if(M<=Jc||B<=Jc)continue;const P=b.id<E.id?[b.id,E.id]:[E.id,b.id],k=new Set(E.members);if(b.members.some(G=>k.has(G))){const G=sy(e,a,{x:Math.max(b.x,E.x),y:Math.max(b.y,E.y),right:Math.min(b.x+b.width,E.x+E.width),bottom:Math.min(b.y+b.height,E.y+E.height)});G.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:G});continue}const N=b.x<=E.x&&b.y<=E.y&&b.x+b.width>=E.x+E.width&&b.y+b.height>=E.y+E.height?b.id:E.x<=b.x&&E.y<=b.y&&E.x+E.width>=b.x+b.width&&E.y+E.height>=b.y+b.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...N?{container:N}:{}})}const s=new Set(a.flatMap(h=>[...h.members])),c=h=>e.shapes.filter(v=>!v.container&&!Zc.has(v.type)&&v.x>=h.x&&v.y>=h.y&&v.x+v.width<=h.x+h.width&&v.y+v.height<=h.y+h.height);for(const h of a){const v=c(h);if(!v.length)continue;const b=new Set(h.members),E=v.filter(M=>!b.has(M.id));E.some(M=>s.has(M.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:E.map(M=>M.id).sort()}))}for(const h of a){const v=new Set(c(h).map(k=>k.id)),b=new Set(h.members),E=new Set([...v].filter(k=>!b.has(k)&&s.has(k)));if(!E.size)continue;let M=!1,B=!1,P=!1;for(const k of e.edges){if(k.type!=="bpmn:SequenceFlow"||!k.source||!k.target)continue;const N=E.has(k.source),G=E.has(k.target);!N&&G&&!v.has(k.source)?M=!0:N&&!G&&!v.has(k.target)?B=!0:N&&G&&(P=!0)}M&&B&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...E].sort()})}const l=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<l.length;h++)for(let v=h+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[h],l[v],l[b]],M={x:Math.max(...E.map(k=>k.x)),y:Math.max(...E.map(k=>k.y)),right:Math.min(...E.map(k=>k.x+k.width)),bottom:Math.min(...E.map(k=>k.y+k.height))};if(M.right-M.x<=Jc||M.bottom-M.y<=Jc)continue;const B=sy(e,[],M);if(!B.length)continue;const P=E.map(k=>k.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:B})}for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Zc.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[E,M,B,P,k]of b){const N=B==="h"?v.x:v.y,G=B==="h"?v.x+v.width:v.y+v.height;if(!(N<k&&P<G))continue;const q=B==="h"?v.y:v.x,Y=B==="h"?v.y+v.height:v.x+v.width;if(!(q<M&&M<Y))continue;const re=Math.min(M-q,Y-M);re<IC||n.push({kind:"group-cuts-shape",group:h.id,shape:v.id,side:E,depth:re})}}const u=t.includeObservationOnly?e.shapes.filter(h=>h.type==="bpmn:Group"&&h.width>0&&h.height>0):[];if(u.length){const h=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const b=un(v);if(b.length)for(const E of u){const M=E.x+E.width,B=E.y+E.height,P=v.endpoints.some(N=>{const G=h.get(N);return!!G&&E.x<G.x&&G.x<M&&E.y<G.y&&G.y<B});let k=null;for(const N of b){const[G,q,Y]=N.axis==="v"?[E.y,B,[["left",E.x],["right",M]]]:[E.x,M,[["top",E.y],["bottom",B]]],re=Math.min(N.hi,q)-Math.max(N.lo,G);if(re<dd)continue;const K=N.axis==="v"?E.x<N.at&&N.at<M:E.y<N.at&&N.at<B;if(!(K&&P))for(const[Ce,Ae]of Y){const Te=Math.abs(N.at-Ae);Te<=ba&&(!k||Te<k.distance)&&(k={side:Ce,inside:K,distance:Te,length:re})}}k&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:k.side,inside:k.inside,distance:Math.round(k.distance),length:Math.round(k.length)})}}}const p=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const b=h.x<v.x+v.width&&v.x<h.x+h.width,E=h.y<v.y+v.height&&v.y<h.y+h.height,M=[["top",h.y,v.y,b],["bottom",h.y+h.height,v.y+v.height,b],["left",h.x,v.x,E],["right",h.x+h.width,v.x+v.width,E]];for(const[B,P,k,N]of M)N&&Math.abs(P-k)<=Km&&n.push({kind:"group-on-container-boundary",group:h.id,container:v.id,side:B})}const d=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<d.length;h++)for(let v=h+1;v<d.length;v++){const b=d[h],E=d[v],M=b.x<E.x+E.width&&E.x<b.x+b.width,B=b.y<E.y+E.height&&E.y<b.y+b.height,P=[["x",b.x+b.width,E.x,B],["x",E.x+E.width,b.x,B],["y",b.y+b.height,E.y,M],["y",E.y+E.height,b.y,M]];for(const[k,N,G,q]of P)if(q&&Math.abs(N-G)<=Km){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:k});break}}for(let h=0;h<e.edges.length;h++)for(let v=h+1;v<e.edges.length;v++){const b=e.edges[h],E=e.edges[v],M=$r(b,E);if(!M)continue;const B=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:M.kind==="opposite"?"edge-overlap-opposite":M.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:B,axis:M.axis,length:Math.round(M.length)})}for(const h of e.edges){if(!h.label)continue;const v=el(h,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:h.id,other:v.other,axis:v.axis})}for(const h of e.edges){if(!h.label)continue;const v=ty(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}if(t.includeObservationOnly){for(const h of e.edges)if(!(!h.label||h.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:b}of vs(h.label,e))n.push({kind:"label-over-shape",edge:h.id,shape:v,depth:Math.round(b)})}t.includeObservationOnly&&n.push(...YC(e));const f=new Set(i.map(h=>h.id)),m=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...i,...m.filter(v=>!f.has(v.id))]){if(!h.label)continue;const v=uy(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}const g=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of m)for(const{owner:v,rect:b}of Ko(e))v===h.id||g.has(v)||md(h.label,b,wa)&&n.push({kind:"pool-name-over-label",pool:h.id,label:v});const y=Ko(e);for(const h of i)if(h.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of y)v!==h.id&&md(h,b,wa)&&n.push({kind:"annotation-over-label",annotation:h.id,label:v});const _=new Map(e.shapes.map(h=>[h.id,h]));for(const h of i){const v=h.parent??UC(h,e,_);if(!v)continue;const b=_.get(v);!b||!b.container||HC(b,h,jC)||h.type==="bpmn:TextAnnotation"&&!qC(h,b,e)||n.push({kind:"shape-outside-container",shape:h.id,container:b.id})}return n.sort((h,v)=>lt(h).localeCompare(lt(v)))}const Ut=e=>typeof e=="object"&&e!==null?e:void 0,on=e=>typeof e=="number"?e:0,_o=e=>{const t=Ut(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function KC(e){const t=Ut(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=_o(r);a&&n.push(a)}}return n}function XC(e){const t=Ut(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:_o(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:_o(t.targetRef);return n&&i?{source:n,target:i}:{}}function ZC(e,t){const n=Ut(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=_o(n);return o?t.get(o):void 0}if(Xc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return _o(n)}function fy(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ut(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ut(e))==null?void 0:s.rootElements)??[]){const d=Ut(p);if((d==null?void 0:d.$type)==="bpmn:Collaboration")for(const f of d.participants??[]){const m=Ut(f),g=_o(m),y=_o(m==null?void 0:m.processRef);g&&y?o.set(y,g):g&&r.add(g)}}for(const p of i){const d=Ut((c=Ut(p))==null?void 0:c.plane),f=(d==null?void 0:d.planeElement)??[];for(const m of f){const g=Ut(m);if(!g)continue;const y=Ut(g.bpmnElement),_=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!_)continue;const h=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",v=Ut(g.bounds);if(v){const E=g.isExpanded===!1&&h!=="bpmn:Participant",M=Ut((l=Ut(g.label))==null?void 0:l.bounds),B={id:_,type:h,x:on(v.x),y:on(v.y),width:on(v.width),height:on(v.height),container:Xc.has(h)&&!E,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:ZC(y,o)}:{},...M?{label:{x:on(M.x),y:on(M.y),width:on(M.width),height:on(M.height)}}:{},...h==="bpmn:Group"?ly(cy(y)):{}},P=g.isHorizontal!==!1,k=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(_)&&P&&k&&(B.label=fd(B,k)),t.push(B);continue}const b=g.waypoint;if(Array.isArray(b)){const E=Ut((u=Ut(g.label))==null?void 0:u.bounds);n.push({id:_,type:h,waypoints:b.map(M=>{var B,P;return{x:on((B=Ut(M))==null?void 0:B.x),y:on((P=Ut(M))==null?void 0:P.y)}}),endpoints:KC(y),...XC(y),...E?{label:{x:on(E.x),y:on(E.y),width:on(E.width),height:on(E.height)}}:{}})}}}return{shapes:t,edges:n}}function hy(e){return ht(fy(e),{includeObservationOnly:!0})}async function JC(e){const{definitions:t,warnings:n}=await xa(e);return{findings:hy(t),warnings:n}}function We(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 g=Ut(r.label),y=_o(r.source),_=_o(r.target);n.push({id:r.id,type:a,waypoints:s.map(h=>({x:on(h.x),y:on(h.y)})),endpoints:[y,_].filter(h=>!!h),...y&&_?{source:y,target:_}:{},...g&&typeof g.x=="number"?{label:{x:g.x,y:on(g.y),width:on(g.width),height:on(g.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ut(r.businessObject),l=Ut(r.label);let u=Ut(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ut(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",d=u&&Xc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,f={id:r.id,type:a,x:r.x,y:r.y,width:on(r.width),height:on(r.height),container:Xc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...d!==void 0?{parent:d}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:on(l.y),width:on(l.width),height:on(l.height)}}:{},...a==="bpmn:Group"?ly(cy(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=Ut(r.di))==null?void 0:i.isHorizontal)!==!1&&(f.label=fd(f,m)),t.push(f)}return{shapes:t,edges:n}}const QC={"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 eA(e,t){const n=QC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function gy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function my(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 eA(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&gy(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?gy(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 $p(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Wo(i.businessObject).map(o=>o.locale)}}}const Fr=20,tA=4,qe=(e,t)=>Math.abs(e-t)<.5,nA=15;function xd(e,t,n){let i=1/0;for(const o of t)if(!n.includes(o.id))for(let r=1;r<e.length;r++)i=Math.min(i,wo(e[r-1],e[r],o));return i}function iA(e,t,n=nA){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=qe(i.x,o.x)&&!qe(i.y,o.y),a=qe(i.y,o.y)&&!qe(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=_=>{const h=_?t.find(v=>v.id===_):void 0;return h?r?[h.x+10,h.x+h.width-10]:[h.y+10,h.y+h.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),m=Math.min(u,d);if(!(m>=f))return[];const g=r?i.x:i.y,y=[];for(let _=5;_<=400;_+=5)for(const h of[-1,1]){const v=g+h*_;if(v<f||v>m)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Ot({...e,waypoints:b},t).length||xd(b,t,s)<n||y.push(b)}return y}function bd(e,t,n,i){const o=e.edges.filter(d=>d.id!==t.id),r={...t,waypoints:n},a={...t,waypoints:[...i]};if(Vn(r,o)>Vn(a,o)||ei(r,o)>ei(a,o))return!1;const s=`L|${t.id}|${t.id}`,c=d=>ht({...e,edges:e.edges.map(f=>f.id===t.id?{...f,waypoints:d}:f)}).filter(f=>lt(f)!==s),l=c(n),u=`"${t.id}"`;if(l.some(d=>JSON.stringify(d).includes(u)))return!1;const p=new Set(c([...i]).map(lt));return l.every(d=>p.has(lt(d)))}function yy(e,t,n,i){for(const o of iA(t,n))if(bd(e,t,o,i))return o;return null}const oA=120;function vy(e,t,n,i,o){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return[];const r=t.find(c=>c.id===e.endpoints[0]),a=t.find(c=>c.id===e.endpoints[1]);if(!r||!a)return[];if(a.x<r.x+r.width)return[];if(Math.min(r.y+r.height,a.y+a.height)-Math.max(r.y,a.y)<10)return[];const s=[];for(const[c,l]of[[0,0],[0,-25],[0,25],[-25,0],[25,0]])for(let u=Fr;u<=oA;u+=5)for(const p of["top","bottom"]){const d=p==="top"?r.y:r.y+r.height,f=p==="top"?a.y:a.y+a.height,m=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,g=r.x+r.width/2+c,y=a.x+a.width/2+l,_=[{x:g,y:d},{x:g,y:m},{x:y,y:m},{x:y,y:f}];if(!rl(_,i)||Ot({...e,waypoints:_},t).length||Ot({...e,endpoints:[],waypoints:_},[r,a]).length||xd(_,t,e.endpoints)<Fr)continue;const h=Td(_,n);(o===void 0?h<Ad:h>=Ad||h<o)||s.push(_)}return s}function xy(e,t,n,i,o){const r=e.shapes.filter(c=>c.type==="bpmn:Participant"||c.type==="bpmn:Lane"),a=by(e,t,i,vy(t,n,r,o));if(a)return a;const s=Math.max(Td(i,r),Fr);return by(e,t,i,vy(t,n,r,o,s))}function by(e,t,n,i){const o=new Map;for(const c of i){const l=c[1].y<c[0].y?"top":"bottom";if(!o.has(l)&&(bd(e,t,c,n)&&o.set(l,c),o.size===2))break}const r=e.edges.filter(c=>c.id!==t.id);let a=null,s=1/0;for(const c of["top","bottom"]){const l=o.get(c);if(!l)continue;const u=Vn({...t,waypoints:l},r);u<s&&(a=l,s=u)}return a}function tl(e,t,n,i=Fr){if(qe(e.y,t.y)&&!qe(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(qe(e.x,t.x)&&!qe(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 wy(e,t,n,i=Fr){if(n.length<2)return null;if(qe(e.y,t.y)&&!qe(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(f=>f.x))-i,s=Math.max(...n.map(f=>f.x+f.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(f=>f.y))-i,p=Math.max(...n.map(f=>f.y+f.height))+i,d=f=>[{x:c,y:e.y},{x:c,y:f},{x:l,y:f},{x:l,y:e.y}];return[d(u),d(p)]}if(qe(e.x,t.x)&&!qe(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(f=>f.y))-i,s=Math.max(...n.map(f=>f.y+f.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(f=>f.x))-i,p=Math.max(...n.map(f=>f.x+f.width))+i,d=f=>[{x:e.x,y:c},{x:f,y:c},{x:f,y:l},{x:e.x,y:l}];return[d(u),d(p)]}return null}function _y(e,t,n=Fr){if(e.length!==4)return null;const[i,o,r,a]=e;if(qe(i.y,o.y)&&qe(o.x,r.x)&&qe(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(qe(i.x,o.x)&&qe(o.y,r.y)&&qe(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 nl(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const 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 il=30,rA=[0,-25,25,-40,40];function aA(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(d=>d.id===e.endpoints[0]),i=t.find(d=>d.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+il:s-il,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return rA.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Ot({...e,endpoints:[],waypoints:d},[n]).length===0)}const wd=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],jr=(e,t,n)=>Ot({...e,waypoints:t},n).length,sA=25;function Ey(e,t,n){const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return{x:t.x+a*i,y:t.y+a*o}}function cA(e,t,n,i){const r=(d,f,m)=>(f.x-d.x)*(m.y-d.y)-(f.y-d.y)*(m.x-d.x),a=r(n,i,e),s=r(n,i,t);if(Math.abs(a)<1e-6&&Math.abs(s)<1e-6){const d=Ey(i,e,t),f=Ey(d,n,i);return Math.hypot(d.x-f.x,d.y-f.y)<1e-6?d:null}const c=r(e,t,n),l=r(e,t,i);if(a*s>1e-6||c*l>1e-6)return null;const u=(e.x-t.x)*(n.y-i.y)-(e.y-t.y)*(n.x-i.x);if(Math.abs(u)<1e-6)return null;const p=((e.x-n.x)*(n.y-i.y)-(e.y-n.y)*(n.x-i.x))/u;return{x:e.x+p*(t.x-e.x),y:e.y+p*(t.y-e.y)}}function lA(e,t,n){let i=0;for(const o of n){if(o.id===t.id||o.waypoints.length<2||o.target!==void 0&&o.target===t.target)continue;const r=o.waypoints[o.waypoints.length-1],a=o.waypoints[o.waypoints.length-2];for(let s=0;s+1<e.length;s++){const c=cA(e[s],e[s+1],a,r);if(c&&Math.hypot(c.x-r.x,c.y-r.y)<=sA){i++;break}}}return i}function ol(e,t,n,i){let o=[...e.waypoints],r=jr(e,o,t);if(r===0)return null;let a=!1;for(const p of nl(e,t))if(jr(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(un),c=p=>un({...e,waypoints:p}).some(d=>Qc(d,s).length>0),l=aA(e,t).filter(p=>jr(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(d=>d.x>=n.x&&d.x<=n.x+n.width&&d.y>=n.y&&d.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(f=>f.id===e.endpoints[0]),d=t.find(f=>f.id===e.endpoints[1]);if(p&&d&&qe(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(qe(f[0].y,f[1].y)&&!qe(f[0].x,f[1].x)){const m=t.filter(h=>!e.endpoints.includes(h.id)&&Ot({...e,waypoints:f},[h]).length>0),g=m.length>=2?wy(f[0],f[1],m):null,_=(g?g.map(h=>[f[0],...h,f[1]]):m.length===1?(tl(f[0],f[1],m[0])??[]).map(h=>[f[0],...h,f[1]]):m.length===0?[f]:[]).filter(h=>jr(e,h,t)===0&&h.length<=o.length).sort((h,v)=>Number(u(v))-Number(u(h)));if(_.length)return _.find(h=>!c(h))??_[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],m=t.filter(_=>!e.endpoints.includes(_.id)&&Ot({...e,waypoints:[d,f]},[_]).length>0);if(m.length<2)continue;const g=wy(d,f,m);if(!g)continue;const y=g.map(_=>wd(o,p,_)).filter(_=>jr(e,_,t)===0).sort((_,h)=>Number(u(h))-Number(u(_)));if(y.length)return y.find(_=>!c(_))??y[0]}for(let p=0;p<tA&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const m=o[f],g=o[f+1];for(const y of t){if(e.endpoints.includes(y.id)||Ot({...e,waypoints:[m,g]},[y]).length===0)continue;const _=tl(m,g,y),v=[...(_y(o,y)??[]).map((E,M)=>({pts:E,k:M,cross:jr(e,E,t),tip:lA(E,e,i??[])})).sort((E,M)=>E.cross-M.cross||E.tip-M.tip||E.k-M.k).map(E=>E.pts),..._?_.map(E=>wd(o,f,E)):[]];if(!v.length)continue;const b=[...v].sort((E,M)=>Number(u(M))-Number(u(E)));for(const E of b){const M=jr(e,E,t);if(M<r){o=E,r=M,d=!0,a=!0;break}}if(d)break}}if(!d)break}return a&&r===0?o:null}function _d(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=Ln(r),s=new Set,c=ht(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(d=>d.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const d=i.get(u);if(!d)continue;const f=d.parent,m=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,g=Ot(p,a);if(!n&&g.length&&g.every(M=>M.type==="bpmn:TextAnnotation")){s.add(u);continue}let y=ol(p,a,m,r.edges);const _=yy(r,p,a,y??p.waypoints);_&&(y=_);const h=xy(r,p,a,y??p.waypoints,m);if(h&&Vn({...p,waypoints:h},r.edges.filter(M=>M.id!==u))===0&&(y=h),!y){g.some(M=>M.type==="bpmn:TextAnnotation")&&s.add(u);continue}const v=r.edges.filter(M=>M.id!==u),b=ei(p,v);ei({...p,waypoints:y},v)>b||o.updateWaypoints(d,y)}return s}function uA(e,t,n,i){var f,m;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=g=>{const y=We(r);return[...eo(y),...Ei(y)].filter(([_,h])=>_===g||h===g).length},c=(g,y)=>g.kind==="label-over-line"||g.kind==="label-over-shape"||g.kind==="label-on-shared-segment"?g.edge===y:g.kind==="annotation-over-label"||g.kind==="pool-name-over-label"?g.label===y:!1,l=g=>new Set(ht(We(r)).filter(y=>!c(y,g)).map(lt)),u=(g,y)=>Math.abs(g-y)<=1,p=(g,y,_,h,v)=>{const b=Ln(We(r));for(let E=0;E+3<g.length;E++){const[M,B,P,k]=[g[E],g[E+1],g[E+2],g[E+3]],N=u(M.y,k.y)&&u(M.x,B.x)&&u(P.x,k.x)&&u(B.y,P.y)&&Math.abs(B.y-M.y)>=5,G=u(M.x,k.x)&&u(M.y,B.y)&&u(P.y,k.y)&&u(B.x,P.x)&&Math.abs(B.x-M.x)>=5;if(!N&&!G)continue;const q={waypoints:[M,k],endpoints:_};if(Ot(q,[y]).length&&!Ot(q,b).length)return E}return-1},d=(g,y)=>[...g.slice(0,y+1),...g.slice(y+3)].filter((_,h,v)=>h===0||h===v.length-1||!(u(v[h-1].x,_.x)&&u(v[h+1].x,_.x)||u(v[h-1].y,_.y)&&u(v[h+1].y,_.y)));for(const g of t){const y=r.get(g.id);if(!y)continue;const _=new Set([...y.incoming??[],...y.outgoing??[]].map(b=>b.id)),h={...g,type:y.type,container:!1,attached:!1},v=r.getAll().filter(b=>{var E;return(b.type==="bpmn:SequenceFlow"||b.type==="bpmn:MessageFlow")&&n.has(b.id)&&!i.has(b.id)&&!_.has(b.id)&&(((E=b.waypoints)==null?void 0:E.length)??0)>=4}).sort((b,E)=>b.id.localeCompare(E.id));for(const b of v){const E=[(f=b.source)==null?void 0:f.id,(m=b.target)==null?void 0:m.id].filter(M=>!!M);for(;;){const M=b.waypoints.map(K=>({x:K.x,y:K.y})),B=p(M,h,E,b.id,b.type);if(B<0)break;const P=b.label,k=P&&{x:P.x,y:P.y},N=l(b.id),G=s(b.id);if(a.updateWaypoints(b,d(M,B)),P&&k){const K={x:k.x+P.width/2,y:k.y+P.height/2},Ce=(Te,de)=>{const z=de.x-Te.x,oe=de.y-Te.y,V=z*z+oe*oe,X=V===0?0:Math.max(0,Math.min(1,((K.x-Te.x)*z+(K.y-Te.y)*oe)/V));return Math.hypot(K.x-(Te.x+X*z),K.y-(Te.y+X*oe))};let Ae=0;for(let Te=1;Te+1<M.length;Te++)Ce(M[Te],M[Te+1])<Ce(M[Ae],M[Ae+1])&&(Ae=Te);(Ae<B||Ae>B+2)&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y})}const q=l(b.id),Y=[...q].filter(K=>!N.has(K)).length,re=[...N].filter(K=>!q.has(K)).length;if(Y<=re&&s(b.id)<=G){o.add(b.id);continue}a.updateWaypoints(b,M),P&&k&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y});break}}}return o}const pA=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 xs(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 rl=(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),Ed=(e,t)=>ys(e,[t])>0;function Sy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=Ln(r);let s=r;const c=new Set(ht(r).map(lt));for(const[l,u]of eo(r))if(!t.has(`${l}|${u}`))for(const[p,d]of[[l,u],[u,l]]){if(n.has(p))continue;const f=s.edges.find(B=>B.id===p),m=s.edges.find(B=>B.id===d);if(!f||!m)continue;const g=i.get(p);if(!g)continue;const y=xs(g),_=pA(m),h=[...nl(f,a)??[]],v=ol(f,[...a,..._],y,r.edges);v&&h.push(v);for(let B=0;B+1<f.waypoints.length;B++)for(const P of _)for(const k of tl(f.waypoints[B],f.waypoints[B+1],P)??[])h.push(wd(f.waypoints,B,k));const b=s.edges.filter(B=>B.id!==p),E=B=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:B}:P)}),M=h.find(B=>{const P={...f,waypoints:B};return Ed(P,m)||!rl(B,y)||b.some(k=>k.id!==d&&!Ed(f,k)&&Ed(P,k))?!1:ht(E(B)).every(k=>c.has(lt(k)))});if(M){o.updateWaypoints(g,M),s=E(M);break}}}const dA=["top","bottom","left","right"],Ry={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},bs=20,fA=20;function hA(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&&qe(e.y,t.y)&&o.push("top"),n&&qe(e.y,t.y+t.height)&&o.push("bottom"),i&&qe(e.x,t.x)&&o.push("left"),i&&qe(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const gA=(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 My(e,t,n,i){const o=Ry[t],r=Ry[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],m=r[p];if(qe(e[d],n[d]))return f===-m&&f*(n[p]-e[p])>=bs?[e,n]:null;let g;if(f===-m){const _=e[p]+f*bs,h=n[p]-f*bs;if(f*(h-_)<0)return null;g=Math.round((e[p]+n[p])/2)}else g=f>0?Math.max(e[p],n[p])+il:Math.min(e[p],n[p])-il;const y=(_,h)=>a?{x:h,y:_}:{x:_,y:h};return[e,y(g,e[d]),y(g,n[d]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=bs&&u>=bs?[e,c,n]:null}function mA(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?hA(a,r):null;if(!s)return[];const c=[];for(const l of dA){const u=gA(t,l),p=o?My(u,l,a,s):My(a,s,u,l);p&&c.push(p)}return c}const Cy=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 yA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ht(r).map(lt));let c=r;for(const[l,u]of Ei(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(k=>k.id===l),d=c.edges.find(k=>k.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Ei({edges:[p,d]}).length)continue;const f=p.endpoints.find(k=>d.endpoints.includes(k)),m=f?a.get(f):void 0;if(!m||m.container)continue;const g=i.get(l),y=i.get(u);if(!g||!y)continue;const _=k=>n.has(k.id)?[k.waypoints]:[k.waypoints,...mA(k,m,a)],h=k=>k.length-2,v=_(p).flatMap(k=>_(d).map(N=>({pa:k,pb:N}))).filter(({pa:k,pb:N})=>k!==p.waypoints||N!==d.waypoints).map(k=>({...k,cost:Cy(k.pa)+Cy(k.pb)+fA*(h(k.pa)+h(k.pb))})).sort((k,N)=>k.cost-N.cost),b=xs(g),E=xs(y),M=Ei(c).length,B=new Set(eo(c).map(([k,N])=>`${k}|${N}`)),P=v.find(({pa:k,pb:N})=>{const G={...p,waypoints:k},q={...d,waypoints:N};if(Ei({edges:[G,q]}).length||$r(G,q)||!rl(k,b)||!rl(N,E))return!1;const Y={...c,edges:c.edges.map(re=>re.id===l?G:re.id===u?q:re)};return Ei(Y).length>=M||eo(Y).some(([re,K])=>!B.has(`${re}|${K}`))?!1:ht(Y).every(re=>s.has(lt(re)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(g,P.pa),P.pb!==d.waypoints&&o.updateWaypoints(y,P.pb),c={...c,edges:c.edges.map(k=>k.id===l?{...p,waypoints:P.pa}:k.id===u?{...d,waypoints:P.pb}:k)})}}const vA=40,xA=20;function bA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=We(i),p=Ei(u);return{keys:new Set(ht(u).map(lt)),crossings:eo(u).length,shared:p.length,mine:p.filter(([d,f])=>d===l||f===l).length}},a=(l,u)=>{const p=We(i),d=p.edges.find(f=>f.id===l);return d?new Set(Ot({...d,waypoints:u},Ln(p)).map(f=>f.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,d=s(u)?u:s(p)?p:void 0;if(!d)continue;const f=d===u?p:u;if(!f||f.type==="bpmn:Participant")continue;const m=f.x+f.width/2;if(m>=d.x+10&&m<=d.x+d.width-10)continue;const g=m>d.x+d.width,y=d.y>f.y,_=y?f.y+f.height:f.y,h=y?d.y:d.y+d.height,v=Math.round((_+h)/2),b=N=>d===u?[...N].reverse():N,E=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),M=r(l.id),B=a(l.id,E)??new Set,P=g?d.x+d.width:d.x,k=d.x+d.width/2;for(let N=Math.min(vA,d.width/4);g?P-N>k:P+N<k;N+=xA){const G=Math.round(g?P-N:P+N),q=b([{x:m,y:_},{x:m,y:v},{x:G,y:v},{x:G,y:h}]),Y=a(l.id,q);if(!Y||[...Y].some(K=>!B.has(K)))continue;o.updateWaypoints(l,q);const re=r(l.id);if(re.crossings<=M.crossings&&re.shared<=M.shared&&re.mine<=M.mine&&[...re.keys].every(K=>M.keys.has(K)))break;o.updateWaypoints(l,E)}}}const wA=10;function Ay(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 Ty(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(re=>re.type==="bpmn:Participant"&&re.container),i=t.shapes.find(re=>re.id===e.endpoints[0]),o=t.shapes.find(re=>re.id===e.endpoints[1]);if(!i||!o)return null;const r=Ay(i,n),a=Ay(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(re=>re.id!==r.id&&re.id!==a.id&&re.y>=c.y+c.height&&re.y+re.height<=l.y).sort((re,K)=>re.y-K.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,m=(d.y+d.height+l.y)/2,g=s?f:m,y=s?m:f,_=e.waypoints[0],h=e.waypoints[e.waypoints.length-1],v=Ln(t),b=t.edges.filter(re=>re.id!==e.id),E=Vn(e,b),M=Ot(e,v).length;if(E===0&&M===0||M===0&&e.waypoints.length===2)return null;const B=Math.min(...u.map(re=>re.x)),P=Math.max(...u.map(re=>re.x+re.width)),k=(_.x+h.x)/2,N=re=>re.filter((K,Ce)=>Ce===0||!(qe(K.x,re[Ce-1].x)&&qe(K.y,re[Ce-1].y)));let G,q;for(let re=B;re<=P;re+=wA){const K=N([_,{x:_.x,y:g},{x:re,y:g},{x:re,y},{x:h.x,y},h]),Ce={...e,waypoints:K};if(Ot(Ce,v).length>0)continue;const Ae=Vn(Ce,b),Te=Math.abs(re-k);(!G||Ae<G.cross||Ae===G.cross&&Te<G.detour)&&(G={pts:K,cross:Ae,detour:Te}),xd(K,v,e.endpoints)>=Fr&&(!q||Ae<q.cross||Ae===q.cross&&Te<q.detour)&&(q={pts:K,cross:Ae,detour:Te})}q&&G&&q!==G&&bd(t,e,q.pts,G.pts)&&(G=q);const Y=G&&(M>0?G.cross<=E:G.cross<E)?G.pts:null;if(M>0){const re=yy(t,e,v,Y??e.waypoints);if(re)return re}return Y}const _A=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function EA(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=We(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Ln(a);for(const p of t.edges){if(!_A.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const d=i.get(p.id);if(!(d!=null&&d.waypoints)||((l=d.source)==null?void 0:l.id)!==p.source||((u=d.target)==null?void 0:u.id)!==p.target)continue;const f=r.get(p.source),m=r.get(p.target),g=s.get(p.source),y=s.get(p.target);if(!f||!m||!g||!y||!qe(f.width,g.width)||!qe(f.height,g.height)||!qe(m.width,y.width)||!qe(m.height,y.height))continue;const _=g.x-f.x,h=g.y-f.y;if(qe(_,0)&&qe(h,0)||!qe(y.x-m.x,_)||!qe(y.y-m.y,h))continue;const v=p.waypoints.map(M=>({x:M.x+_,y:M.y+h})),b=d.waypoints.map(M=>({x:M.x,y:M.y}));b.length===v.length&&b.every((M,B)=>qe(M.x,v[B].x)&&qe(M.y,v[B].y))||b.length===2&&(qe(b[0].x,b[1].x)||qe(b[0].y,b[1].y))&&Ot({...p,waypoints:b},c).length===0||Ot({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function Py(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=We(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Ty(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Sd=20,ky=10,zi=10,Rd=40,SA=6,RA=40,Oy=50;function MA(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=SA})}function Md(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(qe(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function CA(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function Cd(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=ky;o<=n-t;o+=ky)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function AA(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,d=t.x+t.width/2,f=(K,Ce)=>Ce>K.x+zi&&Ce<K.x+K.width-zi,m=(K,Ce)=>K.width<=2*Rd?K.x+K.width/2:Math.min(Math.max(Ce,K.x+Rd),K.x+K.width-Rd),g=Math.max(e.x,t.x)+zi,y=Math.min(e.x+e.width,t.x+t.width)-zi;if(g<=y){const K=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((g+y)/2);r.push([{x:K,y:l},{x:K,y:u}])}const _=s?m(t,p):d,h=a?m(e,d):p;if(!a&&!f(e,_)){const K=_<e.x?e.x:e.x+e.width;for(const Ce of Cd(e.y+e.height/2,e.y+zi,e.y+e.height-zi))r.push([{x:K,y:Ce},{x:_,y:Ce},{x:_,y:u}])}if(!s&&!f(t,h)){const K=h<t.x?t.x:t.x+t.width;for(const Ce of Cd(t.y+t.height/2,t.y+zi,t.y+t.height-zi))r.push([{x:h,y:l},{x:h,y:Ce},{x:K,y:Ce}])}const v=(K,Ce)=>{if(Math.abs(Ce-K)<2*zi)return[];const Ae=Math.min(K,Ce)+zi,Te=Math.max(K,Ce)-zi;return Cd(Math.round((K+Ce)/2),Ae,Te)};if(!a&&n)for(const K of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:K},{x:_,y:K},{x:_,y:u}]);if(!s&&i)for(const K of v(u,c?i.y:i.y+i.height))r.push([{x:h,y:l},{x:h,y:K},{x:d,y:K},{x:d,y:u}]);const b=Math.min(h,_),E=Math.max(h,_),M=[];for(const[K,Ce]of o.filter(Ae=>Ae.x<E&&Ae.x+Ae.width>b).map(Ae=>[Ae.y,Ae.y+Ae.height]).sort((Ae,Te)=>Ae[0]-Te[0])){const Ae=M[M.length-1];Ae&&K<=Ae[1]?Ae[1]=Math.max(Ae[1],Ce):M.push([K,Ce])}const B=[];for(let K=1;K<M.length;K++)M[K][0]-M[K-1][1]>=RA&&B.push(Math.round((M[K-1][1]+M[K][0])/2));M.length&&B.push(M[0][0]-Oy,M[M.length-1][1]+Oy);const P=(K,Ce)=>Ce<K.y?K.y:Ce>K.y+K.height?K.y+K.height:void 0,k=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(K=>!!K)),N=e.y+e.height/2,G=t.y+t.height/2,q=G>N?1:-1,Y=(K,Ce,Ae)=>o.some(Te=>!k.has(Te.id)&&Te.x<K&&K<Te.x+Te.width&&Te.y<Math.max(Ce,Ae)-1&&Te.y+Te.height>Math.min(Ce,Ae)+1),re=[];for(const K of B){const Ce=P(e,K),Ae=P(t,K);Ce===void 0||Ae===void 0||(K-N)*q<0&&Y(h,Ce,K)||(K-G)*q>0&&Y(_,Ae,K)||re.push({pts:[{x:h,y:Ce},{x:h,y:K},{x:_,y:K},{x:_,y:Ae}],len:Math.abs(K-Ce)+(E-b)+Math.abs(Ae-K)})}return{inPools:r,outside:re.sort((K,Ce)=>K.len-Ce.len).map(K=>K.pts)}}function TA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(f=>[f.id,f.waypoints])),a=n.shapes.filter(f=>f.type==="bpmn:Participant"),s=f=>{let m=f;for(;m&&m.type!=="bpmn:Participant";)m=m.parent;return m==null?void 0:m.id},c=()=>{const f=We(i);return{keys:new Set(ht(f).map(lt)),crossings:eo(f).length,shared:Ei(f).length}},l=(f,m)=>f.length===m.length&&f.every((g,y)=>qe(g.x,m[y].x)&&qe(g.y,m[y].y)),u=f=>{const m=f.source,g=f.target;if(!m||!g)return"skip";const y=We(i),_=new Map(y.shapes.map(z=>[z.id,z])),h=s(m),v=s(g),b=new Set([h,v].filter(z=>!!z)),E=y.shapes.filter(z=>z.type==="bpmn:Participant"),M=(f.waypoints??[]).map(z=>({x:z.x,y:z.y})),B=Md(M,b,E);if(B<Sd)return"skip";if(t.has(f.id)){const z=r.get(f.id);if(z&&l(z,M)||B-(z?Md(z,b,a):0)<Sd)return"skip"}const P=_.get(m.id),k=_.get(g.id),N=y.edges.find(z=>z.id===f.id);if(!P||!k||!N)return"skip";const G=Ln(y),q=new Set(Ot(N,G).map(z=>z.id)),Y=Ko(y).filter(z=>z.owner!==f.id&&z.owner!==P.id&&z.owner!==k.id),re=[...y.shapes.filter(z=>!z.container&&z.id!==P.id&&z.id!==k.id),...Y.map(z=>z.rect)],K=z=>un({...N,waypoints:z}).some(oe=>MA(oe,re)),Ce=AA(P,k,h?_.get(h):void 0,v?_.get(v):void 0,E),Ae=z=>z.map((oe,V)=>({pts:oe,i:V,key:oe.length*2+(K(oe)?1:0)})).sort((oe,V)=>oe.key-V.key||oe.i-V.i).map(oe=>oe.pts),Te=[...Ae(Ce.inPools),...Ae(Ce.outside)],de=c();for(const z of Te){if(Md(z,b,E)>=Sd)continue;const oe={...N,waypoints:z};if(Ot(oe,G).some(ue=>!q.has(ue.id))||un(oe).some(ue=>CA(ue,y.shapes)||Y.some(be=>Hi(be.rect,ue))))continue;o.updateWaypoints(f,z);const X=c();if(X.crossings<=de.crossings&&X.shared<=de.shared&&[...X.keys].every(ue=>de.keys.has(ue)))return"fixed";o.updateWaypoints(f,M)}return"stuck"},p=i.getAll().filter(f=>f.type==="bpmn:MessageFlow"),d=[];for(const f of p)u(f)==="stuck"&&d.push(f);for(const f of d)u(f)}const Gi=[25,-25,40,-40],Ea=35;function PA(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)-Ea:Math.max(e.y+e.height,t.y+t.height)+Ea,p=OA(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,kA]];for(const[f,m]of d)for(const g of[0,...Gi])if(!(Math.abs(g)>=e.width/2-5))for(const y of[0,...Gi]){if(Math.abs(y)>=t.width/2-5)continue;const _=i+g,h=o+y,v=[{x:_,y:c},{x:_,y:f},{x:h,y:f},{x:h,y:l}];m&&Ot({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:m+Math.abs(y)+Math.abs(g)})}}return r}const kA=45,al=20;function OA(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(y=>y.container&&(y.type==="bpmn:Lane"||y.type==="bpmn:Participant")&&r>=y.x&&r<=y.x+y.width&&e.y>=y.y&&e.y+e.height<=y.y+y.height).sort((y,_)=>y.width*y.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(y=>!y.container&&y.id!==e.id&&y.id!==t.id),d=p.filter(y=>y.x<c&&y.x+y.width>s&&(n?y.y<l&&y.y+y.height>i:y.y+y.height>l&&y.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(y=>y.label?[y.label]:[])].filter(y=>y.x<c&&y.x+y.width>s);if(n){let y=Math.min(...d.map(h=>h.y));for(let h=!0;h;){h=!1;for(const v of f)v.y<y&&v.y<l&&v.y+v.height>y-al&&(y=v.y,h=!0)}const _=Math.max(u.y,...f.filter(h=>h.y+h.height<=y).map(h=>h.y+h.height));return y-_>=al?Math.round((y+_)/2):null}let m=Math.max(...d.map(y=>y.y+y.height));for(let y=!0;y;){y=!1;for(const _ of f)_.y+_.height>m&&_.y+_.height>l&&_.y<m+al&&(m=_.y+_.height,y=!0)}const g=Math.min(u.y+u.height,...f.filter(y=>y.y>=m).map(y=>y.y));return g-m>=al?Math.round((m+g)/2):null}function sl(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 PA(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-Ea:n.y+n.height+Ea,p=[];for(const h of[0,...Gi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(h)});for(const b of[0,...Gi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(h)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const h of[0,...Gi]){if(Math.abs(h)>=n.width/2-5)continue;const v=a+h;p.push({pts:[{x:v,y:m},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(h)})}const g=60,y=s?i.y+i.height:i.y,_=s?i.y+i.height+Ea:i.y-Ea;for(const h of[0,...Gi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;for(const b of[0,...Gi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:m},{x:E,y:_},{x:v,y:_},{x:v,y}],cost:g+Math.abs(h)+Math.abs(b)})}}return p}const Ad=30;function Dy(e,t){return Td(e,t)<Ad}function Td(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=qe(o.y,r.y)&&!qe(o.x,r.x),s=qe(o.x,r.x)&&!qe(o.y,r.y);if(!(!a&&!s))for(const c of t)if(a){const l=Math.min(o.x,r.x);if(Math.max(o.x,r.x)<=c.x||l>=c.x+c.width)continue;n=Math.min(n,Math.abs(o.y-c.y),Math.abs(o.y-(c.y+c.height)))}else{const l=Math.min(o.y,r.y);if(Math.max(o.y,r.y)<=c.y||l>=c.y+c.height)continue;n=Math.min(n,Math.abs(o.x-c.x),Math.abs(o.x-(c.x+c.width)))}}return n}const cl=40;function DA(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-cl,a=o.x+o.width+cl,s=o.y-cl,c=o.y+o.height+cl;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],d={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},f={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(d.x<a&&f.x>r&&d.y<c&&f.y>s){i++;break}}}return i}function Ly(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(M=>M.container),i=new Map(t.shapes.map(M=>[M.id,M])),o=Ln(t),r=t.edges.filter(M=>M.id!==e.id),a=ei(e,r),s=Vn(e,r),c=M=>DA(M,t.shapes,e.endpoints)+(Dy(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.find(k=>k.type==="bpmn:Lane"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,m=M=>{if(!f||!d)return!1;for(let B=1;B<M.length-2;B++){const P=M[B],k=M[B+1];if(qe(P.y,k.y)&&!qe(P.x,k.x)&&P.y>d.y&&P.y<d.y+d.height)return!0}return!1},g=m(e.waypoints),_=(M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.filter(k=>k.type==="bpmn:Participant"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height).sort((k,N)=>k.width*k.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),h=M=>{if(!_)return 0;let B=0;for(let P=1;P<M.length-1;P++){const k=M[P];(k.x<_.x||k.x>_.x+_.width||k.y<_.y||k.y>_.y+_.height)&&B++}return B},v=h(e.waypoints);if(!Dy(e.waypoints,n)&&!(f&&!g)&&v===0)return null;const b=M=>M.reduce((B,P,k)=>k?B+Math.abs(P.x-M[k-1].x)+Math.abs(P.y-M[k-1].y):0,0);let E;for(const{pts:M,cost:B}of sl(e,i)){const P={...e,waypoints:M};if(Ot(P,o).length>0||$y(M,e,t))continue;const k=ei(P,r);if(k>a)continue;const N=h(M);if(N>v)continue;const G=N<v&&k===0;if(!G&&Vn(P,r)>s)continue;const q=c(M),Y=m(M);if(!G&&!(Y&&!g)&&q>=l)continue;const K=Y?0:1,Ce=b(M);(!E||N<E.out||N===E.out&&(K<E.lane||K===E.lane&&(k<E.opp||k===E.opp&&(q<E.sc||q===E.sc&&(B<E.cost||B===E.cost&&Ce<E.len)))))&&(E={pts:M,out:N,sc:q,lane:K,opp:k,cost:B,len:Ce})}return(E==null?void 0:E.pts)??null}function LA(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 IA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=We(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=Ln(s),u=s.edges.filter(y=>y.id!==a),p=Ot(c,l).length,d=ei(c,u),f=Vn(c,u),m=n.has(a)?new Set(ht(s).map(lt)):null;if(c.waypoints.length>4){const y=i.get(a),_=y?xy(s,c,l,c.waypoints,xs(y)):null;if(y&&_&&_.length<c.waypoints.length){o.updateWaypoints(y,_);continue}}const g=nl(c,s.shapes);g.length===2&&LA(c,s)&&g.reverse();for(const y of g){if(y.length>=c.waypoints.length)continue;const _={...c,waypoints:y};if(Ot(_,l).length>p||ei(_,u)>d||Vn(_,u)>f)continue;if(m){const v=new Set(ht({...s,edges:s.edges.map(M=>M.id===a?_:M)}).map(lt)),b=[...v].filter(M=>!m.has(M)).length,E=[...m].filter(M=>!v.has(M)).length;if(b>E)continue}const h=i.get(a);h&&o.updateWaypoints(h,y);break}}}function Iy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=We(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Ly(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Pd(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=qe(n[0].x,n[1].x)&&!qe(n[0].y,n[1].y),s=qe(n[n.length-1].x,n[n.length-2].x)&&!qe(n[n.length-1].y,n[n.length-2].y);for(const c of Gi){if(a&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}const By=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function BA(e,t,n){const i=e.waypoints;if(i.length<2||!By(e.type))return[];const o=i[0],r=i[1],a=qe(o.y,r.y)&&!qe(o.x,r.x),s=qe(o.x,r.x)&&!qe(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(m=>{if(!By(m.type)||m.type===e.type||m.waypoints.length<2)return!1;const g=m.waypoints[0],y=m.waypoints[1];return!qe(g.x,o.x)||!qe(g.y,o.y)?!1:a?qe(g.y,y.y)&&Math.sign(y.x-g.x)===c:qe(g.x,y.x)&&Math.sign(y.y-g.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(m,g)=>a?g>m.y+5&&g<m.y+m.height-5:g>m.x+5&&g<m.x+m.width-5,f=[];for(const m of Gi){const g=(a?o.y:o.x)+m;if(!d(u,g)||i.length===2&&(!p||!d(p,g)))continue;const y=i.map(_=>({..._}));for(const _ of[y[0],y[1]])a?_.y=g:_.x=g;f.push({pts:y,cost:Math.abs(m)})}return f}function NA(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,d=a?n.x+n.width:n.x,f=r?n.y+n.height:n.y,m=a?i.x:i.x+i.width,g=r?i.y:i.y+i.height,y=[];for(const _ of[0,...Gi])Math.abs(_)<i.width/2-5&&y.push({pts:[{x:d,y:l},{x:u+_,y:l},{x:u+_,y:g}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&y.push({pts:[{x:c,y:f},{x:c,y:p+_},{x:m,y:p+_}],cost:Math.abs(_)});return y}const $A=[[1/2,0],[1/3,25],[2/3,25]],Ny=20;function FA(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of $A){const d=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:d,y:o},{x:d,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+Ny<=i.x&&s(n.x+n.width,i.x),i.x+i.width+Ny<=n.x&&s(n.x,i.x+i.width),a}function kd(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=Math.max(n.x,i.x),r=Math.min(n.x+n.width,i.x+i.width);if(r-o<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,l=a?i.y+i.height:i.y,u=(o+r)/2,p=[];for(const d of[0,...Gi]){const f=u+d;f<=o||f>=r||p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:Math.abs(d)})}return p}const Od=2,jA=3;function $y(e,t,n){if(e.length<2)return!1;for(const i of n.shapes){if(!/Gateway$/.test(i.type)||t.endpoints.includes(i.id))continue;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,wo(e[a-1],e[a],i));if(o>Od)continue;const r=[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}].filter(a=>Ld(a,e)<=Od);if(r.length)for(const a of n.edges){if(a.id===t.id||!a.endpoints.includes(i.id)||a.waypoints.length<2)continue;if([a.waypoints[0],a.waypoints[a.waypoints.length-1]].some(c=>r.some(l=>Math.hypot(c.x-l.x,c.y-l.y)<=jA)&&Ld(c,e)<=Od))return!0}}return!1}function Fy(e,t,n={}){const i=new Map(t.shapes.map(m=>[m.id,m])),o=Ln(t),r=t.edges.filter(m=>m.id!==e.id),a=ei(e,r);if(a===0)return null;const s=Vn(e,r);let c;const l=m=>m.reduce((g,y,_)=>_?g+Math.abs(y.x-m[_-1].x)+Math.abs(y.y-m[_-1].y):0,0),u=3,p=m=>{const g=m[0],y=m[m.length-1],_=Math.hypot(y.x-g.x,y.y-g.y);return _>=1&&l(m)/_>=u?1:0},d=p(e.waypoints),f=[...sl(e,i),...kd(e,i),...Pd(e,i),...BA(e,r,i),...n.sideEntry?FA(e,i):[]];for(const{pts:m,cost:g}of f){const y={...e,waypoints:m};if(Ot(y,o).length>0||$y(m,e,t))continue;const _=ei(y,r),h=Vn(y,r),v=a-_+(d-p(m));if(_>=a||h-s>v)continue;const b=l(m);(!c||_<c.opposite||_===c.opposite&&(h<c.cross||h===c.cross&&(g<c.cost||g===c.cost&&b<c.len)))&&(c={pts:m,opposite:_,cross:h,cost:g,len:b})}return(c==null?void 0:c.pts)??null}function jy(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 HA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Ln(t),o=t.edges.filter(d=>d.id!==e.id),r=jy(e,o);if(r===0)return null;const a=ei(e,o),s=Vn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...kd(e,n),...NA(e,n),...Pd(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=jy(m,o);if(g>=r)continue;const y=ei(m,o);if(y-g>a-r)continue;const _=Vn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.fake||g===u.fake&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,fake:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function Hy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ht(We(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=We(i),l=c.edges.find(d=>d.id===s);if(!l)continue;const u=HA(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function zy(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 Gy(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:zy(e,n)&&zy(t,n)}function Vy(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Gy(e,o,n)&&i++;return i}function zA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Ln(t),o=t.edges.filter(d=>d.id!==e.id),r=Vy(e,o,n);if(r===0)return null;const a=ei(e,o),s=Vn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...kd(e,n),...Pd(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=Vy(m,o,n);if(g>=r)continue;const y=ei(m,o);if(y-g>a-r)continue;const _=Vn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.chain||g===u.chain&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,chain:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function GA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ht(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(d=>r.edges.find(f=>f.id===d));if(!(!u||!p||!Gy(u,p,a)))for(const d of l.edges)n.has(d)||c.add(d)}for(const l of[...c].sort()){const u=We(i),p=u.edges.find(m=>m.id===l);if(!p)continue;const d=zA(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function Wy(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=We(o),c=ht(s).filter(d=>hd(d)&&!t.has(lt(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(hd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(m=>m.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const m=u(d)==="bpmn:SequenceFlow"?0:1,g=u(f)==="bpmn:SequenceFlow"?0:1;return m!==g?m-g:d.localeCompare(f)});for(const d of p){const f=We(o),m=f.edges.find(_=>_.id===d);if(!m)continue;const g=Fy(m,f,{sideEntry:i.has(d)});if(!g)continue;const y=o.get(d);y&&(r.updateWaypoints(y,g),a.add(d))}return a}const VA=10,WA=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function Uy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!el(e,i))return null;const o=Ln(t),r=i.flatMap(un);for(const a of un(e)){let s=[[a.lo,a.hi]];for(const[f,m]of Qc(a,r))s=s.flatMap(([g,y])=>{const _=[];return f>g&&_.push([g,Math.min(y,f)]),m<y&&_.push([Math.max(g,m),y]),_.filter(([h,v])=>v>h)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,m])=>m-f>=c+VA*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Qm}:{x:a.at+In+n.width/2,y:u},d={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!el({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&WA(d,f)))return d}return null}const In=8;function Dd(e,t){const n=e.label;if(!n)return null;const i=un(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=d=>{const f=d.axis==="h"?o:r,m=d.axis==="h"?r-d.at:o-d.at,g=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(m,g)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(un),...t.shapes.filter(d=>d.container).flatMap(_a)],l=d=>!c.some(f=>Hi(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+In,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+In,s.at-In-n.width])for(const f of p){const m=n.y+f;if(m<s.lo||m+n.height>s.hi)continue;const g={...n,x:d,y:m};if(l(g))return g}else for(const d of[s.at-In-n.height,s.at+In])for(const f of p){const m=n.x+f;if(m<s.lo||m+n.width>s.hi)continue;const g={...n,x:m,y:d};if(l(g))return g}return null}const qy=30,Ld=(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},Yy=(e,t)=>Ld({x:e.x+e.width/2,y:e.y+e.height/2},t);function UA(e,t){const n=e.label;if(!n)return null;const i=un(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(un),...t.shapes.filter(c=>c.container).flatMap(_a)],r=Ko(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=>Hi(c,l))&&!vs(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+In,c.at-In-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+In,c.at-In-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 Ky(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=We(i),a=new Set(ht(r).map(lt));for(const[l,u]of t){const p=u.wps,d=i.get(l),f=d==null?void 0:d.label;if(!f||!(d!=null&&d.waypoints))continue;const m=d.waypoints[0].x-p[0].x,g=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((B,P)=>B.x-p[P].x===m&&B.y-p[P].y===g))){if(((s=d.source)==null?void 0:s.id)===u.source&&((c=d.target)==null?void 0:c.id)===u.target)continue;const B=r.edges.find(q=>q.id===l);if(!(B!=null&&B.label)||!vs(B.label,r).length&&!n.has(l))continue;let P={...B.label,x:u.label.x,y:u.label.y};if((vs(P,r).length||Yy(P,B.waypoints)>qy)&&(P=null),!P&&Yy(B.label,B.waypoints)>qy&&(P=UA(B,r)),!P)continue;const k=P;if(k.x===f.x&&k.y===f.y)continue;const N={...r,edges:r.edges.map(q=>q.id===l?{...q,label:k}:q)},G=ht(N);if(G.some(q=>!a.has(lt(q))))continue;o.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=N,a=new Set(G.map(lt));continue}const _=u.label.x+m-f.x,h=u.label.y+g-f.y;if(_===0&&h===0)continue;const v=r.edges.find(B=>B.id===l);if(!(v!=null&&v.label))continue;const b={...v.label,x:v.label.x+_,y:v.label.y+h},E={...r,edges:r.edges.map(B=>B.id===l?{...B,label:b}:B)},M=ht(E);M.some(B=>!a.has(lt(B)))||(o.moveElements([f],{x:_,y:h}),r=E,a=new Set(M.map(lt)))}}function Xy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=We(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Dd(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 Zy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=ht(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(d=>d.id===s.edge);if(!c)continue;const l=Uy(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 Jy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(un),...t.shapes.filter(d=>d.container).flatMap(_a)],o=i.filter(d=>Hi(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=Ko(t).filter(d=>d.owner!==e.id).map(d=>d.rect),s=(d,f)=>d.x<f.x+f.width&&f.x<d.x+d.width&&d.y<f.y+f.height&&f.y<d.y+d.height,c=d=>!i.some(f=>Hi(d,f))&&!r.some(f=>s(d,f))&&!a.some(f=>s(d,f)),l=[];for(const d of o)d.axis==="h"?l.push({...n,y:d.at-In-n.height},{...n,y:d.at+In}):l.push({...n,x:d.at-In-n.width},{...n,x:d.at+In});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+In},{...n,x:u-n.width/2,y:e.y-In-n.height},{...n,x:e.x+e.width+In,y:p-n.height/2},{...n,x:e.x-In-n.width,y:p-n.height/2}),l.find(c)??null}function Qy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=Jy(r,We(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 qA(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 ev(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=We(n),r=new Set(ht(o).map(lt));const a=[...new Set(ht(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(g=>g.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(g=>({...g})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[g,y]of u){const _=g?o.shapes.find(v=>v.id===g):void 0;if(!_)continue;const h=qA(_,l[y]);h.x===l[y].x&&h.y===l[y].y||(l[y]=h,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(g=>g.id===s?{...g,waypoints:l}:g)},f=ht(d);if(f.some(g=>!r.has(lt(g))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),o=d,r=new Set(f.map(lt)))}}const Id=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tv(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 YA(e,t,n){const i=[],o=n?ps(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 tv(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(!Id(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,m]of Object.entries(u))typeof m!="string"||m===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${f}`}),p=!1):o.includes(f)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:f,locales:o}),p=!1);if(!p)continue;const d=o.filter(f=>!(f in u));d.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:d})}}),i}function Si(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function KA(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(Id(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=tv(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=Si(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,m)=>Si(f,"name",a(p[m])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=Si(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,m)=>Si(f,"name",a(p[m])))),s.push(d);break}case"node.add":s.push({...c,node:Si(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:Si(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:Si(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:Si(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:Si(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:Si(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(Si(c,"text",a(l[0])));break;default:s.push(Id(l[0].map)?Si(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const XA=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,nv=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),iv={"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}]},ws=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ll=e=>typeof e=="string"&&e!=="";function ZA(e){const t=[];function n(i,o,r,a){if(a===null){ll(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ws(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)ll(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ws(i)||!ll(i.kind)||!(i.kind in iv)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of iv[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const m of p.slice(0,-1)){if(!ws(d))break;d=d[m]}if(!ws(d))continue;const f=d[p[p.length-1]];if(!(f===void 0&&c.optional)&&!(f===null&&c.optional)){if(!l){n(o,c.path,f,c.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}f.forEach((m,g)=>n(o,`${u}[${g}]`,m,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;ws(c)&&!ll(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"&&!fm(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&&!hm(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 ov(e,t,n={}){const i=ZA(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(g,y,_){if(!XA.test(y)){o.push({kind:"id-invalid",opIndex:g,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:g,id:y});return}r.set(y,{..._,opIndex:g})}e.forEach((g,y)=>{var _;switch(g.kind){case"participant.add":s(y,g.participant.id,{category:"participant",lanes:(g.participant.lanes??[]).map(h=>h.id)});for(const h of g.participant.lanes??[])s(y,h.id,{category:"lane"});break;case"node.add":s(y,g.node.id,{category:"flowNode",participant:g.node.participant});break;case"sequenceFlow.add":s(y,g.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,g.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,g.dataStore.id,{category:"dataStore"});for(const h of g.associations??[])h.id&&s(y,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":g.association.id&&s(y,g.association.id,{category:"dataAssociation"});break;case"association.add":g.association.id&&s(y,g.association.id,{category:"association"});break;case"annotation.add":s(y,g.annotation.id,{category:"annotation"}),(_=g.association)!=null&&_.id&&s(y,g.association.id,{category:"association"});break;case"group.add":s(y,g.group.id,{category:"group"});break;case"participant.update":if(g.lanes){a.set(g.id,g.lanes.map(h=>h.id));for(const h of g.lanes)t.categoryOf(h.id)===void 0&&s(y,h.id,{category:"lane"})}break}});const c=g=>{var y;return((y=r.get(g))==null?void 0:y.category)??t.categoryOf(g)},l=g=>{const y=r.get(g);return y?y.category==="participant"?g:y.participant:t.categoryOf(g)==="participant"?g:t.participantOf(g)};function u(g,y,_,h){const v=c(y);if(v===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:_});return}if(h&&!h.includes(v)){o.push({kind:"ref-category",opIndex:g,ref:y,role:_,expected:h.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(g=>g.kind==="participant.add"),d=new Map;for(const g of e)g.kind==="node.add"?d.set(g.node.id,g.node.eventDefinition):g.kind==="node.update"&&g.type!==void 0&&d.set(g.id,g.eventDefinition);const f=g=>d.has(g)?d.get(g)==="timer":t.eventDefinitionOf(g)==="timer";return e.forEach((g,y)=>{var _,h;switch(g.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=g.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:g.node.id});break}if(u(y,v,"participant",["participant"])===void 0)break;b!==void 0&&((((_=r.get(v))==null?void 0:_.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:y,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:M,condition:B}=g.flow,P=u(y,b,"source",["flowNode"]),k=u(y,E,"target",["flowNode"]);P&&k&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:y,id:v}),M!==void 0&&B!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=g.flow,M=u(y,b,"source",["flowNode","participant"]),B=u(y,E,"target",["flowNode","participant"]);if(M&&B){const P=l(b),k=l(E);P!==void 0&&P===k&&o.push({kind:"message-flow-same-pool",opIndex:y,id:v})}for(const P of[b,E])f(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:v,ref:P});break}case"dataStore.add":{for(const v of g.associations??[]){if([v.source,v.target].filter(M=>M===g.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:v.source,target:v.target});continue}const E=v.source===g.dataStore.id?v.target:v.source;u(y,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=g.association,E=u(y,v,"source"),M=u(y,b,"target");if(E&&M){const B=new Set([E,M]);B.has("dataStore")&&B.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=g.association,M=u(y,b,"source"),B=u(y,E,"target");M&&B&&M!=="annotation"&&B!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(g.association){const{source:v,target:b}=g.association;if(v!==g.annotation.id&&b!==g.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:g.annotation.id});else{const E=v===g.annotation.id?b:v;u(y,E,"association")}}g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.add":{for(const v of g.group.members??[]){const b=u(y,v,"member");b&&nv.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(m(y,g.id,"participant")===void 0)break;if(g.lanes){const v=t.lanesOf(g.id),b=g.lanes.map(P=>P.id);for(const P of v)b.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:g.id,lane:P});for(const P of b)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:y,id:P});const E=b.filter(P=>v.includes(P)),M=P=>E.every((k,N)=>k===P[N]),B=(((h=t.laneDeclarationOrderOf)==null?void 0:h.call(t,g.id))??v).filter(P=>v.includes(P));E.length===v.length&&!M(v)&&!M(B)&&o.push({kind:"lane-reorder-unsupported",opIndex:y,participant:g.id})}break}case"node.update":{if(m(y,g.id,"flowNode")===void 0)break;if(g.lane!==void 0){const v=t.participantOf(g.id);(v?a.get(v)??t.lanesOf(v):[]).includes(g.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:g.lane,participant:v??""})}break}case"sequenceFlow.update":{if(m(y,g.id,"sequenceFlow")===void 0)break;if(g.name!==void 0&&g.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:g.id}),g.source!==void 0||g.target!==void 0){const v=g.source===void 0||u(y,g.source,"source",["flowNode"])!==void 0,b=g.target===void 0||u(y,g.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(g.id),M=g.source??(E==null?void 0:E.source),B=g.target??(E==null?void 0:E.target);v&&b&&M!==void 0&&B!==void 0&&new Set([l(M),l(B),l(g.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:y,id:g.id})}break}case"messageFlow.update":m(y,g.id,"messageFlow");break;case"dataStore.update":m(y,g.id,"dataStore");break;case"annotation.update":{if(m(y,g.id,"annotation")===void 0)break;g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.update":{if(m(y,g.id,"group")===void 0)break;for(const v of g.members??[]){const b=u(y,v,"member");b&&nv.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":m(y,g.id);break;case"element.remove":{m(y,g.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:g.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...YA(e,t,n.i18n)),o;function m(g,y,_){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:g,id:y});return}const h=t.categoryOf(y);if(h===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:"target"});return}if(_&&h!==_){o.push({kind:"ref-category",opIndex:g,ref:y,role:"target",expected:_,actual:h});return}return h}}const Bd=12,rv=14,JA=15,QA=100,eT=300,tT=30,nT=/[㐀-鿿]/,iT=1.1;function av(e){let t=0;for(const n of e)nT.test(n)?t+=Bd:MC(n)?t+=Nr(n,Bd):t+=Nr(n,Bd)*iT;return t}const sv="­";function oT(e,t){const n=e.split(/(\s|-|­)/g),i=[];let o=0,r;if(n.length>1)for(;r=n.shift();)if(r.length+o<t)i.push(r),o+=r.length;else{(r==="-"||r===sv)&&i.pop();break}return i[i.length-1]===sv&&(i[i.length-1]="-"),i.join("")}function rT(e,t,n){const i=Math.max(e.length*(n/t),1);return oT(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const cv=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function aT(e,t,n=av){const i=e.split(/­?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=cv(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=rT(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function lv(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/­?\r?\n/).map(a=>cv(a,av)))),i=Math.max(QA,Math.min(eT,Math.floor(n)+1+rv)),o=Math.max(...t.map(r=>aT(r,i-rv).length));return{width:i,height:Math.max(tT,o*JA+10)}}const uv="bwlExactAnnotationBounds",sT=500;class pv{constructor(t){t.on("commandStack.shape.resize.preExecute",sT,({context:n})=>{var o,r;const i=(o=n==null?void 0:n.hints)==null?void 0:o[uv];!i||((r=n.shape)==null?void 0:r.type)!=="bpmn:TextAnnotation"||(n.newBounds={x:i.x,y:i.y,width:i.width,height:i.height})})}}ln(pv,"$inject",["eventBus"]);const dv={__init__:["annotationExactResize"],annotationExactResize:["type",pv]};function fv(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 ul(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const pl={"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]},Bn=10,cT=300,lT=160,hv=20,Nd=100,gv=40,uT=10,pT=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function mv(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 dl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function fl(e,t,n,i,o){const r=n,a=mv(e,t,i),s=a??i,c=(Y,re,K=s)=>{const[Ce,Ae]=pl[Y];let Te={x:t.x+t.width/2+Ce*(t.width/2+r.width/2+re),y:t.y+t.height/2+Ae*(t.height/2+r.height/2+re)};const de=K.x+Bn+r.width/2,z=K.x+K.width-Bn-r.width/2,oe=K.y+Bn+r.height/2,V=K.y+K.height-Bn-r.height/2,X={x:Math.min(z,Math.max(de,Te.x)),y:Math.min(V,Math.max(oe,Te.y))};return(X.x!==Te.x||X.y!==Te.y)&&(Te=Math.abs(X.x-(t.x+t.width/2))<(t.width+r.width)/2+Bn&&Math.abs(X.y-(t.y+t.height/2))<(t.height+r.height)/2+Bn?{x:t.x+t.width+Bn+r.width/2,y:X.y}:X),Te},l=(i.children??[]).filter(Y=>!("waypoints"in Y&&Y.waypoints)&&Y.type!=="bpmn:Lane"&&Y.type!=="label"&&typeof Y.x=="number"&&Y.id!==o.selfId),u=We(e),p=Y=>{var K,Ce;if(!o.selfId)return!1;const re=e.get(Y);return!!re&&(((K=re.source)==null?void 0:K.id)===o.selfId||((Ce=re.target)==null?void 0:Ce.id)===o.selfId)},d=u.edges.filter(Y=>!p(Y.id)).flatMap(un),f=Ko(u).filter(Y=>Y.owner!==o.selfId).map(Y=>Y.rect),m=Y=>({x0:Y.x-r.width/2-Bn,x1:Y.x+r.width/2+Bn,y0:Y.y-r.height/2-Bn,y1:Y.y+r.height/2+Bn}),g=Y=>{const re=m(Y);return l.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},y=Y=>{const re=m(Y);return d.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},_=Y=>{const re=m(Y);return f.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},h=u.shapes.filter(Y=>Y.type==="bpmn:Group").flatMap(Y=>[{axis:"h",at:Y.y,lo:Y.x,hi:Y.x+Y.width},{axis:"h",at:Y.y+Y.height,lo:Y.x,hi:Y.x+Y.width},{axis:"v",at:Y.x,lo:Y.y,hi:Y.y+Y.height},{axis:"v",at:Y.x+Y.width,lo:Y.y,hi:Y.y+Y.height}]),v=Y=>{const re=m(Y);return h.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},b=Y=>g(Y)||y(Y)||_(Y)||v(Y),E=Y=>Y.x-r.width/2>=i.x&&Y.x+r.width/2<=i.x+i.width&&Y.y-r.height/2>=i.y&&Y.y+r.height/2<=i.y+i.height,M=Y=>E(Y)&&(!a||dl(Y,r,a));if(o.placement){const Y=de=>de.startsWith("top")?de.replace(/^top/,"bottom"):de.replace(/^bottom/,"top"),re=de=>de.endsWith("left")?de.replace(/left$/,"right"):de.replace(/right$/,"left"),K=o.placement.side,Ce=[K,Y(K),re(K),Y(re(K)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ae=o.placement.offset??50;let Te=c(K,Ae);if(b(Te)||a&&!dl(Te,r,a)){const de=(z,oe)=>{const V=new Set;for(const X of Ce){if(V.has(X))continue;V.add(X);const ue=c(X,Ae,z);if(oe(ue)&&!b(ue))return Te=ue,!0}return!1};!de(s,M)&&a&&de(i,E)}return Te}const B=o.from,P=s.x+Bn+r.width/2,k=s.x+s.width-Bn-r.width/2,N=s.y+Bn+r.height/2,G=s.y+s.height-Bn-r.height/2;let q={x:Math.min(k,Math.max(P,B.x)),y:Math.min(G,Math.max(N,B.y))};if(b(q)){const Y=(t.width+r.width)/2+Bn,K=[{x:q.x+Y,y:q.y},{x:q.x-Y,y:q.y},{x:q.x,y:q.y-r.height-Bn},{x:q.x,y:q.y+r.height+Bn}].filter(M).find(Ce=>!b(Ce));K&&(q=K)}return q}function Gt(e,t){return e.filter(n=>n.kind===t)}function yv(e,t){const n=new Map,i=new Set(Gt(e,"node.add").map(s=>s.node.id)),o=Gt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&Gt(e,"sequenceFlow.add").find(d=>d.flow.source===l&&d.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(d=>d!==u&&JSON.stringify(d).includes(p))||(a.add(c),n.set(s.id,u))}return n}function dT(e,t,n){const i=new Map,o=new Set;for(const h of e){const v=i.get(h.source)??[];v.push(h.target),i.set(h.source,v),o.add(h.target)}const r=[...e.map(h=>h.source).filter(h=>!o.has(h)),...t,...e.map(h=>h.source)],a=new Map,s=new Set,c=h=>{a.set(h,"open");for(const v of i.get(h)??[]){const b=a.get(v);b==="open"?s.add(`${h}>${v}`):b||c(v)}a.set(h,"done")};for(const h of r)a.has(h)||c(h);const l=(h,v)=>!s.has(`${h}>${v}`),u=[],p=new Set,d=h=>{p.add(h);for(const v of i.get(h)??[])l(h,v)&&!p.has(v)&&d(v);u.push(h)};for(const h of r)p.has(h)||d(h);const f=new Map;for(const h of u.reverse()){const v=f.get(h)??0;f.set(h,v);for(const b of i.get(h)??[])l(h,b)&&(f.get(b)??-1)<v+1&&f.set(b,v+1)}const m=new Map;for(const h of e){if(!l(h.source,h.target)||!n(h.target))continue;const v=m.get(h.target)??[];v.includes(h.source)||v.push(h.source),m.set(h.target,v)}const g=new Map,y=(h,v)=>{let b=g.get(h);if(!b){b=new Set([h]);const E=[h];for(;E.length;){const M=E.pop();for(const B of i.get(M)??[])l(M,B)&&!b.has(B)&&(b.add(B),E.push(B))}g.set(h,b)}return b.has(v)},_=new Set;for(const h of e){const v=m.get(h.target);if(!v||v.length<2||!v.includes(h.source))continue;const b=f.get(h.source)??0;v.some(E=>E!==h.source&&(f.get(E)??0)>=b+2&&y(h.source,E))&&_.add(h.id)}return _}class vv extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const xv=new WeakMap;function fT(e){return xv.get(e)??new Set}const bv=new WeakMap;function hT(e,t){bv.set(e,t)}const wv=new WeakMap;function gT(e){return wv.get(e)??[]}function _v(e,t){var JS,QS,eR,tR,nR,iR,oR,rR,aR,sR,cR,lR,uR,pR,dR,fR,hR,gR,mR,yR,vR,xR,bR,wR,_R,ER,SR,RR,MR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;xv.set(t,u);const p=[];wv.set(t,p);const d=()=>a.getRootElement(),f=x=>r.get(x),m=x=>{const w=f(x);if(!w)throw new Error(`하강 참조 해소 실패: ${x}`);return w},g=x=>{let w=x.parent;for(;w;){if(w.type==="bpmn:Participant")return w;w=w.parent}},y=(x,w)=>{if(!x)return;const S=w.x+w.width/2,O=w.y+w.height/2;let I;const T=$=>{for(const L of $.children??[])if(L.type==="bpmn:Lane"){const D=L;S>=D.x&&S<=D.x+D.width&&O>=D.y&&O<=D.y+D.height&&(I=D,T(D))}};return T(x),I},_=new Map;for(const x of r.filter(w=>!("waypoints"in w&&w.waypoints)&&w.type!=="bpmn:Lane"&&w.type!=="label"&&typeof w.x=="number"))_.set(x.id,{x:x.x,y:x.y});const h=Gt(e,"participant.add"),v=Gt(e,"node.add"),b=Gt(e,"sequenceFlow.add"),E=Gt(e,"messageFlow.add"),M=Gt(e,"dataStore.add"),B=Gt(e,"dataAssociation.add"),P=Gt(e,"annotation.add"),k=Gt(e,"group.add"),N=new Map(v.map(x=>[x.node.id,x])),G=yv(e,x=>{var w,S;return(S=(w=f(x))==null?void 0:w.source)==null?void 0:S.id}),q=new Set([...G.values()].map(x=>x.flow.id)),Y=b.filter(x=>!q.has(x.flow.id)),re=new Set([...G.values()].map(x=>x.flow.target)),K=x=>Gt(e,"sequenceFlow.update").filter(w=>w.target===x).length+(re.has(x)?1:0),Ce=(x,w,S)=>{var L;const O=x.businessObject,I=(((L=O.extensionElements)==null?void 0:L.values)??[]).filter(D=>D.$type!==w),T=S?[...I,i.create(w,S)]:I;if(!T.length){O.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:T});T.forEach(D=>{D.$parent=$}),n.updateProperties(x,{extensionElements:$})},Ae=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Gt(e,"element.remove")){const w=f(x.id);if(!w)continue;const S="waypoints"in w?[]:[...w.incoming??[],...w.outgoing??[]];n.removeElements([...S,w])}const Te=x=>r.filter(w=>{var S;return w.type==="bpmn:Lane"&&((S=g(w))==null?void 0:S.id)===x}).sort((w,S)=>w.y-S.y),de=[];for(const x of Gt(e,"participant.update")){const w=m(x.id);if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),!x.lanes)continue;const S=Te(x.id);if(!S.length){n.splitLane(w,x.lanes.length),Te(x.id).forEach((T,$)=>{const L=x.lanes[$];L&&n.updateProperties(T,{id:L.id,name:L.name})}),de.push({pool:x.id,lanes:new Set(x.lanes.map(T=>T.id))});continue}const O=new Set(S.map(T=>T.id)),I=x.lanes.reduce((T,$,L)=>O.has($.id)?L:T,-1);x.lanes.forEach((T,$)=>{if(O.has(T.id)){n.updateProperties(m(T.id),{name:T.name});return}const L=$===I+1&&I>=0,D=$===0?n.addLane(Te(x.id)[0],"top"):L?n.addLane(Te(x.id).at(-1),"bottom"):n.addLane(m(x.lanes[$-1].id),"bottom");n.updateProperties(D,{id:T.id,name:T.name})})}const z=150,oe=130,V=80,X=90,ue=180,be=30,$e=30,F=10,C=300,R=5,W=(x,w,S,O,I)=>{const T=S-w.width/2,$=O-w.height/2;return(x.children??[]).find(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="bpmn:Lane"&&L.type!=="label"&&!(I!=null&&I.has(L.id))&&typeof L.x=="number"&&T<L.x+L.width+$e&&T+w.width+$e>L.x&&$<L.y+L.height&&$+w.height>L.y)},J=new Set;for(const x of h){J.add(`pool:${x.participant.id}`);for(const w of x.participant.lanes??[])J.add(w.id)}const fe=new Map;for(const x of v){const w=x.node.lane??`pool:${x.node.participant??""}`;let S=fe.get(w);S||fe.set(w,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const Pe=new Map;for(const[x,w]of fe){if(!J.has(x))continue;const S=[...w].sort((T,$)=>T-$),O=S.map((T,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),I=Math.min(...O);Pe.set(x,new Map(S.map((T,$)=>[T,O[$]-I])))}{const x=new Map;for(const w of h)(w.participant.lanes??[]).forEach((S,O)=>x.set(S.id,O));for(const[w,S]of Pe){if(!x.has(w)||S.size<2)continue;const O=x.get(w),I=S.get(0)??0,T=new Set;for(const te of v){if(te.node.lane!==w||(te.band??0)!==0||!te.node.type.endsWith("Gateway"))continue;const pe={in:new Set,out:new Set,cross:new Set};for(const ae of Y){const ne=ae.flow.source===te.node.id;if(!ne&&ae.flow.target!==te.node.id)continue;const xe=N.get(ne?ae.flow.target:ae.flow.source);if(!xe||xe.node.participant!==te.node.participant||!xe.node.lane)continue;let ve,ee=!1;if(xe.node.lane!==w){const ce=x.get(xe.node.lane);if(ce===void 0)continue;ve=ce>O?"down":"up",ee=!0}else{const ce=S.get(xe.band??0)??I;ve=ce>I?"down":ce<I?"up":void 0}ve&&(pe[ne?"out":"in"].add(ve),ee&&pe.cross.add(ve))}for(const ae of["up","down"])pe.in.has(ae)&&pe.out.has(ae)&&pe.cross.has(ae)&&T.add(ae)}if(T.size!==1)continue;const[$]=T,L=Math.max(...S.values()),D=$==="down"?L:0;if(I===D)continue;const H=[...S.entries()].filter(([te])=>te!==0).sort((te,pe)=>te[1]-pe[1]),j=[...Array(L+1).keys()].filter(te=>te!==D),Q=new Map([[0,D]]);H.forEach(([te],pe)=>Q.set(te,j[pe])),Pe.set(w,Q)}}const ct=x=>{var w;return(((w=fe.get(x))==null?void 0:w.size)??0)>1},pt=x=>x.band??(x.node.lane||!ct(`pool:${x.node.participant??""}`)?void 0:0),zt=new Map,vt=x=>zt.get(x.node.id)??pt(x),an=new Set,Mn=new Set,kn=new Set,Nt=new Set,vn=new Set,On=x=>P.some(w=>{var S,O;return(((S=w.placement)==null?void 0:S.anchor)??(w.association?w.association.source===w.annotation.id?w.association.target:w.association.source:void 0))===x&&((O=w.placement)==null?void 0:O.side.startsWith("bottom"))});{const x=new Map;for(const O of Y)x.set(O.flow.target,(x.get(O.flow.target)??0)+1);const w=O=>{const I=[],T=new Set([O]),$=[O];for(;$.length;){const L=$.shift();I.push(L);for(const D of Y)D.flow.source!==L||T.has(D.flow.target)||(x.get(D.flow.target)??0)!==1||(T.add(D.flow.target),$.push(D.flow.target))}return I},S=(O,I)=>{var T;return((T=Pe.get(O))==null?void 0:T.get(I))??I};for(const O of v){if(!O.node.type.endsWith("Gateway"))continue;const I=O.node.lane??`pool:${O.node.participant??""}`,T=Pe.get(I);if(!T||T.size<2)continue;const $=vt(O);if($===void 0||S(I,$)!==S(I,0))continue;const L=S(I,$),D=Y.filter(ae=>ae.flow.source===O.node.id).map(ae=>N.get(ae.flow.target)).filter(ae=>!!ae&&(ae.node.lane??`pool:${ae.node.participant??""}`)===I),H=D.filter(ae=>{const ne=vt(ae);return ne!==void 0&&S(I,ne)===L&&(x.get(ae.node.id)??0)===1}),j=D.some(ae=>{const ne=vt(ae);return ne!==void 0&&S(I,ne)>L});if(H.length!==1||!j)continue;const Q=new Set(D.flatMap(ae=>w(ae.node.id)));if(!Y.some(ae=>ae.flow.target===O.node.id&&Q.has(ae.flow.source)))continue;const pe=new Map;for(const[ae,ne]of T)pe.set(ae,ne+1);pe.set(-1,0),Pe.set(I,pe);for(const ae of w(H[0].node.id))N.has(ae)&&(zt.set(ae,-1),Mn.add(ae));an.add(O.node.id)}}{const x=j=>j.node.lane??`pool:${j.node.participant??""}`,w=j=>vt(j)??0,S=new Map(h.map((j,Q)=>({id:j.participant.id,order:j.order??Number.POSITIVE_INFINITY,declared:Q})).sort((j,Q)=>j.order!==Q.order?j.order-Q.order:j.declared-Q.declared).map((j,Q)=>[j.id,Q])),O=j=>j===void 0?void 0:S.get(j)??-1,I=j=>{var pe;const Q=N.get(j);if(Q)return Q.node.participant;if(S.has(j))return j;const te=f(j);if(te)return te.type==="bpmn:Participant"?te.id:(pe=g(te))==null?void 0:pe.id},T=new Map;for(const j of Y)T.set(j.flow.target,(T.get(j.flow.target)??0)+1);const $=j=>{const Q=[j],te=new Set([j.node.id]);for(let pe=0;pe<Q.length;pe++)for(const ae of Y){if(ae.flow.source!==Q[pe].node.id||te.has(ae.flow.target)||(T.get(ae.flow.target)??0)!==1)continue;const ne=N.get(ae.flow.target);!ne||ne.node.participant!==j.node.participant||(te.add(ne.node.id),Q.push(ne))}return Q},L=j=>{const Q=new Set(j.map(ae=>ae.node.id)),te=O(j[0].node.participant);if(te===void 0)return;const pe=new Set;for(const ae of E){const ne=Q.has(ae.flow.source)?ae.flow.target:Q.has(ae.flow.target)?ae.flow.source:void 0;if(ne===void 0)continue;const xe=O(I(ne));xe===void 0||xe===te||pe.add(xe<te?"up":"down")}return pe.size===1?[...pe][0]:void 0},D=new Map;{const j=new Map;for(const ne of Y){if(!N.has(ne.flow.source)||!N.has(ne.flow.target))continue;const xe=j.get(ne.flow.source)??[];xe.push(ne.flow.target),j.set(ne.flow.source,xe)}const Q=new Map,te=[],pe=new Set,ae=ne=>{Q.set(ne,"open");for(const xe of j.get(ne)??[]){const ve=Q.get(xe);ve==="open"?pe.add(`${ne}>${xe}`):ve||ae(xe)}Q.set(ne,"done"),te.push(ne)};for(const ne of v)Q.has(ne.node.id)||ae(ne.node.id);for(const ne of te.reverse()){const xe=D.get(ne)??0;D.set(ne,xe);for(const ve of j.get(ne)??[])!pe.has(`${ne}>${ve}`)&&(D.get(ve)??-1)<xe+1&&D.set(ve,xe+1)}}let H=-1e3;for(const j of v){if(!j.node.type.endsWith("Gateway"))continue;const Q=x(j),te=Pe.get(Q);if(!te)continue;const pe=te.get(w(j))??0,ae=ee=>(te.get(w(ee))??0)-pe,ne=Y.filter(ee=>ee.flow.source===j.node.id).map(ee=>N.get(ee.flow.target)).filter(ee=>!!ee&&x(ee)===Q&&(T.get(ee.node.id)??0)===1&&!Mn.has(ee.node.id)).map(ee=>{const ce=$(ee);return{root:ee,subtree:ce,dir:L(ce)}});if(ne.some(ee=>ee.dir==="up")&&ne.some(ee=>ee.dir==="down"))continue;const xe=Y.some(ee=>{const ce=ee.flow.source===j.node.id?N.get(ee.flow.target):void 0;return!!ce&&x(ce)===Q&&ae(ce)===0});let ve=!1;if(!xe){const ee=Y.filter(se=>se.flow.source===j.node.id).map(se=>N.get(se.flow.target)).filter(se=>!!se&&x(se)===Q&&(!!se.node.lane||pt(se)!==void 0)&&ae(se)<0),ce=ee.length?Math.max(...ee.map(ae)):void 0,ye=ee.filter(se=>ae(se)===ce);if(!On(j.node.id)&&ye.length===1&&(T.get(ye[0].node.id)??0)===1&&!an.has(j.node.id))continue;ve=!0}for(const ee of ne){const ce=ee.dir;if(!ce||ne.some(ge=>ge!==ee&&ge.dir===ce))continue;const ye=ae(ee.root);if(ye===0||(ce==="up"?ye<0:ye>0)||Y.some(ge=>{const Fe=ge.flow.target===j.node.id?N.get(ge.flow.source):void 0;if(!Fe||x(Fe)!==Q)return!1;const Ke=ae(Fe);return ce==="up"?Ke<0:Ke>0}))continue;const se=[...te].map(([ge,Fe])=>({band:ge,rel:Fe-pe})).filter(ge=>ce==="up"?ge.rel<0:ge.rel>0).sort((ge,Fe)=>Math.abs(Fe.rel)-Math.abs(ge.rel));if(!se.length&&ce==="down")continue;const Re=w(ee.root),Me=ee.subtree.filter(ge=>x(ge)===Q&&w(ge)===Re),Ge=new Set(ee.subtree.map(ge=>ge.node.id)),Ue=Me.map(ge=>D.get(ge.node.id)??0),Ie=Math.min(...Ue)-1,Oe=Math.max(...Ue)+1,me=ge=>!v.some(Fe=>{if(Ge.has(Fe.node.id)||x(Fe)!==Q||w(Fe)!==ge)return!1;if(!kn.has(ge))return!0;const Ke=D.get(Fe.node.id)??0;return Ke>=Ie&&Ke<=Oe});let he=ve?w(j):(JS=se.find(ge=>me(ge.band)))==null?void 0:JS.band;if(he===void 0){if(he=H--,kn.add(he),ce==="up"){const ge=new Map;for(const[Fe,Ke]of te)ge.set(Fe,Ke+1);ge.set(he,0),Pe.set(Q,ge)}else te.set(he,Math.max(...te.values())+1);(QS=fe.get(Q))==null||QS.add(he)}for(const ge of Me)zt.set(ge.node.id,he)}}{const j=ne=>{const xe=Y.find(ve=>ve.flow.target===ne.node.id);return xe?N.get(xe.flow.source):void 0},Q=ne=>{const xe=j(ne);if(!xe||!xe.node.type.endsWith("Gateway")||x(xe)!==x(ne))return!1;const ve=Pe.get(x(xe));if(!ve)return!1;const ee=ve.get(w(xe))??0,ce=Me=>x(Me)===x(xe)?(ve.get(w(Me))??0)-ee:Number.NaN,ye=Y.filter(Me=>Me.flow.source===xe.node.id).map(Me=>N.get(Me.flow.target)).filter(Me=>!!Me&&(!!Me.node.lane||pt(Me)!==void 0));if(ye.some(Me=>ce(Me)===0))return!1;const le=ye.filter(Me=>Me.node.lane===xe.node.lane&&ce(Me)<0);if(!le.length)return!1;const se=Math.max(...le.map(ce)),Re=le.filter(Me=>ce(Me)===se);return Re.length===1&&Re[0]===ne&&(T.get(ne.node.id)??0)===1&&!On(xe.node.id)&&!an.has(xe.node.id)},te=new Set;for(const ne of v){if(!ne.node.type.endsWith("Gateway")||On(ne.node.id))continue;const xe=Pe.get(x(ne));if(!xe)continue;const ve=xe.get(w(ne))??0;let ee;for(const ce of Y){if(ce.flow.source!==ne.node.id)continue;const ye=N.get(ce.flow.target);if(!ye||x(ye)!==x(ne)||!ye.node.lane&&pt(ye)===void 0)continue;const le=xe.get(w(ye))??0;le<=ve||(!ee||le>ee.row?ee={id:ye.node.id,row:le,count:1}:le===ee.row&&ee.count++)}ee&&ee.count===1&&(T.get(ee.id)??0)===1&&te.add(ee.id)}const pe=new Set,ae=[...v].sort((ne,xe)=>Number(te.has(ne.node.id))-Number(te.has(xe.node.id)));for(const ne of ae){const xe=x(ne),ve=Pe.get(xe);if(!ve)continue;const ee=ne.node.id,ce=E.filter(it=>it.flow.target===ee);if(ce.length!==1||!(T.get(ee)??0)||!ne.node.lane&&pt(ne)===void 0||Mn.has(ee)||Nt.has(ee))continue;const ye=(eR=N.get(ce[0].flow.source))==null?void 0:eR.node.participant;if(!ye||ye===ne.node.participant)continue;const le=O(ne.node.participant),se=O(ye);if(le===void 0||se===void 0||le===se)continue;const Re=se<le,Me=ve.get(0)??0,Ge=(ve.get(w(ne))??Me)-Me;if(Ge===0||(Re?Ge<0:Ge>0)||Q(ne))continue;let Ue;for(const[it,Be]of ve){if(kn.has(it))continue;const Ve=Be-Me;(Re?Ve<0&&(!Ue||Ve<Ue.row):Ve>0&&(!Ue||Ve>Ue.row))&&(Ue={band:it,row:Ve})}if(!Ue)continue;const Ie=w(ne),Oe=$(ne).filter(it=>x(it)===xe&&w(it)===Ie&&!Mn.has(it.node.id)),me=j(ne),he=me!=null&&me.node.type.endsWith("Gateway")?`${me.node.id}|${xe}|${Ue.band}`:void 0,ge=Ue,Fe=!!he&&te.has(ee)&&Y.some(it=>{if(it.flow.source!==me.node.id||it.flow.target===ee)return!1;const Be=N.get(it.flow.target);return!!Be&&x(Be)===xe&&!Oe.includes(Be)&&w(Be)===ge.band});let Ke=Ue.band;if(he&&(pe.has(he)||Fe)){if(Ke=H--,kn.add(Ke),Re){const it=new Map;for(const[Be,Ve]of ve)it.set(Be,Ve+1);it.set(Ke,0),Pe.set(xe,it)}else ve.set(Ke,Math.max(...ve.values())+1);(tR=fe.get(xe))==null||tR.add(Ke)}he&&pe.add(he);for(const it of Oe)zt.set(it.node.id,Ke),Nt.add(it.node.id);Re&&te.has(ee)&&vn.add(ee)}}}const ii=(x,w)=>{var S;return((S=Pe.get(x))==null?void 0:S.get(w))??w},qn=(x,w,S,O)=>{const I=x?f(x):w?f(w):void 0;if(!I)return!1;const T=x?I.y+Math.min(I.height/2,X):I.y+V;return Math.abs(T+ii(x??`pool:${w??""}`,S)*z-O)<=z/2},Ni=new Map;for(const[x,w]of fe){let S=0;for(const O of w)S=Math.max(S,ii(x,O));Ni.set(x,S)}const oi=x=>ue+z*x,Wt=(x,w,S,O)=>{const I=d().children.filter(T=>!("waypoints"in T&&T.waypoints)&&T.type!=="label"&&T.id!==w&&!(O!=null&&O.has(T.id))&&typeof T.y=="number"&&T.y>=x);I.length&&n.moveElements(I,{x:0,y:S})},Rr=(x,w,S)=>{const O=x.type==="bpmn:Participant"?x:void 0;if(!O||O.children.some(L=>L.type==="bpmn:Lane"))return;const I=S+w.height/2+be-O.y;if(O.height>=I)return;const T=I-O.height,$=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:I}),Wt($,O.id,T)},is=(x,w,S)=>{const O=w-x.height;if(O<=0)return new Set;const I=g(x)??x,T=[],$=H=>{if(!(S!=null&&S.has(H.id))){T.push(H);for(const j of H.children??[])$(j)}};$(I);const L=x.y+x.height-10,D=l.calculateAdjustments(T,"y",O,L);return l.makeSpace(D.movingShapes,D.resizingShapes,{x:0,y:O},"s",L),new Set(D.movingShapes.map(H=>H.id))},Zn=(x,w,S)=>{if(x){const $=m(x),L=oi(w);if($.height>=L)return;const D=L-$.height,H=g($),j=H?H.y+H.height:$.y+$.height,Q=is($,L);Wt(j,H==null?void 0:H.id,D,Q);return}if(!S)return;const O=z*(w+1);if(S.height>=O)return;const I=O-S.height,T=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:O}),Wt(T,S.id,I)},_t=new Map;for(const x of Y)_t.set(x.flow.target,(_t.get(x.flow.target)??0)+1);const At=x=>(_t.get(x)??0)<=1,BF=new Set(v.map(x=>x.node.id).filter(x=>K(x)===1&&!Y.some(w=>w.flow.target===x||w.flow.source===x&&N.has(w.flow.target)))),Yg=new Map,Kg=(x,w)=>{if(!x)return;const S=f(x);if(!S||S.height>=oi(w))return;const O=S.y+S.height-10,I=g(S);if(I)return new Set((I.children??[]).filter(T=>T.type!=="bpmn:Lane"&&typeof T.y=="number"&&T.y>O).map(T=>T.id))},Cp=(x,w,S)=>{if(!x)return!0;const O=f(x);return O?S-w.height/2>=O.y&&S+w.height/2<=O.y+O.height:!0},NF=10,$F=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:w}of de){const S=f(x),O=Te(x);if(!S||O.length<2)continue;const I=oi(0),T=NF,$=new Set(Gt(e,"node.update").filter(le=>le.lane!==void 0&&w.has(le.lane)).map(le=>le.id)),L=S.children??[],D=L.filter(le=>!("waypoints"in le&&le.waypoints)&&le.type!=="bpmn:Lane"&&le.type!=="label"&&typeof le.y=="number"),H=[];for(const le of D){H.push([le.y,le.y+le.height]);const se=le.label;se&&H.push([se.y,se.y+se.height])}for(const le of L){const se="waypoints"in le&&le.waypoints?le.label:void 0;se&&se.y+se.height>S.y&&se.y<S.y+S.height&&H.push([se.y,se.y+se.height])}for(const le of d().children){if(le.type!=="bpmn:TextAnnotation")continue;const se=le;se.x<S.x+S.width&&se.x+se.width>S.x&&se.y<S.y+S.height&&se.y+se.height>S.y&&H.push([se.y,se.y+se.height])}H.sort((le,se)=>le[0]-se[0]);const j=S.y,Q=S.y+S.height,te=[];let pe=j;for(const[le,se]of H)le>pe&&te.push([pe,le]),pe=Math.max(pe,se);const ae=D.filter(le=>$F.test(le.type)&&!$.has(le.id)),ne=(le,se)=>ae.some(Re=>Re.y+Re.height/2>=le&&Re.y+Re.height/2<=se),xe=le=>H.some(([se,Re])=>se<le-.5&&le+.5<Re),ve=[];let ee=j;for(const le of O.slice(1).map(se=>se.y)){const se=ee+2*T,Re=!xe(le)&&le>=se&&le<=Q-2*T?[le]:[];for(const[Ge,Ue]of te){const Ie=Math.max(Ge+T,se),Oe=Math.min(Ue-T,Q-2*T);Ie<=Oe&&Re.push(Math.min(Math.max(le,Ie),Oe))}Re.push(Math.max(pe+T,se));let Me;for(const Ge of Re){const Ue=!ne(ee,Ge)&&Ge-ee<I?D.filter(me=>me.y>=Ge).length:0,Ie=Math.abs(Ge-le),Oe=Me?Math.abs(Me.y-le):0;(!Me||Ue<Me.cost||Ue===Me.cost&&(Ie<Oe||Ie===Oe&&Ge>Me.y))&&(Me={y:Ge,cost:Ue})}ve.push(Me.y),ee=Me.y}const ce=ve[ve.length-1]+2*T-Q;ce>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+ce}),Wt(Q,S.id,ce));const ye=[j,...ve,S.y+S.height];O.forEach((le,se)=>{const Re=ye[se],Me=ye[se+1]-Re;(le.y!==Re||le.height!==Me)&&n.resizeShape(le,{x:le.x,y:Re,width:le.width,height:Me})});for(const le of O){if(le.height>=I||ne(le.y,le.y+le.height))continue;const se=I-le.height,Re=S.y+S.height,Me=is(le,I);Wt(Re,S.id,se,Me)}}const Ap=h.map((x,w)=>({op:x,declared:w}));Ap.sort((x,w)=>{const S=x.op.order??Number.POSITIVE_INFINITY,O=w.op.order??Number.POSITIVE_INFINITY;return S!==O?S-O:x.declared-w.declared});let Tc=80;for(const x of r.getAll())x.parent===d()&&"height"in x&&typeof x.y=="number"&&(Tc=Math.max(Tc,x.y+x.height+60));const Xg=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===d()),FF=(()=>{if(!Xg.length)return;const x=Xg.filter(I=>!Ev(I)),w=x.length?x:Xg,S=Math.min(...w.map(I=>I.x)),O=Math.max(...w.map(I=>I.x+I.width));return O>S?{x:S,width:O-S}:void 0})();for(const{op:x}of Ap){const w=x.participant,S=v.filter(ne=>ne.node.participant===w.id).length,O=((nR=w.lanes)==null?void 0:nR.length)??0,I=Math.max(1200,S*160+300),T=(w.lanes??[]).map(ne=>oi(Ni.get(ne.id)??0)),$=T.reduce((ne,xe)=>ne+xe,0);O&&$<300&&(T[O-1]+=300-$);const L=Math.max(300,z*((Ni.get(`pool:${w.id}`)??0)+1)),D=w.blackBox||S+O===0?120:O?Math.max(300,$):L,H=w.blackBox?FF:void 0,j=(H==null?void 0:H.x)??100,Q=(H==null?void 0:H.width)??I,te=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:w.id,name:w.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...w.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Q,height:D,isExpanded:!0}),pe=n.createShape(te,{x:j+Q/2,y:Tc+D/2},d()),ae=w.lanes??[];if(ae.length&&n.splitLane(pe,ae.length),ae.length){const ne=r.filter(xe=>{var ve;return xe.type==="bpmn:Lane"&&((ve=g(xe))==null?void 0:ve.id)===w.id}).sort((xe,ve)=>xe.y-ve.y);if(ne.forEach((xe,ve)=>{const ee=ae[ve];ee&&n.updateProperties(xe,{id:ee.id,name:ee.name})}),T.some(xe=>xe!==pe.height/O)){let xe=pe.y;ne.forEach((ve,ee)=>{const ce=T[ee];n.resizeShape(ve,{x:ve.x,y:xe,width:ve.width,height:ce}),xe+=ce})}}Tc=pe.y+pe.height+60}const jF=x=>{var O;const w=N.get(x);if(w)return w.node.participant??"";const S=f(x);return S?S.type==="bpmn:Participant"?S.id:((O=g(S))==null?void 0:O.id)??"":""},Pc=new Map,bS=x=>{let w=Pc.get(x);return w||Pc.set(x,w={nodes:[],flows:[]}),w};for(const x of v)bS(x.node.participant??"").nodes.push(x);for(const x of Y)bS(jF(x.flow.source)).flows.push(x);const Tp=x=>{var w;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((w=x.condition)==null?void 0:w.label)})},Zg=(x,w,S)=>o.createShape({type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{},businessObject:i.create(ul(x.type),{id:x.id,name:x.name,...w!==void 0?{"bwl:band":w}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),HF=[...Ap.map(({op:x})=>x.participant.id).filter(x=>Pc.has(x)),...[...Pc.keys()].filter(x=>!h.some(w=>w.participant.id===x))],Jg=x=>x.endsWith("Gateway");for(const x of HF){const w=Pc.get(x),S=x?m(x):void 0,O=S?S.x+150:250;let I=S?S.y+80:120;const T=(se,Re,Me)=>{if(se){const Ge=m(se);return Ge.y+Math.min(Ge.height/2,X)+ii(se,Re??0)*z}return Re!==void 0&&S?S.y+V+ii(`pool:${x}`,Re)*z:Me},$=(se,Re,Me)=>{if(se){const Ge=m(se);return Ge.y+Math.min(Ge.height/2,X)+Re*z}return S?S.y+V+Re*z:Me},L=se=>se.participant?m(se.participant):d(),D=(se,Re,Me,Ge,Ue,Ie,Oe,me)=>{const he=Me!==void 0||Ge!==void 0,ge=Be=>{const Ve=()=>Zn(Me,Be,S);me?me(Ve):Ve()},Fe=ii(Me??`pool:${x}`,Ge??0);if((Ge===void 0||qn(Me,x,Ge,Oe??Number.NaN))&&Oe!==void 0&&Cp(Me,Re,Oe)&&!W(se,Re,Ue,Oe))return{x:Ue,y:Oe};if(he)for(let Be=0;Be<4;Be++){const Ve=$(Me,Fe+Be,Ie);if(!W(se,Re,Ue,Ve,Kg(Me,Fe+Be)))return ge(Fe+Be),{x:Ue,y:Ve}}const Ke=T(Me,Ge,Ie);he?ge(Fe):me?me(()=>Rr(se,Re,Re.y+Re.height/2)):Rr(se,Re,Ke);let it=Ue;for(let Be=0;Be<64;Be++){const Ve=W(se,Re,it,Ke);if(!Ve)break;it=Ve.x+Ve.width+oe+Re.width/2}return{x:it,y:Ke}},H=(se,Re,Me)=>{const Ge=r.getAll().filter(Ie=>{var Oe;return/Association$/.test(Ie.type)&&(((Oe=Ie.waypoints)==null?void 0:Oe.length)??0)>=2});if(!Ge.length)return Me;const Ue=Ie=>{const Oe={id:Re.id,type:Re.type,x:Ie-Re.width/2,y:Me.y-Re.height/2,width:Re.width,height:Re.height};return Ge.some(me=>me.waypoints.some((he,ge)=>!!me.waypoints[ge+1]&&wo(he,me.waypoints[ge+1],Oe)<=F))};if(!Ue(Me.x))return Me;for(let Ie=R;Ie<=C;Ie+=R){const Oe=Me.x+Ie;if(!Ue(Oe)&&!W(se,Re,Oe,Me.y))return{x:Oe,y:Me.y}}return Me},j=(se,Re,Me,Ge,Ue)=>{var Be;const Ie=ii(Ge??`pool:${x}`,Ue??0),Oe=$(Ge,Ie,Number.NaN);if(Number.isNaN(Oe))return;const me=W(se,Re,Me,Oe,Kg(Ge,Ie));if(!me||!N.has(me.id)||me.type!=="bpmn:EndEvent")return;const he=Ve=>(Ve??[]).filter(Ft=>Ft.type==="bpmn:SequenceFlow"),ge=he(me.incoming);if(he(me.outgoing).length||ge.length>1)return;const Fe=me.y+me.height/2;if(Math.abs(Fe-Oe)>1)return;const Ke=(Be=ge[0])==null?void 0:Be.source;if(!Ke||typeof Ke.x!="number"||me.x-(Ke.x+Ke.width)>oe)return;const it=$(Ge,Ie+1,Number.NaN);Number.isNaN(it)||W(se,me,me.x+me.width/2,it,new Set([me.id]))||(Zn(Ge,Ie+1,S),n.moveShape(me,{x:0,y:it-Fe}))},Q=new Set(w.flows.map(se=>se.flow.target)),te=new Map,pe=se=>{if(se===void 0)return;const Re=r.get(se);if(!(!Re||typeof Re.x!="number"||typeof Re.width!="number"))return Re.x+Re.width+oe},ae=se=>{if(K(se)>0)return;const Re=w.flows.filter(Ge=>Ge.flow.source===se);if(Re.length!==1)return;const Me=r.get(Re[0].flow.target);return Me&&typeof Me.y=="number"&&typeof Me.height=="number"?Me.y+Me.height/2:void 0};for(const se of w.nodes){if(Q.has(se.node.id))continue;const Re=Zg(se.node,se.band,se.afterColumn),Me=pt(se),Ge=se.node.lane?`${se.node.lane}|${Me??""}`:Me!==void 0?`band:${Me}`:"",Ue=L(se.node),Ie=te.get(Ge)??O,Oe=pe(se.afterColumn),me=Oe===void 0?Ie:Math.max(Ie,Oe);let he;const ge=D(Ue,Re,se.node.lane,Me,me,I,ae(se.node.id),BF.has(se.node.id)&&se.node.participant!==void 0?Fe=>he=Fe:void 0);if(he?n.createShape(Re,ge,Ue,{autoResize:!1}):n.createShape(Re,ge,Ue),he){const Fe=se.node.lane?m(se.node.lane):Ue;Yg.set(se.node.id,{container:Fe,relCy:ge.y-Fe.y,grow:he})}te.set(Ge,ge.x+Re.width+oe),!se.node.lane&&Me===void 0&&(I+=160)}const ne=new Set,xe=new Map,ve=new Map;if(x&&J.has(`pool:${x}`)){const se=new Map;for(const me of w.flows)se.set(me.flow.target,(se.get(me.flow.target)??0)+1);const Re=me=>T(me.node.lane,vt(me),Number.NaN),Me=new Set,Ge=me=>{var Fe;const he=(Fe=N.get(me))==null?void 0:Fe.node.participant;if(he)return f(he);const ge=f(me);if(ge)return ge.type==="bpmn:Participant"?ge:g(ge)},Ue=me=>{const he=[],ge=new Set([me]),Fe=[me];for(;Fe.length;){const Ke=Fe.shift(),it=N.get(Ke);it&&he.push(it);for(const Be of w.flows)Be.flow.source!==Ke||ge.has(Be.flow.target)||(se.get(Be.flow.target)??0)!==1||(ge.add(Be.flow.target),Fe.push(Be.flow.target))}return he},Ie=me=>{if(!S)return;const he=new Set(me.map(Ke=>Ke.node.id));let ge=!1,Fe=!1;for(const Ke of E){if(!he.has(Ke.flow.source))continue;const it=Ge(Ke.flow.target);!it||it.id===S.id||(it.y<S.y?ge=!0:Fe=!0)}return ge&&!Fe?"up":Fe&&!ge?"down":void 0};for(const me of w.nodes){if(!Jg(me.node.type))continue;const he=T(me.node.lane,pt(me),Number.NaN);if(Number.isNaN(he))continue;const ge=[];for(const Be of w.flows){if(Be.flow.source!==me.node.id)continue;const Ve=N.get(Be.flow.target);if(!Ve||Ve.node.lane!==me.node.lane||(se.get(Ve.node.id)??0)!==1)continue;const Ft=pt(Ve);if(Ft===void 0)continue;const cn=T(Ve.node.lane,Ft,Number.NaN);if(Number.isNaN(cn))continue;const Yt=Ue(Ve.node.id),Kt=Ie(Yt);Kt&&ge.push({subtree:Yt,band:Ft,row:cn,dir:Kt})}if(!ge.some(Be=>Be.dir==="up")||!ge.some(Be=>Be.dir==="down")||!ge.some(Be=>Be.dir==="up"&&ge.some(Ve=>Ve.dir==="down"&&Ve.row<Be.row)))continue;const Ke=[...ge].sort((Be,Ve)=>Be.row-Ve.row);[...ge.filter(Be=>Be.dir==="up"),...ge.filter(Be=>Be.dir==="down")].sort((Be,Ve)=>Be.dir===Ve.dir?Be.row-Ve.row:Be.dir==="up"?-1:1).forEach((Be,Ve)=>{const Ft=Ke[Ve].band;if(Ft!==Be.band){Me.add(me.node.id);for(const cn of Be.subtree)pt(cn)===Be.band&&zt.set(cn.node.id,Ft)}})}const Oe=me=>{if(!S)return;const he=new Set(me.map(Ke=>Ke.node.id));let ge=!1,Fe=!1;for(const Ke of E){if(!he.has(Ke.flow.target))continue;const it=Ge(Ke.flow.source);!it||it.id===S.id||(it.y<S.y?ge=!0:Fe=!0)}return ge&&!Fe?"up":Fe&&!ge?"down":void 0};for(const me of w.nodes){if(!Jg(me.node.type))continue;const he=me.node.lane??`pool:${x}`,ge=Pe.get(he);if(!ge||ge.size<2)continue;const Fe=ge.get(0);if(Fe===void 0)continue;const Ke=Math.max(...ge.values()),it=Fe===Ke&&Fe!==0?"down":void 0;if(!it)continue;const Be=[];for(const Kt of w.flows){if(Kt.flow.source!==me.node.id)continue;const mo=N.get(Kt.flow.target);if(!mo||mo.node.lane!==me.node.lane||(se.get(mo.node.id)??0)!==1)continue;const Lp=vt(mo);Lp!==void 0&&Be.push({t:mo,subtree:Ue(mo.node.id),band:Lp})}const Ve=Be.find(Kt=>(ge.get(Kt.band)??Kt.band)===Fe);if(!Ve||Oe(Ve.subtree)===it||Ie(Ve.subtree)===it)continue;const Ft=Be.find(Kt=>Kt!==Ve&&Oe(Kt.subtree)===it);if(!Ft)continue;const cn=Ve.band,Yt=Ft.band;for(const Kt of Ve.subtree)vt(Kt)===cn&&zt.set(Kt.node.id,Yt);for(const Kt of Ft.subtree)vt(Kt)===Yt&&zt.set(Kt.node.id,cn);Me.add(me.node.id)}for(const me of w.nodes){if(!Jg(me.node.type))continue;const he=Re(me);if(Number.isNaN(he)||On(me.node.id))continue;let ge,Fe=!1,Ke;for(const it of w.flows){if(it.flow.source!==me.node.id)continue;const Be=N.get(it.flow.target);if(!Be||!Be.node.lane&&pt(Be)===void 0)continue;const Ve=Re(Be);Number.isNaN(Ve)||(Math.abs(Ve-he)<.5&&(Fe=!0),Ve>he?!ge||Ve>ge.row?ge={id:Be.node.id,row:Ve,count:1}:Ve===ge.row&&ge.count++:Ve<he&&Be.node.lane===me.node.lane&&!Nt.has(Be.node.id)&&(!Ke||Ve>Ke.row?Ke={op:Be,row:Ve,count:1}:Ve===Ke.row&&Ke.count++))}ge&&ge.count===1&&(se.get(ge.id)??0)===1&&!Me.has(me.node.id)&&ne.add(ge.id),!Fe&&Ke&&Ke.count===1&&(se.get(Ke.op.node.id)??0)===1&&!an.has(me.node.id)&&xe.set(Ke.op.node.id,{lane:me.node.lane,band:vt(me)})}for(const me of vn){const he=(iR=w.flows.find(ge=>ge.flow.target===me))==null?void 0:iR.flow.source;he&&!Me.has(he)&&ne.add(me)}}const ee=dT(w.flows.map(se=>se.flow),w.nodes.map(se=>se.node.id),se=>N.has(se));let ce=!1;const ye=new Set;let le=0;for(;le++<w.nodes.length+2;){for(let Me=0;Me<w.nodes.length+w.flows.length+2;Me++){let Ge=!1,Ue=!1;for(const Ie of w.flows){const Oe=Ie.flow;if(ye.has(Oe.id))continue;const me=f(Oe.source);if(!me)continue;const he=f(Oe.target),ge=N.get(Oe.target);if(!he&&ge&&!ce&&ee.has(Oe.id)){Ue=!0;continue}if(!he&&ge){const Fe=Zg(ge.node,ge.band),Ke=vt(ge);if(ge.node.lane||Ke!==void 0){const it=L(ge.node),Be=me,Ve=Be.x+(ve.get(Oe.source)??0)+Be.width+oe,Ft=xe.get(Oe.target);ne.has(Oe.target)&&j(it,Fe,Be.x+Be.width/2,Ft?Ft.lane:ge.node.lane,Ft?Ft.band:Ke);const cn=D(it,Fe,Ft?Ft.lane:ge.node.lane,Ft?Ft.band:Ke,ne.has(Oe.target)?Be.x+Be.width/2:Ve,Number.NaN,Ft||!At(Oe.target)?void 0:Be.y+Be.height/2),Yt=N.has(Oe.source)?cn:H(it,Fe,cn),Kt=n.createShape(Fe,Yt,it);ne.has(Oe.target)&&ve.set(Oe.target,Ve-(Kt.x+Kt.width/2)),n.connect(me,Kt,{type:"bpmn:SequenceFlow",businessObject:Tp(Oe)})}else s.append(me,Fe,{connection:{type:"bpmn:SequenceFlow",businessObject:Tp(Oe)}})}else if(he)n.connect(me,he,{type:"bpmn:SequenceFlow",businessObject:Tp(Oe)});else continue;ye.add(Oe.id),Ge=!0}if(!Ge){if(Ue&&!ce){ce=!0;continue}break}ce=!1}const se=w.nodes.filter(Me=>!f(Me.node.id));if(!se.length)break;const Re=se[0];{const Me=Zg(Re.node,Re.band),Ge=L(Re.node),Ue=pt(Re);n.createShape(Me,D(Ge,Me,Re.node.lane,Ue,O,I),Ge),!Re.node.lane&&Ue===void 0&&(I+=160)}}}const wS=new Map;for(const[x,w]of G){const S=f(x),O=f(w.flow.target);if(!(S!=null&&S.target)||!O)continue;const I=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};wS.set(x,{waypoints:S.waypoints.map(L=>({x:L.x,y:L.y})),label:I});const T=S.target,$=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(S,O,T,[$(O),$(T)]),n.layoutConnection(S,{waypoints:[]})}const _S=new Set;{const x=T=>T.endsWith("Task")||T==="bpmn:CallActivity"||T==="bpmn:SubProcess",w=T=>x(T)||T==="bpmn:EndEvent"||T==="bpmn:IntermediateThrowEvent"||T==="bpmn:IntermediateCatchEvent",S=T=>(T??[]).filter($=>$.type==="bpmn:SequenceFlow"),O=Gt(e,"sequenceFlow.update"),I=(T,$)=>{var L;return(L=y(T,$))==null?void 0:L.id};for(const T of O){if(T.source===void 0&&T.target===void 0||G.has(T.id))continue;const $=f(T.id);if(!$)continue;const L=T.source!==void 0?f(T.source):$.source,D=T.target!==void 0?f(T.target):$.target;if(!L||!D||L.id===D.id||N.has(L.id)||N.has(D.id)||!x(L.type)||!w(D.type)||L.parent!==D.parent||S(D.incoming).some(ee=>ee.id!==$.id)||S(D.outgoing).some(ee=>ee.id!==$.id)||O.some(ee=>ee!==T&&(ee.target===D.id||ee.source===D.id))||D.x>=L.x+L.width)continue;const H=L.parent,j=g(L),Q=L.x+L.width+oe,te=L.y+L.height/2,pe=D.y+D.height/2,ae=I(j,L)===I(j,D),ne=new Set([D.id]),xe=[ae?te:pe,pe].find(ee=>!W(H,D,Q,ee,ne));if(xe===void 0)continue;if(n.moveElements([D],{x:Q-(D.x+D.width/2),y:xe-pe}),j){const ee=D.x+D.width+$d-(j.x+j.width);ee>0&&hl(n,j,j.width+ee)}const ve=ee=>({x:ee.x+ee.width/2,y:ee.y+ee.height/2});n.reconnect($,L,D,[ve(L),ve(D)]),Math.abs(ve(L).y-ve(D).y)>1&&n.layoutConnection($,{waypoints:[]}),_S.add(T.id)}}const Mr=40,zF=10,Pp=x=>{const w=j=>j.kind==="label-over-line"||j.kind==="label-over-shape"||j.kind==="label-on-shared-segment"?j.edge===x.id:j.kind==="annotation-over-label"||j.kind==="pool-name-over-label"?j.label===x.id:!1,S=()=>new Map(ht(We(r)).filter(j=>!w(j)).map(j=>[lt(j),j])),O=S(),I=j=>[...j].filter(([Q])=>!O.has(Q)).map(([,Q])=>Q),T=j=>I(j).length<=[...O.keys()].filter(Q=>!j.has(Q)).length,$=x.waypoints.map(j=>({x:j.x,y:j.y})),L=x.label,D=L&&{x:L.x,y:L.y};n.layoutConnection(x,{waypoints:[]});const H=S();if(!T(H)){if(I(H).every(j=>j.kind==="edge-crosses-shape"&&j.edge===x.id)){const j=We(r),Q=j.edges.find(ne=>ne.id===x.id),te=Ln(j),pe=Q?Ot(Q,te):[],ae=Q&&pe.length&&!pe.every(ne=>ne.type==="bpmn:TextAnnotation")?ol(Q,te,xs(x),j.edges):null;if(ae&&(n.updateWaypoints(x,ae),T(S())))return}n.updateWaypoints(x,$),L&&D&&(L.x!==D.x||L.y!==D.y)&&n.moveElements([L],{x:D.x-L.x,y:D.y-L.y})}},Qg=5,$i=10,ES=200,kc=new Set([...Y.map(x=>x.flow.id),...E.map(x=>x.flow.id),...Gt(e,"sequenceFlow.update").map(x=>x.id),...Gt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),GF=(x,w,S,O,I,T)=>{const $=new Set(x.map(ee=>ee.id)),L=Math.min(...x.map(ee=>ee.x))+w-$i,D=Math.max(...x.map(ee=>ee.x+ee.width))+w+ES+$i,H=Math.min(...x.map(ee=>ee.y+Math.min(0,...S)))-$i,j=Math.max(...x.map(ee=>ee.y+ee.height+Math.max(0,...S)))+$i,Q=r.getAll().filter(ee=>{if(ee.type!=="bpmn:SequenceFlow"&&ee.type!=="bpmn:MessageFlow")return!1;const ce=ee;return kc.has(ce.id)||!ce.waypoints||ce.waypoints.length<2||[ce.source,ce.target].some(le=>!le||$.has(le.id)||le.x>=O)?!1:ce.waypoints.some((le,se)=>{const Re=ce.waypoints[se+1];return!!Re&&Math.max(le.x,Re.x)>=L&&Math.min(le.x,Re.x)<=D&&Math.max(le.y,Re.y)>=H&&Math.min(le.y,Re.y)<=j})});if(!Q.length)return 0;const te=ee=>{const ce=new Map;for(const ye of x)for(const le of S){const se={id:ye.id,type:ye.type,x:ye.x+w+ee,y:ye.y+le,width:ye.width,height:ye.height};for(const Re of Q){let Me=1/0;for(let Ue=0;Ue+1<Re.waypoints.length;Ue++)Me=Math.min(Me,wo(Re.waypoints[Ue],Re.waypoints[Ue+1],se));const Ge=`${Re.id}|${ye.id}`;ce.set(Ge,Math.min(ce.get(Ge)??1/0,Me))}}return ce},pe=[...te(0)].filter(([,ee])=>ee<=Qg).map(([ee])=>ee);if(!pe.length)return 0;let ae=0;for(let ee=1;ee<=ES;ee++){const ce=te(ee);if([...ce.values()].every(ye=>ye>Qg)&&pe.every(ye=>(ce.get(ye)??1/0)>=$i)){ae=ee;break}}if(!ae)return 0;const ne=Math.min(...x.map(ee=>ee.x))+w+ae,xe=new Set(pe.map(ee=>ee.slice(0,ee.indexOf("|"))));return Q.some(ee=>ee.type==="bpmn:SequenceFlow"&&xe.has(ee.id)&&ee.waypoints.some((ce,ye)=>{const le=ee.waypoints[ye+1];if(!le||Math.min(ce.y,le.y)>T||Math.max(ce.y,le.y)<T||ce.y===le.y)return!1;const se=ce.x+(T-ce.y)*(le.x-ce.x)/(le.y-ce.y);return se>I&&se<ne}))?0:ae},Fo=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.target;if(L.flow.source!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},VF=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.source;if(L.flow.target!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},Fi=30,wi=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",os=(x,w)=>hl(n,x,w),jo=(x,w,S=!1)=>{const O=new Set(x.flatMap(D=>D.subtree.map(H=>H.id)));for(const D of x){const H=(D.pool.children??[]).filter(wi).filter(Q=>!O.has(Q.id));if(D.subtree.some(Q=>H.some(te=>Q.x+w<te.x+te.width+Fi&&Q.x+w+Q.width+Fi>te.x&&Q.y<te.y+te.height&&Q.y+Q.height>te.y)))return null}const I=x.map(D=>D.pool.width),T=S?r.filter(D=>Array.isArray(D.waypoints)).map(D=>({c:D,wps:D.waypoints.map(H=>({x:H.x,y:H.y}))})):[],$=r.filter(D=>D.type==="label").map(D=>({label:D,x:D.x,y:D.y}));n.moveElements(x.flatMap(D=>D.subtree),{x:w,y:0});const L=x.map(D=>{const j=Math.max(...D.subtree.map(Q=>Q.x+Q.width))+$d-(D.pool.x+D.pool.width);return j>0&&os(D.pool,D.pool.width+j),j});return()=>{n.moveElements(x.flatMap(D=>D.subtree),{x:-w,y:0}),x.forEach((D,H)=>{L[H]>0&&os(D.pool,I[H])});for(const{c:D,wps:H}of T){const j=D.waypoints??[];j.length===H.length&&j.every((te,pe)=>Math.abs(te.x-H[pe].x)<=.5&&Math.abs(te.y-H[pe].y)<=.5)||n.updateWaypoints(D,H.map(te=>({x:te.x,y:te.y})))}for(let D=0;D<3;D++){let H=0;for(const j of $){const Q=j.x-j.label.x,te=j.y-j.label.y;Math.abs(Q)<=.5&&Math.abs(te)<=.5||(n.moveElements([j.label],{x:Q,y:te}),H++)}if(!H)break}}},em=x=>{var I,T;const w=new Map,S=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const L=$;(L.children??[]).length||(w.set(L.id,L),S.set(L.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$,D=(I=L.source)==null?void 0:I.id,H=(T=L.target)==null?void 0:T.id;D&&H&&S.has(D)&&S.get(D).push(H),D&&H&&S.has(H)&&S.get(H).push(D)}const O=[];for(const[$,L]of S)L.length&&L.every(D=>x.has(D))&&O.push(w.get($));return O},SS=(x,w)=>{if(!x.length)return null;const S=new Set(x.map(j=>j.id)),O=r.getAll().filter(j=>j.type==="bpmn:Participant"&&!S.has(j.id)),I=Math.min(...O.filter(j=>(j.children??[]).length>0).map(j=>j.x)),T=new Set(x.filter(j=>Math.abs(j.x-I)<=2).map(j=>j.id));if(x.some(j=>{const Q=T.has(j.id)?j.x:j.x+w,te=T.has(j.id)?j.width+w:j.width;return O.some(pe=>Q<pe.x+pe.width+Fi&&Q+te+Fi>pe.x&&j.y<pe.y+pe.height&&j.y+j.height>pe.y)}))return null;const L=r.filter(j=>j.type==="label").map(j=>({label:j,x:j.x,y:j.y})),D=x.filter(j=>!T.has(j.id)),H=x.filter(j=>T.has(j.id)).map(j=>({pool:j,was:{x:j.x,y:j.y,width:j.width,height:j.height}}));D.length&&n.moveElements(D,{x:w,y:0});for(const{pool:j,was:Q}of H)n.resizeShape(j,{...Q,width:Q.width+w});return()=>{for(const{pool:j,was:Q}of H)n.resizeShape(j,Q);D.length&&n.moveElements(D,{x:-w,y:0});for(let j=0;j<3;j++){let Q=0;for(const te of L){const pe=te.x-te.label.x,ae=te.y-te.label.y;Math.abs(pe)<=.5&&Math.abs(ae)<=.5||(n.moveElements([te.label],{x:pe,y:ae}),Q++)}if(!Q)break}}},RS=(x,w,S)=>{const O=S.x+S.width/2,I=w.y>S.y,T=I?S.y+S.height:S.y,$=I?w.y:w.y+w.height,L=x.source===w?[{x:O,y:$},{x:O,y:T}]:[{x:O,y:T},{x:O,y:$}],D=We(r),H={...D.edges.find(j=>j.id===x.id),waypoints:L};return Ot(H,Ln(D)).length?!1:(n.updateWaypoints(x,L),!0)},WF=()=>{const x=r.filter($=>$.type==="bpmn:Participant"),w=Math.min(...x.filter($=>($.children??[]).length>0).map($=>$.x)),S=$=>h.some(L=>L.participant.id===$.id),O=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-w)<=2&&!S($),I=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!S($),T=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$;if((L.waypoints??[]).length!==2)continue;const D=[L.source,L.target].find(Q=>O(Q)||I(Q)),H=D===L.source?L.target:L.source;if(!D||!H||H.type==="bpmn:Participant")continue;const j=H.x+H.width/2;I(D)&&(j<D.x||j>D.x+D.width)||T.add(L.id)}return T},UF=x=>{var S;const w=new Map;for(const O of x){const I=r.get(O);if(!I||(I.waypoints??[]).length===2)continue;const T=((S=I.source)==null?void 0:S.type)==="bpmn:Participant"?I.source:I.target,$=T===I.source?I.target:I.source;if($.x+$.width/2<=T.x+T.width)continue;const L=w.get(T.id)??{pool:T,msgs:[]};L.msgs.push({conn:I,other:$}),w.set(T.id,L)}for(const{pool:O,msgs:I}of w.values()){const T=Math.max(...I.map(({other:ae})=>ae.x+ae.width/2))+Nd;if(r.getAll().some(ae=>{if(ae.type!=="bpmn:Participant"||ae.id===O.id)return!1;const ne=ae;return O.x<ne.x+ne.width+Fi&&T+Fi>ne.x&&O.y<ne.y+ne.height&&O.y+O.height>ne.y}))continue;const L={x:O.x,y:O.y,width:O.width,height:O.height},D=[...O.incoming??[],...O.outgoing??[]],H=D.map(ae=>({c:ae,wps:(ae.waypoints??[]).map(ne=>({x:ne.x,y:ne.y}))})),j=D.flatMap(ae=>{const ne=ae.label;return ne?[{label:ne,x:ne.x,y:ne.y}]:[]}),Q=Cr();os(O,T-O.x);const te=I.filter(({conn:ae,other:ne})=>RS(ae,O,ne)).length,pe=Cr();if(!(te>0&&pe.messages>Q.messages&&pe.lines>=Q.lines)){os(O,L.width);for(const{c:ae,wps:ne}of H){const xe=ae.waypoints??[];xe.length===ne.length&&xe.every((ee,ce)=>Math.abs(ee.x-ne[ce].x)<=.5&&Math.abs(ee.y-ne[ce].y)<=.5)||n.updateWaypoints(ae,ne.map(ee=>({x:ee.x,y:ee.y})))}for(let ae=0;ae<3;ae++){let ne=0;for(const xe of j){const ve=xe.x-xe.label.x,ee=xe.y-xe.label.y;Math.abs(ve)<=.5&&Math.abs(ee)<=.5||(n.moveElements([xe.label],{x:ve,y:ee}),ne++)}if(!ne)break}}}},MS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:DataInputAssociation"&&w.type!=="bpmn:DataOutputAssociation")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},CS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:Association")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},qF=x=>{const w=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const O=S;if(x.has(O.id))continue;const T=[...O.incoming??[],...O.outgoing??[]].filter(D=>D.type==="bpmn:Association").map(D=>D.source===O?D.target:D.source);if(!T.length||T.some(D=>D===void 0))continue;const $=D=>{if(!("waypoints"in D&&D.waypoints))return[D.id];const H=D,j=[H.source,H.target];return j.some(Q=>!Q)?[]:j.map(Q=>Q.id)},L=T.flatMap(D=>$(D));L.length&&L.every(D=>x.has(D))&&w.push(O)}return w},AS=()=>ht(We(r)).filter(x=>x.kind==="edge-crosses-shape").length,TS=x=>{const w=(x.children??[]).filter(wi);let S=0;for(let O=0;O<w.length;O++)for(let I=O+1;I<w.length;I++){const T=w[O],$=w[I];T.x<$.x+$.width&&T.x+T.width>$.x&&T.y<$.y+$.height&&T.y+T.height>$.y&&S++}return S},Cr=()=>{const x=We(r),w=S=>S.length>=2&&(S.every(O=>Math.abs(O.x-S[0].x)<.01)||S.every(O=>Math.abs(O.y-S[0].y)<.01));return{messages:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length,lines:x.edges.filter(S=>w(S.waypoints)).length}},PS=x=>{const w=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const I=O;if(!I.waypoints||I.waypoints.length!==2)continue;const T=I.source,$=I.target;if(!T||!$)continue;const L=x.has(T.id);if(L===x.has($.id))continue;const D=L?$:T,H=g(D);if(!H||x.has(D.id))continue;const j=w.get(H.id);j?D.x<j.minX&&(j.minX=D.x):w.set(H.id,{pool:H,minX:D.x})}const S=[];for(const{pool:O,minX:I}of w.values()){const T=(O.children??[]).filter($=>wi($)&&!x.has($.id)&&$.x>=I);T.length&&S.push({subtree:T,pool:O})}return S},YF=(x,w,S)=>{const O=new Map(w.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),I=new Set(x);for(const $ of w)for(const L of $.subtree)I.add(L.id);let T=!1;for(;;){let $=0;for(const L of PS(I)){if(L.pool===S)continue;const D=O.get(L.pool.id);D?D.subtree.push(...L.subtree):O.set(L.pool.id,{subtree:[...L.subtree],pool:L.pool});for(const H of L.subtree)I.add(H.id);$+=L.subtree.length}if(!$)break;T=!0}return T?[...O.values()]:null},KF=(x,w)=>{const S=new Map;for(const I of r.getAll()){if(I.type!=="bpmn:DataInputAssociation"&&I.type!=="bpmn:DataOutputAssociation")continue;const T=I,$=T.waypoints;if(!$||$.length<2||!$.every(pe=>Math.abs(pe.x-$[0].x)<1))continue;const L=T.source,D=T.target;if(!L||!D)continue;const H=x.has(L.id);if(H===x.has(D.id))continue;const j=H?D:L,Q=g(j);if(!Q||Q===w||Q===g(H?L:D))continue;const te=S.get(Q.id);te?j.x<te.minX&&(te.minX=j.x):S.set(Q.id,{pool:Q,minX:j.x})}const O=[];for(const{pool:I,minX:T}of S.values()){const $=(I.children??[]).filter(L=>wi(L)&&!x.has(L.id)&&L.x>=T);$.length&&O.push({subtree:$,pool:I})}return O},kS=x=>{const w=We(r),S=w.shapes.filter(I=>x.has(I.id)),O=new Set;for(const I of w.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const T of Ot(I,S))O.add(`${I.id}|${T.id}`);return O},tm=new Map,XF=Gt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const w=G.get(x.id);return w?[{id:x.id,target:w.flow.target,source:w.flow.source}]:[]});for(const x of XF){if(x.target===void 0)continue;const w=N.get(x.target);if(!w)continue;const S=f(x.target),O=f(x.id);if(!S||!O)continue;const I=x.source!==void 0?f(x.source):O.source,T=O.target;if(!I||!T||T.id===S.id)continue;const $=wS.get(O.id)??{waypoints:O.waypoints,label:O.label},L=$.waypoints&&$.waypoints.length>=3&&Math.abs($.waypoints[0].x-$.waypoints[1].x)<1&&Math.abs($.waypoints[0].y-$.waypoints[1].y)>1?{x:$.waypoints[0].x,y:$.waypoints[0].y}:void 0,D=L?$.waypoints[1].y:void 0,H=L&&$.label?{x:$.label.x,y:$.label.y}:void 0,j=H&&$.label&&Math.abs(H.y+$.label.height/2-D)<=z/5&&H.x+$.label.width>L.x?H.x+$.label.width+6:void 0,Q=(I.outgoing??[]).filter(ke=>ke.type==="bpmn:SequenceFlow"&&ke.id!==O.id&&ke.target&&!kc.has(ke.id)),te=new Set(Q.map(ke=>ke.target.id)),pe=ke=>{const Tt={type:"bpmn:Task",x:ke.x+2,y:ke.y+2,width:ke.width-4,height:ke.height-4};return Q.find(Et=>(Et.waypoints??[]).some((en,je)=>!!Et.waypoints[je+1]&&wo(en,Et.waypoints[je+1],Tt)===0))},ae=Fo(x.target),ne=new Set(ae.map(ke=>ke.id)),xe=Yg.has(x.target)?{autoResize:!1}:void 0,ve=Math.min(...ae.map(ke=>ke.x)),ee=Math.max(...ae.map(ke=>ke.x+ke.width)),ce=I.x+I.width,ye=T.x+T.width<=I.x,le=(()=>{if(!ye)return;const ke=g(S),Tt=((ke==null?void 0:ke.children)??[]).filter(ze=>wi(ze)&&!ne.has(ze.id)&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:Participant"),Et=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],en=r.getAll().filter(ze=>{if(!Et.includes(ze.type))return!1;const jt=ze;return jt.id===O.id||kc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Dt=>!Dt||ne.has(Dt.id))}),je=(ze,jt)=>ae.every(Dt=>{var la;const Rt={id:Dt.id,type:Dt.type,x:Dt.x+ze,y:Dt.y+jt,width:Dt.width,height:Dt.height};return ke&&(Rt.x<ke.x||Rt.x+Rt.width>ke.x+ke.width||Rt.y<ke.y||Rt.y+Rt.height>ke.y+ke.height)||!Cp((la=N.get(Dt.id))==null?void 0:la.node.lane,Dt,Dt.y+jt+Dt.height/2)||Tt.some(Jn=>Rt.x<Jn.x+Jn.width+$i&&Rt.x+Rt.width+$i>Jn.x&&Rt.y<Jn.y+Jn.height+$i&&Rt.y+Rt.height+$i>Jn.y)?!1:en.every(Jn=>{for(let vo=0;vo+1<Jn.waypoints.length;vo++)if(wo(Jn.waypoints[vo],Jn.waypoints[vo+1],Rt)<$i)return!1;return!0})}),Je=I.x+I.width/2,bt=I.y+I.height/2,rt=$.waypoints??[],kt=rt.length>=2&&Math.abs(rt[0].y-rt[1].y)<1&&rt[1].x<rt[0].x;return[...D!==void 0?[{cx:Je,cy:D}]:[],...kt?[{cx:I.x-Mr-S.width/2,cy:rt[0].y}]:[],{cx:Je,cy:bt+z},{cx:Je,cy:bt-z}].find(ze=>je(ze.cx-(S.x+S.width/2),ze.cy-(S.y+S.height/2)))})(),se=ye&&!le?ce:T.x,Re=(()=>{var bt;if(L||ye)return 0;const ke=$.label,Tt=((bt=O.businessObject)==null?void 0:bt.name)??"";if(!ke||ke.width==null||!Tt.trim())return 0;const Et=ce+Mr,en=I.y+I.height/2-S.height/2;if(Math.min(ke.y+ke.height,en+S.height)-Math.max(ke.y,en)<3||ke.x+ke.width-Et<3)return 0;const Je=ke.x+ke.width+zF-Et;return Je<=S.width?Je:0})();Re>0&&u.add(O.id);const Me=S.y+S.height/2,Ge=GF(ae,ce+Mr+Re-ve,[0,I.y+I.height/2-Me,T.y+T.height/2-Me],se,ce,I.y+I.height/2),Ue=ce+Mr+Re+Ge,Ie=(()=>{if(j===void 0)return 0;const ke=ce+Mr,Tt=I.y+I.height/2-S.height/2,Et={x:ke,y:Tt,width:ee-ve,height:S.height},en=g(I);return((en==null?void 0:en.children)??[]).some(Je=>wi(Je)&&!ne.has(Je.id)&&Je.id!==I.id&&Je.id!==T.id&&Je.type!=="bpmn:Group"&&Je.type!=="bpmn:Participant"&&Je.x<Et.x+Et.width&&Je.x+Je.width>Et.x&&Je.y<Et.y+Et.height&&Je.y+Je.height>Et.y)||pe(Et)?Math.max(0,j-ke):0})(),Oe=le?0:ee-ve+Mr*2+Ge+Ie+Re-(ye?0:T.x-ce);let me=[];if(Oe>0){const ke=g(S),Tt=(ke==null?void 0:ke.children)??[],Et=rt=>rt.type==="bpmn:Lane";me=(()=>{const rt=new Set;for(const Xe of Tt)wi(Xe)&&!ne.has(Xe.id)&&Xe.id!==I.id&&Xe.x>=se&&rt.add(Xe.id);const kt=[];for(const Xe of Tt){if(Xe.type!=="bpmn:DataStoreReference"&&Xe.type!=="bpmn:DataObjectReference")continue;const ze=Xe,Dt=[...ze.incoming??[],...ze.outgoing??[]].filter(Rt=>Rt.type==="bpmn:DataInputAssociation"||Rt.type==="bpmn:DataOutputAssociation").map(Rt=>Rt.source===ze?Rt.target:Rt.source);Dt.length&&Dt.every(Rt=>Rt!==void 0&&rt.has(Rt.id))&&kt.push(ze)}return kt})();const je=Tt.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&!Et(rt)&&rt.type!=="label"&&!ne.has(rt.id)&&rt.id!==I.id&&rt.x>=se),Je=je.flatMap(rt=>rt.labels??[]),bt=ke?[ke,...Tt.filter(rt=>Et(rt))]:[];if(je.length){const rt=new Set(je.map(st=>st.id)),kt=PS(rt),Xe=kt.length?YF(rt,kt,ke):null,ze=st=>{const Mt=new Set(rt);for(const Ht of st)for(const Ho of Ht.subtree)Mt.add(Ho.id);return qF(Mt)},jt=ze(kt),Dt=Xe?ze(Xe):jt,Rt=em(rt),la=new Set(rt);for(const st of kt)for(const Mt of st.subtree)la.add(Mt.id);const Jn=kt.length?em(la):Rt,vo=(()=>{if(!Xe)return[];const st=new Set(rt);for(const Mt of Xe)for(const Ht of Mt.subtree)st.add(Ht.id);return em(st)})(),cs=Xe??kt,ua=(()=>{const st=new Set(rt);for(const Mt of cs)for(const Ht of Mt.subtree)st.add(Ht.id);return KF(st,ke)})(),pm=ua.length?ze([...cs,...ua]):jt,Ki=new Set([...je,...bt].map(st=>st.id)),St=Tt.filter(st=>{const Mt=st.labelTarget;return st.type==="label"&&!!Mt&&"waypoints"in Mt&&!!Mt.source&&!!Mt.target&&Ki.has(Mt.source.id)&&Ki.has(Mt.target.id)}),Cn=WF();n.createSpace([...je,...Je,...St],bt,{x:Oe,y:0},"e",se-1);const tn=(st,Mt,Ht)=>{const Ho=Cr(),Ip=Ht?kS(Ht):null,Bp=jo(st,Oe,!!Ht);if(!Bp)return!1;const Ic=Mt.length?SS(Mt,Oe):null,Np=Cr(),nn=!!Ht&&!!Ip&&[...kS(Ht)].some(da=>!Ip.has(da));return Np.messages>Ho.messages&&Np.lines>=Ho.lines&&!nn?!0:(Ic==null||Ic(),Bp(),!1)},yi=ua.length>0&&tn([...cs,...ua],Xe?vo:Jn,new Set(ua.flatMap(st=>st.subtree.map(Mt=>Mt.id)))),pa=!yi&&Xe?tn(Xe,vo):!1;let xo=yi||pa;!xo&&kt.length&&(xo=tn(kt,Jn));const ls=yi?pm:pa?Dt:jt;if(!xo){for(const st of kt){const Mt=Cr(),Ht=jo([st],Oe);if(!Ht)continue;const Ho=Cr();(Ho.messages<=Mt.messages||Ho.lines<Mt.lines)&&Ht()}if(Rt.length){const st=Cr(),Mt=SS(Rt,Oe);if(Mt){const Ht=Cr();(Ht.messages<=st.messages||Ht.lines<st.lines)&&Mt()}}}if(UF(Cn),ls.length){const st=()=>new Set(ht(We(r)).map(Ht=>lt(Ht))),Mt=Ht=>{const Ho=CS(),Ip=st(),Bp=Ht.map(nn=>({a:nn,x:nn.x,y:nn.y})),Ic=r.filter(nn=>nn.type==="label").map(nn=>({label:nn,x:nn.x,y:nn.y}));n.moveElements(Ht,{x:Oe,y:0});const Np=[...st()].filter(nn=>!Ip.has(nn));if(CS()<Ho&&Np.length===0)return!0;for(const{a:nn,x:da,y:Bc}of Bp)(nn.x!==da||nn.y!==Bc)&&n.moveElements([nn],{x:da-nn.x,y:Bc-nn.y});for(const nn of Ic){const da=nn.x-nn.label.x,Bc=nn.y-nn.label.y;(da!==0||Bc!==0)&&n.moveElements([nn.label],{x:da,y:Bc})}return!1};if(!Mt(ls)&&ls.length>1)for(const Ht of ls)Mt([Ht])}}}const he=w.node.lane!==void 0?f(w.node.lane):w.node.participant!==void 0?f(w.node.participant):void 0,ge=ke=>{if(!he)return!0;const Tt=ke.y+ke.height/2;return Tt>=he.y&&Tt<=he.y+he.height},Fe=!ge(I)&&ge(T),Ke=ke=>ke.y+ke.height/2,it=()=>{const ke=I.x+I.width,Tt=T.x,Et=Ke(T)-S.height/2,en=Ke(T)+S.height/2;return!r.getAll().some(je=>wi(je)&&je.type!=="bpmn:Participant"&&je.type!=="bpmn:Group"&&je.type!=="bpmn:TextAnnotation"&&je.id!==I.id&&je.id!==T.id&&je.id!==S.id&&je.x<Tt&&je.x+je.width>ke&&je.y<en&&je.y+je.height>Et)},Be=!Fe&&w.band!==void 0&&ge(T)&&!qn(w.node.lane,w.node.participant,w.band,Ke(I))&&qn(w.node.lane,w.node.participant,w.band,Ke(T))&&T.x>=I.x+I.width&&it(),Ve=Fe||Be?T:I,Ft=Ve.y+Ve.height/2,cn=Ft-(S.y+S.height/2),Yt=w.band!==void 0,Kt=Yt?[S]:ae,mo=(w.band===void 0||qn(w.node.lane,w.node.participant,w.band,Ft))&&At(x.target)&&Kt.every(ke=>{var Tt;return Cp((Tt=N.get(ke.id))==null?void 0:Tt.node.lane,ke,ke.y+ke.height/2+cn)}),Lp=ke=>Math.abs(ke.y+ke.height/2-(S.y+S.height/2))<=z/2;if(mo&&Yt){const ke=Math.abs(cn)<=z/2?ae.filter(je=>je.id!==S.id&&Lp(je)):[],Tt=S.y+S.height/2,en=w.band!==void 0&&!qn(w.node.lane,w.node.participant,w.band,Tt)?ae.filter(je=>{var Je,bt;return je.id!==S.id&&!ke.includes(je)&&((Je=N.get(je.id))==null?void 0:Je.band)===w.band&&((bt=N.get(je.id))==null?void 0:bt.node.lane)===w.node.lane&&(Math.abs(je.y+je.height/2-Tt)<=z/2||qn(w.node.lane,w.node.participant,w.band,je.y+je.height/2))}).map(je=>({t:je,dy:Ft-(je.y+je.height/2)})).filter(({dy:je})=>je!==0):[];if(n.moveElements(ae,{x:Ue-ve,y:0},void 0,xe),n.moveElements([S],{x:0,y:cn},void 0,xe),ke.length){const je=()=>new Set(ht(We(r)).map(ze=>lt(ze))),Je=je(),bt=r.filter(ze=>ze.type==="label").map(ze=>({label:ze,x:ze.x,y:ze.y}));n.moveElements(ke,{x:0,y:cn});const rt=je(),kt=[...rt].filter(ze=>!Je.has(ze)).length,Xe=[...Je].filter(ze=>!rt.has(ze)).length;if(kt>Xe){n.moveElements(ke,{x:0,y:-cn});for(const ze of bt){const jt=ze.x-ze.label.x,Dt=ze.y-ze.label.y;(jt!==0||Dt!==0)&&n.moveElements([ze.label],{x:jt,y:Dt})}}}if(en.length){const je=new Set(ae.map(Je=>Je.id));for(const{t:Je,dy:bt}of en)W(Je.parent,Je,Je.x+Je.width/2,Je.y+Je.height/2+bt,je)||n.moveElements([Je],{x:0,y:bt})}}else n.moveElements(ae,{x:Ue-ve,y:mo?cn:0},void 0,xe);const Yi=g(S);if(!mo&&w.node.lane===void 0&&w.band!==void 0&&Yi){const ke=Yi.y+V+ii(`pool:${w.node.participant??""}`,w.band)*z,Tt=ke-(S.y+S.height/2);Tt!==0&&!W(Yi,S,S.x+S.width/2,ke,ne)&&n.moveElements([S],{x:0,y:Tt},void 0,xe)}if(le)n.moveElements(ae,{x:le.cx-(S.x+S.width/2),y:le.cy-(S.y+S.height/2)},void 0,xe);else if(Yi){const ke=(Yi.children??[]).filter(je=>wi(je)&&!ne.has(je.id)&&je.type!=="bpmn:Group"&&je.type!=="bpmn:Participant"),Tt=(je,Je,bt,rt,kt)=>je.x+Je<kt.x+kt.width+rt&&je.x+Je+je.width+rt>kt.x&&je.y+bt<kt.y+kt.height+rt&&je.y+bt+je.height+rt>kt.y,Et=ke.find(je=>Tt(S,0,0,0,je)),en=Et?void 0:pe(S);if(Et||en){const je=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Je=r.getAll().filter(St=>{if(!je.includes(St.type))return!1;const Cn=St;return kc.has(Cn.id)||!Cn.waypoints||Cn.waypoints.length<2?!1:![Cn.source,Cn.target].some(tn=>!tn||ne.has(tn.id))}),bt=(St,Cn,tn)=>{var yi;return Cp((yi=N.get(St.id))==null?void 0:yi.node.lane,St,St.y+tn+St.height/2)&&St.x+Cn>=Yi.x&&St.x+Cn+St.width<=Yi.x+Yi.width&&St.y+tn>=Yi.y&&St.y+tn+St.height<=Yi.y+Yi.height},rt=(St,Cn)=>ae.every(tn=>bt(tn,St,Cn)&&!ke.some(yi=>Tt(tn,St,Cn,$i,yi))&&Je.every(yi=>{const pa={id:tn.id,type:tn.type,x:tn.x+St,y:tn.y+Cn,width:tn.width,height:tn.height};for(let xo=0;xo+1<yi.waypoints.length;xo++)if(wo(yi.waypoints[xo],yi.waypoints[xo+1],pa)<$i)return!1;return!0})),kt=S.y+S.height/2,Xe=[D,T.y+T.height/2].filter(St=>St!==void 0&&Math.abs(St-kt)>=1),ze=Et&&te.has(Et.id)?Et:en==null?void 0:en.target,jt=ze?ze.x-S.x:0,Dt=Math.max(...ae.map(St=>St.x+St.width)),Rt=[...jt!==0?[jt]:[],...Ge!==0?[-Ge]:[],0],la=j===void 0?[]:Rt.map(St=>Math.max(St,j-S.x)),Jn=St=>Dt+St+Mr<=T.x,vo=[...new Set([...la,...Rt])].filter(Jn),cs=Et&&te.has(Et.id)?[Et.x+Et.width+Mr-S.x]:[],ua=j===void 0?[]:cs.map(St=>Math.max(St,j-S.x)),pm=[...new Set([...ua,...cs])].filter(St=>Jn(St)&&!vo.includes(St));let Ki;for(const St of[vo,pm]){for(const Cn of Xe){for(const tn of St)if(rt(tn,Cn-kt)){Ki={dx:tn,dy:Cn-kt};break}if(Ki)break}if(Ki)break}if(Ki){const St=st=>{const Mt=st;return[Mt.edge,Mt.other,...Array.isArray(Mt.edges)?Mt.edges:[]].some(Ht=>typeof Ht=="string"&&kc.has(Ht))},Cn=()=>new Set(ht(We(r)).filter(st=>!St(st)).map(st=>lt(st))),tn=Cn(),yi=r.filter(st=>st.type==="label").map(st=>({label:st,x:st.x,y:st.y}));n.moveElements(ae,{x:Ki.dx,y:Ki.dy},void 0,xe);const pa=Cn(),xo=[...pa].filter(st=>!tn.has(st)).length,ls=[...tn].filter(st=>!pa.has(st)).length;if(xo>ls){n.moveElements(ae,{x:-Ki.dx,y:-Ki.dy},void 0,xe);for(const st of yi){const Mt=st.x-st.label.x,Ht=st.y-st.label.y;(Mt!==0||Ht!==0)&&n.moveElements([st.label],{x:Mt,y:Ht})}}else L&&tm.set(O.id,{exit:L,channelY:D,label:H})}}}{const ke=new Set(ae.map(Je=>Je.id)),Tt=new Set(Y.map(Je=>Je.flow.id)),Et=20,en=Je=>{const bt=Je.source,rt=Je.target,kt=Math.min(bt.x,rt.x)-Et,Xe=Math.max(bt.x+bt.width,rt.x+rt.width)+Et,ze=Math.min(bt.y,rt.y)-Et,jt=Math.max(bt.y+bt.height,rt.y+rt.height)+Et;return Je.waypoints.some(Dt=>Dt.x<kt||Dt.x>Xe||Dt.y<ze||Dt.y>jt)},je=new Map;for(const Je of ae)for(const bt of[...Je.incoming??[],...Je.outgoing??[]])(G.has(bt.id)||bt.id!==x.id&&Tt.has(bt.id))&&!(ke.has(bt.source.id)&&ke.has(bt.target.id))&&je.set(bt.id,bt);for(const Je of je.values())en(Je)&&Pp(Je)}const yo=me.length?g(me[0]):void 0;if(yo){const ke={assoc:MS(),overlaps:TS(yo),crosses:AS()},Tt=me.map(Xe=>({st:Xe,x:Xe.x})),Et=r.filter(Xe=>Xe.type==="label").map(Xe=>({label:Xe,x:Xe.x,y:Xe.y})),en=Math.min(...me.flatMap(Xe=>[...Xe.incoming??[],...Xe.outgoing??[]].filter(ze=>ze.type==="bpmn:DataInputAssociation"||ze.type==="bpmn:DataOutputAssociation").map(ze=>(ze.source===Xe?ze.target:ze.source).x))),je=new Set(me.map(Xe=>Xe.id)),Je=(yo.children??[]).filter(wi).filter(Xe=>!je.has(Xe.id));let bt=en;for(const Xe of[...me].sort((ze,jt)=>ze.x-jt.x)){let ze=bt;for(let jt=0;jt<100;jt++){const Dt=Je.find(Rt=>ze<Rt.x+Rt.width+Fi&&ze+Xe.width+Fi>Rt.x&&Xe.y<Rt.y+Rt.height&&Xe.y+Xe.height>Rt.y);if(!Dt)break;ze=Dt.x+Dt.width+Fi}ze!==Xe.x&&n.moveElements([Xe],{x:ze-Xe.x,y:0}),bt=ze+Xe.width+Fi}const rt=bt+150-(yo.x+yo.width);rt>0&&os(yo,yo.width+rt);const kt={assoc:MS(),overlaps:TS(yo),crosses:AS()};if(kt.assoc>=ke.assoc||kt.overlaps>ke.overlaps||kt.crosses>ke.crosses){for(const{st:Xe,x:ze}of Tt)Xe.x!==ze&&n.moveElements([Xe],{x:ze-Xe.x,y:0});rt>0&&os(yo,yo.width-rt);for(const Xe of Et){const ze=Xe.x-Xe.label.x,jt=Xe.y-Xe.label.y;(ze!==0||jt!==0)&&n.moveElements([Xe.label],{x:ze,y:jt})}}}}for(const[x,w]of Yg){const S=f(x);if(!S)continue;const O=w.container,I=Math.abs(S.y+S.height/2-O.y-w.relCy)>=.5,T=S.label,$=Math.min(S.y,T&&!T.hidden?T.y:S.y),L=Math.max(S.y+S.height,T&&!T.hidden?T.y+T.height:0);if(I&&$>=O.y&&L<=O.y+O.height)continue;const D=S.y;w.grow(),S.y!==D&&n.moveElements([S],{x:0,y:D-S.y},void 0,{autoResize:!1})}const OS=(x,w)=>{const S=w.target===x,O=m(w.source),I=m(w.target),T=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,I,w.id?{type:T,businessObject:i.create(T,{id:w.id})}:{type:T})},DS=x=>{for(const w of h){if(!w.participant.blackBox)continue;const S=f(w.participant.id);if(!S)continue;const O=[];for(const T of E){const $=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,L=$?f($):void 0;L&&typeof L.x=="number"&&L.type!=="bpmn:Participant"&&O.push(L)}if(!O.length)continue;if(!x&&w.order===void 0){const T=(()=>{var L;const $=new Map;for(const D of O){const H=g(D);if(!H)continue;const j=$.get(H.id);j?j.n+=1:$.set(H.id,{shape:H,n:1})}return(L=[...$.values()].sort((D,H)=>H.n-D.n)[0])==null?void 0:L.shape})();if(T){const $=H=>H.reduce((j,Q)=>j+Q,0)/H.length,L=$(O.map(H=>H.y+H.height/2))<T.y+T.height/2,D=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==w.participant.id&&H.id!==T.id).filter(H=>L?H.y+H.height<=T.y+5:H.y>=T.y+T.height-5);if(D.length){const H=[...D.reduce((ye,le)=>ye.set(le.y,(ye.get(le.y)??0)+1),new Map)].sort((ye,le)=>le[1]-ye[1]||(L?le[0]-ye[0]:ye[0]-le[0]))[0][0],j=Math.min(S.width,cT),Q=lT,te=O.map(ye=>ye.x+ye.width/2),pe=Math.round($(te)-j/2),ae=Math.max(...te)+Nd,ne=ye=>({x:ye,width:Math.max(j,ae-ye)}),xe=D.filter(ye=>Math.min(ye.y+ye.height,H+Q)-Math.max(ye.y,H)>0),ve=ye=>{const le=ne(ye);return xe.some(se=>se.x<le.x+le.width&&le.x<se.x+se.width)},ee=ye=>{const le=ne(ye);return te.filter(se=>se>=le.x+10&&se<=le.x+le.width-10).length},ce=(()=>{if(!ve(pe))return pe;const ye=ee(pe);return xe.flatMap(le=>[le.x+le.width+hv,le.x-hv-j]).map(le=>Math.round(le)).filter(le=>!ve(le)&&ee(le)>=ye).sort((le,se)=>Math.abs(le-pe)-Math.abs(se-pe))[0]??pe})();if(ce!==S.x||H!==S.y||j!==S.width||Q!==S.height){const ye=()=>new Set(ht(We(r)).map(Ue=>lt(Ue))),le=ye(),se={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:ce,y:H,width:j,height:Q});const Re=ye(),Me=[...Re].filter(Ue=>!le.has(Ue)).length,Ge=[...le].filter(Ue=>!Re.has(Ue)).length;Me>Ge&&n.resizeShape(S,se)}}}}const I=Math.max(...O.map(T=>T.x+T.width/2))+Nd;if(I>S.x+S.width&&n.resizeShape(S,{x:S.x,y:S.y,width:I-S.x,height:S.height}),!!x)for(const T of E){const $=f(T.flow.id),L=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,D=L?f(L):void 0;if(!$||!D||D.type==="bpmn:Participant")continue;const H=D.x+D.width/2;H<S.x+10||H>S.x+S.width-10||RS($,S,D)}}};DS(!1);for(const x of E){const w=x.flow;n.connect(m(w.source),m(w.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:w.id,name:w.name})})}{const S=new Set([...Y.map(D=>D.flow.id),...E.map(D=>D.flow.id)].filter(D=>!!D)),O=r.filter(D=>!!D.waypoints),I=(D,H)=>Math.abs(H.x-D.x)<2?"L":Math.abs(H.x-(D.x+D.width))<2?"R":Math.abs(H.y-D.y)<2?"T":Math.abs(H.y-(D.y+D.height))<2?"B":void 0,T=new Map,$=(D,H,j)=>{if(!D||!H||typeof D.x!="number")return;const Q=I(D,H);if(!Q)return;let te=T.get(D.id);te||T.set(D.id,te=new Map),te.set(Q,[...te.get(Q)??[],j])};for(const D of O){const H=D.waypoints;!H||H.length<2||($(D.source,H[0],{id:D.id,dir:"out"}),$(D.target,H[H.length-1],{id:D.id,dir:"in"}))}const L=new Set;for(const[D,H]of T){const j=f(D);if(!j||typeof j.x!="number")continue;const Q=ee=>{var ye;const ce=(ye=f(ee.id))==null?void 0:ye.source;return!!ce&&typeof ce.x=="number"&&ce.x+ce.width/2>j.x+j.width/2};if(![...H.values()].some(ee=>ee.length>=3&&ee.some(ce=>ce.dir==="out")&&ee.some(ce=>ce.dir==="in"&&S.has(ce.id)&&Q(ce))))continue;const pe=g(j);if(!pe||L.has(pe.id)||(pe.children??[]).some(ee=>ee.type==="bpmn:Lane"))continue;const ae=(oR=H.get("T"))!=null&&oR.length?(rR=H.get("B"))!=null&&rR.length?void 0:"B":"T";if(!ae||(ae==="T"?j.y-pe.y:pe.y+pe.height-(j.y+j.height))>=z)continue;const xe=(pe.children??[]).filter(ee=>!("waypoints"in ee&&ee.waypoints)&&ee.type!=="label"&&typeof ee.x=="number"),ve=pe.y+pe.height;n.resizeShape(pe,{x:pe.x,y:pe.y,width:pe.width,height:pe.height+z}),Wt(ve,pe.id,z),ae==="T"&&xe.length&&n.moveElements(xe,{x:0,y:z}),L.add(pe.id)}}const nm=20,LS=4,ZF=3,JF=2,QF=2,e6=[10,30,80],qi=()=>{const x=We(r);return{bad:ht(x).filter(w=>w.kind==="edge-crosses-shape"||w.kind==="edge-overlap-opposite"||w.kind==="edge-overlap-mixed").length,crossings:ry(x),straight:x.edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.waypoints.length===2).length}},Ar=x=>{const w=We(r),S=w.edges.find(O=>O.id===x);return S?Ot(S,Ln(w)).length:0},Oc=x=>Ar(x)>0,rs=x=>We(r).edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.id!==x&&w.waypoints.length===2).length,IS=(x,w,S)=>jo([{subtree:x,pool:w}],S),BS=(x,w)=>w.bad>x.bad||w.crossings>x.crossings&&w.straight<=x.straight&&w.bad>=x.bad,as=(x,w)=>BS(x,w)||w.straight<x.straight,aa=(x,w,S=()=>!0,O=BS,I=!1)=>{const T=qi(),$=jo(x,w,I);if(!$)return!1;const L=qi();return O(T,L)||!S()?($(),!1):!0},t6=(x,w,S,O=()=>!0)=>aa([{subtree:x,pool:w}],S,O),sa=x=>{var w;return!!((w=N.get(x))!=null&&w.node.participant)},ss=new Map;for(const x of E){if(!sa(x.flow.target))continue;const w=ss.get(x.flow.target)??[];w.push(x),ss.set(x.flow.target,w)}const Dc=[...ss.keys()],im=new Set(Y.map(x=>x.flow.target)),NS=x=>Ap.findIndex(({op:w})=>w.participant.id===x);Dc.sort((x,w)=>{var I,T;const S=im.has(x)?1:0,O=im.has(w)?1:0;return S!==O?S-O:NS((I=N.get(x))==null?void 0:I.node.participant)-NS((T=N.get(w))==null?void 0:T.node.participant)});const Tr=x=>x.x+x.width/2,n6=x=>{const w=new Map;for(const I of r.getAll()){const T=I;if(!T.waypoints||!T.source||!T.target)continue;(w.get(T.source.id)??w.set(T.source.id,[]).get(T.source.id)).push(T.target.id)}const S=new Set([x]),O=[x];for(let I=0;I<O.length;I++)for(const T of w.get(O[I])??[])S.has(T)||(S.add(T),O.push(T));return S},i6=(x,w)=>{const S=n6(w);let O;for(const I of r.getAll()){const T=I;if(T.type!=="bpmn:MessageFlow"||!T.source||!T.target||T.target.id!==x||S.has(T.source.id))continue;const $=T.source;if(typeof $.x!="number"||$.type==="bpmn:Participant")continue;const L=Tr($);(O===void 0||L>O)&&(O=L)}return O},om=(x,w)=>{const S=f(x.flow.source);if(S)return S.type==="bpmn:Participant"?i6(S.id,w):Tr(S)},$S=x=>{let w;for(const S of ss.get(x)??[]){const O=om(S,x);O!==void 0&&(!w||O>w.cx)&&(w={op:S,cx:O})}return w==null?void 0:w.op},o6=x=>{const w=$S(x),S=f(x),O=w?om(w,x):void 0;return S&&O!==void 0?O-Tr(S):void 0},FS=x=>{const w=o6(x);return w!==void 0&&Math.abs(w)<nm},kp=(x,w,S,O,I)=>{var T;for(let $=!0;$;){$=!1;for(const L of E){if(L.flow.id===S)continue;const D=w.has(L.flow.source),H=w.has(L.flow.target);if(D===H||O(D?L.flow.source:L.flow.target))continue;const j=D?L.flow.target:L.flow.source;if(I(j)||!sa(j))continue;const Q=f(L.flow.id);if(!(Q!=null&&Q.waypoints)||Q.waypoints.length!==2)continue;const te=f(j),pe=(T=N.get(j))==null?void 0:T.node.participant;if(!te||!pe)continue;const ae=Fo(j,ne=>ne.x>=te.x).filter(ne=>!w.has(ne.id));if(!(!ae.length||ae.some(ne=>I(ne.id)))){for(const ne of ae)w.add(ne.id);x.set(pe,[...x.get(pe)??[],...ae]),$=!0}}}return[...x].map(([$,L])=>({subtree:L,pool:m($)}))},rm=(x,w,S,O,I)=>kp(new Map([[w,[...x]]]),new Set(x.map(T=>T.id)),O,T=>T===S,T=>T===I),am=x=>{const w=$S(x);if(!w)return null;const S=f(x),O=f(w.flow.source),I=om(w,x);if(!S||!O||I===void 0)return null;const T=I-Tr(S);if(T>=nm){const $=N.get(x).node.participant,L=Fo(x,H=>H.x>=S.x),D=Fo(x,H=>H.x>=S.x&&!FS(H.id));return{groups:rm(L,$,x,w.flow.id,w.flow.source),dx:T,cut:D.length<L.length?rm(D,$,x,w.flow.id,w.flow.source):void 0}}if(-T>=nm&&sa(w.flow.source)){const $=N.get(w.flow.source).node.participant,L=Fo(w.flow.source,D=>D.x>=O.x&&!FS(D.id));return{groups:rm(L,$,w.flow.source,w.flow.id,x),dx:-T}}return null},jS=()=>Dc.map(x=>({id:x,plan:am(x)})).filter(x=>!!x.plan).sort((x,w)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))-Math.min(...w.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))).map(x=>x.id),HS=()=>{var O;const x=r.getAll().filter(wi).filter(I=>I.type!=="bpmn:Participant"&&I.type!=="bpmn:Group").map(I=>[I.x,I.x+I.width]).sort((I,T)=>I[0]-T[0]);let w=((O=x[0])==null?void 0:O[1])??0,S=0;for(const[I,T]of x.slice(1))I>w&&(S=Math.max(S,I-w)),w=Math.max(w,T);return S},zS=x=>{if(!x.cut)return jo(x.groups,x.dx);const w=jo(x.groups,x.dx,!0);if(!w)return null;const S=qi(),O=HS();w();const I=jo(x.cut,x.dx,!0);if(I){const T=qi();if(T.bad<=S.bad&&T.crossings<=S.crossings&&T.straight>=S.straight&&HS()<O)return I;I()}return jo(x.groups,x.dx)};for(let x=0;x<3;x++){const w=qi(),S=[];for(const I of jS()){const T=am(I);if(!T)continue;const $=zS(T);$&&S.push($)}if(!S.length)break;if(!as(w,qi()))continue;for(const I of S.reverse())I();let O=!1;for(const I of jS()){const T=am(I);if(!T)continue;const $=qi(),L=zS(T);L&&(as($,qi())?L():O=!0)}if(!O)break}for(const x of Dc){if(im.has(x))continue;const w=N.get(x);if(!w||w.node.lane!==void 0)continue;const S=pt(w);if(S===void 0)continue;const O=f(x),I=O?g(O):void 0;if(!O||!I)continue;const T=I.y+V+ii(`pool:${w.node.participant??""}`,S)*z,$=T-(O.y+O.height/2);$!==0&&!W(I,O,O.x+O.width/2,T)&&n.moveElements([O],{x:0,y:$})}const Op=()=>{const x=r.filter(O=>O.type==="bpmn:Participant"),w=new Map(x.map(O=>[O.id,O]));let S=0;for(const{pools:[O,I]}of vd(x)){const T=w.get(O),$=w.get(I);S+=(Math.min(T.x+T.width,$.x+$.width)-Math.max(T.x,$.x))*(Math.min(T.y+T.height,$.y+$.height)-Math.max(T.y,$.y))}return S},sm=new Set,GS=new Set;for(let x=0,w=!0;w&&x<ZF;x++){w=!1;for(const S of Dc.flatMap(O=>ss.get(O)??[])){if(sm.has(S.flow.id)||!Oc(S.flow.id))continue;const O=f(S.flow.target);if(!O)continue;const I=m(N.get(S.flow.target).node.participant),T=Fo(S.flow.target,j=>j.x>=O.x),$=O.width+oe,L=Ar(S.flow.id),D=rs(S.flow.id),H=Op();for(let j=1;j<=LS;j++){const Q=()=>Ar(S.flow.id)>=L||Op()>H?!1:rs(S.flow.id)>=D?!0:(GS.add(S.flow.id),!1);if(t6(T,I,$*j,Q)){sm.add(S.flow.id),w=!0;break}}}}const VS=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const w=x.source,S=x.target;return!!w&&!!S&&S.x+S.width<w.x}).length;for(const x of Dc.flatMap(w=>ss.get(w)??[])){if(sm.has(x.flow.id)||!GS.has(x.flow.id)||!Oc(x.flow.id))continue;const w=f(x.flow.target);if(!w)continue;const S=m(N.get(x.flow.target).node.participant),O=Fo(x.flow.target,te=>te.x>=w.x),I=new Set(O.map(te=>te.id)),T=new Map;for(const te of r.filter(pe=>pe.type==="bpmn:MessageFlow")){if(((aR=te.waypoints)==null?void 0:aR.length)!==2||!te.source||!te.target)continue;const pe=I.has(te.source.id);if(pe===I.has(te.target.id))continue;const ae=pe?te.target:te.source,ne=(sR=N.get(ae.id))==null?void 0:sR.node.participant;!ne||T.has(ae.id)||T.set(ae.id,{subtree:[ae],pool:m(ne)})}if(!T.size)continue;const $=w.width+oe,L=Ar(x.flow.id),D=rs(x.flow.id),H=Op(),j=VS(),Q=()=>Ar(x.flow.id)<L&&rs(x.flow.id)>=D&&Op()<=H&&VS()<=j;for(let te=1;te<=JF&&!aa([{subtree:O,pool:S},...T.values()],$*te,Q);te++);}const cm=E.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),WS=new Set(cm.map(x=>x.id));for(const x of r.filter(w=>w.type==="bpmn:MessageFlow"))WS.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&cm.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of cm){if(!Oc(x.id))continue;const w=f(x.source),S=f(x.target);if(!w||!S)continue;let O,I,T;if(x.preexisting){const[L,D]=w.type==="bpmn:Participant"?[S,w]:[w,S];if(O=Tr(L),O<D.x||O>D.x+D.width)continue;[I,T]=L.y<D.y?[L.y+L.height,D.y]:[D.y+D.height,L.y]}else{if(w.type==="bpmn:Participant"||S.type==="bpmn:Participant"||(O=w.x+w.width/2,Math.abs(O-(S.x+S.width/2))>15))continue;[I,T]=w.y<S.y?[w.y+w.height,S.y]:[S.y+S.height,w.y]}const $=[...N.values()].map(L=>f(L.node.id)).filter(L=>!!L&&L.id!==w.id&&L.id!==S.id).filter(L=>L.x<=O&&O<=L.x+L.width&&L.y+L.height>I&&L.y<T).sort((L,D)=>L.x-D.x);for(const L of $){const D=(cR=N.get(L.id))==null?void 0:cR.node.participant,H=D?f(D):void 0;if(!D||!H)continue;const j=[...N.values()].filter(ce=>ce.node.participant===D).map(ce=>ce.node.id),Q=ce=>ce.map(ye=>f(ye)).filter(ye=>!!ye),pe=[VF(L.id,ce=>{var ye;return((ye=N.get(ce.id))==null?void 0:ye.node.participant)===D}),Q(j)].filter(ce=>ce.length).map(ce=>[{subtree:ce,pool:H}]);if(x.preexisting){const ce=Q(j);ce.length&&pe.push(kp(new Map([[D,[...ce]]]),new Set(ce.map(ye=>ye.id)),x.id,()=>!1,ye=>ye===w.id||ye===S.id))}const ae=L.width+oe,ne=Ar(x.id),xe=rs(x.id),ve=()=>Ar(x.id)<ne&&rs(x.id)>=xe;let ee=!1;for(const ce of pe){for(let ye=1;ye<=LS;ye++)if(aa(ce,ae*ye,ve)){ee=!0;break}if(ee)break}if(!Oc(x.id))break}}const Dp=()=>{var w;const x=new Set;for(const S of ht(We(r)))S.kind!=="edge-crosses-shape"||WS.has(S.edge)||((w=f(S.edge))==null?void 0:w.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},r6=(x,w)=>qi().bad>=x&&[...Dp()].some(S=>!w.has(S)),US=x=>{var w,S;return Ar(x)===0&&((S=(w=f(x))==null?void 0:w.waypoints)==null?void 0:S.length)===2},a6=(x,w,S)=>{const O=new Set(x.flatMap(T=>T.subtree.map($=>$.id))),I=[...Dp()].filter(T=>!S.has(T)).map(T=>T.split(">")[1]);return[...new Set(I)].filter(T=>O.has(T)&&T!==w.source&&T!==w.target)},s6=(x,w,S,O,I)=>{const T=x.map(H=>({...H,subtree:H.subtree.filter(j=>!I.includes(j.id))})).filter(H=>H.subtree.length),$=new Set(T.flatMap(H=>H.subtree.map(j=>j.id))),L=()=>I.every(H=>{const j=f(H);return!!j&&Y.filter(Q=>Q.flow.target===H&&$.has(Q.flow.source)).every(Q=>{const te=f(Q.flow.source);return!!te&&te.x+te.width<=j.x})});return aa(T,w,()=>US(S.id)&&[...Dp()].every(H=>O.has(H))&&L(),as,!0)};for(const x of E){if(!Oc(x.flow.id))continue;const w=f(x.flow.id);if(((lR=w==null?void 0:w.waypoints)==null?void 0:lR.length)!==2)continue;const S=f(x.flow.source),O=f(x.flow.target);if(!S||!O||S.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!sa(x.flow.source)||!sa(x.flow.target)||Math.abs(Tr(S)-Tr(O))>QF)continue;const I=Tr(S),T=w.waypoints.map(ne=>ne.y),[$,L]=[Math.min(...T),Math.max(...T)],D=Ln(We(r)).filter(ne=>ne.id!==S.id&&ne.id!==O.id&&ne.x<I&&I<ne.x+ne.width&&$<ne.y+ne.height&&ne.y<L);if(!D.length)continue;const H=(uR=N.get(x.flow.source))==null?void 0:uR.node.participant,j=(pR=N.get(x.flow.target))==null?void 0:pR.node.participant;if(!H||!j)continue;const Q=new Map;for(const[ne,xe,ve]of[[x.flow.source,S,H],[x.flow.target,O,j]]){const ee=Q.get(ve)??[],ce=Fo(ne,ye=>ye.x>=xe.x).filter(ye=>!ee.some(le=>le.id===ye.id));Q.set(ve,[...ee,...ce])}const te=new Set([...Q.values()].flat().map(ne=>ne.id)),pe=kp(Q,te,x.flow.id,ne=>ne===x.flow.source||ne===x.flow.target,()=>!1),ae=Math.max(...D.map(ne=>ne.x+ne.width));for(const ne of e6){const xe=ae+ne-I;if(xe<=0)continue;const ve=qi().bad,ee=Dp();let ce=[],ye=!0;const le=()=>!US(x.flow.id)||ye&&(ce=a6(pe,x.flow,ee),ce.length)?!1:!r6(ve,ee);if(aa(pe,xe,le,as))break;if(ce.length&&(s6(pe,xe,x.flow,ee,ce)||(ye=!1,aa(pe,xe,le,as))))break}}{const x=T=>T.y+T.height/2,w=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const T=We(r),$=new Set(ht(T).flatMap(H=>H.kind==="edge-crosses-shape"?[`${H.edge}|${H.shape}`]:[])),L=T.shapes.filter(H=>!H.container&&w.test(H.type)),D=new Set;for(const H of T.edges){if(H.type!=="bpmn:SequenceFlow"&&H.type!=="bpmn:MessageFlow")continue;const j=new Set(H.endpoints);for(const Q of[H.waypoints[0],H.waypoints[H.waypoints.length-1]])for(const te of L)te.x-4<=Q.x&&Q.x<=te.x+te.width+4&&te.y-4<=Q.y&&Q.y<=te.y+te.height+4&&j.add(te.id);for(const Q of L)if(!(j.has(Q.id)||$.has(`${H.id}|${Q.id}`))){for(let te=0;te+1<H.waypoints.length;te++)if(wo(H.waypoints[te],H.waypoints[te+1],Q)<=Qg){D.add(`${H.id}|${Q.id}`);break}}}return D},O=()=>({...qi(),grazes:S()}),I=[];for(const T of N.keys()){if(!sa(T))continue;const $=Y.filter(H=>H.flow.target===T);if($.length!==1)continue;const L=f($[0].flow.source),D=f(T);!L||!D||!N.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=oe+1||I.push({id:T,pred:L,node:D})}I.sort((T,$)=>T.node.x-$.node.x);for(const{id:T}of I){const $=N.get(T),L=f(T),D=f(Y.find(ce=>ce.flow.target===T).flow.source);if(!L||!D)continue;const H=L.x-(D.x+D.width);if(H<=oe+1)continue;const j=m($.node.participant),Q=Fo(T,ce=>ce.x>=L.x),te=-(H-oe),pe=(ce,ye)=>ye.bad>ce.bad||ye.crossings>ce.crossings||ye.crossings===ce.crossings&&ye.bad===ce.bad||ye.straight<ce.straight||[...ye.grazes].some(le=>!ce.grazes.has(le)),ae=kp(new Map([[$.node.participant,[...Q]]]),new Set(Q.map(ce=>ce.id)),"",()=>!1,()=>!1),ne=ae.some(ce=>ce.pool!==j)||ae.reduce((ce,ye)=>ce+ye.subtree.length,0)>Q.length,xe=O(),ve=IS(Q,j,te);if(!ve)continue;const ee=O();if(ne&&!pe(xe,ee)){ve();const ce=jo(ae,te);if(ce){const ye=O();if(!pe(xe,ye)&&ye.bad<=ee.bad&&ye.crossings<=ee.crossings)continue;ce()}IS(Q,j,te);continue}pe(xe,ee)&&ve()}}DS(!0);const c6=10,l6=400,u6=x=>[...x.incoming??[],...x.outgoing??[]].filter(w=>w.type==="bpmn:DataInputAssociation"||w.type==="bpmn:DataOutputAssociation").map(w=>w.source===x?w.target:w.source).filter(w=>!!w&&typeof w.y=="number"),p6=r.filter(x=>x.type==="bpmn:DataStoreReference"&&_.has(x.id)),d6=(x,w)=>{const S=x.x+x.width/2,O=x.y+x.height/2;let I;for(const T of p6){if((g(T)??d())!==w||T.y<x.y+x.height)continue;const $=Math.abs(T.x+T.width/2-S);$>l6||$<T.width||!u6(T).some(D=>D.height===x.height&&Math.abs(D.y+D.height/2-O)<=c6&&T.y>=D.y+D.height)||(!I||$<I.dx||$===I.dx&&T.id<I.id)&&(I={dx:$,id:T.id,cy:T.y+T.height/2})}return I==null?void 0:I.cy},f6=50,h6=(x,w)=>{const S=g(w);if(!S||x.y<w.y+w.height)return;const O=y(S,w),I=O??S,T=x.label,$=Math.max(x.y+x.height,T?T.y+T.height:0),L=I.y+I.height;if($<=L)return;const D=Math.ceil($+f6-L),H=S.y+S.height;if(O){const j=is(O,O.height+D,new Set([x.id]));Wt(H,S.id,D,j)}else n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+D}),Wt(H,S.id,D)};for(const x of M){const w=x.associations??[],S=w.map($=>$.source===x.dataStore.id?$.target:$.source).map(f).find(Boolean),O=S?g(S)??d():d(),I=S?{x:S.x+S.width/2,y:d6(S,O)??S.y+S.height+110}:{x:200,y:Tc+60},T=n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},I,O);S&&h6(T,S);for(const $ of w)OS(x.dataStore.id,$)}for(const x of B){const S=m(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;OS(S,x.association)}let qS=0;const ca=10,YS=40,g6=(x,w)=>{const S=w.map(D=>g(D)).filter(D=>!!D);for(const D of S){const H=ca,j=D.y,Q=D.y+D.height,te=D.x,pe=D.x+D.width;if(Math.abs(x.y-j)<H){const ae=j+H-x.y;x.y+=ae,x.height-=ae}if(Math.abs(x.y+x.height-Q)<H&&(x.height=Q-H-x.y),Math.abs(x.x-te)<H){const ae=te+H-x.x;x.x+=ae,x.width-=ae}Math.abs(x.x+x.width-pe)<H&&(x.width=pe-H-x.x)}if(!S.length)return;const O=Math.min(...S.map(D=>D.y)),I=Math.max(...S.map(D=>D.y+D.height)),T=O-x.y,$=x.y+x.height-I,L=YS-ca;if(T>0!=$>0)if(T>0&&T<L){const D=T+ca;x.y+=D,x.height-=D}else $>0&&$<L&&(x.height-=$+ca)},m6=(x,w)=>{const S=ca,O=30,I=r.filter(T=>T.type==="bpmn:Group"&&T.id!==w);for(const T of I){const $=T.x,L=T.x+T.width,D=T.y,H=T.y+T.height,j=x.y<H&&D<x.y+x.height,Q=x.x<L&&$<x.x+x.width;if(j){if(Math.abs(x.x-L)<S){const te=Math.min(L+S-x.x,O);te>0&&x.width-te>0&&(x.x+=te,x.width-=te)}if(Math.abs(x.x+x.width-$)<S){const te=Math.min(x.x+x.width-($-S),O);te>0&&x.width-te>0&&(x.width-=te)}}if(Q){if(Math.abs(x.y-H)<S){const te=Math.min(H+S-x.y,O);te>0&&x.height-te>0&&(x.y+=te,x.height-=te)}if(Math.abs(x.y+x.height-D)<S){const te=Math.min(x.y+x.height-(D-S),O);te>0&&x.height-te>0&&(x.height-=te)}}}},lm=(x,w)=>{const S=YS,O=Math.min(...x.map(D=>D.x))-S,I=Math.min(...x.map(D=>D.y))-S,T=Math.max(...x.map(D=>D.x+D.width))+S,$=Math.max(...x.map(D=>D.y+D.height))+S,L={x:O,y:I,width:T-O,height:$-I};return g6(L,x),m6(L,w),L};for(const x of k){const w=(x.group.members??[]).map(f).filter(I=>!!I);let S;w.length?S=lm(w,x.group.id):(S={x:300+qS*350,y:40,width:300,height:200},qS++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:S.width,height:S.height},{x:S.x+S.width/2,y:S.y+S.height/2},d());x.group.name&&n.updateLabel(O,x.group.name),(dR=x.group.members)!=null&&dR.length&&Ce(O,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(I=>!!I.waypoints),w=new Map,S=(I,T)=>{!I||!T||(w.has(I)||w.set(I,new Set),w.get(I).add(T))};for(const I of x){const T=(fR=I.source)==null?void 0:fR.id,$=(hR=I.target)==null?void 0:hR.id;S(T,$),((gR=I.type)!=null&&gR.includes("DataOutputAssociation")||(mR=I.type)!=null&&mR.includes("DataInputAssociation")||I.type==="bpmn:Association")&&S($,T)}const O=r.filter(I=>I.type==="bpmn:Group");for(const I of O){const $=(((yR=I.businessObject.extensionElements)==null?void 0:yR.values)??[]).find(ve=>ve.$type==="bwl:Members"),L=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!L.length)continue;const D=new Set(L),H=[...L];for(;H.length;){const ve=H.shift();for(const ee of w.get(ve)??[])D.has(ee)||(D.add(ee),H.push(ee))}const j=I.x,Q=I.x+I.width,te=I.y,pe=I.y+I.height,ae=ve=>Y.filter(ee=>ee.flow.target===ve).length,ne=ve=>{var ce;const ee=((ce=f(ve))==null?void 0:ce.type)??"";if(ee==="bpmn:StartEvent"&&ae(ve)===0)return!1;if(ee.endsWith("Gateway")){const ye=Y.filter(le=>le.flow.target===ve).map(le=>le.flow.source);if(ye.length&&ye.every(le=>{var se;return((se=f(le))==null?void 0:se.type)==="bpmn:StartEvent"&&ae(le)===0}))return!1}return!0},xe=r.filter(ve=>wi(ve)).filter(ve=>ve.type!=="bpmn:Group"&&ve.type!=="bpmn:Participant"&&ve.type!=="bpmn:TextAnnotation"&&!D.has(ve.id)&&sa(ve.id)&&ne(ve.id)&&ve.x<Q&&ve.x+ve.width>j&&ve.y<pe&&ve.y+ve.height>te);if(xe.length)for(const ve of[-1,1]){const ee=xe.filter(Ie=>(Ie.x+Ie.width-j<=Q-Ie.x?-1:1)===ve);if(!ee.length)continue;const ce=[];for(const Ie of ee){const Oe=ce.find(me=>me.some(he=>Ie.y<he.y+he.height&&Ie.y+Ie.height>he.y));Oe?Oe.push(Ie):ce.push([Ie])}const ye=new Map;for(const Ie of ce){let Oe=ve<0?j-ca:Q+ca;for(const me of[...Ie].sort((he,ge)=>ve<0?ge.x-he.x:he.x-ge.x)){const he=ve<0?Math.min(me.x,Oe-me.width):Math.max(me.x,Oe);Oe=ve<0?he-Fi:he+me.width+Fi,he!==me.x&&Math.sign(he-me.x)===ve&&ye.set(me.id,he-me.x)}}const le=new Map,se=Ie=>le.get(Ie)===Ie||!le.get(Ie)?Ie:se(le.get(Ie));for(const Ie of ee)le.set(Ie.id,Ie.id);for(const Ie of E){const Oe=ye.has(Ie.flow.source)?Ie.flow.source:void 0,me=ye.has(Ie.flow.target)?Ie.flow.target:void 0;if(!Oe||!me)continue;const he=f(Ie.flow.id);((vR=he==null?void 0:he.waypoints)==null?void 0:vR.length)===2&&le.set(se(Oe),se(me))}const Re=new Map;for(const Ie of ee){if(!ye.has(Ie.id))continue;const Oe=se(Ie.id);Re.set(Oe,[...Re.get(Oe)??[],Ie])}const Me=[...Re.values()].sort((Ie,Oe)=>ve<0?Math.min(...Ie.map(me=>me.x))-Math.min(...Oe.map(me=>me.x)):Math.max(...Oe.map(me=>me.x))-Math.max(...Ie.map(me=>me.x))),Ge=[];let Ue=!0;for(const Ie of Me){const Oe=Ie.map(ge=>ye.get(ge.id)??0).reduce((ge,Fe)=>Math.abs(Fe)>Math.abs(ge)?Fe:ge,0),me=new Map;let he=!0;for(const ge of Ie){const Fe=g(ge);if(!Fe){he=!1;break}me.has(Fe.id)||me.set(Fe.id,{subtree:[],pool:Fe}),me.get(Fe.id).subtree.push(ge)}he&&aa([...me.values()],Oe,()=>!0,as)?Ge.push({shapes:Ie,dx:Oe}):Ue=!1}if(!Ue)for(const Ie of Ge.reverse())n.moveElements(Ie.shapes,{x:-Ie.dx,y:0})}}}{const x=new Set([...k.map(w=>w.group.id),...Gt(e,"group.update").map(w=>w.id)]);for(const w of r.filter(S=>S.type==="bpmn:Group")){if(x.has(w.id))continue;const O=(((xR=w.businessObject.extensionElements)==null?void 0:xR.values)??[]).find(L=>L.$type==="bwl:Members"),I=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(L=>!!L);!I.length||!I.some(L=>{const D=_.get(L.id);return!D||D.x!==L.x||D.y!==L.y})||!I.some(L=>L.x<w.x||L.y<w.y||L.x+L.width>w.x+w.width||L.y+L.height>w.y+w.height)||n.resizeShape(w,lm(I,w.id))}}{const w=new Map(Ko(We(r)).map(L=>[L.owner,L.rect])),S=r.filter(L=>!!L.waypoints),O=new Map,I=(L,D)=>{!L||!D||(O.has(L)||O.set(L,new Set),O.get(L).add(D))};for(const L of S){const D=(bR=L.source)==null?void 0:bR.id,H=(wR=L.target)==null?void 0:wR.id;I(D,H),((_R=L.type)!=null&&_R.includes("DataOutputAssociation")||(ER=L.type)!=null&&ER.includes("DataInputAssociation")||L.type==="bpmn:Association")&&I(H,D)}const T=L=>Y.filter(D=>D.flow.target===L).length,$=L=>{var H;const D=((H=f(L))==null?void 0:H.type)??"";if(D==="bpmn:StartEvent"&&T(L)===0)return!1;if(D.endsWith("Gateway")){const j=Y.filter(Q=>Q.flow.target===L).map(Q=>Q.flow.source);if(j.length&&j.every(Q=>{var te;return((te=f(Q))==null?void 0:te.type)==="bpmn:StartEvent"&&T(Q)===0}))return!1}return!0};for(const L of r.filter(D=>D.type==="bpmn:Group")){const H=(((SR=L.businessObject.extensionElements)==null?void 0:SR.values)??[]).find(he=>he.$type==="bwl:Members"),j=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const Q=j.map(f).filter(he=>!!he);if(!Q.length||!(k.some(he=>he.group.id===L.id)||Gt(e,"group.update").some(he=>he.id===L.id)||Q.some(he=>{const ge=_.get(he.id);return!ge||ge.x!==he.x||ge.y!==he.y})))continue;const pe=new Set(j),ae=[...j];for(;ae.length;){const he=ae.shift();for(const ge of O.get(he)??[])pe.has(ge)||(pe.add(ge),ae.push(ge))}const ne=L.x,xe=L.x+L.width,ve=L.y,ee=L.y+L.height,ce=he=>{const ge=w.get(he.id),Fe={x:he.x,y:he.y,width:he.width,height:he.height};return ge?[Fe,{x:ge.x,y:ge.y,width:ge.width,height:ge.height}]:[Fe]},ye=Q.flatMap(ce),le=Math.min(...ye.map(he=>he.x)),se=Math.max(...ye.map(he=>he.x+he.width)),Re=Math.min(...ye.map(he=>he.y)),Me=Math.max(...ye.map(he=>he.y+he.height)),Ge={L:le-ne,R:xe-se,T:Re-ve,B:ee-Me},Ue=new Set(j),Ie=he=>he.x>=ne&&he.x+he.width<=xe&&he.y>=ve&&he.y+he.height<=ee,Oe=r.filter(he=>wi(he)).filter(he=>he.type!=="bpmn:Group"&&he.type!=="bpmn:Participant"&&he.type!=="bpmn:TextAnnotation"&&!Ue.has(he.id)&&(!pe.has(he.id)||!Ie(he))&&$(he.id)&&he.x<xe&&he.x+he.width>ne&&he.y<ee&&he.y+he.height>ve);if(!Oe.length)continue;const me={L:0,R:0,T:0,B:0};for(const he of Oe){const ge=ce(he),Fe=Math.min(...ge.map(Yt=>Yt.x)),Ke=Math.max(...ge.map(Yt=>Yt.x+Yt.width)),it=Math.min(...ge.map(Yt=>Yt.y)),Be=Math.max(...ge.map(Yt=>Yt.y+Yt.height)),Ve={L:Ke-ne,R:xe-Fe,T:Be-ve,B:ee-it},Ft=["L","R","T","B"].filter(Yt=>Ve[Yt]<=Ge[Yt]+.001);if(!Ft.length)continue;const cn=Ft.reduce((Yt,Kt)=>Ve[Kt]<Ve[Yt]?Kt:Yt,Ft[0]);me[cn]=Math.max(me[cn],Math.min(Ve[cn]+10,Ge[cn]))}!me.L&&!me.R&&!me.T&&!me.B||n.resizeShape(L,{x:L.x+me.L,y:L.y+me.T,width:L.width-me.L-me.R,height:L.height-me.T-me.B})}}const KS=x=>{const w=x.waypoints;if(w!=null&&w.length){const O=w[Math.floor((w.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let Lc=0;const um=bv.get(t),XS=(x,w)=>{var O;const S=(O=um==null?void 0:um.get(x))==null?void 0:O.texts;return S?[...new Set([w,...Object.values(S)])]:[w]};for(const x of P){const w=x.association,S=((RR=x.placement)==null?void 0:RR.anchor)??(w?w.source===x.annotation.id?w.target:w.source:void 0),O=S?f(S):void 0,I=O?KS(O):void 0,T=lv(XS(x.annotation.id,x.annotation.text??""));let $;if(I&&x.placement){const[j,Q]=pl[x.placement.side],te=x.placement.offset??50;$={x:I.x+I.width/2+j*(I.width/2+T.width/2+te),y:I.y+I.height/2+Q*(I.height/2+T.height/2+te)}}else I?($={x:I.x+I.width/2+180+Lc%3*260,y:I.y-110-Lc%2*95},Lc++):($={x:300+Lc*260,y:60},Lc++);const L=O?g(O)??d():d(),D=L;I&&typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant"&&($=fl(r,I,T,D,x.placement?{placement:x.placement}:{from:$}));const H=n.createShape({type:"bpmn:TextAnnotation",width:T.width,height:T.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},$,L);if(w){const j=Q=>Q===x.annotation.id?H:m(Q);n.connect(j(w.source),j(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}x.placement&&Ce(H,"bwl:Placement",Ae(x.placement))}for(const x of Gt(e,"association.add")){const w=x.association;n.connect(m(w.source),m(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}const y6=(x,w,S,O)=>{const I=x.parent;if(!I)return O;const T=x.x+x.width/2,$=new Set([x.id]);if(!W(I,x,T,O,$))return O;const L=w?w.y+Math.min(w.height/2,X):S?S.y+V:void 0;if(L===void 0)return O;const D=Math.floor((O-L)/z+1e-6);for(let H=1;H<=3;H++){const j=D+H,Q=L+j*z,te=Kg(w==null?void 0:w.id,j);if(!W(I,x,T,Q,te?new Set([...$,...te]):$))return Zn(w==null?void 0:w.id,j,S),Q}return O},ZS=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Gt(e,"node.update")){let w=m(x.id);if(x.type&&ul(x.type)!==w.type){const S=w.x+w.width/2,O=w.y+w.height/2,I=ZS();w=c.replaceElement(w,{type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{}});const T=ZS(),$=[...I].filter(H=>H!==x.id&&!T.has(H));if($.length)throw new vv({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:$});const L=Math.round(S-(w.x+w.width/2)),D=Math.round(O-(w.y+w.height/2));if(L!==0||D!==0){n.moveShape(w,{x:L,y:D});for(const H of[...w.incoming??[],...w.outgoing??[]])Pp(H)}}if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(w,{"bwl:band":x.band});const S=w.y+w.height/2,O=g(w),I=x.lane?m(x.lane):((O==null?void 0:O.children)??[]).find($=>$.type==="bpmn:Lane"&&S>=$.y&&S<=$.y+$.height);x.band!==void 0&&Zn(I==null?void 0:I.id,x.band,O);const T=I?I.y+(x.band===void 0?I.height/2:Math.min(I.height/2,X)+ii(I.id,x.band)*z):x.band!==void 0&&O?O.y+V+ii(`pool:${O.id}`,x.band)*z:void 0;if(T!==void 0){const $=y6(w,I,O,T),L=$===T?T-S:$-(w.y+w.height/2);L!==0&&(p.push({id:w.id,x:w.x,y:w.y,width:w.width,height:w.height}),n.moveElements([w],{x:0,y:L}))}}}for(const x of Gt(e,"sequenceFlow.update")){const w=m(x.id),S=G.get(x.id);if(S){const O=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),I=m(S.flow.source),T=m(S.flow.target),$=n.connect(I,T,{type:"bpmn:SequenceFlow",businessObject:Tp(S.flow)}),L=tm.get(x.id),D=T.y+T.height/2;L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1?n.updateWaypoints($,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]):(n.reconnect($,I,T,[O(I),O(T)]),Math.abs(D-(I.y+I.height/2))>1&&Pp($))}else if((x.source!==void 0||x.target!==void 0)&&!_S.has(x.id)){const O=w,I=x.source!==void 0?m(x.source):O.source,T=x.target!==void 0?m(x.target):O.target,$=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(O,I,T,[$(I),$(T)]);const L=tm.get(O.id),D=T.y+T.height/2;if(L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1){n.updateWaypoints(O,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]);const H=O.label;if(H&&L.label){const Q=Math.abs(L.label.y+H.height/2-L.channelY)<=z/5&&L.label.x+H.width>L.exit.x,te=L.exit.x+6,pe=T.x-6-H.width,ae=Q?pe>=te?{x:Math.max(te,Math.min(L.label.x,pe)),y:L.label.y+(D-L.channelY)}:void 0:L.label;ae&&(ae.x!==H.x||ae.y!==H.y)&&n.moveElements([H],{x:ae.x-H.x,y:ae.y-H.y})}}else Math.abs(D-(I.y+I.height/2))>1&&Pp(O)}x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(w,{name:((MR=x.condition)==null?void 0:MR.label)??void 0})}for(const x of Gt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"annotation.update")){const w=m(x.id);if(x.text!==void 0){n.updateProperties(w,{text:x.text});const S=lv(XS(x.id,x.text));if(S.width!==w.width||S.height!==w.height){const O={x:w.x,y:w.y,width:S.width,height:S.height};n.resizeShape(w,O,void 0,{[uv]:O})}}if(x.placement===null)Ce(w,"bwl:Placement",null);else if(x.placement){const S=m(x.placement.anchor),O=KS(S),I=g(S)??d(),T=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[$,L]=pl[x.placement.side],D=x.placement.offset??50,H={x:O.x+O.width/2+$*(O.width/2+w.width/2+D),y:O.y+O.height/2+L*(O.height/2+w.height/2+D)},j=T?fl(r,O,{width:w.width,height:w.height},I,{placement:x.placement,selfId:x.id}):H;n.moveElements([w],{x:j.x-(w.x+w.width/2),y:j.y-(w.y+w.height/2)}),Ce(w,"bwl:Placement",Ae(x.placement))}}for(const x of Gt(e,"group.update")){const w=m(x.id);if(x.name!==void 0&&n.updateLabel(w,x.name??""),x.members){const S=x.members.map(f).filter(O=>!!O);S.length&&n.resizeShape(w,lm(S,x.id)),Ce(w,"bwl:Members",{refs:x.members.join(" ")})}}}function _s(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 mT(e,t,n){const i=(r,a)=>{const s=r.shapes.find(l=>l.id===a);if(s)return{x:s.x+s.width/2,y:s.y+s.height/2};const c=r.edges.find(l=>l.id===a);return c!=null&&c.waypoints.length?c.waypoints[Math.floor((c.waypoints.length-1)/2)]:void 0},o=new Set;for(const r of e.shapes){if(r.type!=="bpmn:TextAnnotation")continue;const a=i(e,r.id),s=i(t,r.id);if(!a||!s)continue;const c=s.x-a.x,l=s.y-a.y;if(Math.abs(c)<=2&&Math.abs(l)<=2)continue;const u=n(r.id),p=u?i(e,u):void 0,d=u?i(t,u):void 0;p&&d&&Math.abs(d.x-p.x-c)<=2&&Math.abs(d.y-p.y-l)<=2||o.add(r.id)}return o}function yT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(f=>f.type==="bpmn:Association");if(!a.length)return 0;const s=f=>f.map(m=>m.original?{x:m.x,y:m.y,original:{x:m.original.x,y:m.original.y}}:{x:m.x,y:m.y}),c=(f,m)=>f.length===m.length&&f.every((g,y)=>{var _,h,v,b;return g.x===m[y].x&&g.y===m[y].y&&((_=g.original)==null?void 0:_.x)===((h=m[y].original)==null?void 0:h.x)&&((v=g.original)==null?void 0:v.y)===((b=m[y].original)==null?void 0:b.y)}),l=a.map(f=>s(f.waypoints)),u=new Set(a.map(f=>f.id));r.moveElements([t],{x:n,y:i});const p=We(o),d=[...eo(p),...Ei(p)].filter(([f,m])=>u.has(f)!==u.has(m)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,m)=>{c(f.waypoints,l[m])||r.updateWaypoints(f,l[m])}),d}function vT(e,t,n,i=new Set,o=new Set){var g,y;const{elementRegistry:r}=e,a=e.modeling,s=_=>ht(_).filter(h=>!t.has(lt(h))),c=_=>{var h;return((h=r.get(_))==null?void 0:h.type)==="bpmn:TextAnnotation"},l=We(r),u=s(l),p=_=>!n.has(_),d=_=>u.some(h=>h.kind==="edge-crosses-shape"&&h.shape===_&&i.has(h.edge)||h.kind==="shape-overlap"&&h.shapes.includes(_)&&h.shapes.every(c)),f=[...new Set(u.flatMap(_s))].filter(_=>c(_)&&(!p(_)||d(_))),m=[...f.filter(_=>!p(_)),...f.filter(p)];if(m.length)for(const _ of m){const h=r.get(_);if(!h||typeof h.x!="number"||typeof h.width!="number")continue;let v=h.parent,b;for(;v;){if(v.type==="bpmn:Participant"){b=v;break}v=v.parent}if(!b){const V=h.x+h.width/2,X=h.y+h.height/2;b=r.getAll().find(ue=>{if(ue.type!=="bpmn:Participant")return!1;const be=ue;return typeof be.x=="number"&&typeof be.width=="number"&&V>=be.x&&V<=be.x+be.width&&X>=be.y&&X<=be.y+be.height})}if(!b||typeof b.x!="number"||typeof b.width!="number")continue;const M=(((g=h.businessObject.extensionElements)==null?void 0:g.values)??[]).find(V=>V.$type==="bwl:Placement"),B=[...h.incoming??[],...h.outgoing??[]].find(V=>V.type==="bpmn:Association"),P=(M!=null&&M.anchor?r.get(M.anchor):void 0)??(B?((y=B.source)==null?void 0:y.id)===_?B.target:B.source:void 0);if(!P)continue;const k=P.waypoints,N=k!=null&&k.length?{x:k[Math.floor((k.length-1)/2)].x,y:k[Math.floor((k.length-1)/2)].y,width:0,height:0}:{x:P.x,y:P.y,width:P.width,height:P.height},G={width:h.width,height:h.height},q={x:h.x+h.width/2,y:h.y+h.height/2},Y=M==null?void 0:M.side,re=mv(r,N,b),K=[];if(Y&&Y in pl&&K.push(fl(r,N,G,b,{placement:{side:Y,offset:(M==null?void 0:M.offset)??null},selfId:_})),re&&!dl(q,G,re))for(const V of pT)K.push(fl(r,N,G,b,{placement:{side:V,offset:null},selfId:_}));for(const[V,X]of[[-1,0],[1,0],[0,-1],[0,1]])for(let ue=1;ue<=uT;ue++)K.push({x:q.x+V*gv*ue,y:q.y+X*gv*ue});const Ce=p(_)?We(r):l,Ae={...Ce,edges:Ce.edges.filter(V=>V.id!==(B==null?void 0:B.id))},Te=s(Ae),de=Te.filter(V=>_s(V).includes(_)).length;if(!de)continue;let z,oe=!1;for(const V of K){const X=V.x-q.x,ue=V.y-q.y;if(!X&&!ue||V.x-G.width/2<b.x||V.x+G.width/2>b.x+b.width||V.y-G.height/2<b.y||V.y+G.height/2>b.y+b.height||re&&!dl(V,G,re))continue;const be={...Ae,shapes:Ae.shapes.map(R=>R.id===_?{...R,x:R.x+X,y:R.y+ue}:R)},$e=o.has(_)?s(be):ht(be).filter(R=>!t.has(lt(R))||_s(R).includes(_)),F=$e.filter(R=>_s(R).includes(_)).length;if(F>=de||$e.length>Te.length)continue;const C=Math.abs(X)+Math.abs(ue);if(oe||((!z||F<z.mine||F===z.mine&&($e.length<z.all||$e.length===z.all&&C<z.dist))&&(z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C}),z.mine===0&&z.all<Te.length&&(oe=!0)),F===0&&$e.length<Te.length&&yT(e,h,X,ue)===0){z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C};break}}z&&a.moveElements([h],{x:z.x-q.x,y:z.y-q.y})}}const xT=60;function hl(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 bT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=_=>ht(_).filter(h=>!t.has(lt(h))),a=_=>_.filter(h=>h.kind==="pool-overlap"),s=new Map(n.shapes.map(_=>[_.id,_])),c=(_,h)=>h.x>=_.x&&h.y>=_.y&&h.x+h.width<=_.x+_.width&&h.y+h.height<=_.y+_.height,l=_=>{if(!s.get(_))return[_];const v=new Set,b=new Set([_]);for(let M=0;M<4;M++){let B=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...b].some(k=>{const N=s.get(k);return N&&c(P,N)})&&(v.add(P.id),B=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||b.has(P.id)||[...v].some(k=>{const N=s.get(k);return N&&c(N,P)})&&(b.add(P.id),B=!0);if(!B)break}const E=n.shapes.filter(M=>!M.parent&&!b.has(M.id)&&!v.has(M.id)&&M.type!=="bpmn:Group"&&M.type!=="bpmn:Participant").filter(M=>[...v].some(B=>{const P=s.get(B);return P&&c(P,M)})).map(M=>M.id);return[...b,...v,...E]},u=r(We(i)),p=a(u).length;if(!p)return;const d=u.length,f=[];let m=0,g=p,y=d;for(let _=0;_<6;_++){const h=We(i),v=a(r(h));if(!v.length)break;const b=new Map(h.shapes.map(k=>[k.id,k]));let E=null;for(const k of v){if(k.kind!=="pool-overlap")continue;const[N,G]=k.pools,q=b.get(N),Y=b.get(G);if(!q||!Y)continue;const[re,K]=q.x<=Y.x?[q,Y]:[Y,q];if(k.contained)continue;const Ce=s.get(re.id),Ae=s.get(K.id),Te=Ce&&Ae?Math.max(Ae.x-(Ce.x+Ce.width),0):xT,de=re.x+re.width+Te-K.x;if(de<=0)continue;const z=l(K.id).filter(oe=>i.get(oe));z.length&&(!E||de>E.dx)&&(E={movers:z,dx:de})}if(!E)break;const M=E.movers.map(k=>i.get(k)).filter(k=>!!k&&typeof k.x=="number");if(!M.length)break;o.moveElements(M,{x:E.dx,y:0}),f.push({els:M,dx:E.dx});const B=r(We(i)),P=a(B).length;P<p&&B.length<=d&&(P<g||P===g&&B.length<y||m===0)&&(m=f.length,g=P,y=B.length)}for(const{els:_,dx:h}of f.slice(m).reverse())o.moveElements(_,{x:-h,y:0})}const Es=.5,$d=150;function wT(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of _T(n))i.length<n.length&&i.some(r=>Ev(e.elementRegistry.get(r.id)))||ET(e,i)}function _T(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)<=Es?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Ev(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 ET(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(h=>h.x+h.width),r=Math.max(...o);if(r-Math.min(...o)>Es)return;const a=t.map(h=>n.get(h.id)).filter(h=>!!h&&typeof h.x=="number");if(a.length<2)return;const s=new Map(t.map(h=>[h.id,h.x]));if(a.some(h=>Math.abs(h.x-s.get(h.id))>Es))return;const c=a.map(h=>h.x+h.width);if(Math.max(...c)-Math.min(...c)<=Es)return;const l=h=>h.x+h.width,u=h=>!!h&&typeof h.width=="number",p=h=>{const v={shapes:[],edges:[],lanes:[]},b=E=>{for(const M of E.children??[]){if("waypoints"in M&&M.waypoints){v.edges.push(M);continue}M.type!=="label"&&(M.type==="bpmn:Lane"?v.lanes.push(M):v.shapes.push(M),b(M))}};return b(h),v},d=new Map(a.map(h=>[h.id,p(h)]));let f=r;for(const h of a){const{shapes:v}=d.get(h.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+$d))}const m=a.filter(h=>Math.abs(l(h)-f)>Es);if(!m.length)return;for(const h of m){const v=l(h),{shapes:b,edges:E,lanes:M}=d.get(h.id);if([...b.flatMap(k=>[l(k),...u(k.label)?[l(k.label)]:[]]),...E.flatMap(k=>[...k.waypoints.map(N=>N.x),...u(k.label)?[l(k.label)]:[]])].some(k=>k>f)||[...(h.incoming??[]).map(k=>k.waypoints[k.waypoints.length-1]),...(h.outgoing??[]).map(k=>k.waypoints[0])].some(k=>!k||k.x>f||Math.abs(k.x-v)<1))return;if(f>v){const k={x:v,y:h.y,width:f-v,height:h.height},N=new Set([h.id,...b.map(q=>q.id),...E.map(q=>q.id),...M.map(q=>q.id)]);if(n.getAll().some(q=>{var K;if("waypoints"in q&&q.waypoints||q.type==="bpmn:Group"||!u(q))return!1;const Y=q.type==="label"?(K=q.labelTarget)==null?void 0:K.id:q.id;if(!Y||N.has(Y)||N.has(q.id))return!1;const re=q;return re.x<k.x+k.width&&re.x+re.width>k.x&&re.y<k.y+k.height&&re.y+re.height>k.y}))return}}const g=()=>new Set(ht(We(n)).map(lt)),y=g(),_=m.map(h=>h.width);for(const h of m)hl(i,h,f-h.x,{layout:!1});[...g()].every(h=>y.has(h))||m.forEach((h,v)=>hl(i,h,_[v],{layout:!1}))}function ST(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ht(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(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!p.length)continue;const d=p.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(d.length!==p.length)continue;const f=s(p),m=s(d),g=m.l+(l.x-f.l),y=m.t+(l.y-f.t),_=m.r+(l.x+l.width-f.r),h=m.b+(l.y+l.height-f.b),v={x:g,y,width:_-g,height:h-y};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const b=r(We(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(We(i)).length>b&&o.resizeShape(u,E)}}const gl=20,ml=10;function RT(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(ht(f,{includeObservationOnly:!0}).filter(m=>m.kind==="edge-along-group-boundary").map(lt)),s=We(o),c=ht(s,{includeObservationOnly:!0}).filter(f=>f.kind==="edge-along-group-boundary"&&!t.has(lt(f)));if(!c.length)return;const l=new Map(n.shapes.map(f=>[f.id,f])),u=new Map;for(const f of c)u.set(f.group,[...u.get(f.group)??[],f]);for(const[f,m]of u){const g=s.shapes.find($e=>$e.id===f);if(!((p=g==null?void 0:g.members)!=null&&p.length))continue;const y=l.get(f);if(!(!y||Math.abs(y.x-g.x)>=.5||Math.abs(y.y-g.y)>=.5||Math.abs(y.width-g.width)>=.5||Math.abs(y.height-g.height)>=.5))continue;const h=g.members.map($e=>o.get($e)).filter($e=>!!$e&&typeof $e.x=="number");if(!h.length)continue;const v=Math.min(...h.map($e=>$e.x)),b=Math.min(...h.map($e=>$e.y)),E=Math.max(...h.map($e=>$e.x+$e.width)),M=Math.max(...h.map($e=>$e.y+$e.height)),B=g.x,P=g.y,k=g.x+g.width,N=g.y+g.height;let G=B,q=P,Y=k,re=N;for(const $e of m){const F=s.edges.find(R=>R.id===$e.edge);if(!F)continue;const C=F.endpoints.some(R=>{const W=s.shapes.find(Pe=>Pe.id===R);if(!W||W.container)return!1;const J=W.x+W.width/2,fe=W.y+W.height/2;return B<J&&J<k&&P<fe&&fe<N});for(const R of un(F)){const W=R.axis==="v"?[P,N]:[B,k];Math.min(R.hi,W[1])-Math.max(R.lo,W[0])<dd||(R.axis==="v"?B<R.at&&R.at<k:P<R.at&&R.at<N)&&C||(R.axis==="v"?(Math.abs(R.at-B)<=ba&&(G=Math.max(G,R.at+gl)),Math.abs(R.at-k)<=ba&&(Y=Math.min(Y,R.at-gl))):(Math.abs(R.at-P)<=ba&&(q=Math.max(q,R.at+gl)),Math.abs(R.at-N)<=ba&&(re=Math.min(re,R.at-gl))))}}if(G>v-ml&&(G=B),q>b-ml&&(q=P),Y<E+ml&&(Y=k),re<M+ml&&(re=N),G===B&&q===P&&Y===k&&re===N)continue;const K=o.get(f),Ce={x:K.x,y:K.y,width:K.width,height:K.height},Ae=We(o),Te=new Set(ht(Ae).map(lt)),de=a(Ae);r.resizeShape(K,{x:G,y:q,width:Y-G,height:re-q});let z=We(o),oe=ht(z).filter($e=>!Te.has(lt($e)));const V=[];if(oe.length>0&&oe.every($e=>$e.kind==="label-over-line"&&!i.has($e.edge)&&z.edges.some(F=>F.id===$e.edge))){for(const $e of oe){if($e.kind!=="label-over-line")continue;const F=z.edges.find(fe=>fe.id===$e.edge),C=F&&Dd(F,z),R=(d=o.get($e.edge))==null?void 0:d.label;if(!C||!R)continue;const W=C.x-R.x,J=C.y-R.y;r.moveElements([R],{x:W,y:J}),V.push({label:R,dx:W,dy:J})}z=We(o),oe=ht(z).filter($e=>!Te.has(lt($e)))}const ue=a(z),be=[...ue].some($e=>!de.has($e));if(oe.length||be||ue.size>=de.size){for(const $e of V.reverse())r.moveElements([$e.label],{x:-$e.dx,y:-$e.dy});r.resizeShape(K,Ce)}}}function MT(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Wp((o==null?void 0:o.$parent)??o),a=ps(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:Up(u,i,r),requests:Xp(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 Fd(e,t,n={}){var Ae,Te;const{i18n:i,lower:o=_v}=n,r=fv(e),a=my(r.elementRegistry),s=ov(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=KA(t,a,i),u=i&&l.writes.size?MT(l.writes,r.elementRegistry,r.canvas,i):void 0,p=We(r.elementRegistry),d=new Set(ht(p).map(lt)),f=new Set(ht(p,{includeObservationOnly:!0}).map(lt)),m=new Set(yv(l.ops,de=>{var z,oe;return(oe=(z=r.elementRegistry.get(de))==null?void 0:z.source)==null?void 0:oe.id}).keys()),g=new Set(p.edges.map(de=>de.id).filter(de=>!m.has(de))),y=new Set(t.flatMap(de=>de.kind==="sequenceFlow.update"&&(de.source!==void 0||de.target!==void 0)?[de.id]:[])),_=()=>new Set(p.edges.filter(de=>{var oe;const z=(oe=r.elementRegistry.get(de.id))==null?void 0:oe.waypoints;return z?!(z.length===de.waypoints.length&&de.waypoints.every((V,X)=>Math.round(V.x)===Math.round(z[X].x)&&Math.round(V.y)===Math.round(z[X].y))):!1}).map(de=>de.id)),h=(de,z)=>new Set([...de].filter(oe=>!z.has(oe))),v=new Set(p.shapes.map(de=>de.id)),b=new Set(t.flatMap(de=>de.kind==="annotation.update"&&de.placement?[de.id]:[])),E=eo(p),M=E.length,B=new Set(E.map(([de,z])=>`${de}|${z}`)),P=Ei(p),k=new Set(P.map(([de,z])=>`${de}|${z}`)),N=new Map;for(const de of r.elementRegistry.filter(z=>"waypoints"in z&&!!z.waypoints))de.label&&N.set(de.id,{wps:de.waypoints.map(z=>({x:z.x,y:z.y})),label:{x:de.label.x,y:de.label.y},source:(Ae=de.source)==null?void 0:Ae.id,target:(Te=de.target)==null?void 0:Te.id});const G=e.get("commandStack");try{hT(r,l.writes),vm(G,()=>{o(l.ops,r);for(const X of(u==null?void 0:u.contexts())??[])G.execute(Yp,X);bT(r,d,p),wT(r,p),ST(r,d,p),EA(r,p,y),bA(r,g,v),Py(r,g);const de=_d(r,d),z=uA(r,gT(r),g,y);Sy(r,B,g);const oe=_(),V=Wy(r,d,h(g,oe),oe);Iy(r,g),IA(r,g,y),Hy(r,d,g),GA(r,d,g),yA(r,k,g),TA(r,g,p),Zy(r,d,h(g,_())),Xy(r,g,new Set([...y,...V,...z])),Qy(r,v),vT(r,d,v,de,b),_d(r,d,de),RT(r,f,p,g),ev(r,d),Ky(r,N,fT(r))})}catch(de){return{ok:!1,issues:[de instanceof vv?de.issue:{kind:"lower-failed",message:de instanceof Error?de.message:String(de)}],findings:[],stats:c}}const q=We(r.elementRegistry),Y=mT(p,q,de=>{var V,X,ue;const z=r.elementRegistry.get(de),oe=[...(z==null?void 0:z.incoming)??[],...(z==null?void 0:z.outgoing)??[]].find(be=>be.type==="bpmn:Association");return oe&&(((V=oe.source)==null?void 0:V.id)===de?(X=oe.target)==null?void 0:X.id:(ue=oe.source)==null?void 0:ue.id)}),re=ht(q,{includeObservationOnly:!0}).filter(de=>!f.has(lt(de))||_s(de).some(z=>Y.has(z))),K=ay(q),Ce=Ei(q);return{ok:!0,issues:[],findings:re,stats:{edgeCrossings:{before:M,after:K.pairs.length,pairs:K.pairs,solidPairs:K.solidPairs,dashedPairs:K.dashedPairs,mixedPairs:K.mixedPairs,crossPoolMessages:K.crossPoolMessages},sharedEndpointCrossings:{before:P.length,after:Ce.length,pairs:Ce}}}}function CT(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Sv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Rv(e,t){const n=Sv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Mv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function AT(e){return typeof e=="string"&&jp.includes(e)}function Vi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Cv(e,t={}){const n=e.rootElements??[],i=n.find(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:{}},d=[],f=[],m=[],g=[],y=[],_=[],h=[],v=new Map,b=new Set,E=new Set,M=z=>{z&&b.add(z)},B=z=>{b.add(z),E.add(z)},P=z=>{const oe=Mv(z,"bwl:Placement");if(!oe)return;const V=typeof oe.anchor=="string"?oe.anchor:void 0;if(!V||!AT(oe.side))return;const X=typeof oe.offset=="number"?oe.offset:void 0;y.push({owner:z.id,anchor:V,side:oe.side,...X!==void 0?{offset:X}:{}})},k=z=>{const oe=Mv(z,"bwl:Members"),V=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];V.length&&h.push({owner:z.id,refs:V})},N=z=>{var oe;for(const V of z)switch(M(V.id),V.$type){case"bpmn:TextAnnotation":B(V.id),v.set(V.id,V),c.push({id:V.id,text:typeof V.text=="string"?V.text:""}),P(V);break;case"bpmn:Association":m.push({id:V.id,type:V.$type,source:Vi(V.sourceRef),target:Vi(V.targetRef)});break;case"bpmn:Group":{B(V.id),v.set(V.id,V);const X=(oe=V.categoryValueRef)==null?void 0:oe.value;l.push({id:V.id,...typeof X=="string"&&X?{name:X}:{}}),k(V);break}default:u.push({id:V.id,type:V.$type,reason:"type-outside-mvp"})}},G=z=>{for(const oe of z.flowElements??[])M(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"}),(oe.flowElements??[]).length&&G(oe);for(const oe of z.artifacts??[])M(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"})},q=(z,oe)=>{const V=z.flowElements??[],X=(z.laneSets??[]).flatMap(be=>be.lanes??[]),ue=new Map;for(const be of X){M(be.id),v.set(be.id,be);for(const $e of be.flowNodeRef??[]){const F=Vi($e);F&&ue.set(F,be.id)}}for(const be of V){if(M(be.id),v.set(be.id,be),be.$type==="bpmn:SequenceFlow"){d.push({id:be.id,source:Vi(be.sourceRef),target:Vi(be.targetRef),...typeof be.name=="string"&&be.name?{name:be.name}:{}});continue}if(be.$type==="bpmn:DataStoreReference"){B(be.id),s.push({id:be.id,...be.name?{name:be.name}:{}});continue}const $e=CT(be.$type),F=$e==="intermediateCatchEvent"?$p((be.eventDefinitions??[]).map(J=>J.$type)):void 0;if(!dm($e)||$e==="intermediateCatchEvent"&&!F){u.push({id:be.id,type:be.$type,reason:"type-outside-mvp"});continue}B(be.id);const C=$e==="boundaryEvent"?Vi(be.attachedToRef):void 0;a.push({id:be.id,type:$e,...be.name?{name:be.name}:{},...oe?{participant:oe}:{},...ue.has(be.id)?{lane:ue.get(be.id)}:{},...C?{attachedTo:C}:{},...F?{eventDefinition:F}:{}}),$e==="subProcess"&&G(be);const R=Rv(be,"bwl:band");R!==void 0&&(p.bands[be.id]=R);const W=Sv(be,"bwl:afterColumn");typeof W=="string"&&W!==""&&_.push([be.id,W]);for(const J of be.dataOutputAssociations??[])M(J.id),g.push({id:J.id,type:J.$type,source:be.id,target:Vi(J.targetRef)});for(const J of be.dataInputAssociations??[])M(J.id),g.push({id:J.id,type:J.$type,source:Vi((J.sourceRef??[])[0]),target:be.id})}N(z.artifacts??[])};if(i){const z=new Set;for(const oe of i.participants??[]){B(oe.id),v.set(oe.id,oe);const V=Vi(oe.processRef);V&&z.add(V);const X=V?o.get(V):void 0,ue=((X==null?void 0:X.laneSets)??[]).flatMap(C=>C.lanes??[]),be=ue.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of be)B(C.id);const $e=!X||(X.flowElements??[]).length===0&&ue.length===0&&(X.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...$e?{blackBox:!0}:{},...be.length?{lanes:be}:{}});const F=Rv(oe,"bwl:poolOrder");F!==void 0&&(p.poolOrders[oe.id]=F),X&&q(X,oe.id)}for(const oe of i.messageFlows??[])M(oe.id),v.set(oe.id,oe),f.push({id:oe.id,source:Vi(oe.sourceRef),target:Vi(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});N(i.artifacts??[]);for(const[oe,V]of o)!z.has(oe)&&(V.flowElements??[]).length>0&&u.push({id:oe,type:V.$type,reason:"unreachable-process"})}else for(const z of o.values())q(z);const Y=[],re=[],K=[],Ce=[],Ae=(z,oe)=>!!z&&!!oe&&E.has(z)&&E.has(oe);for(const z of d){if(!Ae(z.source,z.target)){u.push({id:z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Y.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of f){if(!Ae(z.source,z.target)){u.push({id:z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}re.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of g){if(!Ae(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}Ce.push({...z.id?{id:z.id}:{},source:z.source,target:z.target}),z.id&&E.add(z.id)}for(const z of m){if(!Ae(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}K.push({...z.id?{id:z.id}:{},source:z.source,target:z.target})}const Te=new Map(l.map(z=>[z.id,z]));for(const{owner:z,refs:oe}of h){const V=oe.filter(ue=>b.has(ue)),X=Te.get(z);X&&V.length&&(X.members=V)}for(const z of y)b.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 _)b.has(oe)&&(p.afterColumns[z]=oe);const de={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Y,...re.length?{messageFlows:re}:{},...s.length?{dataStores:s}:{},...Ce.length?{dataAssociations:Ce}:{},...c.length?{annotations:c}:{},...K.length?{associations:K}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:de,hints:p,omitted:u,i18n:TT(de,v,e,t.i18n)}:{definition:de,hints:p,omitted:u}}function TT(e,t,n,i){const o=Wp(n),r=ps(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Up(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of Xp(u))r.includes(d.locale)&&a.push({id:c.id,...d})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function PT(e,t={}){const{definitions:n,warnings:i}=await xa(e);return{...Cv(n,t),warnings:i}}const kT=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function jd(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function OT(e){return jd(e.processRef)!==void 0}function DT(e){const t=new Set,n=o=>{const r=jd(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 LT(e){const t=[],n=i=>{for(const o of i.flowElements??[])kT.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 IT(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 Hd(e){const t=[],n=e.rootElements??[],i=DT(e);for(const r of LT(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??[])OT(s)&&IT(r.get(jd(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 BT(e){const{definitions:t,warnings:n}=await xa(e);return{issues:Hd(t),warnings:n}}const NT=.5,$T=8,FT=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Sa=e=>typeof e=="number"?e:Number(e??NaN),yl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function jT(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}=${yl(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=>`${yl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(yl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function HT(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?[Sa(s.x),Sa(s.y),Sa(s.width),Sa(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=yl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(d=>[Sa(d.x),Sa(d.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function Av(e){const t=HT(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:")&&!FT.has(s)&&n.set(c,{type:s,props:jT(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 Tv(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function Pv(e,t,n={}){const i=n.moveTolerance??NT,o=Av(e),r=Av(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||Tv(p.geometry,u.geometry,i)||Tv(p.label,u.label,n.labelTolerance??$T))&&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 zT(e,t,n={}){const[i,o]=await Promise.all([xa(e),xa(t)]);return{...Pv(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function GT(e){return new Set([...e.added,...e.modified])}function kv(e){return e.get("moddle").ids}function Ov(e,t,n){const i=Object.prototype.hasOwnProperty.call(e,"nextPrefixed"),o=e.nextPrefixed;e.nextPrefixed=t;try{return n()}finally{i?e.nextPrefixed=o:delete e.nextPrefixed}}function Dv(e,t){const n=kv(e),i=n.nextPrefixed,o=[];return{value:Ov(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function Lv(e,t,n){const i=kv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:Ov(i,function(l,u){const p=t[r++];return p!==void 0&&p.startsWith(l)&&!this.assigned(p)?(this.claim(p,u),a++,p):(s++,o.call(this,l,u))},n),fed:a,missed:s,remaining:Math.max(0,t.length-r)}}function VT(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Iv(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>Fd(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?Dv(e,r):{value:r(),generatedIds:void 0};if(!a.ok)return{status:"rejected",issues:a.issues};const{xml:c}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:c??"",findings:a.findings,stats:a.stats,...s?{generatedIds:s}:{}}}const Ss=()=>typeof performance>"u"?Date.now():performance.now();function WT(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class zd extends Error{constructor(t,n){super(n),this.reason=t}}async function Bv(e,t,{expectedXml:n,i18n:i}){const o=Ss(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(Ss()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(Ss()-o)};const a=e.get("commandStack"),s=xm(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=Lv(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const m=Fd(e,d.ops,{...i?{i18n:i}:{}});if(!m.ok)throw new zd("rejected",`배치 ${f+1}/${t.length} — ${WT(m.issues)}`)})});if(p.missed||p.remaining)throw new zd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof zd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=bm(a,s);if(!l)try{const{xml:p}=await e.saveXML({format:!0});p!==n&&(l={reason:"xml"})}catch(p){l={reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}return l?(u&&a.undo(),{status:"diverged",...l,ms:Math.round(Ss()-o)}):{status:"replayed",ms:Math.round(Ss()-o)}}const UT=new Set(["lasso","lasso.selection","hand","hand.move"]),Nv=1e4,qT="bwl-edit-locked",$v=new WeakMap;function YT(e){const t=$v.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",Nv,()=>{var s;if(o)return UT.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"],Nv,()=>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(qT,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 $v.set(e,a),a}const KT=Symbol("bpmn-editor"),Gd={geometry:[],semantic:[]};function XT(){const e=Se.ref(!1),t=Se.ref(!0),n=Se.ref(!1),i=Se.shallowRef(Gd),o=Se.shallowRef(void 0),r=Se.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=Gd;return}const h=ht(We(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:h,semantic:v?Hd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const h=p();if(!h||!a){r.value=void 0;return}const v=h.locales(),b={};for(const E of v)b[E]={untranslated:h.untranslatedCount(E),reviewRequested:h.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:h.getDisplayLocale()??a.designLocale,counts:b}}function f(){const h=p();h&&(h.configure(a),a&&s&&(s=h.setDisplayLocale(s)))}const m=()=>{l||(e.value=!0,u())};function g(h,v){YT(h).set(!v)}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function _(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(h){a=h,f(),d()},setDisplayLocale(h){var b;s=h;const v=(b=p())==null?void 0:b.setDisplayLocale(h);v&&(s=v),d()},setChangeScope(h){o.value=h===void 0?void 0:new Set(h)},requestFocus(h){if(!c)return;const v=c.get("elementRegistry").get(h);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(h){const v=c==null?void 0:c.get("elementRegistry").get(h),b=v==null?void 0:v.businessObject;if(!b)return;const E=typeof b.name=="string"&&b.name.trim()!==""?b.name:b.text;return{name:typeof E=="string"&&E.trim()!==""?E.trim():void 0,type:typeof b.$type=="string"?b.$type:""}},attach(h){c&&this.detach(),c=h,c.get("eventBus").on("commandStack.changed",m),t.value||g(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",m),c&&!t.value&&g(c,!0),c=void 0,i.value=Gd,o.value=void 0,r.value=void 0},setEditable(h){t.value=h,c&&g(c,h)},async applyAgentBatch(h,v){const b=y();n.value=!0;try{const E=await Iv(b,h,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(h,v){const b=y(),E=e.value;n.value=!0,l=!0;try{const M=await Bv(b,h,{expectedXml:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return e.value=M.status==="replayed"?!1:E,M}finally{l=!1,n.value=!1,u()}},async importXml(h){const{warnings:v}=await y().importXML(h);return e.value=!1,o.value=void 0,u(),{warnings:pd(v)}},async saveXml(){const{xml:h}=await y().saveXML({format:!0});return e.value=!1,h??""},undo:()=>{var h;return(h=_())==null?void 0:h.undo()},redo:()=>{var h;return(h=_())==null?void 0:h.redo()},canUndo:()=>{var h;return((h=_())==null?void 0:h.canUndo())??!1},canRedo:()=>{var h;return((h=_())==null?void 0:h.canRedo())??!1}}}const ZT=new RegExp("\\p{Script=Hangul}","u"),JT=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,QT=new RegExp("\\p{Script=Han}","u");function vl(e){const t=ZT.test(e),n=JT.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:QT.test(e)?"han":"other"}}function Fv(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 jv(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=Dr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Vo(a).filter(l=>An(l))})}return n}const Rs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function eP(e,t={}){const n=Fv(e),i=jv(e);let o;const r={},a=[],s=[],c=[];for(const g of i){const y=g.trs.filter(_=>(_.body??"")===g.name).map(An);if(y.length){const _=[...y].sort().join("+");r[_]=(r[_]??0)+1,o=o?new Set([...o].filter(h=>y.includes(h))):new Set(y)}else g.trs.some(_=>_.body)?a.push(Rs(g)):c.push({e:g,inference:vl(g.name)});for(const _ of g.trs){const h=An(_),v=_.body??"",b=vl(v);b.locale&&b.locale!==h?s.push({...Rs(g),locale:h,script:b.script}):h==="ko"&&b.script==="han"&&g.trs.some(E=>E!==_&&E.body===v)&&s.push({...Rs(g),locale:h,script:"han"})}}const l=new Set(c.map(g=>g.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const g=l.size===1?[...l][0]:void 0;g&&o.has(g)?[u,p]=[g,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const d=n??u,f=[],m=[];for(const{e:g,inference:y}of c)y.locale?y.locale!==d&&f.push({...Rs(g),locale:y.locale}):m.push({...Rs(g),script:y.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:m,drift:a,matchedBy:r,scriptMismatch:s}}function tP(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Fv(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(jv(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(d=>d.body))continue;const l=c.trs.find(d=>An(d)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Or,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Hv(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const Vd=e=>An(e)||void 0,zv=e=>e.body??"";function Gv(e){const t=new Map;for(const n of Hv(e)){const i=Vo(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Vd(o),body:zv(o)}))})}return t}const Vv=e=>JSON.stringify(e.map(t=>t.body).sort());class nP{constructor(){ln(this,"byId",new Map);ln(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};Wv(this.byId,o,a),Wv(this.byBodies,Vv(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Vv(t))??[]}}function Wv(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function iP(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function Wd(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function oP(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const rP=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function aP(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Gv(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=iP(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(y=>y.doc===t.doc&&Wd(y.state,c)).sort((y,_)=>_.version-y.version).slice(0,1).map(y=>y.state)],["lineage",t.index.sameId(a).filter(y=>y.doc!==t.doc&&Wd(y.state,c)).map(y=>y.state)],["bodies",t.index.sameBodies(s.cells).filter(y=>!(y.doc===t.doc&&y.id===a)&&Wd(y.state,c)).map(y=>y.state)]].find(([,y])=>y.length);if(!p){if(!r(s))continue;for(const[y,_]of c)for(let h=0;h<_;h++)n.unresolved.push({...l,body:y,script:vl(y).script});continue}const[d,f]=p,m=f.map(y=>oP(s,y,c));if(m.some(y=>y.overflow)||new Set(m.map(rP)).size>1){n.ambiguous.push({...l,source:d});continue}const[g]=m;for(const y of g.stale)n.stale.push({...l,...y});g.cells.length&&n.restores.push({...l,source:d,cells:g.cells})}return n}function sP(e,t){if(!t.restores.length)return 0;const n=new Map(Hv(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=Vo(r),s=new Set(a.map(Vd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Vd(p)&&zv(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Ne(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function cP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ud={exports:{}},Uv;function lP(){if(Uv)return Ud.exports;Uv=1;var e=Ud.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},Ud.exports}var uP=lP(),pP=cP(uP);function to(e){if(!(this instanceof to))return new to(e);e=e||[128,36,1],this._seed=e.length?pP.rack(e[0],e[1],e[2]):e}to.prototype.next=function(e){return this._seed(e||!0)},to.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},to.prototype.claim=function(e,t){this._seed.set(e,t||!0)},to.prototype.assigned=function(e){return this._seed.get(e)||!1},to.prototype.unclaim=function(e){delete this._seed.hats[e]},to.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const wn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};wn.td=wn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],wn.option=wn.optgroup=[1,'<select multiple="multiple">',"</select>"],wn.thead=wn.tbody=wn.colgroup=wn.caption=wn.tfoot=[1,"<table>","</table>"],wn.polyline=wn.ellipse=wn.polygon=wn.circle=wn.text=wn.line=wn.path=wn.rect=wn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Vt(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(wn,i)?wn[i]:wn._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 dP(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 Kn(e,...t){const n=e.style;return U(t,function(i){i&&U(i,function(o,r){n[r]=o})}),e}function Tn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const fP=Object.prototype.toString;function Pt(e){return new Xo(e)}function Xo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xo.prototype.add=function(e){return this.list.add(e),this},Xo.prototype.remove=function(e){return fP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xo.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},Xo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xo.prototype.array=function(){return Array.from(this.list)},Xo.prototype.has=Xo.prototype.contains=function(e){return this.list.contains(e)};function xl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Hr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function hP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bl={},qv;function gP(){if(qv)return bl;qv=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return bl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},bl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},bl}var Yv=gP(),mP=hP(Yv),Ye=dP({__proto__:null,default:mP},[Yv]),Kv=["focus","blur"];function yP(e,t,n,i,o){return Kv.indexOf(n)!==-1&&(o=!0),Ye.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Hr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function vP(e,t,n,i){return Kv.indexOf(t)!==-1&&(i=!0),Ye.unbind(e,t,n,i)}var ci={bind:yP,unbind:vP};function qd(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ct(e,t){return t=t||document,t.querySelector(e)}function Ms(e,t){return t=t||document,t.querySelectorAll(e)}function no(e){e.parentNode&&e.parentNode.removeChild(e)}function xP(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function bP(e,t){return t.appendChild(xP(e,t))}function ot(e,t){return bP(t,e),e}var Yd=2,Xv={"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":Yd,"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":Yd,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function wP(e,t){return Xv[t]?e.style[t]:e.getAttributeNS(null,t)}function Zv(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Xv[i];o?(o===Yd&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function _P(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Zv(e,o,t[o])}function De(e,t,n){if(typeof t=="string")if(n!==void 0)Zv(e,t,n);else return wP(e,t);else _P(e,t);return e}const EP=Object.prototype.toString;function mt(e){return new Zo(e)}function Zo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zo.prototype.add=function(e){return this.list.add(e),this},Zo.prototype.remove=function(e){return EP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zo.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},Zo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zo.prototype.array=function(){return Array.from(this.list)},Zo.prototype.has=Zo.prototype.contains=function(e){return this.list.contains(e)};function Cs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Kd(e){return e.cloneNode(!0)}var Xd={svg:"http://www.w3.org/2000/svg"},Jv='<svg xmlns="'+Xd.svg+'"';function SP(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Xd.svg)===-1&&(e=Jv+e.substring(4)):(e=Jv+">"+e+"</svg>",t=!0);var n=RP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function RP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function He(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=SP(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Xd.svg,e),t&&De(n,t),n}var Zd=null;function Qv(){return Zd===null&&(Zd=He("svg")),Zd}function ex(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function MP(e,t,n,i,o,r){var a=Qv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return ex(a,e);case 6:return ex(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function As(e){return Qv().createSVGTransform()}var tx=/([&<>]{1})/g,CP=/([&<>\n\r"]{1})/g,AP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Jd(e,t){function n(i,o){return AP[o]||o}return e.replace(t,n)}function nx(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Jd(e.textContent,tx));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,'="',Jd(r.value,CP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)nx(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Jd(e.nodeValue,tx),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function TP(e){for(var t=e.firstChild,n=[];t;)nx(t,n),t=t.nextSibling;return n.join("")}function ix(e,t){return TP(e)}function pn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function PP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function kP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(PP(e,i))}function Ts(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),kP(n,t)),n.consolidate()}const OP=/^class[ {]/;function DP(e){return OP.test(e.toString())}function Qd(e){return Array.isArray(e)}function ef(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wl(...e){e.length===1&&Qd(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const LP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,IP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,BP=/\/\*([^*]*)\*\//m;function NP(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(DP(e)?LP:IP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(BP);return(o&&o[1]||i).trim()})||[]}function ox(e,t){const n=t||{get:function(v,b){if(i.push(v),b===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const b=i.join(" -> ");return i.length=0,new Error(b?`${v} (Resolving: ${b})`:v)};function c(v,b){if(!o[v]&&v.includes(".")){const E=v.split(".");let M=c(E.shift());for(;E.length;)M=M[E.shift()];return M}if(ef(r,v))return r[v];if(ef(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,b)}function l(v,b){if(typeof b>"u"&&(b={}),typeof v!="function")if(Qd(v))v=wl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||NP(v)).map(B=>ef(b,B)?b[B]:c(B));return{fn:v,dependencies:M}}function u(v){const{fn:b,dependencies:E}=l(v),M=Function.prototype.bind.call(b,null,...E);return new M}function p(v,b,E){const{fn:M,dependencies:B}=l(v,E);return M.apply(b,B)}function d(v){return wl(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),M=Object.create(null),B=[],P=[],k=[];let N,G,q,Y;for(let re in o)N=o[re],b.indexOf(re)!==-1&&(N[2]==="private"?(G=B.indexOf(N[3]),G===-1?(q=N[3].createChild([],b),Y=d(q),B.push(N[3]),P.push(q),k.push(Y),E[re]=[Y,re,"private",q]):E[re]=[k[G],re,"private",P[G]]):E[re]=[N[2],N[1]],M[re]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(K=>{N[1].$scope.indexOf(K)!==-1&&(E[re]=[N[2],N[1]],M[K]=!0)});b.forEach(re=>{if(!M[re])throw new Error('No provider for "'+re+'". Cannot use provider from the parent!')}),v.unshift(E)}return new ox(v,a)}const m={factory:p,type:u,value:function(v){return v}};function g(v,b){const E=v.__init__||[];return function(){E.forEach(M=>{typeof M=="string"?b.get(M):b.invoke(M)})}}function y(v){const b=v.__exports__;if(b){const E=v.__modules__,M=Object.keys(v).reduce((G,q)=>(q!=="__exports__"&&q!=="__modules__"&&q!=="__init__"&&q!=="__depends__"&&(G[q]=v[q]),G),Object.create(null)),B=(E||[]).concat(M),P=f(B),k=wl(function(G){return P.get(G)});b.forEach(function(G){o[G]=[k,G,"private",P]});const N=(v.__init__||[]).slice();return N.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:N}),g(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const M=v[E];if(M[2]==="private"){o[E]=M;return}const B=M[0],P=M[1];o[E]=[m[B],$P(B,P),B]}),g(v,a)}function _(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(_,v),v.indexOf(b)!==-1)?v:v.concat(b)}function h(v){const b=v.reduce(_,[]).map(y);let E=!1;return function(){E||(E=!0,b.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=f,this.init=h(e)}function $P(e,t){return e!=="value"&&Qd(t)&&(t=wl(t.slice())),t}var FP=1e3;function Eo(e,t){var n=this;t=t||FP,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)})}Eo.prototype.canRender=function(e){},Eo.prototype.drawShape=function(e,t){},Eo.prototype.drawConnection=function(e,t){},Eo.prototype.getShapePath=function(e){},Eo.prototype.getConnectionPath=function(e){};function zr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function jP(e){return["M",e.x,e.y]}function tf(e){return["L",e.x,e.y]}function HP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function zP(e,t){const n=e.length,i=[jP(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(tf(a));continue}const c=Math.min(t,nf(a.x-r.x,a.y-r.y),nf(s.x-a.x,s.y-a.y));if(!c){i.push(tf(a));continue}const l=_l(a,r,c),u=_l(a,r,c*.5),p=_l(a,s,c),d=_l(a,s,c*.5);i.push(tf(l)),i.push(HP(u,d,p))}return i}function _l(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=nf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function nf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ps(e,t,n){et(t)&&(n=t,t=null),t||(t={});const i=He("path",t);return et(n)&&(i.dataset.cornerRadius=String(n)),of(i,e)}function of(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return De(e,{d:zr(zP(t,n))}),e}function El(e){var t=new Set(e);return ft(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Gr(e,t,n){n=n||0,Qe(e)||(e=[e]),U(e,function(i,o){var r=t(i,o,n);Qe(r)&&r.length&&Gr(r,t,n+1)})}function rf(e,t,n){var i=new Set,o=new Set;return Gr(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 ks(e,t){return rf(e)}function GP(e,t,n){kr(t)&&(t=!0),bn(t)&&(n=t,t=!0),n=n||{};var i=Os(n.allShapes),o=Os(n.allConnections),r=Os(n.enclosedElements),a=Os(n.enclosedConnections),s=Os(n.topLevel,t&&ga(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,U(u.incoming,c),U(u.outgoing,c),u.children}return Gr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function dn(e,t){t=!!t,Qe(e)||(e=[e]);var n,i,o,r;return U(e,function(a){var s=a;a.waypoints&&!t&&(s=dn(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 Ra(e,t){var n={};return U(e,function(i){var o=i;o.waypoints&&(o=dn(o)),!et(t.y)&&o.x>t.x&&(n[i.id]=i),!et(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(et(t.width)&&et(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!et(t.width)||!et(t.height))&&(n[i.id]=i)}),n}function rx(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ax(e){return!!(e&&e.isFrame)}function Os(e,t){return Z({},e||{},t||{})}var VP=1;function Jo(e,t){Eo.call(this,e,VP),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})}Ne(Jo,Eo),Jo.prototype.canRender=function(){return!0},Jo.prototype.drawShape=function(t,n,i){var o=He("rect");return De(o,{x:0,y:0,width:n.width||0,height:n.height||0}),ax(n)?De(o,Z({},this.FRAME_STYLE,i||{})):De(o,Z({},this.SHAPE_STYLE,i||{})),ot(t,o),o},Jo.prototype.drawConnection=function(t,n,i){var o=Ps(n.waypoints,Z({},this.CONNECTION_STYLE,i||{}));return ot(t,o),o},Jo.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 zr(a)},Jo.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 zr(r)},Jo.$inject=["eventBus","styles"];function WP(){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 Z(r,{class:n})},this.style=function(n,i){!Qe(n)&&!i&&(i=n,n=[]);var o=si(n,function(r,a){return Z(r,e[a]||{})},{});return i?Z(o,i):o},this.computeStyle=function(n,i,o){return Qe(i)||(o=i,i=[]),t.style(i||[],Z({},o,n||{}))}}const UP={__init__:["defaultRenderer"],defaultRenderer:["type",Jo],styles:["type",WP]};function rn(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function sn(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 af(e,t){return!e||!t?-1:e.indexOf(t)}function Ds(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sf(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=Ds(e,t);return Math.abs(o/r)<=i}var qP=2;function So(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(YP(o,n))return r;return!1}function YP(e,t){const n=t[0];return zo(t,function(i){return Math.abs(n[e]-i[e])<=qP})}function sx(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 KP=/,?([a-z]),?/gi,cx=parseFloat,fn=Math,Qo=fn.PI,io=fn.min,oo=fn.max,lx=fn.pow,er=fn.abs,XP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,ZP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,ux=Array.isArray||function(e){return e instanceof Array};function JP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function QP(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 e2(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 JP(o,i)?(QP(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function t2(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(XP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(ZP,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=uf,n}function n2(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 i2(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 lf(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 uf(){return this.join(",").replace(KP,"$1")}function o2(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=uf,t}function px(e,t,n,i,o,r,a,s,c){var l=1-c,u=lx(l,3),p=lx(l,2),d=c*c,f=d*c,m=u*e+p*3*c*n+l*3*c*c*o+f*a,g=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:Sl(m),y:Sl(g)}}function dx(e){var t=u2(...e);return lf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function r2(e,t){return e=lf(e),t=lf(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function fx(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 hx(e,t,n,i,o,r,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,m=0;m<u;m++){var g=l*p[m]+l,y=fx(g,e,n,o,a),_=fx(g,t,i,r,s),h=y*y+_*_;f+=d[m]*fn.sqrt(h)}return l*f}function a2(e,t,n,i,o,r,a,s){if(!(oo(e,n)<io(o,a)||io(e,n)>oo(o,a)||oo(t,i)<io(r,s)||io(t,i)>oo(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=Sl(c/u),d=Sl(l/u),f=+p.toFixed(2),m=+d.toFixed(2);if(!(f<+io(e,n).toFixed(2)||f>+oo(e,n).toFixed(2)||f<+io(o,a).toFixed(2)||f>+oo(o,a).toFixed(2)||m<+io(t,i).toFixed(2)||m>+oo(t,i).toFixed(2)||m<+io(r,s).toFixed(2)||m>+oo(r,s).toFixed(2)))return{x:p,y:d}}}}function Sl(e){return Math.round(e*1e11)/1e11}function s2(e,t,n){var i=dx(e),o=dx(t);if(!r2(i,o))return[];var r=hx(...e),a=hx(...t),s=mx(e)?1:~~(r/5)||1,c=mx(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,m;for(f=0;f<s+1;f++){var g=px(...e,f/s);l[f]={x:g.x,y:g.y,t:f/s}}for(f=0;f<c+1;f++)g=px(...t,f/c),u[f]={x:g.x,y:g.y,t:f/c};for(f=0;f<s;f++)for(m=0;m<c;m++){var y=l[f],_=l[f+1],h=u[m],v=u[m+1],b=er(_.x-y.x)<.01?"y":"x",E=er(v.x-h.x)<.01?"y":"x",M=a2(y.x,y.y,_.x,_.y,h.x,h.y,v.x,v.y),B;if(M){if(B=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[B])continue;p[B]=!0;var P=y.t+er((M[b]-y[b])/(_[b]-y[b]))*(_.t-y.t),k=h.t+er((M[E]-h[E])/(v[E]-h[E]))*(v.t-h.t);P>=0&&P<=1&&k>=0&&k<=1&&d.push({x:M.x,y:M.y,t1:P,t2:k})}}return d}function gx(e,t,n){e=xx(e),t=xx(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],m=0,g=e.length;m<g;m++){var y=e[m];if(y[0]=="M")i=s=y[1],o=c=y[2];else{y[0]=="C"?(p=[i,o,...y.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,h=t.length;_<h;_++){var v=t[_];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(d=[r,a,...v.slice(1)],r=d[6],a=d[7]):(d=[r,a,r,a,l,u,l,u],r=l,a=u);var b=s2(p,d);{for(var E=0,M=b.length;E<M;E++)b[E].segment1=m,b[E].segment2=_,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function c2(e){return ux(e)&&ux(e[0])}function l2(e){if(n2(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":o=+l[1]+n,r=+l[2]+i;default:for(var d=1,f=l.length;d<f;d++)c[d]=+l[d]+(d%2?n:i)}else for(var m=0,g=l.length;m<g;m++)c[m]=l[m];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=uf,t}function mx(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Rl(e,t,n,i){return[e,t,n,i,n,i]}function yx(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 vx(e,t,n,i,o,r,a,s,c,l){var u=Qo*120/180,p=Qo/180*(+o||0),d=[],f,m=e2(function(F,C,R){var W=F*fn.cos(R)-C*fn.sin(R),J=F*fn.sin(R)+C*fn.cos(R);return{x:W,y:J}});if(l)B=l[0],P=l[1],E=l[2],M=l[3];else{f=m(e,t,-p),e=f.x,t=f.y,f=m(s,c,-p),s=f.x,c=f.y;var g=(e-s)/2,y=(t-c)/2,_=g*g/(n*n)+y*y/(i*i);_>1&&(_=fn.sqrt(_),n=_*n,i=_*i);var h=n*n,v=i*i,b=(r==a?-1:1)*fn.sqrt(er((h*v-h*y*y-v*g*g)/(h*y*y+v*g*g))),E=b*n*y/i+(e+s)/2,M=b*-i*g/n+(t+c)/2,B=fn.asin(((t-M)/i).toFixed(9)),P=fn.asin(((c-M)/i).toFixed(9));B=e<E?Qo-B:B,P=s<E?Qo-P:P,B<0&&(B=Qo*2+B),P<0&&(P=Qo*2+P),a&&B>P&&(B=B-Qo*2),!a&&P>B&&(P=P-Qo*2)}var k=P-B;if(er(k)>u){var N=P,G=s,q=c;P=B+u*(a&&P>B?1:-1),s=E+n*fn.cos(P),c=M+i*fn.sin(P),d=vx(s,c,n,i,o,0,a,G,q,[P,N,E,M])}k=P-B;var Y=fn.cos(B),re=fn.sin(B),K=fn.cos(P),Ce=fn.sin(P),Ae=fn.tan(k/4),Te=4/3*n*Ae,de=4/3*i*Ae,z=[e,t],oe=[e+Te*re,t-de*Y],V=[s+Te*Ce,c-de*K],X=[s,c];if(oe[0]=2*z[0]-oe[0],oe[1]=2*z[1]-oe[1],l)return[oe,V,X].concat(d);d=[oe,V,X].concat(d).join().split(",");for(var ue=[],be=0,$e=d.length;be<$e;be++)ue[be]=be%2?m(d[be-1],d[be],p).y:m(d[be],d[be+1],p).x;return ue}function u2(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,m,g,y,_,h=0;h<2;++h){if(h==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,d=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,d=3*i-3*t),er(u)<1e-12){if(er(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}y=p*p-4*d*u,_=fn.sqrt(y),!(y<0)&&(m=(-p+_)/(2*u),0<m&&m<1&&c.push(m),g=(-p-_)/(2*u),0<g&&g<1&&c.push(g))}for(var v=c.length,b=v,E;v--;)f=c[v],E=1-f,l[0][v]=E*E*E*e+3*E*E*f*n+3*E*f*f*o+f*f*f*a,l[1][v]=E*E*E*t+3*E*E*f*i+3*E*f*f*r+f*f*f*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:io(...l[0]),y0:io(...l[1]),x1:oo(...l[0]),y1:oo(...l[1])}}function xx(e){if(c2(e)||(e=t2(e)),i2(e))return e;for(var t=o2(l2(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,m){var g,y;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C",...vx(f.x,f.y,...d.slice(1))];break;case"S":m=="C"||m=="S"?(g=f.x*2-f.bx,y=f.y*2-f.by):(g=f.x,y=f.y),d=["C",g,y,...d.slice(1)];break;case"T":m=="Q"||m=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C",...yx(f.x,f.y,f.qx,f.qy,d[1],d[2])];break;case"Q":f.qx=d[1],f.qy=d[2],d=["C",...yx(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...Rl(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...Rl(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...Rl(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...Rl(f.x,f.y,f.X,f.Y)];break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var m=d[f];m.length;)r[f]="A",d.splice(f++,0,["C",...m.splice(0,6)]);d.splice(f,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=cx(u[p-4])||n.x,n.by=cx(u[p-3])||n.y}return t}function Lt(e){return bn(e)&&ai(e,"waypoints")}function ut(e){return bn(e)&&ai(e,"labelTarget")}function p2(e){return bn(e)&&fa(e.parent)}function bx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ro(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ml(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function d2(e){return Ro({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function f2(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var d=t[p-1];if(d){var f=l[l.length-1],m=f&&f.endLength||0,g=m2(d,u);l.push({start:d,end:u,startLength:m,endLength:m+g,length:g})}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 tt(e){return Lt(e)?f2(e):d2(e)}function Nn(e,t,n){n=n||0,bn(n)||(n={x:n,y:n});var i=Ze(e),o=Ze(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 Ls(e,t,n){var i=h2(e,t);return i.length===1||i.length===2&&Ds(i[0],i[1])<1?Ro(i[0]):i.length>1?(i=Xi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),Ro(i[n?0:i.length-1])):null}function h2(e,t){return gx(e,t)}function g2(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ds(n,o)===0||sf(i,o,n)?e.splice(t,1):t++;return e}function m2(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 wx(e){return et(e)?e+"px":e}function y2(e){for(;e.parent;)e=e.parent;return e}function v2(e){e=Z({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Kn(n,{position:"relative",overflow:"hidden",width:wx(e.width),height:wx(e.height)}),t.appendChild(n),n}function _x(e,t,n){const i=He("g");mt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const x2="base",Ex=0,b2=1,w2={shape:["x","y","width","height"],connection:["waypoints"]};function nt(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||{})}nt.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],nt.prototype._init=function(e){const t=this._eventBus,n=this._container=v2(e),i=this._svg=He("svg");De(i,{width:"100%",height:"100%"}),Tn(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")}),ot(n,i);const o=this._viewport=_x(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)},nt.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},nt.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},nt.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=rx(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},nt.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},nt.prototype.restoreFocus=function(){this._restoreFocus()},nt.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},nt.prototype.isFocused=function(){return this._focused},nt.prototype.getDefaultLayer=function(){return this.getLayer(x2,Ex)},nt.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},nt.prototype._getChildIndex=function(e){return si(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},nt.prototype._createLayer=function(e,t){typeof t>"u"&&(t=b2);const n=this._getChildIndex(t);return{group:_x(this._viewport,"layer-"+e,n),index:t,visible:!0}},nt.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},nt.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&&(pn(n),t.visible=!1),n},nt.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],pn(t.group))},nt.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},nt.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(y2(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},nt.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},nt.prototype._findPlaneForRoot=function(e){return $t(this._planes,function(t){return t.rootElement===e})},nt.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},nt.prototype._resolveElements=function(e){return Qe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},nt.prototype.getContainer=function(){return this._container},nt.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&&(U([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),mt(o).add(t)):(e.markers.delete(t),mt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},nt.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},nt.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},nt.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},nt.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},nt.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},nt.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,Ex);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},nt.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},nt.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},nt.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)},nt.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})},nt.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})},nt.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=w2[e];if(!zo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},nt.prototype._setParent=function(e,t,n){sn(t.children,e,n),e.parent=t},nt.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},nt.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},nt.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},nt.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),rn(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},nt.prototype.removeShape=function(e){return this._removeElement(e,"shape")},nt.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},nt.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},nt.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},nt.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},nt.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);Ts(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Ts(t),o=a?a.matrix:MP(),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},nt.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=Z({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Sx(t,n)}),{x:n.e,y:n.f}},nt.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(m=>m!=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=dn(r),s=Ze(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const d=Ze(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-d.right),g=Math.min(0,s.left-d.left),y=Math.max(0,s.bottom-d.bottom),_=Math.min(0,s.top-d.top);u=m||g,p=y||_}this.scroll({dx:-u*l,dy:-p*l})},nt.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 Sx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}nt.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},nt.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=Z(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),Sx(this._viewport,u),u},nt.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},nt.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}},nt.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ma="data-element-id";function xi(e){this._elements={},this._eventBus=e}xi.$inject=["eventBus"],xi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),De(t,Ma,i),n&&De(n,Ma,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},xi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(De(i.gfx,Ma,""),i.secondaryGfx&&De(i.secondaryGfx,Ma,""),delete t[n])},xi.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)},xi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&De(t,Ma,i),t},xi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&De(e,Ma);var n=this._elements[t];return n&&n.element},xi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},xi.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}},xi.prototype.getAll=function(){return this.filter(function(e){return e})},xi.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)})},xi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},xi.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 _2(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 E2(e){return e.__refs_collection===!0}function S2(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Rx(e,t,n){var i=_2(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 R2(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 Ri(e,t){if(!(this instanceof Ri))return new Ri(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ri.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?Rx(this,t,e):R2(this,t,e)},Ri.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return E2(n)||Rx(this,t,e),n},Ri.prototype.ensureBound=function(e,t){S2(e,t)||this.bind(e,t)},Ri.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ri.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 Ri({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Mx=new Ri({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Cx=new Ri({name:"attachers",collection:!0},{name:"host"}),Ax=new Ri({name:"outgoing",collection:!0},{name:"source"}),Tx=new Ri({name:"incoming",collection:!0},{name:"target"});function Ca(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),pf.bind(this,"parent"),Mx.bind(this,"labels"),Ax.bind(this,"outgoing"),Tx.bind(this,"incoming")}function Is(){Ca.call(this),pf.bind(this,"children"),Cx.bind(this,"host"),Cx.bind(this,"attachers")}Ne(Is,Ca);function Px(){Ca.call(this),pf.bind(this,"children")}Ne(Px,Is);function kx(){Is.call(this),Mx.bind(this,"labelTarget")}Ne(kx,Is);function Ox(){Ca.call(this),Ax.bind(this,"source"),Tx.bind(this,"target")}Ne(Ox,Ca);var M2={connection:Ox,shape:Is,label:kx,root:Px};function C2(e,t){var n=M2[e];if(!n)throw new Error("unknown type: <"+e+">");return Z(new n,t)}function A2(e){return e instanceof Ca}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=Z({},t||{}),t.id||(t.id=e+"_"+this._uid++),C2(e,t)};var Al="__fn",Dx=1e3,T2=Array.prototype.slice;function li(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}li.prototype.on=function(e,t,n,i){if(e=Qe(e)?e:[e],Sn(t)&&(i=n,n=t,t=Dx),!et(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})})},li.prototype.once=function(e,t,n,i){var o=this;if(Sn(t)&&(i=n,n=t,t=Dx),!et(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)},li.prototype.off=function(e,t){e=Qe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},li.prototype.createEvent=function(e){var t=new Bs;return t.init(e),t},li.prototype.fire=function(e,t){var n,i,o,r;if(r=T2.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}},li.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},li.prototype._destroy=function(){this._listeners={}},li.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},li.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=P2(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},li.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},li.prototype._getListeners=function(e){return this._listeners[e]},li.prototype._setListeners=function(e,t){this._listeners[e]=t},li.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){Z(this,e||{})};function P2(e,t){return e.apply(null,t)}function nr(e){return e.childNodes[0]}function k2(e){return e.parentNode.childNodes[1]}function Tl(e,t,n,i,o){var r=As();r.setTranslate(t,n);var a=As();a.setRotate(i||0,0,0);var s=As();s.setScale(1,1),Ts(e,[r,a,s])}function $n(e,t,n){var i=As();i.setTranslate(t,n),Ts(e,i)}function Lx(e,t){var n=As();n.setRotate(t,0,0),Ts(e,n)}function bi(e,t){this._eventBus=e,this._elementRegistry=t}bi.$inject=["eventBus","elementRegistry"],bi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=k2(t),n||(n=He("g"),mt(n).add("djs-children"),ot(t.parentNode,n))):n=t,n},bi.prototype._clear=function(e){var t=nr(e);return xl(t),t},bi.prototype._createContainer=function(e,t,n,i){var o=He("g");mt(o).add("djs-group"),typeof n<"u"?O2(o,t,t.childNodes[n]):ot(t,o);var r=He("g");mt(r).add("djs-element"),mt(r).add("djs-"+e),i&&mt(r).add("djs-frame"),ot(o,r);var a=He("g");return mt(a).add("djs-visual"),ot(r,a),r},bi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ax(t))},bi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=si(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),U(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;U(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},bi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},bi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},bi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},bi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},bi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),$n(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?De(n,"display","none"):De(n,"display","block")}},bi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);pn(t.parentNode)};function O2(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const D2={__depends__:[UP],__init__:["canvas"],canvas:["type",nt],elementRegistry:["type",xi],elementFactory:["type",Mo],eventBus:["type",li],graphicsFactory:["type",bi]};function L2(e){var t=new ox(e);return t.init(),t}function I2(e){e=e||{};var t={config:["value",e]},n=[t,D2].concat(e.modules||[]);return L2(n)}function ir(e,t){this._injector=t||I2(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Wn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function ti(e,t){return e.$instanceOf(t)}function B2(e){return $t(e.rootElements,function(t){return ti(t,"bpmn:Process")||ti(t,"bpmn:Collaboration")})}function N2(e){var t={},n=[],i={};function o(V,X){return function(ue){V(ue,X)}}function r(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,X){var ue=V.gfx;if(ue)throw new Error(`already rendered ${Wn(V)}`);return e.element(V,i[V.id],X)}function c(V,X){return e.root(V,i[V.id],X)}function l(V,X){try{var ue=i[V.id]&&s(V,X);return r(V),ue}catch(be){u(be.message,{element:V,error:be}),console.error(`failed to import ${Wn(V)}`,be)}}function u(V,X){e.error(V,X)}var p=this.registerDi=function(X){var ue=X.bpmnElement;ue?i[ue.id]?u(`multiple DI elements defined for ${Wn(ue)}`,{element:ue}):i[ue.id]=X:u(`no bpmnElement referenced in ${Wn(X)}`,{element:X})};function d(V){f(V.plane)}function f(V){p(V),U(V.planeElement,m)}function m(V){p(V)}this.handleDefinitions=function(X,ue){var be=X.diagrams;if(ue&&be.indexOf(ue)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ue&&be&&be.length&&(ue=be[0]),!ue)throw new Error("no diagram to display");i={},d(ue);var $e=ue.plane;if(!$e)throw new Error(`no plane for ${Wn(ue)}`);var F=$e.bpmnElement;if(!F)if(F=B2(X),F)u(`correcting missing bpmnElement on ${Wn($e)} to ${Wn(F)}`),$e.bpmnElement=F,p($e);else throw new Error("no process or collaboration to display");var C=c(F,$e);if(ti(F,"bpmn:Process")||ti(F,"bpmn:SubProcess"))y(F,C);else if(ti(F,"bpmn:Collaboration"))z(F,C),_(X.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Wn($e)}: ${Wn(F)}`);g(n)};var g=this.handleDeferred=function(){for(var X;n.length;)X=n.shift(),X()};function y(V,X){Ae(V,X),k(V.ioSpecification,X),P(V.artifacts,X),r(V)}function _(V,X){var ue=ft(V,function(be){return!a(be)&&ti(be,"bpmn:Process")&&be.laneSets});ue.forEach(o(y,X))}function h(V,X){l(V,X)}function v(V,X){U(V,o(h,X))}function b(V,X){l(V,X)}function E(V,X){l(V,X)}function M(V,X){l(V,X)}function B(V,X){l(V,X)}function P(V,X){U(V,function(ue){ti(ue,"bpmn:Association")?n.push(function(){B(ue,X)}):B(ue,X)})}function k(V,X){V&&(U(V.dataInputs,o(E,X)),U(V.dataOutputs,o(M,X)))}var N=this.handleSubProcess=function(X,ue){Ae(X,ue),P(X.artifacts,ue)};function G(V,X){var ue=l(V,X);ti(V,"bpmn:SubProcess")&&N(V,ue||X),ti(V,"bpmn:Activity")&&k(V.ioSpecification,X),n.push(function(){U(V.dataInputAssociations,o(b,X)),U(V.dataOutputAssociations,o(b,X))})}function q(V,X){l(V,X)}function Y(V,X){l(V,X)}function re(V,X){n.push(function(){var ue=l(V,X);V.childLaneSet&&K(V.childLaneSet,ue||X),oe(V)})}function K(V,X){U(V.lanes,o(re,X))}function Ce(V,X){U(V,o(K,X))}function Ae(V,X){Te(V.flowElements,X),V.laneSets&&Ce(V.laneSets,X)}function Te(V,X){U(V,function(ue){ti(ue,"bpmn:SequenceFlow")?n.push(function(){q(ue,X)}):ti(ue,"bpmn:BoundaryEvent")?n.unshift(function(){G(ue,X)}):ti(ue,"bpmn:FlowNode")?G(ue,X):ti(ue,"bpmn:DataObject")||(ti(ue,"bpmn:DataStoreReference")||ti(ue,"bpmn:DataObjectReference")?Y(ue,X):u(`unrecognized flowElement ${Wn(ue)} in context ${Wn(X&&X.businessObject)}`,{element:ue,context:X}))})}function de(V,X){var ue=l(V,X),be=V.processRef;be&&y(be,ue||X)}function z(V,X){U(V.participants,o(de,X)),n.push(function(){v(V.messageFlows,X)}),P(V.artifacts,X)}function oe(V){U(V.flowNodeRef,function(X){var ue=X.get("lanes");ue&&ue.push(V)})}}function Ix(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(g,y){return i.add(g,y)},element:function(g,y,_){return i.add(g,y,_)},error:function(g,y){s.push({message:g,context:y})}},d=new N2(p);u=u||l.diagrams&&l.diagrams[0];var f=$2(l,u);if(!f)throw new Error("no diagram to display");U(f,function(g){d.handleDefinitions(l,g)});var m=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(m+"_plane")||r.findRoot(m))}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 $2(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=F2(n));var o;A(i,"bpmn:Collaboration")?o=i:o=$t(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return $t(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=zn(o.participants,function(l){return l.processRef}),r.push(o));var a=Bx(r),s=[t],c=[n];return U(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 Bx(e){var t=[];return U(e,function(n){n&&(t.push(n),t=t.concat(Bx(n.flowElements)))}),t}function F2(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var j2='<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>',Nx=j2,$x={verticalAlign:"middle"},Fx={color:"#404040"},H2={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},z2={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},G2={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"},V2='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Nx+'</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>',ro;function W2(){ro=Vt(V2),Kn(ro,H2),Kn(Ct("svg",ro),$x),Kn(Ct(".backdrop",ro),z2),Kn(Ct(".notice",ro),G2),Kn(Ct(".link",ro),Fx,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function U2(){ro||(W2(),ci.bind(ro,".backdrop","click",function(e){document.body.removeChild(ro)})),document.body.appendChild(ro)}const Pl=5,jx="djs-outline-hidden";function Xt(e){e=Z({},Y2,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),X2(this._container)}Ne(Xt,ir),Xt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(d){throw this._emit("import.parse.complete",{error:d}),d}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),kl(s,r),s=q2(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw kl(r,[]),r}if(typeof t=="string"&&(i=K2(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw kl(r,[]),r}try{this.clear()}catch(r){throw kl(r,[]),r}const{warnings:o}=await Ix(this,n,i);return{warnings:o}},Xt.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},Xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Ct(":scope > defs",i._svg),a=ix(o),s=r?"<defs>"+ix(r)+"</defs>":"",c=i.getContainer();Pt(c).add(jx);let l;try{l=o.getBBox()}finally{Pt(c).remove(jx)}const u=l.x-Pl,p=l.y-Pl,d=l.width+Pl*2,f=l.height+Pl*2;t=`<?xml version="1.0" encoding="utf-8"?>
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 DM(e){e=Z({format:!1,preamble:!0},e||{});function t(n,i){var o=i||new kM,r=new OM(o,e.format);e.preamble&&r.append(yM);var a=new qt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(LM(s)),a.build(n).serializeTo(r),!i)return o.value}return{toXML:t}}function LM(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in od)n[i]=od[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 Kc(e,t){_i.call(this,e,t)}Kc.prototype=Object.create(_i.prototype),Kc.prototype.fromXML=function(e,t,n){ri(t)||(n=t,t="bpmn:Definitions");var i=new cd(Z({model:this,lax:!0},n)),o=i.handler(t);return i.fromXML(e,o)},Kc.prototype.toXML=function(e,t){var n=new DM(t);return new Promise(function(i,o){try{var r=n.toXML(e);return i({xml:r})}catch(a){return o(a)}})};var IM="BPMN20",BM="http://www.omg.org/spec/BPMN/20100524/MODEL",NM="bpmn",$M=[],FM=[{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"}]}],jM=[{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"}]}],HM={tagAlias:"lowerCase",typePrefix:"t"},zM={name:IM,uri:BM,prefix:NM,associations:$M,types:FM,enumerations:jM,xml:HM},GM="BPMNDI",VM="http://www.omg.org/spec/BPMN/20100524/DI",WM="bpmndi",UM=[{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"]}],qM=[{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"}]}],YM=[],KM={name:GM,uri:VM,prefix:WM,types:UM,enumerations:qM,associations:YM},XM="DC",ZM="http://www.omg.org/spec/DD/20100524/DC",JM="dc",QM=[{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}]}],eC=[],tC={name:XM,uri:ZM,prefix:JM,types:QM,associations:eC},nC="DI",iC="http://www.omg.org/spec/DD/20100524/DI",oC="di",rC=[{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"}]}],aC=[],sC={tagAlias:"lowerCase"},cC={name:nC,uri:iC,prefix:oC,types:rC,associations:aC,xml:sC},lC="bpmn.io colors for BPMN",uC="http://bpmn.io/schema/bpmn/biocolor/1.0",pC="bioc",dC=[{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"}]}],fC=[],hC=[],gC={name:lC,uri:uC,prefix:pC,types:dC,enumerations:fC,associations:hC},mC="BPMN in Color",yC="http://www.omg.org/spec/BPMN/non-normative/color/1.0",vC="color",xC=[{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"}]}],bC=[],wC=[],_C={name:mC,uri:yC,prefix:vC,types:xC,enumerations:bC,associations:wC};const EC={bpmn:zM,bpmndi:KM,dc:tC,di:cC,bioc:gC,color:_C};function Gm(e,t){const n=Z({},EC,e);return new Kc(n,t)}const SC={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"}},gs={[Em]:SC,[Fp]:mm};function Vm(){return Gm(gs)}const Wm=Vm();async function xa(e){const{rootElement:t,warnings:n}=await Wm.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function RC(e){const{xml:t}=await Wm.toXML(e,{format:!0});return t}function pd(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Qi={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Um=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function MC(e){return Um.test(e)}function CC(e){const t=Qi;return Um.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 Nr(e,t){let n=0;for(const i of e)n+=t*CC(i);return n}function qm(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&AC(e),TC(e),PC(e),kC(e)}function AC(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:Nr(o,r),fontBoundingBoxAscent:r*Qi.ascentEm,fontBoundingBoxDescent:r*Qi.descentEm,actualBoundingBoxAscent:r*Qi.ascentEm,actualBoundingBoxDescent:r*Qi.descentEm}}};t.getContext=()=>n}function TC(e){if(e.SVGMatrix)return;class t{constructor(){ln(this,"a",1);ln(this,"b",0);ln(this,"c",0);ln(this,"d",1);ln(this,"e",0);ln(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 PC(e){var r;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,l=0){const u=s*Math.PI/180,p=Math.cos(u),d=Math.sin(u);a.a=p,a.b=d,a.c=-d,a.d=p,a.e=c-p*c+d*l,a.f=l-d*c-p*l},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(r=e.SVGSVGElement)==null?void 0:r.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const o=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(o,"transform")||Object.defineProperty(o,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function kC(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:Nr(n,12),height:14}})}const Xc=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),OC=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),DC=1,Zc=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),LC=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}`;case"merge-before-predecessor":return`mb|${e.merge}|${e.edge}`}}const Ym=20,Jc=5,Km=3,IC=8,ba=15,dd=50,Xm=12,BC=Xm*1.2;function fd(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(r=>Nr(r,Xm))),o=n.length*BC;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-o/2,width:i,height:o}}const Zm=1;function un(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 un(e))for(const s of un(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Zm)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>=Ym&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function hd(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Jm(e,t){const n=$r(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function NC(e,t){let n=0;for(const i of t)i.id!==e.id&&Jm(e,i)&&n++;return n}function ei(e,t){let n=0;for(const i of t)i.id!==e.id&&$r(e,i)&&n++;return n}const Qm=15,ey=20;function $C(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-ey||t.at>n[1]+ey)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 gd=20;function Qc(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Zm)continue;const o=Math.max(e.lo,i.lo),r=Math.min(e.hi,i.hi);r-o<Ym||n.push([o-gd,r+gd])}return n}function el(e,t){const n=e.label;if(!n)return null;let i=null;for(const o of un(e)){const r=$C(n,o);if(r){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Qc(o,un(a)))if(Math.min(c,r[1])>Math.max(s,r[0])){i={other:a.id,axis:o.axis};break}}}}return i}const FC=10,jC=1,HC=(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 zC(e,t,n,i){const o=n.x+i,r=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=o||s<=r)return!1;const c=t.x-e.x,l=t.y-e.y;let u=0,p=1;const d=(f,m)=>{if(m===0)return f<=0;const g=f/m;if(m>0){if(g>p)return!1;g>u&&(u=g)}else{if(g<u)return!1;g<p&&(p=g)}return!0};return d(o-e.x,c)&&d(e.x-a,-c)&&d(r-e.y,l)&&d(e.y-s,-l)&&p>u}function md(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 GC=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,wa=1;function Hi(e,t){const n=e.x+wa,i=e.x+e.width-wa,o=e.y+wa,r=e.y+e.height-wa;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 _a(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 ty(e,t){const n=e.label;if(!n)return null;if(un(e).some(i=>Hi(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(un(i).some(o=>Hi(n,o)))return i.id;for(const i of t.shapes.filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(_a(i).some(o=>Hi(n,o)))return i.id;return null}function Ot(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(zC(e.waypoints[r],e.waypoints[r+1],o,LC)){i.push(o);break}}return i}const ms=(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))},VC=(e,t,n,i)=>iy(e,t,n,i)?0:Math.min(ms(e,n,i),ms(t,n,i),ms(n,e,t),ms(i,e,t)),ny=(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 wo(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,ms({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(ny(e,s)||ny(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,VC(e,t,s[l],s[(l+1)%s.length]));return c}function iy(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 yd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function oy(e,t){for(let n=0;n+1<e.waypoints.length;n++)for(let i=0;i+1<t.waypoints.length;i++)if(iy(e.waypoints[n],e.waypoints[n+1],t.waypoints[i],t.waypoints[i+1]))return!0;return!1}function ys(e,t){let n=0;for(const i of t)i.id===e.id||yd(e,i)||oy(e,i)&&n++;return n}function Vn(e,t){let n=0;for(const i of t)i.id===e.id||yd(e,i)||ys(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function ry(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++)ys(n[i],[n[o]])>0&&(t+=n[i].type===n[o].type?2:1);return t}function eo(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(ys(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 Ei(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let o=i+1;o<n.length;o++)if(yd(n[i],n[o])&&oy(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 ay(e){const t=eo(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:WC(e)}}function WC(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 sy(e,t,n){const i=new Set(t.flatMap(o=>[...o.members]));return e.shapes.filter(o=>!o.container&&!Zc.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 cy(e){var n;const t=(n=Ut(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const o=Ut(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 ly=e=>e?{members:e}:{},Ln=e=>e.shapes.filter(t=>!t.container);function UC(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 qC(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 uy(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(un(i).some(o=>Hi(n,o)))return i.id;for(const i of[...t.shapes].filter(o=>o.container).sort((o,r)=>o.id.localeCompare(r.id)))if(_a(i).some(o=>Hi(n,o)))return i.id;return null}function Ko(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 py=3;function dy(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 vs(e,t){const n=[];for(const i of t.shapes){if(i.container||Zc.has(i.type))continue;const o=dy(e,i);o>=py&&n.push({shape:i.id,depth:o})}return n.sort((i,o)=>i.shape.localeCompare(o.shape))}function vd(e){const t=[],n=e.filter(o=>o.type==="bpmn:Participant"),i=(o,r)=>o.x<=r.x&&o.y<=r.y&&o.x+o.width>=r.x+r.width&&o.y+o.height>=r.y+r.height;for(let o=0;o<n.length;o++)for(let r=o+1;r<n.length;r++){const a=n[o],s=n[r];a.x+a.width<=s.x||s.x+s.width<=a.x||a.y+a.height<=s.y||s.y+s.height<=a.y||t.push({pools:[a.id,s.id],contained:i(a,s)||i(s,a)})}return t}function YC(e){const t=e.edges.filter(s=>s.type==="bpmn:SequenceFlow"&&!!s.source&&!!s.target),n=new Map,i=new Map;for(const s of t)n.set(s.source,[...n.get(s.source)??[],s.target]),i.set(s.target,[...i.get(s.target)??[],s.source]);const o=(s,c)=>{const l=new Set([s]),u=[s];for(;u.length;)for(const p of c.get(u.pop())??[])l.has(p)||(l.add(p),u.push(p));return l},r=new Map(e.shapes.map(s=>[s.id,s])),a=[];for(const[s,c]of i){const l=r.get(s);if(!l)continue;const u=o(s,n),p=[...new Set(c)].filter(f=>!u.has(f)&&r.has(f));if(p.length<2)continue;const d=p.map(f=>o(f,i));if([...d[0]].some(f=>d.every(m=>m.has(f)))){for(const f of p)if(!(l.x+l.width/2>=r.get(f).x))for(const m of t)m.source===f&&m.target===s&&a.push({kind:"merge-before-predecessor",merge:s,edge:m.id})}}return a}function ht(e,t={}){const n=[],i=e.shapes.filter(h=>!h.container);for(const h of e.edges)for(const v of Ot(h,i))n.push({kind:"edge-crosses-shape",edge:h.id,shape:v.id});const o=e.shapes.filter(h=>h.container&&OC.has(h.type));if(o.length){const h=(v,b)=>{const E=e.shapes.find(M=>M.id===b);return!!E&&E.x>=v.x&&E.y>=v.y&&E.x+E.width<=v.x+v.width&&E.y+E.height<=v.y+v.height};for(const v of e.edges)for(const b of Ot(v,o))v.endpoints.includes(b.id)||v.endpoints.some(E=>h(b,E))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}for(const h of e.edges){if(h.waypoints.length<2)continue;const v=[[h.source,h.waypoints[0]],[h.target,h.waypoints[h.waypoints.length-1]]];for(const[b,E]of v){if(!b)continue;const M=e.shapes.find(N=>N.id===b);if(!M||M.container)continue;const B=Math.max(M.x-E.x,E.x-(M.x+M.width),0),P=Math.max(M.y-E.y,E.y-(M.y+M.height),0),k=Math.hypot(B,P);k>FC&&n.push({kind:"edge-endpoint-detached",edge:h.id,shape:b,distance:Math.round(k)})}}for(const h of vd(e.shapes))n.push({kind:"pool-overlap",...h});const r=i.filter(h=>!h.attached);for(let h=0;h<r.length;h++)for(let v=h+1;v<r.length;v++){const b=r[h],E=r[v];if(!md(b,E,DC))continue;const M=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:"shape-overlap",shapes:M,identical:GC(b,E)})}const a=e.shapes.filter(h=>h.type==="bpmn:Group"&&Array.isArray(h.members)&&h.members.length>0);for(let h=0;h<a.length;h++)for(let v=h+1;v<a.length;v++){const b=a[h],E=a[v],M=Math.min(b.x+b.width,E.x+E.width)-Math.max(b.x,E.x),B=Math.min(b.y+b.height,E.y+E.height)-Math.max(b.y,E.y);if(M<=Jc||B<=Jc)continue;const P=b.id<E.id?[b.id,E.id]:[E.id,b.id],k=new Set(E.members);if(b.members.some(G=>k.has(G))){const G=sy(e,a,{x:Math.max(b.x,E.x),y:Math.max(b.y,E.y),right:Math.min(b.x+b.width,E.x+E.width),bottom:Math.min(b.y+b.height,E.y+E.height)});G.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:P,shapes:G});continue}const N=b.x<=E.x&&b.y<=E.y&&b.x+b.width>=E.x+E.width&&b.y+b.height>=E.y+E.height?b.id:E.x<=b.x&&E.y<=b.y&&E.x+E.width>=b.x+b.width&&E.y+E.height>=b.y+b.height?E.id:void 0;n.push({kind:"group-overlap-unintended",groups:P,...N?{container:N}:{}})}const s=new Set(a.flatMap(h=>[...h.members])),c=h=>e.shapes.filter(v=>!v.container&&!Zc.has(v.type)&&v.x>=h.x&&v.y>=h.y&&v.x+v.width<=h.x+h.width&&v.y+v.height<=h.y+h.height);for(const h of a){const v=c(h);if(!v.length)continue;const b=new Set(h.members),E=v.filter(M=>!b.has(M.id));E.some(M=>s.has(M.id))&&(E.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:h.id,shapes:E.map(M=>M.id).sort()}))}for(const h of a){const v=new Set(c(h).map(k=>k.id)),b=new Set(h.members),E=new Set([...v].filter(k=>!b.has(k)&&s.has(k)));if(!E.size)continue;let M=!1,B=!1,P=!1;for(const k of e.edges){if(k.type!=="bpmn:SequenceFlow"||!k.source||!k.target)continue;const N=E.has(k.source),G=E.has(k.target);!N&&G&&!v.has(k.source)?M=!0:N&&!G&&!v.has(k.target)?B=!0:N&&G&&(P=!0)}M&&B&&P&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:h.id,shapes:[...E].sort()})}const l=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<l.length;h++)for(let v=h+1;v<l.length;v++)for(let b=v+1;b<l.length;b++){const E=[l[h],l[v],l[b]],M={x:Math.max(...E.map(k=>k.x)),y:Math.max(...E.map(k=>k.y)),right:Math.min(...E.map(k=>k.x+k.width)),bottom:Math.min(...E.map(k=>k.y+k.height))};if(M.right-M.x<=Jc||M.bottom-M.y<=Jc)continue;const B=sy(e,[],M);if(!B.length)continue;const P=E.map(k=>k.id).sort();n.push({kind:"group-stack-unreadable",groups:P,shapes:B})}for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||Zc.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",h.y,"h",h.x,h.x+h.width],["bottom",h.y+h.height,"h",h.x,h.x+h.width],["left",h.x,"v",h.y,h.y+h.height],["right",h.x+h.width,"v",h.y,h.y+h.height]];for(const[E,M,B,P,k]of b){const N=B==="h"?v.x:v.y,G=B==="h"?v.x+v.width:v.y+v.height;if(!(N<k&&P<G))continue;const q=B==="h"?v.y:v.x,Y=B==="h"?v.y+v.height:v.x+v.width;if(!(q<M&&M<Y))continue;const re=Math.min(M-q,Y-M);re<IC||n.push({kind:"group-cuts-shape",group:h.id,shape:v.id,side:E,depth:re})}}const u=t.includeObservationOnly?e.shapes.filter(h=>h.type==="bpmn:Group"&&h.width>0&&h.height>0):[];if(u.length){const h=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const b=un(v);if(b.length)for(const E of u){const M=E.x+E.width,B=E.y+E.height,P=v.endpoints.some(N=>{const G=h.get(N);return!!G&&E.x<G.x&&G.x<M&&E.y<G.y&&G.y<B});let k=null;for(const N of b){const[G,q,Y]=N.axis==="v"?[E.y,B,[["left",E.x],["right",M]]]:[E.x,M,[["top",E.y],["bottom",B]]],re=Math.min(N.hi,q)-Math.max(N.lo,G);if(re<dd)continue;const K=N.axis==="v"?E.x<N.at&&N.at<M:E.y<N.at&&N.at<B;if(!(K&&P))for(const[Ce,Ae]of Y){const Te=Math.abs(N.at-Ae);Te<=ba&&(!k||Te<k.distance)&&(k={side:Ce,inside:K,distance:Te,length:re})}}k&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:E.id,side:k.side,inside:k.inside,distance:Math.round(k.distance),length:Math.round(k.length)})}}}const p=e.shapes.filter(h=>h.container&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Lane");for(const h of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const b=h.x<v.x+v.width&&v.x<h.x+h.width,E=h.y<v.y+v.height&&v.y<h.y+h.height,M=[["top",h.y,v.y,b],["bottom",h.y+h.height,v.y+v.height,b],["left",h.x,v.x,E],["right",h.x+h.width,v.x+v.width,E]];for(const[B,P,k,N]of M)N&&Math.abs(P-k)<=Km&&n.push({kind:"group-on-container-boundary",group:h.id,container:v.id,side:B})}const d=e.shapes.filter(h=>h.type==="bpmn:Group");for(let h=0;h<d.length;h++)for(let v=h+1;v<d.length;v++){const b=d[h],E=d[v],M=b.x<E.x+E.width&&E.x<b.x+b.width,B=b.y<E.y+E.height&&E.y<b.y+b.height,P=[["x",b.x+b.width,E.x,B],["x",E.x+E.width,b.x,B],["y",b.y+b.height,E.y,M],["y",E.y+E.height,b.y,M]];for(const[k,N,G,q]of P)if(q&&Math.abs(N-G)<=Km){n.push({kind:"group-on-group-boundary",groups:b.id<E.id?[b.id,E.id]:[E.id,b.id],axis:k});break}}for(let h=0;h<e.edges.length;h++)for(let v=h+1;v<e.edges.length;v++){const b=e.edges[h],E=e.edges[v],M=$r(b,E);if(!M)continue;const B=b.id<E.id?[b.id,E.id]:[E.id,b.id];n.push({kind:M.kind==="opposite"?"edge-overlap-opposite":M.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:B,axis:M.axis,length:Math.round(M.length)})}for(const h of e.edges){if(!h.label)continue;const v=el(h,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:h.id,other:v.other,axis:v.axis})}for(const h of e.edges){if(!h.label)continue;const v=ty(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}if(t.includeObservationOnly){for(const h of e.edges)if(!(!h.label||h.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:b}of vs(h.label,e))n.push({kind:"label-over-shape",edge:h.id,shape:v,depth:Math.round(b)})}t.includeObservationOnly&&n.push(...YC(e));const f=new Set(i.map(h=>h.id)),m=e.shapes.filter(h=>h.type==="bpmn:Participant"&&h.label);for(const h of[...i,...m.filter(v=>!f.has(v.id))]){if(!h.label)continue;const v=uy(h,e);v&&n.push({kind:"label-over-line",edge:h.id,line:v})}const g=new Set(e.shapes.filter(h=>h.type==="bpmn:TextAnnotation").map(h=>h.id));for(const h of m)for(const{owner:v,rect:b}of Ko(e))v===h.id||g.has(v)||md(h.label,b,wa)&&n.push({kind:"pool-name-over-label",pool:h.id,label:v});const y=Ko(e);for(const h of i)if(h.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of y)v!==h.id&&md(h,b,wa)&&n.push({kind:"annotation-over-label",annotation:h.id,label:v});const _=new Map(e.shapes.map(h=>[h.id,h]));for(const h of i){const v=h.parent??UC(h,e,_);if(!v)continue;const b=_.get(v);!b||!b.container||HC(b,h,jC)||h.type==="bpmn:TextAnnotation"&&!qC(h,b,e)||n.push({kind:"shape-outside-container",shape:h.id,container:b.id})}return n.sort((h,v)=>lt(h).localeCompare(lt(v)))}const Ut=e=>typeof e=="object"&&e!==null?e:void 0,on=e=>typeof e=="number"?e:0,_o=e=>{const t=Ut(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function KC(e){const t=Ut(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=_o(r);a&&n.push(a)}}return n}function XC(e){const t=Ut(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:_o(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:_o(t.targetRef);return n&&i?{source:n,target:i}:{}}function ZC(e,t){const n=Ut(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const o=_o(n);return o?t.get(o):void 0}if(Xc.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return _o(n)}function fy(e){var a,s,c,l,u;const t=[],n=[],i=((a=Ut(e))==null?void 0:a.diagrams)??[],o=new Map,r=new Set;for(const p of((s=Ut(e))==null?void 0:s.rootElements)??[]){const d=Ut(p);if((d==null?void 0:d.$type)==="bpmn:Collaboration")for(const f of d.participants??[]){const m=Ut(f),g=_o(m),y=_o(m==null?void 0:m.processRef);g&&y?o.set(y,g):g&&r.add(g)}}for(const p of i){const d=Ut((c=Ut(p))==null?void 0:c.plane),f=(d==null?void 0:d.planeElement)??[];for(const m of f){const g=Ut(m);if(!g)continue;const y=Ut(g.bpmnElement),_=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!_)continue;const h=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",v=Ut(g.bounds);if(v){const E=g.isExpanded===!1&&h!=="bpmn:Participant",M=Ut((l=Ut(g.label))==null?void 0:l.bounds),B={id:_,type:h,x:on(v.x),y:on(v.y),width:on(v.width),height:on(v.height),container:Xc.has(h)&&!E,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:ZC(y,o)}:{},...M?{label:{x:on(M.x),y:on(M.y),width:on(M.width),height:on(M.height)}}:{},...h==="bpmn:Group"?ly(cy(y)):{}},P=g.isHorizontal!==!1,k=typeof(y==null?void 0:y.name)=="string"?y.name:"";r.has(_)&&P&&k&&(B.label=fd(B,k)),t.push(B);continue}const b=g.waypoint;if(Array.isArray(b)){const E=Ut((u=Ut(g.label))==null?void 0:u.bounds);n.push({id:_,type:h,waypoints:b.map(M=>{var B,P;return{x:on((B=Ut(M))==null?void 0:B.x),y:on((P=Ut(M))==null?void 0:P.y)}}),endpoints:KC(y),...XC(y),...E?{label:{x:on(E.x),y:on(E.y),width:on(E.width),height:on(E.height)}}:{}})}}}return{shapes:t,edges:n}}function hy(e){return ht(fy(e),{includeObservationOnly:!0})}async function JC(e){const{definitions:t,warnings:n}=await xa(e);return{findings:hy(t),warnings:n}}function We(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 g=Ut(r.label),y=_o(r.source),_=_o(r.target);n.push({id:r.id,type:a,waypoints:s.map(h=>({x:on(h.x),y:on(h.y)})),endpoints:[y,_].filter(h=>!!h),...y&&_?{source:y,target:_}:{},...g&&typeof g.x=="number"?{label:{x:g.x,y:on(g.y),width:on(g.width),height:on(g.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const c=Ut(r.businessObject),l=Ut(r.label);let u=Ut(r.parent);for(;u&&u.type==="bpmn:Lane";)u=Ut(u.parent);const p=typeof(u==null?void 0:u.type)=="string"?u.type:"",d=u&&Xc.has(p)&&p!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,f={id:r.id,type:a,x:r.x,y:r.y,width:on(r.width),height:on(r.height),container:Xc.has(a)&&(a==="bpmn:Participant"||r.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...d!==void 0?{parent:d}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:on(l.y),width:on(l.width),height:on(l.height)}}:{},...a==="bpmn:Group"?ly(cy(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=Ut(r.di))==null?void 0:i.isHorizontal)!==!1&&(f.label=fd(f,m)),t.push(f)}return{shapes:t,edges:n}}const QC={"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 eA(e,t){const n=QC[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function gy(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function my(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 eA(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&gy(i)===n).sort((i,o)=>i.y-o.y).map(i=>i.id),laneDeclarationOrderOf:n=>{var s;const i=e.get(n),o=(s=i==null?void 0:i.businessObject)==null?void 0:s.processRef,r=[],a=c=>{for(const l of c??[])for(const u of l.lanes??[])r.push(u.id),a(u.childLaneSet?[u.childLaneSet]:void 0)};return a(o==null?void 0:o.laneSets),r},participantOf:n=>{const i=e.get(n);return i?gy(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 $p(o)},reviewRequestLocalesOf:n=>{const i=e.get(n);return!i||i.type==="label"?[]:Wo(i.businessObject).map(o=>o.locale)}}}const Fr=20,tA=4,qe=(e,t)=>Math.abs(e-t)<.5,nA=15;function xd(e,t,n){let i=1/0;for(const o of t)if(!n.includes(o.id))for(let r=1;r<e.length;r++)i=Math.min(i,wo(e[r-1],e[r],o));return i}function iA(e,t,n=nA){if(e.type!=="bpmn:MessageFlow"||e.waypoints.length!==2)return[];const[i,o]=e.waypoints,r=qe(i.x,o.x)&&!qe(i.y,o.y),a=qe(i.y,o.y)&&!qe(i.x,o.x);if(!r&&!a)return[];const s=e.endpoints,c=_=>{const h=_?t.find(v=>v.id===_):void 0;return h?r?[h.x+10,h.x+h.width-10]:[h.y+10,h.y+h.height-10]:[-1/0,1/0]},[l,u]=c(s[0]),[p,d]=c(s[1]),f=Math.max(l,p),m=Math.min(u,d);if(!(m>=f))return[];const g=r?i.x:i.y,y=[];for(let _=5;_<=400;_+=5)for(const h of[-1,1]){const v=g+h*_;if(v<f||v>m)continue;const b=r?[{x:v,y:i.y},{x:v,y:o.y}]:[{x:i.x,y:v},{x:o.x,y:v}];Ot({...e,waypoints:b},t).length||xd(b,t,s)<n||y.push(b)}return y}function bd(e,t,n,i){const o=e.edges.filter(d=>d.id!==t.id),r={...t,waypoints:n},a={...t,waypoints:[...i]};if(Vn(r,o)>Vn(a,o)||ei(r,o)>ei(a,o))return!1;const s=`L|${t.id}|${t.id}`,c=d=>ht({...e,edges:e.edges.map(f=>f.id===t.id?{...f,waypoints:d}:f)}).filter(f=>lt(f)!==s),l=c(n),u=`"${t.id}"`;if(l.some(d=>JSON.stringify(d).includes(u)))return!1;const p=new Set(c([...i]).map(lt));return l.every(d=>p.has(lt(d)))}function yy(e,t,n,i){for(const o of iA(t,n))if(bd(e,t,o,i))return o;return null}const oA=120;function vy(e,t,n,i,o){if(e.type!=="bpmn:SequenceFlow"||e.endpoints.length!==2)return[];const r=t.find(c=>c.id===e.endpoints[0]),a=t.find(c=>c.id===e.endpoints[1]);if(!r||!a)return[];if(a.x<r.x+r.width)return[];if(Math.min(r.y+r.height,a.y+a.height)-Math.max(r.y,a.y)<10)return[];const s=[];for(const[c,l]of[[0,0],[0,-25],[0,25],[-25,0],[25,0]])for(let u=Fr;u<=oA;u+=5)for(const p of["top","bottom"]){const d=p==="top"?r.y:r.y+r.height,f=p==="top"?a.y:a.y+a.height,m=p==="top"?Math.min(d,f)-u:Math.max(d,f)+u,g=r.x+r.width/2+c,y=a.x+a.width/2+l,_=[{x:g,y:d},{x:g,y:m},{x:y,y:m},{x:y,y:f}];if(!rl(_,i)||Ot({...e,waypoints:_},t).length||Ot({...e,endpoints:[],waypoints:_},[r,a]).length||xd(_,t,e.endpoints)<Fr)continue;const h=Td(_,n);(o===void 0?h<Ad:h>=Ad||h<o)||s.push(_)}return s}function xy(e,t,n,i,o){const r=e.shapes.filter(c=>c.type==="bpmn:Participant"||c.type==="bpmn:Lane"),a=by(e,t,i,vy(t,n,r,o));if(a)return a;const s=Math.max(Td(i,r),Fr);return by(e,t,i,vy(t,n,r,o,s))}function by(e,t,n,i){const o=new Map;for(const c of i){const l=c[1].y<c[0].y?"top":"bottom";if(!o.has(l)&&(bd(e,t,c,n)&&o.set(l,c),o.size===2))break}const r=e.edges.filter(c=>c.id!==t.id);let a=null,s=1/0;for(const c of["top","bottom"]){const l=o.get(c);if(!l)continue;const u=Vn({...t,waypoints:l},r);u<s&&(a=l,s=u)}return a}function tl(e,t,n,i=Fr){if(qe(e.y,t.y)&&!qe(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(qe(e.x,t.x)&&!qe(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 wy(e,t,n,i=Fr){if(n.length<2)return null;if(qe(e.y,t.y)&&!qe(e.x,t.x)){const o=Math.min(e.x,t.x),r=Math.max(e.x,t.x),a=Math.min(...n.map(f=>f.x))-i,s=Math.max(...n.map(f=>f.x+f.width))+i;if(!(o<a&&s<r))return null;const c=e.x<t.x?a:s,l=e.x<t.x?s:a,u=Math.min(...n.map(f=>f.y))-i,p=Math.max(...n.map(f=>f.y+f.height))+i,d=f=>[{x:c,y:e.y},{x:c,y:f},{x:l,y:f},{x:l,y:e.y}];return[d(u),d(p)]}if(qe(e.x,t.x)&&!qe(e.y,t.y)){const o=Math.min(e.y,t.y),r=Math.max(e.y,t.y),a=Math.min(...n.map(f=>f.y))-i,s=Math.max(...n.map(f=>f.y+f.height))+i;if(!(o<a&&s<r))return null;const c=e.y<t.y?a:s,l=e.y<t.y?s:a,u=Math.min(...n.map(f=>f.x))-i,p=Math.max(...n.map(f=>f.x+f.width))+i,d=f=>[{x:e.x,y:c},{x:f,y:c},{x:f,y:l},{x:e.x,y:l}];return[d(u),d(p)]}return null}function _y(e,t,n=Fr){if(e.length!==4)return null;const[i,o,r,a]=e;if(qe(i.y,o.y)&&qe(o.x,r.x)&&qe(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(qe(i.x,o.x)&&qe(o.y,r.y)&&qe(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 nl(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const 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 il=30,rA=[0,-25,25,-40,40];function aA(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(d=>d.id===e.endpoints[0]),i=t.find(d=>d.id===e.endpoints[1]);if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=r<o,s=a?n.y+n.height:n.y,c=a?s+il:s-il,l=a?i.y+i.height:i.y,u=n.x+n.width/2,p=i.x+i.width/2;return rA.map(d=>[{x:u,y:s},{x:u,y:c},{x:p+d,y:c},{x:p+d,y:l}]).filter(d=>Ot({...e,endpoints:[],waypoints:d},[n]).length===0)}const wd=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],jr=(e,t,n)=>Ot({...e,waypoints:t},n).length,sA=25;function Ey(e,t,n){const i=n.x-t.x,o=n.y-t.y,r=i*i+o*o,a=r?Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*o)/r)):0;return{x:t.x+a*i,y:t.y+a*o}}function cA(e,t,n,i){const r=(d,f,m)=>(f.x-d.x)*(m.y-d.y)-(f.y-d.y)*(m.x-d.x),a=r(n,i,e),s=r(n,i,t);if(Math.abs(a)<1e-6&&Math.abs(s)<1e-6){const d=Ey(i,e,t),f=Ey(d,n,i);return Math.hypot(d.x-f.x,d.y-f.y)<1e-6?d:null}const c=r(e,t,n),l=r(e,t,i);if(a*s>1e-6||c*l>1e-6)return null;const u=(e.x-t.x)*(n.y-i.y)-(e.y-t.y)*(n.x-i.x);if(Math.abs(u)<1e-6)return null;const p=((e.x-n.x)*(n.y-i.y)-(e.y-n.y)*(n.x-i.x))/u;return{x:e.x+p*(t.x-e.x),y:e.y+p*(t.y-e.y)}}function lA(e,t,n){let i=0;for(const o of n){if(o.id===t.id||o.waypoints.length<2||o.target!==void 0&&o.target===t.target)continue;const r=o.waypoints[o.waypoints.length-1],a=o.waypoints[o.waypoints.length-2];for(let s=0;s+1<e.length;s++){const c=cA(e[s],e[s+1],a,r);if(c&&Math.hypot(c.x-r.x,c.y-r.y)<=sA){i++;break}}}return i}function ol(e,t,n,i){let o=[...e.waypoints],r=jr(e,o,t);if(r===0)return null;let a=!1;for(const p of nl(e,t))if(jr(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(un),c=p=>un({...e,waypoints:p}).some(d=>Qc(d,s).length>0),l=aA(e,t).filter(p=>jr(e,p,t)===0);if(l.length)return l.find(p=>!c(p))??l[0];const u=p=>!n||p.every(d=>d.x>=n.x&&d.x<=n.x+n.width&&d.y>=n.y&&d.y<=n.y+n.height);if(e.endpoints.length===2&&o.length>2){const p=t.find(f=>f.id===e.endpoints[0]),d=t.find(f=>f.id===e.endpoints[1]);if(p&&d&&qe(p.y+p.height/2,d.y+d.height/2)){const f=[o[0],o[o.length-1]];if(qe(f[0].y,f[1].y)&&!qe(f[0].x,f[1].x)){const m=t.filter(h=>!e.endpoints.includes(h.id)&&Ot({...e,waypoints:f},[h]).length>0),g=m.length>=2?wy(f[0],f[1],m):null,_=(g?g.map(h=>[f[0],...h,f[1]]):m.length===1?(tl(f[0],f[1],m[0])??[]).map(h=>[f[0],...h,f[1]]):m.length===0?[f]:[]).filter(h=>jr(e,h,t)===0&&h.length<=o.length).sort((h,v)=>Number(u(v))-Number(u(h)));if(_.length)return _.find(h=>!c(h))??_[0]}}}for(let p=0;p+1<o.length;p++){const d=o[p],f=o[p+1],m=t.filter(_=>!e.endpoints.includes(_.id)&&Ot({...e,waypoints:[d,f]},[_]).length>0);if(m.length<2)continue;const g=wy(d,f,m);if(!g)continue;const y=g.map(_=>wd(o,p,_)).filter(_=>jr(e,_,t)===0).sort((_,h)=>Number(u(h))-Number(u(_)));if(y.length)return y.find(_=>!c(_))??y[0]}for(let p=0;p<tA&&r>0;p++){let d=!1;for(let f=0;f+1<o.length&&!d;f++){const m=o[f],g=o[f+1];for(const y of t){if(e.endpoints.includes(y.id)||Ot({...e,waypoints:[m,g]},[y]).length===0)continue;const _=tl(m,g,y),v=[...(_y(o,y)??[]).map((E,M)=>({pts:E,k:M,cross:jr(e,E,t),tip:lA(E,e,i??[])})).sort((E,M)=>E.cross-M.cross||E.tip-M.tip||E.k-M.k).map(E=>E.pts),..._?_.map(E=>wd(o,f,E)):[]];if(!v.length)continue;const b=[...v].sort((E,M)=>Number(u(M))-Number(u(E)));for(const E of b){const M=jr(e,E,t);if(M<r){o=E,r=M,d=!0,a=!0;break}}if(d)break}}if(!d)break}return a&&r===0?o:null}function _d(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=Ln(r),s=new Set,c=ht(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(d=>d.id===u.edge);p&&l.set(u.edge,p)}for(const[u,p]of l){if(n&&!n.has(u))continue;const d=i.get(u);if(!d)continue;const f=d.parent,m=f&&typeof f.x=="number"&&typeof f.width=="number"?{x:f.x,y:f.y,width:f.width,height:f.height}:void 0,g=Ot(p,a);if(!n&&g.length&&g.every(M=>M.type==="bpmn:TextAnnotation")){s.add(u);continue}let y=ol(p,a,m,r.edges);const _=yy(r,p,a,y??p.waypoints);_&&(y=_);const h=xy(r,p,a,y??p.waypoints,m);if(h&&Vn({...p,waypoints:h},r.edges.filter(M=>M.id!==u))===0&&(y=h),!y){g.some(M=>M.type==="bpmn:TextAnnotation")&&s.add(u);continue}const v=r.edges.filter(M=>M.id!==u),b=ei(p,v);ei({...p,waypoints:y},v)>b||o.updateWaypoints(d,y)}return s}function uA(e,t,n,i){var f,m;const o=new Set;if(!t.length)return o;const{elementRegistry:r}=e,a=e.modeling,s=g=>{const y=We(r);return[...eo(y),...Ei(y)].filter(([_,h])=>_===g||h===g).length},c=(g,y)=>g.kind==="label-over-line"||g.kind==="label-over-shape"||g.kind==="label-on-shared-segment"?g.edge===y:g.kind==="annotation-over-label"||g.kind==="pool-name-over-label"?g.label===y:!1,l=g=>new Set(ht(We(r)).filter(y=>!c(y,g)).map(lt)),u=(g,y)=>Math.abs(g-y)<=1,p=(g,y,_,h,v)=>{const b=Ln(We(r));for(let E=0;E+3<g.length;E++){const[M,B,P,k]=[g[E],g[E+1],g[E+2],g[E+3]],N=u(M.y,k.y)&&u(M.x,B.x)&&u(P.x,k.x)&&u(B.y,P.y)&&Math.abs(B.y-M.y)>=5,G=u(M.x,k.x)&&u(M.y,B.y)&&u(P.y,k.y)&&u(B.x,P.x)&&Math.abs(B.x-M.x)>=5;if(!N&&!G)continue;const q={waypoints:[M,k],endpoints:_};if(Ot(q,[y]).length&&!Ot(q,b).length)return E}return-1},d=(g,y)=>[...g.slice(0,y+1),...g.slice(y+3)].filter((_,h,v)=>h===0||h===v.length-1||!(u(v[h-1].x,_.x)&&u(v[h+1].x,_.x)||u(v[h-1].y,_.y)&&u(v[h+1].y,_.y)));for(const g of t){const y=r.get(g.id);if(!y)continue;const _=new Set([...y.incoming??[],...y.outgoing??[]].map(b=>b.id)),h={...g,type:y.type,container:!1,attached:!1},v=r.getAll().filter(b=>{var E;return(b.type==="bpmn:SequenceFlow"||b.type==="bpmn:MessageFlow")&&n.has(b.id)&&!i.has(b.id)&&!_.has(b.id)&&(((E=b.waypoints)==null?void 0:E.length)??0)>=4}).sort((b,E)=>b.id.localeCompare(E.id));for(const b of v){const E=[(f=b.source)==null?void 0:f.id,(m=b.target)==null?void 0:m.id].filter(M=>!!M);for(;;){const M=b.waypoints.map(K=>({x:K.x,y:K.y})),B=p(M,h,E,b.id,b.type);if(B<0)break;const P=b.label,k=P&&{x:P.x,y:P.y},N=l(b.id),G=s(b.id);if(a.updateWaypoints(b,d(M,B)),P&&k){const K={x:k.x+P.width/2,y:k.y+P.height/2},Ce=(Te,de)=>{const z=de.x-Te.x,oe=de.y-Te.y,V=z*z+oe*oe,X=V===0?0:Math.max(0,Math.min(1,((K.x-Te.x)*z+(K.y-Te.y)*oe)/V));return Math.hypot(K.x-(Te.x+X*z),K.y-(Te.y+X*oe))};let Ae=0;for(let Te=1;Te+1<M.length;Te++)Ce(M[Te],M[Te+1])<Ce(M[Ae],M[Ae+1])&&(Ae=Te);(Ae<B||Ae>B+2)&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y})}const q=l(b.id),Y=[...q].filter(K=>!N.has(K)).length,re=[...N].filter(K=>!q.has(K)).length;if(Y<=re&&s(b.id)<=G){o.add(b.id);continue}a.updateWaypoints(b,M),P&&k&&(P.x!==k.x||P.y!==k.y)&&a.moveElements([P],{x:k.x-P.x,y:k.y-P.y});break}}}return o}const pA=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 xs(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 rl=(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),Ed=(e,t)=>ys(e,[t])>0;function Sy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=Ln(r);let s=r;const c=new Set(ht(r).map(lt));for(const[l,u]of eo(r))if(!t.has(`${l}|${u}`))for(const[p,d]of[[l,u],[u,l]]){if(n.has(p))continue;const f=s.edges.find(B=>B.id===p),m=s.edges.find(B=>B.id===d);if(!f||!m)continue;const g=i.get(p);if(!g)continue;const y=xs(g),_=pA(m),h=[...nl(f,a)??[]],v=ol(f,[...a,..._],y,r.edges);v&&h.push(v);for(let B=0;B+1<f.waypoints.length;B++)for(const P of _)for(const k of tl(f.waypoints[B],f.waypoints[B+1],P)??[])h.push(wd(f.waypoints,B,k));const b=s.edges.filter(B=>B.id!==p),E=B=>({...s,edges:s.edges.map(P=>P.id===p?{...P,waypoints:B}:P)}),M=h.find(B=>{const P={...f,waypoints:B};return Ed(P,m)||!rl(B,y)||b.some(k=>k.id!==d&&!Ed(f,k)&&Ed(P,k))?!1:ht(E(B)).every(k=>c.has(lt(k)))});if(M){o.updateWaypoints(g,M),s=E(M);break}}}const dA=["top","bottom","left","right"],Ry={top:{x:0,y:-1},bottom:{x:0,y:1},left:{x:-1,y:0},right:{x:1,y:0}},bs=20,fA=20;function hA(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&&qe(e.y,t.y)&&o.push("top"),n&&qe(e.y,t.y+t.height)&&o.push("bottom"),i&&qe(e.x,t.x)&&o.push("left"),i&&qe(e.x,t.x+t.width)&&o.push("right"),o.length===1?o[0]:null}const gA=(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 My(e,t,n,i){const o=Ry[t],r=Ry[i],a=o.x===0,s=r.x===0;if(a===s){const p=a?"y":"x",d=a?"x":"y",f=o[p],m=r[p];if(qe(e[d],n[d]))return f===-m&&f*(n[p]-e[p])>=bs?[e,n]:null;let g;if(f===-m){const _=e[p]+f*bs,h=n[p]-f*bs;if(f*(h-_)<0)return null;g=Math.round((e[p]+n[p])/2)}else g=f>0?Math.max(e[p],n[p])+il:Math.min(e[p],n[p])-il;const y=(_,h)=>a?{x:h,y:_}:{x:_,y:h};return[e,y(g,e[d]),y(g,n[d]),n]}const c=a?{x:e.x,y:n.y}:{x:n.x,y:e.y},l=a?o.y*(c.y-e.y):o.x*(c.x-e.x),u=s?r.y*(c.y-n.y):r.x*(c.x-n.x);return l>=bs&&u>=bs?[e,c,n]:null}function mA(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?hA(a,r):null;if(!s)return[];const c=[];for(const l of dA){const u=gA(t,l),p=o?My(u,l,a,s):My(a,s,u,l);p&&c.push(p)}return c}const Cy=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 yA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=new Set(ht(r).map(lt));let c=r;for(const[l,u]of Ei(r)){if(t.has(`${l}|${u}`))continue;const p=c.edges.find(k=>k.id===l),d=c.edges.find(k=>k.id===u);if(!p||!d||p.type!=="bpmn:SequenceFlow"||d.type!=="bpmn:SequenceFlow"||n.has(l)&&n.has(u)||!Ei({edges:[p,d]}).length)continue;const f=p.endpoints.find(k=>d.endpoints.includes(k)),m=f?a.get(f):void 0;if(!m||m.container)continue;const g=i.get(l),y=i.get(u);if(!g||!y)continue;const _=k=>n.has(k.id)?[k.waypoints]:[k.waypoints,...mA(k,m,a)],h=k=>k.length-2,v=_(p).flatMap(k=>_(d).map(N=>({pa:k,pb:N}))).filter(({pa:k,pb:N})=>k!==p.waypoints||N!==d.waypoints).map(k=>({...k,cost:Cy(k.pa)+Cy(k.pb)+fA*(h(k.pa)+h(k.pb))})).sort((k,N)=>k.cost-N.cost),b=xs(g),E=xs(y),M=Ei(c).length,B=new Set(eo(c).map(([k,N])=>`${k}|${N}`)),P=v.find(({pa:k,pb:N})=>{const G={...p,waypoints:k},q={...d,waypoints:N};if(Ei({edges:[G,q]}).length||$r(G,q)||!rl(k,b)||!rl(N,E))return!1;const Y={...c,edges:c.edges.map(re=>re.id===l?G:re.id===u?q:re)};return Ei(Y).length>=M||eo(Y).some(([re,K])=>!B.has(`${re}|${K}`))?!1:ht(Y).every(re=>s.has(lt(re)))});P&&(P.pa!==p.waypoints&&o.updateWaypoints(g,P.pa),P.pb!==d.waypoints&&o.updateWaypoints(y,P.pb),c={...c,edges:c.edges.map(k=>k.id===l?{...p,waypoints:P.pa}:k.id===u?{...d,waypoints:P.pb}:k)})}}const vA=40,xA=20;function bA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>{const u=We(i),p=Ei(u);return{keys:new Set(ht(u).map(lt)),crossings:eo(u).length,shared:p.length,mine:p.filter(([d,f])=>d===l||f===l).length}},a=(l,u)=>{const p=We(i),d=p.edges.find(f=>f.id===l);return d?new Set(Ot({...d,waypoints:u},Ln(p)).map(f=>f.id)):null},s=l=>!!l&&l.type==="bpmn:Participant"&&!(l.children??[]).length&&n.has(l.id),c=i.getAll().filter(l=>l.type==="bpmn:MessageFlow"&&!t.has(l.id));for(const l of c){const u=l.source,p=l.target,d=s(u)?u:s(p)?p:void 0;if(!d)continue;const f=d===u?p:u;if(!f||f.type==="bpmn:Participant")continue;const m=f.x+f.width/2;if(m>=d.x+10&&m<=d.x+d.width-10)continue;const g=m>d.x+d.width,y=d.y>f.y,_=y?f.y+f.height:f.y,h=y?d.y:d.y+d.height,v=Math.round((_+h)/2),b=N=>d===u?[...N].reverse():N,E=(l.waypoints??[]).map(N=>({x:N.x,y:N.y})),M=r(l.id),B=a(l.id,E)??new Set,P=g?d.x+d.width:d.x,k=d.x+d.width/2;for(let N=Math.min(vA,d.width/4);g?P-N>k:P+N<k;N+=xA){const G=Math.round(g?P-N:P+N),q=b([{x:m,y:_},{x:m,y:v},{x:G,y:v},{x:G,y:h}]),Y=a(l.id,q);if(!Y||[...Y].some(K=>!B.has(K)))continue;o.updateWaypoints(l,q);const re=r(l.id);if(re.crossings<=M.crossings&&re.shared<=M.shared&&re.mine<=M.mine&&[...re.keys].every(K=>M.keys.has(K)))break;o.updateWaypoints(l,E)}}}const wA=10;function Ay(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 Ty(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(re=>re.type==="bpmn:Participant"&&re.container),i=t.shapes.find(re=>re.id===e.endpoints[0]),o=t.shapes.find(re=>re.id===e.endpoints[1]);if(!i||!o)return null;const r=Ay(i,n),a=Ay(o,n);if(!r||!a||r.id===a.id)return null;const s=a.y>r.y,c=s?r:a,l=s?a:r,u=n.filter(re=>re.id!==r.id&&re.id!==a.id&&re.y>=c.y+c.height&&re.y+re.height<=l.y).sort((re,K)=>re.y-K.y);if(!u.length)return null;const p=u[0],d=u[u.length-1],f=(c.y+c.height+p.y)/2,m=(d.y+d.height+l.y)/2,g=s?f:m,y=s?m:f,_=e.waypoints[0],h=e.waypoints[e.waypoints.length-1],v=Ln(t),b=t.edges.filter(re=>re.id!==e.id),E=Vn(e,b),M=Ot(e,v).length;if(E===0&&M===0||M===0&&e.waypoints.length===2)return null;const B=Math.min(...u.map(re=>re.x)),P=Math.max(...u.map(re=>re.x+re.width)),k=(_.x+h.x)/2,N=re=>re.filter((K,Ce)=>Ce===0||!(qe(K.x,re[Ce-1].x)&&qe(K.y,re[Ce-1].y)));let G,q;for(let re=B;re<=P;re+=wA){const K=N([_,{x:_.x,y:g},{x:re,y:g},{x:re,y},{x:h.x,y},h]),Ce={...e,waypoints:K};if(Ot(Ce,v).length>0)continue;const Ae=Vn(Ce,b),Te=Math.abs(re-k);(!G||Ae<G.cross||Ae===G.cross&&Te<G.detour)&&(G={pts:K,cross:Ae,detour:Te}),xd(K,v,e.endpoints)>=Fr&&(!q||Ae<q.cross||Ae===q.cross&&Te<q.detour)&&(q={pts:K,cross:Ae,detour:Te})}q&&G&&q!==G&&bd(t,e,q.pts,G.pts)&&(G=q);const Y=G&&(M>0?G.cross<=E:G.cross<E)?G.pts:null;if(M>0){const re=yy(t,e,v,Y??e.waypoints);if(re)return re}return Y}const _A=new Set(["bpmn:SequenceFlow","bpmn:MessageFlow"]);function EA(e,t,n){var l,u;const{elementRegistry:i}=e,o=e.modeling,r=new Map(t.shapes.map(p=>[p.id,p])),a=We(i),s=new Map(a.shapes.map(p=>[p.id,p])),c=Ln(a);for(const p of t.edges){if(!_A.has(p.type)||!p.source||!p.target||n.has(p.id))continue;const d=i.get(p.id);if(!(d!=null&&d.waypoints)||((l=d.source)==null?void 0:l.id)!==p.source||((u=d.target)==null?void 0:u.id)!==p.target)continue;const f=r.get(p.source),m=r.get(p.target),g=s.get(p.source),y=s.get(p.target);if(!f||!m||!g||!y||!qe(f.width,g.width)||!qe(f.height,g.height)||!qe(m.width,y.width)||!qe(m.height,y.height))continue;const _=g.x-f.x,h=g.y-f.y;if(qe(_,0)&&qe(h,0)||!qe(y.x-m.x,_)||!qe(y.y-m.y,h))continue;const v=p.waypoints.map(M=>({x:M.x+_,y:M.y+h})),b=d.waypoints.map(M=>({x:M.x,y:M.y}));b.length===v.length&&b.every((M,B)=>qe(M.x,v[B].x)&&qe(M.y,v[B].y))||b.length===2&&(qe(b[0].x,b[1].x)||qe(b[0].y,b[1].y))&&Ot({...p,waypoints:b},c).length===0||Ot({...p,waypoints:v},c).length>0||o.updateWaypoints(d,v)}}function Py(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n);for(const r of o.edges){if(r.type!=="bpmn:MessageFlow"||t.has(r.id))continue;const a=We(n),s=a.edges.find(u=>u.id===r.id);if(!s)continue;const c=Ty(s,a);if(!c)continue;const l=n.get(r.id);l&&i.updateWaypoints(l,c)}}const Sd=20,ky=10,zi=10,Rd=40,SA=6,RA=40,Oy=50;function MA(e,t){return t.some(n=>{const[i,o,r,a]=e.axis==="h"?[n.x,n.x+n.width,n.y,n.y+n.height]:[n.y,n.y+n.height,n.x,n.x+n.width];if(e.hi<=i||e.lo>=o||e.at>r&&e.at<a)return!1;const s=Math.min(Math.abs(e.at-r),Math.abs(e.at-a));return s>0&&s<=SA})}function Md(e,t,n){let i=0;for(let o=1;o<e.length;o++){const r=e[o-1],a=e[o];if(qe(r.y,a.y))for(const s of n)t.has(s.id)||r.y<=s.y+1||r.y>=s.y+s.height-1||(i+=Math.max(0,Math.min(Math.max(r.x,a.x),s.x+s.width)-Math.max(Math.min(r.x,a.x),s.x)))}return i}function CA(e,t){if(e.axis!=="h")return!1;const n=(i,o)=>e.lo<o&&e.hi>i;return t.some(i=>{const o=i.label;return!o||i.container||!n(i.x,i.x+i.width)||!n(o.x,o.x+o.width)?!1:o.y>=i.y+i.height?e.at>=i.y+i.height&&e.at<=o.y:o.y+o.height<=i.y?e.at>=o.y+o.height&&e.at<=i.y:!1})}function Cd(e,t,n){if(t>n)return[];const i=[Math.min(Math.max(e,t),n)];for(let o=ky;o<=n-t;o+=ky)e+o<=n&&i.push(e+o),e-o>=t&&i.push(e-o);return i}function AA(e,t,n,i,o){const r=[],a=e.type==="bpmn:Participant",s=t.type==="bpmn:Participant",c=t.y>=e.y+e.height;if(!c&&t.y+t.height>e.y)return{inPools:r,outside:[]};const l=c?e.y+e.height:e.y,u=c?t.y:t.y+t.height,p=e.x+e.width/2,d=t.x+t.width/2,f=(K,Ce)=>Ce>K.x+zi&&Ce<K.x+K.width-zi,m=(K,Ce)=>K.width<=2*Rd?K.x+K.width/2:Math.min(Math.max(Ce,K.x+Rd),K.x+K.width-Rd),g=Math.max(e.x,t.x)+zi,y=Math.min(e.x+e.width,t.x+t.width)-zi;if(g<=y){const K=!a&&f(t,p)?p:!s&&f(e,d)?d:Math.round((g+y)/2);r.push([{x:K,y:l},{x:K,y:u}])}const _=s?m(t,p):d,h=a?m(e,d):p;if(!a&&!f(e,_)){const K=_<e.x?e.x:e.x+e.width;for(const Ce of Cd(e.y+e.height/2,e.y+zi,e.y+e.height-zi))r.push([{x:K,y:Ce},{x:_,y:Ce},{x:_,y:u}])}if(!s&&!f(t,h)){const K=h<t.x?t.x:t.x+t.width;for(const Ce of Cd(t.y+t.height/2,t.y+zi,t.y+t.height-zi))r.push([{x:h,y:l},{x:h,y:Ce},{x:K,y:Ce}])}const v=(K,Ce)=>{if(Math.abs(Ce-K)<2*zi)return[];const Ae=Math.min(K,Ce)+zi,Te=Math.max(K,Ce)-zi;return Cd(Math.round((K+Ce)/2),Ae,Te)};if(!a&&n)for(const K of v(l,c?n.y+n.height:n.y))r.push([{x:p,y:l},{x:p,y:K},{x:_,y:K},{x:_,y:u}]);if(!s&&i)for(const K of v(u,c?i.y:i.y+i.height))r.push([{x:h,y:l},{x:h,y:K},{x:d,y:K},{x:d,y:u}]);const b=Math.min(h,_),E=Math.max(h,_),M=[];for(const[K,Ce]of o.filter(Ae=>Ae.x<E&&Ae.x+Ae.width>b).map(Ae=>[Ae.y,Ae.y+Ae.height]).sort((Ae,Te)=>Ae[0]-Te[0])){const Ae=M[M.length-1];Ae&&K<=Ae[1]?Ae[1]=Math.max(Ae[1],Ce):M.push([K,Ce])}const B=[];for(let K=1;K<M.length;K++)M[K][0]-M[K-1][1]>=RA&&B.push(Math.round((M[K-1][1]+M[K][0])/2));M.length&&B.push(M[0][0]-Oy,M[M.length-1][1]+Oy);const P=(K,Ce)=>Ce<K.y?K.y:Ce>K.y+K.height?K.y+K.height:void 0,k=new Set([a?e.id:n==null?void 0:n.id,s?t.id:i==null?void 0:i.id].filter(K=>!!K)),N=e.y+e.height/2,G=t.y+t.height/2,q=G>N?1:-1,Y=(K,Ce,Ae)=>o.some(Te=>!k.has(Te.id)&&Te.x<K&&K<Te.x+Te.width&&Te.y<Math.max(Ce,Ae)-1&&Te.y+Te.height>Math.min(Ce,Ae)+1),re=[];for(const K of B){const Ce=P(e,K),Ae=P(t,K);Ce===void 0||Ae===void 0||(K-N)*q<0&&Y(h,Ce,K)||(K-G)*q>0&&Y(_,Ae,K)||re.push({pts:[{x:h,y:Ce},{x:h,y:K},{x:_,y:K},{x:_,y:Ae}],len:Math.abs(K-Ce)+(E-b)+Math.abs(Ae-K)})}return{inPools:r,outside:re.sort((K,Ce)=>K.len-Ce.len).map(K=>K.pts)}}function TA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=new Map(n.edges.map(f=>[f.id,f.waypoints])),a=n.shapes.filter(f=>f.type==="bpmn:Participant"),s=f=>{let m=f;for(;m&&m.type!=="bpmn:Participant";)m=m.parent;return m==null?void 0:m.id},c=()=>{const f=We(i);return{keys:new Set(ht(f).map(lt)),crossings:eo(f).length,shared:Ei(f).length}},l=(f,m)=>f.length===m.length&&f.every((g,y)=>qe(g.x,m[y].x)&&qe(g.y,m[y].y)),u=f=>{const m=f.source,g=f.target;if(!m||!g)return"skip";const y=We(i),_=new Map(y.shapes.map(z=>[z.id,z])),h=s(m),v=s(g),b=new Set([h,v].filter(z=>!!z)),E=y.shapes.filter(z=>z.type==="bpmn:Participant"),M=(f.waypoints??[]).map(z=>({x:z.x,y:z.y})),B=Md(M,b,E);if(B<Sd)return"skip";if(t.has(f.id)){const z=r.get(f.id);if(z&&l(z,M)||B-(z?Md(z,b,a):0)<Sd)return"skip"}const P=_.get(m.id),k=_.get(g.id),N=y.edges.find(z=>z.id===f.id);if(!P||!k||!N)return"skip";const G=Ln(y),q=new Set(Ot(N,G).map(z=>z.id)),Y=Ko(y).filter(z=>z.owner!==f.id&&z.owner!==P.id&&z.owner!==k.id),re=[...y.shapes.filter(z=>!z.container&&z.id!==P.id&&z.id!==k.id),...Y.map(z=>z.rect)],K=z=>un({...N,waypoints:z}).some(oe=>MA(oe,re)),Ce=AA(P,k,h?_.get(h):void 0,v?_.get(v):void 0,E),Ae=z=>z.map((oe,V)=>({pts:oe,i:V,key:oe.length*2+(K(oe)?1:0)})).sort((oe,V)=>oe.key-V.key||oe.i-V.i).map(oe=>oe.pts),Te=[...Ae(Ce.inPools),...Ae(Ce.outside)],de=c();for(const z of Te){if(Md(z,b,E)>=Sd)continue;const oe={...N,waypoints:z};if(Ot(oe,G).some(ue=>!q.has(ue.id))||un(oe).some(ue=>CA(ue,y.shapes)||Y.some(be=>Hi(be.rect,ue))))continue;o.updateWaypoints(f,z);const X=c();if(X.crossings<=de.crossings&&X.shared<=de.shared&&[...X.keys].every(ue=>de.keys.has(ue)))return"fixed";o.updateWaypoints(f,M)}return"stuck"},p=i.getAll().filter(f=>f.type==="bpmn:MessageFlow"),d=[];for(const f of p)u(f)==="stuck"&&d.push(f);for(const f of d)u(f)}const Gi=[25,-25,40,-40],Ea=35;function PA(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)-Ea:Math.max(e.y+e.height,t.y+t.height)+Ea,p=OA(e,t,s,u,n),d=p===null?[[u,0]]:[[u,0],[p,kA]];for(const[f,m]of d)for(const g of[0,...Gi])if(!(Math.abs(g)>=e.width/2-5))for(const y of[0,...Gi]){if(Math.abs(y)>=t.width/2-5)continue;const _=i+g,h=o+y,v=[{x:_,y:c},{x:_,y:f},{x:h,y:f},{x:h,y:l}];m&&Ot({endpoints:[],waypoints:v},a).length||r.push({pts:v,cost:m+Math.abs(y)+Math.abs(g)})}}return r}const kA=45,al=20;function OA(e,t,n,i,o){if(!o.length)return null;const r=e.x+e.width/2,a=t.x+t.width/2,s=Math.min(r,a),c=Math.max(r,a),l=n?Math.min(e.y,t.y):Math.max(e.y+e.height,t.y+t.height),u=o.filter(y=>y.container&&(y.type==="bpmn:Lane"||y.type==="bpmn:Participant")&&r>=y.x&&r<=y.x+y.width&&e.y>=y.y&&e.y+e.height<=y.y+y.height).sort((y,_)=>y.width*y.height-_.width*_.height)[0];if(!u)return null;const p=o.filter(y=>!y.container&&y.id!==e.id&&y.id!==t.id),d=p.filter(y=>y.x<c&&y.x+y.width>s&&(n?y.y<l&&y.y+y.height>i:y.y+y.height>l&&y.y<i));if(!d.length)return null;const f=[...p,...p.flatMap(y=>y.label?[y.label]:[])].filter(y=>y.x<c&&y.x+y.width>s);if(n){let y=Math.min(...d.map(h=>h.y));for(let h=!0;h;){h=!1;for(const v of f)v.y<y&&v.y<l&&v.y+v.height>y-al&&(y=v.y,h=!0)}const _=Math.max(u.y,...f.filter(h=>h.y+h.height<=y).map(h=>h.y+h.height));return y-_>=al?Math.round((y+_)/2):null}let m=Math.max(...d.map(y=>y.y+y.height));for(let y=!0;y;){y=!1;for(const _ of f)_.y+_.height>m&&_.y+_.height>l&&_.y<m+al&&(m=_.y+_.height,y=!0)}const g=Math.min(u.y+u.height,...f.filter(y=>y.y>=m).map(y=>y.y));return g-m>=al?Math.round((m+g)/2):null}function sl(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 PA(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-Ea:n.y+n.height+Ea,p=[];for(const h of[0,...Gi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;p.push({pts:[{x:n.x,y:o},{x:v,y:o},{x:v,y:c}],cost:Math.abs(h)});for(const b of[0,...Gi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:l},{x:E,y:u},{x:v,y:u},{x:v,y:c}],cost:Math.abs(h)+Math.abs(b)})}}const d=50,f=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const h of[0,...Gi]){if(Math.abs(h)>=n.width/2-5)continue;const v=a+h;p.push({pts:[{x:v,y:m},{x:v,y:f},{x:i.x+i.width,y:f}],cost:d+Math.abs(h)})}const g=60,y=s?i.y+i.height:i.y,_=s?i.y+i.height+Ea:i.y-Ea;for(const h of[0,...Gi]){if(Math.abs(h)>=i.width/2-5)continue;const v=r+h;for(const b of[0,...Gi]){if(Math.abs(b)>=n.width/2-5)continue;const E=a+b;p.push({pts:[{x:E,y:m},{x:E,y:_},{x:v,y:_},{x:v,y}],cost:g+Math.abs(h)+Math.abs(b)})}}return p}const Ad=30;function Dy(e,t){return Td(e,t)<Ad}function Td(e,t){let n=1/0;for(let i=1;i<e.length-2;i++){const o=e[i],r=e[i+1],a=qe(o.y,r.y)&&!qe(o.x,r.x),s=qe(o.x,r.x)&&!qe(o.y,r.y);if(!(!a&&!s))for(const c of t)if(a){const l=Math.min(o.x,r.x);if(Math.max(o.x,r.x)<=c.x||l>=c.x+c.width)continue;n=Math.min(n,Math.abs(o.y-c.y),Math.abs(o.y-(c.y+c.height)))}else{const l=Math.min(o.y,r.y);if(Math.max(o.y,r.y)<=c.y||l>=c.y+c.height)continue;n=Math.min(n,Math.abs(o.x-c.x),Math.abs(o.x-(c.x+c.width)))}}return n}const cl=40;function DA(e,t,n){let i=0;for(const o of t){if(o.container||n.includes(o.id))continue;const r=o.x-cl,a=o.x+o.width+cl,s=o.y-cl,c=o.y+o.height+cl;for(let l=1;l<e.length-2;l++){const u=e[l],p=e[l+1],d={x:Math.min(u.x,p.x),y:Math.min(u.y,p.y)},f={x:Math.max(u.x,p.x),y:Math.max(u.y,p.y)};if(d.x<a&&f.x>r&&d.y<c&&f.y>s){i++;break}}}return i}function Ly(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(M=>M.container),i=new Map(t.shapes.map(M=>[M.id,M])),o=Ln(t),r=t.edges.filter(M=>M.id!==e.id),a=ei(e,r),s=Vn(e,r),c=M=>DA(M,t.shapes,e.endpoints)+(Dy(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.find(k=>k.type==="bpmn:Lane"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height)},p=u(i.get(e.endpoints[0]??"")),d=u(i.get(e.endpoints[1]??"")),f=!!p&&!!d&&p.id!==d.id,m=M=>{if(!f||!d)return!1;for(let B=1;B<M.length-2;B++){const P=M[B],k=M[B+1];if(qe(P.y,k.y)&&!qe(P.x,k.x)&&P.y>d.y&&P.y<d.y+d.height)return!0}return!1},g=m(e.waypoints),_=(M=>{if(!M)return;const B=M.x+M.width/2,P=M.y+M.height/2;return n.filter(k=>k.type==="bpmn:Participant"&&B>=k.x&&B<=k.x+k.width&&P>=k.y&&P<=k.y+k.height).sort((k,N)=>k.width*k.height-N.width*N.height)[0]})(i.get(e.endpoints[0]??"")),h=M=>{if(!_)return 0;let B=0;for(let P=1;P<M.length-1;P++){const k=M[P];(k.x<_.x||k.x>_.x+_.width||k.y<_.y||k.y>_.y+_.height)&&B++}return B},v=h(e.waypoints);if(!Dy(e.waypoints,n)&&!(f&&!g)&&v===0)return null;const b=M=>M.reduce((B,P,k)=>k?B+Math.abs(P.x-M[k-1].x)+Math.abs(P.y-M[k-1].y):0,0);let E;for(const{pts:M,cost:B}of sl(e,i)){const P={...e,waypoints:M};if(Ot(P,o).length>0||$y(M,e,t))continue;const k=ei(P,r);if(k>a)continue;const N=h(M);if(N>v)continue;const G=N<v&&k===0;if(!G&&Vn(P,r)>s)continue;const q=c(M),Y=m(M);if(!G&&!(Y&&!g)&&q>=l)continue;const K=Y?0:1,Ce=b(M);(!E||N<E.out||N===E.out&&(K<E.lane||K===E.lane&&(k<E.opp||k===E.opp&&(q<E.sc||q===E.sc&&(B<E.cost||B===E.cost&&Ce<E.len)))))&&(E={pts:M,out:N,sc:q,lane:K,opp:k,cost:B,len:Ce})}return(E==null?void 0:E.pts)??null}function LA(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 IA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i).edges.filter(a=>(!t.has(a.id)||n.has(a.id))&&a.waypoints.length>=4).map(a=>a.id).sort();for(const a of r){const s=We(i),c=s.edges.find(y=>y.id===a);if(!c||c.waypoints.length<4)continue;const l=Ln(s),u=s.edges.filter(y=>y.id!==a),p=Ot(c,l).length,d=ei(c,u),f=Vn(c,u),m=n.has(a)?new Set(ht(s).map(lt)):null;if(c.waypoints.length>4){const y=i.get(a),_=y?xy(s,c,l,c.waypoints,xs(y)):null;if(y&&_&&_.length<c.waypoints.length){o.updateWaypoints(y,_);continue}}const g=nl(c,s.shapes);g.length===2&&LA(c,s)&&g.reverse();for(const y of g){if(y.length>=c.waypoints.length)continue;const _={...c,waypoints:y};if(Ot(_,l).length>p||ei(_,u)>d||Vn(_,u)>f)continue;if(m){const v=new Set(ht({...s,edges:s.edges.map(M=>M.id===a?_:M)}).map(lt)),b=[...v].filter(M=>!m.has(M)).length,E=[...m].filter(M=>!v.has(M)).length;if(b>E)continue}const h=i.get(a);h&&o.updateWaypoints(h,y);break}}}function Iy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n).edges.filter(r=>r.type==="bpmn:SequenceFlow"&&!t.has(r.id)).map(r=>r.id).sort();for(const r of o){const a=We(n),s=a.edges.find(u=>u.id===r);if(!s)continue;const c=Ly(s,a);if(!c)continue;const l=n.get(r);l&&i.updateWaypoints(l,c)}}function Pd(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=qe(n[0].x,n[1].x)&&!qe(n[0].y,n[1].y),s=qe(n[n.length-1].x,n[n.length-2].x)&&!qe(n[n.length-1].y,n[n.length-2].y);for(const c of Gi){if(a&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}const By=e=>e==="bpmn:SequenceFlow"||e==="bpmn:MessageFlow";function BA(e,t,n){const i=e.waypoints;if(i.length<2||!By(e.type))return[];const o=i[0],r=i[1],a=qe(o.y,r.y)&&!qe(o.x,r.x),s=qe(o.x,r.x)&&!qe(o.y,r.y);if(!a&&!s)return[];const c=Math.sign(a?r.x-o.x:r.y-o.y);if(!t.some(m=>{if(!By(m.type)||m.type===e.type||m.waypoints.length<2)return!1;const g=m.waypoints[0],y=m.waypoints[1];return!qe(g.x,o.x)||!qe(g.y,o.y)?!1:a?qe(g.y,y.y)&&Math.sign(y.x-g.x)===c:qe(g.x,y.x)&&Math.sign(y.y-g.y)===c}))return[];const u=n.get(e.endpoints[0]??""),p=n.get(e.endpoints[1]??"");if(!u)return[];const d=(m,g)=>a?g>m.y+5&&g<m.y+m.height-5:g>m.x+5&&g<m.x+m.width-5,f=[];for(const m of Gi){const g=(a?o.y:o.x)+m;if(!d(u,g)||i.length===2&&(!p||!d(p,g)))continue;const y=i.map(_=>({..._}));for(const _ of[y[0],y[1]])a?_.y=g:_.x=g;f.push({pts:y,cost:Math.abs(m)})}return f}function NA(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const o=i.y+i.height<=n.y,r=n.y+n.height<=i.y;if(!o&&!r)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,l=n.y+n.height/2,u=i.x+i.width/2,p=i.y+i.height/2,d=a?n.x+n.width:n.x,f=r?n.y+n.height:n.y,m=a?i.x:i.x+i.width,g=r?i.y:i.y+i.height,y=[];for(const _ of[0,...Gi])Math.abs(_)<i.width/2-5&&y.push({pts:[{x:d,y:l},{x:u+_,y:l},{x:u+_,y:g}],cost:Math.abs(_)}),Math.abs(_)<i.height/2-5&&y.push({pts:[{x:c,y:f},{x:c,y:p+_},{x:m,y:p+_}],cost:Math.abs(_)});return y}const $A=[[1/2,0],[1/3,25],[2/3,25]],Ny=20;function FA(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const o=n.y+n.height/2,r=i.y+i.height/2;if(Math.abs(o-r)<1)return[];const a=[],s=(c,l)=>{for(const[u,p]of $A){const d=Math.round(c+(l-c)*u);a.push({pts:[{x:c,y:o},{x:d,y:o},{x:d,y:r},{x:l,y:r}],cost:p})}};return n.x+n.width+Ny<=i.x&&s(n.x+n.width,i.x),i.x+i.width+Ny<=n.x&&s(n.x,i.x+i.width),a}const jA=1e3;function kd(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=[],d=[n,i].filter(y=>/Gateway$/.test(y.type)),f=d.length?d[0].x+d[0].width/2:void 0,m=f!==void 0&&d.every(y=>Math.abs(y.x+y.width/2-f)<=.5)&&f>o&&f<r;m&&p.push({pts:[{x:f,y:c},{x:f,y:l}],cost:0});const g=d.length?jA:0;for(const y of[0,...Gi]){const _=u+y;_<=o||_>=r||m&&Math.abs(_-f)<.5||p.push({pts:[{x:_,y:c},{x:_,y:l}],cost:Math.abs(y)+g})}return p}const Od=2,HA=3;function $y(e,t,n){if(e.length<2)return!1;for(const i of n.shapes){if(!/Gateway$/.test(i.type)||t.endpoints.includes(i.id))continue;let o=1/0;for(let a=1;a<e.length;a++)o=Math.min(o,wo(e[a-1],e[a],i));if(o>Od)continue;const r=[{x:i.x+i.width/2,y:i.y},{x:i.x+i.width,y:i.y+i.height/2},{x:i.x+i.width/2,y:i.y+i.height},{x:i.x,y:i.y+i.height/2}].filter(a=>Ld(a,e)<=Od);if(r.length)for(const a of n.edges){if(a.id===t.id||!a.endpoints.includes(i.id)||a.waypoints.length<2)continue;if([a.waypoints[0],a.waypoints[a.waypoints.length-1]].some(c=>r.some(l=>Math.hypot(c.x-l.x,c.y-l.y)<=HA)&&Ld(c,e)<=Od))return!0}}return!1}function Fy(e,t,n={}){const i=new Map(t.shapes.map(m=>[m.id,m])),o=Ln(t),r=t.edges.filter(m=>m.id!==e.id),a=ei(e,r);if(a===0)return null;const s=Vn(e,r);let c;const l=m=>m.reduce((g,y,_)=>_?g+Math.abs(y.x-m[_-1].x)+Math.abs(y.y-m[_-1].y):0,0),u=3,p=m=>{const g=m[0],y=m[m.length-1],_=Math.hypot(y.x-g.x,y.y-g.y);return _>=1&&l(m)/_>=u?1:0},d=p(e.waypoints),f=[...sl(e,i),...kd(e,i),...Pd(e,i),...BA(e,r,i),...n.sideEntry?FA(e,i):[]];for(const{pts:m,cost:g}of f){const y={...e,waypoints:m};if(Ot(y,o).length>0||$y(m,e,t))continue;const _=ei(y,r),h=Vn(y,r),v=a-_+(d-p(m));if(_>=a||h-s>v)continue;const b=l(m);(!c||_<c.opposite||_===c.opposite&&(h<c.cross||h===c.cross&&(g<c.cost||g===c.cost&&b<c.len)))&&(c={pts:m,opposite:_,cross:h,cost:g,len:b})}return(c==null?void 0:c.pts)??null}function jy(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 zA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Ln(t),o=t.edges.filter(d=>d.id!==e.id),r=jy(e,o);if(r===0)return null;const a=ei(e,o),s=Vn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...kd(e,n),...NA(e,n),...Pd(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=jy(m,o);if(g>=r)continue;const y=ei(m,o);if(y-g>a-r)continue;const _=Vn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.fake||g===u.fake&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,fake:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function Hy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=ht(We(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=We(i),l=c.edges.find(d=>d.id===s);if(!l)continue;const u=zA(l,c);if(!u)continue;const p=i.get(s);p&&o.updateWaypoints(p,u)}}function zy(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 Gy(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:zy(e,n)&&zy(t,n)}function Vy(e,t,n){let i=0;for(const o of t)o.id!==e.id&&Gy(e,o,n)&&i++;return i}function GA(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Ln(t),o=t.edges.filter(d=>d.id!==e.id),r=Vy(e,o,n);if(r===0)return null;const a=ei(e,o),s=Vn(e,o),c=d=>d.reduce((f,m,g)=>g?f+Math.abs(m.x-d[g-1].x)+Math.abs(m.y-d[g-1].y):0,0),l=2;let u;const p=[...sl(e,n),...kd(e,n),...Pd(e,n)];for(const{pts:d,cost:f}of p){const m={...e,waypoints:d};if(Ot(m,i).length>0)continue;const g=Vy(m,o,n);if(g>=r)continue;const y=ei(m,o);if(y-g>a-r)continue;const _=Vn(m,o);if(_-s>(r-g)*l)continue;const h=c(d);(!u||g<u.chain||g===u.chain&&(y<u.unreadable||y===u.unreadable&&(_<u.cross||_===u.cross&&(f<u.cost||f===u.cost&&h<u.length))))&&(u={pts:d,chain:g,unreadable:y,cross:_,cost:f,length:h})}return(u==null?void 0:u.pts)??null}function VA(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=new Map(r.shapes.map(l=>[l.id,l])),s=ht(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(d=>r.edges.find(f=>f.id===d));if(!(!u||!p||!Gy(u,p,a)))for(const d of l.edges)n.has(d)||c.add(d)}for(const l of[...c].sort()){const u=We(i),p=u.edges.find(m=>m.id===l);if(!p)continue;const d=GA(p,u);if(!d)continue;const f=i.get(l);f&&o.updateWaypoints(f,d)}}function Wy(e,t,n,i=new Set){const{elementRegistry:o}=e,r=e.modeling,a=new Set,s=We(o),c=ht(s).filter(d=>hd(d)&&!t.has(lt(d)));if(!c.length)return a;const l=new Set;for(const d of c)if(hd(d))for(const f of d.edges)n.has(f)||l.add(f);const u=d=>{var f;return((f=s.edges.find(m=>m.id===d))==null?void 0:f.type)??""},p=[...l].sort((d,f)=>{const m=u(d)==="bpmn:SequenceFlow"?0:1,g=u(f)==="bpmn:SequenceFlow"?0:1;return m!==g?m-g:d.localeCompare(f)});for(const d of p){const f=We(o),m=f.edges.find(_=>_.id===d);if(!m)continue;const g=Fy(m,f,{sideEntry:i.has(d)});if(!g)continue;const y=o.get(d);y&&(r.updateWaypoints(y,g),a.add(d))}return a}const WA=10,UA=(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 Uy(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!el(e,i))return null;const o=Ln(t),r=i.flatMap(un);for(const a of un(e)){let s=[[a.lo,a.hi]];for(const[f,m]of Qc(a,r))s=s.flatMap(([g,y])=>{const _=[];return f>g&&_.push([g,Math.min(y,f)]),m<y&&_.push([Math.max(g,m),y]),_.filter(([h,v])=>v>h)});const c=a.axis==="h"?n.width:n.height,l=s.find(([f,m])=>m-f>=c+WA*2);if(!l)continue;const u=(l[0]+l[1])/2,p=a.axis==="h"?{x:u,y:a.at-Qm}:{x:a.at+In+n.width/2,y:u},d={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!el({...e,label:d},i)&&!o.some(f=>!e.endpoints.includes(f.id)&&UA(d,f)))return d}return null}const In=8;function Dd(e,t){const n=e.label;if(!n)return null;const i=un(e);if(!i.length)return null;const o=n.x+n.width/2,r=n.y+n.height/2,a=d=>{const f=d.axis==="h"?o:r,m=d.axis==="h"?r-d.at:o-d.at,g=f<d.lo?d.lo-f:f>d.hi?f-d.hi:0;return Math.hypot(m,g)},s=i.reduce((d,f)=>a(f)<a(d)?f:d,i[0]),c=[...i,...t.edges.filter(d=>d.id!==e.id).flatMap(un),...t.shapes.filter(d=>d.container).flatMap(_a)],l=d=>!c.some(f=>Hi(d,f));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+In,p=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const d of[s.at+In,s.at-In-n.width])for(const f of p){const m=n.y+f;if(m<s.lo||m+n.height>s.hi)continue;const g={...n,x:d,y:m};if(l(g))return g}else for(const d of[s.at-In-n.height,s.at+In])for(const f of p){const m=n.x+f;if(m<s.lo||m+n.width>s.hi)continue;const g={...n,x:m,y:d};if(l(g))return g}return null}const qy=30,Ld=(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},Yy=(e,t)=>Ld({x:e.x+e.width/2,y:e.y+e.height/2},t);function qA(e,t){const n=e.label;if(!n)return null;const i=un(e);if(!i.length)return null;const o=[...i,...t.edges.filter(c=>c.id!==e.id).flatMap(un),...t.shapes.filter(c=>c.container).flatMap(_a)],r=Ko(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=>Hi(c,l))&&!vs(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+In,c.at-In-n.height].map(p=>({...n,x:l-n.width/2,y:p})):[c.at+In,c.at-In-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 Ky(e,t,n=new Set){var s,c;const{elementRegistry:i}=e,o=e.modeling;let r=We(i),a=new Set(ht(r).map(lt));for(const[l,u]of t){const p=u.wps,d=i.get(l),f=d==null?void 0:d.label;if(!f||!(d!=null&&d.waypoints))continue;const m=d.waypoints[0].x-p[0].x,g=d.waypoints[0].y-p[0].y;if(!(d.waypoints.length===p.length&&d.waypoints.every((B,P)=>B.x-p[P].x===m&&B.y-p[P].y===g))){if(((s=d.source)==null?void 0:s.id)===u.source&&((c=d.target)==null?void 0:c.id)===u.target)continue;const B=r.edges.find(q=>q.id===l);if(!(B!=null&&B.label)||!vs(B.label,r).length&&!n.has(l))continue;let P={...B.label,x:u.label.x,y:u.label.y};if((vs(P,r).length||Yy(P,B.waypoints)>qy)&&(P=null),!P&&Yy(B.label,B.waypoints)>qy&&(P=qA(B,r)),!P)continue;const k=P;if(k.x===f.x&&k.y===f.y)continue;const N={...r,edges:r.edges.map(q=>q.id===l?{...q,label:k}:q)},G=ht(N);if(G.some(q=>!a.has(lt(q))))continue;o.moveElements([f],{x:k.x-f.x,y:k.y-f.y}),r=N,a=new Set(G.map(lt));continue}const _=u.label.x+m-f.x,h=u.label.y+g-f.y;if(_===0&&h===0)continue;const v=r.edges.find(B=>B.id===l);if(!(v!=null&&v.label))continue;const b={...v.label,x:v.label.x+_,y:v.label.y+h},E={...r,edges:r.edges.map(B=>B.id===l?{...B,label:b}:B)},M=ht(E);M.some(B=>!a.has(lt(B)))||(o.moveElements([f],{x:_,y:h}),r=E,a=new Set(M.map(lt)))}}function Xy(e,t,n=new Set){const{elementRegistry:i}=e,o=e.modeling,r=We(i);for(const a of r.edges){if(!a.label||t.has(a.id)&&!n.has(a.id))continue;const s=Dd(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 Zy(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=We(i),a=ht(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(d=>d.id===s.edge);if(!c)continue;const l=Uy(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 Jy(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(un),...t.shapes.filter(d=>d.container).flatMap(_a)],o=i.filter(d=>Hi(n,d));if(!o.length)return null;const r=t.shapes.filter(d=>!d.container&&d.id!==e.id),a=Ko(t).filter(d=>d.owner!==e.id).map(d=>d.rect),s=(d,f)=>d.x<f.x+f.width&&f.x<d.x+d.width&&d.y<f.y+f.height&&f.y<d.y+d.height,c=d=>!i.some(f=>Hi(d,f))&&!r.some(f=>s(d,f))&&!a.some(f=>s(d,f)),l=[];for(const d of o)d.axis==="h"?l.push({...n,y:d.at-In-n.height},{...n,y:d.at+In}):l.push({...n,x:d.at-In-n.width},{...n,x:d.at+In});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+In},{...n,x:u-n.width/2,y:e.y-In-n.height},{...n,x:e.x+e.width+In,y:p-n.height/2},{...n,x:e.x-In-n.width,y:p-n.height/2}),l.find(c)??null}function Qy(e,t){const{elementRegistry:n}=e,i=e.modeling,o=We(n);for(const r of o.shapes){if(r.container||!r.label||t.has(r.id))continue;const a=Jy(r,We(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 YA(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 ev(e,t){const{elementRegistry:n}=e,i=e.modeling;let o=We(n),r=new Set(ht(o).map(lt));const a=[...new Set(ht(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(g=>g.id===s);if(!c||c.waypoints.length<2)continue;const l=c.waypoints.map(g=>({...g})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let p=!1;for(const[g,y]of u){const _=g?o.shapes.find(v=>v.id===g):void 0;if(!_)continue;const h=YA(_,l[y]);h.x===l[y].x&&h.y===l[y].y||(l[y]=h,p=!0)}if(!p)continue;const d={...o,edges:o.edges.map(g=>g.id===s?{...g,waypoints:l}:g)},f=ht(d);if(f.some(g=>!r.has(lt(g))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),o=d,r=new Set(f.map(lt)))}}const Id=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tv(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 KA(e,t,n){const i=[],o=n?ps(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 tv(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(!Id(s.map)){i.push({kind:"payload-invalid",opIndex:a,field:s.mapField});continue}const u=s.map;let p=!0;for(const[f,m]of Object.entries(u))typeof m!="string"||m===""?(i.push({kind:"payload-invalid",opIndex:a,field:`${s.mapField}.${f}`}),p=!1):o.includes(f)||(i.push({kind:"locale-not-in-document",opIndex:a,id:s.id,field:s.mapField,locale:f,locales:o}),p=!1);if(!p)continue;const d=o.filter(f=>!(f in u));d.length&&i.push({kind:"locale-texts-incomplete",opIndex:a,id:s.id,field:s.mapField,missing:d})}}),i}function Si(e,t,n){const i=t==="text"?"texts":"names",{[i]:o,...r}=e;return n===void 0?r:{...r,[t]:n}}function XA(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(Id(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=tv(c,t);if(!l.length){s.push(c);continue}switch(c.kind){case"participant.add":{const[u,...p]=l,d=Si(c.participant,"name",a(u));c.participant.lanes&&(d.lanes=c.participant.lanes.map((f,m)=>Si(f,"name",a(p[m])))),s.push({...c,participant:d});break}case"participant.update":{const[u,...p]=l,d=Si(c,"name",a(u));c.lanes&&(d.lanes=c.lanes.map((f,m)=>Si(f,"name",a(p[m])))),s.push(d);break}case"node.add":s.push({...c,node:Si(c.node,"name",a(l[0]))});break;case"sequenceFlow.add":s.push({...c,flow:Si(c.flow,"name",a(l[0]))});break;case"messageFlow.add":s.push({...c,flow:Si(c.flow,"name",a(l[0]))});break;case"dataStore.add":s.push({...c,dataStore:Si(c.dataStore,"name",a(l[0]))});break;case"annotation.add":s.push({...c,annotation:Si(c.annotation,"text",a(l[0]))});break;case"group.add":s.push({...c,group:Si(c.group,"name",a(l[0]))});break;case"annotation.update":s.push(Si(c,"text",a(l[0])));break;default:s.push(Id(l[0].map)?Si(c,"name",a(l[0])):(a(l[0]),c))}}return{ops:s,writes:i}}const ZA=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,nv=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),iv={"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}]},ws=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ll=e=>typeof e=="string"&&e!=="";function JA(e){const t=[];function n(i,o,r,a){if(a===null){ll(r)||t.push({kind:"payload-invalid",opIndex:i,field:o});return}if(!ws(r)){t.push({kind:"payload-invalid",opIndex:i,field:o});return}for(const s of a)ll(r[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${o}.${s}`})}return e.forEach((i,o)=>{var r,a,s;if(!ws(i)||!ll(i.kind)||!(i.kind in iv)){t.push({kind:"payload-invalid",opIndex:o,field:"kind"});return}for(const c of iv[i.kind]){const l=c.path.endsWith("[]"),u=l?c.path.slice(0,-2):c.path,p=u.split(".");let d=i;for(const m of p.slice(0,-1)){if(!ws(d))break;d=d[m]}if(!ws(d))continue;const f=d[p[p.length-1]];if(!(f===void 0&&c.optional)&&!(f===null&&c.optional)){if(!l){n(o,c.path,f,c.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:o,field:c.path});continue}f.forEach((m,g)=>n(o,`${u}[${g}]`,m,c.shape))}}if(i.kind==="annotation.add"){const c=i.annotation;ws(c)&&!ll(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"&&!fm(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&&!hm(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 ov(e,t,n={}){const i=JA(e);if(i.length>0)return i;const o=[],r=new Map,a=new Map;function s(g,y,_){if(!ZA.test(y)){o.push({kind:"id-invalid",opIndex:g,id:y});return}if(t.categoryOf(y)!==void 0||r.has(y)){o.push({kind:"id-duplicate",opIndex:g,id:y});return}r.set(y,{..._,opIndex:g})}e.forEach((g,y)=>{var _;switch(g.kind){case"participant.add":s(y,g.participant.id,{category:"participant",lanes:(g.participant.lanes??[]).map(h=>h.id)});for(const h of g.participant.lanes??[])s(y,h.id,{category:"lane"});break;case"node.add":s(y,g.node.id,{category:"flowNode",participant:g.node.participant});break;case"sequenceFlow.add":s(y,g.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":s(y,g.flow.id,{category:"messageFlow"});break;case"dataStore.add":s(y,g.dataStore.id,{category:"dataStore"});for(const h of g.associations??[])h.id&&s(y,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":g.association.id&&s(y,g.association.id,{category:"dataAssociation"});break;case"association.add":g.association.id&&s(y,g.association.id,{category:"association"});break;case"annotation.add":s(y,g.annotation.id,{category:"annotation"}),(_=g.association)!=null&&_.id&&s(y,g.association.id,{category:"association"});break;case"group.add":s(y,g.group.id,{category:"group"});break;case"participant.update":if(g.lanes){a.set(g.id,g.lanes.map(h=>h.id));for(const h of g.lanes)t.categoryOf(h.id)===void 0&&s(y,h.id,{category:"lane"})}break}});const c=g=>{var y;return((y=r.get(g))==null?void 0:y.category)??t.categoryOf(g)},l=g=>{const y=r.get(g);return y?y.category==="participant"?g:y.participant:t.categoryOf(g)==="participant"?g:t.participantOf(g)};function u(g,y,_,h){const v=c(y);if(v===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:_});return}if(h&&!h.includes(v)){o.push({kind:"ref-category",opIndex:g,ref:y,role:_,expected:h.join("|"),actual:v});return}return v}const p=t.isCollaboration()||e.some(g=>g.kind==="participant.add"),d=new Map;for(const g of e)g.kind==="node.add"?d.set(g.node.id,g.node.eventDefinition):g.kind==="node.update"&&g.type!==void 0&&d.set(g.id,g.eventDefinition);const f=g=>d.has(g)?d.get(g)==="timer":t.eventDefinitionOf(g)==="timer";return e.forEach((g,y)=>{var _,h;switch(g.kind){case"participant.add":break;case"node.add":{const{participant:v,lane:b}=g.node;if(v===void 0){(p||b!==void 0)&&o.push({kind:"participant-required",opIndex:y,id:g.node.id});break}if(u(y,v,"participant",["participant"])===void 0)break;b!==void 0&&((((_=r.get(v))==null?void 0:_.lanes)??a.get(v)??t.lanesOf(v)).includes(b)||o.push({kind:"lane-unknown",opIndex:y,lane:b,participant:v}));break}case"sequenceFlow.add":{const{id:v,source:b,target:E,name:M,condition:B}=g.flow,P=u(y,b,"source",["flowNode"]),k=u(y,E,"target",["flowNode"]);P&&k&&l(b)!==l(E)&&o.push({kind:"flow-cross-pool",opIndex:y,id:v}),M!==void 0&&B!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:v});break}case"messageFlow.add":{const{id:v,source:b,target:E}=g.flow,M=u(y,b,"source",["flowNode","participant"]),B=u(y,E,"target",["flowNode","participant"]);if(M&&B){const P=l(b),k=l(E);P!==void 0&&P===k&&o.push({kind:"message-flow-same-pool",opIndex:y,id:v})}for(const P of[b,E])f(P)&&o.push({kind:"message-flow-timer-endpoint",opIndex:y,id:v,ref:P});break}case"dataStore.add":{for(const v of g.associations??[]){if([v.source,v.target].filter(M=>M===g.dataStore.id).length!==1){o.push({kind:"data-association-ends",opIndex:y,source:v.source,target:v.target});continue}const E=v.source===g.dataStore.id?v.target:v.source;u(y,E,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:v,target:b}=g.association,E=u(y,v,"source"),M=u(y,b,"target");if(E&&M){const B=new Set([E,M]);B.has("dataStore")&&B.has("flowNode")||o.push({kind:"data-association-ends",opIndex:y,source:v,target:b})}break}case"association.add":{const{id:v,source:b,target:E}=g.association,M=u(y,b,"source"),B=u(y,E,"target");M&&B&&M!=="annotation"&&B!=="annotation"&&o.push({kind:"association-detached",opIndex:y,annotation:v??`${b}->${E}`});break}case"annotation.add":{if(g.association){const{source:v,target:b}=g.association;if(v!==g.annotation.id&&b!==g.annotation.id)o.push({kind:"association-detached",opIndex:y,annotation:g.annotation.id});else{const E=v===g.annotation.id?b:v;u(y,E,"association")}}g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.add":{for(const v of g.group.members??[]){const b=u(y,v,"member");b&&nv.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(m(y,g.id,"participant")===void 0)break;if(g.lanes){const v=t.lanesOf(g.id),b=g.lanes.map(P=>P.id);for(const P of v)b.includes(P)||o.push({kind:"lane-shrink-unsupported",opIndex:y,participant:g.id,lane:P});for(const P of b)t.categoryOf(P)!==void 0&&!v.includes(P)&&o.push({kind:"id-duplicate",opIndex:y,id:P});const E=b.filter(P=>v.includes(P)),M=P=>E.every((k,N)=>k===P[N]),B=(((h=t.laneDeclarationOrderOf)==null?void 0:h.call(t,g.id))??v).filter(P=>v.includes(P));E.length===v.length&&!M(v)&&!M(B)&&o.push({kind:"lane-reorder-unsupported",opIndex:y,participant:g.id})}break}case"node.update":{if(m(y,g.id,"flowNode")===void 0)break;if(g.lane!==void 0){const v=t.participantOf(g.id);(v?a.get(v)??t.lanesOf(v):[]).includes(g.lane)||o.push({kind:"lane-unknown",opIndex:y,lane:g.lane,participant:v??""})}break}case"sequenceFlow.update":{if(m(y,g.id,"sequenceFlow")===void 0)break;if(g.name!==void 0&&g.condition!==void 0&&o.push({kind:"condition-name-conflict",opIndex:y,id:g.id}),g.source!==void 0||g.target!==void 0){const v=g.source===void 0||u(y,g.source,"source",["flowNode"])!==void 0,b=g.target===void 0||u(y,g.target,"target",["flowNode"])!==void 0,E=t.endpointsOf(g.id),M=g.source??(E==null?void 0:E.source),B=g.target??(E==null?void 0:E.target);v&&b&&M!==void 0&&B!==void 0&&new Set([l(M),l(B),l(g.id)]).size>1&&o.push({kind:"flow-cross-pool",opIndex:y,id:g.id})}break}case"messageFlow.update":m(y,g.id,"messageFlow");break;case"dataStore.update":m(y,g.id,"dataStore");break;case"annotation.update":{if(m(y,g.id,"annotation")===void 0)break;g.placement&&u(y,g.placement.anchor,"anchor");break}case"group.update":{if(m(y,g.id,"group")===void 0)break;for(const v of g.members??[]){const b=u(y,v,"member");b&&nv.has(b)&&o.push({kind:"ref-category",opIndex:y,ref:v,role:"member",expected:"shape",actual:b})}break}case"translation.confirm":m(y,g.id);break;case"element.remove":{m(y,g.id)==="lane"&&o.push({kind:"ref-category",opIndex:y,ref:g.id,role:"target",expected:"removable",actual:"lane"});break}}}),o.push(...KA(e,t,n.i18n)),o;function m(g,y,_){if(r.has(y)){o.push({kind:"target-added-in-batch",opIndex:g,id:y});return}const h=t.categoryOf(y);if(h===void 0){o.push({kind:"ref-missing",opIndex:g,ref:y,role:"target"});return}if(_&&h!==_){o.push({kind:"ref-category",opIndex:g,ref:y,role:"target",expected:_,actual:h});return}return h}}const Bd=12,rv=14,QA=15,eT=100,tT=300,nT=30,iT=/[㐀-鿿]/,oT=1.1;function av(e){let t=0;for(const n of e)iT.test(n)?t+=Bd:MC(n)?t+=Nr(n,Bd):t+=Nr(n,Bd)*oT;return t}const sv="­";function rT(e,t){const n=e.split(/(\s|-|­)/g),i=[];let o=0,r;if(n.length>1)for(;r=n.shift();)if(r.length+o<t)i.push(r),o+=r.length;else{(r==="-"||r===sv)&&i.pop();break}return i[i.length-1]===sv&&(i[i.length-1]="-"),i.join("")}function aT(e,t,n){const i=Math.max(e.length*(n/t),1);return rT(e,i)||e.slice(0,Math.max(Math.round(i-1),1))}const cv=(e,t)=>e?t(e.replace(/\s+$/,"")):0;function sT(e,t,n=av){const i=e.split(/­?\r?\n/),o=[];for(;i.length;){const r=i.shift();let a=r;for(;;){const s=cv(a,n);if(a===" "||a===""||s<Math.round(t)||a.length<2)break;a=aT(a,s,t)}a.length<r.length&&i.unshift(r.slice(a.length).trim()),o.push(a)}return o}function lv(e){const t=e.length?e:[""],n=Math.max(0,...t.flatMap(r=>r.split(/­?\r?\n/).map(a=>cv(a,av)))),i=Math.max(eT,Math.min(tT,Math.floor(n)+1+rv)),o=Math.max(...t.map(r=>sT(r,i-rv).length));return{width:i,height:Math.max(nT,o*QA+10)}}const uv="bwlExactAnnotationBounds",cT=500;class pv{constructor(t){t.on("commandStack.shape.resize.preExecute",cT,({context:n})=>{var o,r;const i=(o=n==null?void 0:n.hints)==null?void 0:o[uv];!i||((r=n.shape)==null?void 0:r.type)!=="bpmn:TextAnnotation"||(n.newBounds={x:i.x,y:i.y,width:i.width,height:i.height})})}}ln(pv,"$inject",["eventBus"]);const dv={__init__:["annotationExactResize"],annotationExactResize:["type",pv]};function fv(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 ul(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const pl={"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]},Bn=10,lT=300,uT=160,hv=20,Nd=100,gv=40,pT=10,dT=["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"];function mv(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 dl=(e,t,n)=>e.y-t.height/2>=n.y&&e.y+t.height/2<=n.y+n.height;function fl(e,t,n,i,o){const r=n,a=mv(e,t,i),s=a??i,c=(Y,re,K=s)=>{const[Ce,Ae]=pl[Y];let Te={x:t.x+t.width/2+Ce*(t.width/2+r.width/2+re),y:t.y+t.height/2+Ae*(t.height/2+r.height/2+re)};const de=K.x+Bn+r.width/2,z=K.x+K.width-Bn-r.width/2,oe=K.y+Bn+r.height/2,V=K.y+K.height-Bn-r.height/2,X={x:Math.min(z,Math.max(de,Te.x)),y:Math.min(V,Math.max(oe,Te.y))};return(X.x!==Te.x||X.y!==Te.y)&&(Te=Math.abs(X.x-(t.x+t.width/2))<(t.width+r.width)/2+Bn&&Math.abs(X.y-(t.y+t.height/2))<(t.height+r.height)/2+Bn?{x:t.x+t.width+Bn+r.width/2,y:X.y}:X),Te},l=(i.children??[]).filter(Y=>!("waypoints"in Y&&Y.waypoints)&&Y.type!=="bpmn:Lane"&&Y.type!=="label"&&typeof Y.x=="number"&&Y.id!==o.selfId),u=We(e),p=Y=>{var K,Ce;if(!o.selfId)return!1;const re=e.get(Y);return!!re&&(((K=re.source)==null?void 0:K.id)===o.selfId||((Ce=re.target)==null?void 0:Ce.id)===o.selfId)},d=u.edges.filter(Y=>!p(Y.id)).flatMap(un),f=Ko(u).filter(Y=>Y.owner!==o.selfId).map(Y=>Y.rect),m=Y=>({x0:Y.x-r.width/2-Bn,x1:Y.x+r.width/2+Bn,y0:Y.y-r.height/2-Bn,y1:Y.y+r.height/2+Bn}),g=Y=>{const re=m(Y);return l.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},y=Y=>{const re=m(Y);return d.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},_=Y=>{const re=m(Y);return f.some(K=>re.x0<K.x+K.width&&re.x1>K.x&&re.y0<K.y+K.height&&re.y1>K.y)},h=u.shapes.filter(Y=>Y.type==="bpmn:Group").flatMap(Y=>[{axis:"h",at:Y.y,lo:Y.x,hi:Y.x+Y.width},{axis:"h",at:Y.y+Y.height,lo:Y.x,hi:Y.x+Y.width},{axis:"v",at:Y.x,lo:Y.y,hi:Y.y+Y.height},{axis:"v",at:Y.x+Y.width,lo:Y.y,hi:Y.y+Y.height}]),v=Y=>{const re=m(Y);return h.some(K=>K.axis==="h"?K.at>re.y0&&K.at<re.y1&&K.lo<re.x1&&K.hi>re.x0:K.at>re.x0&&K.at<re.x1&&K.lo<re.y1&&K.hi>re.y0)},b=Y=>g(Y)||y(Y)||_(Y)||v(Y),E=Y=>Y.x-r.width/2>=i.x&&Y.x+r.width/2<=i.x+i.width&&Y.y-r.height/2>=i.y&&Y.y+r.height/2<=i.y+i.height,M=Y=>E(Y)&&(!a||dl(Y,r,a));if(o.placement){const Y=de=>de.startsWith("top")?de.replace(/^top/,"bottom"):de.replace(/^bottom/,"top"),re=de=>de.endsWith("left")?de.replace(/left$/,"right"):de.replace(/right$/,"left"),K=o.placement.side,Ce=[K,Y(K),re(K),Y(re(K)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ae=o.placement.offset??50;let Te=c(K,Ae);if(b(Te)||a&&!dl(Te,r,a)){const de=(z,oe)=>{const V=new Set;for(const X of Ce){if(V.has(X))continue;V.add(X);const ue=c(X,Ae,z);if(oe(ue)&&!b(ue))return Te=ue,!0}return!1};!de(s,M)&&a&&de(i,E)}return Te}const B=o.from,P=s.x+Bn+r.width/2,k=s.x+s.width-Bn-r.width/2,N=s.y+Bn+r.height/2,G=s.y+s.height-Bn-r.height/2;let q={x:Math.min(k,Math.max(P,B.x)),y:Math.min(G,Math.max(N,B.y))};if(b(q)){const Y=(t.width+r.width)/2+Bn,K=[{x:q.x+Y,y:q.y},{x:q.x-Y,y:q.y},{x:q.x,y:q.y-r.height-Bn},{x:q.x,y:q.y+r.height+Bn}].filter(M).find(Ce=>!b(Ce));K&&(q=K)}return q}function Gt(e,t){return e.filter(n=>n.kind===t)}function yv(e,t){const n=new Map,i=new Set(Gt(e,"node.add").map(s=>s.node.id)),o=Gt(e,"sequenceFlow.update"),r=new Set(o.flatMap(s=>s.target!==void 0?[s.target]:[])),a=new Set;for(const s of o){const c=s.source;if(s.target!==void 0||c===void 0||!i.has(c)||r.has(c)||a.has(c))continue;const l=t(s.id),u=l&&Gt(e,"sequenceFlow.add").find(d=>d.flow.source===l&&d.flow.target===c);if(!u)continue;const p=JSON.stringify(u.flow.id);e.some(d=>d!==u&&JSON.stringify(d).includes(p))||(a.add(c),n.set(s.id,u))}return n}function fT(e,t,n){const i=new Map,o=new Set;for(const h of e){const v=i.get(h.source)??[];v.push(h.target),i.set(h.source,v),o.add(h.target)}const r=[...e.map(h=>h.source).filter(h=>!o.has(h)),...t,...e.map(h=>h.source)],a=new Map,s=new Set,c=h=>{a.set(h,"open");for(const v of i.get(h)??[]){const b=a.get(v);b==="open"?s.add(`${h}>${v}`):b||c(v)}a.set(h,"done")};for(const h of r)a.has(h)||c(h);const l=(h,v)=>!s.has(`${h}>${v}`),u=[],p=new Set,d=h=>{p.add(h);for(const v of i.get(h)??[])l(h,v)&&!p.has(v)&&d(v);u.push(h)};for(const h of r)p.has(h)||d(h);const f=new Map;for(const h of u.reverse()){const v=f.get(h)??0;f.set(h,v);for(const b of i.get(h)??[])l(h,b)&&(f.get(b)??-1)<v+1&&f.set(b,v+1)}const m=new Map;for(const h of e){if(!l(h.source,h.target)||!n(h.target))continue;const v=m.get(h.target)??[];v.includes(h.source)||v.push(h.source),m.set(h.target,v)}const g=new Map,y=(h,v)=>{let b=g.get(h);if(!b){b=new Set([h]);const E=[h];for(;E.length;){const M=E.pop();for(const B of i.get(M)??[])l(M,B)&&!b.has(B)&&(b.add(B),E.push(B))}g.set(h,b)}return b.has(v)},_=new Set;for(const h of e){const v=m.get(h.target);if(!v||v.length<2||!v.includes(h.source))continue;const b=f.get(h.source)??0;v.some(E=>E!==h.source&&(f.get(E)??0)>=b+2&&y(h.source,E))&&_.add(h.id)}return _}class vv extends Error{constructor(t){super(t.kind),this.issue=t,this.name="LowerIssueError"}}const xv=new WeakMap;function hT(e){return xv.get(e)??new Set}const bv=new WeakMap;function gT(e,t){bv.set(e,t)}const wv=new WeakMap;function mT(e){return wv.get(e)??[]}function _v(e,t){var JS,QS,eR,tR,nR,iR,oR,rR,aR,sR,cR,lR,uR,pR,dR,fR,hR,gR,mR,yR,vR,xR,bR,wR,_R,ER,SR,RR,MR;const{modeling:n,bpmnFactory:i,elementFactory:o,elementRegistry:r,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=new Set;xv.set(t,u);const p=[];wv.set(t,p);const d=()=>a.getRootElement(),f=x=>r.get(x),m=x=>{const w=f(x);if(!w)throw new Error(`하강 참조 해소 실패: ${x}`);return w},g=x=>{let w=x.parent;for(;w;){if(w.type==="bpmn:Participant")return w;w=w.parent}},y=(x,w)=>{if(!x)return;const S=w.x+w.width/2,O=w.y+w.height/2;let I;const T=$=>{for(const L of $.children??[])if(L.type==="bpmn:Lane"){const D=L;S>=D.x&&S<=D.x+D.width&&O>=D.y&&O<=D.y+D.height&&(I=D,T(D))}};return T(x),I},_=new Map;for(const x of r.filter(w=>!("waypoints"in w&&w.waypoints)&&w.type!=="bpmn:Lane"&&w.type!=="label"&&typeof w.x=="number"))_.set(x.id,{x:x.x,y:x.y});const h=Gt(e,"participant.add"),v=Gt(e,"node.add"),b=Gt(e,"sequenceFlow.add"),E=Gt(e,"messageFlow.add"),M=Gt(e,"dataStore.add"),B=Gt(e,"dataAssociation.add"),P=Gt(e,"annotation.add"),k=Gt(e,"group.add"),N=new Map(v.map(x=>[x.node.id,x])),G=yv(e,x=>{var w,S;return(S=(w=f(x))==null?void 0:w.source)==null?void 0:S.id}),q=new Set([...G.values()].map(x=>x.flow.id)),Y=b.filter(x=>!q.has(x.flow.id)),re=new Set([...G.values()].map(x=>x.flow.target)),K=x=>Gt(e,"sequenceFlow.update").filter(w=>w.target===x).length+(re.has(x)?1:0),Ce=(x,w,S)=>{var L;const O=x.businessObject,I=(((L=O.extensionElements)==null?void 0:L.values)??[]).filter(D=>D.$type!==w),T=S?[...I,i.create(w,S)]:I;if(!T.length){O.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const $=i.create("bpmn:ExtensionElements",{values:T});T.forEach(D=>{D.$parent=$}),n.updateProperties(x,{extensionElements:$})},Ae=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Gt(e,"element.remove")){const w=f(x.id);if(!w)continue;const S="waypoints"in w?[]:[...w.incoming??[],...w.outgoing??[]];n.removeElements([...S,w])}const Te=x=>r.filter(w=>{var S;return w.type==="bpmn:Lane"&&((S=g(w))==null?void 0:S.id)===x}).sort((w,S)=>w.y-S.y),de=[];for(const x of Gt(e,"participant.update")){const w=m(x.id);if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),!x.lanes)continue;const S=Te(x.id);if(!S.length){n.splitLane(w,x.lanes.length),Te(x.id).forEach((T,$)=>{const L=x.lanes[$];L&&n.updateProperties(T,{id:L.id,name:L.name})}),de.push({pool:x.id,lanes:new Set(x.lanes.map(T=>T.id))});continue}const O=new Set(S.map(T=>T.id)),I=x.lanes.reduce((T,$,L)=>O.has($.id)?L:T,-1);x.lanes.forEach((T,$)=>{if(O.has(T.id)){n.updateProperties(m(T.id),{name:T.name});return}const L=$===I+1&&I>=0,D=$===0?n.addLane(Te(x.id)[0],"top"):L?n.addLane(Te(x.id).at(-1),"bottom"):n.addLane(m(x.lanes[$-1].id),"bottom");n.updateProperties(D,{id:T.id,name:T.name})})}const z=150,oe=130,V=80,X=90,ue=180,be=30,$e=30,F=10,C=300,R=5,W=(x,w,S,O,I)=>{const T=S-w.width/2,$=O-w.height/2;return(x.children??[]).find(L=>!("waypoints"in L&&L.waypoints)&&L.type!=="bpmn:Lane"&&L.type!=="label"&&!(I!=null&&I.has(L.id))&&typeof L.x=="number"&&T<L.x+L.width+$e&&T+w.width+$e>L.x&&$<L.y+L.height&&$+w.height>L.y)},J=new Set;for(const x of h){J.add(`pool:${x.participant.id}`);for(const w of x.participant.lanes??[])J.add(w.id)}const fe=new Map;for(const x of v){const w=x.node.lane??`pool:${x.node.participant??""}`;let S=fe.get(w);S||fe.set(w,S=new Set([0])),x.band!==void 0&&S.add(x.band)}const Pe=new Map;for(const[x,w]of fe){if(!J.has(x))continue;const S=[...w].sort((T,$)=>T-$),O=S.map((T,$)=>$===0?0:$%2===1?Math.ceil($/2):-($/2)),I=Math.min(...O);Pe.set(x,new Map(S.map((T,$)=>[T,O[$]-I])))}{const x=new Map;for(const w of h)(w.participant.lanes??[]).forEach((S,O)=>x.set(S.id,O));for(const[w,S]of Pe){if(!x.has(w)||S.size<2)continue;const O=x.get(w),I=S.get(0)??0,T=new Set;for(const te of v){if(te.node.lane!==w||(te.band??0)!==0||!te.node.type.endsWith("Gateway"))continue;const pe={in:new Set,out:new Set,cross:new Set};for(const ae of Y){const ne=ae.flow.source===te.node.id;if(!ne&&ae.flow.target!==te.node.id)continue;const xe=N.get(ne?ae.flow.target:ae.flow.source);if(!xe||xe.node.participant!==te.node.participant||!xe.node.lane)continue;let ve,ee=!1;if(xe.node.lane!==w){const ce=x.get(xe.node.lane);if(ce===void 0)continue;ve=ce>O?"down":"up",ee=!0}else{const ce=S.get(xe.band??0)??I;ve=ce>I?"down":ce<I?"up":void 0}ve&&(pe[ne?"out":"in"].add(ve),ee&&pe.cross.add(ve))}for(const ae of["up","down"])pe.in.has(ae)&&pe.out.has(ae)&&pe.cross.has(ae)&&T.add(ae)}if(T.size!==1)continue;const[$]=T,L=Math.max(...S.values()),D=$==="down"?L:0;if(I===D)continue;const H=[...S.entries()].filter(([te])=>te!==0).sort((te,pe)=>te[1]-pe[1]),j=[...Array(L+1).keys()].filter(te=>te!==D),Q=new Map([[0,D]]);H.forEach(([te],pe)=>Q.set(te,j[pe])),Pe.set(w,Q)}}const ct=x=>{var w;return(((w=fe.get(x))==null?void 0:w.size)??0)>1},pt=x=>x.band??(x.node.lane||!ct(`pool:${x.node.participant??""}`)?void 0:0),zt=new Map,vt=x=>zt.get(x.node.id)??pt(x),an=new Set,Mn=new Set,kn=new Set,Nt=new Set,vn=new Set,On=x=>P.some(w=>{var S,O;return(((S=w.placement)==null?void 0:S.anchor)??(w.association?w.association.source===w.annotation.id?w.association.target:w.association.source:void 0))===x&&((O=w.placement)==null?void 0:O.side.startsWith("bottom"))});{const x=new Map;for(const O of Y)x.set(O.flow.target,(x.get(O.flow.target)??0)+1);const w=O=>{const I=[],T=new Set([O]),$=[O];for(;$.length;){const L=$.shift();I.push(L);for(const D of Y)D.flow.source!==L||T.has(D.flow.target)||(x.get(D.flow.target)??0)!==1||(T.add(D.flow.target),$.push(D.flow.target))}return I},S=(O,I)=>{var T;return((T=Pe.get(O))==null?void 0:T.get(I))??I};for(const O of v){if(!O.node.type.endsWith("Gateway"))continue;const I=O.node.lane??`pool:${O.node.participant??""}`,T=Pe.get(I);if(!T||T.size<2)continue;const $=vt(O);if($===void 0||S(I,$)!==S(I,0))continue;const L=S(I,$),D=Y.filter(ae=>ae.flow.source===O.node.id).map(ae=>N.get(ae.flow.target)).filter(ae=>!!ae&&(ae.node.lane??`pool:${ae.node.participant??""}`)===I),H=D.filter(ae=>{const ne=vt(ae);return ne!==void 0&&S(I,ne)===L&&(x.get(ae.node.id)??0)===1}),j=D.some(ae=>{const ne=vt(ae);return ne!==void 0&&S(I,ne)>L});if(H.length!==1||!j)continue;const Q=new Set(D.flatMap(ae=>w(ae.node.id)));if(!Y.some(ae=>ae.flow.target===O.node.id&&Q.has(ae.flow.source)))continue;const pe=new Map;for(const[ae,ne]of T)pe.set(ae,ne+1);pe.set(-1,0),Pe.set(I,pe);for(const ae of w(H[0].node.id))N.has(ae)&&(zt.set(ae,-1),Mn.add(ae));an.add(O.node.id)}}{const x=j=>j.node.lane??`pool:${j.node.participant??""}`,w=j=>vt(j)??0,S=new Map(h.map((j,Q)=>({id:j.participant.id,order:j.order??Number.POSITIVE_INFINITY,declared:Q})).sort((j,Q)=>j.order!==Q.order?j.order-Q.order:j.declared-Q.declared).map((j,Q)=>[j.id,Q])),O=j=>j===void 0?void 0:S.get(j)??-1,I=j=>{var pe;const Q=N.get(j);if(Q)return Q.node.participant;if(S.has(j))return j;const te=f(j);if(te)return te.type==="bpmn:Participant"?te.id:(pe=g(te))==null?void 0:pe.id},T=new Map;for(const j of Y)T.set(j.flow.target,(T.get(j.flow.target)??0)+1);const $=j=>{const Q=[j],te=new Set([j.node.id]);for(let pe=0;pe<Q.length;pe++)for(const ae of Y){if(ae.flow.source!==Q[pe].node.id||te.has(ae.flow.target)||(T.get(ae.flow.target)??0)!==1)continue;const ne=N.get(ae.flow.target);!ne||ne.node.participant!==j.node.participant||(te.add(ne.node.id),Q.push(ne))}return Q},L=j=>{const Q=new Set(j.map(ae=>ae.node.id)),te=O(j[0].node.participant);if(te===void 0)return;const pe=new Set;for(const ae of E){const ne=Q.has(ae.flow.source)?ae.flow.target:Q.has(ae.flow.target)?ae.flow.source:void 0;if(ne===void 0)continue;const xe=O(I(ne));xe===void 0||xe===te||pe.add(xe<te?"up":"down")}return pe.size===1?[...pe][0]:void 0},D=new Map;{const j=new Map;for(const ne of Y){if(!N.has(ne.flow.source)||!N.has(ne.flow.target))continue;const xe=j.get(ne.flow.source)??[];xe.push(ne.flow.target),j.set(ne.flow.source,xe)}const Q=new Map,te=[],pe=new Set,ae=ne=>{Q.set(ne,"open");for(const xe of j.get(ne)??[]){const ve=Q.get(xe);ve==="open"?pe.add(`${ne}>${xe}`):ve||ae(xe)}Q.set(ne,"done"),te.push(ne)};for(const ne of v)Q.has(ne.node.id)||ae(ne.node.id);for(const ne of te.reverse()){const xe=D.get(ne)??0;D.set(ne,xe);for(const ve of j.get(ne)??[])!pe.has(`${ne}>${ve}`)&&(D.get(ve)??-1)<xe+1&&D.set(ve,xe+1)}}let H=-1e3;for(const j of v){if(!j.node.type.endsWith("Gateway"))continue;const Q=x(j),te=Pe.get(Q);if(!te)continue;const pe=te.get(w(j))??0,ae=ee=>(te.get(w(ee))??0)-pe,ne=Y.filter(ee=>ee.flow.source===j.node.id).map(ee=>N.get(ee.flow.target)).filter(ee=>!!ee&&x(ee)===Q&&(T.get(ee.node.id)??0)===1&&!Mn.has(ee.node.id)).map(ee=>{const ce=$(ee);return{root:ee,subtree:ce,dir:L(ce)}});if(ne.some(ee=>ee.dir==="up")&&ne.some(ee=>ee.dir==="down"))continue;const xe=Y.some(ee=>{const ce=ee.flow.source===j.node.id?N.get(ee.flow.target):void 0;return!!ce&&x(ce)===Q&&ae(ce)===0});let ve=!1;if(!xe){const ee=Y.filter(se=>se.flow.source===j.node.id).map(se=>N.get(se.flow.target)).filter(se=>!!se&&x(se)===Q&&(!!se.node.lane||pt(se)!==void 0)&&ae(se)<0),ce=ee.length?Math.max(...ee.map(ae)):void 0,ye=ee.filter(se=>ae(se)===ce);if(!On(j.node.id)&&ye.length===1&&(T.get(ye[0].node.id)??0)===1&&!an.has(j.node.id))continue;ve=!0}for(const ee of ne){const ce=ee.dir;if(!ce||ne.some(ge=>ge!==ee&&ge.dir===ce))continue;const ye=ae(ee.root);if(ye===0||(ce==="up"?ye<0:ye>0)||Y.some(ge=>{const Fe=ge.flow.target===j.node.id?N.get(ge.flow.source):void 0;if(!Fe||x(Fe)!==Q)return!1;const Ke=ae(Fe);return ce==="up"?Ke<0:Ke>0}))continue;const se=[...te].map(([ge,Fe])=>({band:ge,rel:Fe-pe})).filter(ge=>ce==="up"?ge.rel<0:ge.rel>0).sort((ge,Fe)=>Math.abs(Fe.rel)-Math.abs(ge.rel));if(!se.length&&ce==="down")continue;const Re=w(ee.root),Me=ee.subtree.filter(ge=>x(ge)===Q&&w(ge)===Re),Ge=new Set(ee.subtree.map(ge=>ge.node.id)),Ue=Me.map(ge=>D.get(ge.node.id)??0),Ie=Math.min(...Ue)-1,Oe=Math.max(...Ue)+1,me=ge=>!v.some(Fe=>{if(Ge.has(Fe.node.id)||x(Fe)!==Q||w(Fe)!==ge)return!1;if(!kn.has(ge))return!0;const Ke=D.get(Fe.node.id)??0;return Ke>=Ie&&Ke<=Oe});let he=ve?w(j):(JS=se.find(ge=>me(ge.band)))==null?void 0:JS.band;if(he===void 0){if(he=H--,kn.add(he),ce==="up"){const ge=new Map;for(const[Fe,Ke]of te)ge.set(Fe,Ke+1);ge.set(he,0),Pe.set(Q,ge)}else te.set(he,Math.max(...te.values())+1);(QS=fe.get(Q))==null||QS.add(he)}for(const ge of Me)zt.set(ge.node.id,he)}}{const j=ne=>{const xe=Y.find(ve=>ve.flow.target===ne.node.id);return xe?N.get(xe.flow.source):void 0},Q=ne=>{const xe=j(ne);if(!xe||!xe.node.type.endsWith("Gateway")||x(xe)!==x(ne))return!1;const ve=Pe.get(x(xe));if(!ve)return!1;const ee=ve.get(w(xe))??0,ce=Me=>x(Me)===x(xe)?(ve.get(w(Me))??0)-ee:Number.NaN,ye=Y.filter(Me=>Me.flow.source===xe.node.id).map(Me=>N.get(Me.flow.target)).filter(Me=>!!Me&&(!!Me.node.lane||pt(Me)!==void 0));if(ye.some(Me=>ce(Me)===0))return!1;const le=ye.filter(Me=>Me.node.lane===xe.node.lane&&ce(Me)<0);if(!le.length)return!1;const se=Math.max(...le.map(ce)),Re=le.filter(Me=>ce(Me)===se);return Re.length===1&&Re[0]===ne&&(T.get(ne.node.id)??0)===1&&!On(xe.node.id)&&!an.has(xe.node.id)},te=new Set;for(const ne of v){if(!ne.node.type.endsWith("Gateway")||On(ne.node.id))continue;const xe=Pe.get(x(ne));if(!xe)continue;const ve=xe.get(w(ne))??0;let ee;for(const ce of Y){if(ce.flow.source!==ne.node.id)continue;const ye=N.get(ce.flow.target);if(!ye||x(ye)!==x(ne)||!ye.node.lane&&pt(ye)===void 0)continue;const le=xe.get(w(ye))??0;le<=ve||(!ee||le>ee.row?ee={id:ye.node.id,row:le,count:1}:le===ee.row&&ee.count++)}ee&&ee.count===1&&(T.get(ee.id)??0)===1&&te.add(ee.id)}const pe=new Set,ae=[...v].sort((ne,xe)=>Number(te.has(ne.node.id))-Number(te.has(xe.node.id)));for(const ne of ae){const xe=x(ne),ve=Pe.get(xe);if(!ve)continue;const ee=ne.node.id,ce=E.filter(it=>it.flow.target===ee);if(ce.length!==1||!(T.get(ee)??0)||!ne.node.lane&&pt(ne)===void 0||Mn.has(ee)||Nt.has(ee))continue;const ye=(eR=N.get(ce[0].flow.source))==null?void 0:eR.node.participant;if(!ye||ye===ne.node.participant)continue;const le=O(ne.node.participant),se=O(ye);if(le===void 0||se===void 0||le===se)continue;const Re=se<le,Me=ve.get(0)??0,Ge=(ve.get(w(ne))??Me)-Me;if(Ge===0||(Re?Ge<0:Ge>0)||Q(ne))continue;let Ue;for(const[it,Be]of ve){if(kn.has(it))continue;const Ve=Be-Me;(Re?Ve<0&&(!Ue||Ve<Ue.row):Ve>0&&(!Ue||Ve>Ue.row))&&(Ue={band:it,row:Ve})}if(!Ue)continue;const Ie=w(ne),Oe=$(ne).filter(it=>x(it)===xe&&w(it)===Ie&&!Mn.has(it.node.id)),me=j(ne),he=me!=null&&me.node.type.endsWith("Gateway")?`${me.node.id}|${xe}|${Ue.band}`:void 0,ge=Ue,Fe=!!he&&te.has(ee)&&Y.some(it=>{if(it.flow.source!==me.node.id||it.flow.target===ee)return!1;const Be=N.get(it.flow.target);return!!Be&&x(Be)===xe&&!Oe.includes(Be)&&w(Be)===ge.band});let Ke=Ue.band;if(he&&(pe.has(he)||Fe)){if(Ke=H--,kn.add(Ke),Re){const it=new Map;for(const[Be,Ve]of ve)it.set(Be,Ve+1);it.set(Ke,0),Pe.set(xe,it)}else ve.set(Ke,Math.max(...ve.values())+1);(tR=fe.get(xe))==null||tR.add(Ke)}he&&pe.add(he);for(const it of Oe)zt.set(it.node.id,Ke),Nt.add(it.node.id);Re&&te.has(ee)&&vn.add(ee)}}}const ii=(x,w)=>{var S;return((S=Pe.get(x))==null?void 0:S.get(w))??w},qn=(x,w,S,O)=>{const I=x?f(x):w?f(w):void 0;if(!I)return!1;const T=x?I.y+Math.min(I.height/2,X):I.y+V;return Math.abs(T+ii(x??`pool:${w??""}`,S)*z-O)<=z/2},Ni=new Map;for(const[x,w]of fe){let S=0;for(const O of w)S=Math.max(S,ii(x,O));Ni.set(x,S)}const oi=x=>ue+z*x,Wt=(x,w,S,O)=>{const I=d().children.filter(T=>!("waypoints"in T&&T.waypoints)&&T.type!=="label"&&T.id!==w&&!(O!=null&&O.has(T.id))&&typeof T.y=="number"&&T.y>=x);I.length&&n.moveElements(I,{x:0,y:S})},Rr=(x,w,S)=>{const O=x.type==="bpmn:Participant"?x:void 0;if(!O||O.children.some(L=>L.type==="bpmn:Lane"))return;const I=S+w.height/2+be-O.y;if(O.height>=I)return;const T=I-O.height,$=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:I}),Wt($,O.id,T)},is=(x,w,S)=>{const O=w-x.height;if(O<=0)return new Set;const I=g(x)??x,T=[],$=H=>{if(!(S!=null&&S.has(H.id))){T.push(H);for(const j of H.children??[])$(j)}};$(I);const L=x.y+x.height-10,D=l.calculateAdjustments(T,"y",O,L);return l.makeSpace(D.movingShapes,D.resizingShapes,{x:0,y:O},"s",L),new Set(D.movingShapes.map(H=>H.id))},Zn=(x,w,S)=>{if(x){const $=m(x),L=oi(w);if($.height>=L)return;const D=L-$.height,H=g($),j=H?H.y+H.height:$.y+$.height,Q=is($,L);Wt(j,H==null?void 0:H.id,D,Q);return}if(!S)return;const O=z*(w+1);if(S.height>=O)return;const I=O-S.height,T=S.y+S.height;n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:O}),Wt(T,S.id,I)},_t=new Map;for(const x of Y)_t.set(x.flow.target,(_t.get(x.flow.target)??0)+1);const At=x=>(_t.get(x)??0)<=1,NF=new Set(v.map(x=>x.node.id).filter(x=>K(x)===1&&!Y.some(w=>w.flow.target===x||w.flow.source===x&&N.has(w.flow.target)))),Yg=new Map,Kg=(x,w)=>{if(!x)return;const S=f(x);if(!S||S.height>=oi(w))return;const O=S.y+S.height-10,I=g(S);if(I)return new Set((I.children??[]).filter(T=>T.type!=="bpmn:Lane"&&typeof T.y=="number"&&T.y>O).map(T=>T.id))},Cp=(x,w,S)=>{if(!x)return!0;const O=f(x);return O?S-w.height/2>=O.y&&S+w.height/2<=O.y+O.height:!0},$F=10,FF=/(Task|Event|Gateway|CallActivity|SubProcess|Transaction)$/;for(const{pool:x,lanes:w}of de){const S=f(x),O=Te(x);if(!S||O.length<2)continue;const I=oi(0),T=$F,$=new Set(Gt(e,"node.update").filter(le=>le.lane!==void 0&&w.has(le.lane)).map(le=>le.id)),L=S.children??[],D=L.filter(le=>!("waypoints"in le&&le.waypoints)&&le.type!=="bpmn:Lane"&&le.type!=="label"&&typeof le.y=="number"),H=[];for(const le of D){H.push([le.y,le.y+le.height]);const se=le.label;se&&H.push([se.y,se.y+se.height])}for(const le of L){const se="waypoints"in le&&le.waypoints?le.label:void 0;se&&se.y+se.height>S.y&&se.y<S.y+S.height&&H.push([se.y,se.y+se.height])}for(const le of d().children){if(le.type!=="bpmn:TextAnnotation")continue;const se=le;se.x<S.x+S.width&&se.x+se.width>S.x&&se.y<S.y+S.height&&se.y+se.height>S.y&&H.push([se.y,se.y+se.height])}H.sort((le,se)=>le[0]-se[0]);const j=S.y,Q=S.y+S.height,te=[];let pe=j;for(const[le,se]of H)le>pe&&te.push([pe,le]),pe=Math.max(pe,se);const ae=D.filter(le=>FF.test(le.type)&&!$.has(le.id)),ne=(le,se)=>ae.some(Re=>Re.y+Re.height/2>=le&&Re.y+Re.height/2<=se),xe=le=>H.some(([se,Re])=>se<le-.5&&le+.5<Re),ve=[];let ee=j;for(const le of O.slice(1).map(se=>se.y)){const se=ee+2*T,Re=!xe(le)&&le>=se&&le<=Q-2*T?[le]:[];for(const[Ge,Ue]of te){const Ie=Math.max(Ge+T,se),Oe=Math.min(Ue-T,Q-2*T);Ie<=Oe&&Re.push(Math.min(Math.max(le,Ie),Oe))}Re.push(Math.max(pe+T,se));let Me;for(const Ge of Re){const Ue=!ne(ee,Ge)&&Ge-ee<I?D.filter(me=>me.y>=Ge).length:0,Ie=Math.abs(Ge-le),Oe=Me?Math.abs(Me.y-le):0;(!Me||Ue<Me.cost||Ue===Me.cost&&(Ie<Oe||Ie===Oe&&Ge>Me.y))&&(Me={y:Ge,cost:Ue})}ve.push(Me.y),ee=Me.y}const ce=ve[ve.length-1]+2*T-Q;ce>0&&(n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+ce}),Wt(Q,S.id,ce));const ye=[j,...ve,S.y+S.height];O.forEach((le,se)=>{const Re=ye[se],Me=ye[se+1]-Re;(le.y!==Re||le.height!==Me)&&n.resizeShape(le,{x:le.x,y:Re,width:le.width,height:Me})});for(const le of O){if(le.height>=I||ne(le.y,le.y+le.height))continue;const se=I-le.height,Re=S.y+S.height,Me=is(le,I);Wt(Re,S.id,se,Me)}}const Ap=h.map((x,w)=>({op:x,declared:w}));Ap.sort((x,w)=>{const S=x.op.order??Number.POSITIVE_INFINITY,O=w.op.order??Number.POSITIVE_INFINITY;return S!==O?S-O:x.declared-w.declared});let Tc=80;for(const x of r.getAll())x.parent===d()&&"height"in x&&typeof x.y=="number"&&(Tc=Math.max(Tc,x.y+x.height+60));const Xg=r.getAll().filter(x=>x.type==="bpmn:Participant"&&x.parent===d()),jF=(()=>{if(!Xg.length)return;const x=Xg.filter(I=>!Ev(I)),w=x.length?x:Xg,S=Math.min(...w.map(I=>I.x)),O=Math.max(...w.map(I=>I.x+I.width));return O>S?{x:S,width:O-S}:void 0})();for(const{op:x}of Ap){const w=x.participant,S=v.filter(ne=>ne.node.participant===w.id).length,O=((nR=w.lanes)==null?void 0:nR.length)??0,I=Math.max(1200,S*160+300),T=(w.lanes??[]).map(ne=>oi(Ni.get(ne.id)??0)),$=T.reduce((ne,xe)=>ne+xe,0);O&&$<300&&(T[O-1]+=300-$);const L=Math.max(300,z*((Ni.get(`pool:${w.id}`)??0)+1)),D=w.blackBox||S+O===0?120:O?Math.max(300,$):L,H=w.blackBox?jF:void 0,j=(H==null?void 0:H.x)??100,Q=(H==null?void 0:H.width)??I,te=o.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:w.id,name:w.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...w.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Q,height:D,isExpanded:!0}),pe=n.createShape(te,{x:j+Q/2,y:Tc+D/2},d()),ae=w.lanes??[];if(ae.length&&n.splitLane(pe,ae.length),ae.length){const ne=r.filter(xe=>{var ve;return xe.type==="bpmn:Lane"&&((ve=g(xe))==null?void 0:ve.id)===w.id}).sort((xe,ve)=>xe.y-ve.y);if(ne.forEach((xe,ve)=>{const ee=ae[ve];ee&&n.updateProperties(xe,{id:ee.id,name:ee.name})}),T.some(xe=>xe!==pe.height/O)){let xe=pe.y;ne.forEach((ve,ee)=>{const ce=T[ee];n.resizeShape(ve,{x:ve.x,y:xe,width:ve.width,height:ce}),xe+=ce})}}Tc=pe.y+pe.height+60}const HF=x=>{var O;const w=N.get(x);if(w)return w.node.participant??"";const S=f(x);return S?S.type==="bpmn:Participant"?S.id:((O=g(S))==null?void 0:O.id)??"":""},Pc=new Map,bS=x=>{let w=Pc.get(x);return w||Pc.set(x,w={nodes:[],flows:[]}),w};for(const x of v)bS(x.node.participant??"").nodes.push(x);for(const x of Y)bS(HF(x.flow.source)).flows.push(x);const Tp=x=>{var w;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((w=x.condition)==null?void 0:w.label)})},Zg=(x,w,S)=>o.createShape({type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{},businessObject:i.create(ul(x.type),{id:x.id,name:x.name,...w!==void 0?{"bwl:band":w}:{},...S!==void 0?{"bwl:afterColumn":S}:{}})}),zF=[...Ap.map(({op:x})=>x.participant.id).filter(x=>Pc.has(x)),...[...Pc.keys()].filter(x=>!h.some(w=>w.participant.id===x))],Jg=x=>x.endsWith("Gateway");for(const x of zF){const w=Pc.get(x),S=x?m(x):void 0,O=S?S.x+150:250;let I=S?S.y+80:120;const T=(se,Re,Me)=>{if(se){const Ge=m(se);return Ge.y+Math.min(Ge.height/2,X)+ii(se,Re??0)*z}return Re!==void 0&&S?S.y+V+ii(`pool:${x}`,Re)*z:Me},$=(se,Re,Me)=>{if(se){const Ge=m(se);return Ge.y+Math.min(Ge.height/2,X)+Re*z}return S?S.y+V+Re*z:Me},L=se=>se.participant?m(se.participant):d(),D=(se,Re,Me,Ge,Ue,Ie,Oe,me)=>{const he=Me!==void 0||Ge!==void 0,ge=Be=>{const Ve=()=>Zn(Me,Be,S);me?me(Ve):Ve()},Fe=ii(Me??`pool:${x}`,Ge??0);if((Ge===void 0||qn(Me,x,Ge,Oe??Number.NaN))&&Oe!==void 0&&Cp(Me,Re,Oe)&&!W(se,Re,Ue,Oe))return{x:Ue,y:Oe};if(he)for(let Be=0;Be<4;Be++){const Ve=$(Me,Fe+Be,Ie);if(!W(se,Re,Ue,Ve,Kg(Me,Fe+Be)))return ge(Fe+Be),{x:Ue,y:Ve}}const Ke=T(Me,Ge,Ie);he?ge(Fe):me?me(()=>Rr(se,Re,Re.y+Re.height/2)):Rr(se,Re,Ke);let it=Ue;for(let Be=0;Be<64;Be++){const Ve=W(se,Re,it,Ke);if(!Ve)break;it=Ve.x+Ve.width+oe+Re.width/2}return{x:it,y:Ke}},H=(se,Re,Me)=>{const Ge=r.getAll().filter(Ie=>{var Oe;return/Association$/.test(Ie.type)&&(((Oe=Ie.waypoints)==null?void 0:Oe.length)??0)>=2});if(!Ge.length)return Me;const Ue=Ie=>{const Oe={id:Re.id,type:Re.type,x:Ie-Re.width/2,y:Me.y-Re.height/2,width:Re.width,height:Re.height};return Ge.some(me=>me.waypoints.some((he,ge)=>!!me.waypoints[ge+1]&&wo(he,me.waypoints[ge+1],Oe)<=F))};if(!Ue(Me.x))return Me;for(let Ie=R;Ie<=C;Ie+=R){const Oe=Me.x+Ie;if(!Ue(Oe)&&!W(se,Re,Oe,Me.y))return{x:Oe,y:Me.y}}return Me},j=(se,Re,Me,Ge,Ue)=>{var Be;const Ie=ii(Ge??`pool:${x}`,Ue??0),Oe=$(Ge,Ie,Number.NaN);if(Number.isNaN(Oe))return;const me=W(se,Re,Me,Oe,Kg(Ge,Ie));if(!me||!N.has(me.id)||me.type!=="bpmn:EndEvent")return;const he=Ve=>(Ve??[]).filter(Ft=>Ft.type==="bpmn:SequenceFlow"),ge=he(me.incoming);if(he(me.outgoing).length||ge.length>1)return;const Fe=me.y+me.height/2;if(Math.abs(Fe-Oe)>1)return;const Ke=(Be=ge[0])==null?void 0:Be.source;if(!Ke||typeof Ke.x!="number"||me.x-(Ke.x+Ke.width)>oe)return;const it=$(Ge,Ie+1,Number.NaN);Number.isNaN(it)||W(se,me,me.x+me.width/2,it,new Set([me.id]))||(Zn(Ge,Ie+1,S),n.moveShape(me,{x:0,y:it-Fe}))},Q=new Set(w.flows.map(se=>se.flow.target)),te=new Map,pe=se=>{if(se===void 0)return;const Re=r.get(se);if(!(!Re||typeof Re.x!="number"||typeof Re.width!="number"))return Re.x+Re.width+oe},ae=se=>{if(K(se)>0)return;const Re=w.flows.filter(Ge=>Ge.flow.source===se);if(Re.length!==1)return;const Me=r.get(Re[0].flow.target);return Me&&typeof Me.y=="number"&&typeof Me.height=="number"?Me.y+Me.height/2:void 0};for(const se of w.nodes){if(Q.has(se.node.id))continue;const Re=Zg(se.node,se.band,se.afterColumn),Me=pt(se),Ge=se.node.lane?`${se.node.lane}|${Me??""}`:Me!==void 0?`band:${Me}`:"",Ue=L(se.node),Ie=te.get(Ge)??O,Oe=pe(se.afterColumn),me=Oe===void 0?Ie:Math.max(Ie,Oe);let he;const ge=D(Ue,Re,se.node.lane,Me,me,I,ae(se.node.id),NF.has(se.node.id)&&se.node.participant!==void 0?Fe=>he=Fe:void 0);if(he?n.createShape(Re,ge,Ue,{autoResize:!1}):n.createShape(Re,ge,Ue),he){const Fe=se.node.lane?m(se.node.lane):Ue;Yg.set(se.node.id,{container:Fe,relCy:ge.y-Fe.y,grow:he})}te.set(Ge,ge.x+Re.width+oe),!se.node.lane&&Me===void 0&&(I+=160)}const ne=new Set,xe=new Map,ve=new Map;if(x&&J.has(`pool:${x}`)){const se=new Map;for(const me of w.flows)se.set(me.flow.target,(se.get(me.flow.target)??0)+1);const Re=me=>T(me.node.lane,vt(me),Number.NaN),Me=new Set,Ge=me=>{var Fe;const he=(Fe=N.get(me))==null?void 0:Fe.node.participant;if(he)return f(he);const ge=f(me);if(ge)return ge.type==="bpmn:Participant"?ge:g(ge)},Ue=me=>{const he=[],ge=new Set([me]),Fe=[me];for(;Fe.length;){const Ke=Fe.shift(),it=N.get(Ke);it&&he.push(it);for(const Be of w.flows)Be.flow.source!==Ke||ge.has(Be.flow.target)||(se.get(Be.flow.target)??0)!==1||(ge.add(Be.flow.target),Fe.push(Be.flow.target))}return he},Ie=me=>{if(!S)return;const he=new Set(me.map(Ke=>Ke.node.id));let ge=!1,Fe=!1;for(const Ke of E){if(!he.has(Ke.flow.source))continue;const it=Ge(Ke.flow.target);!it||it.id===S.id||(it.y<S.y?ge=!0:Fe=!0)}return ge&&!Fe?"up":Fe&&!ge?"down":void 0};for(const me of w.nodes){if(!Jg(me.node.type))continue;const he=T(me.node.lane,pt(me),Number.NaN);if(Number.isNaN(he))continue;const ge=[];for(const Be of w.flows){if(Be.flow.source!==me.node.id)continue;const Ve=N.get(Be.flow.target);if(!Ve||Ve.node.lane!==me.node.lane||(se.get(Ve.node.id)??0)!==1)continue;const Ft=pt(Ve);if(Ft===void 0)continue;const cn=T(Ve.node.lane,Ft,Number.NaN);if(Number.isNaN(cn))continue;const Yt=Ue(Ve.node.id),Kt=Ie(Yt);Kt&&ge.push({subtree:Yt,band:Ft,row:cn,dir:Kt})}if(!ge.some(Be=>Be.dir==="up")||!ge.some(Be=>Be.dir==="down")||!ge.some(Be=>Be.dir==="up"&&ge.some(Ve=>Ve.dir==="down"&&Ve.row<Be.row)))continue;const Ke=[...ge].sort((Be,Ve)=>Be.row-Ve.row);[...ge.filter(Be=>Be.dir==="up"),...ge.filter(Be=>Be.dir==="down")].sort((Be,Ve)=>Be.dir===Ve.dir?Be.row-Ve.row:Be.dir==="up"?-1:1).forEach((Be,Ve)=>{const Ft=Ke[Ve].band;if(Ft!==Be.band){Me.add(me.node.id);for(const cn of Be.subtree)pt(cn)===Be.band&&zt.set(cn.node.id,Ft)}})}const Oe=me=>{if(!S)return;const he=new Set(me.map(Ke=>Ke.node.id));let ge=!1,Fe=!1;for(const Ke of E){if(!he.has(Ke.flow.target))continue;const it=Ge(Ke.flow.source);!it||it.id===S.id||(it.y<S.y?ge=!0:Fe=!0)}return ge&&!Fe?"up":Fe&&!ge?"down":void 0};for(const me of w.nodes){if(!Jg(me.node.type))continue;const he=me.node.lane??`pool:${x}`,ge=Pe.get(he);if(!ge||ge.size<2)continue;const Fe=ge.get(0);if(Fe===void 0)continue;const Ke=Math.max(...ge.values()),it=Fe===Ke&&Fe!==0?"down":void 0;if(!it)continue;const Be=[];for(const Kt of w.flows){if(Kt.flow.source!==me.node.id)continue;const mo=N.get(Kt.flow.target);if(!mo||mo.node.lane!==me.node.lane||(se.get(mo.node.id)??0)!==1)continue;const Lp=vt(mo);Lp!==void 0&&Be.push({t:mo,subtree:Ue(mo.node.id),band:Lp})}const Ve=Be.find(Kt=>(ge.get(Kt.band)??Kt.band)===Fe);if(!Ve||Oe(Ve.subtree)===it||Ie(Ve.subtree)===it)continue;const Ft=Be.find(Kt=>Kt!==Ve&&Oe(Kt.subtree)===it);if(!Ft)continue;const cn=Ve.band,Yt=Ft.band;for(const Kt of Ve.subtree)vt(Kt)===cn&&zt.set(Kt.node.id,Yt);for(const Kt of Ft.subtree)vt(Kt)===Yt&&zt.set(Kt.node.id,cn);Me.add(me.node.id)}for(const me of w.nodes){if(!Jg(me.node.type))continue;const he=Re(me);if(Number.isNaN(he)||On(me.node.id))continue;let ge,Fe=!1,Ke;for(const it of w.flows){if(it.flow.source!==me.node.id)continue;const Be=N.get(it.flow.target);if(!Be||!Be.node.lane&&pt(Be)===void 0)continue;const Ve=Re(Be);Number.isNaN(Ve)||(Math.abs(Ve-he)<.5&&(Fe=!0),Ve>he?!ge||Ve>ge.row?ge={id:Be.node.id,row:Ve,count:1}:Ve===ge.row&&ge.count++:Ve<he&&Be.node.lane===me.node.lane&&!Nt.has(Be.node.id)&&(!Ke||Ve>Ke.row?Ke={op:Be,row:Ve,count:1}:Ve===Ke.row&&Ke.count++))}ge&&ge.count===1&&(se.get(ge.id)??0)===1&&!Me.has(me.node.id)&&ne.add(ge.id),!Fe&&Ke&&Ke.count===1&&(se.get(Ke.op.node.id)??0)===1&&!an.has(me.node.id)&&xe.set(Ke.op.node.id,{lane:me.node.lane,band:vt(me)})}for(const me of vn){const he=(iR=w.flows.find(ge=>ge.flow.target===me))==null?void 0:iR.flow.source;he&&!Me.has(he)&&ne.add(me)}}const ee=fT(w.flows.map(se=>se.flow),w.nodes.map(se=>se.node.id),se=>N.has(se));let ce=!1;const ye=new Set;let le=0;for(;le++<w.nodes.length+2;){for(let Me=0;Me<w.nodes.length+w.flows.length+2;Me++){let Ge=!1,Ue=!1;for(const Ie of w.flows){const Oe=Ie.flow;if(ye.has(Oe.id))continue;const me=f(Oe.source);if(!me)continue;const he=f(Oe.target),ge=N.get(Oe.target);if(!he&&ge&&!ce&&ee.has(Oe.id)){Ue=!0;continue}if(!he&&ge){const Fe=Zg(ge.node,ge.band),Ke=vt(ge);if(ge.node.lane||Ke!==void 0){const it=L(ge.node),Be=me,Ve=Be.x+(ve.get(Oe.source)??0)+Be.width+oe,Ft=xe.get(Oe.target);ne.has(Oe.target)&&j(it,Fe,Be.x+Be.width/2,Ft?Ft.lane:ge.node.lane,Ft?Ft.band:Ke);const cn=D(it,Fe,Ft?Ft.lane:ge.node.lane,Ft?Ft.band:Ke,ne.has(Oe.target)?Be.x+Be.width/2:Ve,Number.NaN,Ft||!At(Oe.target)?void 0:Be.y+Be.height/2),Yt=N.has(Oe.source)?cn:H(it,Fe,cn),Kt=n.createShape(Fe,Yt,it);ne.has(Oe.target)&&ve.set(Oe.target,Ve-(Kt.x+Kt.width/2)),n.connect(me,Kt,{type:"bpmn:SequenceFlow",businessObject:Tp(Oe)})}else s.append(me,Fe,{connection:{type:"bpmn:SequenceFlow",businessObject:Tp(Oe)}})}else if(he)n.connect(me,he,{type:"bpmn:SequenceFlow",businessObject:Tp(Oe)});else continue;ye.add(Oe.id),Ge=!0}if(!Ge){if(Ue&&!ce){ce=!0;continue}break}ce=!1}const se=w.nodes.filter(Me=>!f(Me.node.id));if(!se.length)break;const Re=se[0];{const Me=Zg(Re.node,Re.band),Ge=L(Re.node),Ue=pt(Re);n.createShape(Me,D(Ge,Me,Re.node.lane,Ue,O,I),Ge),!Re.node.lane&&Ue===void 0&&(I+=160)}}}const wS=new Map;for(const[x,w]of G){const S=f(x),O=f(w.flow.target);if(!(S!=null&&S.target)||!O)continue;const I=S.label&&{x:S.label.x,y:S.label.y,width:S.label.width,height:S.label.height};wS.set(x,{waypoints:S.waypoints.map(L=>({x:L.x,y:L.y})),label:I});const T=S.target,$=L=>({x:L.x+L.width/2,y:L.y+L.height/2});n.reconnect(S,O,T,[$(O),$(T)]),n.layoutConnection(S,{waypoints:[]})}const _S=new Set;{const x=T=>T.endsWith("Task")||T==="bpmn:CallActivity"||T==="bpmn:SubProcess",w=T=>x(T)||T==="bpmn:EndEvent"||T==="bpmn:IntermediateThrowEvent"||T==="bpmn:IntermediateCatchEvent",S=T=>(T??[]).filter($=>$.type==="bpmn:SequenceFlow"),O=Gt(e,"sequenceFlow.update"),I=(T,$)=>{var L;return(L=y(T,$))==null?void 0:L.id};for(const T of O){if(T.source===void 0&&T.target===void 0||G.has(T.id))continue;const $=f(T.id);if(!$)continue;const L=T.source!==void 0?f(T.source):$.source,D=T.target!==void 0?f(T.target):$.target;if(!L||!D||L.id===D.id||N.has(L.id)||N.has(D.id)||!x(L.type)||!w(D.type)||L.parent!==D.parent||S(D.incoming).some(ee=>ee.id!==$.id)||S(D.outgoing).some(ee=>ee.id!==$.id)||O.some(ee=>ee!==T&&(ee.target===D.id||ee.source===D.id))||D.x>=L.x+L.width)continue;const H=L.parent,j=g(L),Q=L.x+L.width+oe,te=L.y+L.height/2,pe=D.y+D.height/2,ae=I(j,L)===I(j,D),ne=new Set([D.id]),xe=[ae?te:pe,pe].find(ee=>!W(H,D,Q,ee,ne));if(xe===void 0)continue;if(n.moveElements([D],{x:Q-(D.x+D.width/2),y:xe-pe}),j){const ee=D.x+D.width+$d-(j.x+j.width);ee>0&&hl(n,j,j.width+ee)}const ve=ee=>({x:ee.x+ee.width/2,y:ee.y+ee.height/2});n.reconnect($,L,D,[ve(L),ve(D)]),Math.abs(ve(L).y-ve(D).y)>1&&n.layoutConnection($,{waypoints:[]}),_S.add(T.id)}}const Mr=40,GF=10,Pp=x=>{const w=j=>j.kind==="label-over-line"||j.kind==="label-over-shape"||j.kind==="label-on-shared-segment"?j.edge===x.id:j.kind==="annotation-over-label"||j.kind==="pool-name-over-label"?j.label===x.id:!1,S=()=>new Map(ht(We(r)).filter(j=>!w(j)).map(j=>[lt(j),j])),O=S(),I=j=>[...j].filter(([Q])=>!O.has(Q)).map(([,Q])=>Q),T=j=>I(j).length<=[...O.keys()].filter(Q=>!j.has(Q)).length,$=x.waypoints.map(j=>({x:j.x,y:j.y})),L=x.label,D=L&&{x:L.x,y:L.y};n.layoutConnection(x,{waypoints:[]});const H=S();if(!T(H)){if(I(H).every(j=>j.kind==="edge-crosses-shape"&&j.edge===x.id)){const j=We(r),Q=j.edges.find(ne=>ne.id===x.id),te=Ln(j),pe=Q?Ot(Q,te):[],ae=Q&&pe.length&&!pe.every(ne=>ne.type==="bpmn:TextAnnotation")?ol(Q,te,xs(x),j.edges):null;if(ae&&(n.updateWaypoints(x,ae),T(S())))return}n.updateWaypoints(x,$),L&&D&&(L.x!==D.x||L.y!==D.y)&&n.moveElements([L],{x:D.x-L.x,y:D.y-L.y})}},Qg=5,$i=10,ES=200,kc=new Set([...Y.map(x=>x.flow.id),...E.map(x=>x.flow.id),...Gt(e,"sequenceFlow.update").map(x=>x.id),...Gt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),VF=(x,w,S,O,I,T)=>{const $=new Set(x.map(ee=>ee.id)),L=Math.min(...x.map(ee=>ee.x))+w-$i,D=Math.max(...x.map(ee=>ee.x+ee.width))+w+ES+$i,H=Math.min(...x.map(ee=>ee.y+Math.min(0,...S)))-$i,j=Math.max(...x.map(ee=>ee.y+ee.height+Math.max(0,...S)))+$i,Q=r.getAll().filter(ee=>{if(ee.type!=="bpmn:SequenceFlow"&&ee.type!=="bpmn:MessageFlow")return!1;const ce=ee;return kc.has(ce.id)||!ce.waypoints||ce.waypoints.length<2||[ce.source,ce.target].some(le=>!le||$.has(le.id)||le.x>=O)?!1:ce.waypoints.some((le,se)=>{const Re=ce.waypoints[se+1];return!!Re&&Math.max(le.x,Re.x)>=L&&Math.min(le.x,Re.x)<=D&&Math.max(le.y,Re.y)>=H&&Math.min(le.y,Re.y)<=j})});if(!Q.length)return 0;const te=ee=>{const ce=new Map;for(const ye of x)for(const le of S){const se={id:ye.id,type:ye.type,x:ye.x+w+ee,y:ye.y+le,width:ye.width,height:ye.height};for(const Re of Q){let Me=1/0;for(let Ue=0;Ue+1<Re.waypoints.length;Ue++)Me=Math.min(Me,wo(Re.waypoints[Ue],Re.waypoints[Ue+1],se));const Ge=`${Re.id}|${ye.id}`;ce.set(Ge,Math.min(ce.get(Ge)??1/0,Me))}}return ce},pe=[...te(0)].filter(([,ee])=>ee<=Qg).map(([ee])=>ee);if(!pe.length)return 0;let ae=0;for(let ee=1;ee<=ES;ee++){const ce=te(ee);if([...ce.values()].every(ye=>ye>Qg)&&pe.every(ye=>(ce.get(ye)??1/0)>=$i)){ae=ee;break}}if(!ae)return 0;const ne=Math.min(...x.map(ee=>ee.x))+w+ae,xe=new Set(pe.map(ee=>ee.slice(0,ee.indexOf("|"))));return Q.some(ee=>ee.type==="bpmn:SequenceFlow"&&xe.has(ee.id)&&ee.waypoints.some((ce,ye)=>{const le=ee.waypoints[ye+1];if(!le||Math.min(ce.y,le.y)>T||Math.max(ce.y,le.y)<T||ce.y===le.y)return!1;const se=ce.x+(T-ce.y)*(le.x-ce.x)/(le.y-ce.y);return se>I&&se<ne}))?0:ae},Fo=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.target;if(L.flow.source!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},WF=(x,w=()=>!0)=>{const S=f(x);if(!S)return[];const O=[S],I=new Set([x]);for(let T=0;T<O.length;T++){const $=O[T].id;for(const L of Y){const D=L.flow.source;if(L.flow.target!==$||I.has(D)||!N.has(D))continue;I.add(D);const H=f(D);H&&w(H)&&O.push(H)}}return O},Fi=30,wi=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",os=(x,w)=>hl(n,x,w),jo=(x,w,S=!1)=>{const O=new Set(x.flatMap(D=>D.subtree.map(H=>H.id)));for(const D of x){const H=(D.pool.children??[]).filter(wi).filter(Q=>!O.has(Q.id));if(D.subtree.some(Q=>H.some(te=>Q.x+w<te.x+te.width+Fi&&Q.x+w+Q.width+Fi>te.x&&Q.y<te.y+te.height&&Q.y+Q.height>te.y)))return null}const I=x.map(D=>D.pool.width),T=S?r.filter(D=>Array.isArray(D.waypoints)).map(D=>({c:D,wps:D.waypoints.map(H=>({x:H.x,y:H.y}))})):[],$=r.filter(D=>D.type==="label").map(D=>({label:D,x:D.x,y:D.y}));n.moveElements(x.flatMap(D=>D.subtree),{x:w,y:0});const L=x.map(D=>{const j=Math.max(...D.subtree.map(Q=>Q.x+Q.width))+$d-(D.pool.x+D.pool.width);return j>0&&os(D.pool,D.pool.width+j),j});return()=>{n.moveElements(x.flatMap(D=>D.subtree),{x:-w,y:0}),x.forEach((D,H)=>{L[H]>0&&os(D.pool,I[H])});for(const{c:D,wps:H}of T){const j=D.waypoints??[];j.length===H.length&&j.every((te,pe)=>Math.abs(te.x-H[pe].x)<=.5&&Math.abs(te.y-H[pe].y)<=.5)||n.updateWaypoints(D,H.map(te=>({x:te.x,y:te.y})))}for(let D=0;D<3;D++){let H=0;for(const j of $){const Q=j.x-j.label.x,te=j.y-j.label.y;Math.abs(Q)<=.5&&Math.abs(te)<=.5||(n.moveElements([j.label],{x:Q,y:te}),H++)}if(!H)break}}},em=x=>{var I,T;const w=new Map,S=new Map;for(const $ of r.getAll()){if($.type!=="bpmn:Participant")continue;const L=$;(L.children??[]).length||(w.set(L.id,L),S.set(L.id,[]))}for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$,D=(I=L.source)==null?void 0:I.id,H=(T=L.target)==null?void 0:T.id;D&&H&&S.has(D)&&S.get(D).push(H),D&&H&&S.has(H)&&S.get(H).push(D)}const O=[];for(const[$,L]of S)L.length&&L.every(D=>x.has(D))&&O.push(w.get($));return O},SS=(x,w)=>{if(!x.length)return null;const S=new Set(x.map(j=>j.id)),O=r.getAll().filter(j=>j.type==="bpmn:Participant"&&!S.has(j.id)),I=Math.min(...O.filter(j=>(j.children??[]).length>0).map(j=>j.x)),T=new Set(x.filter(j=>Math.abs(j.x-I)<=2).map(j=>j.id));if(x.some(j=>{const Q=T.has(j.id)?j.x:j.x+w,te=T.has(j.id)?j.width+w:j.width;return O.some(pe=>Q<pe.x+pe.width+Fi&&Q+te+Fi>pe.x&&j.y<pe.y+pe.height&&j.y+j.height>pe.y)}))return null;const L=r.filter(j=>j.type==="label").map(j=>({label:j,x:j.x,y:j.y})),D=x.filter(j=>!T.has(j.id)),H=x.filter(j=>T.has(j.id)).map(j=>({pool:j,was:{x:j.x,y:j.y,width:j.width,height:j.height}}));D.length&&n.moveElements(D,{x:w,y:0});for(const{pool:j,was:Q}of H)n.resizeShape(j,{...Q,width:Q.width+w});return()=>{for(const{pool:j,was:Q}of H)n.resizeShape(j,Q);D.length&&n.moveElements(D,{x:-w,y:0});for(let j=0;j<3;j++){let Q=0;for(const te of L){const pe=te.x-te.label.x,ae=te.y-te.label.y;Math.abs(pe)<=.5&&Math.abs(ae)<=.5||(n.moveElements([te.label],{x:pe,y:ae}),Q++)}if(!Q)break}}},RS=(x,w,S)=>{const O=S.x+S.width/2,I=w.y>S.y,T=I?S.y+S.height:S.y,$=I?w.y:w.y+w.height,L=x.source===w?[{x:O,y:$},{x:O,y:T}]:[{x:O,y:T},{x:O,y:$}],D=We(r),H={...D.edges.find(j=>j.id===x.id),waypoints:L};return Ot(H,Ln(D)).length?!1:(n.updateWaypoints(x,L),!0)},UF=()=>{const x=r.filter($=>$.type==="bpmn:Participant"),w=Math.min(...x.filter($=>($.children??[]).length>0).map($=>$.x)),S=$=>h.some(L=>L.participant.id===$.id),O=$=>!!$&&$.type==="bpmn:Participant"&&!($.children??[]).length&&Math.abs($.x-w)<=2&&!S($),I=$=>!!$&&$.type==="bpmn:Participant"&&($.children??[]).length>0&&!S($),T=new Set;for(const $ of r.getAll()){if($.type!=="bpmn:MessageFlow")continue;const L=$;if((L.waypoints??[]).length!==2)continue;const D=[L.source,L.target].find(Q=>O(Q)||I(Q)),H=D===L.source?L.target:L.source;if(!D||!H||H.type==="bpmn:Participant")continue;const j=H.x+H.width/2;I(D)&&(j<D.x||j>D.x+D.width)||T.add(L.id)}return T},qF=x=>{var S;const w=new Map;for(const O of x){const I=r.get(O);if(!I||(I.waypoints??[]).length===2)continue;const T=((S=I.source)==null?void 0:S.type)==="bpmn:Participant"?I.source:I.target,$=T===I.source?I.target:I.source;if($.x+$.width/2<=T.x+T.width)continue;const L=w.get(T.id)??{pool:T,msgs:[]};L.msgs.push({conn:I,other:$}),w.set(T.id,L)}for(const{pool:O,msgs:I}of w.values()){const T=Math.max(...I.map(({other:ae})=>ae.x+ae.width/2))+Nd;if(r.getAll().some(ae=>{if(ae.type!=="bpmn:Participant"||ae.id===O.id)return!1;const ne=ae;return O.x<ne.x+ne.width+Fi&&T+Fi>ne.x&&O.y<ne.y+ne.height&&O.y+O.height>ne.y}))continue;const L={x:O.x,y:O.y,width:O.width,height:O.height},D=[...O.incoming??[],...O.outgoing??[]],H=D.map(ae=>({c:ae,wps:(ae.waypoints??[]).map(ne=>({x:ne.x,y:ne.y}))})),j=D.flatMap(ae=>{const ne=ae.label;return ne?[{label:ne,x:ne.x,y:ne.y}]:[]}),Q=Cr();os(O,T-O.x);const te=I.filter(({conn:ae,other:ne})=>RS(ae,O,ne)).length,pe=Cr();if(!(te>0&&pe.messages>Q.messages&&pe.lines>=Q.lines)){os(O,L.width);for(const{c:ae,wps:ne}of H){const xe=ae.waypoints??[];xe.length===ne.length&&xe.every((ee,ce)=>Math.abs(ee.x-ne[ce].x)<=.5&&Math.abs(ee.y-ne[ce].y)<=.5)||n.updateWaypoints(ae,ne.map(ee=>({x:ee.x,y:ee.y})))}for(let ae=0;ae<3;ae++){let ne=0;for(const xe of j){const ve=xe.x-xe.label.x,ee=xe.y-xe.label.y;Math.abs(ve)<=.5&&Math.abs(ee)<=.5||(n.moveElements([xe.label],{x:ve,y:ee}),ne++)}if(!ne)break}}}},MS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:DataInputAssociation"&&w.type!=="bpmn:DataOutputAssociation")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},CS=()=>{let x=0;for(const w of r.getAll()){if(w.type!=="bpmn:Association")continue;const S=w.waypoints??[];for(let O=1;O<S.length;O++)x+=Math.hypot(S[O].x-S[O-1].x,S[O].y-S[O-1].y)}return x},YF=x=>{const w=[];for(const S of r.getAll()){if(S.type!=="bpmn:TextAnnotation")continue;const O=S;if(x.has(O.id))continue;const T=[...O.incoming??[],...O.outgoing??[]].filter(D=>D.type==="bpmn:Association").map(D=>D.source===O?D.target:D.source);if(!T.length||T.some(D=>D===void 0))continue;const $=D=>{if(!("waypoints"in D&&D.waypoints))return[D.id];const H=D,j=[H.source,H.target];return j.some(Q=>!Q)?[]:j.map(Q=>Q.id)},L=T.flatMap(D=>$(D));L.length&&L.every(D=>x.has(D))&&w.push(O)}return w},AS=()=>ht(We(r)).filter(x=>x.kind==="edge-crosses-shape").length,TS=x=>{const w=(x.children??[]).filter(wi);let S=0;for(let O=0;O<w.length;O++)for(let I=O+1;I<w.length;I++){const T=w[O],$=w[I];T.x<$.x+$.width&&T.x+T.width>$.x&&T.y<$.y+$.height&&T.y+T.height>$.y&&S++}return S},Cr=()=>{const x=We(r),w=S=>S.length>=2&&(S.every(O=>Math.abs(O.x-S[0].x)<.01)||S.every(O=>Math.abs(O.y-S[0].y)<.01));return{messages:x.edges.filter(S=>S.type==="bpmn:MessageFlow"&&S.waypoints.length===2).length,lines:x.edges.filter(S=>w(S.waypoints)).length}},PS=x=>{const w=new Map;for(const O of r.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const I=O;if(!I.waypoints||I.waypoints.length!==2)continue;const T=I.source,$=I.target;if(!T||!$)continue;const L=x.has(T.id);if(L===x.has($.id))continue;const D=L?$:T,H=g(D);if(!H||x.has(D.id))continue;const j=w.get(H.id);j?D.x<j.minX&&(j.minX=D.x):w.set(H.id,{pool:H,minX:D.x})}const S=[];for(const{pool:O,minX:I}of w.values()){const T=(O.children??[]).filter($=>wi($)&&!x.has($.id)&&$.x>=I);T.length&&S.push({subtree:T,pool:O})}return S},KF=(x,w,S)=>{const O=new Map(w.map($=>[$.pool.id,{subtree:[...$.subtree],pool:$.pool}])),I=new Set(x);for(const $ of w)for(const L of $.subtree)I.add(L.id);let T=!1;for(;;){let $=0;for(const L of PS(I)){if(L.pool===S)continue;const D=O.get(L.pool.id);D?D.subtree.push(...L.subtree):O.set(L.pool.id,{subtree:[...L.subtree],pool:L.pool});for(const H of L.subtree)I.add(H.id);$+=L.subtree.length}if(!$)break;T=!0}return T?[...O.values()]:null},XF=(x,w)=>{const S=new Map;for(const I of r.getAll()){if(I.type!=="bpmn:DataInputAssociation"&&I.type!=="bpmn:DataOutputAssociation")continue;const T=I,$=T.waypoints;if(!$||$.length<2||!$.every(pe=>Math.abs(pe.x-$[0].x)<1))continue;const L=T.source,D=T.target;if(!L||!D)continue;const H=x.has(L.id);if(H===x.has(D.id))continue;const j=H?D:L,Q=g(j);if(!Q||Q===w||Q===g(H?L:D))continue;const te=S.get(Q.id);te?j.x<te.minX&&(te.minX=j.x):S.set(Q.id,{pool:Q,minX:j.x})}const O=[];for(const{pool:I,minX:T}of S.values()){const $=(I.children??[]).filter(L=>wi(L)&&!x.has(L.id)&&L.x>=T);$.length&&O.push({subtree:$,pool:I})}return O},kS=x=>{const w=We(r),S=w.shapes.filter(I=>x.has(I.id)),O=new Set;for(const I of w.edges)if(!(I.type!=="bpmn:SequenceFlow"&&I.type!=="bpmn:MessageFlow"))for(const T of Ot(I,S))O.add(`${I.id}|${T.id}`);return O},tm=new Map,ZF=Gt(e,"sequenceFlow.update").flatMap(x=>{if(x.target!==void 0)return[{id:x.id,target:x.target,source:x.source}];const w=G.get(x.id);return w?[{id:x.id,target:w.flow.target,source:w.flow.source}]:[]});for(const x of ZF){if(x.target===void 0)continue;const w=N.get(x.target);if(!w)continue;const S=f(x.target),O=f(x.id);if(!S||!O)continue;const I=x.source!==void 0?f(x.source):O.source,T=O.target;if(!I||!T||T.id===S.id)continue;const $=wS.get(O.id)??{waypoints:O.waypoints,label:O.label},L=$.waypoints&&$.waypoints.length>=3&&Math.abs($.waypoints[0].x-$.waypoints[1].x)<1&&Math.abs($.waypoints[0].y-$.waypoints[1].y)>1?{x:$.waypoints[0].x,y:$.waypoints[0].y}:void 0,D=L?$.waypoints[1].y:void 0,H=L&&$.label?{x:$.label.x,y:$.label.y}:void 0,j=H&&$.label&&Math.abs(H.y+$.label.height/2-D)<=z/5&&H.x+$.label.width>L.x?H.x+$.label.width+6:void 0,Q=(I.outgoing??[]).filter(ke=>ke.type==="bpmn:SequenceFlow"&&ke.id!==O.id&&ke.target&&!kc.has(ke.id)),te=new Set(Q.map(ke=>ke.target.id)),pe=ke=>{const Tt={type:"bpmn:Task",x:ke.x+2,y:ke.y+2,width:ke.width-4,height:ke.height-4};return Q.find(Et=>(Et.waypoints??[]).some((en,je)=>!!Et.waypoints[je+1]&&wo(en,Et.waypoints[je+1],Tt)===0))},ae=Fo(x.target),ne=new Set(ae.map(ke=>ke.id)),xe=Yg.has(x.target)?{autoResize:!1}:void 0,ve=Math.min(...ae.map(ke=>ke.x)),ee=Math.max(...ae.map(ke=>ke.x+ke.width)),ce=I.x+I.width,ye=T.x+T.width<=I.x,le=(()=>{if(!ye)return;const ke=g(S),Tt=((ke==null?void 0:ke.children)??[]).filter(ze=>wi(ze)&&!ne.has(ze.id)&&ze.type!=="bpmn:Group"&&ze.type!=="bpmn:Participant"),Et=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],en=r.getAll().filter(ze=>{if(!Et.includes(ze.type))return!1;const jt=ze;return jt.id===O.id||kc.has(jt.id)||!jt.waypoints||jt.waypoints.length<2?!1:![jt.source,jt.target].some(Dt=>!Dt||ne.has(Dt.id))}),je=(ze,jt)=>ae.every(Dt=>{var la;const Rt={id:Dt.id,type:Dt.type,x:Dt.x+ze,y:Dt.y+jt,width:Dt.width,height:Dt.height};return ke&&(Rt.x<ke.x||Rt.x+Rt.width>ke.x+ke.width||Rt.y<ke.y||Rt.y+Rt.height>ke.y+ke.height)||!Cp((la=N.get(Dt.id))==null?void 0:la.node.lane,Dt,Dt.y+jt+Dt.height/2)||Tt.some(Jn=>Rt.x<Jn.x+Jn.width+$i&&Rt.x+Rt.width+$i>Jn.x&&Rt.y<Jn.y+Jn.height+$i&&Rt.y+Rt.height+$i>Jn.y)?!1:en.every(Jn=>{for(let vo=0;vo+1<Jn.waypoints.length;vo++)if(wo(Jn.waypoints[vo],Jn.waypoints[vo+1],Rt)<$i)return!1;return!0})}),Je=I.x+I.width/2,bt=I.y+I.height/2,rt=$.waypoints??[],kt=rt.length>=2&&Math.abs(rt[0].y-rt[1].y)<1&&rt[1].x<rt[0].x;return[...D!==void 0?[{cx:Je,cy:D}]:[],...kt?[{cx:I.x-Mr-S.width/2,cy:rt[0].y}]:[],{cx:Je,cy:bt+z},{cx:Je,cy:bt-z}].find(ze=>je(ze.cx-(S.x+S.width/2),ze.cy-(S.y+S.height/2)))})(),se=ye&&!le?ce:T.x,Re=(()=>{var bt;if(L||ye)return 0;const ke=$.label,Tt=((bt=O.businessObject)==null?void 0:bt.name)??"";if(!ke||ke.width==null||!Tt.trim())return 0;const Et=ce+Mr,en=I.y+I.height/2-S.height/2;if(Math.min(ke.y+ke.height,en+S.height)-Math.max(ke.y,en)<3||ke.x+ke.width-Et<3)return 0;const Je=ke.x+ke.width+GF-Et;return Je<=S.width?Je:0})();Re>0&&u.add(O.id);const Me=S.y+S.height/2,Ge=VF(ae,ce+Mr+Re-ve,[0,I.y+I.height/2-Me,T.y+T.height/2-Me],se,ce,I.y+I.height/2),Ue=ce+Mr+Re+Ge,Ie=(()=>{if(j===void 0)return 0;const ke=ce+Mr,Tt=I.y+I.height/2-S.height/2,Et={x:ke,y:Tt,width:ee-ve,height:S.height},en=g(I);return((en==null?void 0:en.children)??[]).some(Je=>wi(Je)&&!ne.has(Je.id)&&Je.id!==I.id&&Je.id!==T.id&&Je.type!=="bpmn:Group"&&Je.type!=="bpmn:Participant"&&Je.x<Et.x+Et.width&&Je.x+Je.width>Et.x&&Je.y<Et.y+Et.height&&Je.y+Je.height>Et.y)||pe(Et)?Math.max(0,j-ke):0})(),Oe=le?0:ee-ve+Mr*2+Ge+Ie+Re-(ye?0:T.x-ce);let me=[];if(Oe>0){const ke=g(S),Tt=(ke==null?void 0:ke.children)??[],Et=rt=>rt.type==="bpmn:Lane";me=(()=>{const rt=new Set;for(const Xe of Tt)wi(Xe)&&!ne.has(Xe.id)&&Xe.id!==I.id&&Xe.x>=se&&rt.add(Xe.id);const kt=[];for(const Xe of Tt){if(Xe.type!=="bpmn:DataStoreReference"&&Xe.type!=="bpmn:DataObjectReference")continue;const ze=Xe,Dt=[...ze.incoming??[],...ze.outgoing??[]].filter(Rt=>Rt.type==="bpmn:DataInputAssociation"||Rt.type==="bpmn:DataOutputAssociation").map(Rt=>Rt.source===ze?Rt.target:Rt.source);Dt.length&&Dt.every(Rt=>Rt!==void 0&&rt.has(Rt.id))&&kt.push(ze)}return kt})();const je=Tt.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&!Et(rt)&&rt.type!=="label"&&!ne.has(rt.id)&&rt.id!==I.id&&rt.x>=se),Je=je.flatMap(rt=>rt.labels??[]),bt=ke?[ke,...Tt.filter(rt=>Et(rt))]:[];if(je.length){const rt=new Set(je.map(st=>st.id)),kt=PS(rt),Xe=kt.length?KF(rt,kt,ke):null,ze=st=>{const Mt=new Set(rt);for(const Ht of st)for(const Ho of Ht.subtree)Mt.add(Ho.id);return YF(Mt)},jt=ze(kt),Dt=Xe?ze(Xe):jt,Rt=em(rt),la=new Set(rt);for(const st of kt)for(const Mt of st.subtree)la.add(Mt.id);const Jn=kt.length?em(la):Rt,vo=(()=>{if(!Xe)return[];const st=new Set(rt);for(const Mt of Xe)for(const Ht of Mt.subtree)st.add(Ht.id);return em(st)})(),cs=Xe??kt,ua=(()=>{const st=new Set(rt);for(const Mt of cs)for(const Ht of Mt.subtree)st.add(Ht.id);return XF(st,ke)})(),pm=ua.length?ze([...cs,...ua]):jt,Ki=new Set([...je,...bt].map(st=>st.id)),St=Tt.filter(st=>{const Mt=st.labelTarget;return st.type==="label"&&!!Mt&&"waypoints"in Mt&&!!Mt.source&&!!Mt.target&&Ki.has(Mt.source.id)&&Ki.has(Mt.target.id)}),Cn=UF();n.createSpace([...je,...Je,...St],bt,{x:Oe,y:0},"e",se-1);const tn=(st,Mt,Ht)=>{const Ho=Cr(),Ip=Ht?kS(Ht):null,Bp=jo(st,Oe,!!Ht);if(!Bp)return!1;const Ic=Mt.length?SS(Mt,Oe):null,Np=Cr(),nn=!!Ht&&!!Ip&&[...kS(Ht)].some(da=>!Ip.has(da));return Np.messages>Ho.messages&&Np.lines>=Ho.lines&&!nn?!0:(Ic==null||Ic(),Bp(),!1)},yi=ua.length>0&&tn([...cs,...ua],Xe?vo:Jn,new Set(ua.flatMap(st=>st.subtree.map(Mt=>Mt.id)))),pa=!yi&&Xe?tn(Xe,vo):!1;let xo=yi||pa;!xo&&kt.length&&(xo=tn(kt,Jn));const ls=yi?pm:pa?Dt:jt;if(!xo){for(const st of kt){const Mt=Cr(),Ht=jo([st],Oe);if(!Ht)continue;const Ho=Cr();(Ho.messages<=Mt.messages||Ho.lines<Mt.lines)&&Ht()}if(Rt.length){const st=Cr(),Mt=SS(Rt,Oe);if(Mt){const Ht=Cr();(Ht.messages<=st.messages||Ht.lines<st.lines)&&Mt()}}}if(qF(Cn),ls.length){const st=()=>new Set(ht(We(r)).map(Ht=>lt(Ht))),Mt=Ht=>{const Ho=CS(),Ip=st(),Bp=Ht.map(nn=>({a:nn,x:nn.x,y:nn.y})),Ic=r.filter(nn=>nn.type==="label").map(nn=>({label:nn,x:nn.x,y:nn.y}));n.moveElements(Ht,{x:Oe,y:0});const Np=[...st()].filter(nn=>!Ip.has(nn));if(CS()<Ho&&Np.length===0)return!0;for(const{a:nn,x:da,y:Bc}of Bp)(nn.x!==da||nn.y!==Bc)&&n.moveElements([nn],{x:da-nn.x,y:Bc-nn.y});for(const nn of Ic){const da=nn.x-nn.label.x,Bc=nn.y-nn.label.y;(da!==0||Bc!==0)&&n.moveElements([nn.label],{x:da,y:Bc})}return!1};if(!Mt(ls)&&ls.length>1)for(const Ht of ls)Mt([Ht])}}}const he=w.node.lane!==void 0?f(w.node.lane):w.node.participant!==void 0?f(w.node.participant):void 0,ge=ke=>{if(!he)return!0;const Tt=ke.y+ke.height/2;return Tt>=he.y&&Tt<=he.y+he.height},Fe=!ge(I)&&ge(T),Ke=ke=>ke.y+ke.height/2,it=()=>{const ke=I.x+I.width,Tt=T.x,Et=Ke(T)-S.height/2,en=Ke(T)+S.height/2;return!r.getAll().some(je=>wi(je)&&je.type!=="bpmn:Participant"&&je.type!=="bpmn:Group"&&je.type!=="bpmn:TextAnnotation"&&je.id!==I.id&&je.id!==T.id&&je.id!==S.id&&je.x<Tt&&je.x+je.width>ke&&je.y<en&&je.y+je.height>Et)},Be=!Fe&&w.band!==void 0&&ge(T)&&!qn(w.node.lane,w.node.participant,w.band,Ke(I))&&qn(w.node.lane,w.node.participant,w.band,Ke(T))&&T.x>=I.x+I.width&&it(),Ve=Fe||Be?T:I,Ft=Ve.y+Ve.height/2,cn=Ft-(S.y+S.height/2),Yt=w.band!==void 0,Kt=Yt?[S]:ae,mo=(w.band===void 0||qn(w.node.lane,w.node.participant,w.band,Ft))&&At(x.target)&&Kt.every(ke=>{var Tt;return Cp((Tt=N.get(ke.id))==null?void 0:Tt.node.lane,ke,ke.y+ke.height/2+cn)}),Lp=ke=>Math.abs(ke.y+ke.height/2-(S.y+S.height/2))<=z/2;if(mo&&Yt){const ke=Math.abs(cn)<=z/2?ae.filter(je=>je.id!==S.id&&Lp(je)):[],Tt=S.y+S.height/2,en=w.band!==void 0&&!qn(w.node.lane,w.node.participant,w.band,Tt)?ae.filter(je=>{var Je,bt;return je.id!==S.id&&!ke.includes(je)&&((Je=N.get(je.id))==null?void 0:Je.band)===w.band&&((bt=N.get(je.id))==null?void 0:bt.node.lane)===w.node.lane&&(Math.abs(je.y+je.height/2-Tt)<=z/2||qn(w.node.lane,w.node.participant,w.band,je.y+je.height/2))}).map(je=>({t:je,dy:Ft-(je.y+je.height/2)})).filter(({dy:je})=>je!==0):[];if(n.moveElements(ae,{x:Ue-ve,y:0},void 0,xe),n.moveElements([S],{x:0,y:cn},void 0,xe),ke.length){const je=()=>new Set(ht(We(r)).map(ze=>lt(ze))),Je=je(),bt=r.filter(ze=>ze.type==="label").map(ze=>({label:ze,x:ze.x,y:ze.y}));n.moveElements(ke,{x:0,y:cn});const rt=je(),kt=[...rt].filter(ze=>!Je.has(ze)).length,Xe=[...Je].filter(ze=>!rt.has(ze)).length;if(kt>Xe){n.moveElements(ke,{x:0,y:-cn});for(const ze of bt){const jt=ze.x-ze.label.x,Dt=ze.y-ze.label.y;(jt!==0||Dt!==0)&&n.moveElements([ze.label],{x:jt,y:Dt})}}}if(en.length){const je=new Set(ae.map(Je=>Je.id));for(const{t:Je,dy:bt}of en)W(Je.parent,Je,Je.x+Je.width/2,Je.y+Je.height/2+bt,je)||n.moveElements([Je],{x:0,y:bt})}}else n.moveElements(ae,{x:Ue-ve,y:mo?cn:0},void 0,xe);const Yi=g(S);if(!mo&&w.node.lane===void 0&&w.band!==void 0&&Yi){const ke=Yi.y+V+ii(`pool:${w.node.participant??""}`,w.band)*z,Tt=ke-(S.y+S.height/2);Tt!==0&&!W(Yi,S,S.x+S.width/2,ke,ne)&&n.moveElements([S],{x:0,y:Tt},void 0,xe)}if(le)n.moveElements(ae,{x:le.cx-(S.x+S.width/2),y:le.cy-(S.y+S.height/2)},void 0,xe);else if(Yi){const ke=(Yi.children??[]).filter(je=>wi(je)&&!ne.has(je.id)&&je.type!=="bpmn:Group"&&je.type!=="bpmn:Participant"),Tt=(je,Je,bt,rt,kt)=>je.x+Je<kt.x+kt.width+rt&&je.x+Je+je.width+rt>kt.x&&je.y+bt<kt.y+kt.height+rt&&je.y+bt+je.height+rt>kt.y,Et=ke.find(je=>Tt(S,0,0,0,je)),en=Et?void 0:pe(S);if(Et||en){const je=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Je=r.getAll().filter(St=>{if(!je.includes(St.type))return!1;const Cn=St;return kc.has(Cn.id)||!Cn.waypoints||Cn.waypoints.length<2?!1:![Cn.source,Cn.target].some(tn=>!tn||ne.has(tn.id))}),bt=(St,Cn,tn)=>{var yi;return Cp((yi=N.get(St.id))==null?void 0:yi.node.lane,St,St.y+tn+St.height/2)&&St.x+Cn>=Yi.x&&St.x+Cn+St.width<=Yi.x+Yi.width&&St.y+tn>=Yi.y&&St.y+tn+St.height<=Yi.y+Yi.height},rt=(St,Cn)=>ae.every(tn=>bt(tn,St,Cn)&&!ke.some(yi=>Tt(tn,St,Cn,$i,yi))&&Je.every(yi=>{const pa={id:tn.id,type:tn.type,x:tn.x+St,y:tn.y+Cn,width:tn.width,height:tn.height};for(let xo=0;xo+1<yi.waypoints.length;xo++)if(wo(yi.waypoints[xo],yi.waypoints[xo+1],pa)<$i)return!1;return!0})),kt=S.y+S.height/2,Xe=[D,T.y+T.height/2].filter(St=>St!==void 0&&Math.abs(St-kt)>=1),ze=Et&&te.has(Et.id)?Et:en==null?void 0:en.target,jt=ze?ze.x-S.x:0,Dt=Math.max(...ae.map(St=>St.x+St.width)),Rt=[...jt!==0?[jt]:[],...Ge!==0?[-Ge]:[],0],la=j===void 0?[]:Rt.map(St=>Math.max(St,j-S.x)),Jn=St=>Dt+St+Mr<=T.x,vo=[...new Set([...la,...Rt])].filter(Jn),cs=Et&&te.has(Et.id)?[Et.x+Et.width+Mr-S.x]:[],ua=j===void 0?[]:cs.map(St=>Math.max(St,j-S.x)),pm=[...new Set([...ua,...cs])].filter(St=>Jn(St)&&!vo.includes(St));let Ki;for(const St of[vo,pm]){for(const Cn of Xe){for(const tn of St)if(rt(tn,Cn-kt)){Ki={dx:tn,dy:Cn-kt};break}if(Ki)break}if(Ki)break}if(Ki){const St=st=>{const Mt=st;return[Mt.edge,Mt.other,...Array.isArray(Mt.edges)?Mt.edges:[]].some(Ht=>typeof Ht=="string"&&kc.has(Ht))},Cn=()=>new Set(ht(We(r)).filter(st=>!St(st)).map(st=>lt(st))),tn=Cn(),yi=r.filter(st=>st.type==="label").map(st=>({label:st,x:st.x,y:st.y}));n.moveElements(ae,{x:Ki.dx,y:Ki.dy},void 0,xe);const pa=Cn(),xo=[...pa].filter(st=>!tn.has(st)).length,ls=[...tn].filter(st=>!pa.has(st)).length;if(xo>ls){n.moveElements(ae,{x:-Ki.dx,y:-Ki.dy},void 0,xe);for(const st of yi){const Mt=st.x-st.label.x,Ht=st.y-st.label.y;(Mt!==0||Ht!==0)&&n.moveElements([st.label],{x:Mt,y:Ht})}}else L&&tm.set(O.id,{exit:L,channelY:D,label:H})}}}{const ke=new Set(ae.map(Je=>Je.id)),Tt=new Set(Y.map(Je=>Je.flow.id)),Et=20,en=Je=>{const bt=Je.source,rt=Je.target,kt=Math.min(bt.x,rt.x)-Et,Xe=Math.max(bt.x+bt.width,rt.x+rt.width)+Et,ze=Math.min(bt.y,rt.y)-Et,jt=Math.max(bt.y+bt.height,rt.y+rt.height)+Et;return Je.waypoints.some(Dt=>Dt.x<kt||Dt.x>Xe||Dt.y<ze||Dt.y>jt)},je=new Map;for(const Je of ae)for(const bt of[...Je.incoming??[],...Je.outgoing??[]])(G.has(bt.id)||bt.id!==x.id&&Tt.has(bt.id))&&!(ke.has(bt.source.id)&&ke.has(bt.target.id))&&je.set(bt.id,bt);for(const Je of je.values())en(Je)&&Pp(Je)}const yo=me.length?g(me[0]):void 0;if(yo){const ke={assoc:MS(),overlaps:TS(yo),crosses:AS()},Tt=me.map(Xe=>({st:Xe,x:Xe.x})),Et=r.filter(Xe=>Xe.type==="label").map(Xe=>({label:Xe,x:Xe.x,y:Xe.y})),en=Math.min(...me.flatMap(Xe=>[...Xe.incoming??[],...Xe.outgoing??[]].filter(ze=>ze.type==="bpmn:DataInputAssociation"||ze.type==="bpmn:DataOutputAssociation").map(ze=>(ze.source===Xe?ze.target:ze.source).x))),je=new Set(me.map(Xe=>Xe.id)),Je=(yo.children??[]).filter(wi).filter(Xe=>!je.has(Xe.id));let bt=en;for(const Xe of[...me].sort((ze,jt)=>ze.x-jt.x)){let ze=bt;for(let jt=0;jt<100;jt++){const Dt=Je.find(Rt=>ze<Rt.x+Rt.width+Fi&&ze+Xe.width+Fi>Rt.x&&Xe.y<Rt.y+Rt.height&&Xe.y+Xe.height>Rt.y);if(!Dt)break;ze=Dt.x+Dt.width+Fi}ze!==Xe.x&&n.moveElements([Xe],{x:ze-Xe.x,y:0}),bt=ze+Xe.width+Fi}const rt=bt+150-(yo.x+yo.width);rt>0&&os(yo,yo.width+rt);const kt={assoc:MS(),overlaps:TS(yo),crosses:AS()};if(kt.assoc>=ke.assoc||kt.overlaps>ke.overlaps||kt.crosses>ke.crosses){for(const{st:Xe,x:ze}of Tt)Xe.x!==ze&&n.moveElements([Xe],{x:ze-Xe.x,y:0});rt>0&&os(yo,yo.width-rt);for(const Xe of Et){const ze=Xe.x-Xe.label.x,jt=Xe.y-Xe.label.y;(ze!==0||jt!==0)&&n.moveElements([Xe.label],{x:ze,y:jt})}}}}for(const[x,w]of Yg){const S=f(x);if(!S)continue;const O=w.container,I=Math.abs(S.y+S.height/2-O.y-w.relCy)>=.5,T=S.label,$=Math.min(S.y,T&&!T.hidden?T.y:S.y),L=Math.max(S.y+S.height,T&&!T.hidden?T.y+T.height:0);if(I&&$>=O.y&&L<=O.y+O.height)continue;const D=S.y;w.grow(),S.y!==D&&n.moveElements([S],{x:0,y:D-S.y},void 0,{autoResize:!1})}const OS=(x,w)=>{const S=w.target===x,O=m(w.source),I=m(w.target),T=S?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,I,w.id?{type:T,businessObject:i.create(T,{id:w.id})}:{type:T})},DS=x=>{for(const w of h){if(!w.participant.blackBox)continue;const S=f(w.participant.id);if(!S)continue;const O=[];for(const T of E){const $=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,L=$?f($):void 0;L&&typeof L.x=="number"&&L.type!=="bpmn:Participant"&&O.push(L)}if(!O.length)continue;if(!x&&w.order===void 0){const T=(()=>{var L;const $=new Map;for(const D of O){const H=g(D);if(!H)continue;const j=$.get(H.id);j?j.n+=1:$.set(H.id,{shape:H,n:1})}return(L=[...$.values()].sort((D,H)=>H.n-D.n)[0])==null?void 0:L.shape})();if(T){const $=H=>H.reduce((j,Q)=>j+Q,0)/H.length,L=$(O.map(H=>H.y+H.height/2))<T.y+T.height/2,D=r.filter(H=>H.type==="bpmn:Participant"&&H.id!==w.participant.id&&H.id!==T.id).filter(H=>L?H.y+H.height<=T.y+5:H.y>=T.y+T.height-5);if(D.length){const H=[...D.reduce((ye,le)=>ye.set(le.y,(ye.get(le.y)??0)+1),new Map)].sort((ye,le)=>le[1]-ye[1]||(L?le[0]-ye[0]:ye[0]-le[0]))[0][0],j=Math.min(S.width,lT),Q=uT,te=O.map(ye=>ye.x+ye.width/2),pe=Math.round($(te)-j/2),ae=Math.max(...te)+Nd,ne=ye=>({x:ye,width:Math.max(j,ae-ye)}),xe=D.filter(ye=>Math.min(ye.y+ye.height,H+Q)-Math.max(ye.y,H)>0),ve=ye=>{const le=ne(ye);return xe.some(se=>se.x<le.x+le.width&&le.x<se.x+se.width)},ee=ye=>{const le=ne(ye);return te.filter(se=>se>=le.x+10&&se<=le.x+le.width-10).length},ce=(()=>{if(!ve(pe))return pe;const ye=ee(pe);return xe.flatMap(le=>[le.x+le.width+hv,le.x-hv-j]).map(le=>Math.round(le)).filter(le=>!ve(le)&&ee(le)>=ye).sort((le,se)=>Math.abs(le-pe)-Math.abs(se-pe))[0]??pe})();if(ce!==S.x||H!==S.y||j!==S.width||Q!==S.height){const ye=()=>new Set(ht(We(r)).map(Ue=>lt(Ue))),le=ye(),se={x:S.x,y:S.y,width:S.width,height:S.height};n.resizeShape(S,{x:ce,y:H,width:j,height:Q});const Re=ye(),Me=[...Re].filter(Ue=>!le.has(Ue)).length,Ge=[...le].filter(Ue=>!Re.has(Ue)).length;Me>Ge&&n.resizeShape(S,se)}}}}const I=Math.max(...O.map(T=>T.x+T.width/2))+Nd;if(I>S.x+S.width&&n.resizeShape(S,{x:S.x,y:S.y,width:I-S.x,height:S.height}),!!x)for(const T of E){const $=f(T.flow.id),L=T.flow.source===w.participant.id?T.flow.target:T.flow.target===w.participant.id?T.flow.source:void 0,D=L?f(L):void 0;if(!$||!D||D.type==="bpmn:Participant")continue;const H=D.x+D.width/2;H<S.x+10||H>S.x+S.width-10||RS($,S,D)}}};DS(!1);for(const x of E){const w=x.flow;n.connect(m(w.source),m(w.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:w.id,name:w.name})})}{const S=new Set([...Y.map(D=>D.flow.id),...E.map(D=>D.flow.id)].filter(D=>!!D)),O=r.filter(D=>!!D.waypoints),I=(D,H)=>Math.abs(H.x-D.x)<2?"L":Math.abs(H.x-(D.x+D.width))<2?"R":Math.abs(H.y-D.y)<2?"T":Math.abs(H.y-(D.y+D.height))<2?"B":void 0,T=new Map,$=(D,H,j)=>{if(!D||!H||typeof D.x!="number")return;const Q=I(D,H);if(!Q)return;let te=T.get(D.id);te||T.set(D.id,te=new Map),te.set(Q,[...te.get(Q)??[],j])};for(const D of O){const H=D.waypoints;!H||H.length<2||($(D.source,H[0],{id:D.id,dir:"out"}),$(D.target,H[H.length-1],{id:D.id,dir:"in"}))}const L=new Set;for(const[D,H]of T){const j=f(D);if(!j||typeof j.x!="number")continue;const Q=ee=>{var ye;const ce=(ye=f(ee.id))==null?void 0:ye.source;return!!ce&&typeof ce.x=="number"&&ce.x+ce.width/2>j.x+j.width/2};if(![...H.values()].some(ee=>ee.length>=3&&ee.some(ce=>ce.dir==="out")&&ee.some(ce=>ce.dir==="in"&&S.has(ce.id)&&Q(ce))))continue;const pe=g(j);if(!pe||L.has(pe.id)||(pe.children??[]).some(ee=>ee.type==="bpmn:Lane"))continue;const ae=(oR=H.get("T"))!=null&&oR.length?(rR=H.get("B"))!=null&&rR.length?void 0:"B":"T";if(!ae||(ae==="T"?j.y-pe.y:pe.y+pe.height-(j.y+j.height))>=z)continue;const xe=(pe.children??[]).filter(ee=>!("waypoints"in ee&&ee.waypoints)&&ee.type!=="label"&&typeof ee.x=="number"),ve=pe.y+pe.height;n.resizeShape(pe,{x:pe.x,y:pe.y,width:pe.width,height:pe.height+z}),Wt(ve,pe.id,z),ae==="T"&&xe.length&&n.moveElements(xe,{x:0,y:z}),L.add(pe.id)}}const nm=20,LS=4,JF=3,QF=2,e6=2,t6=[10,30,80],qi=()=>{const x=We(r);return{bad:ht(x).filter(w=>w.kind==="edge-crosses-shape"||w.kind==="edge-overlap-opposite"||w.kind==="edge-overlap-mixed").length,crossings:ry(x),straight:x.edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.waypoints.length===2).length}},Ar=x=>{const w=We(r),S=w.edges.find(O=>O.id===x);return S?Ot(S,Ln(w)).length:0},Oc=x=>Ar(x)>0,rs=x=>We(r).edges.filter(w=>w.type==="bpmn:MessageFlow"&&w.id!==x&&w.waypoints.length===2).length,IS=(x,w,S)=>jo([{subtree:x,pool:w}],S),BS=(x,w)=>w.bad>x.bad||w.crossings>x.crossings&&w.straight<=x.straight&&w.bad>=x.bad,as=(x,w)=>BS(x,w)||w.straight<x.straight,aa=(x,w,S=()=>!0,O=BS,I=!1)=>{const T=qi(),$=jo(x,w,I);if(!$)return!1;const L=qi();return O(T,L)||!S()?($(),!1):!0},n6=(x,w,S,O=()=>!0)=>aa([{subtree:x,pool:w}],S,O),sa=x=>{var w;return!!((w=N.get(x))!=null&&w.node.participant)},ss=new Map;for(const x of E){if(!sa(x.flow.target))continue;const w=ss.get(x.flow.target)??[];w.push(x),ss.set(x.flow.target,w)}const Dc=[...ss.keys()],im=new Set(Y.map(x=>x.flow.target)),NS=x=>Ap.findIndex(({op:w})=>w.participant.id===x);Dc.sort((x,w)=>{var I,T;const S=im.has(x)?1:0,O=im.has(w)?1:0;return S!==O?S-O:NS((I=N.get(x))==null?void 0:I.node.participant)-NS((T=N.get(w))==null?void 0:T.node.participant)});const Tr=x=>x.x+x.width/2,i6=x=>{const w=new Map;for(const I of r.getAll()){const T=I;if(!T.waypoints||!T.source||!T.target)continue;(w.get(T.source.id)??w.set(T.source.id,[]).get(T.source.id)).push(T.target.id)}const S=new Set([x]),O=[x];for(let I=0;I<O.length;I++)for(const T of w.get(O[I])??[])S.has(T)||(S.add(T),O.push(T));return S},o6=(x,w)=>{const S=i6(w);let O;for(const I of r.getAll()){const T=I;if(T.type!=="bpmn:MessageFlow"||!T.source||!T.target||T.target.id!==x||S.has(T.source.id))continue;const $=T.source;if(typeof $.x!="number"||$.type==="bpmn:Participant")continue;const L=Tr($);(O===void 0||L>O)&&(O=L)}return O},om=(x,w)=>{const S=f(x.flow.source);if(S)return S.type==="bpmn:Participant"?o6(S.id,w):Tr(S)},$S=x=>{let w;for(const S of ss.get(x)??[]){const O=om(S,x);O!==void 0&&(!w||O>w.cx)&&(w={op:S,cx:O})}return w==null?void 0:w.op},r6=x=>{const w=$S(x),S=f(x),O=w?om(w,x):void 0;return S&&O!==void 0?O-Tr(S):void 0},FS=x=>{const w=r6(x);return w!==void 0&&Math.abs(w)<nm},kp=(x,w,S,O,I)=>{var T;for(let $=!0;$;){$=!1;for(const L of E){if(L.flow.id===S)continue;const D=w.has(L.flow.source),H=w.has(L.flow.target);if(D===H||O(D?L.flow.source:L.flow.target))continue;const j=D?L.flow.target:L.flow.source;if(I(j)||!sa(j))continue;const Q=f(L.flow.id);if(!(Q!=null&&Q.waypoints)||Q.waypoints.length!==2)continue;const te=f(j),pe=(T=N.get(j))==null?void 0:T.node.participant;if(!te||!pe)continue;const ae=Fo(j,ne=>ne.x>=te.x).filter(ne=>!w.has(ne.id));if(!(!ae.length||ae.some(ne=>I(ne.id)))){for(const ne of ae)w.add(ne.id);x.set(pe,[...x.get(pe)??[],...ae]),$=!0}}}return[...x].map(([$,L])=>({subtree:L,pool:m($)}))},rm=(x,w,S,O,I)=>kp(new Map([[w,[...x]]]),new Set(x.map(T=>T.id)),O,T=>T===S,T=>T===I),am=x=>{const w=$S(x);if(!w)return null;const S=f(x),O=f(w.flow.source),I=om(w,x);if(!S||!O||I===void 0)return null;const T=I-Tr(S);if(T>=nm){const $=N.get(x).node.participant,L=Fo(x,H=>H.x>=S.x),D=Fo(x,H=>H.x>=S.x&&!FS(H.id));return{groups:rm(L,$,x,w.flow.id,w.flow.source),dx:T,cut:D.length<L.length?rm(D,$,x,w.flow.id,w.flow.source):void 0}}if(-T>=nm&&sa(w.flow.source)){const $=N.get(w.flow.source).node.participant,L=Fo(w.flow.source,D=>D.x>=O.x&&!FS(D.id));return{groups:rm(L,$,w.flow.source,w.flow.id,x),dx:-T}}return null},jS=()=>Dc.map(x=>({id:x,plan:am(x)})).filter(x=>!!x.plan).sort((x,w)=>Math.min(...x.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))-Math.min(...w.plan.groups.flatMap(S=>S.subtree.map(O=>O.x)))).map(x=>x.id),HS=()=>{var O;const x=r.getAll().filter(wi).filter(I=>I.type!=="bpmn:Participant"&&I.type!=="bpmn:Group").map(I=>[I.x,I.x+I.width]).sort((I,T)=>I[0]-T[0]);let w=((O=x[0])==null?void 0:O[1])??0,S=0;for(const[I,T]of x.slice(1))I>w&&(S=Math.max(S,I-w)),w=Math.max(w,T);return S},zS=x=>{if(!x.cut)return jo(x.groups,x.dx);const w=jo(x.groups,x.dx,!0);if(!w)return null;const S=qi(),O=HS();w();const I=jo(x.cut,x.dx,!0);if(I){const T=qi();if(T.bad<=S.bad&&T.crossings<=S.crossings&&T.straight>=S.straight&&HS()<O)return I;I()}return jo(x.groups,x.dx)};for(let x=0;x<3;x++){const w=qi(),S=[];for(const I of jS()){const T=am(I);if(!T)continue;const $=zS(T);$&&S.push($)}if(!S.length)break;if(!as(w,qi()))continue;for(const I of S.reverse())I();let O=!1;for(const I of jS()){const T=am(I);if(!T)continue;const $=qi(),L=zS(T);L&&(as($,qi())?L():O=!0)}if(!O)break}for(const x of Dc){if(im.has(x))continue;const w=N.get(x);if(!w||w.node.lane!==void 0)continue;const S=pt(w);if(S===void 0)continue;const O=f(x),I=O?g(O):void 0;if(!O||!I)continue;const T=I.y+V+ii(`pool:${w.node.participant??""}`,S)*z,$=T-(O.y+O.height/2);$!==0&&!W(I,O,O.x+O.width/2,T)&&n.moveElements([O],{x:0,y:$})}const Op=()=>{const x=r.filter(O=>O.type==="bpmn:Participant"),w=new Map(x.map(O=>[O.id,O]));let S=0;for(const{pools:[O,I]}of vd(x)){const T=w.get(O),$=w.get(I);S+=(Math.min(T.x+T.width,$.x+$.width)-Math.max(T.x,$.x))*(Math.min(T.y+T.height,$.y+$.height)-Math.max(T.y,$.y))}return S},sm=new Set,GS=new Set;for(let x=0,w=!0;w&&x<JF;x++){w=!1;for(const S of Dc.flatMap(O=>ss.get(O)??[])){if(sm.has(S.flow.id)||!Oc(S.flow.id))continue;const O=f(S.flow.target);if(!O)continue;const I=m(N.get(S.flow.target).node.participant),T=Fo(S.flow.target,j=>j.x>=O.x),$=O.width+oe,L=Ar(S.flow.id),D=rs(S.flow.id),H=Op();for(let j=1;j<=LS;j++){const Q=()=>Ar(S.flow.id)>=L||Op()>H?!1:rs(S.flow.id)>=D?!0:(GS.add(S.flow.id),!1);if(n6(T,I,$*j,Q)){sm.add(S.flow.id),w=!0;break}}}}const VS=()=>r.filter(x=>x.type==="bpmn:SequenceFlow").filter(x=>{const w=x.source,S=x.target;return!!w&&!!S&&S.x+S.width<w.x}).length;for(const x of Dc.flatMap(w=>ss.get(w)??[])){if(sm.has(x.flow.id)||!GS.has(x.flow.id)||!Oc(x.flow.id))continue;const w=f(x.flow.target);if(!w)continue;const S=m(N.get(x.flow.target).node.participant),O=Fo(x.flow.target,te=>te.x>=w.x),I=new Set(O.map(te=>te.id)),T=new Map;for(const te of r.filter(pe=>pe.type==="bpmn:MessageFlow")){if(((aR=te.waypoints)==null?void 0:aR.length)!==2||!te.source||!te.target)continue;const pe=I.has(te.source.id);if(pe===I.has(te.target.id))continue;const ae=pe?te.target:te.source,ne=(sR=N.get(ae.id))==null?void 0:sR.node.participant;!ne||T.has(ae.id)||T.set(ae.id,{subtree:[ae],pool:m(ne)})}if(!T.size)continue;const $=w.width+oe,L=Ar(x.flow.id),D=rs(x.flow.id),H=Op(),j=VS(),Q=()=>Ar(x.flow.id)<L&&rs(x.flow.id)>=D&&Op()<=H&&VS()<=j;for(let te=1;te<=QF&&!aa([{subtree:O,pool:S},...T.values()],$*te,Q);te++);}const cm=E.map(x=>({id:x.flow.id,source:x.flow.source,target:x.flow.target,preexisting:!1})),WS=new Set(cm.map(x=>x.id));for(const x of r.filter(w=>w.type==="bpmn:MessageFlow"))WS.has(x.id)||!x.source||!x.target||x.source.type==="bpmn:Participant"!=(x.target.type==="bpmn:Participant")&&cm.push({id:x.id,source:x.source.id,target:x.target.id,preexisting:!0});for(const x of cm){if(!Oc(x.id))continue;const w=f(x.source),S=f(x.target);if(!w||!S)continue;let O,I,T;if(x.preexisting){const[L,D]=w.type==="bpmn:Participant"?[S,w]:[w,S];if(O=Tr(L),O<D.x||O>D.x+D.width)continue;[I,T]=L.y<D.y?[L.y+L.height,D.y]:[D.y+D.height,L.y]}else{if(w.type==="bpmn:Participant"||S.type==="bpmn:Participant"||(O=w.x+w.width/2,Math.abs(O-(S.x+S.width/2))>15))continue;[I,T]=w.y<S.y?[w.y+w.height,S.y]:[S.y+S.height,w.y]}const $=[...N.values()].map(L=>f(L.node.id)).filter(L=>!!L&&L.id!==w.id&&L.id!==S.id).filter(L=>L.x<=O&&O<=L.x+L.width&&L.y+L.height>I&&L.y<T).sort((L,D)=>L.x-D.x);for(const L of $){const D=(cR=N.get(L.id))==null?void 0:cR.node.participant,H=D?f(D):void 0;if(!D||!H)continue;const j=[...N.values()].filter(ce=>ce.node.participant===D).map(ce=>ce.node.id),Q=ce=>ce.map(ye=>f(ye)).filter(ye=>!!ye),pe=[WF(L.id,ce=>{var ye;return((ye=N.get(ce.id))==null?void 0:ye.node.participant)===D}),Q(j)].filter(ce=>ce.length).map(ce=>[{subtree:ce,pool:H}]);if(x.preexisting){const ce=Q(j);ce.length&&pe.push(kp(new Map([[D,[...ce]]]),new Set(ce.map(ye=>ye.id)),x.id,()=>!1,ye=>ye===w.id||ye===S.id))}const ae=L.width+oe,ne=Ar(x.id),xe=rs(x.id),ve=()=>Ar(x.id)<ne&&rs(x.id)>=xe;let ee=!1;for(const ce of pe){for(let ye=1;ye<=LS;ye++)if(aa(ce,ae*ye,ve)){ee=!0;break}if(ee)break}if(!Oc(x.id))break}}const Dp=()=>{var w;const x=new Set;for(const S of ht(We(r)))S.kind!=="edge-crosses-shape"||WS.has(S.edge)||((w=f(S.edge))==null?void 0:w.type)==="bpmn:MessageFlow"&&x.add(`${S.edge}>${S.shape}`);return x},a6=(x,w)=>qi().bad>=x&&[...Dp()].some(S=>!w.has(S)),US=x=>{var w,S;return Ar(x)===0&&((S=(w=f(x))==null?void 0:w.waypoints)==null?void 0:S.length)===2},s6=(x,w,S)=>{const O=new Set(x.flatMap(T=>T.subtree.map($=>$.id))),I=[...Dp()].filter(T=>!S.has(T)).map(T=>T.split(">")[1]);return[...new Set(I)].filter(T=>O.has(T)&&T!==w.source&&T!==w.target)},c6=(x,w,S,O,I)=>{const T=x.map(H=>({...H,subtree:H.subtree.filter(j=>!I.includes(j.id))})).filter(H=>H.subtree.length),$=new Set(T.flatMap(H=>H.subtree.map(j=>j.id))),L=()=>I.every(H=>{const j=f(H);return!!j&&Y.filter(Q=>Q.flow.target===H&&$.has(Q.flow.source)).every(Q=>{const te=f(Q.flow.source);return!!te&&te.x+te.width<=j.x})});return aa(T,w,()=>US(S.id)&&[...Dp()].every(H=>O.has(H))&&L(),as,!0)};for(const x of E){if(!Oc(x.flow.id))continue;const w=f(x.flow.id);if(((lR=w==null?void 0:w.waypoints)==null?void 0:lR.length)!==2)continue;const S=f(x.flow.source),O=f(x.flow.target);if(!S||!O||S.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!sa(x.flow.source)||!sa(x.flow.target)||Math.abs(Tr(S)-Tr(O))>e6)continue;const I=Tr(S),T=w.waypoints.map(ne=>ne.y),[$,L]=[Math.min(...T),Math.max(...T)],D=Ln(We(r)).filter(ne=>ne.id!==S.id&&ne.id!==O.id&&ne.x<I&&I<ne.x+ne.width&&$<ne.y+ne.height&&ne.y<L);if(!D.length)continue;const H=(uR=N.get(x.flow.source))==null?void 0:uR.node.participant,j=(pR=N.get(x.flow.target))==null?void 0:pR.node.participant;if(!H||!j)continue;const Q=new Map;for(const[ne,xe,ve]of[[x.flow.source,S,H],[x.flow.target,O,j]]){const ee=Q.get(ve)??[],ce=Fo(ne,ye=>ye.x>=xe.x).filter(ye=>!ee.some(le=>le.id===ye.id));Q.set(ve,[...ee,...ce])}const te=new Set([...Q.values()].flat().map(ne=>ne.id)),pe=kp(Q,te,x.flow.id,ne=>ne===x.flow.source||ne===x.flow.target,()=>!1),ae=Math.max(...D.map(ne=>ne.x+ne.width));for(const ne of t6){const xe=ae+ne-I;if(xe<=0)continue;const ve=qi().bad,ee=Dp();let ce=[],ye=!0;const le=()=>!US(x.flow.id)||ye&&(ce=s6(pe,x.flow,ee),ce.length)?!1:!a6(ve,ee);if(aa(pe,xe,le,as))break;if(ce.length&&(c6(pe,xe,x.flow,ee,ce)||(ye=!1,aa(pe,xe,le,as))))break}}{const x=T=>T.y+T.height/2,w=/(Task|Event|Gateway|CallActivity|SubProcess)$/,S=()=>{const T=We(r),$=new Set(ht(T).flatMap(H=>H.kind==="edge-crosses-shape"?[`${H.edge}|${H.shape}`]:[])),L=T.shapes.filter(H=>!H.container&&w.test(H.type)),D=new Set;for(const H of T.edges){if(H.type!=="bpmn:SequenceFlow"&&H.type!=="bpmn:MessageFlow")continue;const j=new Set(H.endpoints);for(const Q of[H.waypoints[0],H.waypoints[H.waypoints.length-1]])for(const te of L)te.x-4<=Q.x&&Q.x<=te.x+te.width+4&&te.y-4<=Q.y&&Q.y<=te.y+te.height+4&&j.add(te.id);for(const Q of L)if(!(j.has(Q.id)||$.has(`${H.id}|${Q.id}`))){for(let te=0;te+1<H.waypoints.length;te++)if(wo(H.waypoints[te],H.waypoints[te+1],Q)<=Qg){D.add(`${H.id}|${Q.id}`);break}}}return D},O=()=>({...qi(),grazes:S()}),I=[];for(const T of N.keys()){if(!sa(T))continue;const $=Y.filter(H=>H.flow.target===T);if($.length!==1)continue;const L=f($[0].flow.source),D=f(T);!L||!D||!N.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=oe+1||I.push({id:T,pred:L,node:D})}I.sort((T,$)=>T.node.x-$.node.x);for(const{id:T}of I){const $=N.get(T),L=f(T),D=f(Y.find(ce=>ce.flow.target===T).flow.source);if(!L||!D)continue;const H=L.x-(D.x+D.width);if(H<=oe+1)continue;const j=m($.node.participant),Q=Fo(T,ce=>ce.x>=L.x),te=-(H-oe),pe=(ce,ye)=>ye.bad>ce.bad||ye.crossings>ce.crossings||ye.crossings===ce.crossings&&ye.bad===ce.bad||ye.straight<ce.straight||[...ye.grazes].some(le=>!ce.grazes.has(le)),ae=kp(new Map([[$.node.participant,[...Q]]]),new Set(Q.map(ce=>ce.id)),"",()=>!1,()=>!1),ne=ae.some(ce=>ce.pool!==j)||ae.reduce((ce,ye)=>ce+ye.subtree.length,0)>Q.length,xe=O(),ve=IS(Q,j,te);if(!ve)continue;const ee=O();if(ne&&!pe(xe,ee)){ve();const ce=jo(ae,te);if(ce){const ye=O();if(!pe(xe,ye)&&ye.bad<=ee.bad&&ye.crossings<=ee.crossings)continue;ce()}IS(Q,j,te);continue}pe(xe,ee)&&ve()}}DS(!0);const l6=10,u6=400,p6=x=>[...x.incoming??[],...x.outgoing??[]].filter(w=>w.type==="bpmn:DataInputAssociation"||w.type==="bpmn:DataOutputAssociation").map(w=>w.source===x?w.target:w.source).filter(w=>!!w&&typeof w.y=="number"),d6=r.filter(x=>x.type==="bpmn:DataStoreReference"&&_.has(x.id)),f6=(x,w)=>{const S=x.x+x.width/2,O=x.y+x.height/2;let I;for(const T of d6){if((g(T)??d())!==w||T.y<x.y+x.height)continue;const $=Math.abs(T.x+T.width/2-S);$>u6||$<T.width||!p6(T).some(D=>D.height===x.height&&Math.abs(D.y+D.height/2-O)<=l6&&T.y>=D.y+D.height)||(!I||$<I.dx||$===I.dx&&T.id<I.id)&&(I={dx:$,id:T.id,cy:T.y+T.height/2})}return I==null?void 0:I.cy},h6=50,g6=(x,w)=>{const S=g(w);if(!S||x.y<w.y+w.height)return;const O=y(S,w),I=O??S,T=x.label,$=Math.max(x.y+x.height,T?T.y+T.height:0),L=I.y+I.height;if($<=L)return;const D=Math.ceil($+h6-L),H=S.y+S.height;if(O){const j=is(O,O.height+D,new Set([x.id]));Wt(H,S.id,D,j)}else n.resizeShape(S,{x:S.x,y:S.y,width:S.width,height:S.height+D}),Wt(H,S.id,D)};for(const x of M){const w=x.associations??[],S=w.map($=>$.source===x.dataStore.id?$.target:$.source).map(f).find(Boolean),O=S?g(S)??d():d(),I=S?{x:S.x+S.width/2,y:f6(S,O)??S.y+S.height+110}:{x:200,y:Tc+60},T=n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},I,O);S&&g6(T,S);for(const $ of w)OS(x.dataStore.id,$)}for(const x of B){const S=m(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;OS(S,x.association)}let qS=0;const ca=10,YS=40,m6=(x,w)=>{const S=w.map(D=>g(D)).filter(D=>!!D);for(const D of S){const H=ca,j=D.y,Q=D.y+D.height,te=D.x,pe=D.x+D.width;if(Math.abs(x.y-j)<H){const ae=j+H-x.y;x.y+=ae,x.height-=ae}if(Math.abs(x.y+x.height-Q)<H&&(x.height=Q-H-x.y),Math.abs(x.x-te)<H){const ae=te+H-x.x;x.x+=ae,x.width-=ae}Math.abs(x.x+x.width-pe)<H&&(x.width=pe-H-x.x)}if(!S.length)return;const O=Math.min(...S.map(D=>D.y)),I=Math.max(...S.map(D=>D.y+D.height)),T=O-x.y,$=x.y+x.height-I,L=YS-ca;if(T>0!=$>0)if(T>0&&T<L){const D=T+ca;x.y+=D,x.height-=D}else $>0&&$<L&&(x.height-=$+ca)},y6=(x,w)=>{const S=ca,O=30,I=r.filter(T=>T.type==="bpmn:Group"&&T.id!==w);for(const T of I){const $=T.x,L=T.x+T.width,D=T.y,H=T.y+T.height,j=x.y<H&&D<x.y+x.height,Q=x.x<L&&$<x.x+x.width;if(j){if(Math.abs(x.x-L)<S){const te=Math.min(L+S-x.x,O);te>0&&x.width-te>0&&(x.x+=te,x.width-=te)}if(Math.abs(x.x+x.width-$)<S){const te=Math.min(x.x+x.width-($-S),O);te>0&&x.width-te>0&&(x.width-=te)}}if(Q){if(Math.abs(x.y-H)<S){const te=Math.min(H+S-x.y,O);te>0&&x.height-te>0&&(x.y+=te,x.height-=te)}if(Math.abs(x.y+x.height-D)<S){const te=Math.min(x.y+x.height-(D-S),O);te>0&&x.height-te>0&&(x.height-=te)}}}},lm=(x,w)=>{const S=YS,O=Math.min(...x.map(D=>D.x))-S,I=Math.min(...x.map(D=>D.y))-S,T=Math.max(...x.map(D=>D.x+D.width))+S,$=Math.max(...x.map(D=>D.y+D.height))+S,L={x:O,y:I,width:T-O,height:$-I};return m6(L,x),y6(L,w),L};for(const x of k){const w=(x.group.members??[]).map(f).filter(I=>!!I);let S;w.length?S=lm(w,x.group.id):(S={x:300+qS*350,y:40,width:300,height:200},qS++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:S.width,height:S.height},{x:S.x+S.width/2,y:S.y+S.height/2},d());x.group.name&&n.updateLabel(O,x.group.name),(dR=x.group.members)!=null&&dR.length&&Ce(O,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=r.filter(I=>!!I.waypoints),w=new Map,S=(I,T)=>{!I||!T||(w.has(I)||w.set(I,new Set),w.get(I).add(T))};for(const I of x){const T=(fR=I.source)==null?void 0:fR.id,$=(hR=I.target)==null?void 0:hR.id;S(T,$),((gR=I.type)!=null&&gR.includes("DataOutputAssociation")||(mR=I.type)!=null&&mR.includes("DataInputAssociation")||I.type==="bpmn:Association")&&S($,T)}const O=r.filter(I=>I.type==="bpmn:Group");for(const I of O){const $=(((yR=I.businessObject.extensionElements)==null?void 0:yR.values)??[]).find(ve=>ve.$type==="bwl:Members"),L=(($==null?void 0:$.refs)??"").split(" ").filter(Boolean);if(!L.length)continue;const D=new Set(L),H=[...L];for(;H.length;){const ve=H.shift();for(const ee of w.get(ve)??[])D.has(ee)||(D.add(ee),H.push(ee))}const j=I.x,Q=I.x+I.width,te=I.y,pe=I.y+I.height,ae=ve=>Y.filter(ee=>ee.flow.target===ve).length,ne=ve=>{var ce;const ee=((ce=f(ve))==null?void 0:ce.type)??"";if(ee==="bpmn:StartEvent"&&ae(ve)===0)return!1;if(ee.endsWith("Gateway")){const ye=Y.filter(le=>le.flow.target===ve).map(le=>le.flow.source);if(ye.length&&ye.every(le=>{var se;return((se=f(le))==null?void 0:se.type)==="bpmn:StartEvent"&&ae(le)===0}))return!1}return!0},xe=r.filter(ve=>wi(ve)).filter(ve=>ve.type!=="bpmn:Group"&&ve.type!=="bpmn:Participant"&&ve.type!=="bpmn:TextAnnotation"&&!D.has(ve.id)&&sa(ve.id)&&ne(ve.id)&&ve.x<Q&&ve.x+ve.width>j&&ve.y<pe&&ve.y+ve.height>te);if(xe.length)for(const ve of[-1,1]){const ee=xe.filter(Ie=>(Ie.x+Ie.width-j<=Q-Ie.x?-1:1)===ve);if(!ee.length)continue;const ce=[];for(const Ie of ee){const Oe=ce.find(me=>me.some(he=>Ie.y<he.y+he.height&&Ie.y+Ie.height>he.y));Oe?Oe.push(Ie):ce.push([Ie])}const ye=new Map;for(const Ie of ce){let Oe=ve<0?j-ca:Q+ca;for(const me of[...Ie].sort((he,ge)=>ve<0?ge.x-he.x:he.x-ge.x)){const he=ve<0?Math.min(me.x,Oe-me.width):Math.max(me.x,Oe);Oe=ve<0?he-Fi:he+me.width+Fi,he!==me.x&&Math.sign(he-me.x)===ve&&ye.set(me.id,he-me.x)}}const le=new Map,se=Ie=>le.get(Ie)===Ie||!le.get(Ie)?Ie:se(le.get(Ie));for(const Ie of ee)le.set(Ie.id,Ie.id);for(const Ie of E){const Oe=ye.has(Ie.flow.source)?Ie.flow.source:void 0,me=ye.has(Ie.flow.target)?Ie.flow.target:void 0;if(!Oe||!me)continue;const he=f(Ie.flow.id);((vR=he==null?void 0:he.waypoints)==null?void 0:vR.length)===2&&le.set(se(Oe),se(me))}const Re=new Map;for(const Ie of ee){if(!ye.has(Ie.id))continue;const Oe=se(Ie.id);Re.set(Oe,[...Re.get(Oe)??[],Ie])}const Me=[...Re.values()].sort((Ie,Oe)=>ve<0?Math.min(...Ie.map(me=>me.x))-Math.min(...Oe.map(me=>me.x)):Math.max(...Oe.map(me=>me.x))-Math.max(...Ie.map(me=>me.x))),Ge=[];let Ue=!0;for(const Ie of Me){const Oe=Ie.map(ge=>ye.get(ge.id)??0).reduce((ge,Fe)=>Math.abs(Fe)>Math.abs(ge)?Fe:ge,0),me=new Map;let he=!0;for(const ge of Ie){const Fe=g(ge);if(!Fe){he=!1;break}me.has(Fe.id)||me.set(Fe.id,{subtree:[],pool:Fe}),me.get(Fe.id).subtree.push(ge)}he&&aa([...me.values()],Oe,()=>!0,as)?Ge.push({shapes:Ie,dx:Oe}):Ue=!1}if(!Ue)for(const Ie of Ge.reverse())n.moveElements(Ie.shapes,{x:-Ie.dx,y:0})}}}{const x=new Set([...k.map(w=>w.group.id),...Gt(e,"group.update").map(w=>w.id)]);for(const w of r.filter(S=>S.type==="bpmn:Group")){if(x.has(w.id))continue;const O=(((xR=w.businessObject.extensionElements)==null?void 0:xR.values)??[]).find(L=>L.$type==="bwl:Members"),I=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(L=>!!L);!I.length||!I.some(L=>{const D=_.get(L.id);return!D||D.x!==L.x||D.y!==L.y})||!I.some(L=>L.x<w.x||L.y<w.y||L.x+L.width>w.x+w.width||L.y+L.height>w.y+w.height)||n.resizeShape(w,lm(I,w.id))}}{const w=new Map(Ko(We(r)).map(L=>[L.owner,L.rect])),S=r.filter(L=>!!L.waypoints),O=new Map,I=(L,D)=>{!L||!D||(O.has(L)||O.set(L,new Set),O.get(L).add(D))};for(const L of S){const D=(bR=L.source)==null?void 0:bR.id,H=(wR=L.target)==null?void 0:wR.id;I(D,H),((_R=L.type)!=null&&_R.includes("DataOutputAssociation")||(ER=L.type)!=null&&ER.includes("DataInputAssociation")||L.type==="bpmn:Association")&&I(H,D)}const T=L=>Y.filter(D=>D.flow.target===L).length,$=L=>{var H;const D=((H=f(L))==null?void 0:H.type)??"";if(D==="bpmn:StartEvent"&&T(L)===0)return!1;if(D.endsWith("Gateway")){const j=Y.filter(Q=>Q.flow.target===L).map(Q=>Q.flow.source);if(j.length&&j.every(Q=>{var te;return((te=f(Q))==null?void 0:te.type)==="bpmn:StartEvent"&&T(Q)===0}))return!1}return!0};for(const L of r.filter(D=>D.type==="bpmn:Group")){const H=(((SR=L.businessObject.extensionElements)==null?void 0:SR.values)??[]).find(he=>he.$type==="bwl:Members"),j=((H==null?void 0:H.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const Q=j.map(f).filter(he=>!!he);if(!Q.length||!(k.some(he=>he.group.id===L.id)||Gt(e,"group.update").some(he=>he.id===L.id)||Q.some(he=>{const ge=_.get(he.id);return!ge||ge.x!==he.x||ge.y!==he.y})))continue;const pe=new Set(j),ae=[...j];for(;ae.length;){const he=ae.shift();for(const ge of O.get(he)??[])pe.has(ge)||(pe.add(ge),ae.push(ge))}const ne=L.x,xe=L.x+L.width,ve=L.y,ee=L.y+L.height,ce=he=>{const ge=w.get(he.id),Fe={x:he.x,y:he.y,width:he.width,height:he.height};return ge?[Fe,{x:ge.x,y:ge.y,width:ge.width,height:ge.height}]:[Fe]},ye=Q.flatMap(ce),le=Math.min(...ye.map(he=>he.x)),se=Math.max(...ye.map(he=>he.x+he.width)),Re=Math.min(...ye.map(he=>he.y)),Me=Math.max(...ye.map(he=>he.y+he.height)),Ge={L:le-ne,R:xe-se,T:Re-ve,B:ee-Me},Ue=new Set(j),Ie=he=>he.x>=ne&&he.x+he.width<=xe&&he.y>=ve&&he.y+he.height<=ee,Oe=r.filter(he=>wi(he)).filter(he=>he.type!=="bpmn:Group"&&he.type!=="bpmn:Participant"&&he.type!=="bpmn:TextAnnotation"&&!Ue.has(he.id)&&(!pe.has(he.id)||!Ie(he))&&$(he.id)&&he.x<xe&&he.x+he.width>ne&&he.y<ee&&he.y+he.height>ve);if(!Oe.length)continue;const me={L:0,R:0,T:0,B:0};for(const he of Oe){const ge=ce(he),Fe=Math.min(...ge.map(Yt=>Yt.x)),Ke=Math.max(...ge.map(Yt=>Yt.x+Yt.width)),it=Math.min(...ge.map(Yt=>Yt.y)),Be=Math.max(...ge.map(Yt=>Yt.y+Yt.height)),Ve={L:Ke-ne,R:xe-Fe,T:Be-ve,B:ee-it},Ft=["L","R","T","B"].filter(Yt=>Ve[Yt]<=Ge[Yt]+.001);if(!Ft.length)continue;const cn=Ft.reduce((Yt,Kt)=>Ve[Kt]<Ve[Yt]?Kt:Yt,Ft[0]);me[cn]=Math.max(me[cn],Math.min(Ve[cn]+10,Ge[cn]))}!me.L&&!me.R&&!me.T&&!me.B||n.resizeShape(L,{x:L.x+me.L,y:L.y+me.T,width:L.width-me.L-me.R,height:L.height-me.T-me.B})}}const KS=x=>{const w=x.waypoints;if(w!=null&&w.length){const O=w[Math.floor((w.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const S=x;return{x:S.x,y:S.y,width:S.width,height:S.height}};let Lc=0;const um=bv.get(t),XS=(x,w)=>{var O;const S=(O=um==null?void 0:um.get(x))==null?void 0:O.texts;return S?[...new Set([w,...Object.values(S)])]:[w]};for(const x of P){const w=x.association,S=((RR=x.placement)==null?void 0:RR.anchor)??(w?w.source===x.annotation.id?w.target:w.source:void 0),O=S?f(S):void 0,I=O?KS(O):void 0,T=lv(XS(x.annotation.id,x.annotation.text??""));let $;if(I&&x.placement){const[j,Q]=pl[x.placement.side],te=x.placement.offset??50;$={x:I.x+I.width/2+j*(I.width/2+T.width/2+te),y:I.y+I.height/2+Q*(I.height/2+T.height/2+te)}}else I?($={x:I.x+I.width/2+180+Lc%3*260,y:I.y-110-Lc%2*95},Lc++):($={x:300+Lc*260,y:60},Lc++);const L=O?g(O)??d():d(),D=L;I&&typeof D.x=="number"&&typeof D.width=="number"&&D.type==="bpmn:Participant"&&($=fl(r,I,T,D,x.placement?{placement:x.placement}:{from:$}));const H=n.createShape({type:"bpmn:TextAnnotation",width:T.width,height:T.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},$,L);if(w){const j=Q=>Q===x.annotation.id?H:m(Q);n.connect(j(w.source),j(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}x.placement&&Ce(H,"bwl:Placement",Ae(x.placement))}for(const x of Gt(e,"association.add")){const w=x.association;n.connect(m(w.source),m(w.target),w.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:w.id})}:{type:"bpmn:Association"})}const v6=(x,w,S,O)=>{const I=x.parent;if(!I)return O;const T=x.x+x.width/2,$=new Set([x.id]);if(!W(I,x,T,O,$))return O;const L=w?w.y+Math.min(w.height/2,X):S?S.y+V:void 0;if(L===void 0)return O;const D=Math.floor((O-L)/z+1e-6);for(let H=1;H<=3;H++){const j=D+H,Q=L+j*z,te=Kg(w==null?void 0:w.id,j);if(!W(I,x,T,Q,te?new Set([...$,...te]):$))return Zn(w==null?void 0:w.id,j,S),Q}return O},ZS=()=>new Set(r.getAll().filter(x=>x.type!=="label").map(x=>x.id));for(const x of Gt(e,"node.update")){let w=m(x.id);if(x.type&&ul(x.type)!==w.type){const S=w.x+w.width/2,O=w.y+w.height/2,I=ZS();w=c.replaceElement(w,{type:ul(x.type),...x.eventDefinition?{eventDefinitionType:Fc[x.eventDefinition]}:{}});const T=ZS(),$=[...I].filter(H=>H!==x.id&&!T.has(H));if($.length)throw new vv({kind:"type-change-drops-elements",opIndex:e.indexOf(x),id:x.id,type:x.type,dropped:$});const L=Math.round(S-(w.x+w.width/2)),D=Math.round(O-(w.y+w.height/2));if(L!==0||D!==0){n.moveShape(w,{x:L,y:D});for(const H of[...w.incoming??[],...w.outgoing??[]])Pp(H)}}if(x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(w,{"bwl:band":x.band});const S=w.y+w.height/2,O=g(w),I=x.lane?m(x.lane):((O==null?void 0:O.children)??[]).find($=>$.type==="bpmn:Lane"&&S>=$.y&&S<=$.y+$.height);x.band!==void 0&&Zn(I==null?void 0:I.id,x.band,O);const T=I?I.y+(x.band===void 0?I.height/2:Math.min(I.height/2,X)+ii(I.id,x.band)*z):x.band!==void 0&&O?O.y+V+ii(`pool:${O.id}`,x.band)*z:void 0;if(T!==void 0){const $=v6(w,I,O,T),L=$===T?T-S:$-(w.y+w.height/2);L!==0&&(p.push({id:w.id,x:w.x,y:w.y,width:w.width,height:w.height}),n.moveElements([w],{x:0,y:L}))}}}for(const x of Gt(e,"sequenceFlow.update")){const w=m(x.id),S=G.get(x.id);if(S){const O=H=>({x:H.x+H.width/2,y:H.y+H.height/2}),I=m(S.flow.source),T=m(S.flow.target),$=n.connect(I,T,{type:"bpmn:SequenceFlow",businessObject:Tp(S.flow)}),L=tm.get(x.id),D=T.y+T.height/2;L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1?n.updateWaypoints($,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]):(n.reconnect($,I,T,[O(I),O(T)]),Math.abs(D-(I.y+I.height/2))>1&&Pp($))}else if((x.source!==void 0||x.target!==void 0)&&!_S.has(x.id)){const O=w,I=x.source!==void 0?m(x.source):O.source,T=x.target!==void 0?m(x.target):O.target,$=H=>({x:H.x+H.width/2,y:H.y+H.height/2});n.reconnect(O,I,T,[$(I),$(T)]);const L=tm.get(O.id),D=T.y+T.height/2;if(L&&T.x>L.exit.x&&Math.abs(D-L.exit.y)>1){n.updateWaypoints(O,[L.exit,{x:L.exit.x,y:D},{x:T.x,y:D}]);const H=O.label;if(H&&L.label){const Q=Math.abs(L.label.y+H.height/2-L.channelY)<=z/5&&L.label.x+H.width>L.exit.x,te=L.exit.x+6,pe=T.x-6-H.width,ae=Q?pe>=te?{x:Math.max(te,Math.min(L.label.x,pe)),y:L.label.y+(D-L.channelY)}:void 0:L.label;ae&&(ae.x!==H.x||ae.y!==H.y)&&n.moveElements([H],{x:ae.x-H.x,y:ae.y-H.y})}}else Math.abs(D-(I.y+I.height/2))>1&&Pp(O)}x.name!==void 0&&n.updateProperties(w,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(w,{name:((MR=x.condition)==null?void 0:MR.label)??void 0})}for(const x of Gt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(m(x.id),{name:x.name??void 0});for(const x of Gt(e,"annotation.update")){const w=m(x.id);if(x.text!==void 0){n.updateProperties(w,{text:x.text});const S=lv(XS(x.id,x.text));if(S.width!==w.width||S.height!==w.height){const O={x:w.x,y:w.y,width:S.width,height:S.height};n.resizeShape(w,O,void 0,{[uv]:O})}}if(x.placement===null)Ce(w,"bwl:Placement",null);else if(x.placement){const S=m(x.placement.anchor),O=KS(S),I=g(S)??d(),T=typeof I.x=="number"&&typeof I.width=="number"&&I.type==="bpmn:Participant",[$,L]=pl[x.placement.side],D=x.placement.offset??50,H={x:O.x+O.width/2+$*(O.width/2+w.width/2+D),y:O.y+O.height/2+L*(O.height/2+w.height/2+D)},j=T?fl(r,O,{width:w.width,height:w.height},I,{placement:x.placement,selfId:x.id}):H;n.moveElements([w],{x:j.x-(w.x+w.width/2),y:j.y-(w.y+w.height/2)}),Ce(w,"bwl:Placement",Ae(x.placement))}}for(const x of Gt(e,"group.update")){const w=m(x.id);if(x.name!==void 0&&n.updateLabel(w,x.name??""),x.members){const S=x.members.map(f).filter(O=>!!O);S.length&&n.resizeShape(w,lm(S,x.id)),Ce(w,"bwl:Members",{refs:x.members.join(" ")})}}}function _s(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 yT(e,t,n){const i=(r,a)=>{const s=r.shapes.find(l=>l.id===a);if(s)return{x:s.x+s.width/2,y:s.y+s.height/2};const c=r.edges.find(l=>l.id===a);return c!=null&&c.waypoints.length?c.waypoints[Math.floor((c.waypoints.length-1)/2)]:void 0},o=new Set;for(const r of e.shapes){if(r.type!=="bpmn:TextAnnotation")continue;const a=i(e,r.id),s=i(t,r.id);if(!a||!s)continue;const c=s.x-a.x,l=s.y-a.y;if(Math.abs(c)<=2&&Math.abs(l)<=2)continue;const u=n(r.id),p=u?i(e,u):void 0,d=u?i(t,u):void 0;p&&d&&Math.abs(d.x-p.x-c)<=2&&Math.abs(d.y-p.y-l)<=2||o.add(r.id)}return o}function vT(e,t,n,i){const{elementRegistry:o}=e,r=e.modeling,a=[...t.incoming??[],...t.outgoing??[]].filter(f=>f.type==="bpmn:Association");if(!a.length)return 0;const s=f=>f.map(m=>m.original?{x:m.x,y:m.y,original:{x:m.original.x,y:m.original.y}}:{x:m.x,y:m.y}),c=(f,m)=>f.length===m.length&&f.every((g,y)=>{var _,h,v,b;return g.x===m[y].x&&g.y===m[y].y&&((_=g.original)==null?void 0:_.x)===((h=m[y].original)==null?void 0:h.x)&&((v=g.original)==null?void 0:v.y)===((b=m[y].original)==null?void 0:b.y)}),l=a.map(f=>s(f.waypoints)),u=new Set(a.map(f=>f.id));r.moveElements([t],{x:n,y:i});const p=We(o),d=[...eo(p),...Ei(p)].filter(([f,m])=>u.has(f)!==u.has(m)).length;return r.moveElements([t],{x:-n,y:-i}),a.forEach((f,m)=>{c(f.waypoints,l[m])||r.updateWaypoints(f,l[m])}),d}function xT(e,t,n,i=new Set,o=new Set){var g,y;const{elementRegistry:r}=e,a=e.modeling,s=_=>ht(_).filter(h=>!t.has(lt(h))),c=_=>{var h;return((h=r.get(_))==null?void 0:h.type)==="bpmn:TextAnnotation"},l=We(r),u=s(l),p=_=>!n.has(_),d=_=>u.some(h=>h.kind==="edge-crosses-shape"&&h.shape===_&&i.has(h.edge)||h.kind==="shape-overlap"&&h.shapes.includes(_)&&h.shapes.every(c)),f=[...new Set(u.flatMap(_s))].filter(_=>c(_)&&(!p(_)||d(_))),m=[...f.filter(_=>!p(_)),...f.filter(p)];if(m.length)for(const _ of m){const h=r.get(_);if(!h||typeof h.x!="number"||typeof h.width!="number")continue;let v=h.parent,b;for(;v;){if(v.type==="bpmn:Participant"){b=v;break}v=v.parent}if(!b){const V=h.x+h.width/2,X=h.y+h.height/2;b=r.getAll().find(ue=>{if(ue.type!=="bpmn:Participant")return!1;const be=ue;return typeof be.x=="number"&&typeof be.width=="number"&&V>=be.x&&V<=be.x+be.width&&X>=be.y&&X<=be.y+be.height})}if(!b||typeof b.x!="number"||typeof b.width!="number")continue;const M=(((g=h.businessObject.extensionElements)==null?void 0:g.values)??[]).find(V=>V.$type==="bwl:Placement"),B=[...h.incoming??[],...h.outgoing??[]].find(V=>V.type==="bpmn:Association"),P=(M!=null&&M.anchor?r.get(M.anchor):void 0)??(B?((y=B.source)==null?void 0:y.id)===_?B.target:B.source:void 0);if(!P)continue;const k=P.waypoints,N=k!=null&&k.length?{x:k[Math.floor((k.length-1)/2)].x,y:k[Math.floor((k.length-1)/2)].y,width:0,height:0}:{x:P.x,y:P.y,width:P.width,height:P.height},G={width:h.width,height:h.height},q={x:h.x+h.width/2,y:h.y+h.height/2},Y=M==null?void 0:M.side,re=mv(r,N,b),K=[];if(Y&&Y in pl&&K.push(fl(r,N,G,b,{placement:{side:Y,offset:(M==null?void 0:M.offset)??null},selfId:_})),re&&!dl(q,G,re))for(const V of dT)K.push(fl(r,N,G,b,{placement:{side:V,offset:null},selfId:_}));for(const[V,X]of[[-1,0],[1,0],[0,-1],[0,1]])for(let ue=1;ue<=pT;ue++)K.push({x:q.x+V*gv*ue,y:q.y+X*gv*ue});const Ce=p(_)?We(r):l,Ae={...Ce,edges:Ce.edges.filter(V=>V.id!==(B==null?void 0:B.id))},Te=s(Ae),de=Te.filter(V=>_s(V).includes(_)).length;if(!de)continue;let z,oe=!1;for(const V of K){const X=V.x-q.x,ue=V.y-q.y;if(!X&&!ue||V.x-G.width/2<b.x||V.x+G.width/2>b.x+b.width||V.y-G.height/2<b.y||V.y+G.height/2>b.y+b.height||re&&!dl(V,G,re))continue;const be={...Ae,shapes:Ae.shapes.map(R=>R.id===_?{...R,x:R.x+X,y:R.y+ue}:R)},$e=o.has(_)?s(be):ht(be).filter(R=>!t.has(lt(R))||_s(R).includes(_)),F=$e.filter(R=>_s(R).includes(_)).length;if(F>=de||$e.length>Te.length)continue;const C=Math.abs(X)+Math.abs(ue);if(oe||((!z||F<z.mine||F===z.mine&&($e.length<z.all||$e.length===z.all&&C<z.dist))&&(z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C}),z.mine===0&&z.all<Te.length&&(oe=!0)),F===0&&$e.length<Te.length&&vT(e,h,X,ue)===0){z={x:V.x,y:V.y,mine:F,all:$e.length,dist:C};break}}z&&a.moveElements([h],{x:z.x-q.x,y:z.y-q.y})}}const bT=60;function hl(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 wT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=_=>ht(_).filter(h=>!t.has(lt(h))),a=_=>_.filter(h=>h.kind==="pool-overlap"),s=new Map(n.shapes.map(_=>[_.id,_])),c=(_,h)=>h.x>=_.x&&h.y>=_.y&&h.x+h.width<=_.x+_.width&&h.y+h.height<=_.y+_.height,l=_=>{if(!s.get(_))return[_];const v=new Set,b=new Set([_]);for(let M=0;M<4;M++){let B=!1;for(const P of n.shapes)P.type!=="bpmn:Group"||v.has(P.id)||[...b].some(k=>{const N=s.get(k);return N&&c(P,N)})&&(v.add(P.id),B=!0);for(const P of n.shapes)P.type!=="bpmn:Participant"||b.has(P.id)||[...v].some(k=>{const N=s.get(k);return N&&c(N,P)})&&(b.add(P.id),B=!0);if(!B)break}const E=n.shapes.filter(M=>!M.parent&&!b.has(M.id)&&!v.has(M.id)&&M.type!=="bpmn:Group"&&M.type!=="bpmn:Participant").filter(M=>[...v].some(B=>{const P=s.get(B);return P&&c(P,M)})).map(M=>M.id);return[...b,...v,...E]},u=r(We(i)),p=a(u).length;if(!p)return;const d=u.length,f=[];let m=0,g=p,y=d;for(let _=0;_<6;_++){const h=We(i),v=a(r(h));if(!v.length)break;const b=new Map(h.shapes.map(k=>[k.id,k]));let E=null;for(const k of v){if(k.kind!=="pool-overlap")continue;const[N,G]=k.pools,q=b.get(N),Y=b.get(G);if(!q||!Y)continue;const[re,K]=q.x<=Y.x?[q,Y]:[Y,q];if(k.contained)continue;const Ce=s.get(re.id),Ae=s.get(K.id),Te=Ce&&Ae?Math.max(Ae.x-(Ce.x+Ce.width),0):bT,de=re.x+re.width+Te-K.x;if(de<=0)continue;const z=l(K.id).filter(oe=>i.get(oe));z.length&&(!E||de>E.dx)&&(E={movers:z,dx:de})}if(!E)break;const M=E.movers.map(k=>i.get(k)).filter(k=>!!k&&typeof k.x=="number");if(!M.length)break;o.moveElements(M,{x:E.dx,y:0}),f.push({els:M,dx:E.dx});const B=r(We(i)),P=a(B).length;P<p&&B.length<=d&&(P<g||P===g&&B.length<y||m===0)&&(m=f.length,g=P,y=B.length)}for(const{els:_,dx:h}of f.slice(m).reverse())o.moveElements(_,{x:-h,y:0})}const Es=.5,$d=150;function _T(e,t){const n=t.shapes.filter(i=>i.type==="bpmn:Participant");if(!(n.length<2))for(const i of ET(n))i.length<n.length&&i.some(r=>Ev(e.elementRegistry.get(r.id)))||ST(e,i)}function ET(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)<=Es?o.push(i):n.push([i])}return n.filter(i=>i.length>=2)}function Ev(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 ST(e,t){const{elementRegistry:n}=e,i=e.modeling,o=t.map(h=>h.x+h.width),r=Math.max(...o);if(r-Math.min(...o)>Es)return;const a=t.map(h=>n.get(h.id)).filter(h=>!!h&&typeof h.x=="number");if(a.length<2)return;const s=new Map(t.map(h=>[h.id,h.x]));if(a.some(h=>Math.abs(h.x-s.get(h.id))>Es))return;const c=a.map(h=>h.x+h.width);if(Math.max(...c)-Math.min(...c)<=Es)return;const l=h=>h.x+h.width,u=h=>!!h&&typeof h.width=="number",p=h=>{const v={shapes:[],edges:[],lanes:[]},b=E=>{for(const M of E.children??[]){if("waypoints"in M&&M.waypoints){v.edges.push(M);continue}M.type!=="label"&&(M.type==="bpmn:Lane"?v.lanes.push(M):v.shapes.push(M),b(M))}};return b(h),v},d=new Map(a.map(h=>[h.id,p(h)]));let f=r;for(const h of a){const{shapes:v}=d.get(h.id),b=v.flatMap(E=>[l(E),...u(E.label)?[l(E.label)]:[]]);b.length&&(f=Math.max(f,Math.max(...b)+$d))}const m=a.filter(h=>Math.abs(l(h)-f)>Es);if(!m.length)return;for(const h of m){const v=l(h),{shapes:b,edges:E,lanes:M}=d.get(h.id);if([...b.flatMap(k=>[l(k),...u(k.label)?[l(k.label)]:[]]),...E.flatMap(k=>[...k.waypoints.map(N=>N.x),...u(k.label)?[l(k.label)]:[]])].some(k=>k>f)||[...(h.incoming??[]).map(k=>k.waypoints[k.waypoints.length-1]),...(h.outgoing??[]).map(k=>k.waypoints[0])].some(k=>!k||k.x>f||Math.abs(k.x-v)<1))return;if(f>v){const k={x:v,y:h.y,width:f-v,height:h.height},N=new Set([h.id,...b.map(q=>q.id),...E.map(q=>q.id),...M.map(q=>q.id)]);if(n.getAll().some(q=>{var K;if("waypoints"in q&&q.waypoints||q.type==="bpmn:Group"||!u(q))return!1;const Y=q.type==="label"?(K=q.labelTarget)==null?void 0:K.id:q.id;if(!Y||N.has(Y)||N.has(q.id))return!1;const re=q;return re.x<k.x+k.width&&re.x+re.width>k.x&&re.y<k.y+k.height&&re.y+re.height>k.y}))return}}const g=()=>new Set(ht(We(n)).map(lt)),y=g(),_=m.map(h=>h.width);for(const h of m)hl(i,h,f-h.x,{layout:!1});[...g()].every(h=>y.has(h))||m.forEach((h,v)=>hl(i,h,_[v],{layout:!1}))}function RT(e,t,n){const{elementRegistry:i}=e,o=e.modeling,r=l=>ht(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(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!p.length)continue;const d=p.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(d.length!==p.length)continue;const f=s(p),m=s(d),g=m.l+(l.x-f.l),y=m.t+(l.y-f.t),_=m.r+(l.x+l.width-f.r),h=m.b+(l.y+l.height-f.b),v={x:g,y,width:_-g,height:h-y};if(v.width<=0||v.height<=0||Math.abs(v.x-u.x)<1&&Math.abs(v.y-u.y)<1&&Math.abs(v.width-u.width)<1&&Math.abs(v.height-u.height)<1)continue;const b=r(We(i)).length,E={x:u.x,y:u.y,width:u.width,height:u.height};o.resizeShape(u,v),r(We(i)).length>b&&o.resizeShape(u,E)}}const gl=20,ml=10;function MT(e,t,n,i){var p,d;const{elementRegistry:o}=e,r=e.modeling,a=f=>new Set(ht(f,{includeObservationOnly:!0}).filter(m=>m.kind==="edge-along-group-boundary").map(lt)),s=We(o),c=ht(s,{includeObservationOnly:!0}).filter(f=>f.kind==="edge-along-group-boundary"&&!t.has(lt(f)));if(!c.length)return;const l=new Map(n.shapes.map(f=>[f.id,f])),u=new Map;for(const f of c)u.set(f.group,[...u.get(f.group)??[],f]);for(const[f,m]of u){const g=s.shapes.find($e=>$e.id===f);if(!((p=g==null?void 0:g.members)!=null&&p.length))continue;const y=l.get(f);if(!(!y||Math.abs(y.x-g.x)>=.5||Math.abs(y.y-g.y)>=.5||Math.abs(y.width-g.width)>=.5||Math.abs(y.height-g.height)>=.5))continue;const h=g.members.map($e=>o.get($e)).filter($e=>!!$e&&typeof $e.x=="number");if(!h.length)continue;const v=Math.min(...h.map($e=>$e.x)),b=Math.min(...h.map($e=>$e.y)),E=Math.max(...h.map($e=>$e.x+$e.width)),M=Math.max(...h.map($e=>$e.y+$e.height)),B=g.x,P=g.y,k=g.x+g.width,N=g.y+g.height;let G=B,q=P,Y=k,re=N;for(const $e of m){const F=s.edges.find(R=>R.id===$e.edge);if(!F)continue;const C=F.endpoints.some(R=>{const W=s.shapes.find(Pe=>Pe.id===R);if(!W||W.container)return!1;const J=W.x+W.width/2,fe=W.y+W.height/2;return B<J&&J<k&&P<fe&&fe<N});for(const R of un(F)){const W=R.axis==="v"?[P,N]:[B,k];Math.min(R.hi,W[1])-Math.max(R.lo,W[0])<dd||(R.axis==="v"?B<R.at&&R.at<k:P<R.at&&R.at<N)&&C||(R.axis==="v"?(Math.abs(R.at-B)<=ba&&(G=Math.max(G,R.at+gl)),Math.abs(R.at-k)<=ba&&(Y=Math.min(Y,R.at-gl))):(Math.abs(R.at-P)<=ba&&(q=Math.max(q,R.at+gl)),Math.abs(R.at-N)<=ba&&(re=Math.min(re,R.at-gl))))}}if(G>v-ml&&(G=B),q>b-ml&&(q=P),Y<E+ml&&(Y=k),re<M+ml&&(re=N),G===B&&q===P&&Y===k&&re===N)continue;const K=o.get(f),Ce={x:K.x,y:K.y,width:K.width,height:K.height},Ae=We(o),Te=new Set(ht(Ae).map(lt)),de=a(Ae);r.resizeShape(K,{x:G,y:q,width:Y-G,height:re-q});let z=We(o),oe=ht(z).filter($e=>!Te.has(lt($e)));const V=[];if(oe.length>0&&oe.every($e=>$e.kind==="label-over-line"&&!i.has($e.edge)&&z.edges.some(F=>F.id===$e.edge))){for(const $e of oe){if($e.kind!=="label-over-line")continue;const F=z.edges.find(fe=>fe.id===$e.edge),C=F&&Dd(F,z),R=(d=o.get($e.edge))==null?void 0:d.label;if(!C||!R)continue;const W=C.x-R.x,J=C.y-R.y;r.moveElements([R],{x:W,y:J}),V.push({label:R,dx:W,dy:J})}z=We(o),oe=ht(z).filter($e=>!Te.has(lt($e)))}const ue=a(z),be=[...ue].some($e=>!de.has($e));if(oe.length||be||ue.size>=de.size){for(const $e of V.reverse())r.moveElements([$e.label],{x:-$e.dx,y:-$e.dy});r.resizeShape(K,Ce)}}}function CT(e,t,n,i){var c;const o=n.getRootElement().businessObject,r=Wp((o==null?void 0:o.$parent)??o),a=ps(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:Up(u,i,r),requests:Xp(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 Fd(e,t,n={}){var Ae,Te;const{i18n:i,lower:o=_v}=n,r=fv(e),a=my(r.elementRegistry),s=ov(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=XA(t,a,i),u=i&&l.writes.size?CT(l.writes,r.elementRegistry,r.canvas,i):void 0,p=We(r.elementRegistry),d=new Set(ht(p).map(lt)),f=new Set(ht(p,{includeObservationOnly:!0}).map(lt)),m=new Set(yv(l.ops,de=>{var z,oe;return(oe=(z=r.elementRegistry.get(de))==null?void 0:z.source)==null?void 0:oe.id}).keys()),g=new Set(p.edges.map(de=>de.id).filter(de=>!m.has(de))),y=new Set(t.flatMap(de=>de.kind==="sequenceFlow.update"&&(de.source!==void 0||de.target!==void 0)?[de.id]:[])),_=()=>new Set(p.edges.filter(de=>{var oe;const z=(oe=r.elementRegistry.get(de.id))==null?void 0:oe.waypoints;return z?!(z.length===de.waypoints.length&&de.waypoints.every((V,X)=>Math.round(V.x)===Math.round(z[X].x)&&Math.round(V.y)===Math.round(z[X].y))):!1}).map(de=>de.id)),h=(de,z)=>new Set([...de].filter(oe=>!z.has(oe))),v=new Set(p.shapes.map(de=>de.id)),b=new Set(t.flatMap(de=>de.kind==="annotation.update"&&de.placement?[de.id]:[])),E=eo(p),M=E.length,B=new Set(E.map(([de,z])=>`${de}|${z}`)),P=Ei(p),k=new Set(P.map(([de,z])=>`${de}|${z}`)),N=new Map;for(const de of r.elementRegistry.filter(z=>"waypoints"in z&&!!z.waypoints))de.label&&N.set(de.id,{wps:de.waypoints.map(z=>({x:z.x,y:z.y})),label:{x:de.label.x,y:de.label.y},source:(Ae=de.source)==null?void 0:Ae.id,target:(Te=de.target)==null?void 0:Te.id});const G=e.get("commandStack");try{gT(r,l.writes),vm(G,()=>{o(l.ops,r);for(const X of(u==null?void 0:u.contexts())??[])G.execute(Yp,X);wT(r,d,p),_T(r,p),RT(r,d,p),EA(r,p,y),bA(r,g,v),Py(r,g);const de=_d(r,d),z=uA(r,mT(r),g,y);Sy(r,B,g);const oe=_(),V=Wy(r,d,h(g,oe),oe);Iy(r,g),IA(r,g,y),Hy(r,d,g),VA(r,d,g),yA(r,k,g),TA(r,g,p),Zy(r,d,h(g,_())),Xy(r,g,new Set([...y,...V,...z])),Qy(r,v),xT(r,d,v,de,b),_d(r,d,de),MT(r,f,p,g),ev(r,d),Ky(r,N,hT(r))})}catch(de){return{ok:!1,issues:[de instanceof vv?de.issue:{kind:"lower-failed",message:de instanceof Error?de.message:String(de)}],findings:[],stats:c}}const q=We(r.elementRegistry),Y=yT(p,q,de=>{var V,X,ue;const z=r.elementRegistry.get(de),oe=[...(z==null?void 0:z.incoming)??[],...(z==null?void 0:z.outgoing)??[]].find(be=>be.type==="bpmn:Association");return oe&&(((V=oe.source)==null?void 0:V.id)===de?(X=oe.target)==null?void 0:X.id:(ue=oe.source)==null?void 0:ue.id)}),re=ht(q,{includeObservationOnly:!0}).filter(de=>!f.has(lt(de))||_s(de).some(z=>Y.has(z))),K=ay(q),Ce=Ei(q);return{ok:!0,issues:[],findings:re,stats:{edgeCrossings:{before:M,after:K.pairs.length,pairs:K.pairs,solidPairs:K.solidPairs,dashedPairs:K.dashedPairs,mixedPairs:K.mixedPairs,crossPoolMessages:K.crossPoolMessages},sharedEndpointCrossings:{before:P.length,after:Ce.length,pairs:Ce}}}}function AT(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Sv(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Rv(e,t){const n=Sv(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Mv(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(o=>(o==null?void 0:o.$type)===t)}function TT(e){return typeof e=="string"&&jp.includes(e)}function Vi(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Cv(e,t={}){const n=e.rootElements??[],i=n.find(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:{}},d=[],f=[],m=[],g=[],y=[],_=[],h=[],v=new Map,b=new Set,E=new Set,M=z=>{z&&b.add(z)},B=z=>{b.add(z),E.add(z)},P=z=>{const oe=Mv(z,"bwl:Placement");if(!oe)return;const V=typeof oe.anchor=="string"?oe.anchor:void 0;if(!V||!TT(oe.side))return;const X=typeof oe.offset=="number"?oe.offset:void 0;y.push({owner:z.id,anchor:V,side:oe.side,...X!==void 0?{offset:X}:{}})},k=z=>{const oe=Mv(z,"bwl:Members"),V=typeof(oe==null?void 0:oe.refs)=="string"?oe.refs.split(/\s+/).filter(Boolean):[];V.length&&h.push({owner:z.id,refs:V})},N=z=>{var oe;for(const V of z)switch(M(V.id),V.$type){case"bpmn:TextAnnotation":B(V.id),v.set(V.id,V),c.push({id:V.id,text:typeof V.text=="string"?V.text:""}),P(V);break;case"bpmn:Association":m.push({id:V.id,type:V.$type,source:Vi(V.sourceRef),target:Vi(V.targetRef)});break;case"bpmn:Group":{B(V.id),v.set(V.id,V);const X=(oe=V.categoryValueRef)==null?void 0:oe.value;l.push({id:V.id,...typeof X=="string"&&X?{name:X}:{}}),k(V);break}default:u.push({id:V.id,type:V.$type,reason:"type-outside-mvp"})}},G=z=>{for(const oe of z.flowElements??[])M(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"}),(oe.flowElements??[]).length&&G(oe);for(const oe of z.artifacts??[])M(oe.id),u.push({id:oe.id,type:oe.$type,reason:"inside-container"})},q=(z,oe)=>{const V=z.flowElements??[],X=(z.laneSets??[]).flatMap(be=>be.lanes??[]),ue=new Map;for(const be of X){M(be.id),v.set(be.id,be);for(const $e of be.flowNodeRef??[]){const F=Vi($e);F&&ue.set(F,be.id)}}for(const be of V){if(M(be.id),v.set(be.id,be),be.$type==="bpmn:SequenceFlow"){d.push({id:be.id,source:Vi(be.sourceRef),target:Vi(be.targetRef),...typeof be.name=="string"&&be.name?{name:be.name}:{}});continue}if(be.$type==="bpmn:DataStoreReference"){B(be.id),s.push({id:be.id,...be.name?{name:be.name}:{}});continue}const $e=AT(be.$type),F=$e==="intermediateCatchEvent"?$p((be.eventDefinitions??[]).map(J=>J.$type)):void 0;if(!dm($e)||$e==="intermediateCatchEvent"&&!F){u.push({id:be.id,type:be.$type,reason:"type-outside-mvp"});continue}B(be.id);const C=$e==="boundaryEvent"?Vi(be.attachedToRef):void 0;a.push({id:be.id,type:$e,...be.name?{name:be.name}:{},...oe?{participant:oe}:{},...ue.has(be.id)?{lane:ue.get(be.id)}:{},...C?{attachedTo:C}:{},...F?{eventDefinition:F}:{}}),$e==="subProcess"&&G(be);const R=Rv(be,"bwl:band");R!==void 0&&(p.bands[be.id]=R);const W=Sv(be,"bwl:afterColumn");typeof W=="string"&&W!==""&&_.push([be.id,W]);for(const J of be.dataOutputAssociations??[])M(J.id),g.push({id:J.id,type:J.$type,source:be.id,target:Vi(J.targetRef)});for(const J of be.dataInputAssociations??[])M(J.id),g.push({id:J.id,type:J.$type,source:Vi((J.sourceRef??[])[0]),target:be.id})}N(z.artifacts??[])};if(i){const z=new Set;for(const oe of i.participants??[]){B(oe.id),v.set(oe.id,oe);const V=Vi(oe.processRef);V&&z.add(V);const X=V?o.get(V):void 0,ue=((X==null?void 0:X.laneSets)??[]).flatMap(C=>C.lanes??[]),be=ue.map(C=>({id:C.id,...C.name?{name:C.name}:{}}));for(const C of be)B(C.id);const $e=!X||(X.flowElements??[]).length===0&&ue.length===0&&(X.artifacts??[]).length===0;r.push({id:oe.id,...oe.name?{name:oe.name}:{},...$e?{blackBox:!0}:{},...be.length?{lanes:be}:{}});const F=Rv(oe,"bwl:poolOrder");F!==void 0&&(p.poolOrders[oe.id]=F),X&&q(X,oe.id)}for(const oe of i.messageFlows??[])M(oe.id),v.set(oe.id,oe),f.push({id:oe.id,source:Vi(oe.sourceRef),target:Vi(oe.targetRef),...typeof oe.name=="string"&&oe.name?{name:oe.name}:{}});N(i.artifacts??[]);for(const[oe,V]of o)!z.has(oe)&&(V.flowElements??[]).length>0&&u.push({id:oe,type:V.$type,reason:"unreachable-process"})}else for(const z of o.values())q(z);const Y=[],re=[],K=[],Ce=[],Ae=(z,oe)=>!!z&&!!oe&&E.has(z)&&E.has(oe);for(const z of d){if(!Ae(z.source,z.target)){u.push({id:z.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}Y.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of f){if(!Ae(z.source,z.target)){u.push({id:z.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}re.push({id:z.id,source:z.source,target:z.target,...z.name?{name:z.name}:{}}),E.add(z.id)}for(const z of g){if(!Ae(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}Ce.push({...z.id?{id:z.id}:{},source:z.source,target:z.target}),z.id&&E.add(z.id)}for(const z of m){if(!Ae(z.source,z.target)){u.push({id:z.id??"",type:z.type,reason:"endpoint-outside-mvp"});continue}K.push({...z.id?{id:z.id}:{},source:z.source,target:z.target})}const Te=new Map(l.map(z=>[z.id,z]));for(const{owner:z,refs:oe}of h){const V=oe.filter(ue=>b.has(ue)),X=Te.get(z);X&&V.length&&(X.members=V)}for(const z of y)b.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 _)b.has(oe)&&(p.afterColumns[z]=oe);const de={...r.length?{participants:r}:{},nodes:a,sequenceFlows:Y,...re.length?{messageFlows:re}:{},...s.length?{dataStores:s}:{},...Ce.length?{dataAssociations:Ce}:{},...c.length?{annotations:c}:{},...K.length?{associations:K}:{},...l.length?{groups:l}:{}};return t.i18n?{definition:de,hints:p,omitted:u,i18n:PT(de,v,e,t.i18n)}:{definition:de,hints:p,omitted:u}}function PT(e,t,n,i){const o=Wp(n),r=ps(i),a=[],s=(c,l)=>{const u=t.get(c.id);if(!u)return;const p=Up(u,i,o);Object.keys(p).length&&(c[l]=p);for(const d of Xp(u))r.includes(d.locale)&&a.push({id:c.id,...d})};for(const c of e.participants??[]){s(c,"names");for(const l of c.lanes??[])s(l,"names")}for(const c of[e.nodes,e.sequenceFlows,e.messageFlows,e.dataStores,e.groups])for(const l of c??[])s(l,"names");for(const c of e.annotations??[])s(c,"texts");return{designLocale:i.designLocale,companionLocales:r.slice(1),reviewRequests:a}}async function kT(e,t={}){const{definitions:n,warnings:i}=await xa(e);return{...Cv(n,t),warnings:i}}const OT=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function jd(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function DT(e){return jd(e.processRef)!==void 0}function LT(e){const t=new Set,n=o=>{const r=jd(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 IT(e){const t=[],n=i=>{for(const o of i.flowElements??[])OT.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 BT(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 Hd(e){const t=[],n=e.rootElements??[],i=LT(e);for(const r of IT(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??[])DT(s)&&BT(r.get(jd(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 NT(e){const{definitions:t,warnings:n}=await xa(e);return{issues:Hd(t),warnings:n}}const $T=.5,FT=8,jT=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Sa=e=>typeof e=="number"?e:Number(e??NaN),yl=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function HT(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}=${yl(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=>`${yl(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(yl).sort().join(",")}]`);const o=t.conditionExpression;return o&&typeof o.body=="string"&&n.push(`cond=${o.body}`),n.join("|")}function zT(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?[Sa(s.x),Sa(s.y),Sa(s.width),Sa(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=yl(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,o(s.bounds));else{const p=Array.isArray(s.waypoint)?s.waypoint:[];i(l,p.flatMap(d=>[Sa(d.x),Sa(d.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,o(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&r(l)};return r(e.diagrams),{body:t,labels:n}}function Av(e){const t=zT(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:")&&!jT.has(s)&&n.set(c,{type:s,props:HT(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 Tv(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),o=t===""?[]:t.split(",").map(Number);return i.length!==o.length?!0:i.some((r,a)=>Math.abs(r-o[a])>n)}function Pv(e,t,n={}){const i=n.moveTolerance??$T,o=Av(e),r=Av(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||Tv(p.geometry,u.geometry,i)||Tv(p.label,u.label,n.labelTolerance??FT))&&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 GT(e,t,n={}){const[i,o]=await Promise.all([xa(e),xa(t)]);return{...Pv(i.definitions,o.definitions,n),warnings:[...i.warnings,...o.warnings]}}function VT(e){return new Set([...e.added,...e.modified])}function kv(e){return e.get("moddle").ids}function Ov(e,t,n){const i=Object.prototype.hasOwnProperty.call(e,"nextPrefixed"),o=e.nextPrefixed;e.nextPrefixed=t;try{return n()}finally{i?e.nextPrefixed=o:delete e.nextPrefixed}}function Dv(e,t){const n=kv(e),i=n.nextPrefixed,o=[];return{value:Ov(n,function(a,s){const c=i.call(this,a,s);return o.push(c),c},t),generatedIds:o}}function Lv(e,t,n){const i=kv(e),o=i.nextPrefixed;let r=0,a=0,s=0;return{value:Ov(i,function(l,u){const p=t[r++];return p!==void 0&&p.startsWith(l)&&!this.assigned(p)?(this.claim(p,u),a++,p):(s++,o.call(this,l,u))},n),fed:a,missed:s,remaining:Math.max(0,t.length-r)}}function WT(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Iv(e,t,{currentVersion:n,i18n:i,recordGeneratedIds:o=!1}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const r=()=>Fd(e,t.ops,{i18n:i}),{value:a,generatedIds:s}=o?Dv(e,r):{value:r(),generatedIds:void 0};if(!a.ok)return{status:"rejected",issues:a.issues};const{xml:c}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:c??"",findings:a.findings,stats:a.stats,...s?{generatedIds:s}:{}}}const Ss=()=>typeof performance>"u"?Date.now():performance.now();function UT(e){return e.slice(0,3).map(t=>`${t.kind}${"message"in t&&t.message?`: ${t.message}`:""}`).join(" / ").slice(0,300)}class zd extends Error{constructor(t,n){super(n),this.reason=t}}async function Bv(e,t,{expectedXml:n,i18n:i}){const o=Ss(),r=e.get("headlessReplay",!1);if(!r)return{status:"diverged",reason:"unsupported",detail:"HeadlessReplayModule 미탑재",ms:Math.round(Ss()-o)};if(!t.length)return{status:"diverged",reason:"unsupported",detail:"배치 없음",ms:Math.round(Ss()-o)};const a=e.get("commandStack"),s=xm(a),c=t.flatMap(p=>p.generatedIds);let l;try{r.run(()=>{const p=Lv(e,c,()=>{t.forEach((d,f)=>{f>0&&r.atBatchBoundary();const m=Fd(e,d.ops,{...i?{i18n:i}:{}});if(!m.ok)throw new zd("rejected",`배치 ${f+1}/${t.length} — ${UT(m.issues)}`)})});if(p.missed||p.remaining)throw new zd("ids",`주입 ${p.fed} · 떨어짐 ${p.missed} · 남음 ${p.remaining} / ${c.length}`)})}catch(p){l=p instanceof zd?{reason:p.reason,detail:p.message}:{reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}const u=bm(a,s);if(!l)try{const{xml:p}=await e.saveXML({format:!0});p!==n&&(l={reason:"xml"})}catch(p){l={reason:"error",detail:(p instanceof Error?p.message:String(p)).slice(0,300)}}return l?(u&&a.undo(),{status:"diverged",...l,ms:Math.round(Ss()-o)}):{status:"replayed",ms:Math.round(Ss()-o)}}const qT=new Set(["lasso","lasso.selection","hand","hand.move"]),Nv=1e4,YT="bwl-edit-locked",$v=new WeakMap;function KT(e){const t=$v.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",Nv,()=>{var s;if(o)return qT.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"],Nv,()=>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(YT,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 $v.set(e,a),a}const XT=Symbol("bpmn-editor"),Gd={geometry:[],semantic:[]};function ZT(){const e=Se.ref(!1),t=Se.ref(!0),n=Se.ref(!1),i=Se.shallowRef(Gd),o=Se.shallowRef(void 0),r=Se.shallowRef(void 0);let a,s,c,l=!1;const u=()=>{if(d(),!c){i.value=Gd;return}const h=ht(We(c.get("elementRegistry")),{includeObservationOnly:!0}),v=c.getDefinitions();i.value={geometry:h,semantic:v?Hd(v):[]}};function p(){return(c==null?void 0:c.get("i18nDisplay",!1))??void 0}function d(){const h=p();if(!h||!a){r.value=void 0;return}const v=h.locales(),b={};for(const E of v)b[E]={untranslated:h.untranslatedCount(E),reviewRequested:h.reviewRequestedCount(E)};r.value={designLocale:a.designLocale,locales:v,displayLocale:h.getDisplayLocale()??a.designLocale,counts:b}}function f(){const h=p();h&&(h.configure(a),a&&s&&(s=h.setDisplayLocale(s)))}const m=()=>{l||(e.value=!0,u())};function g(h,v){KT(h).set(!v)}function y(){if(!c)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return c}function _(){return c==null?void 0:c.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:u,changeScope:o,i18n:r,configureI18n(h){a=h,f(),d()},setDisplayLocale(h){var b;s=h;const v=(b=p())==null?void 0:b.setDisplayLocale(h);v&&(s=v),d()},setChangeScope(h){o.value=h===void 0?void 0:new Set(h)},requestFocus(h){if(!c)return;const v=c.get("elementRegistry").get(h);v&&(c.get("canvas").scrollToElement(v,180),c.get("selection").select(v))},describeElement(h){const v=c==null?void 0:c.get("elementRegistry").get(h),b=v==null?void 0:v.businessObject;if(!b)return;const E=typeof b.name=="string"&&b.name.trim()!==""?b.name:b.text;return{name:typeof E=="string"&&E.trim()!==""?E.trim():void 0,type:typeof b.$type=="string"?b.$type:""}},attach(h){c&&this.detach(),c=h,c.get("eventBus").on("commandStack.changed",m),t.value||g(c,!1),f(),u()},detach(){c==null||c.get("eventBus").off("commandStack.changed",m),c&&!t.value&&g(c,!0),c=void 0,i.value=Gd,o.value=void 0,r.value=void 0},setEditable(h){t.value=h,c&&g(c,h)},async applyAgentBatch(h,v){const b=y();n.value=!0;try{const E=await Iv(b,h,{currentVersion:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return E.status==="applied"&&(e.value=!1),E}finally{n.value=!1}},async replayAgentTurn(h,v){const b=y(),E=e.value;n.value=!0,l=!0;try{const M=await Bv(b,h,{expectedXml:v,...a?{i18n:{designLocale:a.designLocale,companionLocales:a.companionLocales}}:{}});return e.value=M.status==="replayed"?!1:E,M}finally{l=!1,n.value=!1,u()}},async importXml(h){const{warnings:v}=await y().importXML(h);return e.value=!1,o.value=void 0,u(),{warnings:pd(v)}},async saveXml(){const{xml:h}=await y().saveXML({format:!0});return e.value=!1,h??""},undo:()=>{var h;return(h=_())==null?void 0:h.undo()},redo:()=>{var h;return(h=_())==null?void 0:h.redo()},canUndo:()=>{var h;return((h=_())==null?void 0:h.canUndo())??!1},canRedo:()=>{var h;return((h=_())==null?void 0:h.canRedo())??!1}}}const JT=new RegExp("\\p{Script=Hangul}","u"),QT=/[\p{Script=Hiragana}\p{Script=Katakana}]/u,eP=new RegExp("\\p{Script=Han}","u");function vl(e){const t=JT.test(e),n=QT.test(e);return t&&n?{script:"mixed"}:t?{script:"hangul",locale:"ko"}:n?{script:"kana",locale:"ja"}:{script:eP.test(e)?"han":"other"}}function Fv(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 jv(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=Dr(a);if(!s)continue;const c=s.target[s.key]??"";c&&n.push({bo:a,name:c,trs:Vo(a).filter(l=>An(l))})}return n}const Rs=e=>({id:e.bo.id,type:e.bo.$type,name:e.name});function tP(e,t={}){const n=Fv(e),i=jv(e);let o;const r={},a=[],s=[],c=[];for(const g of i){const y=g.trs.filter(_=>(_.body??"")===g.name).map(An);if(y.length){const _=[...y].sort().join("+");r[_]=(r[_]??0)+1,o=o?new Set([...o].filter(h=>y.includes(h))):new Set(y)}else g.trs.some(_=>_.body)?a.push(Rs(g)):c.push({e:g,inference:vl(g.name)});for(const _ of g.trs){const h=An(_),v=_.body??"",b=vl(v);b.locale&&b.locale!==h?s.push({...Rs(g),locale:h,script:b.script}):h==="ko"&&b.script==="han"&&g.trs.some(E=>E!==_&&E.body===v)&&s.push({...Rs(g),locale:h,script:"han"})}}const l=new Set(c.map(g=>g.inference.locale).filter(Boolean));let u,p;if(n)p="kept";else if(o&&o.size===1)[u,p]=[[...o][0],"matched"];else if(o&&o.size>1){const g=l.size===1?[...l][0]:void 0;g&&o.has(g)?[u,p]=[g,"matched"]:p="ambiguous"}else o?p="mixed":l.size===1?[u,p]=[[...l][0],"script"]:p=l.size>1?"mixed":"no-evidence";u&&t.designLocale&&u!==t.designLocale&&([u,p]=[void 0,"non-design"]);const d=n??u,f=[],m=[];for(const{e:g,inference:y}of c)y.locale?y.locale!==d&&f.push({...Rs(g),locale:y.locale}):m.push({...Rs(g),script:y.script});return{root:{current:n,proposed:u,reason:p},additions:f,undecided:m,drift:a,matchedBy:r,scriptMismatch:s}}function nP(e,t){const n=e.$model;let i=0;if(t.root.proposed&&!Fv(e)&&(e.set("xml:lang",t.root.proposed),i++),!t.additions.length)return i;const o=new Map(jv(e).map(r=>[r.bo.id,r]));for(const{id:r,name:a,locale:s}of t.additions){const c=o.get(r);if(!c||c.name!==a||c.trs.some(d=>d.body))continue;const l=c.trs.find(d=>An(d)===s);if(l){l.body=c.name,i++;continue}let u=c.bo.extensionElements;u||(u=n.create("bpmn:ExtensionElements",{values:[]}),u.$parent=c.bo,c.bo.extensionElements=u);const p=n.create(Or,{body:c.name});p.set("xml:lang",s),p.$parent=u,u.get("values").push(p),i++}return i}function Hv(e){var i;const t=new Set,n=[];for(const o of(e==null?void 0:e.diagrams)??[])for(const r of((i=o==null?void 0:o.plane)==null?void 0:i.planeElement)??[]){const a=r==null?void 0:r.bpmnElement;!(a!=null&&a.id)||t.has(a)||(t.add(a),n.push(a))}return n}const Vd=e=>An(e)||void 0,zv=e=>e.body??"";function Gv(e){const t=new Map;for(const n of Hv(e)){const i=Vo(n);i.length&&t.set(n.id,{type:n.$type,cells:i.map(o=>({locale:Vd(o),body:zv(o)}))})}return t}const Vv=e=>JSON.stringify(e.map(t=>t.body).sort());class iP{constructor(){ln(this,"byId",new Map);ln(this,"byBodies",new Map)}add(t,n,i){for(const[o,r]of i){if(!r.cells.some(s=>s.locale))continue;const a={doc:t,version:n,id:o,state:r};Wv(this.byId,o,a),Wv(this.byBodies,Vv(r.cells),a)}}sameId(t){return this.byId.get(t)??[]}sameBodies(t){return this.byBodies.get(Vv(t))??[]}}function Wv(e,t,n){const i=e.get(t);i?i.push(n):e.set(t,[n])}function oP(e,t,n){var s;const i=new Set(t.cells.filter(c=>c.locale).map(c=>c.body)),o=new Map,r=(c,l)=>(c??[]).filter(u=>!u.locale&&u.body===l).length,a=t.cells.every(c=>!c.locale);for(const c of t.cells){if(c.locale||i.has(c.body)||o.has(c.body))continue;const l=r(t.cells,c.body)-(a?0:n?r((s=n.get(e))==null?void 0:s.cells,c.body):1/0);l>0&&o.set(c.body,l)}return o}function Wd(e,t){return[...t.keys()].every(n=>e.cells.some(i=>i.body===n))&&e.cells.some(n=>n.locale&&t.has(n.body))}function rP(e,t,n){const i=new Set(e.cells.filter(r=>r.locale).map(r=>r.locale)),o={cells:[],stale:[],overflow:!1};for(const[r,a]of n){const s=[...new Set(t.cells.filter(l=>l.body===r&&l.locale).map(l=>l.locale))],c=s.filter(l=>!i.has(l));for(const l of s)i.has(l)&&o.stale.push({body:r,locale:l});c.length>a&&(o.overflow=!0);for(const l of c.slice(0,a))o.cells.push({body:r,locale:l}),i.add(l)}return o}const aP=e=>JSON.stringify([...e.cells].sort((t,n)=>(t.body+t.locale).localeCompare(n.body+n.locale)));function sP(e,t){const n={restores:[],ambiguous:[],stale:[],unresolved:[]},i=Gv(e),o=new Set([...i.values()].flatMap(a=>a.cells.map(s=>s.locale).filter(s=>!!s))),r=a=>!o.size||[...o].some(s=>!a.cells.some(c=>c.locale===s));for(const[a,s]of i){const c=oP(a,s,t.baseline);if(!c.size)continue;const l={id:a,type:s.type},p=[["history",t.index.sameId(a).filter(y=>y.doc===t.doc&&Wd(y.state,c)).sort((y,_)=>_.version-y.version).slice(0,1).map(y=>y.state)],["lineage",t.index.sameId(a).filter(y=>y.doc!==t.doc&&Wd(y.state,c)).map(y=>y.state)],["bodies",t.index.sameBodies(s.cells).filter(y=>!(y.doc===t.doc&&y.id===a)&&Wd(y.state,c)).map(y=>y.state)]].find(([,y])=>y.length);if(!p){if(!r(s))continue;for(const[y,_]of c)for(let h=0;h<_;h++)n.unresolved.push({...l,body:y,script:vl(y).script});continue}const[d,f]=p,m=f.map(y=>rP(s,y,c));if(m.some(y=>y.overflow)||new Set(m.map(aP)).size>1){n.ambiguous.push({...l,source:d});continue}const[g]=m;for(const y of g.stale)n.stale.push({...l,...y});g.cells.length&&n.restores.push({...l,source:d,cells:g.cells})}return n}function cP(e,t){if(!t.restores.length)return 0;const n=new Map(Hv(e).map(o=>[o.id,o]));let i=0;for(const o of t.restores){const r=n.get(o.id);if(!r)continue;const a=Vo(r),s=new Set(a.map(Vd).filter(Boolean));for(const{body:c,locale:l}of o.cells){if(s.has(l))continue;const u=a.find(p=>!Vd(p)&&zv(p)===c);u&&(u.set("xml:lang",l),s.add(l),i++)}}return i}function Ne(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function lP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ud={exports:{}},Uv;function uP(){if(Uv)return Ud.exports;Uv=1;var e=Ud.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},Ud.exports}var pP=uP(),dP=lP(pP);function to(e){if(!(this instanceof to))return new to(e);e=e||[128,36,1],this._seed=e.length?dP.rack(e[0],e[1],e[2]):e}to.prototype.next=function(e){return this._seed(e||!0)},to.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},to.prototype.claim=function(e,t){this._seed.set(e,t||!0)},to.prototype.assigned=function(e){return this._seed.get(e)||!1},to.prototype.unclaim=function(e){delete this._seed.hats[e]},to.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const wn={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};wn.td=wn.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],wn.option=wn.optgroup=[1,'<select multiple="multiple">',"</select>"],wn.thead=wn.tbody=wn.colgroup=wn.caption=wn.tfoot=[1,"<table>","</table>"],wn.polyline=wn.ellipse=wn.polygon=wn.circle=wn.text=wn.line=wn.path=wn.rect=wn.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Vt(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(wn,i)?wn[i]:wn._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 fP(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 Kn(e,...t){const n=e.style;return U(t,function(i){i&&U(i,function(o,r){n[r]=o})}),e}function Tn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const hP=Object.prototype.toString;function Pt(e){return new Xo(e)}function Xo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Xo.prototype.add=function(e){return this.list.add(e),this},Xo.prototype.remove=function(e){return hP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Xo.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},Xo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Xo.prototype.array=function(){return Array.from(this.list)},Xo.prototype.has=Xo.prototype.contains=function(e){return this.list.contains(e)};function xl(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Hr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function gP(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bl={},qv;function mP(){if(qv)return bl;qv=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return bl.bind=function(o,r,a,s){return e||i(),o[e](n+r,a,s||!1),a},bl.unbind=function(o,r,a,s){return t||i(),o[t](n+r,a,s||!1),a},bl}var Yv=mP(),yP=gP(Yv),Ye=fP({__proto__:null,default:yP},[Yv]),Kv=["focus","blur"];function vP(e,t,n,i,o){return Kv.indexOf(n)!==-1&&(o=!0),Ye.bind(e,n,function(r){var a=r.target||r.srcElement;r.delegateTarget=Hr(a,t,!0),r.delegateTarget&&i.call(e,r)},o)}function xP(e,t,n,i){return Kv.indexOf(t)!==-1&&(i=!0),Ye.unbind(e,t,n,i)}var ci={bind:vP,unbind:xP};function qd(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ct(e,t){return t=t||document,t.querySelector(e)}function Ms(e,t){return t=t||document,t.querySelectorAll(e)}function no(e){e.parentNode&&e.parentNode.removeChild(e)}function bP(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function wP(e,t){return t.appendChild(bP(e,t))}function ot(e,t){return wP(t,e),e}var Yd=2,Xv={"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":Yd,"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":Yd,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function _P(e,t){return Xv[t]?e.style[t]:e.getAttributeNS(null,t)}function Zv(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),o=Xv[i];o?(o===Yd&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function EP(e,t){var n=Object.keys(t),i,o;for(i=0,o;o=n[i];i++)Zv(e,o,t[o])}function De(e,t,n){if(typeof t=="string")if(n!==void 0)Zv(e,t,n);else return _P(e,t);else EP(e,t);return e}const SP=Object.prototype.toString;function mt(e){return new Zo(e)}function Zo(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zo.prototype.add=function(e){return this.list.add(e),this},Zo.prototype.remove=function(e){return SP.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zo.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},Zo.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zo.prototype.array=function(){return Array.from(this.list)},Zo.prototype.has=Zo.prototype.contains=function(e){return this.list.contains(e)};function Cs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Kd(e){return e.cloneNode(!0)}var Xd={svg:"http://www.w3.org/2000/svg"},Jv='<svg xmlns="'+Xd.svg+'"';function RP(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Xd.svg)===-1&&(e=Jv+e.substring(4)):(e=Jv+">"+e+"</svg>",t=!0);var n=MP(e);if(!t)return n;for(var i=document.createDocumentFragment(),o=n.firstChild;o.firstChild;)i.appendChild(o.firstChild);return i}function MP(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function He(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=RP(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Xd.svg,e),t&&De(n,t),n}var Zd=null;function Qv(){return Zd===null&&(Zd=He("svg")),Zd}function ex(e,t){var n,i,o=Object.keys(t);for(n=0;i=o[n];n++)e[i]=t[i];return e}function CP(e,t,n,i,o,r){var a=Qv().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return ex(a,e);case 6:return ex(a,{a:e,b:t,c:n,d:i,e:o,f:r})}}function As(e){return Qv().createSVGTransform()}var tx=/([&<>]{1})/g,AP=/([&<>\n\r"]{1})/g,TP={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Jd(e,t){function n(i,o){return TP[o]||o}return e.replace(t,n)}function nx(e,t){var n,i,o,r,a;switch(e.nodeType){case 3:t.push(Jd(e.textContent,tx));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,'="',Jd(r.value,AP),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)nx(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Jd(e.nodeValue,tx),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function PP(e){for(var t=e.firstChild,n=[];t;)nx(t,n),t=t.nextSibling;return n.join("")}function ix(e,t){return PP(e)}function pn(e){var t=e.parentNode;return t&&t.removeChild(e),e}function kP(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function OP(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(kP(e,i))}function Ts(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),OP(n,t)),n.consolidate()}const DP=/^class[ {]/;function LP(e){return DP.test(e.toString())}function Qd(e){return Array.isArray(e)}function ef(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function wl(...e){e.length===1&&Qd(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const IP=/constructor\s*[^(]*\(\s*([^)]*)\)/m,BP=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,NP=/\/\*([^*]*)\*\//m;function $P(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(LP(e)?IP:BP);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const o=i.match(NP);return(o&&o[1]||i).trim()})||[]}function ox(e,t){const n=t||{get:function(v,b){if(i.push(v),b===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],o=this._providers=Object.create(n._providers||null),r=this._instances=Object.create(null),a=r.injector=this,s=function(v){const b=i.join(" -> ");return i.length=0,new Error(b?`${v} (Resolving: ${b})`:v)};function c(v,b){if(!o[v]&&v.includes(".")){const E=v.split(".");let M=c(E.shift());for(;E.length;)M=M[E.shift()];return M}if(ef(r,v))return r[v];if(ef(o,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),r[v]=o[v][0](o[v][1]),i.pop(),r[v]}return n.get(v,b)}function l(v,b){if(typeof b>"u"&&(b={}),typeof v!="function")if(Qd(v))v=wl(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const M=(v.$inject||$P(v)).map(B=>ef(b,B)?b[B]:c(B));return{fn:v,dependencies:M}}function u(v){const{fn:b,dependencies:E}=l(v),M=Function.prototype.bind.call(b,null,...E);return new M}function p(v,b,E){const{fn:M,dependencies:B}=l(v,E);return M.apply(b,B)}function d(v){return wl(b=>v.get(b))}function f(v,b){if(b&&b.length){const E=Object.create(null),M=Object.create(null),B=[],P=[],k=[];let N,G,q,Y;for(let re in o)N=o[re],b.indexOf(re)!==-1&&(N[2]==="private"?(G=B.indexOf(N[3]),G===-1?(q=N[3].createChild([],b),Y=d(q),B.push(N[3]),P.push(q),k.push(Y),E[re]=[Y,re,"private",q]):E[re]=[k[G],re,"private",P[G]]):E[re]=[N[2],N[1]],M[re]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(K=>{N[1].$scope.indexOf(K)!==-1&&(E[re]=[N[2],N[1]],M[K]=!0)});b.forEach(re=>{if(!M[re])throw new Error('No provider for "'+re+'". Cannot use provider from the parent!')}),v.unshift(E)}return new ox(v,a)}const m={factory:p,type:u,value:function(v){return v}};function g(v,b){const E=v.__init__||[];return function(){E.forEach(M=>{typeof M=="string"?b.get(M):b.invoke(M)})}}function y(v){const b=v.__exports__;if(b){const E=v.__modules__,M=Object.keys(v).reduce((G,q)=>(q!=="__exports__"&&q!=="__modules__"&&q!=="__init__"&&q!=="__depends__"&&(G[q]=v[q]),G),Object.create(null)),B=(E||[]).concat(M),P=f(B),k=wl(function(G){return P.get(G)});b.forEach(function(G){o[G]=[k,G,"private",P]});const N=(v.__init__||[]).slice();return N.unshift(function(){P.init()}),v=Object.assign({},v,{__init__:N}),g(v,P)}return Object.keys(v).forEach(function(E){if(E==="__init__"||E==="__depends__")return;const M=v[E];if(M[2]==="private"){o[E]=M;return}const B=M[0],P=M[1];o[E]=[m[B],FP(B,P),B]}),g(v,a)}function _(v,b){return v.indexOf(b)!==-1||(v=(b.__depends__||[]).reduce(_,v),v.indexOf(b)!==-1)?v:v.concat(b)}function h(v){const b=v.reduce(_,[]).map(y);let E=!1;return function(){E||(E=!0,b.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=u,this.createChild=f,this.init=h(e)}function FP(e,t){return e!=="value"&&Qd(t)&&(t=wl(t.slice())),t}var jP=1e3;function Eo(e,t){var n=this;t=t||jP,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)})}Eo.prototype.canRender=function(e){},Eo.prototype.drawShape=function(e,t){},Eo.prototype.drawConnection=function(e,t){},Eo.prototype.getShapePath=function(e){},Eo.prototype.getConnectionPath=function(e){};function zr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function HP(e){return["M",e.x,e.y]}function tf(e){return["L",e.x,e.y]}function zP(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function GP(e,t){const n=e.length,i=[HP(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(tf(a));continue}const c=Math.min(t,nf(a.x-r.x,a.y-r.y),nf(s.x-a.x,s.y-a.y));if(!c){i.push(tf(a));continue}const l=_l(a,r,c),u=_l(a,r,c*.5),p=_l(a,s,c),d=_l(a,s,c*.5);i.push(tf(l)),i.push(zP(u,d,p))}return i}function _l(e,t,n){const i=t.x-e.x,o=t.y-e.y,r=nf(i,o),a=n/r;return{x:e.x+i*a,y:e.y+o*a}}function nf(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ps(e,t,n){et(t)&&(n=t,t=null),t||(t={});const i=He("path",t);return et(n)&&(i.dataset.cornerRadius=String(n)),of(i,e)}function of(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return De(e,{d:zr(GP(t,n))}),e}function El(e){var t=new Set(e);return ft(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Gr(e,t,n){n=n||0,Qe(e)||(e=[e]),U(e,function(i,o){var r=t(i,o,n);Qe(r)&&r.length&&Gr(r,t,n+1)})}function rf(e,t,n){var i=new Set,o=new Set;return Gr(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 ks(e,t){return rf(e)}function VP(e,t,n){kr(t)&&(t=!0),bn(t)&&(n=t,t=!0),n=n||{};var i=Os(n.allShapes),o=Os(n.allConnections),r=Os(n.enclosedElements),a=Os(n.enclosedConnections),s=Os(n.topLevel,t&&ga(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,U(u.incoming,c),U(u.outgoing,c),u.children}return Gr(e,l),{allShapes:i,allConnections:o,topLevel:s,enclosedConnections:a,enclosedElements:r}}function dn(e,t){t=!!t,Qe(e)||(e=[e]);var n,i,o,r;return U(e,function(a){var s=a;a.waypoints&&!t&&(s=dn(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 Ra(e,t){var n={};return U(e,function(i){var o=i;o.waypoints&&(o=dn(o)),!et(t.y)&&o.x>t.x&&(n[i.id]=i),!et(t.x)&&o.y>t.y&&(n[i.id]=i),o.x>t.x&&o.y>t.y&&(et(t.width)&&et(t.height)&&o.width+o.x<t.width+t.x&&o.height+o.y<t.height+t.y||!et(t.width)||!et(t.height))&&(n[i.id]=i)}),n}function rx(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ax(e){return!!(e&&e.isFrame)}function Os(e,t){return Z({},e||{},t||{})}var WP=1;function Jo(e,t){Eo.call(this,e,WP),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})}Ne(Jo,Eo),Jo.prototype.canRender=function(){return!0},Jo.prototype.drawShape=function(t,n,i){var o=He("rect");return De(o,{x:0,y:0,width:n.width||0,height:n.height||0}),ax(n)?De(o,Z({},this.FRAME_STYLE,i||{})):De(o,Z({},this.SHAPE_STYLE,i||{})),ot(t,o),o},Jo.prototype.drawConnection=function(t,n,i){var o=Ps(n.waypoints,Z({},this.CONNECTION_STYLE,i||{}));return ot(t,o),o},Jo.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 zr(a)},Jo.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 zr(r)},Jo.$inject=["eventBus","styles"];function UP(){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 Z(r,{class:n})},this.style=function(n,i){!Qe(n)&&!i&&(i=n,n=[]);var o=si(n,function(r,a){return Z(r,e[a]||{})},{});return i?Z(o,i):o},this.computeStyle=function(n,i,o){return Qe(i)||(o=i,i=[]),t.style(i||[],Z({},o,n||{}))}}const qP={__init__:["defaultRenderer"],defaultRenderer:["type",Jo],styles:["type",UP]};function rn(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function sn(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 af(e,t){return!e||!t?-1:e.indexOf(t)}function Ds(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function sf(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=Ds(e,t);return Math.abs(o/r)<=i}var YP=2;function So(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[o,r]of Object.entries(i))if(KP(o,n))return r;return!1}function KP(e,t){const n=t[0];return zo(t,function(i){return Math.abs(n[e]-i[e])<=YP})}function sx(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 XP=/,?([a-z]),?/gi,cx=parseFloat,fn=Math,Qo=fn.PI,io=fn.min,oo=fn.max,lx=fn.pow,er=fn.abs,ZP=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,JP=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,ux=Array.isArray||function(e){return e instanceof Array};function QP(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function e2(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 t2(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 QP(o,i)?(e2(r,i),o[i]):(r.length>=1e3&&delete o[r.shift()],r.push(i),o[i]=e(...arguments),o[i])}return t}function n2(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(ZP,function(i,o,r){var a=[],s=o.toLowerCase();for(r.replace(JP,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=uf,n}function i2(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 o2(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 lf(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 uf(){return this.join(",").replace(XP,"$1")}function r2(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=uf,t}function px(e,t,n,i,o,r,a,s,c){var l=1-c,u=lx(l,3),p=lx(l,2),d=c*c,f=d*c,m=u*e+p*3*c*n+l*3*c*c*o+f*a,g=u*t+p*3*c*i+l*3*c*c*r+f*s;return{x:Sl(m),y:Sl(g)}}function dx(e){var t=p2(...e);return lf(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function tr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function a2(e,t){return e=lf(e),t=lf(t),tr(t,e.x,e.y)||tr(t,e.x2,e.y)||tr(t,e.x,e.y2)||tr(t,e.x2,e.y2)||tr(e,t.x,t.y)||tr(e,t.x2,t.y)||tr(e,t.x,t.y2)||tr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function fx(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 hx(e,t,n,i,o,r,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],d=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],f=0,m=0;m<u;m++){var g=l*p[m]+l,y=fx(g,e,n,o,a),_=fx(g,t,i,r,s),h=y*y+_*_;f+=d[m]*fn.sqrt(h)}return l*f}function s2(e,t,n,i,o,r,a,s){if(!(oo(e,n)<io(o,a)||io(e,n)>oo(o,a)||oo(t,i)<io(r,s)||io(t,i)>oo(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=Sl(c/u),d=Sl(l/u),f=+p.toFixed(2),m=+d.toFixed(2);if(!(f<+io(e,n).toFixed(2)||f>+oo(e,n).toFixed(2)||f<+io(o,a).toFixed(2)||f>+oo(o,a).toFixed(2)||m<+io(t,i).toFixed(2)||m>+oo(t,i).toFixed(2)||m<+io(r,s).toFixed(2)||m>+oo(r,s).toFixed(2)))return{x:p,y:d}}}}function Sl(e){return Math.round(e*1e11)/1e11}function c2(e,t,n){var i=dx(e),o=dx(t);if(!a2(i,o))return[];var r=hx(...e),a=hx(...t),s=mx(e)?1:~~(r/5)||1,c=mx(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),p={},d=[],f,m;for(f=0;f<s+1;f++){var g=px(...e,f/s);l[f]={x:g.x,y:g.y,t:f/s}}for(f=0;f<c+1;f++)g=px(...t,f/c),u[f]={x:g.x,y:g.y,t:f/c};for(f=0;f<s;f++)for(m=0;m<c;m++){var y=l[f],_=l[f+1],h=u[m],v=u[m+1],b=er(_.x-y.x)<.01?"y":"x",E=er(v.x-h.x)<.01?"y":"x",M=s2(y.x,y.y,_.x,_.y,h.x,h.y,v.x,v.y),B;if(M){if(B=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[B])continue;p[B]=!0;var P=y.t+er((M[b]-y[b])/(_[b]-y[b]))*(_.t-y.t),k=h.t+er((M[E]-h[E])/(v[E]-h[E]))*(v.t-h.t);P>=0&&P<=1&&k>=0&&k<=1&&d.push({x:M.x,y:M.y,t1:P,t2:k})}}return d}function gx(e,t,n){e=xx(e),t=xx(t);for(var i,o,r,a,s,c,l,u,p,d,f=n?0:[],m=0,g=e.length;m<g;m++){var y=e[m];if(y[0]=="M")i=s=y[1],o=c=y[2];else{y[0]=="C"?(p=[i,o,...y.slice(1)],i=p[6],o=p[7]):(p=[i,o,i,o,s,c,s,c],i=s,o=c);for(var _=0,h=t.length;_<h;_++){var v=t[_];if(v[0]=="M")r=l=v[1],a=u=v[2];else{v[0]=="C"?(d=[r,a,...v.slice(1)],r=d[6],a=d[7]):(d=[r,a,r,a,l,u,l,u],r=l,a=u);var b=c2(p,d);{for(var E=0,M=b.length;E<M;E++)b[E].segment1=m,b[E].segment2=_,b[E].bez1=p,b[E].bez2=d;f=f.concat(b)}}}}}return f}function l2(e){return ux(e)&&ux(e[0])}function u2(e){if(i2(e))return e;var t=new Array(e.length),n=0,i=0,o=0,r=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],o=n,r=i,a++,t[0]=["M",n,i]);for(var c,l,u=a,p=e.length;u<p;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":o=+l[1]+n,r=+l[2]+i;default:for(var d=1,f=l.length;d<f;d++)c[d]=+l[d]+(d%2?n:i)}else for(var m=0,g=l.length;m<g;m++)c[m]=l[m];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=uf,t}function mx(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Rl(e,t,n,i){return[e,t,n,i,n,i]}function yx(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 vx(e,t,n,i,o,r,a,s,c,l){var u=Qo*120/180,p=Qo/180*(+o||0),d=[],f,m=t2(function(F,C,R){var W=F*fn.cos(R)-C*fn.sin(R),J=F*fn.sin(R)+C*fn.cos(R);return{x:W,y:J}});if(l)B=l[0],P=l[1],E=l[2],M=l[3];else{f=m(e,t,-p),e=f.x,t=f.y,f=m(s,c,-p),s=f.x,c=f.y;var g=(e-s)/2,y=(t-c)/2,_=g*g/(n*n)+y*y/(i*i);_>1&&(_=fn.sqrt(_),n=_*n,i=_*i);var h=n*n,v=i*i,b=(r==a?-1:1)*fn.sqrt(er((h*v-h*y*y-v*g*g)/(h*y*y+v*g*g))),E=b*n*y/i+(e+s)/2,M=b*-i*g/n+(t+c)/2,B=fn.asin(((t-M)/i).toFixed(9)),P=fn.asin(((c-M)/i).toFixed(9));B=e<E?Qo-B:B,P=s<E?Qo-P:P,B<0&&(B=Qo*2+B),P<0&&(P=Qo*2+P),a&&B>P&&(B=B-Qo*2),!a&&P>B&&(P=P-Qo*2)}var k=P-B;if(er(k)>u){var N=P,G=s,q=c;P=B+u*(a&&P>B?1:-1),s=E+n*fn.cos(P),c=M+i*fn.sin(P),d=vx(s,c,n,i,o,0,a,G,q,[P,N,E,M])}k=P-B;var Y=fn.cos(B),re=fn.sin(B),K=fn.cos(P),Ce=fn.sin(P),Ae=fn.tan(k/4),Te=4/3*n*Ae,de=4/3*i*Ae,z=[e,t],oe=[e+Te*re,t-de*Y],V=[s+Te*Ce,c-de*K],X=[s,c];if(oe[0]=2*z[0]-oe[0],oe[1]=2*z[1]-oe[1],l)return[oe,V,X].concat(d);d=[oe,V,X].concat(d).join().split(",");for(var ue=[],be=0,$e=d.length;be<$e;be++)ue[be]=be%2?m(d[be-1],d[be],p).y:m(d[be],d[be+1],p).x;return ue}function p2(e,t,n,i,o,r,a,s){for(var c=[],l=[[],[]],u,p,d,f,m,g,y,_,h=0;h<2;++h){if(h==0?(p=6*e-12*n+6*o,u=-3*e+9*n-9*o+3*a,d=3*n-3*e):(p=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*s,d=3*i-3*t),er(u)<1e-12){if(er(p)<1e-12)continue;f=-d/p,0<f&&f<1&&c.push(f);continue}y=p*p-4*d*u,_=fn.sqrt(y),!(y<0)&&(m=(-p+_)/(2*u),0<m&&m<1&&c.push(m),g=(-p-_)/(2*u),0<g&&g<1&&c.push(g))}for(var v=c.length,b=v,E;v--;)f=c[v],E=1-f,l[0][v]=E*E*E*e+3*E*E*f*n+3*E*f*f*o+f*f*f*a,l[1][v]=E*E*E*t+3*E*E*f*i+3*E*f*f*r+f*f*f*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=a,l[1][b+1]=s,l[0].length=l[1].length=b+2,{x0:io(...l[0]),y0:io(...l[1]),x1:oo(...l[0]),y1:oo(...l[1])}}function xx(e){if(l2(e)||(e=n2(e)),o2(e))return e;for(var t=r2(u2(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(d,f,m){var g,y;if(!d)return["C",f.x,f.y,f.x,f.y,f.x,f.y];switch(!(d[0]in{T:1,Q:1})&&(f.qx=f.qy=null),d[0]){case"M":f.X=d[1],f.Y=d[2];break;case"A":d=["C",...vx(f.x,f.y,...d.slice(1))];break;case"S":m=="C"||m=="S"?(g=f.x*2-f.bx,y=f.y*2-f.by):(g=f.x,y=f.y),d=["C",g,y,...d.slice(1)];break;case"T":m=="Q"||m=="T"?(f.qx=f.x*2-f.qx,f.qy=f.y*2-f.qy):(f.qx=f.x,f.qy=f.y),d=["C",...yx(f.x,f.y,f.qx,f.qy,d[1],d[2])];break;case"Q":f.qx=d[1],f.qy=d[2],d=["C",...yx(f.x,f.y,d[1],d[2],d[3],d[4])];break;case"L":d=["C",...Rl(f.x,f.y,d[1],d[2])];break;case"H":d=["C",...Rl(f.x,f.y,d[1],f.y)];break;case"V":d=["C",...Rl(f.x,f.y,f.x,d[1])];break;case"Z":d=["C",...Rl(f.x,f.y,f.X,f.Y)];break}return d},o=function(d,f){if(d[f].length>7){d[f].shift();for(var m=d[f];m.length;)r[f]="A",d.splice(f++,0,["C",...m.splice(0,6)]);d.splice(f,1),l=t.length}},r=[],a="",s="",c=0,l=t.length;c<l;c++){t[c]&&(a=t[c][0]),a!="C"&&(r[c]=a,c&&(s=r[c-1])),t[c]=i(t[c],n,s),r[c]!="A"&&a=="C"&&(r[c]="C"),o(t,c);var u=t[c],p=u.length;n.x=u[p-2],n.y=u[p-1],n.bx=cx(u[p-4])||n.x,n.by=cx(u[p-3])||n.y}return t}function Lt(e){return bn(e)&&ai(e,"waypoints")}function ut(e){return bn(e)&&ai(e,"labelTarget")}function d2(e){return bn(e)&&fa(e.parent)}function bx(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ro(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ze(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ml(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function f2(e){return Ro({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function h2(e){for(var t=e.waypoints,n=t.reduce(function(l,u,p){var d=t[p-1];if(d){var f=l[l.length-1],m=f&&f.endLength||0,g=y2(d,u);l.push({start:d,end:u,startLength:m,endLength:m+g,length:g})}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 tt(e){return Lt(e)?h2(e):f2(e)}function Nn(e,t,n){n=n||0,bn(n)||(n={x:n,y:n});var i=Ze(e),o=Ze(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 Ls(e,t,n){var i=g2(e,t);return i.length===1||i.length===2&&Ds(i[0],i[1])<1?Ro(i[0]):i.length>1?(i=Xi(i,function(o){var r=Math.floor(o.t2*100)||1;return r=100-r,r=(r<10?"0":"")+r,o.segment2+"#"+r}),Ro(i[n?0:i.length-1])):null}function g2(e,t){return gx(e,t)}function m2(e){e=e.slice();for(var t=0,n,i,o;e[t];)n=e[t],i=e[t-1],o=e[t+1],Ds(n,o)===0||sf(i,o,n)?e.splice(t,1):t++;return e}function y2(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 wx(e){return et(e)?e+"px":e}function v2(e){for(;e.parent;)e=e.parent;return e}function x2(e){e=Z({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Kn(n,{position:"relative",overflow:"hidden",width:wx(e.width),height:wx(e.height)}),t.appendChild(n),n}function _x(e,t,n){const i=He("g");mt(i).add(t);const o=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[o]||null),i}const b2="base",Ex=0,w2=1,_2={shape:["x","y","width","height"],connection:["waypoints"]};function nt(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||{})}nt.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],nt.prototype._init=function(e){const t=this._eventBus,n=this._container=x2(e),i=this._svg=He("svg");De(i,{width:"100%",height:"100%"}),Tn(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")}),ot(n,i);const o=this._viewport=_x(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)},nt.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},nt.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},nt.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=rx(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},nt.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},nt.prototype.restoreFocus=function(){this._restoreFocus()},nt.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},nt.prototype.isFocused=function(){return this._focused},nt.prototype.getDefaultLayer=function(){return this.getLayer(b2,Ex)},nt.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},nt.prototype._getChildIndex=function(e){return si(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},nt.prototype._createLayer=function(e,t){typeof t>"u"&&(t=w2);const n=this._getChildIndex(t);return{group:_x(this._viewport,"layer-"+e,n),index:t,visible:!0}},nt.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},nt.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&&(pn(n),t.visible=!1),n},nt.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],pn(t.group))},nt.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},nt.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const o=this._findPlaneForRoot(v2(i));if(!o||n&&o.rootElement!==n)return;n=o.rootElement}return n},nt.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},nt.prototype._findPlaneForRoot=function(e){return $t(this._planes,function(t){return t.rootElement===e})},nt.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},nt.prototype._resolveElements=function(e){return Qe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},nt.prototype.getContainer=function(){return this._container},nt.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&&(U([i.gfx,i.secondaryGfx],function(o){o&&(n?(e.markers.add(t),mt(o).add(t)):(e.markers.delete(t),mt(o).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},nt.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},nt.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},nt.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},nt.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},nt.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},nt.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,Ex);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},nt.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},nt.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},nt.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)},nt.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})},nt.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})},nt.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=_2[e];if(!zo(n,function(o){return typeof t[o]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},nt.prototype._setParent=function(e,t,n){sn(t.children,e,n),e.parent=t},nt.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},nt.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},nt.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},nt.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),rn(e.parent&&e.parent.children,e),e.parent=null,o.fire(t+".removed",{element:e}),n.remove(e),e},nt.prototype.removeShape=function(e){return this._removeElement(e,"shape")},nt.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},nt.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},nt.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},nt.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},nt.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);Ts(t,u)});else return r=this._rootElement?this.getActiveLayer():null,i=r&&r.getBBox()||{},a=Ts(t),o=a?a.matrix:CP(),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},nt.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=Z({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Sx(t,n)}),{x:n.e,y:n.f}},nt.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(m=>m!=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=dn(r),s=Ze(a),c=this.viewbox(),l=this.zoom();let u,p;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const d=Ze(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-d.right),g=Math.min(0,s.left-d.left),y=Math.max(0,s.bottom-d.bottom),_=Math.min(0,s.top-d.top);u=m||g,p=y||_}this.scroll({dx:-u*l,dy:-p*l})},nt.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 Sx(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}nt.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},nt.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=Z(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),Sx(this._viewport,u),u},nt.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},nt.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}},nt.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ma="data-element-id";function xi(e){this._elements={},this._eventBus=e}xi.$inject=["eventBus"],xi.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),De(t,Ma,i),n&&De(n,Ma,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},xi.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(De(i.gfx,Ma,""),i.secondaryGfx&&De(i.secondaryGfx,Ma,""),delete t[n])},xi.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)},xi.prototype.updateGraphics=function(e,t,n){var i=e.id||e,o=this._elements[i];return n?o.secondaryGfx=t:o.gfx=t,t&&De(t,Ma,i),t},xi.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&De(e,Ma);var n=this._elements[t];return n&&n.element},xi.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},xi.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}},xi.prototype.getAll=function(){return this.filter(function(e){return e})},xi.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)})},xi.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},xi.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 E2(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 S2(e){return e.__refs_collection===!0}function R2(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Rx(e,t,n){var i=E2(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 M2(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 Ri(e,t){if(!(this instanceof Ri))return new Ri(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ri.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?Rx(this,t,e):M2(this,t,e)},Ri.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return S2(n)||Rx(this,t,e),n},Ri.prototype.ensureBound=function(e,t){R2(e,t)||this.bind(e,t)},Ri.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ri.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 Ri({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Mx=new Ri({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Cx=new Ri({name:"attachers",collection:!0},{name:"host"}),Ax=new Ri({name:"outgoing",collection:!0},{name:"source"}),Tx=new Ri({name:"incoming",collection:!0},{name:"target"});function Ca(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),pf.bind(this,"parent"),Mx.bind(this,"labels"),Ax.bind(this,"outgoing"),Tx.bind(this,"incoming")}function Is(){Ca.call(this),pf.bind(this,"children"),Cx.bind(this,"host"),Cx.bind(this,"attachers")}Ne(Is,Ca);function Px(){Ca.call(this),pf.bind(this,"children")}Ne(Px,Is);function kx(){Is.call(this),Mx.bind(this,"labelTarget")}Ne(kx,Is);function Ox(){Ca.call(this),Ax.bind(this,"source"),Tx.bind(this,"target")}Ne(Ox,Ca);var C2={connection:Ox,shape:Is,label:kx,root:Px};function A2(e,t){var n=C2[e];if(!n)throw new Error("unknown type: <"+e+">");return Z(new n,t)}function T2(e){return e instanceof Ca}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=Z({},t||{}),t.id||(t.id=e+"_"+this._uid++),A2(e,t)};var Al="__fn",Dx=1e3,P2=Array.prototype.slice;function li(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}li.prototype.on=function(e,t,n,i){if(e=Qe(e)?e:[e],Sn(t)&&(i=n,n=t,t=Dx),!et(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})})},li.prototype.once=function(e,t,n,i){var o=this;if(Sn(t)&&(i=n,n=t,t=Dx),!et(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)},li.prototype.off=function(e,t){e=Qe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},li.prototype.createEvent=function(e){var t=new Bs;return t.init(e),t},li.prototype.fire=function(e,t){var n,i,o,r;if(r=P2.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}},li.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},li.prototype._destroy=function(){this._listeners={}},li.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},li.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=k2(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},li.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},li.prototype._getListeners=function(e){return this._listeners[e]},li.prototype._setListeners=function(e,t){this._listeners[e]=t},li.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){Z(this,e||{})};function k2(e,t){return e.apply(null,t)}function nr(e){return e.childNodes[0]}function O2(e){return e.parentNode.childNodes[1]}function Tl(e,t,n,i,o){var r=As();r.setTranslate(t,n);var a=As();a.setRotate(i||0,0,0);var s=As();s.setScale(1,1),Ts(e,[r,a,s])}function $n(e,t,n){var i=As();i.setTranslate(t,n),Ts(e,i)}function Lx(e,t){var n=As();n.setRotate(t,0,0),Ts(e,n)}function bi(e,t){this._eventBus=e,this._elementRegistry=t}bi.$inject=["eventBus","elementRegistry"],bi.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=O2(t),n||(n=He("g"),mt(n).add("djs-children"),ot(t.parentNode,n))):n=t,n},bi.prototype._clear=function(e){var t=nr(e);return xl(t),t},bi.prototype._createContainer=function(e,t,n,i){var o=He("g");mt(o).add("djs-group"),typeof n<"u"?D2(o,t,t.childNodes[n]):ot(t,o);var r=He("g");mt(r).add("djs-element"),mt(r).add("djs-"+e),i&&mt(r).add("djs-frame"),ot(o,r);var a=He("g");return mt(a).add("djs-visual"),ot(r,a),r},bi.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ax(t))},bi.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=si(e,function(o,r){return r.parent&&(o[r.parent.id]=r.parent),o},{}),U(i,function(o){var r=o.children;if(r){var a=t._getChildrenContainer(o),s=a.firstChild;U(r,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},bi.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},bi.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},bi.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},bi.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},bi.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),$n(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?De(n,"display","none"):De(n,"display","block")}},bi.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);pn(t.parentNode)};function D2(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const L2={__depends__:[qP],__init__:["canvas"],canvas:["type",nt],elementRegistry:["type",xi],elementFactory:["type",Mo],eventBus:["type",li],graphicsFactory:["type",bi]};function I2(e){var t=new ox(e);return t.init(),t}function B2(e){e=e||{};var t={config:["value",e]},n=[t,L2].concat(e.modules||[]);return I2(n)}function ir(e,t){this._injector=t||B2(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Wn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function ti(e,t){return e.$instanceOf(t)}function N2(e){return $t(e.rootElements,function(t){return ti(t,"bpmn:Process")||ti(t,"bpmn:Collaboration")})}function $2(e){var t={},n=[],i={};function o(V,X){return function(ue){V(ue,X)}}function r(V){t[V.id]=V}function a(V){return t[V.id]}function s(V,X){var ue=V.gfx;if(ue)throw new Error(`already rendered ${Wn(V)}`);return e.element(V,i[V.id],X)}function c(V,X){return e.root(V,i[V.id],X)}function l(V,X){try{var ue=i[V.id]&&s(V,X);return r(V),ue}catch(be){u(be.message,{element:V,error:be}),console.error(`failed to import ${Wn(V)}`,be)}}function u(V,X){e.error(V,X)}var p=this.registerDi=function(X){var ue=X.bpmnElement;ue?i[ue.id]?u(`multiple DI elements defined for ${Wn(ue)}`,{element:ue}):i[ue.id]=X:u(`no bpmnElement referenced in ${Wn(X)}`,{element:X})};function d(V){f(V.plane)}function f(V){p(V),U(V.planeElement,m)}function m(V){p(V)}this.handleDefinitions=function(X,ue){var be=X.diagrams;if(ue&&be.indexOf(ue)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ue&&be&&be.length&&(ue=be[0]),!ue)throw new Error("no diagram to display");i={},d(ue);var $e=ue.plane;if(!$e)throw new Error(`no plane for ${Wn(ue)}`);var F=$e.bpmnElement;if(!F)if(F=N2(X),F)u(`correcting missing bpmnElement on ${Wn($e)} to ${Wn(F)}`),$e.bpmnElement=F,p($e);else throw new Error("no process or collaboration to display");var C=c(F,$e);if(ti(F,"bpmn:Process")||ti(F,"bpmn:SubProcess"))y(F,C);else if(ti(F,"bpmn:Collaboration"))z(F,C),_(X.rootElements,C);else throw new Error(`unsupported bpmnElement for ${Wn($e)}: ${Wn(F)}`);g(n)};var g=this.handleDeferred=function(){for(var X;n.length;)X=n.shift(),X()};function y(V,X){Ae(V,X),k(V.ioSpecification,X),P(V.artifacts,X),r(V)}function _(V,X){var ue=ft(V,function(be){return!a(be)&&ti(be,"bpmn:Process")&&be.laneSets});ue.forEach(o(y,X))}function h(V,X){l(V,X)}function v(V,X){U(V,o(h,X))}function b(V,X){l(V,X)}function E(V,X){l(V,X)}function M(V,X){l(V,X)}function B(V,X){l(V,X)}function P(V,X){U(V,function(ue){ti(ue,"bpmn:Association")?n.push(function(){B(ue,X)}):B(ue,X)})}function k(V,X){V&&(U(V.dataInputs,o(E,X)),U(V.dataOutputs,o(M,X)))}var N=this.handleSubProcess=function(X,ue){Ae(X,ue),P(X.artifacts,ue)};function G(V,X){var ue=l(V,X);ti(V,"bpmn:SubProcess")&&N(V,ue||X),ti(V,"bpmn:Activity")&&k(V.ioSpecification,X),n.push(function(){U(V.dataInputAssociations,o(b,X)),U(V.dataOutputAssociations,o(b,X))})}function q(V,X){l(V,X)}function Y(V,X){l(V,X)}function re(V,X){n.push(function(){var ue=l(V,X);V.childLaneSet&&K(V.childLaneSet,ue||X),oe(V)})}function K(V,X){U(V.lanes,o(re,X))}function Ce(V,X){U(V,o(K,X))}function Ae(V,X){Te(V.flowElements,X),V.laneSets&&Ce(V.laneSets,X)}function Te(V,X){U(V,function(ue){ti(ue,"bpmn:SequenceFlow")?n.push(function(){q(ue,X)}):ti(ue,"bpmn:BoundaryEvent")?n.unshift(function(){G(ue,X)}):ti(ue,"bpmn:FlowNode")?G(ue,X):ti(ue,"bpmn:DataObject")||(ti(ue,"bpmn:DataStoreReference")||ti(ue,"bpmn:DataObjectReference")?Y(ue,X):u(`unrecognized flowElement ${Wn(ue)} in context ${Wn(X&&X.businessObject)}`,{element:ue,context:X}))})}function de(V,X){var ue=l(V,X),be=V.processRef;be&&y(be,ue||X)}function z(V,X){U(V.participants,o(de,X)),n.push(function(){v(V.messageFlows,X)}),P(V.artifacts,X)}function oe(V){U(V.flowNodeRef,function(X){var ue=X.get("lanes");ue&&ue.push(V)})}}function Ix(e,t,n){var i,o,r,a,s=[];function c(l,u){var p={root:function(g,y){return i.add(g,y)},element:function(g,y,_){return i.add(g,y,_)},error:function(g,y){s.push({message:g,context:y})}},d=new $2(p);u=u||l.diagrams&&l.diagrams[0];var f=F2(l,u);if(!f)throw new Error("no diagram to display");U(f,function(g){d.handleDefinitions(l,g)});var m=u.plane.bpmnElement.id;r.setRootElement(r.findRoot(m+"_plane")||r.findRoot(m))}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 F2(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!A(n,"bpmn:Process")&&!A(n,"bpmn:Collaboration")&&(i=j2(n));var o;A(i,"bpmn:Collaboration")?o=i:o=$t(e.rootElements,function(l){if(A(l,"bpmn:Collaboration"))return $t(l.participants,function(u){return u.processRef===i})});var r=[i];o&&(r=zn(o.participants,function(l){return l.processRef}),r.push(o));var a=Bx(r),s=[t],c=[n];return U(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 Bx(e){var t=[];return U(e,function(n){n&&(t.push(n),t=t.concat(Bx(n.flowElements)))}),t}function j2(e){for(var t=e;t;){if(A(t,"bpmn:Process"))return t;t=t.$parent}}var H2='<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>',Nx=H2,$x={verticalAlign:"middle"},Fx={color:"#404040"},z2={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},G2={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},V2={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"},W2='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Nx+'</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>',ro;function U2(){ro=Vt(W2),Kn(ro,z2),Kn(Ct("svg",ro),$x),Kn(Ct(".backdrop",ro),G2),Kn(Ct(".notice",ro),V2),Kn(Ct(".link",ro),Fx,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function q2(){ro||(U2(),ci.bind(ro,".backdrop","click",function(e){document.body.removeChild(ro)})),document.body.appendChild(ro)}const Pl=5,jx="djs-outline-hidden";function Xt(e){e=Z({},K2,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),Z2(this._container)}Ne(Xt,ir),Xt.prototype.importXML=async function(t,n){const i=this;function o(a){return i.get("eventBus").createEvent(a)}let r=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(d){throw this._emit("import.parse.complete",{error:d}),d}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;r=r.concat(l),s=this._emit("import.parse.complete",o({error:null,definitions:s,elementsById:u,references:c,warnings:r}))||s;const p=await this.importDefinitions(s,n);return r=r.concat(p.warnings),this._emit("import.done",{error:null,warnings:r}),{warnings:r}}catch(a){let s=a;throw r=r.concat(s.warnings||[]),kl(s,r),s=Y2(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const r=new Error("no XML imported");throw kl(r,[]),r}if(typeof t=="string"&&(i=X2(n,t),!i)){const r=new Error("BPMNDiagram <"+t+"> not found");throw kl(r,[]),r}try{this.clear()}catch(r){throw kl(r,[]),r}const{warnings:o}=await Ix(this,n,i);return{warnings:o}},Xt.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},Xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),o=i.getActiveLayer(),r=Ct(":scope > defs",i._svg),a=ix(o),s=r?"<defs>"+ix(r)+"</defs>":"",c=i.getContainer();Pt(c).add(jx);let l;try{l=o.getBBox()}finally{Pt(c).remove(jx)}const u=l.x-Pl,p=l.y-Pl,d=l.width+Pl*2,f=l.height+Pl*2;t=`<?xml version="1.0" encoding="utf-8"?>
7
7
  <!-- created with bpmn-js / http://bpmn.io -->
8
8
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
9
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+d+'" height="'+f+'" viewBox="'+u+" "+p+" "+d+" "+f+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Xt.prototype._setDefinitions=function(e){this._definitions=e},Xt.prototype.getModules=function(){return this._modules},Xt.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},Xt.prototype.destroy=function(){ir.prototype.destroy.call(this),no(this._container)},Xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Xt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Ct(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Xt.prototype.getDefinitions=function(){return this._definitions},Xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Xt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=Z(Zi(n,["additionalModules"]),{canvas:Z({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},Xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Xt.prototype._createContainer=function(e){const t=Vt('<div class="bjs-container"></div>');return Kn(t,{width:Hx(e.width),height:Hx(e.height),position:e.position}),t},Xt.prototype._createModdle=function(e){const t=Z({},this._moddleExtensions,e.moddleExtensions);return new Gm(t)},Xt.prototype._modules=[];function kl(e,t){return e.warnings=t,e}function q2(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 Y2={width:"100%",height:"100%",position:"relative"};function Hx(e){return e+(et(e)?"px":"")}function K2(e,t){return t&&$t(e.diagrams,function(n){return n.id===t})||null}function X2(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Nx+"</a>",i=Vt(n);Kn(Ct("svg",i),$x),Kn(i,Fx,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ye.bind(i,"click",function(o){U2(),o.preventDefault()})}function Vr(e){Xt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ne(Vr,Xt),Vr.prototype._createModdle=function(e){var t=Xt.prototype._createModdle.call(this,e);return t.ids=new to([32,36,1]),t},Vr.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 yt(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||xt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!Ee(e).processRef:!0}function Rn(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=xt(e).isHorizontal;return t===void 0?!0:t}}function Z2(e){return e&&Ee(e).isInterrupting!==!1}function Un(e){return e&&!!Ee(e).triggeredByEvent}function Aa(e,t){var n=Ee(e).eventDefinitions;return Go(n,function(i){return A(i,t)})}function J2(e){return Aa(e,"bpmn:ErrorEventDefinition")}function Q2(e){return Aa(e,"bpmn:EscalationEventDefinition")}function ek(e){return Aa(e,"bpmn:CompensateEventDefinition")}var Wr={width:90,height:20},zx=15;function or(e){return A(e,"bpmn:Event")||A(e,"bpmn:Gateway")||A(e,"bpmn:DataStoreReference")||A(e,"bpmn:DataObjectReference")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:Group")}function Ol(e){return ut(e.label)}function tk(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=nk(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-=zx:a+=zx,{x:a,y:s}}function nk(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?tk(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Wr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Wr.height/2}}function Gx(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Wr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=df(t),i=Wr),Z({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Vx(e){if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return"name";if(A(e,"bpmn:TextAnnotation"))return"text";if(A(e,"bpmn:Group"))return"categoryValueRef"}function ik(e){var t=e.categoryValueRef;return t&&t.value||""}function ui(e){var t=e.businessObject,n=Vx(t);if(n)return n==="categoryValueRef"?ik(t):t[n]||""}function ok(e,t){var n=e.businessObject,i=Vx(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function rk(e){return ut(e)&&or(e.labelTarget)}var Ta=7;function Wx(e){let t=[];return U(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),U(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ns(e){const t=new Map;return U(rf(e),n=>{U(Wx(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 ff="hsl(225, 10%, 15%)",ak="white";function ao(e,t){return Go(e.eventDefinitions,function(n){return n.$type===t})}function sk(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function ck(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function gt(e,t,n){var i=xt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||ak}function Le(e,t,n){var i=xt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||ff}function $s(e,t,n,i){var o=xt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Le(e,n)}function Ux(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 zr(o)}function hf(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 zr(a)}function lk(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 zr(s)}function uk(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 zr(r)}function Fs(e,t={}){return{width:Mi(e,t),height:pi(e,t)}}function Mi(e,t={}){return ai(t,"width")?t.width:e.width}function pi(e,t={}){return ai(t,"height")?t.height:e.height}var pk=new to,dk=10,Dl=3,fk=1.5,Ll=10,hk=4,Pa=.95,gk=1,mk=.25;function Ur(e,t,n,i,o,r,a){Eo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(F){return n.computeStyle(F,{strokeLinecap:"round",strokeLinejoin:"round",stroke:ff,strokeWidth:2,fill:"white"})}function p(F){return n.computeStyle(F,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:ff,strokeWidth:2})}function d(F,C){var{ref:R={x:0,y:0},scale:W=1,element:J,parentGfx:fe=o._svg}=C,Pe=He("marker",{id:F,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*W,markerHeight:20*W,orient:"auto"});ot(Pe,J);var ct=Ct(":scope > defs",fe);ct||(ct=He("defs"),ot(fe,ct)),ot(ct,Pe)}function f(F,C,R,W){var J=pk.nextPrefixed("marker-");return m(F,J,C,R,W),"url(#"+J+")"}function m(F,C,R,W,J){if(R==="sequenceflow-end"){var fe=He("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:J,stroke:J,strokeWidth:1})});d(C,{element:fe,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="messageflow-start"){var Pe=He("circle",{cx:6,cy:6,r:3.5,...u({fill:W,stroke:J,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:Pe,ref:{x:6,y:6},parentGfx:F})}if(R==="messageflow-end"){var ct=He("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:W,stroke:J,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:ct,ref:{x:8.5,y:5},parentGfx:F})}if(R==="association-start"){var pt=He("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:J,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:pt,ref:{x:1,y:10},scale:.5,parentGfx:F})}if(R==="association-end"){var zt=He("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:J,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:zt,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="conditional-flow-marker"){var vt=He("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:W,stroke:J})});d(C,{element:vt,ref:{x:-1,y:10},scale:.5,parentGfx:F})}if(R==="conditional-default-flow-marker"){var an=He("path",{d:"M 6 4 L 10 16",...u({stroke:J,fill:"none"})});d(C,{element:an,ref:{x:0,y:10},scale:.5,parentGfx:F})}}function g(F,C,R,W,J={}){bn(W)&&(J=W,W=0),W=W||0,J=u(J);var fe=C/2,Pe=R/2,ct=He("circle",{cx:fe,cy:Pe,r:Math.round((C+R)/4-W),...J});return ot(F,ct),ct}function y(F,C,R,W,J,fe){bn(J)&&(fe=J,J=0),J=J||0,fe=u(fe);var Pe=He("rect",{x:J,y:J,width:C-J*2,height:R-J*2,rx:W,ry:W,...fe});return ot(F,Pe),Pe}function _(F,C,R,W){var J=C/2,fe=R/2,Pe=[{x:J,y:0},{x:C,y:fe},{x:J,y:R},{x:0,y:fe}],ct=Pe.map(function(zt){return zt.x+","+zt.y}).join(" ");W=u(W);var pt=He("polygon",{...W,points:ct});return ot(F,pt),pt}function h(F,C,R,W){R=p(R);var J=Ps(C,R,W);return ot(F,J),J}function v(F,C,R){return h(F,C,R,5)}function b(F,C,R){R=p(R);var W=He("path",{...R,d:C});return ot(F,W),W}function E(F,C,R,W){return b(C,R,Z({"data-marker":F},W))}function M(F){return $e[F]}function B(F){return function(C,R,W){return M(F)(C,R,W)}}var P={"bpmn:MessageEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill),Pe=W?gt(C,s,R.fill):Le(C,c,R.stroke),ct=b(F,J,{fill:fe,stroke:Pe,strokeWidth:1});return ct},"bpmn:TimerEventDefinition":function(F,C,R={}){var W=R.width||C.width,J=R.height||C.height,fe=R.width?1:2,Pe=g(F,W,J,.2*J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:fe}),ct=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:W,containerHeight:J,position:{mx:.5,my:.5}});b(F,ct,{stroke:Le(C,c,R.stroke),strokeWidth:fe});for(var pt=0;pt<12;pt++){var zt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:W,containerHeight:J,position:{mx:.5,my:.5}}),vt=W/2,an=J/2;b(F,zt,{strokeWidth:1,stroke:Le(C,c,R.stroke),transform:"rotate("+pt*30+","+an+","+vt+")"})}return Pe},"bpmn:EscalationEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(F,C,R={}){var W=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return b(F,W,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),fe=W?Le(C,c,R.stroke):"none",Pe=b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1});return Lx(Pe,45),Pe},"bpmn:CompensateEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{strokeWidth:1,fill:fe,stroke:Le(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(F,C,R={}){var W=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return b(F,W,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(F,C,R={}){var W=g(F,C.width,C.height,8,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:4});return W}};function k(F,C,R={},W){var J=Ee(F),fe=sk(J),Pe=W||F;return J.get("eventDefinitions")&&J.get("eventDefinitions").length>1?J.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,Pe,R,fe):P["bpmn:MultipleEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,Pe,R,fe):null}var N={ParticipantMultiplicityMarker:function(F,C,R={}){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2-6)/W,my:(J-15)/J}});E("participant-multiplicity",F,fe,{strokeWidth:2,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},SubProcessMarker:function(F,C,R={}){var W=y(F,14,14,0,{strokeWidth:1,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)});$n(W,C.width/2-7.5,C.height-20);var J=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",F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},ParallelMarker:function(F,C,R){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2+R.parallel)/W,my:(J-20)/J}});E("parallel",F,fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},SequentialMarker:function(F,C,R){var W=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",F,W,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},CompensationMarker:function(F,C,R){var W=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",F,W,{strokeWidth:1,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},LoopMarker:function(F,C,R){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2+R.loop)/W,my:(J-7)/J}});E("loop",F,fe,{strokeWidth:1.5,fill:"none",stroke:Le(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(F,C,R){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2+R.adhoc)/W,my:(J-15)/J}});E("adhoc",F,fe,{strokeWidth:1,fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke)})}};function G(F,C,R,W){N[F](C,R,W)}function q(F,C,R=[],W={}){W={fill:W.fill,stroke:W.stroke,width:Mi(C,W),height:pi(C,W)};var J=Ee(C),fe=R.includes("SubProcessMarker");fe?W={...W,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:W={...W,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},J.get("isForCompensation")&&R.push("CompensationMarker"),A(J,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),fe||Z(W,{compensation:W.compensation-18}));var Pe=J.get("loopCharacteristics"),ct=Pe&&Pe.get("isSequential");Pe&&(Z(W,{compensation:W.compensation-18}),R.includes("AdhocMarker")&&Z(W,{seq:-23,loop:-18,parallel:-24}),ct===void 0&&R.push("LoopMarker"),ct===!1&&R.push("ParallelMarker"),ct===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&Z(W,{compensation:-8}),U(R,function(pt){G(pt,F,C,W)})}function Y(F,C,R={}){R=Z({size:{width:100}},R);var W=r.createText(C||"",R);return mt(W).add("djs-label"),ot(F,W),W}function re(F,C,R,W={}){var J=Ee(C),fe=Fs({x:C.x,y:C.y,width:C.width,height:C.height},W);return Y(F,J.name,{align:R,box:fe,padding:7,style:{fill:$s(C,l,c,W.stroke)}})}function K(F,C,R={}){var W={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Y(F,ui(C),{box:W,style:Z({},r.getExternalStyle(),{fill:$s(C,l,c,R.stroke)})})}function Ce(F,C,R,W={}){var J=Rn(R),fe=Y(F,C,{box:{height:30,width:J?pi(R,W):Mi(R,W)},align:"center-middle",style:{fill:$s(R,l,c,W.stroke)}});if(J){var Pe=-1*pi(R,W);Tl(fe,0,-Pe,270)}}function Ae(F,C,R={}){var{width:W,height:J}=Fs(C,R);return y(F,W,J,Ll,{...R,fill:gt(C,s,R.fill),fillOpacity:Pa,stroke:Le(C,c,R.stroke)})}function Te(F,C,R={}){var W=Ee(C),J=gt(C,s,R.fill),fe=Le(C,c,R.stroke);return(W.get("associationDirection")==="One"||W.get("associationDirection")==="Both")&&(R.markerEnd=f(F,"association-end",J,fe)),W.get("associationDirection")==="Both"&&(R.markerStart=f(F,"association-start",J,fe)),R=wt(R,["markerStart","markerEnd"]),v(F,C.waypoints,{...R,stroke:fe,strokeDasharray:"0, 5"})}function de(F,C,R={}){var W=gt(C,s,R.fill),J=Le(C,c,R.stroke),fe=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Pe=b(F,fe,{fill:W,fillOpacity:Pa,stroke:J}),ct=Ee(C);if(ck(ct)){var pt=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}});b(F,pt,{strokeWidth:2,fill:W,stroke:J})}return Pe}function z(F,C,R={}){return g(F,C.width,C.height,{fillOpacity:Pa,...R,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})}function oe(F,C,R={}){return _(F,C.width,C.height,{fill:gt(C,s,R.fill),fillOpacity:Pa,stroke:Le(C,c,R.stroke)})}function V(F,C,R={}){var W=y(F,Mi(C,R),pi(C,R),0,{fill:gt(C,s,R.fill),fillOpacity:R.fillOpacity||Pa,stroke:Le(C,c,R.stroke),strokeWidth:1.5}),J=Ee(C);if(A(J,"bpmn:Lane")){var fe=J.get("name");Ce(F,fe,C,R)}return W}function X(F,C,R={}){var W=Ae(F,C,R),J=yt(C);if(Un(C)&&(De(W,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!J)){var fe=Ee(C).flowElements||[],Pe=fe.filter(ct=>A(ct,"bpmn:StartEvent"));Pe.length===1&&ue(Pe[0],F,R,C)}return re(F,C,J?"center-top":"center-middle",R),J?q(F,C,void 0,R):q(F,C,["SubProcessMarker"],R),W}function ue(F,C,R,W){var J=22,fe={fill:gt(W,s,R.fill),stroke:Le(W,c,R.stroke),width:J,height:J},Pe=Ee(F).isInterrupting,ct=Pe?0:3,pt=Pe?1:1.2,zt=20,vt=(J-zt)/2,an="translate("+vt+","+vt+")";g(C,zt,zt,{fill:fe.fill,stroke:fe.stroke,strokeWidth:pt,strokeDasharray:ct,transform:an}),k(F,C,fe,W)}function be(F,C,R={}){var W=Ae(F,C,R);return re(F,C,"center-middle",R),q(F,C,void 0,R),W}var $e=this.handlers={"bpmn:AdHocSubProcess":function(F,C,R={}){return yt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),X(F,C,R)},"bpmn:Association":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Te(F,C,R)},"bpmn:BoundaryEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=Ee(C),fe=J.get("cancelActivity");R={strokeWidth:1.5,fill:gt(C,s,R.fill),fillOpacity:gk,stroke:Le(C,c,R.stroke)},fe||(R.strokeDasharray="6");var Pe=z(F,C,R);return g(F,C.width,C.height,Dl,{...R,fill:"none"}),W&&k(C,F,R),Pe},"bpmn:BusinessRuleTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),fe=b(F,J);De(fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1});var Pe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ct=b(F,Pe);return De(ct,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:CallActivity":function(F,C,R={}){return R=wt(R,["fill","stroke"]),X(F,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R),J=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(F,J,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:DataInput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=i.getRawPath("DATA_ARROW"),J=de(F,C,R);return b(F,W,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1}),J},"bpmn:DataInputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Te(F,C,{...R,markerEnd:f(F,"association-end",gt(C,s,R.fill),Le(C,c,R.stroke))})},"bpmn:DataObject":function(F,C,R={}){return R=wt(R,["fill","stroke"]),de(F,C,R)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=i.getRawPath("DATA_ARROW"),J=de(F,C,R);return b(F,W,{strokeWidth:1,fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke)}),J},"bpmn:DataOutputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Te(F,C,{...R,markerEnd:f(F,"association-end",gt(C,s,R.fill),Le(C,c,R.stroke))})},"bpmn:DataStoreReference":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(F,W,{fill:gt(C,s,R.fill),fillOpacity:Pa,stroke:Le(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=z(F,C,{...R,strokeWidth:4});return W&&k(C,F,R),J},"bpmn:EventBasedGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=Ee(C),J=oe(F,C,R);g(F,C.width,C.height,C.height*.2,{fill:gt(C,"none",R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1});var fe=W.get("eventGatewayType"),Pe=!!W.get("instantiate");function ct(){var zt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(F,zt,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:2})}if(fe==="Parallel"){var pt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(F,pt,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1})}else fe==="Exclusive"&&(Pe||g(F,C.width,C.height,C.height*.26,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1}),ct());return J},"bpmn:ExclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R),J=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),fe=xt(C);return fe.get("isMarkerVisible")&&b(F,J,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:Gateway":function(F,C,R={}){return R=wt(R,["fill","stroke"]),oe(F,C,R)},"bpmn:Group":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),y(F,C.width,C.height,Ll,{stroke:Le(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Mi(C,R),height:pi(C,R)})},"bpmn:InclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R);return g(F,C.width,C.height,C.height*.24,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:2.5}),W},"bpmn:IntermediateEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=z(F,C,{...R,strokeWidth:1.5});return g(F,C.width,C.height,Dl,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1.5}),W&&k(C,F,R),J},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),V(F,C,{...R,fillOpacity:mk})},"bpmn:ManualTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:.5}),W},"bpmn:MessageFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=Ee(C),J=xt(C),fe=gt(C,s,R.fill),Pe=Le(C,c,R.stroke),ct=v(F,C.waypoints,{markerEnd:f(F,"messageflow-end",fe,Pe),markerStart:f(F,"messageflow-start",fe,Pe),stroke:Pe,strokeDasharray:"10, 11",strokeWidth:1.5});if(W.get("messageRef")){var pt=ct.getPointAtLength(ct.getTotalLength()/2),zt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:pt.x,y:pt.y}}),vt={strokeWidth:1};J.get("messageVisibleKind")==="initiating"?(vt.fill=fe,vt.stroke=Pe):(vt.fill=Pe,vt.stroke=fe);var an=b(F,zt,vt),Mn=W.get("messageRef"),kn=Mn.get("name"),Nt=Y(F,kn,{align:"center-top",fitBox:!0,style:{fill:Pe}}),vn=an.getBBox(),On=Nt.getBBox(),ii=pt.x-On.width/2,qn=pt.y+vn.height/2+dk;Tl(Nt,ii,qn,0)}return ct},"bpmn:ParallelGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R),J=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(F,J,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:Participant":function(F,C,R={}){R=wt(R,["fill","stroke","width","height"]);var W=V(F,C,R),J=yt(C),fe=Rn(C),Pe=Ee(C),ct=Pe.get("name");if(J){var pt=fe?[{x:30,y:0},{x:30,y:pi(C,R)}]:[{x:0,y:30},{x:Mi(C,R),y:30}];h(F,pt,{stroke:Le(C,c,R.stroke),strokeWidth:fk}),Ce(F,ct,C,R)}else{var zt=Fs(C,R);fe||(zt.height=Mi(C,R),zt.width=pi(C,R));var vt=Y(F,ct,{box:zt,align:"center-middle",style:{fill:$s(C,l,c,R.stroke)}});if(!fe){var an=-1*pi(C,R);Tl(vt,0,-an,270)}}return Pe.get("participantMultiplicity")&&G("ParticipantMultiplicityMarker",F,C,R),W},"bpmn:ReceiveTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=Ee(C),J=be(F,C,R),fe;return W.get("instantiate")?(g(F,28,28,20*.22,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),fe=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):fe=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(F,fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),J},"bpmn:ScriptTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:SendTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(F,J,{fill:Le(C,c,R.stroke),stroke:gt(C,s,R.fill),strokeWidth:1}),W},"bpmn:SequenceFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=gt(C,s,R.fill),J=Le(C,c,R.stroke),fe=v(F,C.waypoints,{markerEnd:f(F,"sequenceflow-end",W,J),stroke:J}),Pe=Ee(C),{source:ct}=C;if(ct){var pt=Ee(ct);Pe.get("conditionExpression")&&A(pt,"bpmn:Activity")&&De(fe,{markerStart:f(F,"conditional-flow-marker",W,J)}),pt.get("default")&&(A(pt,"bpmn:Gateway")||A(pt,"bpmn:Activity"))&&pt.get("default")===Pe&&De(fe,{markerStart:f(F,"conditional-default-flow-marker",W,J)})}return fe},"bpmn:ServiceTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R);g(F,10,10,{fill:gt(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var J=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),g(F,10,10,{fill:gt(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var fe=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(F,fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:StartEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=Ee(C);J.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var fe=z(F,C,R);return W&&k(C,F,R),fe},"bpmn:SubProcess":function(F,C,R={}){return yt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),X(F,C,R)},"bpmn:Task":function(F,C,R={}){return R=wt(R,["fill","stroke"]),be(F,C,R)},"bpmn:TextAnnotation":function(F,C,R={}){R=wt(R,["fill","stroke"]);var{width:W,height:J}=Fs(C,R),fe=y(F,W,J,0,0,{fill:"none",stroke:"none"}),Pe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:0,my:0}});b(F,Pe,{stroke:Le(C,c,R.stroke)});var ct=Ee(C),pt=ct.get("text")||"";return Y(F,pt,{align:"left-top",box:Fs(C,R),padding:Ta,style:{fill:$s(C,l,c,R.stroke)}}),fe},"bpmn:Transaction":function(F,C,R={}){yt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]);var W=X(F,C,{strokeWidth:1.5,...R}),J=n.style(["no-fill","no-events"],{stroke:Le(C,c,R.stroke),strokeWidth:1.5}),fe=yt(C);return fe||(R={}),y(F,Mi(C,R),pi(C,R),Ll-Dl,Dl,J),W},"bpmn:UserTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=15,fe=12,Pe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:J,y:fe}});b(F,Pe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:.5});var ct=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:J,y:fe}});b(F,ct,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:.5});var pt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:J,y:fe}});return b(F,pt,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:.5}),W},label:function(F,C,R={}){return K(F,C,R)}};this._drawPath=b,this._renderer=M}Ne(Ur,Eo),Ur.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ur.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},Ur.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ur.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ur.prototype.getShapePath=function(e){return ut(e)?hf(e,hk):A(e,"bpmn:Event")?Ux(e):A(e,"bpmn:Activity")?hf(e,Ll):A(e,"bpmn:Gateway")?lk(e):uk(e)};function wt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var yk=0,vk={width:150,height:50};function xk(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function bk(e){return bn(e)?Z({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var gf=null;function wk(){return gf||(gf=document.createElement("canvas").getContext("2d")),gf}function _k(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(qx(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function qx(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Ek(e,t){var n=wk();if(!n)return{width:0,height:0};n.font=_k(t),"letterSpacing"in n&&(n.letterSpacing=qx(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 Sk(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=Ek(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return Rk(e,o,i,r);o=Ck(o,r.width,t)}}function Rk(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 Yx="­";function Mk(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===Yx)&&o.pop();break}var a=o[o.length-1];return a&&a===Yx&&(o[o.length-1]="-"),o.join("")}function Ck(e,t,n){var i=Math.max(e.length*(n/t),1),o=Mk(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Il(e){this._config=Z({},{size:vk,padding:yk,style:{},align:"center-top"},e||{})}Il.prototype.createText=function(e,t){return this.layoutText(e,t).element},Il.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Il.prototype.layoutText=function(e,t){for(var n=Z({},this._config.size,t.box),i=Z({},this._config.style,t.style),o=xk(t.align||this._config.align),r=bk(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Ak(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(Sk(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=si(l,function(y,_,h){return y+(s||_.height)},0)+r.top+r.bottom,d=si(l,function(y,_,h){return _.width>y?_.width:y},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var m=He("text");De(m,i),U(l,function(y){var _;switch(f+=s||y.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?d:u)-r.right-y.width;break;default:_=Math.max(((a?d:u)-y.width)/2+r.left,0)}var h=He("tspan");De(h,{x:_,y:f}),h.textContent=y.text,ot(m,h)});var g={width:d,height:p};return{dimensions:g,element:m}};function Ak(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Tk=12,Pk=1.2,kk=40;function Kx(e){var t=Z({fontFamily:"Arial, sans-serif",fontSize:Tk,fontWeight:"normal",lineHeight:Pk},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=Z({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Il({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Wr.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:Ta});return{x:a.x,y:a.y,width:a.width,height:Math.max(kk,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,Z({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Kx.$inject=["config.textRenderer"];function Ok(){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=Bk(i.d,{mx:o,my:r,e:a});return p}}var Dk=/\{([^{}]+)\}/g,Lk=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Ik(e,t,n){var i=n;return t.replace(Lk,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 Bk(e,t){return String(e).replace(Dk,function(n,i){return Ik(n,i,t)})}const Nk={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ur],textRenderer:["type",Kx],pathMap:["type",Ok]};function $k(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const js={translate:["value",$k]};function Bl(e,t,n){return Z({id:e.id,type:e.$type,businessObject:e,di:t},n)}function Fk(e,t,n){var i=e.waypoint;return!i||i.length<2?[tt(t),tt(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Xx(e,t,n){return new Error(`element ${Wn(t)} referenced by ${Wn(e)}#${n} not yet drawn`)}function Co(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Co.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Co.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Bl(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!yt(e,t),c=Hk(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Bl(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),A(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),A(e,"bpmn:Lane")&&(r=0),A(e,"bpmn:DataStoreReference")&&(jk(n,tt(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(A(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Bl(e,t,{hidden:o,source:u,target:p,waypoints:Fk(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Wn(t)} for element ${Wn(e)}`);return or(e)&&ui(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Co.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Wn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Xx(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Co.prototype.addLabel=function(e,t,n){var i,o,r;return i=Gx(t,n),o=ui(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Bl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ui(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)},Co.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?Xx(e,i,t+"Ref"):new Error(`${Wn(e)}#${t} Ref not specified`)},Co.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Co.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Co.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function jk(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 Hk(e){return A(e,"bpmn:Group")}const Zx={__depends__:[Nk,{__depends__:[js],bpmnImporter:["type",Co]}]};function Hs(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Wi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function mf(e){return Math.log(e)/Math.log(10)}var zk=1e3;function _e(e){this._eventBus=e}_e.$inject=["eventBus"];function Gk(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}_e.prototype.on=function(e,t,n,i,o,r){if((Sn(t)||et(t))&&(r=o,o=i,i=n,n=t,t=null),Sn(n)&&(r=o,o=i,i=n,n=zk),bn(o)&&(r=o,o=!1),!Sn(i))throw new Error("handlerFn must be a function");Qe(e)||(e=[e]);var a=this._eventBus;U(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?Gk(i,r):i,r)})},_e.prototype.canExecute=Ao("canExecute"),_e.prototype.preExecute=Ao("preExecute"),_e.prototype.preExecuted=Ao("preExecuted"),_e.prototype.execute=Ao("execute"),_e.prototype.executed=Ao("executed"),_e.prototype.postExecute=Ao("postExecute"),_e.prototype.postExecuted=Ao("postExecuted"),_e.prototype.revert=Ao("revert"),_e.prototype.reverted=Ao("reverted");function Ao(e){return function(n,i,o,r,a){(Sn(n)||et(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var yf=["top","bottom","left","right"],Nl=10;function vf(e,t){_e.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(Ol(o)&&!Lt(o)){var r=Uk(o);r&&i(o,r)}}function i(o,r){var a=tt(o),s=o.label,c=tt(s);if(s.parent){var l=Ze(o),u;switch(r){case"top":u={x:a.x,y:l.top-Nl-s.height/2};break;case"left":u={x:l.left-Nl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Nl+s.height/2};break;case"right":u={x:l.right+Nl+s.width/2,y:a.y};break}var p=Wi(u,c);t.moveShape(s,p)}}}Ne(vf,_e),vf.$inject=["eventBus","modeling"];function Vk(e){var t=e.host,n=tt(e),i=Nn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=yf.filter(function(a){return o.indexOf(a)===-1});return r}function Wk(e){var t=tt(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 Jx(t,i)});return n}function Uk(e){var t=tt(e.label),n=tt(e),i=Jx(n,t);if(qk(i)){var o=Wk(e);if(e.host){var r=Vk(e);o=o.concat(r)}var a=yf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?Nn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Jx(e,t){return Nn(t,e,5)}function qk(e){return yf.indexOf(e)!==-1}function xf(e){_e.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(A(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ne(xf,_e),xf.$inject=["eventBus"];var Yk=1500;function bf(e,t,n){e.invoke(_e,this),this.preExecute("elements.delete",Yk,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=ft(o,l=>A(l,"bpmn:Participant")||A(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>A(l,"bpmn:Artifact"))),c=new Set;return U(r,l=>{const u=new Set(ha(Ra(Array.from(s),dn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ne(bf,_e),bf.$inject=["injector","eventBus","canvas"];function wf(e,t){e.invoke(_e,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=ft(o.incoming.concat(o.outgoing),function(a){return A(a,"bpmn:Association")});U(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ne(wf,_e),wf.$inject=["injector","modeling"];function ka(e,t){for(ri(t)&&(t=[t]);e=e.parent;)if(dt(e,t))return e;return null}function Qx(e,t){var n=ka(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ka(e,i),n)return Rn(n);if(dt(e,i))return Rn(e);var o;for(o=Ee(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=Ee(a);return s&&s.get("processRef")===o});return r?Rn(r):!0}var eb=500;function $l(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",eb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return tb(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",eb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];tb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}$l.$inject=["bpmnReplace","injector"],Ne($l,_e),$l.prototype._replaceShape=function(e,t){var n=Kk(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Kk(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function tb(e,t){return!ut(e)&&dt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function _f(e,t){_e.call(this,e);function n(i){return ft(i.attachers,function(o){return A(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);A(o,"bpmn:EventBasedGateway")&&A(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;A(o,"bpmn:Gateway")&&A(r,"bpmn:EventBasedGateway")&&U(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}_f.$inject=["eventBus","modeling"],Ne(_f,_e);function nb(e){return e.create("bpmn:Category")}function Xk(e){return e.create("bpmn:CategoryValue")}function ib(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Xk(e)),n.$parent||(n.$parent=nb(e)),n}function Zk(e,t,n){return sn(t.get("categoryValue"),e),e.$parent=t,sn(n.get("rootElements"),t),t.$parent=n,e}function Jk(e){var t=e.$parent;return t&&(rn(t.get("categoryValue"),e),e.$parent=null),e}function Qk(e){var t=e.$parent;return t&&(rn(t.get("rootElements"),e),e.$parent=null),e}var eO=500;function Ef(e,t,n){n.invoke(_e,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(Ee).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&Zk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&Qk(l),c&&!o(c,u)&&Jk(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.executed(["shape.move","shape.resize"],eO,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,Ee(l))},!0),this.executed("group.updateRefs",function(c){ob(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){ob(c).forEach(function(l){s(l.categoryValue,l.category,Ee(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Ef.$inject=["bpmnjs","elementRegistry","injector"],Ne(Ef,_e);function ob(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Sf(e,t,n){_e.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const _=y.source,h=y.target;Oa(_)&&zs(h)&&u(h)}function o(y){const _=y.connection,h=y.source,v=y.target;Oa(h)&&Fl(v)&&(l(v),d(h,[_]))}function r(y){const _=y.newTarget,h=y.oldSource,v=y.oldTarget;if(v!==_){const b=h;zs(v)&&u(v),Oa(b)&&Fl(_)&&l(_)}}function a(y){const{element:_}=y;zs(_)?(p(_),f(_)):Fl(_)&&m(_)}function s(y){const{newData:_,oldShape:h}=y;if(Oa(y.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>zs(b));v&&v.target&&(y._connectionTarget=v.target)}else if(!Oa(y.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>Fl(b));v&&v.target&&(y._connectionTarget=v.target),g(h)}}function c(y){const{_connectionTarget:_,newShape:h}=y;_&&t.connect(h,_)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const _ of y.incoming)n.canConnect(_.source,y)||t.removeConnection(_);for(const _ of y.outgoing)n.canConnect(y,_.target)||t.removeConnection(_)}function d(y,_){y.outgoing.filter(b=>A(b,"bpmn:Association")).filter(b=>zs(b.target)&&!_.includes(b)).forEach(b=>t.removeConnection(b))}function f(y){const _=y.attachers.slice();_.length&&t.removeElements(_)}function m(y){const _=y.incoming.filter(h=>Oa(h.source));t.removeElements(_)}function g(y){const _=y.outgoing.filter(h=>A(h,"bpmn:SequenceFlow"));t.removeElements(_)}}Ne(Sf,_e),Sf.$inject=["eventBus","modeling","bpmnRules"];function zs(e){const t=Ee(e);return t&&t.get("isForCompensation")}function Oa(e){return e&&A(e,"bpmn:BoundaryEvent")&&Aa(e,"bpmn:CompensateEventDefinition")}function Fl(e){return e&&A(e,"bpmn:Activity")&&!Un(e)}function Rf(e){e.invoke(_e,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;A(i,"bpmn:Lane")&&!A(o,"bpmn:Lane")&&(n.parent=ka(i,"bpmn:Participant"))})}Rf.$inject=["injector"],Ne(Rf,_e);function Mf(e,t){_e.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(A(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}Mf.$inject=["eventBus","bpmnFactory"],Ne(Mf,_e);var Cf=20,Af=20,rb=30,jl=2e3;function Tf(e,t,n){_e.call(this,t),t.on(["create.start","shape.move.start"],jl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!A(a,"bpmn:Participant")||!A(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!A(p,"bpmn:Group")&&!ut(p)&&!Lt(p)});if(c.length){var l=dn(c),u=tO(a,l);Z(a,u),r.createConstraints=nO(a,l)}}}),t.on("create.start",jl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}A(a,"bpmn:Participant")&&A(s,"bpmn:Process")&&(t.on("element.hover",jl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return A(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",jl,function(o){var r=o.elements,a=o.parent,s=iO(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=Ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;A(a,"bpmn:Participant")&&A(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=Ee(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&Ee(s).set("processRef",Ee(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&Ee(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Tf.$inject=["canvas","eventBus","modeling"],Ne(Tf,_e);function tO(e,t){t={width:t.width+Cf*2+rb,height:t.height+Af*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 nO(e,t){return t=Ze(t),{bottom:t.top+e.height/2-Af,left:t.right-e.width/2+Cf,top:t.bottom-e.height/2+Af,right:t.left+e.width/2-Cf-rb}}function iO(e){return $t(e,function(t){return A(t,"bpmn:Participant")})}var ab="__targetRef_placeholder";function Pf(e,t){_e.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],sb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],sb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return $t(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=$t(c,function(u){return u.name===ab});return!l&&s&&(l=t.create("bpmn:Property",{name:ab}),sn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||rn(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,d=s.newTarget,f=d&&d.businessObject,m=s.oldTarget||s.target,g=m&&m.businessObject,y=c.businessObject,_;g&&g!==p&&o(g,l),f&&f!==p&&o(f,l),p?(_=i(p,!0),y.targetRef=_):y.targetRef=null}}Pf.$inject=["eventBus","bpmnFactory"],Ne(Pf,_e);function sb(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Hl(e){this._bpmnUpdater=e}Hl.$inject=["bpmnUpdater"],Hl.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),[]},Hl.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){_e.call(this,i),t.registerHandler("dataStore.updateContainment",Hl);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&Ee(s).processRef})[0]}function r(s){return s.children.filter(function(c){return A(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:xt(s),newSemanticParent:u.processRef||u,newDiParent:xt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return A(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!A(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!A(u,"bpmn:Collaboration")&&A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(p,"bpmn:Collaboration")){var d=A(u,"bpmn:Participant")?u:rO(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();dt(l,["bpmn:Participant","bpmn:SubProcess"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return oO(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(d){A(u,"bpmn:Process")&&a(d,u)})})}kf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ne(kf,_e);function oO(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 rO(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var zl=Math.max,Gl=Math.min,aO=20;function cb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function sO(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 cO(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 Vl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return et(o)&&(i=(/top|left/.test(e)?Gl:zl)(i,o)),et(r)&&(i=(/top|left/.test(e)?zl:Gl)(i,r)),i}function lO(e,t){if(!t)return e;var n=Ze(e);return Ml({top:Vl("top",n,t),right:Vl("right",n,t),bottom:Vl("bottom",n,t),left:Vl("left",n,t)})}function uO(e,t,n,i){var o=Ze(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?Ze(i):r,s={top:Gl(r.top,a.top),left:Gl(r.left,a.left),bottom:zl(r.bottom,a.bottom),right:zl(r.right,a.right)};return Ml(s)}function Gs(e,t){return typeof e<"u"?e:aO}function pO(e,t){var n,i,o,r;return typeof t=="object"?(n=Gs(t.left),i=Gs(t.right),o=Gs(t.top),r=Gs(t.bottom)):n=i=o=r=Gs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function dO(e){return!(e.waypoints||e.type==="label")}function lb(e,t){var n;if(e.length===void 0?n=ft(e.children,dO):n=e,n.length)return pO(dn(n),t)}var rr=Math.abs;function fO(e,t){return cb(Ze(t),Ze(e))}var hO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ci=30;function Wl(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Wl(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Ai(e){return ka(e,hO)||e}function gO(e,t){var n=Ai(e),i=A(n,"bpmn:Process")?[]:[n],o=Wl(n,i),r=Ze(e),a=Ze(t),s=fO(e,t),c=[],l=Rn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,d=l?s.right:0,f=l?0:s.bottom,m=l?s.left:0,g=Ze(u);s.top&&(rr(g.bottom-r.top)<10&&(f=a.top-g.bottom),rr(g.top-r.top)<5&&(p=a.top-g.top)),s.left&&(rr(g.right-r.left)<10&&(d=a.left-g.right),rr(g.left-r.left)<5&&(m=a.left-g.left)),s.bottom&&(rr(g.top-r.bottom)<10&&(p=a.bottom-g.top),rr(g.bottom-r.bottom)<5&&(f=a.bottom-g.bottom)),s.right&&(rr(g.left-r.right)<10&&(m=a.right-g.left),rr(g.right-r.right)<5&&(d=a.right-g.right)),(p||d||f||m)&&c.push({shape:u,newBounds:cO(u,{top:p,right:d,bottom:f,left:m})})}}),c}var mO=500;function Of(e,t){_e.call(this,e);function n(i,o){var r=Rn(i),a=ar(o),s=[],c=[],l=[],u=[];if(Gr(a,function(y){return r?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var d,f,m,g;s.length&&(d=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},"s")),c.length&&(f=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:-p},"n")),l.length&&(m=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:p,y:0},"e")),u.length&&(g=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",mO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;A(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Of.$inject=["eventBus","spaceTool"],Ne(Of,_e);var ub=500;function Ul(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ub,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return pb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",ub,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;pb(a,vO(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Ul.$inject=["bpmnReplace","injector"],Ne(Ul,_e),Ul.prototype._replaceShape=function(e){var t=yO(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function yO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function pb(e,t){return!ut(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function vO(e,t){return e.indexOf(t)!==-1}var ql=Math.round,xO=Math.max;function bO(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 wO(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var db=10;function _O(e,t){var n,i;for(n=0;i=e[n];n++)if(Ds(i,t)<=db)return{point:e[n],bendpoint:!0,index:n};return null}function EO(e,t){var n=gx(bO(t,db),wO(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=xO(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:ql(i.x+o.x)/2,y:ql(i.y+o.y)/2},index:i.segment2}:{point:{x:ql(i.x),y:ql(i.y)},index:i.segment2}:null}function Df(e,t){return _O(e,t)||EO(e,t)}function Lf(e,t,n){_e.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,m,g=o.outgoing.slice(),y=o.incoming.slice(),_;et(a.width)?_=tt(a):_=a;var h=Df(s,_);if(h){if(c=s.slice(0,h.index),l=s.slice(h.index+(h.bendpoint?1:0)),!c.length||!l.length)return;u=h.bendpoint?s[h.index]:_,(c.length===1||!fb(o,c[c.length-1]))&&c.push(hb(u)),(l.length===1||!fb(o,l[0]))&&l.unshift(hb(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),f=r),t.canConnect(o,d,r)&&(f?m=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),m=r));var v=[].concat(f&&ft(y,function(b){return b.source===f.source})||[],m&&ft(g,function(b){return b.target===m.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=tt(c),u={x:l.x+s.x,y:l.y+s.y},p=$t(r.children,function(d){var f=t.canInsert(a,d);return f&&Df(d.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}Ne(Lf,_e),Lf.$inject=["eventBus","bpmnRules","modeling"];function fb(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 hb(e){return Z({},e)}function If(e,t){_e.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Da(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Da(l)):c=a.incoming.filter(l=>l!==o&&Da(l)&&A(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(A(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Da).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Da).forEach(function(s){const c=a.incoming.filter(Da).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}If.$inject=["eventBus","modeling"],Ne(If,_e);function Da(e){return A(e,"bpmn:SequenceFlow")}var Yl=1500,gb=2e3;function mb(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"],Yl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!dt(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ai(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||dt(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"],Yl,function(i){var o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Ai(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Yl,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ai(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Yl,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Ai(r)||r)}),t.on("shape.move.start",gb,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Ai(o)||o)}),t.on("spaceTool.move",gb,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Ai(o))})}mb.$inject=["elementRegistry","eventBus","canvas"];var yb=770;function Bf(e,t,n,i){n.invoke(_e,this);function o(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef;u||(u=ib(e,l));var p=c.category||u.$parent||nb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=Ee(l);if(!(!A(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=Ee(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||Ee(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",yb,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=Ee(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",yb,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})}Bf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ne(Bf,_e);function Nf(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 vb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Nf(i,o,r,a),l=Nf(i,o,r,s),u;c&&l?xb(c,r)>xb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],tt(i.source)),t(o[o.length-1],o[o.length-2],tt(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}vb.$inject=["eventBus"];function xb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $f(e){_e.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=Ee(i),r=xt(i);if(dt(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}$f.$inject=["eventBus"],Ne($f,_e);function bb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function wb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function SO(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 RO(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 Ff(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=RO([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 _b(e,t){var n=Ff(e,t),i={x:n.x-e.x,y:n.y-e.y};return bb(i)}function Vs(e,t){return bb({x:e.x-t.x,y:e.y-t.y})}var Eb=Math.sqrt,Sb=Math.min,MO=Math.max,Rb=Math.abs;function Mb(e){return Math.pow(e,2)}function Ws(e,t){return Eb(Mb(e.x-t.x)+Mb(e.y-t.y))}function CO(e,t){var n=0,i,o,r,a,s,c,l,u,p,d,f;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],Ab(i,o)?l=[i]:(r=Ws(e,i),a=Ws(e,o),c=Sb(r,a),l=AO(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:Ab(i,l[0])?n:n+1}),l.length===2&&(s=PO(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ws(i,s)/Ws(i,o)}),p=Ws(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function AO(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,d=u/c,f=p*p-d;if(f<0&&f>-1e-6&&(f=0),f<0)return[];var m=Eb(f),g=-p+m,y=-p-m,_={x:e.x-o*g,y:e.y-r*g};if(f===0)return[_];var h={x:e.x-o*y,y:e.y-r*y};return[_,h].filter(function(v){return TO(v,e,t)})}function TO(e,t,n){return Cb(e.x,t.x,n.x)&&Cb(e.y,t.y,n.y)}function Cb(e,t,n){return e>=Sb(t,n)-Kl&&e<=MO(t,n)+Kl}function PO(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Kl=.1;function Ab(e,t){return Rb(e.x-t.x)<=Kl&&Rb(e.y-t.y)<=Kl}function kO(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=Pb(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Tb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=CO(e,n),c=s.segmentIndex,l=kO(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=kb(n,c),p=kb(t,l),d=s.position,f=DO(u,d),m=OO(u,p);if(s.type==="bendpoint"){var g=t.length-n.length,y=s.bendpointIndex,_=n[y];if(t.indexOf(_)!==-1)return a;if(g===0){var h=t[y];return o=h.x-s.position.x,r=h.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}g<0&&y!==0&&y<n.length-1&&(f=Pb(n,y))}var v={x:(p[1].x-p[0].x)*f+p[0].x,y:(p[1].y-p[0].y)*f+p[0].y},b=SO({x:e.x-d.x,y:e.y-d.y},m);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:Ro(v),delta:Ro({x:o,y:r})}}function Pb(e,t){var n=Vs(e[t-1],e[t]),i=Vs(e[t],e[t+1]),o=n/(n+i);return o}function OO(e,t){var n=wb(e),i=wb(t);return i-n}function kb(e,t){return[e[t],e[t+1]]}function DO(e,t){var n=Vs(e[0],e[1]),i=Vs(e[0],t);return n===0?0:i/n}function LO(e,t,n,i){var o=tt(e);return Tb(o,t,n,i).delta}function Us(e,t,n){var i=Hs(t),o=Hs(n),r=Wi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return Ro({x:o.x+a.x,y:o.y+a.y})}function Ob(e,t,n){var i=Hs(e),o=Hs(t),r=Hs(n),a=Wi(e,i),s=Wi(i,o),c=IO(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 Ro({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function IO(e,t,n){var i=Ze(t),o=Ze(n);if(BO(i,o))return null;var r=Nn(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=Nn(n,s),c!==r?null:a}function BO(e,t){return NO(e,t)||$O(e,t)}function NO(e,t){return e.right!==t.right&&e.left!==t.left}function $O(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Db="name",Lb="text";function jf(e,t,n,i){_e.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{Ee(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Db in l&&t.updateLabel(c,l[Db]),Lb in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Lb]||"");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;ut(l)||!or(l)||ui(l)&&t.updateLabel(l,ui(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=Z({},s.hints),p=s.newWaypoints||c.waypoints,d=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),LO(l,p,d,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=Ee(c);u&&or(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(!(!ut(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(ui(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?m-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Ol(c)){var p=c.label,d=tt(p),f=HO(u),m=jO(d,f),g=FO(m,u,l);t.moveShape(p,g)}})}Ne(jf,_e),jf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function FO(e,t,n){var i=Us(e,t,n);return Ro(Wi(i,e))}function jO(e,t){if(t.length){var n=zO(e,t);return Ff(e,n)}}function HO(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 zO(e,t){var n=t.map(function(o){return{line:o,distance:_b(e,o)}}),i=Xi(n,"distance");return i[0].line}function GO(e,t,n,i){return Tb(e,t,n,i).point}function Hf(e,t){_e.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=Z({},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),GO(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},d=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,d)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},d=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,d)})})}Ne(Hf,_e),Hf.$inject=["eventBus","modeling"];function Xl(e,t,n){var i=Jl(e),o=Bb(i,t),r=i[0];return o.length?o[o.length-1]:Us(r.original||r,n,t)}function Zl(e,t,n){var i=Jl(e),o=Bb(i,t),r=i[i.length-1];return o.length?o[0]:Us(r.original||r,n,t)}function zf(e,t,n){var i=Jl(e),o=Ib(t,n),r=i[0];return Us(r.original||r,o,t)}function Gf(e,t,n){var i=Jl(e),o=Ib(t,n),r=i[i.length-1];return Us(r.original||r,o,t)}function Ib(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Jl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Bb(e,t){var n=zn(e,WO);return ft(n,function(i){return VO(i,t)})}function VO(e,t){return Nn(t,e,1)==="intersect"}function WO(e){return e.original||e}function Vf(e,t){_e.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(UO(i,o)){var r=qO(i);r.incoming.forEach(function(a){var s=Zl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Xl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Vf.$inject=["eventBus","modeling"],Ne(Vf,_e);function UO(e,t){return A(e,"bpmn:Participant")&&yt(e)&&A(t,"bpmn:Participant")&&!yt(t)}function qO(e){var t=ks([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){A(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){A(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const YO=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Nb(e){const t=Ee(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:YO.some(i=>A(n[0],i))}function $b(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Wf(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Nb(o))return;const a=$b(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=Ee(i).get(a),l=Ee(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Wf.$inject=["injector","modeling"],Ne(Wf,_e);function Uf(e,t){_e.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=xt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ne(Uf,_e),Uf.$inject=["eventBus","modeling"];function qf(e,t,n){_e.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!A(r,"bpmn:SequenceFlow")||!A(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=KO(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ne(qf,_e),qf.$inject=["eventBus","bpmnRules","modeling"];function La(e){return e.original||e}function KO(e,t){var n=Nf(La(e[e.length-2]),La(e[e.length-1]),La(t[1]),La(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[La(e[0]),La(t[t.length-1])]}function Yf(e,t){_e.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;A(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}Yf.$inject=["eventBus","modeling"],Ne(Yf,_e);function Kf(e,t,n,i){_e.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var d,f;A(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),A(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(f=!0),n.canConnectSequenceFlow(l,u)&&(d="bpmn:SequenceFlow")),f&&t.removeConnection(c),d&&t.connect(l,u,{type:d,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,d=l.newTarget||u.target,f,m;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(m=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,o&&s(u,m))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,d;!p||!p.length||(d=p.indexOf(c),d!==-1&&p.splice(d,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;U(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,d=p.businessObject,f;u.default&&(f=$t(p.outgoing,ma({id:p.businessObject.default.id})),f&&t.updateProperties(f,{conditionExpression:void 0})),u.conditionExpression&&d.sourceRef.default===d&&t.updateProperties(p.source,{default:void 0})})}Ne(Kf,_e),Kf.$inject=["eventBus","modeling","bpmnRules","injector"];function Ql(e,t,n,i,o,r){i.invoke(_e,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=si(l,function(p,d){var f=t.canReplace([d],d.host||d.parent||c);return f?p.concat(f.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];U(s.closure.topLevel,function(d){Un(d)?u=u.concat(d.children):u=u.concat(d)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Ne(Ql,_e),Ql.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;U(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)},Ql.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var XO=1500,ZO={width:140,height:120},Xf={width:300,height:60},Zf={width:60,height:300},eu={width:300,height:150},tu={width:150,height:300},Fb={width:140,height:120},jb={width:100,height:40};function Hb(e){e.on("resize.start",XO,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(A(i,"bpmn:Lane")||A(i,"bpmn:Participant"))&&(n.resizeConstraints=nD(i,o,r)),A(i,"bpmn:SubProcess")&&yt(i)&&(n.minDimensions=Fb),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=jb)})}Hb.$inject=["eventBus"];var sr=Math.abs,JO=Math.min,QO=Math.max;function zb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ia(e,t,n){return zb(e,t,n,JO)}function Ba(e,t,n){return zb(e,t,n,QO)}var eD={top:20,left:50,right:20,bottom:20},tD={top:50,left:20,right:20,bottom:20};function nD(e,t,n){var i=Ai(e),o=!0,r=!0,a=Wl(i,[i]),s=Ze(e),c={},l={},u=Rn(e),p=u?Xf:Zf;/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(m){var g=Ze(m);u?(g.top<s.top-10&&(o=!1),g.bottom>s.bottom+10&&(r=!1)):(g.left<s.left-10&&(o=!1),g.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&sr(s.top-g.bottom)<10&&Ba(c,"top",g.top+p.height),sr(s.top-g.top)<5&&Ia(l,"top",g.bottom-p.height)),/e/.test(t)&&(n&&sr(s.right-g.left)<10&&Ia(c,"right",g.right-p.width),sr(s.right-g.right)<5&&Ba(l,"right",g.left+p.width)),/s/.test(t)&&(n&&sr(s.bottom-g.top)<10&&Ia(c,"bottom",g.bottom-p.height),sr(s.bottom-g.bottom)<5&&Ba(l,"bottom",g.top+p.height)),/w/.test(t)&&(n&&sr(s.left-g.right)<10&&Ba(c,"left",g.left+p.width),sr(s.left-g.left)<5&&Ia(l,"left",g.right-p.width))});var d=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(A(m,"bpmn:FlowElement")||A(m,"bpmn:Artifact"))}),f=u?eD:tD;return d.forEach(function(m){var g=Ze(m);/n/.test(t)&&(!u||o)&&Ia(l,"top",g.top-f.top),/e/.test(t)&&(u||r)&&Ba(l,"right",g.right+f.right),/s/.test(t)&&(!u||r)&&Ba(l,"bottom",g.bottom+f.bottom),/w/.test(t)&&(u||o)&&Ia(l,"left",g.left-f.left)}),{min:l,max:c}}function Gb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Na(e){return e.originalEvent||e.srcEvent}function Jf(e){Gb(e),Gb(Na(e))}function qr(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 Vb(){return/mac/i.test(navigator.platform)}function Wb(e,t){return(Na(e)||e).button===t}function cr(e){return Wb(e,0)}function iD(e){return Wb(e,1)}function qs(e){var t=Na(e)||e;return cr(e)?Vb()?t.metaKey:t.ctrlKey:!1}function nu(e){var t=Na(e)||e;return cr(e)&&t.shiftKey}var Ub=1001;function qb(e,t){e.on("resize.start",Ub+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!qs(n))}),e.on("resize.end",Ub,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))return r&&(a=bx(a),t.resizeLane(o,a,i.balanced)),!1})}qb.$inject=["eventBus","modeling"];var oD=500;function Qf(e,t,n,i,o){n.invoke(_e,this);function r(u){return dt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||rD(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!$t(d,ma({id:u.id}))}function s(u){if(A(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(A(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(A(u,"bpmn:MessageEventDefinition"))return"messageRef";if(A(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(dt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),d=p[0];return d.get(s(d))}function l(u,p){if(dt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var d=u.get("eventDefinitions"),f=d[0];return f.set(s(f),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var d=Ee(p),f=c(d),m;f&&!a(f)&&(m=e.getDefinitions().get("rootElements"),sn(m,f),u.addedRootElement=f)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var d=e.getDefinitions().get("rootElements");rn(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=Ee(d),m=c(f);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",oD,function(u){var p=u.descriptor,d=p.businessObject,f=p.referencedRootElement;f&&(a(f)||(f=i.copyElement(f,o.create(f.$type))),l(d,f),delete p.referencedRootElement)})}Qf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ne(Qf,_e);function rD(e,t){return Qe(t)||(t=[t]),Go(t,function(n){return Aa(e,n)})}var Yb=Math.max;function Kb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return U(n,function(a){var s=a.id;A(a,"bpmn:Participant")&&(r[s]=sD(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=Rn(a)?Xf:Zf),A(a,"bpmn:SubProcess")&&yt(a)&&(r[s]=Fb),A(a,"bpmn:TextAnnotation")&&(r[s]=jb),A(a,"bpmn:Group")&&(r[s]=ZO)}),r})}Kb.$inject=["eventBus"];function aD(e){return e==="x"}function sD(e,t,n){var i=Rn(e);if(!uD(e))return i?eu:tu;var o=aD(t),r={};return o?i?r=eu:r={width:lD(e,n,o),height:tu.height}:i?r={width:eu.width,height:cD(e,n,o)}:r=tu,r}function cD(e,t,n){var i;return i=pD(e,t,n),Yb(eu.height,i)}function lD(e,t,n){var i;return i=dD(e,t,n),Yb(tu.width,i)}function uD(e){return!!ar(e).length}function pD(e,t,n){var i=ar(e),o;return o=eh(i,t,n),e.height-o.height+Xf.height}function dD(e,t,n){var i=ar(e),o;return o=eh(i,t,n),e.width-o.width+Zf.width}function eh(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=ar(o),r.length?eh(r,t,n):o}var Xb="_plane";function Zb(e){var t=e.id;return fD(t)}function so(e){var t=e.id;return A(e,"bpmn:SubProcess")?Jb(t):t}function Yr(e){return Jb(e)}function iu(e){var t=xt(e);return A(t,"bpmndi:BPMNPlane")}function Jb(e){return e+Xb}function fD(e){return e.replace(new RegExp(Xb+"$"),"")}var Qb=400,hD=600,ew={x:180,y:160};function To(e,t,n,i,o,r,a){_e.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return A(p,"bpmn:SubProcess")&&!yt(p)}function l(p){var d=p.shape,f=p.newRootElement,m=Ee(d);f=s._addDiagram(f||m),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=Ee(d);s._removeDiagram(f);var m=p.newRootElement=a.get(so(f));e.removeRootElement(m)}this.executed("shape.create",function(p){var d=p.shape;c(d)&&l(p)},!0),this.postExecuted("elements.create",function(p){var d=p.elements;U(d,function(f){if(c(f)){var m=a.get(so(f));if(!(!m||!f.children||!f.children.length)){var g=tw(f);s._showRecursively(g),s._moveChildrenToShape(g,m)}}})},!0),this.reverted("shape.create",function(p){var d=p.shape;c(d)&&u(p)},!0),this.preExecute("shape.delete",function(p){var d=p.shape;!A(d,"bpmn:SubProcess")||!yt(d)||U(Ns([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(so(d));f&&n.removeElements(f.children.slice())}},!0),this.executed("shape.delete",function(p){var d=p.shape;c(d)&&u(p)},!0),this.reverted("shape.delete",function(p){var d=p.shape;c(d)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var d=p.oldShape,f=p.newShape;!c(d)||!c(f)||(p.oldRoot=e.removeRootElement(so(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,m=e.findRoot(so(d));if(!(!f||!m)){var g=f.children;n.moveElements(g,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,Yr(y)),a.updateId(g,y);return}var _=a.get(Yr(g));_&&a.updateId(Yr(g),Yr(y))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,Yr(g)),a.updateId(y,g);return}var _=a.get(Yr(y));_&&a.updateId(_,Yr(g))}}},!0),t.on("element.changed",function(p){var d=p.element;if(iu(d)){var f=d,m=a.get(Zb(f));!m||m===f||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Qb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(yt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",Qb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(yt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",hD,function(p){var d=p.shape;if(A(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(yt(d))s._moveChildrenToShape(f.children.slice(),d),U(Ns(d.children),g=>{n.moveShape(g.annotation,{x:0,y:0},d.parent),U(g.associations,y=>{n.moveConnection(y,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var m=tw(d);s._moveChildrenToShape(m,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var m=so(d),g=a.get(m);g&&f.push.apply(f,g.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,m=p.elements,g=f.parent,y=A(xt(g),"bpmndi:BPMNPlane");if(y){var _=Zb(g),h=$t(m,function(v){return v.id===_});h&&(d.parent=h.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}Ne(To,_e),To.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=dn(i),r;if(!t.x)r={x:ew.x-o.x,y:ew.y-o.y};else{var a=tt(t),s=tt(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},To.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Wx(e).map(i=>i.annotation));n.size&&U(Ns(e.children),i=>{n.has(i.annotation)&&U(i.associations,o=>{t.removeConnection(o)})})},To.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},To.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},To.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:so(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},To.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=$t(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},To.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function gD(e){var t=[];return U(Ns(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function tw(e){return e.children.slice().concat(gD(e.children)).concat(mD(e))}function mD(e){return rf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function th(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!A(o,"bpmn:SubProcess")||A(o,"bpmn:AdHocSubProcess")||!(A(i,"bpmn:Task")||A(i,"bpmn:CallActivity"))||!yt(o))){var r=yD(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}th.$inject=["injector","modeling"],Ne(th,_e);function yD(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function nh(e,t){_e.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;A(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&A(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!A(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,ui(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}}})}Ne(nh,_e),nh.$inject=["eventBus","textRenderer"];function ih(e,t){_e.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(yt(i))return;var o=ks(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();U(s,function(l){r(l,!0)}),U(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,tt(i)):t.reconnectStart(a,i,tt(i)))}},!0)}Ne(ih,_e),ih.$inject=["eventBus","modeling"];var oh=500;function rh(e,t,n){_e.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=vD(c).concat([a]),p=lb(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"],oh,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?xt(c).isExpanded=!1:(i(c.children),xt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],oh,function(a){var s=a.context,c=s.shape;c.collapsed?xt(c).isExpanded=!1:xt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],oh,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"})})}Ne(rh,_e),rh.$inject=["eventBus","elementFactory","modeling"];function vD(e){return e.filter(function(t){return!t.hidden})}function ah(e,t,n,i){t.invoke(_e,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;ut(a)||(A(a,"bpmn:Participant")&&yt(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;A(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ne(ah,_e),ah.$inject=["canvas","injector","moddle","modeling"];function sh(e,t){_e.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;xD(o,r)&&t.updateProperties(r,{default:null})})}Ne(sh,_e),sh.$inject=["eventBus","modeling"];function xD(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=Ee(t),i=Ee(e);return n.get("default")===i}var bD=500,wD=5e3,nw=["shape.create","shape.delete","shape.move","shape.resize"],iw=[...nw,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function ch(e,t){_e.call(this,e);var n;function i(){return n=n||new _D,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(iw,wD,function(){i()}),this.postExecuted(iw,bD,function(){r()}),this.preExecute(nw,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(A(c,"bpmn:Lane")&&l.addLane(c),A(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}ch.$inject=["eventBus","modeling"],Ne(ch,_e);function _D(){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 ED=500,SD=5e3,ow=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],rw=[...ow,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function lh(e,t){_e.call(this,e);var n;function i(){return n=n||new RD,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(rw,SD,function(){i()}),this.postExecuted(rw,ED,function(){r()}),this.preExecute(ow,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(A(s,"bpmn:FlowElement")&&c.addFlowElement(s),A(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;A(s,"bpmn:Group")&&o().addGroup(s)})}lh.$inject=["eventBus","modeling"],Ne(lh,_e);function RD(){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 uh(e,t){_e.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)MD(r)&&!AD(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ne(uh,_e),uh.$inject=["eventBus","modeling"];function MD(e){const t=Ee(e);return t&&t.isForCompensation}function CD(e){return e&&A(e,"bpmn:BoundaryEvent")&&Aa(e,"bpmn:CompensateEventDefinition")}function AD(e){return e.incoming.filter(n=>CD(n.source)).length>0}const TD={__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",vf],appendBehavior:["type",xf],associationBehavior:["type",wf],attachEventBehavior:["type",$l],artifactBehavior:["type",bf],boundaryEventBehavior:["type",_f],categoryRootElementReferenceBehavior:["type",Ef],compensateBoundaryEventBehaviour:["type",Sf],createBehavior:["type",Rf],createDataObjectBehavior:["type",Mf],createParticipantBehavior:["type",Tf],dataInputAssociationBehavior:["type",Pf],dataStoreBehavior:["type",kf],deleteLaneBehavior:["type",Of],detachEventBehavior:["type",Ul],dropOnFlowBehavior:["type",Lf],eventBasedGatewayBehavior:["type",If],fixHoverBehavior:["type",mb],groupBehavior:["type",Bf],importDockingFix:["type",vb],isHorizontalFix:["type",$f],labelBehavior:["type",jf],layoutConnectionBehavior:["type",Hf],messageFlowBehavior:["type",Vf],nonInterruptingBehavior:["type",Wf],removeElementBehavior:["type",qf],removeEmbeddedLabelBoundsBehavior:["type",Uf],removeParticipantBehavior:["type",Yf],replaceConnectionBehavior:["type",Kf],replaceElementBehaviour:["type",Ql],resizeBehavior:["type",Hb],resizeLaneBehavior:["type",qb],rootElementReferenceBehavior:["type",Qf],spaceToolBehavior:["type",Kb],subProcessPlaneBehavior:["type",To],subProcessStartEventBehavior:["type",th],textAnnotationBehavior:["type",nh],toggleCollapseConnectionBehaviour:["type",ih],toggleElementCollapseBehaviour:["type",rh],unclaimIdBehavior:["type",ah],unsetDefaultFlowBehavior:["type",sh],updateFlowNodeRefsBehavior:["type",ch],updateCategoryValueRefsBehavior:["type",lh],setCompensationActivityAfterPasteBehavior:["type",uh]};function ph(e){this._commandStack=e.get("commandStack",!1)}ph.$inject=["injector"],ph.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const co={__init__:["rules"],rules:["type",ph]};function Ti(e){_e.call(this,e),this.init()}Ti.$inject=["eventBus"],Ne(Ti,_e),Ti.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)})},Ti.prototype.init=function(){};function aw(e,t){var n=Nn(e,t,-15);return n!=="intersect"?n:null}function Fn(e){Ti.call(this,e)}Ne(Fn,Ti),Fn.$inject=["eventBus"],Fn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return PD(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 ru(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ru(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 xw(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Lt(i)&&!au(t,i)?!1:zo(t,function(o){return Lt(o)?ru(o.source,o.target,o):o.host?Ys(o,o.host,null,n):gh(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 fw(a)&&!n.includes(a.host)})?!1:Ys(n,t,null,i)||yw(n,t,i)||vw(n,t)||au(n,t)}),this.addRule("shape.create",function(e){return gh(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ys(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Sw(n,t)})},Fn.prototype.canConnectMessageFlow=_w,Fn.prototype.canConnectSequenceFlow=Ew,Fn.prototype.canConnectDataAssociation=mh,Fn.prototype.canConnectAssociation=bw,Fn.prototype.canConnectCompensationAssociation=ww,Fn.prototype.canMove=vw,Fn.prototype.canAttach=Ys,Fn.prototype.canReplace=yw,Fn.prototype.canDrop=$a,Fn.prototype.canInsert=au,Fn.prototype.canCreate=gh,Fn.prototype.canConnect=ru,Fn.prototype.canResize=xw,Fn.prototype.canCopy=Sw;function PD(e){return dh(e)?null:dt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function dh(e){return!e||ut(e)}function sw(e){do{if(A(e,"bpmn:Process"))return Ee(e);if(A(e,"bpmn:Participant"))return Ee(e).processRef||Ee(e)}while(e=e.parent)}function fh(e){return A(e,"bpmn:TextAnnotation")}function hh(e){return A(e,"bpmn:Group")&&!e.labelTarget}function cw(e){return A(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function ou(e){return Ee(e).isForCompensation}function kD(e,t){var n=sw(e),i=sw(t);return n===i}function OD(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&pw(e,"bpmn:MessageEventDefinition"))}function DD(e){return A(e,"bpmn:InteractionNode")&&!ou(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&pw(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!lo(e,"bpmn:MessageEventDefinition"))}function lw(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return Ee(t);if(A(t,"bpmn:Participant"))return Ee(t).processRef}return null}function uw(e,t){var n=lw(e),i=lw(t);return n===i}function lo(e,t){var n=Ee(e);return!!$t(n.eventDefinitions||[],function(i){return A(i,t)})}function pw(e,t){var n=Ee(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function LD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Un(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!cw(e)&&!ou(e)}function ID(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Un(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!ou(e)}function BD(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(lo(e,"bpmn:MessageEventDefinition")||lo(e,"bpmn:TimerEventDefinition")||lo(e,"bpmn:ConditionalEventDefinition")||lo(e,"bpmn:SignalEventDefinition"))}function ND(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function dw(e,t){var n=ND(t);return n.indexOf(e)!==-1}function ru(e,t,n){if(dh(e)||dh(t))return null;if(!A(n,"bpmn:DataAssociation")){if(_w(e,t))return{type:"bpmn:MessageFlow"};if(Ew(e,t))return{type:"bpmn:SequenceFlow"}}var i=mh(e,t);return i||(ww(e,t)?{type:"bpmn:Association",associationDirection:"One"}:bw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function $a(e,t){return ut(e)||hh(e)?!0:A(t,"bpmn:Participant")&&!yt(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):dt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:A(e,"bpmn:Lane")?A(t,"bpmn:Participant")||A(t,"bpmn:Lane"):A(e,"bpmn:BoundaryEvent")&&!$D(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?yt(t):dt(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?Go(Ee(t).get("participants"),function(n){return!!n.get("processRef")}):dt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?dt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function $D(e){return Ee(e).cancelActivity&&(hw(e)||gw(e))}function fw(e){return!ut(e)&&A(e,"bpmn:BoundaryEvent")}function FD(e){return A(e,"bpmn:Lane")}function jD(e){return fw(e)||A(e,"bpmn:IntermediateThrowEvent")&&hw(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&gw(e)}function hw(e){var t=Ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function gw(e){return mw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function mw(e,t){return t.some(function(n){return lo(e,n)})}function HD(e){return A(e,"bpmn:ReceiveTask")&&$t(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Ys(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return ut(o)||!jD(o)||Un(t)||!A(t,"bpmn:Activity")||ou(t)||i&&!aw(i,t)||HD(t)?!1:"attach"}function yw(e,t,n){if(!t)return!1;var i={replacements:[]};return U(e,function(o){Un(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&$a(o,t)&&(Z2(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(J2(o)||Q2(o)||ek(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),mw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&A(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),A(t,"bpmn:Transaction")||lo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(A(o,"bpmn:EndEvent")&&$a(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Ys(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function vw(e,t){return Go(e,FD)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return $a(n,t)})}function gh(e,t,n,i){return t?ut(e)||hh(e)?!0:$a(e,t)||au(e,t):!1}function xw(e,t,n){return A(e,"bpmn:SubProcess")?yt(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:fh(e)?n?n==="e"||n==="w":!0:hh(e)?!0:ut(e)?n?n==="e"||n==="w":!0:!1}function zD(e,t){var n=fh(e),i=fh(t);return(n||i)&&n!==i}function bw(e,t){return dw(t,e)||dw(e,t)?!1:zD(e,t)?!0:!!mh(e,t)}function ww(e,t){return uw(e,t)&&cw(e)&&A(t,"bpmn:Activity")&&!VD(t,e)&&!Un(t)}function _w(e,t){return Mw(e)&&!Mw(t)?!1:OD(e)&&DD(t)&&!kD(e,t)}function Ew(e,t){return LD(e)&&ID(t)&&uw(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!BD(t))}function mh(e,t){return dt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&dt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:dt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&dt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function au(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:dt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ut(t)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&$a(e,t.parent)}function yh(e,t){return e&&t&&e.indexOf(t)!==-1}function Sw(e,t){return ut(t)?!0:!(A(t,"bpmn:Lane")&&!yh(e,t.parent)||A(t,"bpmn:MessageFlow")&&!GD(e,t))}function GD(e,t){var n=Rw(t.source),i=Rw(t.target);return yh(e,n)&&yh(e,i)}function Rw(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function Mw(e){return ka(e,"bpmn:Process")||ka(e,"bpmn:Collaboration")}function VD(e,t){return e.attachers.includes(t)}const WD={__depends__:[co],__init__:["bpmnRules"],bpmnRules:["type",Fn]};var UD=2e3;function Cw(e,t){e.on("saveXML.start",UD,n);function n(){var i=t.getRootElements();U(i,function(o){var r=xt(o),a,s;a=ks([o]),a=ft(a,function(c){return c!==o&&!c.labelTarget}),s=zn(a,xt),r.set("planeElement",s)})}}Cw.$inject=["eventBus","canvas"];const qD={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Cw]};function su(e){_e.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}su.prototype.getOrdering=function(e,t){return null},Ne(su,_e);function vh(e,t){su.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=$t(n,function(c){return dt(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&&!dt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||A(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=wm(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}}}vh.$inject=["eventBus","canvas"],Ne(vh,su);const YD={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",vh]};function Ks(){}Ks.prototype.get=function(){return this._data},Ks.prototype.set=function(e){this._data=e},Ks.prototype.clear=function(){var e=this._data;return delete this._data,e},Ks.prototype.isEmpty=function(){return!this._data};const KD={clipboard:["type",Ks]};var Aw=1500;function Tw(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",Aw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Aw,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=qr(a),c=document.elementFromPoint(s.x,s.y),XD(c)}}Tw.$inject=["elementRegistry","eventBus","injector"];function XD(e){return Hr(e,"svg, .djs-element",!0)}const ZD={__init__:["hoverFix"],hoverFix:["type",Tw]};function JD(e){return!0}function cu(e){return cr(e)||iD(e)}var Pw=500;function kw(e,t,n){var i=this;function o(P,k,N){if(!s(P,k)){var G,q,Y;N?q=t.getGraphics(N):(G=k.delegateTarget||k.target,G&&(q=G,N=t.get(q))),!(!q||!N)&&(Y=e.fire(P,{element:N,gfx:q,originalEvent:k}),Y===!1&&(k.stopPropagation(),k.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,k){var N=l[P]||cr;return!N(k)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":JD,"element.mousedown":cu,"element.mouseup":cu,"element.click":cu,"element.dblclick":cu};function u(P,k,N){var G=c[P];if(!G)throw new Error("unmapped DOM event name <"+P+">");return o(G,k,N)}var p="svg, .djs-element";function d(P,k,N,G){var q=r[N]=function(Y){o(N,Y)};G&&(l[N]=G),q.$delegate=ci.bind(P,p,k,q)}function f(P,k,N){var G=a(N);G&&ci.unbind(P,k,G.$delegate)}function m(P){U(c,function(k,N){d(P,N,k)})}function g(P){U(c,function(k,N){f(P,N,k)})}e.on("canvas.destroy",function(P){g(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.createHit",{element:k,gfx:N})}),e.on(["shape.changed","connection.changed"],Pw,function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.updateHit",{element:k,gfx:N})}),e.on("interactionEvents.createHit",Pw,function(P){var k=P.element,N=P.gfx;i.createDefaultHit(k,N)}),e.on("interactionEvents.updateHit",function(P){var k=P.element,N=P.gfx;i.updateDefaultHit(k,N)});var y=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),h=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:h,"click-stroke":_,stroke:y,"no-move":v};function E(P,k){return k=Z({stroke:"white",strokeWidth:15},k||{}),n.cls(P,["no-fill","no-border"],k)}function M(P,k){var N=b[k];if(!N)throw new Error("invalid hit type <"+k+">");return De(P,N),P}function B(P,k){ot(P,k)}this.removeHits=function(P){var k=Ms(".djs-hit",P);U(k,pn)},this.createDefaultHit=function(P,k){var N=P.waypoints,G=P.isFrame,q;return N?this.createWaypointsHit(k,N):(q=G?"stroke":"all",this.createBoxHit(k,q,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,k){var N=Ps(k);return M(N,"stroke"),B(P,N),N},this.createBoxHit=function(P,k,N){N=Z({x:0,y:0},N);var G=He("rect");return M(G,k),De(G,N),B(P,G),G},this.updateDefaultHit=function(P,k){var N=Ct(".djs-hit",k);if(N)return P.waypoints?of(N,P.waypoints):De(N,{width:P.width,height:P.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}kw.$inject=["eventBus","elementRegistry","styles"];const lu={__init__:["interactionEvents"],interactionEvents:["type",kw]};function Fa(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)})}Fa.$inject=["eventBus","canvas"],Fa.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()})}},Fa.prototype.get=function(){return Array.from(this._selectedElements)},Fa.prototype.isSelected=function(e){return this._selectedElements.has(e)},Fa.prototype.select=function(e,t){var n=this.get();Qe(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?U(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ow="hover",Dw="selected";function Lw(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,Ow)}),t.on("element.out",function(o){i(o.element,Ow)}),t.on("selection.changed",function(o){function r(l){i(l,Dw)}function a(l){n(l,Dw)}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)})}Lw.$inject=["canvas","eventBus"];function Iw(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;Qe(l)?t.select(l):t.select(s.filter(QD))}}),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=$t(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(cr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=nu(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Iw.$inject=["eventBus","selection","canvas","elementRegistry"];function QD(e){return!e.hidden}const Pi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[lu],selection:["type",Fa],selectionVisuals:["type",Lw],selectionBehavior:["type",Iw]};var eL=/^djs-cursor-.*$/;function uu(e){var t=Pt(document.body);t.removeMatching(eL),e&&t.add("djs-cursor-"+e)}function Bw(){uu(null)}var tL=5e3;function Nw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,tL,n),function(){e.off(t,n)}}var nL=["c","C"],iL=["v","V"],oL=["d","D"],rL=["x","X"],aL=["y","Y"],$w=["z","Z"];function sL(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function di(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function _n(e,t){return e=Qe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function xh(e){return e.shiftKey}function cL(e){return di(e)&&_n(nL,e)}function lL(e){return di(e)&&_n(iL,e)}function uL(e){return di(e)&&_n(oL,e)}function pL(e){return di(e)&&_n(rL,e)}function dL(e){return di(e)&&!xh(e)&&_n($w,e)}function fL(e){return di(e)&&(_n(aL,e)||_n($w,e)&&xh(e))}var ja=Math.round,Fw="djs-drag-active";function Kr(e){e.preventDefault()}function hL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function gL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jw(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(v.x-E.left)/b.scale,y:b.y+(v.y-E.top)/b.scale}}function s(v,b){b=b||r;var E=e.createEvent(Z({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(b.prefix+"."+v,E)}function c(v){var b=v.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(v,b){var E=r.payload,M=r.displacement,B=r.globalStart,P=qr(v),k=Wi(P,B),N=r.localStart,G=a(P),q=Wi(G,N);if(!r.active&&(b||gL(k)>r.threshold)){if(Z(E,{x:ja(N.x+M.x),y:ja(N.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&uu(r.cursor),t.addMarker(t.getRootElement(),Fw)}Jf(v),r.active&&(Z(E,{x:ja(G.x+M.x),y:ja(G.y+M.y),dx:ja(q.x),dy:ja(q.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Jf(v)),E=s("end")),E===!1&&s("rejected"),b=_(E!==!0),s("ended",b)}function p(v){_n("Escape",v)&&(Kr(v),y())}function d(v){var b;r.active&&(b=Nw(e),setTimeout(b,400),Kr(v)),u(v)}function f(v){l(v)}function m(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function g(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function y(v){var b;if(r){var E=r.active;E&&s("cancel"),b=_(v),E&&s("canceled",b)}}function _(v){var b,E;s("cleanup"),Bw(),r.trapClick?E=d:E=u,Ye.unbind(document,"mousemove",l),Ye.unbind(document,"dragstart",Kr),Ye.unbind(document,"selectstart",Kr),Ye.unbind(document,"mousedown",E,!0),Ye.unbind(document,"mouseup",E,!0),Ye.unbind(document,"keyup",p),Ye.unbind(document,"touchstart",f,!0),Ye.unbind(document,"touchcancel",y,!0),Ye.unbind(document,"touchmove",l,!0),Ye.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),Fw);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),b=r,r=null,b}function h(v,b,E,M){r&&y(!1),typeof b=="string"&&(M=E,E=b,b=null),M=Z({},o,M||{});var B=M.data||{},P,k,N,G,q;if(M.trapClick?G=d:G=u,v?(P=Na(v)||v,k=qr(v),Jf(v),P.type==="dragstart"&&Kr(P)):(P=null,k={x:0,y:0}),N=a(k),b||(b=N),q=hL(P),r=Z({prefix:E,data:B,payload:{},globalStart:k,displacement:Wi(b,N),localStart:N,isTouch:q},M),M.manual||(q?(Ye.bind(document,"touchstart",f,!0),Ye.bind(document,"touchcancel",y,!0),Ye.bind(document,"touchmove",l,!0),Ye.bind(document,"touchend",u,!0)):(Ye.bind(document,"mousemove",l),Ye.bind(document,"dragstart",Kr),Ye.bind(document,"selectstart",Kr),Ye.bind(document,"mousedown",G,!0),Ye.bind(document,"mouseup",G,!0)),Ye.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",g)),s("init")===!1)return y(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",y),this.init=h,this.move=l,this.hover=m,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){Z(o,v)}}jw.$inject=["eventBus","canvas","selection","elementRegistry"];const Po={__depends__:[ZD,Pi],dragging:["type",jw]};function Xr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Xr.prototype.next=function(){return this._prefix+ ++this._counter};const mL=new Xr("ps");var yL=["marker-start","marker-mid","marker-end"],vL=["circle","ellipse","line","path","polygon","polyline","path","rect"];function lr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}lr.$inject=["elementRegistry","eventBus","canvas","styles"],lr.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")},lr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},lr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Kd(n);return this._cloneMarkers(nr(o),i),De(o,this._styles.cls(i,[])),ot(t,o),De(o,"data-preview-support-element-id",e.id),o},lr.prototype.addFrame=function(e,t){var n=He("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ot(t,n),De(n,"data-preview-support-element-id",e.id),n},lr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),_L(e)&&yL.forEach(function(o){if(De(e,o)){var r=xL(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},lr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,mL.next()].join("-"),a=Ct("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Kd(n);s.id=r,mt(s).add(o);var c=Ct(":scope > defs",e);c||(c=He("defs"),ot(e,c)),ot(c,s);var l=wL(s.id);De(t,i,l)};function xL(e,t,n){var i=bL(De(e,t));return Ct("marker#"+i,n||document)}function bL(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function wL(e){return"url(#"+e+")"}function _L(e){return vL.indexOf(e.nodeName)!==-1}const Ha={__init__:["previewSupport"],previewSupport:["type",lr]};var EL="drop-ok",Hw="drop-not-ok",zw="attach-ok",Gw="new-parent",Vw="create",SL=2e3;function Ww(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=ft(c,function(h){var v=h.labelTarget;return!h.parent&&!(ut(h)&&c.indexOf(v)!==-1)});var f=$t(c,function(h){return!Lt(h)}),m=!1,g=!1,y=!1;qw(c)&&(m=o.allowed("shape.attach",{position:u,shape:f,target:l})),m||(qw(c)?y=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=d.connectionTarget;return y||m?(f&&p&&(g=o.allowed("connection.create",{source:_===p?f:p,target:_===p?p:f,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:g}):y===null||m===null?null:!1}function a(c,l){[zw,EL,Hw,Gw].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,d=l.source,f=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Uw(c);var m={x:c.x,y:c.y},g=l.canExecute=p&&r(u,p,m,d,f);p&&g!==null&&(l.target=p,g&&g.attach?a(p,zw):a(p,g?Gw:Hw))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,d=l.elements,f=l.target,m=l.canExecute,g=m&&m.attach,y=m&&m.connect,_=l.hints||{};if(m===!1||!f)return!1;Uw(c);var h={x:c.x,y:c.y};y?p=i.appendShape(u,p,h,f,{attach:g,connection:y===!0?{}:y,connectionTarget:_.connectionTarget}):(d=i.createElements(d,h,f,Z({},_,{attach:g})),p=$t(d,function(v){return!Lt(v)})),Z(l,{elements:d,shape:p}),Z(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===Vw&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],SL,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Qe(l)||(l=[l]);var p=$t(l,function(m){return!Lt(m)});if(p){u=Z({elements:l,hints:{},shape:p},u||{}),U(l,function(m){et(m.x)||(m.x=0),et(m.y)||(m.y=0)});var d=ft(l,function(m){return!m.hidden}),f=dn(d);U(l,function(m){Lt(m)&&(m.waypoints=zn(m.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),Z(m,{x:m.x-f.x-f.width/2,y:m.y-f.y-f.height/2})}),t.init(c,Vw,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Ww.$inject=["canvas","dragging","eventBus","modeling","rules"];function Uw(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 qw(e){return e&&e.length===1&&!Lt(e[0])}var RL=750;function Yw(e,t,n,i,o){function r(a){var s=He("g");De(s,o.cls("djs-drag-group",["no-events"]));var c=He("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(nr(u),l)):(u=n._createContainer("shape",c),n.drawShape(nr(u),l),$n(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",RL,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(),ot(p,u)),$n(u,a.x,a.y)):pn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&pn(c)})}Yw.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const pu={__depends__:[Po,Ha,co,Pi],__init__:["create","createPreview"],create:["type",Ww],createPreview:["type",Yw]};function bh(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)})}bh.$inject=["eventBus"],bh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||ML(0,0)};function ML(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 Xs={__init__:["mouse"],mouse:["type",bh]};var Kw=2e3;function fi(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),CL(u)&&(l.priority=2,l.host=u.host.id),Lt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=AL(u)),ut(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),U(["x","y","width","height"],function(d){et(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Kw,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Kw,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;Z(l,{createElementsBehavior:!1})})}fi.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],fi.prototype.copy=function(e,t={}){var n,i;return Qe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Qe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},fi.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})}}},fi.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},fi.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},fi.prototype._getElementIdsFromTree=function(e){var t={};return U(e,function(n){U(n,function(i){i.id&&(t[i.id]=!0)})}),t},fi.prototype._paste=function(e,t,n,i){U(e,function(r){et(r.x)||(r.x=0),et(r.y)||(r.y=0)});var o=dn(e);return U(e,function(r){Lt(r)&&(r.waypoints=zn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),Z(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,Z({},i))},fi.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return U(e,function(r,a){r=Xi(r,"priority"),U(r,function(s){var c=Z({},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(Lt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(ut(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},fi.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Zi(e,["id"]));return t},fi.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Zi(e,["id"]));return t},fi.prototype.createShape=function(e){var t=this._elementFactory.createShape(Zi(e,["id"]));return t},fi.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Lt(e)&&(!n.has(e.source)||!n.has(e.target))||ut(e)&&!n.has(e.labelTarget))},fi.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=El(e);function s(p,d){return t.allowed("element.copy",{element:p,elements:d})}function c(p,d){var f=r.get(p);if(!f){var m={element:p,depth:d};o.push(m),r.set(p,m);return}if(f.depth<d){o=l(f,o);var g={element:f.element,depth:d};o.push(g),r.set(p,g)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}Gr(a,function(p,d,f){if(ut(p))return;U(p.labels,function(y){c(y,f)});function m(y){y&&y.length&&U(y,function(_){U(_.labels,function(h){c(h,f)}),c(_,f)})}U([p.attachers,p.incoming,p.outgoing],m),c(p,f);var g=[];return p.children&&(g=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:g}),g}),e=zn(o,function(p){return p.element});var u=new Set(e);return o=zn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Xi(o,function(p){return p.descriptor.priority}),e=zn(o,function(p){return p.element}),U(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){Zw(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Zw(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function CL(e){return!!e.host}function AL(e){return zn(e.waypoints,function(t){return t=Xw(t),t.original&&(t.original=Xw(t.original)),t})}function Xw(e){return Z({},e)}function Zw(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const TL={__depends__:[KD,pu,Xs,co],__init__:["copyPaste"],copyPaste:["type",fi]};function wh(e,t,n){Qe(n)||(n=[n]),U(n,function(i){kr(e[i])||(t[i]=e[i])})}var _h=750;function Jw(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",_h,function(c){var l=c.descriptor,u=c.element,p=Ee(u);if(ut(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(xt(u),!0);f.bpmnElement=d,wh(d,l,"name"),wh(f,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=Ee(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(Ee(c).attachedToRef=Ee(l[c.host])),Zi(u,si(u,function(d,f,m){var g=f.element,y=f.property;return m===c.id&&(g.set(y,p),d.push(c.id)),d},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,d=u.di;if(ut(u)){u.businessObject=Ee(l[u.labelTarget]),u.di=xt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,wh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",_h,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=Ee(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;A(l,"bpmn:SubProcess")&&U(Ns(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",_h,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Jw.$inject=["bpmnFactory","eventBus","moddleCopy"];const PL=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],kL=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Zs(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 Xi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=bn(o)&&o.$descriptor;if(a&&kL.includes(a))return r;if(a&&PL.includes(a)||a&&s&&!$t(s.properties,ma({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(A(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Zs.$inject=["eventBus","bpmnFactory","moddle"],Zs.prototype.copyElement=function(e,t,n,i=!1){n&&!Qe(n)&&(n=[n]),n=n||Eh(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Qe(o)&&(n=o),U(n,r=>{let a;ai(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!xn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Zs.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 bn(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):Qe(e)?si(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):bn(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},Zs.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 Eh(e,t){return si(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Qw={__depends__:[TL],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Jw],moddleCopy:["type",Zs]};var e_=Math.round;function Sh(e,t){this._modeling=e,this._eventBus=t}Sh.$inject=["modeling","eventBus"],Sh.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=e_(s+r/2),u=e_(c+a/2),p=i.replaceShape(e,Z({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function t_(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}t_.$inject=["selection","eventBus"];const OL={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",t_],replace:["type",Sh]};function DL(e,t,n){Qe(n)||(n=[n]),U(n,function(i){kr(e[i])||(t[i]=e[i])})}var LL=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function IL(e,t){var n=e&&ai(e,"collapsed")?e.collapsed:!yt(e),i;return t&&(ai(t,"collapsed")||ai(t,"isExpanded"))?i=ai(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function n_(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(du(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&IL(s,c))return i.toggleCollapse(s),s;var d=e.create(u),f={type:u,businessObject:d};f.di={},u==="bpmn:ExclusiveGateway"&&(f.di.isMarkerVisible=!0),DL(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var m=Eh(p.$descriptor),g=Eh(d.$descriptor,!0),y=BL(m,g);Z(d,ji(c,LL));var _=ft(y,function(b){return b==="eventDefinitions"?i_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Un(d):ai(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Un(d):!0});if(d=n.copyElement(p,d,_),c.eventDefinitionType&&(i_(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(du(p))f.isExpanded=yt(s);else if(c&&ai(c,"isExpanded")){f.isExpanded=c.isExpanded;var h=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=h.width,f.height=h.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}yt(s)&&!A(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(du(p)&&!du(d)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=Rn(s);xt(s).isHorizontal||(xt(f).isHorizontal=v),f.width=v?s.width:t.getDefaultSize(f).width,f.height=v?t.getDefaultSize(f).height:s.height}return r.allowed("shape.resize",{shape:d})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),d.name=p.name,dt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&dt(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!A(p,"bpmn:BoundaryEvent")&&A(d,"bpmn:BoundaryEvent")&&(f.host=c.host),(f.type==="bpmn:DataStoreReference"||f.type==="bpmn:DataObjectReference")&&(f.x=s.x+(s.width-f.width)/2),o.replaceElement(s,f,{...l,targetElement:c})}this.replaceElement=a}n_.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function du(e){return A(e,"bpmn:SubProcess")}function i_(e,t){var n=Ee(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function BL(e,t){return e.filter(function(n){return t.includes(n)})}const o_={__depends__:[Qw,OL,Pi],bpmnReplace:["type",n_]};var NL=250;function Zr(e){this._eventBus=e,this._tools=[],this._active=null}Zr.$inject=["eventBus"],Zr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Zr.prototype.isActive=function(e){return e&&this._active===e},Zr.prototype.length=function(e){return this._tools.length},Zr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Zr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),U(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,NL,function(o){this._active&&($L(o)||this.setActive(null))},this)};function $L(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Hr(t,'.group[data-group="tools"]')}const fu={__depends__:[Po],__init__:["toolManager"],toolManager:["type",Zr]};function FL(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 jL(e,t){var n=[],i=new Set(e);U(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;U(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 HL(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 Rh=Math.abs,zL=Math.round,ko={x:"width",y:"height"},r_="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},GL=1500,hu={n:"s",w:"e",s:"n",e:"w"},gu=20;function ki(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",GL,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&s_(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,m=l.start;if(l.initialized){s_(c);var g={x:0,y:0};g[u]=zL(c["d"+u]),s.makeSpace(d,f,g,p,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}ki.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ki.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:r_,data:{context:{reactivate:n}},trapClick:!1})},ki.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:r_,data:{context:{}}})},ki.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},ki.prototype.init=function(e,t){var n=Rh(e.dx)>Rh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Rh(i)<5)return!1;i<0&&(i*=-1),qs(e)&&(i*=-1);var r=FL(n,i),a=this._canvas.getRootElement();!nu(e)&&e.hover&&(a=e.hover);var s=[...ks(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=VL(c,n,r,o,l);return Z(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),uu("resize-"+(n==="x"?"ew":"ns")),!0},ki.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(f){s.has(f)||(s.add(f),r.push(f));var m=f.label;m&&!s.has(m)&&(s.add(m),r.push(m))}function d(f){c.has(f)||(c.add(f),a.push(f))}return U(e,function(f){if(!(!f.parent||ut(f))){if(Lt(f)){u.push(f);return}var m=f[t],g=m+f[ko[t]];if(WL(f)&&(n>0&&tt(f)[t]>i||n<0&&tt(f)[t]<i)){l.push(f);return}if(n>0&&m>i||n<0&&g<i){p(f);return}if(m<i&&g>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),U(r,function(f){var m=f.attachers;m&&U(m,function(g){p(g)})}),U(l,function(f){var m=f.host;(s.has(m)||c.has(m))&&p(f)}),U(u,function(f){var m=f.source,g=f.target,y=f.label;(s.has(m)||c.has(m))&&(s.has(g)||c.has(g))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},ki.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ki.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function a_(e){return{top:e.top-gu,right:e.right+gu,bottom:e.bottom+gu,left:e.left-gu}}function s_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;et(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),et(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),et(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),et(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function VL(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 U(a,function(d){var f=d.attachers,m=d.children,g=Ze(d),y=ft(m,function(q){return!Lt(q)&&!ut(q)&&!u.has(q)&&!p.has(q)}),_=ft(m,function(q){return!Lt(q)&&!ut(q)&&u.has(q)}),h,v,b,E=[],M=[],B,P,k,N;y.length&&(v=a_(Ze(dn(y))),h=i-g[ur[n]]+v[ur[n]],n==="n"?s.bottom=l=et(l)?Math.min(l,h):h:n==="w"?s.right=l=et(l)?Math.min(l,h):h:n==="s"?s.top=c=et(c)?Math.max(c,h):h:n==="e"&&(s.left=c=et(c)?Math.max(c,h):h)),_.length&&(b=a_(Ze(dn(_))),h=i-b[ur[hu[n]]]+g[ur[hu[n]]],n==="n"?s.bottom=l=et(l)?Math.min(l,h):h:n==="w"?s.right=l=et(l)?Math.min(l,h):h:n==="s"?s.top=c=et(c)?Math.max(c,h):h:n==="e"&&(s.left=c=et(c)?Math.max(c,h):h)),f&&f.length&&(f.forEach(function(q){u.has(q)?E.push(q):M.push(q)}),E.length&&(B=Ze(dn(E.map(tt))),P=g[ur[hu[n]]]-(B[ur[hu[n]]]-i)),M.length&&(k=Ze(dn(M.map(tt))),N=k[ur[n]]-(g[ur[n]]-i)),n==="n"?(h=Math.min(P||1/0,N||1/0),s.bottom=l=et(l)?Math.min(l,h):h):n==="w"?(h=Math.min(P||1/0,N||1/0),s.right=l=et(l)?Math.min(l,h):h):n==="s"?(h=Math.max(P||-1/0,N||-1/0),s.top=c=et(c)?Math.max(c,h):h):n==="e"&&(h=Math.max(P||-1/0,N||-1/0),s.left=c=et(c)?Math.max(c,h):h));var G=o&&o[d.id];G&&(n==="n"?(h=i+d[ko[t]]-G[ko[t]],s.bottom=l=et(l)?Math.min(l,h):h):n==="w"?(h=i+d[ko[t]]-G[ko[t]],s.right=l=et(l)?Math.min(l,h):h):n==="s"?(h=i-d[ko[t]]+G[ko[t]],s.top=c=et(c)?Math.max(c,h):h):n==="e"&&(h=i-d[ko[t]]+G[ko[t]],s.left=c=et(c)?Math.max(c,h):h))}),s}}function WL(e){return!!e.host}var Mh="djs-dragging",c_="djs-resizing",UL=250,mu=Math.max;function l_(e,t,n,i,o){function r(a,s){U(a,function(c){o.addDragger(c,s),n.addMarker(c,Mh)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=He("g");De(u,i.cls("djs-crosshair-group",["no-events"])),ot(s,u);var p=He("path");De(p,"d",l.x),mt(p).add("djs-crosshair"),ot(u,p);var d=He("path");De(d,"d",l.y),mt(d).add("djs-crosshair"),ot(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;$n(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&pn(c)}),e.on("spaceTool.move",UL,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var d=n.getLayer("space");c=He("path"),De(c,"d","M0,0 L0,0"),mt(c).add("djs-crosshair"),ot(d,c),s.line=c;var f=He("g");De(f,i.cls("djs-drag-group",["no-events"])),ot(n.getActiveLayer(),f),r(u,f);var m=new Set(u);U(p,function(M){m.add(M)});var g=new Set,y=s.movingConnections=[];m.forEach(function(M){U(M.outgoing,function(B){g.has(B)||!Lt(B)||!m.has(B.target)||(g.add(B),y.push(B))})}),r(y,f),s.dragGroup=f}if(!s.frameGroup){var _=He("g");De(_,i.cls("djs-frame-group",["no-events"])),ot(n.getActiveLayer(),_);var h=[];U(p,function(M){var B=o.addFrame(M,_),P=B.getBBox();h.push({element:B,initialBounds:P}),n.addMarker(M,c_)}),s.frameGroup=_,s.frames=h}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};De(c,{d:v[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,$n(s.dragGroup,E.x,E.y),U(s.frames,function(M){var B=M.element,P=M.initialBounds,k,N;s.direction==="e"?De(B,{width:mu(P.width+E.x,5)}):(k=mu(P.width-E.x,5),De(B,{width:k,x:P.x+P.width-k})),s.direction==="s"?De(B,{height:mu(P.height+E.y,5)}):(N=mu(P.height-E.y,5),De(B,{height:N,y:P.y+P.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,d=s.dragGroup,f=s.frameGroup;U(c,function(m){n.removeMarker(m,Mh)}),U(l,function(m){n.removeMarker(m,Mh)}),d&&(pn(p),pn(d)),U(u,function(m){n.removeMarker(m,c_)}),f&&pn(f)})}l_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const qL={__init__:["spaceToolPreview"],__depends__:[Po,co,fu,Ha,Xs],spaceTool:["type",ki],spaceToolPreview:["type",l_]};function yu(e,t){e.invoke(ki,this),this._canvas=t}yu.$inject=["injector","canvas"],Ne(yu,ki),yu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=ha(Ra(o.children.filter(l=>A(l,"bpmn:Artifact")),dn(r))));const s=[...e,...a];var c=ki.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||YL(l)&&(t==="y"&&Rn(l)||t==="x"&&!Rn(l)))}),c};function YL(e){return A(e,"bpmn:Participant")&&!Ee(e).processRef}const u_={__depends__:[qL],spaceTool:["type",yu]};function Zt(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)}Zt.$inject=["eventBus","injector"],Zt.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()},Zt.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},Zt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Zt.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()}},Zt.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()}},Zt.prototype.register=function(e,t){this._setHandler(e,t)},Zt.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)},Zt.prototype.canUndo=function(){return!!this._getUndoAction()},Zt.prototype.canRedo=function(){return!!this._getRedoAction()},Zt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Zt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Zt.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)})},Zt.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},Zt.prototype._createId=function(){return this._uid++},Zt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Zt.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()},Zt.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)},Zt.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:_m("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Zt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Qe(e)?e:[e],t.dirty=t.dirty.concat(e))},Zt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Zt.prototype._revertedAction=function(e){this._stackIdx--},Zt.prototype._getHandler=function(e){return this._handlerMap[e]},Zt.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 KL={commandStack:["type",Zt]};function pr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var XL=250,p_=1400;function Ch(e,t,n){_e.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",p_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=d_(a),r.validatedShapes=d_(s)}),i&&t.on("shape.move.start",XL,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",p_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];U(s,function(l){U(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;pr(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=af(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&&(sn(s.labels,a,c),a.labelTarget=s)})}Ne(Ch,_e),Ch.$inject=["injector","eventBus","modeling"];function d_(e){var t=new Set(e);return ft(e,function(n){return!t.has(n.labelTarget)})}const ZL={__init__:["labelSupport"],labelSupport:["type",Ch]};var JL=251,f_=1401,h_="attach-ok";function Ah(e,t,n,i,o){_e.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",f_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=QL(c),s.validatedShapes=eI(l)}),r&&t.on("shape.move.start",JL,function(a){var s=a.context,c=s.shapes,l=Th(c);U(l,function(u){r.makeDraggable(s,u,!0),U(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,h_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,h_)}))}}),this.preExecuted("elements.move",f_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Th(l);U(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=ft(c,function(p){var d=p.host;return tI(p)&&!nI(c,d)}),U(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;U(s,function(c){U(c.attachers,function(l){U(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),U(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;pr(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&&U(l.attachers,function(u){var p=Ob(u,c,l);o.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,d=s.hints||{};d.attachSupport!==!1&&U(p,function(f){var m=Ob(f,l,u);o.moveShape(f,m,f.parent),U(f.labels,function(g){o.moveShape(g,m,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ne(Ah,_e),Ah.$inject=["injector","eventBus","canvas","rules","modeling"];function Th(e){return zp(zn(e,function(t){return t.attachers||[]}))}function QL(e){var t=Th(e);return DR("id",e,t)}function eI(e){var t=ga(e,"id");return ft(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function tI(e){return!!e.host}function nI(e,t){return e.indexOf(t)!==-1}const iI={__depends__:[co],__init__:["attachSupport"],attachSupport:["type",Ah]};function g_(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(rx(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)})}g_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Ph={__init__:["changeSupport"],changeSupport:["type",g_]};function Oi(e){this._model=e}Oi.$inject=["moddle"],Oi.prototype._needsId=function(e){return dt(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"])},Oi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;A(e,"bpmn:Activity")?t="Activity":A(e,"bpmn:Event")?t="Event":A(e,"bpmn:Gateway")?t="Gateway":dt(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))},Oi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Oi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Oi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",Z({bpmnElement:e,bounds:this.createDiBounds()},t))},Oi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Oi.prototype.createDiWaypoints=function(e){var t=this;return zn(e,function(n){return t.createDiWaypoint(n)})},Oi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ji(e,["x","y"]))},Oi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",Z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Oi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",Z({bpmnElement:e},t))};function hi(e,t,n){_e.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var m=f.context,g=m.hints||{},y;!m.cropped&&g.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var m=f.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(f){var m=f.context,g=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(g,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],gi(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],gi(a));function s(f){var m=f.context,g=m.oldRoot,y=g.children;U(y,function(_){A(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var m=f.context.shape;A(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],gi(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],gi(function(f){f.context.shape.type!=="label"&&c(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&c({context:{shape:f.element}})});function l(f){i.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],gi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],gi(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],gi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],gi(u)),this.executed("connection.reconnect",gi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=Ee(g),v=Ee(y),b=Ee(_);h.conditionExpression&&!dt(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=h.conditionExpression,delete h.conditionExpression),y!==_&&v.default===h&&(m.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",gi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=Ee(g),v=Ee(y),b=Ee(_);m.oldConditionExpression&&(h.conditionExpression=m.oldConditionExpression),m.oldDefault&&(v.default=m.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],gi(p)),this.reverted(["element.updateAttachment"],gi(p)),this.executed("element.updateLabel",gi(d)),this.reverted("element.updateLabel",gi(d));function d(f){const{element:m}=f.context,g=ui(m),y=xt(m),_=y&&y.get("label");or(m)||iu(m)||(g&&!_?y.set("label",t.create("bpmndi:BPMNLabel")):!g&&_&&y.set("label",void 0))}}Ne(hi,_e),hi.$inject=["eventBus","bpmnFactory","connectionDocking"],hi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},hi.prototype.updateParent=function(e,t){if(!ut(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=xt(e),r=n&&n.businessObject,a=xt(n);A(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),A(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),A(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),A(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},hi.prototype.updateBounds=function(e){var t=xt(e),n=rI(e);if(n){var i=Wi(n,t.get("bounds"));Z(n,{x:e.x+i.x,y:e.y+i.y})}var o=ut(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),Z(r,{x:e.x,y:e.y,width:e.width,height:e.height})},hi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),rn(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),sn(o,e))}},hi.prototype.updateDiConnection=function(e,t,n){var i=xt(e),o=xt(t),r=xt(n);i.sourceElement&&i.sourceElement.bpmnElement!==Ee(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==Ee(n)&&(i.targetElement=n&&r)},hi.prototype.updateDiParent=function(e,t){if(t&&!A(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(rn(n,e),e.$parent=null)}};function oI(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}hi.prototype.getLaneSet=function(e){var t,n;return A(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(A(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},hi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))&&(A(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(A(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(A(e,"bpmn:FlowElement")){if(t){if(A(t,"bpmn:Participant"))t=t.processRef;else if(A(t,"bpmn:Lane"))do t=t.$parent.$parent;while(A(t,"bpmn:Lane"))}i="flowElements"}else if(A(e,"bpmn:Artifact")){for(;t&&!A(t,"bpmn:Process")&&!A(t,"bpmn:SubProcess")&&!A(t,"bpmn:Collaboration");)if(A(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(A(e,"bpmn:MessageFlow"))i="messageFlows";else if(A(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=oI(e.$parent||t),e.$parent&&(rn(r.get("rootElements"),o),o.$parent=null),t&&(sn(r.get("rootElements"),o),o.$parent=r))}else A(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":A(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),rn(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);rn(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},hi.prototype.updateConnectionWaypoints=function(e){var t=xt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},hi.prototype.updateConnection=function(e){var t=e.connection,n=Ee(t),i=t.source,o=Ee(i),r=t.target,a=Ee(t.target),s;if(A(n,"bpmn:DataAssociation"))A(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):A(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=A(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(rn(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(rn(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)},hi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function gi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;A(i,"bpmn:BaseElement")&&e(t)}}function rI(e){if(A(e,"bpmn:Activity")){var t=xt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function dr(e,t){Mo.call(this),this._bpmnFactory=e,this._moddle=t}Ne(dr,Mo),dr.$inject=["bpmnFactory","moddle"],dr.prototype._baseCreate=Mo.prototype.create,dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,Z({type:"label",di:n},Wr,t))}return this.createElement(e,t)},dr.prototype.createElement=function(e,t){t=Z({},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(!sI(o)){var r=Z({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}A(i,"bpmn:Group")&&(t=Z({isFrame:!0},t)),t=aI(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=kh(o,t,"isExpanded")),dt(i,["bpmn:Lane","bpmn:Participant"])&&(t=kh(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!yt(i,o)),A(i,"bpmn:ExclusiveGateway")&&(ai(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),xn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),xn(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=Z({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},dr.prototype.getDefaultSize=function(e,t){var n=Ee(e);if(t=t||xt(e),A(n,"bpmn:SubProcess"))return yt(n,t)?{width:350,height:200}:{width:100,height:80};if(A(n,"bpmn:Task"))return{width:100,height:80};if(A(n,"bpmn:Gateway"))return{width:50,height:50};if(A(n,"bpmn:Event"))return{width:36,height:36};if(A(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return yt(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return A(n,"bpmn:Lane")?{width:400,height:100}:A(n,"bpmn:DataObjectReference")?{width:36,height:50}:A(n,"bpmn:DataStoreReference")?{width:50,height:50}:A(n,"bpmn:TextAnnotation")?{width:100,height:40}:A(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dr.prototype.createParticipantShape=function(e){return bn(e)||(e={isExpanded:e}),e=Z({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function aI(e,t,n){return U(n,function(i){t=kh(e,t,i)}),t}function kh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Zi(t,[n]))}function sI(e){return dt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function vu(e,t){this._modeling=e,this._canvas=t}vu.$inject=["modeling","canvas"],vu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;U(n,function(o){var r={x:0,y:0};xn(i.left)?r.x=i.left-o.x:xn(i.right)?r.x=i.right-o.width-o.x:xn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:xn(i.top)?r.y=i.top-o.y:xn(i.bottom)?r.y=i.bottom-o.height-o.y:xn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},vu.prototype.postExecute=function(e){};function xu(e){this._modeling=e}xu.$inject=["modeling"],xu.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},xu.prototype.postExecute=function(e){var t=e.hints||{};cI(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 cI(e,t){return Go(e.outgoing,function(n){return n.target===t})}function bu(e,t){this._canvas=e,this._layouter=t}bu.$inject=["canvas","layouter"],bu.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},bu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var wu=Math.round;function Oh(e){this._modeling=e}Oh.$inject=["modeling"],Oh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;U(t,function(p){et(p.x)||(p.x=0),et(p.y)||(p.y=0)});var s=ft(t,function(p){return!p.hidden}),c=dn(s);U(t,function(p){Lt(p)&&(p.waypoints=zn(p.waypoints,function(d){return{x:wu(d.x-c.x-c.width/2+o.x),y:wu(d.y-c.y-c.height/2+o.y)}})),Z(p,{x:wu(p.x-c.x-c.width/2+o.x),y:wu(p.y-c.y-c.height/2+o.y)})});var l=new Set(El(t)),u={};U(t,function(p){if(Lt(p)){u[p.id]=et(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var d=Z({},r);l.has(p)||(d.autoResize=!1),ut(p)&&(d=Zi(d,["attach"])),u[p.id]=et(i)?a.createShape(p,ji(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,ji(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=ha(u)};var m_=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?Z(t,n):Z(t,{x:n.x-m_(t.width/2),y:n.y-m_(t.height/2)}),this._canvas.addShape(t,i,o),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Js(e){fr.call(this,e)}Ne(Js,fr),Js.$inject=["canvas"];var lI=fr.prototype.execute;Js.prototype.execute=function(e){var t=e.shape;return pI(t),t.labelTarget=e.labelTarget,lI.call(this,e)};var uI=fr.prototype.revert;Js.prototype.revert=function(e){return e.shape.labelTarget=null,uI.call(this,e)};function pI(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Qs(e,t){this._canvas=e,this._modeling=t}Qs.$inject=["canvas","modeling"],Qs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Qs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=af(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Qs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,sn(n.children,t,i),this._canvas.addConnection(t,n),t};function Dh(e,t){this._modeling=e,this._elementRegistry=t}Dh.$inject=["modeling","elementRegistry"],Dh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;U(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function ec(e,t){this._canvas=e,this._modeling=t}ec.$inject=["canvas","modeling"],ec.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){Lt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ec.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=af(i.children,n),t.removeShape(n),n},ec.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return sn(i.children,n,o),t.addShape(n,i),n};function _u(e){this._modeling=e}_u.$inject=["modeling"];var y_={x:"y",y:"x"};_u.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(y,_){y.range.min=Math.min(_[i],y.range.min),y.range.max=Math.max(_[i]+_[o],y.range.max)}function a(y){return y[i]+y[o]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,_){var h={y:0};h[i]=y-a(_),h[i]&&(h[y_[i]]=0,t.moveElements([_],h,_.parent))}var u=n[0],p=s(n),d=n[p],f,m,g=0;U(n,function(y,_){var h,v,b;if(y.elements.length<2){_&&_!==n.length-1&&(r(y,y.elements[0]),g+=c(y.range));return}h=Xi(y.elements,i),v=h[0],_===p&&(v=h[s(h)]),b=a(v),y.range=null,U(h,function(E){if(l(b,E),y.range===null){y.range={min:E[i],max:E[i]+E[o]};return}r(y,E)}),_&&_!==n.length-1&&(g+=c(y.range))}),m=Math.abs(d.range.min-u.range.max),f=Math.round((m-g)/(n.length-1)),!(f<n.length-1)&&U(n,function(y,_){var h={},v;y===u||y===d||(v=n[_-1],y.range.max=0,U(y.elements,function(b,E){h[y_[i]]=0,h[i]=v.range.max-b[i]+f,y.range.min!==b[i]&&(h[i]+=b[i]-y.range.min),h[i]&&t.moveElements([b],h,b.parent),y.range.max=Math.max(b[i]+b[o],E?y.range.max:0)}))})},_u.prototype.postExecute=function(e){};function Eu(e,t){this._layouter=e,this._canvas=t}Eu.$inject=["layouter","canvas"],Eu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return Z(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Eu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Lh(){}Lh.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=rn(r.children,t),sn(i.children,t,o),t.parent=i,U(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},Lh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return rn(n.children,t),sn(i.children,t,o),t.parent=i,U(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 Ih(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ih.prototype.add=function(e,t){return this.addAll([e],t)},Ih.prototype.addAll=function(e,t){var n=GP(e,!!t,this);return Z(this,n),this};function tc(e){this._modeling=e}tc.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},tc.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),U(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),U(s,function(p){var d=!!a[p.source.id],f=!!a[p.target.id];c[p.id]&&d&&f?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:d&&zf(p,p.source,t),connectionEnd:f&&Gf(p,p.target,t)})})},tc.prototype.getClosure=function(e){return new Ih().addAll(e,!0)};function Su(e){this._helper=new tc(e)}Su.$inject=["modeling"],Su.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Su.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Jr(e){this._modeling=e,this._helper=new tc(e)}Jr.$inject=["modeling"],Jr.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=ji(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=rn(r.children,t),sn(i.children,t,o),Z(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Jr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(U(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Gf(r,t,n)})}),U(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:zf(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Jr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return sn(n.children,t,i),Z(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Jr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Jr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function nc(e){this._modeling=e}nc.$inject=["modeling"],nc.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 Qe(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},nc.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||v_(Qe(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||v_(Qe(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},nc.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 v_(e){return e.original||e}function Oo(e,t){this._modeling=e,this._rules=t}Oo.$inject=["modeling","rules"],Oo.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(m,g,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:g})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var d=o.incoming.slice(),f=o.outgoing.slice();U(d,function(m){var g=m.source,y=c(g,s,m);y&&t.reconnectEnd(m,s,Zl(m,s,u),a)}),U(f,function(m){var g=m.target,y=c(s,g,m);y&&t.reconnectStart(m,s,Xl(m,s,u),a)})},Oo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Oo.prototype.execute=function(e){},Oo.prototype.revert=function(e){},Oo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Oo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Oo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ic(e){this._modeling=e}ic.$inject=["modeling"],ic.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},Z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ic.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(U(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Zl(r,n,i)})}),U(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Xl(r,n,i)})}))},ic.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return Z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.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),U(o,function(s){a[s.id]=fI(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(jL(i,o),t,n,r,i,o,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;U(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;U(e,function(o){var r=HL(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);U(e,function(u){var p=u.source,d=u.target,f=dI(u),m=b_(n),g={},y=c.has(p)||l.has(p),_=c.has(d)||l.has(d);y&&_?(f=zn(f,function(h){return w_(h,i,n)&&(h[m]=h[m]+t[m]),h.original&&w_(h.original,i,n)&&(h.original[m]=h.original[m]+t[m]),h}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(y||_)&&(c.has(p)?g.connectionStart=zf(u,p,t):c.has(d)?g.connectionEnd=Gf(u,d,t):l.has(p)?g.connectionStart=Xl(u,p,a[p.id]):l.has(d)&&(g.connectionEnd=Zl(u,d,a[d.id])),s._modeling.layoutConnection(u,g))})};function x_(e){return Z({},e)}function dI(e){return zn(e.waypoints,function(t){return t=x_(t),t.original&&(t.original=x_(t.original)),t})}function b_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function w_(e,t,n){var i=b_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function fI(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ru(e){this._modeling=e}Ru.$inject=["modeling"],Ru.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=__(n),t.collapsed=!t.collapsed;var i=E_(n,t.collapsed);return[t].concat(i)},Ru.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=S_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function __(e){var t={};return U(e,function(n){t[n.id]=n.hidden,n.children&&(t=Z({},t,__(n.children)))}),t}function E_(e,t){var n=[];return U(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(E_(i.children,i.collapsed||t)))}),n}function S_(e,t){var n=[];return U(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(S_(i.children,t)))}),n}function Mu(e){this._modeling=e}Mu.$inject=["modeling"],Mu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=R_(i,t),M_(n,t),t.host=n,t},Mu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,R_(n,t),M_(i,t,o),t};function R_(e,t){return rn(e&&e.attachers,t)}function M_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),sn(i,t,n)}}function Bh(){}Bh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Bh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function It(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}It.$inject=["eventBus","elementFactory","commandStack"],It.prototype.getHandlers=function(){return{"shape.append":xu,"shape.create":fr,"shape.delete":ec,"shape.move":Jr,"shape.resize":ic,"shape.replace":Oo,"shape.toggleCollapse":Ru,spaceTool:hr,"label.create":Js,"connection.create":bu,"connection.delete":Qs,"connection.move":Lh,"connection.layout":Eu,"connection.updateWaypoints":Bh,"connection.reconnect":nc,"elements.create":Oh,"elements.move":Su,"elements.delete":Dh,"elements.distribute":_u,"elements.align":vu,"element.updateAttachment":Mu}},It.prototype.registerHandlers=function(e){U(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},It.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)},It.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},It.prototype.moveElements=function(e,t,n,i){i=i||{};var 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)},It.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)},It.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},It.prototype.createConnection=function(e,t,n,i,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},It.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},It.prototype.createElements=function(e,t,n,i,o){Qe(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},It.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},It.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},It.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},It.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},It.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},It.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},It.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},It.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},It.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},It.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)},It.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},It.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},It.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,Z(i,{docking:"source"}))},It.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,Z(i,{docking:"target"}))},It.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},It.prototype._create=function(e,t){return A2(t)?t:this._elementFactory.create(e,t)},It.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function oc(e){this._elementRegistry=e}oc.$inject=["elementRegistry"],oc.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||hI(n,zc(i));return C_(n,i),e.oldProperties=r,e.changed=o,o},oc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return C_(n,t),i},oc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?gI(e,t):[]};function hI(e,t){return si(t,function(n,i){return n[i]=e.get(i),n},{})}function C_(e,t){U(t,function(n,i){e.set(i,n)})}function gI(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&Ee(n).dataObjectRef===e})}var rc="default",Do="id",A_="di",mI={width:0,height:0};function ac(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ac.$inject=["elementRegistry","moddle","modeling","textRenderer"],ac.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=wI(e.properties),s=e.oldProperties||yI(t,a);return T_(a,r)&&(o.unclaim(r[Do]),i.updateId(t,a[Do]),o.claim(a[Do],r)),rc in a&&(a[rc]&&n.push(i.get(a[rc].id)),r[rc]&&n.push(i.get(r[rc].id))),P_(t,a),e.oldProperties=s,e.changed=n,n},ac.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Ee(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,mI)}},ac.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return P_(t,i),T_(n,o)&&(a.unclaim(n[Do]),r.updateId(t,i[Do]),a.claim(i[Do],o)),e.changed};function T_(e,t){return Do in e&&e[Do]!==t[Do]}function yI(e,t){var n=zc(t),i=e.businessObject,o=xt(e);return si(n,function(r,a){return a!==A_?r[a]=i.get(a):r[a]=vI(o,zc(t.di)),r},{})}function vI(e,t){return si(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function P_(e,t){var n=e.businessObject,i=xt(e);U(t,function(o,r){r!==A_?n.set(r,o):i&&xI(i,o)})}function xI(e,t){U(t,function(n,i){e.set(i,n)})}var bI=["default"];function wI(e){var t=Z({},e);return bI.forEach(function(n){n in e&&(t[n]=Ee(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=xt(o);return t.setRootElement(n),t.removeRootElement(o),sn(a.rootElements,i),i.$parent=a,rn(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=xt(n);return t.setRootElement(o),t.removeRootElement(n),rn(a.rootElements,i),i.$parent=null,sn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Nh(e,t){this._modeling=e,this._spaceTool=t}Nh.$inject=["modeling","spaceTool"],Nh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ai(i),a=r===i,s=a?i:i.parent,c=ar(s),l=Rn(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+Ci,y:i.y,width:i.width-Ci,height:i.height}:{x:i.x,y:i.y+Ci,width:i.width,height:i.height-Ci};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Gr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:ft(b.children,function(E){return E!==i})});var d,f,m,g,y;o==="top"?(d=-120,f=i.y,m=f+10,g="n",y="y"):o==="left"?(d=-120,f=i.x,m=f+10,g="w",y="x"):o==="bottom"?(d=120,f=i.y+i.height,m=f-10,g="s",y="y"):o==="right"&&(d=120,f=i.x+i.width,m=f-10,g="e",y="x");var _=t.calculateAdjustments(p,y,d,m),h=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,h,g,m);var v=l?{x:i.x+(a?Ci:0),y:f-(o==="top"?120:0),width:i.width-(a?Ci:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Ci:0),width:120,height:i.height-(a?Ci:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function $h(e){this._modeling=e}$h.$inject=["modeling"],$h.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=ar(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=Rn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,d;for(d=0;d<i;d++)d===i-1?l=s-c*d:l=c,u=a?{x:n.x+Ci,y:n.y+d*c,width:n.width-Ci,height:l}:{x:n.x+d*c,y:n.y+Ci,width:l,height:n.height-Ci},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function sc(e,t){this._modeling=e,this._spaceTool=t}sc.$inject=["modeling","spaceTool"],sc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},sc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=gO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},sc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ze(e),o=Ze(t),r=cb(o,i),a=Ai(e),s=[],c=[];Gr(a,function(m){return s.push(m),(A(m,"bpmn:Lane")||A(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,p,d,f;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",d=r.top>0||r.bottom<0?-l:l,f=n.calculateAdjustments(s,"y",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",d=r.left>0||r.right<0?-l:l,f=n.calculateAdjustments(c,"x",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},p))};var cc="flowNodeRef",Fh="lanes";function Au(){}Au.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=Ze(p),f={x:u.x+u.width/2,y:u.y+u.height/2};return f.x>d.left&&f.x<d.right&&f.y>d.top&&f.y<d.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ai(u);return o[p.id]||(o[p.id]=Wl(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(d){return a(u,d)}).map(function(d){return d.businessObject})}return t.forEach(function(u){var p=Ai(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return A(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get(Fh),f=d.slice(),m=l(u);i.push({flowNode:p,remove:f,add:m})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(cc).forEach(function(d){i.push({flowNode:d,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(Fh);n.remove.forEach(function(r){rn(o,r),rn(r.get(cc),i)}),n.add.forEach(function(r){sn(o,r),sn(r.get(cc),i)})}),[]},Au.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Fh);n.add.forEach(function(r){rn(o,r),rn(r.get(cc),i)}),n.remove.forEach(function(r){sn(o,r),sn(r.get(cc),i)})}),[]};var jh="categoryValueRef";function lc(e,t){this._bpmnFactory=e,this._elementRegistry=t}lc.$inject=["bpmnFactory","elementRegistry"],lc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(h,v,b){if(v){var E=a.get(h);E||(E={},a.set(h,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:Hh(h)}:E.past={categoryValue:v}))}}function c(h){o.set(h,Ee(h))}function l(){n.filter(function(h){return A(h,"bpmn:FlowElement")&&!ut(h)&&h.parent}).forEach(c)}function u(h){var v=Ee(h),b=v.get("categoryValueRef");return b||(b=ib(i,v),r.push(_I(h,b))),b}function p(h){return h.reduce(function(v,b){var E=Hh(b),M=v.get(E);return M||(M=[],v.set(E,M)),M.push(b),v},new Map)}e=Array.from(e||[]);var d=p(e);t.length&&l(),e.forEach(c),n.filter(function(h){return A(h,"bpmn:Group")&&!ut(h)&&h.parent}).forEach(function(h){var v=Ee(h).get("categoryValueRef");if(!v){var b=Hh(h),E=d.get(b)||[],M=Ra(E,h),B=Object.keys(M).length>0;B&&(v=u(h))}s(h,v,!0)}),t.forEach(function(h){s(h.groupShape,h.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),m=Array.from(a.values()).reduce(function(h,v){return v.present&&h.add(v.present.categoryValue),v.past&&h.add(v.past.categoryValue),h},new Set),g=new Map,y=p(f);a.forEach(function(h,v){var b=h.present;if(b){var E=y.get(b.root)||[],M=Ra(E,v);E.forEach(function(B){if(M[B.id]){var P=g.get(B);P||(P=new Set,g.set(B,P)),P.add(b.categoryValue)}})}});var _=f.reduce(function(h,v){var b=o.get(v),E=b.get(jh),M=new Set(E),B=g.get(v)||new Set,P=Array.from(B).filter(function(N){return!M.has(N)}),k=E.filter(function(N){return m.has(N)&&!B.has(N)});return(P.length||k.length)&&h.push({businessObject:b,categoryValuesToAdd:P,categoryValuesToRemove:k}),h},[]);return{flowElements:_,groups:r}},lc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),EI(t.groups),RI(t.flowElements),[]},lc.prototype.revert=function(e){var t=e.updates;return MI(t.flowElements),SI(t.groups),[]};function _I(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function EI(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function SI(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=null})}function RI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jh);t.categoryValuesToRemove.forEach(function(o){rn(i,o)}),t.categoryValuesToAdd.forEach(function(o){sn(i,o,!0)})})}function MI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jh);t.categoryValuesToAdd.forEach(function(o){rn(i,o)}),t.categoryValuesToRemove.forEach(function(o){sn(i,o,!0)})})}function Hh(e){for(;e.parent;)e=e.parent;return e}function Tu(e){this._moddle=e}Tu.$inject=["moddle"],Tu.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},Tu.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 CI={fill:void 0,stroke:void 0};function zh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ri(t)){var n=AI(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}zh.$inject=["commandStack"],zh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||CI,i=this,o={};"fill"in n&&Z(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&Z(o,{"border-color":this._normalizeColor(n.stroke)}),U(t,function(r){var a=Lt(r)?ji(o,["border-color"]):o,s=xt(r);if(TI(a),ut(r)){if(!s||!A(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!dt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function AI(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 TI(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var PI={width:0,height:0};function k_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return ok(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!ut(l)&&or(l)&&!Ol(l)&&!O_(p)){var d=7,f=df(l);f={x:f.x,y:f.y+d},e.createLabel(l,f,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=ui(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,d=c.newBounds,f=c.hints||{};if(!(!ut(u)&&!A(u,"bpmn:TextAnnotation"))){if(ut(u)&&O_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=ui(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,m)),d&&e.resizeShape(u,d,PI)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}k_.$inject=["modeling","textRenderer","bpmnFactory"];function O_(e){return!e||!e.trim()}function jn(e,t,n,i){It.call(this,e,t,n),this._bpmnRules=i}Ne(jn,It),jn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],jn.prototype.getHandlers=function(){var e=It.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=oc,e["element.updateProperties"]=ac,e["canvas.updateRoot"]=Cu,e["lane.add"]=Nh,e["lane.resize"]=sc,e["lane.split"]=$h,e["lane.updateRefs"]=Au,e["group.updateRefs"]=lc,e["id.updateClaim"]=Tu,e["element.setColor"]=zh,e["element.updateLabel"]=k_,e},jn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},jn.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)},jn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},jn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},jn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},jn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},jn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},jn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},jn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},jn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},jn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},jn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},jn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},jn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function D_(){}D_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||tt(t.source||e.source),t.connectionEnd||tt(t.target||e.target)]};var Pu=20,kI=5,ku=Math.round,L_=20,OI={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function DI(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function LI(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function I_(e,t,n){var i=Nn(t,e,kI),o=n.split(":")[0],r=ku((t.x-e.x)/2+e.x),a=ku((t.y-e.y)/2+e.y),s,c,l=LI(o,i),u=/h|r|l/.test(o),p=!1,d=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=DI(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+Pu*(/l/.test(o)?-1:1),y:d?a+Pu:a}):(d=r===e.x,s={x:d?r+Pu:r,y:e.y+Pu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Gh(e,s,c).concat(s),directions:c,turnNextDirections:d}}function II(e,t,n){return I_(e,t,n)}function BI(e,t,n){var i=I_(t,e,B_(n));return{waypoints:i.waypoints.slice().reverse(),directions:B_(i.directions),turnNextDirections:i.turnNextDirections}}function NI(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=Gh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function B_(e){return e.split(":").reverse().join(":")}function $I(e,t,n){var i=ku((t.x-e.x)/2+e.x),o=ku((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 Gh(e,t,n){if(n=n||"h:h",!qI(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if($_(n)){var i=II(e,t,n),o=BI(e,t,n),r=NI(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return $I(e,t,n)}function FI(e,t,n){var i=Gh(e,t,n);return i.unshift(e),i.push(t),j_(i)}function jI(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=kR(r,"straight")[0]||"h:h",s=OI[a]||0,c=Nn(e,t,s),l=UI(c,a);n=n||tt(e),i=i||tt(t);var u=l.split(":"),p=F_(n,e,u[0],YI(c)),d=F_(i,t,u[1],c);return FI(p,d,l)}function HI(e,t,n,i,o,r){Qe(n)&&(o=n,r=i,n=tt(e),i=tt(t)),r=Z({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&GI(e,t,n,i,r),c||(c=r.connectionEnd&&WI(t,e,i,o),c)||(c=r.connectionStart&&VI(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:jI(e,t,n,i,r)}function zI(e,t,n){return e>=t&&e<=n}function N_(e,t,n){var i={x:"width",y:"height"};return zI(t[e],n[e],n[e]+n[i[e]])}function GI(e,t,n,i,o){var r={},a,s;return s=Nn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?N_(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:N_(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 VI(e,t,n,i){return Vh(e,t,n,i)}function WI(e,t,n,i){var o=i.slice().reverse();return o=Vh(e,t,n,o),o?o.reverse():null}function Vh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!$t(u,function(p,d){var f=u[d-1];return f&&Ds(p,f)<3})}function r(u,p,d){var f=So(p,u);switch(f){case"v":return{x:d.x,y:u.y};case"h":return{x:u.x,y:d.y}}return{x:u.x,y:u.y}}function a(u,p,d){var f;for(f=u.length-2;f!==0;f--)if(sx(u[f],p,L_)||sx(u[f],d,L_))return u.slice(f);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=Vh(e,t,n,l)),c&&So(c)?null:c}function UI(e,t){if($_(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 qI(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function $_(e){return e&&/t|r|b|l/.test(e)}function YI(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 j_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return sf(o,r,n,0)||t.push(n),t},[])}var KI=-10,XI=40,ZI={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},JI={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},Wh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},uc={top:"t",right:"r",bottom:"b",left:"l"};function Ou(e){this._elementRegistry=e}Ne(Ou,D_),Ou.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)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!z_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Qx(n,s)?ZI:JI;return A(e,"bpmn:MessageFlow")?c=eB(n,i,u):(A(e,"bpmn:SequenceFlow")||z_(n,i))&&(n===i?c={preferredLayouts:aB(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:sB(n,i,a,u)}:pc(n)||pc(i)?c={preferredLayouts:u.subProcess,preserveDocking:nB(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=Z(c,t),l=j_(HI(n,i,r,a,o,c))),l||[r,a]};function QI(e){var t=e.host;return Nn(tt(e),t,KI)}function eB(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:tB(e,t)}}function tB(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":pc(t)?"source":pc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function nB(e){return pc(e)?"target":"source"}function H_(e,t){return e?e.original||e:tt(t)}function z_(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function pc(e){return A(e,"bpmn:SubProcess")&&yt(e)}function Qr(e,t){return e===t}function iB(e,t){return t.indexOf(e)!==-1}function za(e){var t=/right|left/.exec(e);return t&&t[0]}function Ga(e){var t=/top|bottom/.exec(e);return t&&t[0]}function G_(e,t){return Wh[e]===t}function oB(e,t){var n=za(e),i=Wh[n];return t.indexOf(i)!==-1}function rB(e,t){var n=Ga(e),i=Wh[n];return t.indexOf(i)!==-1}function V_(e){return e==="right"||e==="left"}function aB(e,t,n){var i=t.waypoints,o=i&&i.length&&Nn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function sB(e,t,n,i){var o=tt(e),r=tt(t),a=QI(e),s,c,l=Qr(e.host,t),u=iB(a,["top","right","bottom","left"]),p=Nn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?cB(a,u,e,t,n,i):(s=lB(a,p,u,i.isHorizontal),c=uB(a,p,u,i.isHorizontal),[s+":"+c])}function cB(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Ga(e):za(e),s=uc[a],c;return t?V_(e)?c=W_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=W_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function W_(e,t,n,i){var o=XI;return!(Uh(e,i,n,o)||Uh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Uh(e,i,tt(t),o))}function Uh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function lB(e,t,n,i){if(n)return uc[e];var o=Ga(e),r=za(e),a=Ga(t),s=za(t);if(i){if(Qr(o,a)||G_(r,s))return uc[o]}else if(Qr(r,s)||G_(o,a))return uc[r];return uc[i?r:o]}function uB(e,t,n,i){if(n)return V_(e)?oB(e,t)||Qr(e,t)?"h":"v":rB(e,t)||Qr(e,t)?"v":"h";var o=Ga(e),r=za(e),a=Ga(t),s=za(t);return a&&!s?"v":s&&!a?"h":i?Qr(o,a)?"h":"v":Qr(r,s)?"v":"h"}Ou.$inject=["elementRegistry"];function U_(e){return Z({original:e.point.original||e.point},e.actual)}function gr(e,t){this._elementRegistry=e,this._graphicsFactory=t}gr.$inject=["elementRegistry","graphicsFactory"],gr.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(U_(i)),r.push(U_(o)),r},gr.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}},gr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Ls(i,o,n)},gr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},gr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},gr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const qh={__init__:["modeling","bpmnUpdater"],__depends__:[TD,WD,qD,YD,o_,KL,ZL,iI,Pi,Ph,u_],bpmnFactory:["type",Oi],bpmnUpdater:["type",hi],elementFactory:["type",dr],modeling:["type",jn],layouter:["type",Ou],connectionDocking:["type",gr]};var pB=10,q_=50,dB=250;function Yh(e,t,n,i){for(var o;o=fB(e,n,t);)n=i(t,n,o);return n}function Kh(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 fB(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=gB(e);return $t(o,function(r){if(r===n)return!1;var a=Nn(r,i,pB);return a==="intersect"})}function hB(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||q_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||dB,c=t.reference||"start";r||(r=vB);function l(m,g){return o==="n"?c==="start"?Ze(m).top-Ze(g).bottom:c==="center"?Ze(m).top-tt(g).y:Ze(m).top-Ze(g).top:o==="w"?c==="start"?Ze(m).left-Ze(g).right:c==="center"?Ze(m).left-tt(g).x:Ze(m).left-Ze(g).left:o==="s"?c==="start"?Ze(g).top-Ze(m).bottom:c==="center"?tt(g).y-Ze(m).bottom:Ze(g).bottom-Ze(m).bottom:c==="start"?Ze(g).left-Ze(m).right:c==="center"?tt(g).x-Ze(m).right:Ze(g).right-Ze(m).right}var u=e.incoming.filter(r).map(function(m){var g=a(m),y=g<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:g}}),p=e.outgoing.filter(r).map(function(m){var g=a(m),y=g>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:g}}),d=u.concat(p).reduce(function(m,g){return m[g.id+"__weight_"+g.weight]=g,m},{}),f=si(d,function(m,g){var y=g.distance,_=g.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*_,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return f.distance||i}function gB(e){var t=Xh(e);return e.host&&(t=t.concat(Xh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Xh(i))},[]))),t}function Xh(e){return yB(e).concat(mB(e))}function mB(e){return e.incoming.map(function(t){return t.source})}function yB(e){return e.outgoing.map(function(t){return t.target})}function vB(){return!0}var xB=100;function Y_(e,t,n){e.on("autoPlace",xB,function(i){var o=i.shape,r=i.source;return bB(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}}Y_.$inject=["eventBus","modeling","canvas"];function bB(e,t,n){n||(n={});var i=n.defaultDistance||q_,o=tt(e),r=Ze(e);return{x:r.right+i+t.width/2,y:o.y}}function K_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}K_.$inject=["eventBus","selection"];const wB={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Y_],autoPlaceSelectionBehavior:["type",K_]};function X_(e,t,n){var i=Qx(e,n);if(A(t,"bpmn:TextAnnotation"))return EB(e,t,i);if(dt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return SB(e,t,i);if(A(t,"bpmn:FlowNode"))return _B(e,t,i)}function _B(e,t,n){var i=Ze(e),o=tt(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=hB(e,{filter:function(f){return A(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;A(e,"bpmn:BoundaryEvent")&&(l=Nn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+Z_(l,c,r)}:{x:o.x+Z_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return Yh(e,t,u,Kh(d))}function Z_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function EB(e,t,n){var i=Ze(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};Lt(e)&&(o=tt(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 Yh(e,t,o,Kh(a))}function SB(e,t,n){var i=Ze(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 Yh(e,t,o,Kh(a))}function J_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return X_(o,i,t)})}J_.$inject=["eventBus","elementRegistry"];const Du={__depends__:[wB],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",J_]};function Lo(e,t,n,i){_e.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=zp(ha(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ga(s,function(p){return p.parent.id});U(u,function(p,d){Qe(l)&&(p=p.filter(function(f){return $t(l,ma({id:f.id}))})),o._expand(p,d)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}Lo.$inject=["eventBus","elementRegistry","modeling","rules"],Ne(Lo,_e),Lo.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ze(dn(e)),r=Ze(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),Ml(Z({},r,a))},Lo.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(RB(i,t)){var o=MB(ji(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Lo.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Lo.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Lo.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function RB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function MB(e,t){var n="";return e=Ze(e),t=Ze(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 Lu(e){e.invoke(Lo,this)}Lu.$inject=["injector"],Ne(Lu,Lo),Lu.prototype.resize=function(e,t,n){A(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function dc(e){Ti.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}dc.$inject=["eventBus"],Ne(dc,Ti),dc.prototype.canResize=function(e,t){return!1};function Iu(e,t){dc.call(this,e),this._modeling=t}Ne(Iu,dc),Iu.$inject=["eventBus","modeling"],Iu.prototype.canResize=function(e,t){if(A(t.di,"bpmndi:BPMNPlane")||!A(t,"bpmn:Participant")&&!A(t,"bpmn:Lane")&&!A(t,"bpmn:SubProcess"))return!1;var n=!0;return U(e,function(i){if(A(i,"bpmn:Lane")||ut(i)){n=!1;return}}),n};const Q_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Lu],bpmnAutoResizeProvider:["type",Iu]},CB=1500;class e0{constructor(t){t.on("moddleCopy.canCopyProperties",CB,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Or)))return;const o=An(n);o!==void 0&&i.set("xml:lang",o)})}}ln(e0,"$inject",["eventBus"]);const t0={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",e0]},AB=500,Bu=1,n0=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Bu||n>e.x+e.width+Bu||i<e.y-Bu||i>e.y+e.height+Bu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class i0{constructor(t){t.on("bpmnElement.added",AB,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(n0(n.source,i[0]),n0(n.target,i[i.length-1]))})}}ln(i0,"$inject",["eventBus"]);const o0={__init__:["annotationImportDocking"],annotationImportDocking:["type",i0]},Zh=[Zx,js,qh,Du,Q_,Jp,t0,o0,dv];function TB(e={}){qm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Vr({container:t,moddleExtensions:e.moddleExtensions??gs,additionalModules:[...Zh,...e.additionalModules??[]]})}const r0={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","merge-before-predecessor":"연결","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":"풀"},PB={이:["이","가"],을:["을","를"],와:["과","와"]};function kB(e,t){const[n,i]=PB[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 OB={"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":"연관선"},DB="요소";function Jh(e){return(e&&OB[e.type])??DB}const a0=20;function LB(e){const t=e.replace(/\s+/g," ").trim();return t.length>a0?`${t.slice(0,a0)}…`:t}function Nu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:LB(o.name),a=r===void 0?i+Jh(o):r,s=r===void 0?a:`「${r}」`;return n?s+kB(a,n).slice(a.length):s}function IB(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&&Jh(r)===Jh(a);return[Nu(e,t,i),Nu(e,n,o,s?"다른 ":"")]}function BB(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 NB(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];case"merge-before-predecessor":return[e.merge,e.edge]}}const $u={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function $B(e,t){const n=(o,r)=>Nu(t,o,r),i=(o,r,a,s)=>IB(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)}의 ${$u[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)}의 ${$u[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${$u[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${$u[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} 겹칩니다.`}case"merge-before-predecessor":return`합류 ${n(e.merge,"이")} 앞 단계보다 앞에 놓여 ${n(e.edge,"이")} 거꾸로 들어갑니다.`}}function FB(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Nu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const s0="기타",Qh={error:0,warning:1,info:2};function c0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${lt(i)}`,source:"geometry",code:i.kind,severity:BB(i),targetRefs:NB(i),category:r0[i.kind]??s0,message:$B(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:r0[i.ruleId]??s0,message:FB(i,t)});return n}function l0(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Va(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function eg(e,t){if(t===void 0||e.length===0)return!1;const n=Va(e[0],t);return e.some(i=>Va(i,t)!==n)}function u0(e,t){const n=eg(e,t);return e.slice().sort((i,o)=>(n?Number(Va(o,t))-Number(Va(i,t)):0)||Qh[i.severity]-Qh[o.severity])}const p0="i18n-untranslated",d0="i18n-review-requested",fc="i18nDisplay.redrawn",f0=[["untranslated",p0],["reviewRequested",d0]];class tg{constructor(t,n,i,o,r,a,s,c){ln(this,"config");ln(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(d,f,m)=>this.withDisplayText(f,()=>l(d,f,m),d);const u=r.activate.bind(r);r.activate=d=>this.withDisplayText(d,()=>u(d));const p=r.update.bind(r);r.update=(d,f,m,g)=>{const y=this.resolve(d);if(!y||y.native)return p(d,f,m,g);(f??"").trim()!==(m??"").trim()&&i.execute(Vc,{element:d.labelTarget??d,locale:this.displayLocale,text:f,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",d=>{if(!this.config)return;const{element:f,newLabel:m,oldLabel:g}=d.context;(m??"")!==(g??"")&&i.execute(Vc,{element:f.labelTarget??f,locale:this.displayLocale,text:m??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:g??""})})}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=Dr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Vo(n).filter(d=>An(d)),s=d=>d.body??"",c=a.find(d=>An(d)===o&&s(d)),l=Wo(n).some(d=>d.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(d=>s(d)===r).map(An);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i){var d;if(!this.config)return n();const o=this.resolve(t),r=(d=i==null?void 0:i.parentNode)==null?void 0:d.classList;if(r)for(const[f,m]of f0)r.toggle(m,(o==null?void 0:o.status)===f);if(!o||o.native)return n();const{target:a,key:s}=Dr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const f=n();return p&&(f!=null&&f.setAttribute)&&f.setAttribute("transform",`translate(${p.dx}, 0)`),f}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,o]of f0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(fc)}}ln(tg,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const h0={__depends__:[Jp],__init__:["i18nDisplay"],i18nDisplay:["type",tg]};var jB=2e3;function ng(e,t,n){e.on("autoPlace",jB,function(i){var o=i.source,r=tt(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],A(a,"bpmn:TextAnnotation")&&(HB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}ng.$inject=["eventBus","gridSnapping","elementRegistry"];function HB(e){return e==="x"}var zB=3e3;function Wa(e,t,n){_e.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],zB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||GB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Wa.$inject=["eventBus","gridSnapping","modeling"],Ne(Wa,_e),Wa.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=UB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function GB(e){return e.length>3}function VB(e){return e==="h"}function WB(e){return e==="v"}function UB(e,t,n){var i=So(t,n),o={};return VB(i)&&(o.y=e.snapValue(t.y)),WB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=Z({},t,o),n=Z({},n,o)),[t,n]}function qB(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Nr(e,t),fontBoundingBoxAscent:t*Qi.ascentEm,fontBoundingBoxDescent:t*Qi.descentEm,actualBoundingBoxAscent:t*Qi.ascentEm,actualBoundingBoxDescent:t*Qi.descentEm}}class ig{constructor(t,n,i,o,r,a){ln(this,"active",!1);ln(this,"shadow");ln(this,"shadowContainer");this.eventBus=t,this.elementRegistry=n,this.textRenderer=i,this.graphicsFactory=o,this.canvas=r,this.bpmnjs=a,t.on("diagram.destroy",()=>this.disposeShadow());let s=[];t.on("elements.changed",c=>{this.active||(s=c.elements??[])}),t.on("commandStack.changed",c=>{const l=s;s=[],!(this.active||(c==null?void 0:c.trigger)!=="undo"&&(c==null?void 0:c.trigger)!=="redo")&&this.remeasureLabelsOf(l)})}isActive(){return this.active}run(t){if(this.active)throw new Error("headlessReplay.run: 이미 창 안이다(중첩 금지)");const n=typeof CanvasRenderingContext2D>"u"?void 0:CanvasRenderingContext2D.prototype,i=n==null?void 0:n.measureText;n&&(n.measureText=qB),this.active=!0;try{return this.reproject(),t()}finally{this.active=!1,n&&i&&(n.measureText=i),this.relabel(),this.syncGraphicsOrder(),this.redrawAll()}}atBatchBoundary(){if(!this.active)throw new Error("headlessReplay.atBatchBoundary: 창 밖이다");this.eventBus.fire("saveXML.start",{definitions:this.bpmnjs.getDefinitions()}),this.reproject()}reproject(){const t=this.ensureShadow();t.get("eventBus").fire("diagram.clear");let n=!1;t.get("eventBus").once("import.render.complete",()=>n=!0);let i;if(Ix(t,this.bpmnjs.getDefinitions()).catch(u=>i=u),!n)throw new Error(`headlessReplay: 그림자 import 가 동기로 끝나지 않았다${i?` — ${String(i)}`:""}`);const o=t.get("elementRegistry"),r=this.elementRegistry,a=u=>u?r.get(u.id):void 0,s=o.getAll();for(const u of s){const p=r.get(u.id);if(!p)continue;u.waypoints?p.waypoints=u.waypoints.map(f=>({x:f.x,y:f.y,...f.original?{original:{x:f.original.x,y:f.original.y}}:{}})):u.parent&&(p.x=u.x,p.y=u.y,p.width=u.width,p.height=u.height),p.collapsed=u.collapsed,p.hidden=u.hidden,p.isFrame=u.isFrame;const d=a(u.parent);d&&p.parent!==d&&(p.parent=d);for(const f of["incoming","outgoing"]){const m=(u[f]??[]).map(a).filter(Boolean),g=p[f];g&&m.length===g.length&&m.every(y=>g.includes(y))&&m.forEach((y,_)=>g[_]=y)}}for(const u of s){const p=r.get(u.id);if(!(p!=null&&p.children)||!u.children)continue;const d=u.children.map(a).filter(Boolean),f=p.children.filter(m=>!d.includes(m)&&m.parent===p);p.children.length=0,p.children.push(...d,...f)}const c=r._elements,l={};for(const u of s)u.id in c&&(l[u.id]=c[u.id]);for(const u of Object.keys(c))u in l||(l[u]=c[u]);r._elements=l}relabel(){for(const t of this.elementRegistry.filter(n=>n.type==="label"))this.remeasure(t)}remeasure(t){const n=t.labelTarget,i=n&&ui(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(Gx(xt(n),n),i),r={x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)};return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height?!1:(Object.assign(t,r),!0)}remeasureLabelsOf(t){const n=new Set;for(const o of t){(o==null?void 0:o.type)==="label"&&n.add(o);for(const r of(o==null?void 0:o.labels)??[])n.add(r)}let i=0;for(const o of n){if(!this.elementRegistry.get(o.id)||!this.remeasure(o))continue;const r=this.elementRegistry.getGraphics(o);r&&this.graphicsFactory.update("shape",o,r),i++}i&&this.eventBus.fire(fc)}syncGraphicsOrder(){var t,n;for(const i of this.elementRegistry.getAll()){if(!((t=i.children)!=null&&t.length))continue;const o=this.graphicsFactory._getChildrenContainer(i);for(const r of i.children){const a=(n=this.elementRegistry.getGraphics(r))==null?void 0:n.parentNode;a&&o.appendChild(a)}}}redrawAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);i&&this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}this.eventBus.fire(fc)}ensureShadow(){if(this.shadow)return this.shadow;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-10000px;top:0;width:800px;height:600px;visibility:hidden",document.body.appendChild(t),this.shadowContainer=t,this.shadow=new Vr({container:t,moddleExtensions:gs,additionalModules:[...Zh]}),this.shadow}disposeShadow(){var t,n;(t=this.shadow)==null||t.destroy(),this.shadow=void 0,(n=this.shadowContainer)==null||n.remove(),this.shadowContainer=void 0}}ln(ig,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function g0(e,t){const n=Object.create(e);return n.on=(i,o,r,a)=>{typeof o=="function"&&(a=r,r=o,o=1e3);const s=function(...c){return t.isActive()?void 0:r.apply(this,c)};return e.on(i,o,s,a)},n}function og(e,t,n,i){ng.call(this,g0(e,i),t,n)}og.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Fu(e,t,n,i){Wa.call(this,g0(e,i),t,n)}Fu.prototype=Object.create(Wa.prototype),Fu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function YB(e){return e instanceof og||e instanceof Fu}const m0={__init__:["headlessReplay"],headlessReplay:["type",ig],gridSnappingAutoPlaceBehavior:["type",og],gridSnappingLayoutConnectionBehavior:["type",Fu]};function ea(e){return CSS.escape(e)}var KB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function y0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return KB[t]})}var ju=50,XB=new Xr,v0={min:.2,max:4},ZB=10,JB=.1,QB=250,eN=100,tN=2e3;function Hn(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=XB.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=Hu({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg(p,r._canvas),r._update()}function s(u){return function(d){var f=ag(d);(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var m=Hu({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),g=i.viewbox(),y=iN(m,g),_=r._viewportDom.getBoundingClientRect(),h={x:f.x-_.left+1,y:f.y-_.top+1};Z(r._state,{cachedViewbox:g,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:y,offsetViewportDom:h,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ye.bind(document,"mousemove",c),Ye.bind(document,"mouseup",l)}}function c(u){var p=ag(u);if(r._state.isDragging){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,m=r._state.parentClientRect;Z(r._viewportDom.style,{top:p.y-d.y-m.top+"px",left:p.x-d.x-m.left+"px"});var g=b0(m,{top:p.y-d.y-m.top,left:p.x-d.x-m.left,width:f.width,height:f.height});Z(r._overlay.style,{clipPath:g});var y=Hu({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=ag(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),Z(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ye.unbind(document,"mousemove",c),Ye.unbind(document,"mouseup",l))}Ye.bind(this._viewportDom,"mousedown",s(!1)),Ye.bind(this._svg,"mousedown",s(!0)),Ye.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!cN(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*lN(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>JB){var f=d>0?1:-1,m=Math.log(i.zoom())/Math.log(10),g=uN(v0,ZB*2),y=Math.round(m/g)*g;y+=g*f;var _=Math.pow(10,y);i.zoom(pN(v0,_),h),r._state.zoomDelta=0;var h=Hu({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg(h,r._canvas),r._update()}}}),Ye.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",QB,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,d=u.newId;r._updateElementId(p,d)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(d){r._addElement(d)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}Hn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Hn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Pt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Pt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Pt(o).add("map"),n.appendChild(o);var r=this._svg=He("svg");De(r,{width:"100%",height:"100%"}),ot(o,r);var a=this._elementsGroup=He("g");ot(r,a);var s=this._viewportGroup=He("g");ot(r,s);var c=this._viewport=He("rect");mt(c).add("viewport"),ot(s,c),Ye.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Pt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Pt(u).add("overlay"),this._parent.appendChild(u)},Hn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=et(this._config.debounceDelay)?this._config.debounceDelay:eN,n=et(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:tN,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)}},Hn.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)})}},Hn.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(w0(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-ju,o=o-ju,r=r+ju*2,a=a+ju*2,this._lastViewbox={x:i,y:o,width:r,height:a},De(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),De(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};Z(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=b0(l,p);Z(this._overlay.style,{clipPath:d})}}},Hn.prototype.open=function(){Z(this._state,{isOpen:!0}),Pt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Tn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Hn.prototype.close=function(){Z(this._state,{isOpen:!1}),Pt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Tn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Hn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Hn.prototype.isOpen=function(){return this._state.isOpen},Hn.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)}},Hn.prototype._updateElementId=function(e,t){try{var n=Ct("#"+ea(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Hn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Hn.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=Ct("#"+ea(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=rN(e);return s!==-1?a?aN(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),nN(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),De(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),De(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},Hn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&pn(t)},Hn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=nr(t),n)){var i=dN(Kd(n));return De(i,{id:this._prefixId(e.id)}),i}},Hn.prototype._clear=function(){Cs(this._elementsGroup)},Hn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function nN(e){return e.waypoints}function iN(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 Hu(e,t,n){var i=t.getBoundingClientRect(),o=oN(n,i.width/i.height),r=x0(e.x,0,i.width,o.x,o.x+o.width),a=x0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function rg(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 oN(e,t){var n=e.width/e.height,i=Z({},{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;Z(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;Z(i,{x:s,width:a})}return i}function x0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function rN(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function aN(e,t,n){var i=sN(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function sN(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function zu(e){return e.width===0&&e.height===0}function cN(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var lN=Math.sign||function(e){return e>=0?1:-1};function uN(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 pN(e,t){return Math.max(e.min,Math.min(e.max,t))}function b0(e,t){var n=[uo(t.left,t.top),uo(t.left+t.width,t.top),uo(t.left+t.width,t.top+t.height),uo(t.left,t.top+t.height),uo(t.left,e.height),uo(e.width,e.height),uo(e.width,0),uo(0,0),uo(0,e.height),uo(t.left,e.height)].join(", ");return"polygon("+n+")"}function uo(e,t){return e+"px "+t+"px"}function w0(e){return zo(e,function(t){return bn(t)?w0(t):et(t)&&isFinite(t)})}function ag(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function dN(e){return Ms("[id]",e).forEach(function(t){t.remove()}),e}var fN={__init__:["minimap"],minimap:["type",Hn]};const _0={closed:"미니맵",open:"접기"};class E0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(fc,()=>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?_0.open:_0.closed)}}ln(E0,"$inject",["eventBus","minimap","canvas"]);const S0=[h0,{__depends__:[fN],__init__:["minimapI18n"],minimapI18n:["type",E0]},t0,o0,dv,m0];var hN=new Xr("ov"),gN=500;function Pn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=hN,this._overlayDefaults=Z({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=mN(n.getContainer()),this._init()}Pn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Pn.prototype.get=function(e){if(ri(e)&&(e={id:e}),ri(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ft(t.overlays,ma({type:e.type})):t.overlays.slice():[]}else return e.type?ft(this._overlays,ma({type:e.type})):e.id?this._overlays[e.id]:null},Pn.prototype.add=function(e,t,n){if(bn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=Z({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Pn.prototype.remove=function(e){var t=this.get(e)||[];Qe(t)||(t=[t]);var n=this;U(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(no(i.html),no(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Pn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Pn.prototype.show=function(){Gu(this._overlayRoot)},Pn.prototype.hide=function(){Gu(this._overlayRoot,!1)},Pn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xl(this._overlayRoot)},Pn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=dn(t);i=r.x,o=r.y}R0(n,i,o),Tn(e.html,"data-container-id",t.id)},Pn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=dn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=dn(i).height:s=i.height,r=t.bottom*-1+s}R0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Pn.prototype._createOverlayContainer=function(e){var t=Vt('<div class="djs-overlays" />');Kn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Pn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";M0(this._overlayRoot,n)},Pn.prototype._getOverlayContainer=function(e,t){var n=$t(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Pn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),ri(i)&&(i=Vt(i)),r=this._getOverlayContainer(n),o=Vt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Kn(o,{position:"absolute"}),o.appendChild(i),e.type&&Pt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Gu(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Pn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(xn(o)&&o>t.scale||xn(r)&&r<t.scale))&&(c=!1),Gu(a,c),this._updateOverlayScale(e,t)},Pn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),xn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),xn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),xn(a)&&(s="scale("+a+","+a+")"),M0(r,s)},Pn.prototype._updateOverlaysVisibilty=function(e){var t=this;U(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Pn.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});U(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){no(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",gN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(U(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&&Pt(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 mN(e){var t=Vt('<div class="djs-overlay-container" />');return Kn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function R0(e,t,n){Kn(e,{left:t+"px",top:n+"px"})}function Gu(e,t){e.style.display=t===!1?"none":""}function M0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Vu={__init__:["overlays"],overlays:["type",Pn]};function sg(e,t){t.invoke(_e,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ne(sg,_e),sg.$inject=["canvas","injector"];const yN={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",sg]};var vN="bjs-breadcrumbs-shown";function C0(e,t,n){var i=Vt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Pt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=Ee(l),p=$t(a,function(d){return d===u});p&&s()});function s(c){c&&(a=xN(c));var l=a.flatMap(function(p){var d=n.findRoot(so(p))||n.findRoot(p.id);if(!d&&A(p,"bpmn:Process")){var f=t.find(function(y){var _=Ee(y);return _&&_.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var m=y0(p.name||p.id),g=Vt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return g.addEventListener("click",function(){n.setRootElement(d)}),g});i.innerHTML="";var u=l.length>1;r.toggle(vN,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}C0.$inject=["eventBus","elementRegistry","canvas"];function xN(e){for(var t=Ee(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function A0(e,t){var n=null,i=new bN;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!A(r,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}A0.$inject=["eventBus","canvas"];function bN(){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 T0={x:180,y:160};function ta(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}ta.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)})}},ta.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),_N(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},ta.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=wN(e),i={x:n.x-T0.x,y:n.y-T0.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)})},ta.prototype._moveToDiPlane=function(e,t){var n=P0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},ta.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},ta.$inject=["eventBus","moddle"];function P0(e){return A(e,"bpmndi:BPMNDiagram")?e:P0(e.$parent)}function wN(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=Ze(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ml(t)}function _N(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||dt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Wu=250,EN='<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>',SN="bjs-drilldown-empty";function mr(e,t,n,i,o){_e.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Wu,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"],Wu,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)})})}Ne(mr,_e),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(so(e))},mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Pt(i.html).toggle(SN,!o)}},mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Ee(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Vt('<button type="button" class="bjs-drilldown">'+EN+"</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(so(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const RN={__depends__:[Vu,Ph,yN],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",C0],drilldownCentering:["type",A0],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",ta]};function yr(e){Xt.call(this,e)}Ne(yr,Xt),yr.prototype._modules=[Zx,RN,Vu,Pi,js],yr.prototype._moddleExtensions={};var Uu="keyboard.keydown",MN="keyboard.keyup",CN=1e3,k0="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 Xn(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(k0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Xn.$inject=["config.keyboard","eventBus"],Xn.prototype._keydownHandler=function(e){this._keyHandler(e,Uu)},Xn.prototype._keyupHandler=function(e){this._keyHandler(e,MN)},Xn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Uu,i),n&&e.preventDefault()}},Xn.prototype._isEventIgnored=function(e){return!1},Xn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(k0)),this.unbind(),e=this._node=this._target,Ye.bind(e,"keydown",this._keydownHandler),Ye.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Xn.prototype.getBinding=function(){return this._node},Xn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ye.unbind(e,"keydown",this._keydownHandler),Ye.unbind(e,"keyup",this._keyupHandler)),this._node=null},Xn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Xn.prototype.addListener=function(e,t,n){Sn(e)&&(n=t,t=e,e=CN),this._eventBus.on(n||Uu,e,t)},Xn.prototype.removeListener=function(e,t){this._eventBus.off(t||Uu,e)},Xn.prototype.hasModifier=sL,Xn.prototype.isCmd=di,Xn.prototype.isShift=xh,Xn.prototype.isKey=_n;var AN=500;function Ua(e,t){var n=this;e.on("editorActions.init",AN,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ua.$inject=["eventBus","keyboard"],Ua.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(dL(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(fL(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(cL(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(lL(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(uL(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(pL(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(_n(["+","Add","="],o)&&di(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(_n(["-","Subtract"],o)&&di(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(_n("0",o)&&di(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(_n(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const cg={__init__:["keyboard","keyboardBindings"],keyboard:["type",Xn],keyboardBindings:["type",Ua]};var TN={moveSpeed:50,moveSpeedAccelerated:200};function O0(e,t,n){var i=this;this._config=Z({},TN,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})}}O0.$inject=["config.keyboardMove","keyboard","canvas"];const D0={__depends__:[cg],__init__:["keyboardMove"],keyboardMove:["type",O0]};var PN=15;function L0(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=qr(s),p=Wi(u,c);if(!n.dragging&&kN(p)>PN&&(n.dragging=!0,l===0&&Nw(e),uu("grab")),n.dragging){var d=n.last||n.start;p=Wi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ye.unbind(document,"mousemove",o),Ye.unbind(document,"mouseup",r),n=null,Bw()}function a(s){if(!Hr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:qr(s)},Ye.bind(document,"mousemove",o),Ye.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}L0.$inject=["eventBus","canvas"];function kN(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const I0={__init__:["moveCanvas"],moveCanvas:["type",L0]};function B0(e,t){var n=mf(e.min),i=mf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function ON(e,t){return Math.max(e.min,Math.min(e.max,t))}var DN=Math.sign||function(e){return e>=0?1:-1},lg={min:.2,max:4},N0=10,LN=.1,IN=.75;function po(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||IN;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}po.$inject=["config.zoomScroll","eventBus","canvas"],po.prototype.scroll=function(t){this._canvas.scroll(t)},po.prototype.reset=function(){this._canvas.zoom("fit-viewport")},po.prototype.zoom=function(t,n){var i=B0(lg,N0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>LN&&(this._zoom(t,n,i),this._totalDelta=0)},po.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Vb()&&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))*DN(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)}},po.prototype.stepZoom=function(t,n){var i=B0(lg,N0);this._zoom(t,n,i)},po.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=mf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(ON(lg,s),t)},po.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ye[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},po.prototype._init=function(e){this.toggle(e)};const $0={__init__:["zoomScroll"],zoomScroll:["type",po]};function hc(e){yr.call(this,e)}Ne(hc,yr),hc.prototype._navigationModules=[D0,I0,$0],hc.prototype._modules=[].concat(yr.prototype._modules,hc.prototype._navigationModules);function ug(e){return e&&e[e.length-1]}function F0(e){return e.y}function j0(e){return e.x}var BN={left:j0,center:j0,right:function(e){return e.x+e.width},top:F0,middle:F0,bottom:function(e){return e.y+e.height}};function qa(e,t){this._modeling=e,this._rules=t}qa.$inject=["modeling","rules"],qa.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}},qa.prototype._isType=function(e,t){return t.indexOf(e)!==-1},qa.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(d,f){return Math.round((d[i]+f[i]+f[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=ug(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(U(t,function(d){var f=d[i]+Math.round(d[o]/2);a[f]?a[f].elements.push(d):a[f]={elements:[d],center:f}}),c=Xi(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=ug(c).center,r;l=t[0],t=Xi(t,function(d){return d[i]+d[o]}),u=ug(t),r[e]=p(l,u)}return r},qa.prototype.trigger=function(e,t){var n=this._modeling,i,o=ft(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Qe(i)&&(o=i),!(o.length<2||!i)){var r=BN[t],a=Xi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const NN={__init__:["alignElements"],alignElements:["type",qa]},$N=new Xr;function Ya(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ya.$inject=["eventBus"],Ya.prototype.schedule=function(e,t=$N.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ya.prototype._schedule=function(e,t){const n=FN();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}},Ya.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ya.prototype._cancel=function(e){clearTimeout(e.executionId)};function FN(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const jN={scheduler:["type",Ya]};var HN="djs-element-hidden",qu=".entry",zN=1e3,H0=8,GN=300;function hn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}hn.$inject=["canvas","elementRegistry","eventBus","scheduler"],hn.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=Qe(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=Qe(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},hn.prototype._createContainer=function(){var e=Vt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},hn.prototype.registerProvider=function(e,t){t||(t=e,e=zN),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},hn.prototype.getEntries=function(e){var t=this._getProviders(),n=Qe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return U(t,function(o){if(Sn(o[n])){var r=o[n](e);Sn(r)?i=r(i):U(r,function(a,s){i[s]=a})}}),i},hn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Tn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},GN);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},hn.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(Sn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},hn.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))}},hn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},hn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;U(t,function(o,r){var a=o.group||"default",s=Vt(o.html||'<div class="entry" draggable="true"></div>'),c;Tn(s,"data-action",r),c=Ct("[data-group="+ea(a)+"]",n),c||(c=Vt('<div class="group"></div>'),Tn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&VN(s,o.className),o.title&&Tn(s,"title",o.title),o.imageUrl&&(i=Vt("<img>"),Tn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Pt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},hn.prototype._createHtml=function(e){var t=this,n=Vt('<div class="djs-context-pad"></div>');return ci.bind(n,qu,"click",function(i){t.trigger("click",i)}),ci.bind(n,qu,"dragstart",function(i){t.trigger("dragstart",i)}),ci.bind(n,qu,"mouseover",function(i){t.trigger("mouseover",i)}),ci.bind(n,qu,"mouseout",function(i){t.trigger("mouseout",i)}),Ye.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},hn.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&UN(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},hn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},hn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Qe(e)!==Qe(n)?!1:Qe(e)?e.length===n.length&&zo(e,function(i){return n.includes(i)}):n===e},hn.prototype.isShown=function(){return this.isOpen()&&Pt(this._current.html).has("open")},hn.prototype.show=function(){this.isOpen()&&(Pt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},hn.prototype.hide=function(){this.isOpen()&&(Pt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},hn.prototype._getPosition=function(e){if(!Qe(e)&&Lt(e)){var t=this._canvas.viewbox(),n=WN(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+H0*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+H0*this._canvas.zoom(),top:s.top-a.top}},hn.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")},hn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Qe(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,HN)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},hn.prototype._getTargetBounds=function(e){var t=this,n=Qe(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 VN(e,t){var n=Pt(e);t=Qe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function WN(e){return e.waypoints[e.waypoints.length-1]}function UN(e,t){return e=Qe(e)?e:[e],t=Qe(t)?t:[t],e.length===t.length&&zo(e,function(n){return t.includes(n)})}const z0={__depends__:[lu,jN,Vu],contextPad:["type",hn]};var Yu,Jt,G0,vr,V0,W0,U0,pg,Ku,gc,q0,dg,fg,hg,Xu={},Zu=[],qN=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ju=Array.isArray;function Io(e,t){for(var n in t)e[n]=t[n];return e}function gg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Y0(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?Yu.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 Qu(e,a,i,o,null)}function Qu(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??++G0,__i:-1,__u:0};return o==null&&Jt.vnode!=null&&Jt.vnode(r),r}function ep(e){return e.children}function tp(e,t){this.props=e,this.context=t}function na(e,t){if(t==null)return e.__?na(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"?na(e):null}function YN(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Io({},t);r.__v=t.__v+1,Jt.vnode&&Jt.vnode(r),mg(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??na(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,nE(i,r,o),t.__e=t.__=null,r.__e!=n&&K0(r)}}function K0(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}),K0(e)}function X0(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!np.__r++||V0!=Jt.debounceRendering)&&((V0=Jt.debounceRendering)||W0)(np)}function np(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(U0),e=vr.shift(),t=vr.length,YN(e)}finally{vr.length=np.__r=0}}function Z0(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,m,g,y,_=i&&i.__k||Zu,h=t.length;for(c=KN(n,t,_,c,h),p=0;p<h;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&_[f.__i]||Xu,f.__i=p,y=mg(e,f,d,o,r,a,s,c,l,u),m=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&yg(d.ref,null,f),u.push(f.ref,f.__c||m,f)),g==null&&m!=null&&(g=m),4&f.__u?(c=J0(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function KN(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,d=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=Qu(null,a,null,null,null):Ju(a)?a=e.__k[r]=Qu(ep,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Qu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+d,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=XN(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?d--:o<u&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=na(s)),oE(s,s));return i}function J0(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=J0(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=na(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function XN(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 Q0(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||qN.test(t)?n:n+"px"}function ip(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||Q0(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Q0(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(q0,"$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[gc]=i[gc]:(n[gc]=dg,e.addEventListener(t,r?hg:fg,r)):e.removeEventListener(t,r?hg:fg,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 eE(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ku]==null)t[Ku]=dg++;else if(t[Ku]<n[gc])return;return n(Jt.event?Jt.event(t):t)}}}function mg(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,m,g,y,_,h,v,b,E,M,B,P,k,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Jt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(h=t.props,v=N.prototype&&N.prototype.render,b=(u=N.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?_=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new N(h,E):(t.__c=d=new tp(h,E),d.constructor=N,d.render=JN),b&&b.sub(d),d.state||(d.state={}),d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&N.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Io({},d.__s)),Io(d.__s,N.getDerivedStateFromProps(h,d.__s))),m=d.props,g=d.state,d.__v=t,f)v&&N.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&N.getDerivedStateFromProps==null&&h!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(h,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(h,d.__s,E)===!1){t.__v!=n.__v&&(d.props=h,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(G){G&&(G.__=t)}),Zu.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=na(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(h,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,y)})}if(d.context=E,d.props=h,d.__P=e,d.__e=!1,M=Jt.__r,B=0,v)d.state=d.__s,d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),Zu.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++B<25);d.state=d.__s,d.getChildContext!=null&&(i=Io(Io({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(m,g)),P=u!=null&&u.type===ep&&u.key==null?iE(u.props.children):u,s=Z0(e,Ju(P)?P:[P],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(G){if(a.length=p,t.__v=null,c||r!=null){if(G.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(k=r.length;k--;)gg(r[k])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),G.then||tE(t),Jt.__e(G,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=ZN(n.__e,t,n,i,o,r,a,c,l);return(u=Jt.diffed)&&u(t),128&t.__u?void 0:s}function tE(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(tE))}function nE(e,t,n){for(var i=0;i<n.length;i++)yg(n[i],n[++i],n[++i]);Jt.__c&&Jt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Jt.__e(r,o.__v)}})}function iE(e){return typeof e!="object"||e==null||e.__b>0?e:Ju(e)?e.map(iE):e.constructor!==void 0?null:Io({},e)}function ZN(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,m,g,y=n.props||Xu,_=t.props,h=t.type;if(h=="svg"?o="http://www.w3.org/2000/svg":h=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((f=r[l])&&"setAttribute"in f==!!h&&(h?f.localName==h:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(h==null)return document.createTextNode(_);e=document.createElementNS(o,h,_.is&&_),s&&(Jt.__m&&Jt.__m(t,r),s=!1),r=null}if(h==null)y===_||s&&e.data==_||(e.data=_);else{if(r=h=="textarea"&&_.defaultValue!=null?null:r&&Yu.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(f=e.attributes[l]).name]=f.value;for(l in y)f=y[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||ip(e,l,null,f,o);for(l in _)f=_[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?m=f:l=="checked"?g=f:s&&typeof f!="function"||y[l]===f||ip(e,l,f,y[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),Z0(t.type=="template"?e.content:e,Ju(d)?d:[d],t,n,i,h=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&na(n,0),s,c),r!=null)for(l=r.length;l--;)gg(r[l]);s&&h!="textarea"||(l="value",h=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||h=="progress"&&!m||h=="option"&&m!=y[l])&&ip(e,l,m,y[l],o),l="checked",g!=null&&g!=e[l]&&ip(e,l,g,y[l],o))}return e}function yg(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){Jt.__e(o,n)}}function oE(e,t,n){var i,o;if(Jt.unmount&&Jt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||yg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Jt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&oE(i[o],t,n||typeof e.type!="function");n||gg(e.__e),e.__c=e.__=e.__e=void 0}function JN(e,t,n){return this.constructor(e,n)}function rE(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Jt.__&&Jt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],mg(t,e=t.__k=Y0(ep,null,[e]),o||Xu,Xu,t.namespaceURI,o?null:t.firstChild?Yu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),nE(r,e,a),e.props.children=null}Yu=Zu.slice,Jt={__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}},G0=0,tp.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Io({},this.state),typeof e=="function"&&(e=e(Io({},n),this.props)),e&&Io(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),X0(this))},tp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),X0(this))},tp.prototype.render=ep,vr=[],W0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,U0=function(e,t){return e.__v.__b-t.__v.__b},np.__r=0,pg=Math.random().toString(8),Ku="__d"+pg,gc="__a"+pg,q0=/(PointerCapture)$|Capture$/i,dg=0,fg=eE(!1),hg=eE(!0);var aE=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,aE(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},sE=new Map;function QN(e){var t=sE.get(this);return t||(t=new Map,sE.set(this,t)),(t=aE(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(d){r===1&&(d||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,d,a):r===3&&(d||a)?(c.push(3,d,a),r=2):r===2&&a==="..."&&d?c.push(4,d,0):r===2&&a&&!d?c.push(5,0,!0,a):r>=5&&((a||!d&&r===5)&&(c.push(r,0,a,o),r=6),d&&(c.push(r,d,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
10
- `||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Bt=QN.bind(Y0),Ka,gn,vg,cE,mc=0,lE=[],En=Jt,uE=En.__b,pE=En.__r,dE=En.diffed,fE=En.__c,hE=En.unmount,gE=En.__;function op(e,t){En.__h&&En.__h(gn,e,mc||t),mc=0;var n=gn.__H||(gn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function xg(e){return mc=1,e$(yE,e)}function e$(e,t,n){var i=op(Ka++,2);if(i.t=e,!i.__c&&(i.__=[yE(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=gn,!gn.__f)){var o=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(f){if(f.__N){u=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};gn.__f=!0;var r=gn.shouldComponentUpdate,a=gn.componentWillUpdate;gn.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)},gn.shouldComponentUpdate=o}return i.__N||i.__}function rp(e,t){var n=op(Ka++,3);!En.__s&&_g(n.__H,t)&&(n.__=e,n.u=t,gn.__H.__h.push(n))}function bg(e,t){var n=op(Ka++,4);!En.__s&&_g(n.__H,t)&&(n.__=e,n.u=t,gn.__h.push(n))}function ap(e){return mc=5,Bo(function(){return{current:e}},[])}function Bo(e,t){var n=op(Ka++,7);return _g(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function yc(e,t){return mc=8,Bo(function(){return e},t)}function t$(){for(var e;e=lE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(sp),t.__h.some(wg),t.__h=[]}catch(n){t.__h=[],En.__e(n,e.__v)}}}En.__b=function(e){gn=null,uE&&uE(e)},En.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gE&&gE(e,t)},En.__r=function(e){pE&&pE(e),Ka=0;var t=(gn=e.__c).__H;t&&(vg===gn?(t.__h=[],gn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(sp),t.__h.some(wg),t.__h=[],Ka=0)),vg=gn},En.diffed=function(e){dE&&dE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(lE.push(t)!==1&&cE===En.requestAnimationFrame||((cE=En.requestAnimationFrame)||n$)(t$)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),vg=gn=null},En.__c=function(e,t){t.some(function(n){try{n.__h.some(sp),n.__h=n.__h.filter(function(i){return!i.__||wg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],En.__e(i,n.__v)}}),fE&&fE(e,t)},En.unmount=function(e){hE&&hE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{sp(i)}catch(o){t=o}}),n.__H=void 0,t&&En.__e(t,n.__v))};var mE=typeof requestAnimationFrame=="function";function n$(e){var t,n=function(){clearTimeout(i),mE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);mE&&(t=requestAnimationFrame(n))}function sp(e){var t=gn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),gn=t}function wg(e){var t=gn;e.__c=e.__(),gn=t}function _g(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function yE(e,t){return typeof t=="function"?t(e):t}function i$(e){const{navigationStack:t,setNavigationStack:n}=e,i=Bo(()=>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 Bt`
9
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+d+'" height="'+f+'" viewBox="'+u+" "+p+" "+d+" "+f+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Xt.prototype._setDefinitions=function(e){this._definitions=e},Xt.prototype.getModules=function(){return this._modules},Xt.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},Xt.prototype.destroy=function(){ir.prototype.destroy.call(this),no(this._container)},Xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Xt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Ct(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Xt.prototype.getDefinitions=function(){return this._definitions},Xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Xt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),o=n.additionalModules||[],r=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(r,i,o),s=Z(Zi(n,["additionalModules"]),{canvas:Z({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},Xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Xt.prototype._createContainer=function(e){const t=Vt('<div class="bjs-container"></div>');return Kn(t,{width:Hx(e.width),height:Hx(e.height),position:e.position}),t},Xt.prototype._createModdle=function(e){const t=Z({},this._moddleExtensions,e.moddleExtensions);return new Gm(t)},Xt.prototype._modules=[];function kl(e,t){return e.warnings=t,e}function Y2(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 K2={width:"100%",height:"100%",position:"relative"};function Hx(e){return e+(et(e)?"px":"")}function X2(e,t){return t&&$t(e.diagrams,function(n){return n.id===t})||null}function Z2(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Nx+"</a>",i=Vt(n);Kn(Ct("svg",i),$x),Kn(i,Fx,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ye.bind(i,"click",function(o){q2(),o.preventDefault()})}function Vr(e){Xt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ne(Vr,Xt),Vr.prototype._createModdle=function(e){var t=Xt.prototype._createModdle.call(this,e);return t.ids=new to([32,36,1]),t},Vr.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 yt(e,t){return A(e,"bpmn:CallActivity")?!1:A(e,"bpmn:SubProcess")?(t=t||xt(e),t&&A(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):A(e,"bpmn:Participant")?!!Ee(e).processRef:!0}function Rn(e){if(!(!A(e,"bpmn:Participant")&&!A(e,"bpmn:Lane"))){var t=xt(e).isHorizontal;return t===void 0?!0:t}}function J2(e){return e&&Ee(e).isInterrupting!==!1}function Un(e){return e&&!!Ee(e).triggeredByEvent}function Aa(e,t){var n=Ee(e).eventDefinitions;return Go(n,function(i){return A(i,t)})}function Q2(e){return Aa(e,"bpmn:ErrorEventDefinition")}function ek(e){return Aa(e,"bpmn:EscalationEventDefinition")}function tk(e){return Aa(e,"bpmn:CompensateEventDefinition")}var Wr={width:90,height:20},zx=15;function or(e){return A(e,"bpmn:Event")||A(e,"bpmn:Gateway")||A(e,"bpmn:DataStoreReference")||A(e,"bpmn:DataObjectReference")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:Group")}function Ol(e){return ut(e.label)}function nk(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],o=ik(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-=zx:a+=zx,{x:a,y:s}}function ik(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?nk(e.waypoints):A(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Wr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Wr.height/2}}function Gx(e,t){var n,i,o,r=e.label;return r&&r.bounds?(o=r.bounds,i={width:Math.max(Wr.width,o.width),height:o.height},n={x:o.x+o.width/2,y:o.y+o.height/2}):(n=df(t),i=Wr),Z({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Vx(e){if(A(e,"bpmn:FlowElement")||A(e,"bpmn:Participant")||A(e,"bpmn:Lane")||A(e,"bpmn:SequenceFlow")||A(e,"bpmn:MessageFlow")||A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))return"name";if(A(e,"bpmn:TextAnnotation"))return"text";if(A(e,"bpmn:Group"))return"categoryValueRef"}function ok(e){var t=e.categoryValueRef;return t&&t.value||""}function ui(e){var t=e.businessObject,n=Vx(t);if(n)return n==="categoryValueRef"?ok(t):t[n]||""}function rk(e,t){var n=e.businessObject,i=Vx(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function ak(e){return ut(e)&&or(e.labelTarget)}var Ta=7;function Wx(e){let t=[];return U(e.incoming,n=>{A(n,"bpmn:Association")&&A(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),U(e.outgoing,n=>{A(n,"bpmn:Association")&&A(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ns(e){const t=new Map;return U(rf(e),n=>{U(Wx(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 ff="hsl(225, 10%, 15%)",sk="white";function ao(e,t){return Go(e.eventDefinitions,function(n){return n.$type===t})}function ck(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function lk(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function gt(e,t,n){var i=xt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||sk}function Le(e,t,n){var i=xt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||ff}function $s(e,t,n,i){var o=xt(e),r=o.get("label");return i||r&&r.get("color:color")||t||Le(e,n)}function Ux(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 zr(o)}function hf(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 zr(a)}function uk(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 zr(s)}function pk(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 zr(r)}function Fs(e,t={}){return{width:Mi(e,t),height:pi(e,t)}}function Mi(e,t={}){return ai(t,"width")?t.width:e.width}function pi(e,t={}){return ai(t,"height")?t.height:e.height}var dk=new to,fk=10,Dl=3,hk=1.5,Ll=10,gk=4,Pa=.95,mk=1,yk=.25;function Ur(e,t,n,i,o,r,a){Eo.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(F){return n.computeStyle(F,{strokeLinecap:"round",strokeLinejoin:"round",stroke:ff,strokeWidth:2,fill:"white"})}function p(F){return n.computeStyle(F,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:ff,strokeWidth:2})}function d(F,C){var{ref:R={x:0,y:0},scale:W=1,element:J,parentGfx:fe=o._svg}=C,Pe=He("marker",{id:F,viewBox:"0 0 20 20",refX:R.x,refY:R.y,markerWidth:20*W,markerHeight:20*W,orient:"auto"});ot(Pe,J);var ct=Ct(":scope > defs",fe);ct||(ct=He("defs"),ot(fe,ct)),ot(ct,Pe)}function f(F,C,R,W){var J=dk.nextPrefixed("marker-");return m(F,J,C,R,W),"url(#"+J+")"}function m(F,C,R,W,J){if(R==="sequenceflow-end"){var fe=He("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:J,stroke:J,strokeWidth:1})});d(C,{element:fe,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="messageflow-start"){var Pe=He("circle",{cx:6,cy:6,r:3.5,...u({fill:W,stroke:J,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:Pe,ref:{x:6,y:6},parentGfx:F})}if(R==="messageflow-end"){var ct=He("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:W,stroke:J,strokeWidth:1,strokeDasharray:[1e4,1]})});d(C,{element:ct,ref:{x:8.5,y:5},parentGfx:F})}if(R==="association-start"){var pt=He("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:J,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:pt,ref:{x:1,y:10},scale:.5,parentGfx:F})}if(R==="association-end"){var zt=He("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:J,strokeWidth:1.5,strokeDasharray:[1e4,1]})});d(C,{element:zt,ref:{x:11,y:10},scale:.5,parentGfx:F})}if(R==="conditional-flow-marker"){var vt=He("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:W,stroke:J})});d(C,{element:vt,ref:{x:-1,y:10},scale:.5,parentGfx:F})}if(R==="conditional-default-flow-marker"){var an=He("path",{d:"M 6 4 L 10 16",...u({stroke:J,fill:"none"})});d(C,{element:an,ref:{x:0,y:10},scale:.5,parentGfx:F})}}function g(F,C,R,W,J={}){bn(W)&&(J=W,W=0),W=W||0,J=u(J);var fe=C/2,Pe=R/2,ct=He("circle",{cx:fe,cy:Pe,r:Math.round((C+R)/4-W),...J});return ot(F,ct),ct}function y(F,C,R,W,J,fe){bn(J)&&(fe=J,J=0),J=J||0,fe=u(fe);var Pe=He("rect",{x:J,y:J,width:C-J*2,height:R-J*2,rx:W,ry:W,...fe});return ot(F,Pe),Pe}function _(F,C,R,W){var J=C/2,fe=R/2,Pe=[{x:J,y:0},{x:C,y:fe},{x:J,y:R},{x:0,y:fe}],ct=Pe.map(function(zt){return zt.x+","+zt.y}).join(" ");W=u(W);var pt=He("polygon",{...W,points:ct});return ot(F,pt),pt}function h(F,C,R,W){R=p(R);var J=Ps(C,R,W);return ot(F,J),J}function v(F,C,R){return h(F,C,R,5)}function b(F,C,R){R=p(R);var W=He("path",{...R,d:C});return ot(F,W),W}function E(F,C,R,W){return b(C,R,Z({"data-marker":F},W))}function M(F){return $e[F]}function B(F){return function(C,R,W){return M(F)(C,R,W)}}var P={"bpmn:MessageEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.235,my:.315}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill),Pe=W?gt(C,s,R.fill):Le(C,c,R.stroke),ct=b(F,J,{fill:fe,stroke:Pe,strokeWidth:1});return ct},"bpmn:TimerEventDefinition":function(F,C,R={}){var W=R.width||C.width,J=R.height||C.height,fe=R.width?1:2,Pe=g(F,W,J,.2*J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:fe}),ct=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:W,containerHeight:J,position:{mx:.5,my:.5}});b(F,ct,{stroke:Le(C,c,R.stroke),strokeWidth:fe});for(var pt=0;pt<12;pt++){var zt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:W,containerHeight:J,position:{mx:.5,my:.5}}),vt=W/2,an=J/2;b(F,zt,{strokeWidth:1,stroke:Le(C,c,R.stroke),transform:"rotate("+pt*30+","+an+","+vt+")"})}return Pe},"bpmn:EscalationEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(F,C,R={}){var W=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.222}});return b(F,W,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.57,my:.263}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.2,my:.722}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.638,my:-.055}}),fe=W?Le(C,c,R.stroke):"none",Pe=b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1});return Lx(Pe,45),Pe},"bpmn:CompensateEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.22,my:.5}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.5,my:.2}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{strokeWidth:1,fill:fe,stroke:Le(C,c,R.stroke)})},"bpmn:MultipleEventDefinition":function(F,C,R={},W){var J=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.211,my:.36}}),fe=W?Le(C,c,R.stroke):gt(C,s,R.fill);return b(F,J,{fill:fe,stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(F,C,R={}){var W=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:R.width||C.width,containerHeight:R.height||C.height,position:{mx:.458,my:.194}});return b(F,W,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(F,C,R={}){var W=g(F,C.width,C.height,8,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:4});return W}};function k(F,C,R={},W){var J=Ee(F),fe=ck(J),Pe=W||F;return J.get("eventDefinitions")&&J.get("eventDefinitions").length>1?J.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](C,Pe,R,fe):P["bpmn:MultipleEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](C,Pe,R,fe):ao(J,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](C,Pe,R,fe):null}var N={ParticipantMultiplicityMarker:function(F,C,R={}){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2-6)/W,my:(J-15)/J}});E("participant-multiplicity",F,fe,{strokeWidth:2,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},SubProcessMarker:function(F,C,R={}){var W=y(F,14,14,0,{strokeWidth:1,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)});$n(W,C.width/2-7.5,C.height-20);var J=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",F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},ParallelMarker:function(F,C,R){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2+R.parallel)/W,my:(J-20)/J}});E("parallel",F,fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},SequentialMarker:function(F,C,R){var W=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.seq)/C.width,my:(C.height-19)/C.height}});E("sequential",F,W,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},CompensationMarker:function(F,C,R){var W=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:(C.width/2+R.compensation)/C.width,my:(C.height-13)/C.height}});E("compensation",F,W,{strokeWidth:1,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})},LoopMarker:function(F,C,R){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2+R.loop)/W,my:(J-7)/J}});E("loop",F,fe,{strokeWidth:1.5,fill:"none",stroke:Le(C,c,R.stroke),strokeMiterlimit:.5})},AdhocMarker:function(F,C,R){var W=Mi(C,R),J=pi(C,R),fe=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:(W/2+R.adhoc)/W,my:(J-15)/J}});E("adhoc",F,fe,{strokeWidth:1,fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke)})}};function G(F,C,R,W){N[F](C,R,W)}function q(F,C,R=[],W={}){W={fill:W.fill,stroke:W.stroke,width:Mi(C,W),height:pi(C,W)};var J=Ee(C),fe=R.includes("SubProcessMarker");fe?W={...W,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:W={...W,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},J.get("isForCompensation")&&R.push("CompensationMarker"),A(J,"bpmn:AdHocSubProcess")&&(R.push("AdhocMarker"),fe||Z(W,{compensation:W.compensation-18}));var Pe=J.get("loopCharacteristics"),ct=Pe&&Pe.get("isSequential");Pe&&(Z(W,{compensation:W.compensation-18}),R.includes("AdhocMarker")&&Z(W,{seq:-23,loop:-18,parallel:-24}),ct===void 0&&R.push("LoopMarker"),ct===!1&&R.push("ParallelMarker"),ct===!0&&R.push("SequentialMarker")),R.includes("CompensationMarker")&&R.length===1&&Z(W,{compensation:-8}),U(R,function(pt){G(pt,F,C,W)})}function Y(F,C,R={}){R=Z({size:{width:100}},R);var W=r.createText(C||"",R);return mt(W).add("djs-label"),ot(F,W),W}function re(F,C,R,W={}){var J=Ee(C),fe=Fs({x:C.x,y:C.y,width:C.width,height:C.height},W);return Y(F,J.name,{align:R,box:fe,padding:7,style:{fill:$s(C,l,c,W.stroke)}})}function K(F,C,R={}){var W={width:C.width,height:C.height,x:C.width/2+C.x,y:C.height/2+C.y};return Y(F,ui(C),{box:W,style:Z({},r.getExternalStyle(),{fill:$s(C,l,c,R.stroke)})})}function Ce(F,C,R,W={}){var J=Rn(R),fe=Y(F,C,{box:{height:30,width:J?pi(R,W):Mi(R,W)},align:"center-middle",style:{fill:$s(R,l,c,W.stroke)}});if(J){var Pe=-1*pi(R,W);Tl(fe,0,-Pe,270)}}function Ae(F,C,R={}){var{width:W,height:J}=Fs(C,R);return y(F,W,J,Ll,{...R,fill:gt(C,s,R.fill),fillOpacity:Pa,stroke:Le(C,c,R.stroke)})}function Te(F,C,R={}){var W=Ee(C),J=gt(C,s,R.fill),fe=Le(C,c,R.stroke);return(W.get("associationDirection")==="One"||W.get("associationDirection")==="Both")&&(R.markerEnd=f(F,"association-end",J,fe)),W.get("associationDirection")==="Both"&&(R.markerStart=f(F,"association-start",J,fe)),R=wt(R,["markerStart","markerEnd"]),v(F,C.waypoints,{...R,stroke:fe,strokeDasharray:"0, 5"})}function de(F,C,R={}){var W=gt(C,s,R.fill),J=Le(C,c,R.stroke),fe=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}}),Pe=b(F,fe,{fill:W,fillOpacity:Pa,stroke:J}),ct=Ee(C);if(lk(ct)){var pt=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}});b(F,pt,{strokeWidth:2,fill:W,stroke:J})}return Pe}function z(F,C,R={}){return g(F,C.width,C.height,{fillOpacity:Pa,...R,fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke)})}function oe(F,C,R={}){return _(F,C.width,C.height,{fill:gt(C,s,R.fill),fillOpacity:Pa,stroke:Le(C,c,R.stroke)})}function V(F,C,R={}){var W=y(F,Mi(C,R),pi(C,R),0,{fill:gt(C,s,R.fill),fillOpacity:R.fillOpacity||Pa,stroke:Le(C,c,R.stroke),strokeWidth:1.5}),J=Ee(C);if(A(J,"bpmn:Lane")){var fe=J.get("name");Ce(F,fe,C,R)}return W}function X(F,C,R={}){var W=Ae(F,C,R),J=yt(C);if(Un(C)&&(De(W,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!J)){var fe=Ee(C).flowElements||[],Pe=fe.filter(ct=>A(ct,"bpmn:StartEvent"));Pe.length===1&&ue(Pe[0],F,R,C)}return re(F,C,J?"center-top":"center-middle",R),J?q(F,C,void 0,R):q(F,C,["SubProcessMarker"],R),W}function ue(F,C,R,W){var J=22,fe={fill:gt(W,s,R.fill),stroke:Le(W,c,R.stroke),width:J,height:J},Pe=Ee(F).isInterrupting,ct=Pe?0:3,pt=Pe?1:1.2,zt=20,vt=(J-zt)/2,an="translate("+vt+","+vt+")";g(C,zt,zt,{fill:fe.fill,stroke:fe.stroke,strokeWidth:pt,strokeDasharray:ct,transform:an}),k(F,C,fe,W)}function be(F,C,R={}){var W=Ae(F,C,R);return re(F,C,"center-middle",R),q(F,C,void 0,R),W}var $e=this.handlers={"bpmn:AdHocSubProcess":function(F,C,R={}){return yt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),X(F,C,R)},"bpmn:Association":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Te(F,C,R)},"bpmn:BoundaryEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=Ee(C),fe=J.get("cancelActivity");R={strokeWidth:1.5,fill:gt(C,s,R.fill),fillOpacity:mk,stroke:Le(C,c,R.stroke)},fe||(R.strokeDasharray="6");var Pe=z(F,C,R);return g(F,C.width,C.height,Dl,{...R,fill:"none"}),W&&k(C,F,R),Pe},"bpmn:BusinessRuleTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),fe=b(F,J);De(fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1});var Pe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ct=b(F,Pe);return De(ct,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:CallActivity":function(F,C,R={}){return R=wt(R,["fill","stroke"]),X(F,C,{strokeWidth:5,...R})},"bpmn:ComplexGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R),J=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.26}});return b(F,J,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:DataInput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=i.getRawPath("DATA_ARROW"),J=de(F,C,R);return b(F,W,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1}),J},"bpmn:DataInputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Te(F,C,{...R,markerEnd:f(F,"association-end",gt(C,s,R.fill),Le(C,c,R.stroke))})},"bpmn:DataObject":function(F,C,R={}){return R=wt(R,["fill","stroke"]),de(F,C,R)},"bpmn:DataObjectReference":B("bpmn:DataObject"),"bpmn:DataOutput":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=i.getRawPath("DATA_ARROW"),J=de(F,C,R);return b(F,W,{strokeWidth:1,fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke)}),J},"bpmn:DataOutputAssociation":function(F,C,R={}){return R=wt(R,["fill","stroke"]),Te(F,C,{...R,markerEnd:f(F,"association-end",gt(C,s,R.fill),Le(C,c,R.stroke))})},"bpmn:DataStoreReference":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:C.width,containerHeight:C.height,position:{mx:0,my:.133}});return b(F,W,{fill:gt(C,s,R.fill),fillOpacity:Pa,stroke:Le(C,c,R.stroke),strokeWidth:2})},"bpmn:EndEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=z(F,C,{...R,strokeWidth:4});return W&&k(C,F,R),J},"bpmn:EventBasedGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=Ee(C),J=oe(F,C,R);g(F,C.width,C.height,C.height*.2,{fill:gt(C,"none",R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1});var fe=W.get("eventGatewayType"),Pe=!!W.get("instantiate");function ct(){var zt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:C.width,containerHeight:C.height,position:{mx:.36,my:.44}});b(F,zt,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:2})}if(fe==="Parallel"){var pt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.474,my:.296}});b(F,pt,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1})}else fe==="Exclusive"&&(Pe||g(F,C.width,C.height,C.height*.26,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1}),ct());return J},"bpmn:ExclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R),J=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:C.width,containerHeight:C.height,position:{mx:.32,my:.3}}),fe=xt(C);return fe.get("isMarkerVisible")&&b(F,J,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:Gateway":function(F,C,R={}){return R=wt(R,["fill","stroke"]),oe(F,C,R)},"bpmn:Group":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),y(F,C.width,C.height,Ll,{stroke:Le(C,c,R.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Mi(C,R),height:pi(C,R)})},"bpmn:InclusiveGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R);return g(F,C.width,C.height,C.height*.24,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:2.5}),W},"bpmn:IntermediateEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=z(F,C,{...R,strokeWidth:1.5});return g(F,C.width,C.height,Dl,{fill:"none",stroke:Le(C,c,R.stroke),strokeWidth:1.5}),W&&k(C,F,R),J},"bpmn:IntermediateCatchEvent":B("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":B("bpmn:IntermediateEvent"),"bpmn:Lane":function(F,C,R={}){return R=wt(R,["fill","stroke","width","height"]),V(F,C,{...R,fillOpacity:yk})},"bpmn:ManualTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:.5}),W},"bpmn:MessageFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=Ee(C),J=xt(C),fe=gt(C,s,R.fill),Pe=Le(C,c,R.stroke),ct=v(F,C.waypoints,{markerEnd:f(F,"messageflow-end",fe,Pe),markerStart:f(F,"messageflow-start",fe,Pe),stroke:Pe,strokeDasharray:"10, 11",strokeWidth:1.5});if(W.get("messageRef")){var pt=ct.getPointAtLength(ct.getTotalLength()/2),zt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:pt.x,y:pt.y}}),vt={strokeWidth:1};J.get("messageVisibleKind")==="initiating"?(vt.fill=fe,vt.stroke=Pe):(vt.fill=Pe,vt.stroke=fe);var an=b(F,zt,vt),Mn=W.get("messageRef"),kn=Mn.get("name"),Nt=Y(F,kn,{align:"center-top",fitBox:!0,style:{fill:Pe}}),vn=an.getBBox(),On=Nt.getBBox(),ii=pt.x-On.width/2,qn=pt.y+vn.height/2+fk;Tl(Nt,ii,qn,0)}return ct},"bpmn:ParallelGateway":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=oe(F,C,R),J=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:C.width,containerHeight:C.height,position:{mx:.46,my:.2}});return b(F,J,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:Participant":function(F,C,R={}){R=wt(R,["fill","stroke","width","height"]);var W=V(F,C,R),J=yt(C),fe=Rn(C),Pe=Ee(C),ct=Pe.get("name");if(J){var pt=fe?[{x:30,y:0},{x:30,y:pi(C,R)}]:[{x:0,y:30},{x:Mi(C,R),y:30}];h(F,pt,{stroke:Le(C,c,R.stroke),strokeWidth:hk}),Ce(F,ct,C,R)}else{var zt=Fs(C,R);fe||(zt.height=Mi(C,R),zt.width=pi(C,R));var vt=Y(F,ct,{box:zt,align:"center-middle",style:{fill:$s(C,l,c,R.stroke)}});if(!fe){var an=-1*pi(C,R);Tl(vt,0,-an,270)}}return Pe.get("participantMultiplicity")&&G("ParticipantMultiplicityMarker",F,C,R),W},"bpmn:ReceiveTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=Ee(C),J=be(F,C,R),fe;return W.get("instantiate")?(g(F,28,28,20*.22,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),fe=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):fe=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(F,fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),J},"bpmn:ScriptTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:SendTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(F,J,{fill:Le(C,c,R.stroke),stroke:gt(C,s,R.fill),strokeWidth:1}),W},"bpmn:SequenceFlow":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=gt(C,s,R.fill),J=Le(C,c,R.stroke),fe=v(F,C.waypoints,{markerEnd:f(F,"sequenceflow-end",W,J),stroke:J}),Pe=Ee(C),{source:ct}=C;if(ct){var pt=Ee(ct);Pe.get("conditionExpression")&&A(pt,"bpmn:Activity")&&De(fe,{markerStart:f(F,"conditional-flow-marker",W,J)}),pt.get("default")&&(A(pt,"bpmn:Gateway")||A(pt,"bpmn:Activity"))&&pt.get("default")===Pe&&De(fe,{markerStart:f(F,"conditional-default-flow-marker",W,J)})}return fe},"bpmn:ServiceTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R);g(F,10,10,{fill:gt(C,s,R.fill),stroke:"none",transform:"translate(6, 6)"});var J=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(F,J,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),g(F,10,10,{fill:gt(C,s,R.fill),stroke:"none",transform:"translate(11, 10)"});var fe=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(F,fe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:1}),W},"bpmn:StartEvent":function(F,C,R={}){var{renderIcon:W=!0}=R;R=wt(R,["fill","stroke"]);var J=Ee(C);J.get("isInterrupting")||(R={...R,strokeDasharray:"6"});var fe=z(F,C,R);return W&&k(C,F,R),fe},"bpmn:SubProcess":function(F,C,R={}){return yt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]),X(F,C,R)},"bpmn:Task":function(F,C,R={}){return R=wt(R,["fill","stroke"]),be(F,C,R)},"bpmn:TextAnnotation":function(F,C,R={}){R=wt(R,["fill","stroke"]);var{width:W,height:J}=Fs(C,R),fe=y(F,W,J,0,0,{fill:"none",stroke:"none"}),Pe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:W,containerHeight:J,position:{mx:0,my:0}});b(F,Pe,{stroke:Le(C,c,R.stroke)});var ct=Ee(C),pt=ct.get("text")||"";return Y(F,pt,{align:"left-top",box:Fs(C,R),padding:Ta,style:{fill:$s(C,l,c,R.stroke)}}),fe},"bpmn:Transaction":function(F,C,R={}){yt(C)?R=wt(R,["fill","stroke","width","height"]):R=wt(R,["fill","stroke"]);var W=X(F,C,{strokeWidth:1.5,...R}),J=n.style(["no-fill","no-events"],{stroke:Le(C,c,R.stroke),strokeWidth:1.5}),fe=yt(C);return fe||(R={}),y(F,Mi(C,R),pi(C,R),Ll-Dl,Dl,J),W},"bpmn:UserTask":function(F,C,R={}){R=wt(R,["fill","stroke"]);var W=be(F,C,R),J=15,fe=12,Pe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:J,y:fe}});b(F,Pe,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:.5});var ct=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:J,y:fe}});b(F,ct,{fill:gt(C,s,R.fill),stroke:Le(C,c,R.stroke),strokeWidth:.5});var pt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:J,y:fe}});return b(F,pt,{fill:Le(C,c,R.stroke),stroke:Le(C,c,R.stroke),strokeWidth:.5}),W},label:function(F,C,R={}){return K(F,C,R)}};this._drawPath=b,this._renderer=M}Ne(Ur,Eo),Ur.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Ur.prototype.canRender=function(e){return A(e,"bpmn:BaseElement")},Ur.prototype.drawShape=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ur.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,o=this._renderer(i);return o(e,t,n)},Ur.prototype.getShapePath=function(e){return ut(e)?hf(e,gk):A(e,"bpmn:Event")?Ux(e):A(e,"bpmn:Activity")?hf(e,Ll):A(e,"bpmn:Gateway")?uk(e):pk(e)};function wt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var vk=0,xk={width:150,height:50};function bk(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function wk(e){return bn(e)?Z({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var gf=null;function _k(){return gf||(gf=document.createElement("canvas").getContext("2d")),gf}function Ek(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(qx(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function qx(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Sk(e,t){var n=_k();if(!n)return{width:0,height:0};n.font=Ek(t),"letterSpacing"in n&&(n.letterSpacing=qx(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 Rk(e,t,n){for(var i=e.shift(),o=i,r;;){if(r=Sk(o,n),r.width=o?r.width:0,o===" "||o===""||r.width<Math.round(t)||o.length<2)return Mk(e,o,i,r);o=Ak(o,r.width,t)}}function Mk(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 Yx="­";function Ck(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===Yx)&&o.pop();break}var a=o[o.length-1];return a&&a===Yx&&(o[o.length-1]="-"),o.join("")}function Ak(e,t,n){var i=Math.max(e.length*(n/t),1),o=Ck(e,i);return o||(o=e.slice(0,Math.max(Math.round(i-1),1))),o}function Il(e){this._config=Z({},{size:xk,padding:vk,style:{},align:"center-top"},e||{})}Il.prototype.createText=function(e,t){return this.layoutText(e,t).element},Il.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Il.prototype.layoutText=function(e,t){for(var n=Z({},this._config.size,t.box),i=Z({},this._config.style,t.style),o=bk(t.align||this._config.align),r=wk(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Tk(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-r.left-r.right;c.length;)l.push(Rk(c,u,i));o.vertical==="middle"&&(r.top=r.bottom=0);var p=si(l,function(y,_,h){return y+(s||_.height)},0)+r.top+r.bottom,d=si(l,function(y,_,h){return _.width>y?_.width:y},0),f=r.top;o.vertical==="middle"&&(f+=(n.height-p)/2),f-=(s||l[0].height)/4;var m=He("text");De(m,i),U(l,function(y){var _;switch(f+=s||y.height,o.horizontal){case"left":_=r.left;break;case"right":_=(a?d:u)-r.right-y.width;break;default:_=Math.max(((a?d:u)-y.width)/2+r.left,0)}var h=He("tspan");De(h,{x:_,y:f}),h.textContent=y.text,ot(m,h)});var g={width:d,height:p};return{dimensions:g,element:m}};function Tk(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Pk=12,kk=1.2,Ok=40;function Kx(e){var t=Z({fontFamily:"Arial, sans-serif",fontSize:Pk,fontWeight:"normal",lineHeight:kk},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=Z({},t,{fontSize:n},e&&e.externalStyle||{}),o=new Il({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Wr.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:Ta});return{x:a.x,y:a.y,width:a.width,height:Math.max(Ok,Math.round(c.height))}},this.getDimensions=function(a,s){return o.getDimensions(a,s||{})};function r(a,s,c){return o.getDimensions(a,Z({box:s},c))}this.createText=function(a,s){return o.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Kx.$inject=["config.textRenderer"];function Dk(){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=Nk(i.d,{mx:o,my:r,e:a});return p}}var Lk=/\{([^{}]+)\}/g,Ik=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Bk(e,t,n){var i=n;return t.replace(Ik,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 Nk(e,t){return String(e).replace(Lk,function(n,i){return Bk(n,i,t)})}const $k={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ur],textRenderer:["type",Kx],pathMap:["type",Dk]};function Fk(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const js={translate:["value",Fk]};function Bl(e,t,n){return Z({id:e.id,type:e.$type,businessObject:e,di:t},n)}function jk(e,t,n){var i=e.waypoint;return!i||i.length<2?[tt(t),tt(n)]:i.map(function(o){return{x:o.x,y:o.y}})}function Xx(e,t,n){return new Error(`element ${Wn(t)} referenced by ${Wn(e)}#${n} not yet drawn`)}function Co(e,t,n,i,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=o}Co.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Co.prototype.add=function(e,t,n){var i,o,r;if(A(t,"bpmndi:BPMNPlane")){var a=A(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Bl(e,t,a)),this._canvas.addRootElement(i)}else if(A(t,"bpmndi:BPMNShape")){var s=!yt(e,t),c=zk(e);o=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Bl(e,t,{collapsed:s,hidden:o,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),A(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),A(e,"bpmn:Lane")&&(r=0),A(e,"bpmn:DataStoreReference")&&(Hk(n,tt(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,r)}else if(A(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),p=this._getTarget(e);o=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Bl(e,t,{hidden:o,source:u,target:p,waypoints:jk(t,u,p)})),A(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,r)}else throw new Error(`unknown di ${Wn(t)} for element ${Wn(e)}`);return or(e)&&ui(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Co.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Wn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),o=i&&i.attachers;if(!i)throw Xx(e,n,"attachedToRef");t.host=i,o||(i.attachers=o=[]),o.indexOf(t)===-1&&o.push(t)},Co.prototype.addLabel=function(e,t,n){var i,o,r;return i=Gx(t,n),o=ui(n),o&&(i=this._textRenderer.getExternalLabelBounds(i,o)),r=this._elementFactory.createLabel(Bl(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ui(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)},Co.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?Xx(e,i,t+"Ref"):new Error(`${Wn(e)}#${t} Ref not specified`)},Co.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Co.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Co.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function Hk(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 zk(e){return A(e,"bpmn:Group")}const Zx={__depends__:[$k,{__depends__:[js],bpmnImporter:["type",Co]}]};function Hs(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Wi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function mf(e){return Math.log(e)/Math.log(10)}var Gk=1e3;function _e(e){this._eventBus=e}_e.$inject=["eventBus"];function Vk(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}_e.prototype.on=function(e,t,n,i,o,r){if((Sn(t)||et(t))&&(r=o,o=i,i=n,n=t,t=null),Sn(n)&&(r=o,o=i,i=n,n=Gk),bn(o)&&(r=o,o=!1),!Sn(i))throw new Error("handlerFn must be a function");Qe(e)||(e=[e]);var a=this._eventBus;U(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,o?Vk(i,r):i,r)})},_e.prototype.canExecute=Ao("canExecute"),_e.prototype.preExecute=Ao("preExecute"),_e.prototype.preExecuted=Ao("preExecuted"),_e.prototype.execute=Ao("execute"),_e.prototype.executed=Ao("executed"),_e.prototype.postExecute=Ao("postExecute"),_e.prototype.postExecuted=Ao("postExecuted"),_e.prototype.revert=Ao("revert"),_e.prototype.reverted=Ao("reverted");function Ao(e){return function(n,i,o,r,a){(Sn(n)||et(n))&&(a=r,r=o,o=i,i=n,n=null),this.on(n,e,i,o,r,a)}}var yf=["top","bottom","left","right"],Nl=10;function vf(e,t){_e.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(o){var r=o.context,a=r.connection,s=a.source,c=a.target,l=r.hints||{};l.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(o){var r=o.context,a=r.shape,s=r.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(o){var r=o.context,a=r.elements,s=r.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(o){if(Ol(o)&&!Lt(o)){var r=qk(o);r&&i(o,r)}}function i(o,r){var a=tt(o),s=o.label,c=tt(s);if(s.parent){var l=Ze(o),u;switch(r){case"top":u={x:a.x,y:l.top-Nl-s.height/2};break;case"left":u={x:l.left-Nl-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Nl+s.height/2};break;case"right":u={x:l.right+Nl+s.width/2,y:a.y};break}var p=Wi(u,c);t.moveShape(s,p)}}}Ne(vf,_e),vf.$inject=["eventBus","modeling"];function Wk(e){var t=e.host,n=tt(e),i=Nn(n,t),o;i.indexOf("-")>=0?o=i.split("-"):o=[i];var r=yf.filter(function(a){return o.indexOf(a)===-1});return r}function Uk(e){var t=tt(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 Jx(t,i)});return n}function qk(e){var t=tt(e.label),n=tt(e),i=Jx(n,t);if(Yk(i)){var o=Uk(e);if(e.host){var r=Wk(e);o=o.concat(r)}var a=yf.filter(function(s){return o.indexOf(s)===-1});return a.indexOf(i)!==-1?Nn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Jx(e,t){return Nn(t,e,5)}function Yk(e){return yf.indexOf(e)!==-1}function xf(e){_e.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(A(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}Ne(xf,_e),xf.$inject=["eventBus"];var Kk=1500;function bf(e,t,n){e.invoke(_e,this),this.preExecute("elements.delete",Kk,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=ft(o,l=>A(l,"bpmn:Participant")||A(l,"bpmn:SubProcess"));if(!r.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>A(l,"bpmn:Artifact"))),c=new Set;return U(r,l=>{const u=new Set(ha(Ra(Array.from(s),dn(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ne(bf,_e),bf.$inject=["injector","eventBus","canvas"];function wf(e,t){e.invoke(_e,this),this.postExecute("shape.move",function(n){var i=n.newParent,o=n.shape,r=ft(o.incoming.concat(o.outgoing),function(a){return A(a,"bpmn:Association")});U(r,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ne(wf,_e),wf.$inject=["injector","modeling"];function ka(e,t){for(ri(t)&&(t=[t]);e=e.parent;)if(dt(e,t))return e;return null}function Qx(e,t){var n=ka(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=ka(e,i),n)return Rn(n);if(dt(e,i))return Rn(e);var o;for(o=Ee(e);o&&!A(o,"bpmn:Process");o=o.$parent);if(!t)return!0;var r=t.find(function(a){var s=Ee(a);return s&&s.get("processRef")===o});return r?Rn(r):!0}var eb=500;function $l(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",eb,function(i){var o=i.elements;o=o.filter(function(r){var a=r.host;return tb(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",eb,function(i){var o=i.shapes,r=i.newHost;if(o.length===1){var a=o[0];tb(a,r)&&(i.shapes=[n._replaceShape(a,r)])}},!0)}$l.$inject=["bpmnReplace","injector"],Ne($l,_e),$l.prototype._replaceShape=function(e,t){var n=Xk(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Xk(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function tb(e,t){return!ut(e)&&dt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function _f(e,t){_e.call(this,e);function n(i){return ft(i.attachers,function(o){return A(o,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var o=i.context.source,r=i.context.target,a=n(r);A(o,"bpmn:EventBasedGateway")&&A(r,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var o=i.context.oldSource,r=i.context.newSource;A(o,"bpmn:Gateway")&&A(r,"bpmn:EventBasedGateway")&&U(r.outgoing,function(a){var s=a.target,c=n(s);A(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}_f.$inject=["eventBus","modeling"],Ne(_f,_e);function nb(e){return e.create("bpmn:Category")}function Zk(e){return e.create("bpmn:CategoryValue")}function ib(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Zk(e)),n.$parent||(n.$parent=nb(e)),n}function Jk(e,t,n){return sn(t.get("categoryValue"),e),e.$parent=t,sn(n.get("rootElements"),t),t.$parent=n,e}function Qk(e){var t=e.$parent;return t&&(rn(t.get("categoryValue"),e),e.$parent=null),e}function eO(e){var t=e.$parent;return t&&(rn(t.get("rootElements"),e),e.$parent=null),e}var tO=500;function Ef(e,t,n){n.invoke(_e,this);function i(c){return t.filter(function(l){return A(l,"bpmn:Group")&&!l.labelTarget}).map(Ee).filter(function(l){return l!==c})}function o(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function r(c,l){return i(l).some(function(u){var p=u.get("categoryValueRef");return p&&p.$parent===c})}function a(c,l){c&&l&&Jk(c,l,e.getDefinitions())}function s(c,l,u){l&&!r(l,u)&&eO(l),c&&!o(c,u)&&Qk(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.executed(["shape.move","shape.resize"],tO,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,Ee(l))},!0),this.executed("group.updateRefs",function(c){ob(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){ob(c).forEach(function(l){s(l.categoryValue,l.category,Ee(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,Ee(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Ef.$inject=["bpmnjs","elementRegistry","injector"],Ne(Ef,_e);function ob(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Sf(e,t,n){_e.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",o,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",r,!0),this.postExecuted("element.updateProperties",a,!0);function i(y){const _=y.source,h=y.target;Oa(_)&&zs(h)&&u(h)}function o(y){const _=y.connection,h=y.source,v=y.target;Oa(h)&&Fl(v)&&(l(v),d(h,[_]))}function r(y){const _=y.newTarget,h=y.oldSource,v=y.oldTarget;if(v!==_){const b=h;zs(v)&&u(v),Oa(b)&&Fl(_)&&l(_)}}function a(y){const{element:_}=y;zs(_)?(p(_),f(_)):Fl(_)&&m(_)}function s(y){const{newData:_,oldShape:h}=y;if(Oa(y.oldShape)&&_.eventDefinitionType!=="bpmn:CompensateEventDefinition"||_.type!=="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>zs(b));v&&v.target&&(y._connectionTarget=v.target)}else if(!Oa(y.oldShape)&&_.eventDefinitionType==="bpmn:CompensateEventDefinition"&&_.type==="bpmn:BoundaryEvent"){const v=h.outgoing.find(({target:b})=>Fl(b));v&&v.target&&(y._connectionTarget=v.target),g(h)}}function c(y){const{_connectionTarget:_,newShape:h}=y;_&&t.connect(h,_)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function p(y){for(const _ of y.incoming)n.canConnect(_.source,y)||t.removeConnection(_);for(const _ of y.outgoing)n.canConnect(y,_.target)||t.removeConnection(_)}function d(y,_){y.outgoing.filter(b=>A(b,"bpmn:Association")).filter(b=>zs(b.target)&&!_.includes(b)).forEach(b=>t.removeConnection(b))}function f(y){const _=y.attachers.slice();_.length&&t.removeElements(_)}function m(y){const _=y.incoming.filter(h=>Oa(h.source));t.removeElements(_)}function g(y){const _=y.outgoing.filter(h=>A(h,"bpmn:SequenceFlow"));t.removeElements(_)}}Ne(Sf,_e),Sf.$inject=["eventBus","modeling","bpmnRules"];function zs(e){const t=Ee(e);return t&&t.get("isForCompensation")}function Oa(e){return e&&A(e,"bpmn:BoundaryEvent")&&Aa(e,"bpmn:CompensateEventDefinition")}function Fl(e){return e&&A(e,"bpmn:Activity")&&!Un(e)}function Rf(e){e.invoke(_e,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,o=n.shape;A(i,"bpmn:Lane")&&!A(o,"bpmn:Lane")&&(n.parent=ka(i,"bpmn:Participant"))})}Rf.$inject=["injector"],Ne(Rf,_e);function Mf(e,t){_e.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,o=i.shape;if(A(o,"bpmn:DataObjectReference")&&o.type!=="label"){var r=t.create("bpmn:DataObject");r.isCollection=((a=o.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,o.businessObject.dataObjectRef=r}})}Mf.$inject=["eventBus","bpmnFactory"],Ne(Mf,_e);var Cf=20,Af=20,rb=30,jl=2e3;function Tf(e,t,n){_e.call(this,t),t.on(["create.start","shape.move.start"],jl,function(o){var r=o.context,a=r.shape,s=e.getRootElement();if(!(!A(a,"bpmn:Participant")||!A(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!A(p,"bpmn:Group")&&!ut(p)&&!Lt(p)});if(c.length){var l=dn(c),u=nO(a,l);Z(a,u),r.createConstraints=iO(a,l)}}}),t.on("create.start",jl,function(o){var r=o.context,a=r.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}A(a,"bpmn:Participant")&&A(s,"bpmn:Process")&&(t.on("element.hover",jl,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var o=e.getRootElement();return A(o,"bpmn:Collaboration")?o:n.makeCollaboration()}this.preExecute("elements.create",jl,function(o){var r=o.elements,a=o.parent,s=oO(r),c;s&&A(a,"bpmn:Process")&&(o.parent=i(),c=o.hints=o.hints||{},c.participant=s,c.process=a,c.processRef=Ee(s).get("processRef"))},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;A(a,"bpmn:Participant")&&A(r,"bpmn:Process")&&(o.parent=i(),o.process=r,o.processRef=Ee(a).get("processRef"))},!0),this.execute("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.shape,c=r.participant;a&&(!c||s===c)&&Ee(s).set("processRef",Ee(a))},!0),this.revert("shape.create",function(o){var r=o.hints||{},a=o.process||r.process,s=o.processRef||r.processRef,c=o.shape,l=r.participant;a&&(!l||c===l)&&Ee(c).set("processRef",s)},!0),this.postExecute("shape.create",function(o){var r=o.hints||{},a=o.process||o.hints.process,s=o.shape,c=r.participant;if(a){var l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Tf.$inject=["canvas","eventBus","modeling"],Ne(Tf,_e);function nO(e,t){t={width:t.width+Cf*2+rb,height:t.height+Af*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 iO(e,t){return t=Ze(t),{bottom:t.top+e.height/2-Af,left:t.right-e.width/2+Cf,top:t.bottom-e.height/2+Af,right:t.left+e.width/2-Cf-rb}}function oO(e){return $t(e,function(t){return A(t,"bpmn:Participant")})}var ab="__targetRef_placeholder";function Pf(e,t){_e.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],sb(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],sb(r));function n(a,s,c){var l=a.get("dataInputAssociations");return $t(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=$t(c,function(u){return u.name===ab});return!l&&s&&(l=t.create("bpmn:Property",{name:ab}),sn(c,l)),l}function o(a,s){var c=i(a);c&&(n(a,c,s)||rn(a.get("properties"),c))}function r(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,p=u&&u.businessObject,d=s.newTarget,f=d&&d.businessObject,m=s.oldTarget||s.target,g=m&&m.businessObject,y=c.businessObject,_;g&&g!==p&&o(g,l),f&&f!==p&&o(f,l),p?(_=i(p,!0),y.targetRef=_):y.targetRef=null}}Pf.$inject=["eventBus","bpmnFactory"],Ne(Pf,_e);function sb(e){return function(t){var n=t.context,i=n.connection;if(A(i,"bpmn:DataInputAssociation"))return e(t)}}function Hl(e){this._bpmnUpdater=e}Hl.$inject=["bpmnUpdater"],Hl.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),[]},Hl.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){_e.call(this,i),t.registerHandler("dataStore.updateContainment",Hl);function o(){return n.filter(function(s){return A(s,"bpmn:Participant")&&Ee(s).processRef})[0]}function r(s){return s.children.filter(function(c){return A(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||o(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:xt(s),newSemanticParent:u.processRef||u,newDiParent:xt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(p){return A(p,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(p){return!A(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,p=l.parent;if(!A(u,"bpmn:Collaboration")&&A(l,"bpmn:DataStoreReference")&&l.type!=="label"&&A(p,"bpmn:Collaboration")){var d=A(u,"bpmn:Participant")?u:aO(u,"bpmn:Participant");a(l,d)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();dt(l,["bpmn:Participant","bpmn:SubProcess"])&&A(u,"bpmn:Collaboration")&&r(u).filter(function(p){return rO(p,l)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,p=r(l);p.forEach(function(d){A(u,"bpmn:Process")&&a(d,u)})})}kf.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ne(kf,_e);function rO(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 aO(e,t){for(;e.parent;){if(A(e.parent,t))return e.parent;e=e.parent}}var zl=Math.max,Gl=Math.min,sO=20;function cb(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function cO(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 lO(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 Vl(e,t,n){var i=t[e],o=n.min&&n.min[e],r=n.max&&n.max[e];return et(o)&&(i=(/top|left/.test(e)?Gl:zl)(i,o)),et(r)&&(i=(/top|left/.test(e)?zl:Gl)(i,r)),i}function uO(e,t){if(!t)return e;var n=Ze(e);return Ml({top:Vl("top",n,t),right:Vl("right",n,t),bottom:Vl("bottom",n,t),left:Vl("left",n,t)})}function pO(e,t,n,i){var o=Ze(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?Ze(i):r,s={top:Gl(r.top,a.top),left:Gl(r.left,a.left),bottom:zl(r.bottom,a.bottom),right:zl(r.right,a.right)};return Ml(s)}function Gs(e,t){return typeof e<"u"?e:sO}function dO(e,t){var n,i,o,r;return typeof t=="object"?(n=Gs(t.left),i=Gs(t.right),o=Gs(t.top),r=Gs(t.bottom)):n=i=o=r=Gs(t),{x:e.x-n,y:e.y-o,width:e.width+n+i,height:e.height+o+r}}function fO(e){return!(e.waypoints||e.type==="label")}function lb(e,t){var n;if(e.length===void 0?n=ft(e.children,fO):n=e,n.length)return dO(dn(n),t)}var rr=Math.abs;function hO(e,t){return cb(Ze(t),Ze(e))}var gO=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Ci=30;function Wl(e,t){return t=t||[],e.children.filter(function(n){A(n,"bpmn:Lane")&&(Wl(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return A(t,"bpmn:Lane")})}function Ai(e){return ka(e,gO)||e}function mO(e,t){var n=Ai(e),i=A(n,"bpmn:Process")?[]:[n],o=Wl(n,i),r=Ze(e),a=Ze(t),s=hO(e,t),c=[],l=Rn(e);return o.forEach(function(u){if(u!==e){var p=l?0:s.top,d=l?s.right:0,f=l?0:s.bottom,m=l?s.left:0,g=Ze(u);s.top&&(rr(g.bottom-r.top)<10&&(f=a.top-g.bottom),rr(g.top-r.top)<5&&(p=a.top-g.top)),s.left&&(rr(g.right-r.left)<10&&(d=a.left-g.right),rr(g.left-r.left)<5&&(m=a.left-g.left)),s.bottom&&(rr(g.top-r.bottom)<10&&(p=a.bottom-g.top),rr(g.bottom-r.bottom)<5&&(f=a.bottom-g.bottom)),s.right&&(rr(g.left-r.right)<10&&(m=a.right-g.left),rr(g.right-r.right)<5&&(d=a.right-g.right)),(p||d||f||m)&&c.push({shape:u,newBounds:lO(u,{top:p,right:d,bottom:f,left:m})})}}),c}var yO=500;function Of(e,t){_e.call(this,e);function n(i,o){var r=Rn(i),a=ar(o),s=[],c=[],l=[],u=[];if(Gr(a,function(y){return r?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var p;r?c.length&&s.length?p=i.height/2:p=i.height:u.length&&l.length?p=i.width/2:p=i.width;var d,f,m,g;s.length&&(d=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},"s")),c.length&&(f=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:-p},"n")),l.length&&(m=t.calculateAdjustments(l,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:p,y:0},"e")),u.length&&(g=t.calculateAdjustments(u,"x",-p,i.x+i.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",yO,function(i){var o=i.context,r=o.hints,a=o.shape,s=o.oldParent;A(a,"bpmn:Lane")&&(r&&r.nested||n(a,s))})}Of.$inject=["eventBus","spaceTool"],Ne(Of,_e);var ub=500;function Ul(e,t){t.invoke(_e,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ub,function(i){var o=i.elements;o.filter(function(r){var a=r.host;return pb(r,a)}).map(function(r){return o.indexOf(r)}).forEach(function(r){i.elements[r]=n._replaceShape(o[r])})},!0),this.preExecute("elements.move",ub,function(i){var o=i.shapes,r=i.newHost;o.forEach(function(a,s){var c=a.host;pb(a,xO(o,c)?c:r)&&(o[s]=n._replaceShape(a))})},!0)}Ul.$inject=["bpmnReplace","injector"],Ne(Ul,_e),Ul.prototype._replaceShape=function(e){var t=vO(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function vO(e){var t=Ee(e),n=t.eventDefinitions;return n&&n[0]}function pb(e,t){return!ut(e)&&A(e,"bpmn:BoundaryEvent")&&!t}function xO(e,t){return e.indexOf(t)!==-1}var ql=Math.round,bO=Math.max;function wO(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 _O(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var db=10;function EO(e,t){var n,i;for(n=0;i=e[n];n++)if(Ds(i,t)<=db)return{point:e[n],bendpoint:!0,index:n};return null}function SO(e,t){var n=gx(wO(t,db),_O(e)),i=n[0],o=n[n.length-1],r;return i?i!==o?i.segment2!==o.segment2?(r=bO(i.segment2,o.segment2)-1,{point:e[r],bendpoint:!0,index:r}):{point:{x:ql(i.x+o.x)/2,y:ql(i.y+o.y)/2},index:i.segment2}:{point:{x:ql(i.x),y:ql(i.y)},index:i.segment2}:null}function Df(e,t){return EO(e,t)||SO(e,t)}function Lf(e,t,n){_e.call(this,e);function i(o,r,a){var s=r.waypoints,c,l,u,p,d,f,m,g=o.outgoing.slice(),y=o.incoming.slice(),_;et(a.width)?_=tt(a):_=a;var h=Df(s,_);if(h){if(c=s.slice(0,h.index),l=s.slice(h.index+(h.bendpoint?1:0)),!c.length||!l.length)return;u=h.bendpoint?s[h.index]:_,(c.length===1||!fb(o,c[c.length-1]))&&c.push(hb(u)),(l.length===1||!fb(o,l[0]))&&l.unshift(hb(u))}p=r.source,d=r.target,t.canConnect(p,o,r)&&(n.reconnectEnd(r,o,c||_),f=r),t.canConnect(o,d,r)&&(f?m=n.connect(o,d,{type:r.type,waypoints:l}):(n.reconnectStart(r,o,l||_),m=r));var v=[].concat(f&&ft(y,function(b){return b.source===f.source})||[],m&&ft(g,function(b){return b.target===m.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(o){var r=o.newParent,a=o.shapes,s=o.delta,c=a[0];if(!(!c||!r)){r&&r.waypoints&&(o.newParent=r=r.parent);var l=tt(c),u={x:l.x+s.x,y:l.y+s.y},p=$t(r.children,function(d){var f=t.canInsert(a,d);return f&&Df(d.waypoints,u)});p&&(o.targetFlow=p,o.position=u)}},!0),this.postExecuted("elements.move",function(o){var r=o.shapes,a=o.targetFlow,s=o.position;a&&i(r[0],a,s)},!0),this.preExecute("shape.create",function(o){var r=o.parent,a=o.shape;t.canInsert(a,r)&&(o.targetFlow=r,o.parent=r.parent)},!0),this.postExecuted("shape.create",function(o){var r=o.shape,a=o.targetFlow,s=o.position;a&&i(r,a,s)},!0)}Ne(Lf,_e),Lf.$inject=["eventBus","bpmnRules","modeling"];function fb(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 hb(e){return Z({},e)}function If(e,t){_e.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,o=i.connection,r=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Da(o)){var c=[];A(r,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==o&&Da(l)):c=a.incoming.filter(l=>l!==o&&Da(l)&&A(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,o=i.newShape;if(A(o,"bpmn:EventBasedGateway")){var r=o.outgoing.filter(Da).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);r.forEach(function(a){a.incoming.filter(Da).forEach(function(s){const c=a.incoming.filter(Da).filter(function(l){return l.source===o});(s.source!==o||c.length>1)&&t.removeConnection(s)})})}})}If.$inject=["eventBus","modeling"],Ne(If,_e);function Da(e){return A(e,"bpmn:SequenceFlow")}var Yl=1500,gb=2e3;function mb(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"],Yl,function(i){var o=i.context,r=o.shape||i.shape,a=i.hover;A(a,"bpmn:Lane")&&!dt(r,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Ai(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(r.labelTarget||dt(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"],Yl,function(i){var o=i.hover;A(o,"bpmn:Lane")&&(i.hover=Ai(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Yl,function(i){var o=i.context,r=i.hover,a=o.type;A(r,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Ai(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Yl,function(i){var o=i.context,r=o.start;A(r,"bpmn:Lane")&&(o.start=Ai(r)||r)}),t.on("shape.move.start",gb,function(i){var o=i.shape;A(o,"bpmn:Lane")&&(i.shape=Ai(o)||o)}),t.on("spaceTool.move",gb,function(i){var o=i.hover;o&&A(o,"bpmn:Lane")&&(i.hover=Ai(o))})}mb.$inject=["elementRegistry","eventBus","canvas"];var yb=770;function Bf(e,t,n,i){n.invoke(_e,this);function o(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef;u||(u=ib(e,l));var p=c.category||u.$parent||nb(e);l.categoryValueRef=u,u.$parent=p,c.categoryValue=u,c.category=p}function r(s,c){var l=Ee(s),u=c.categoryValue||l.categoryValueRef,p=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=p,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&o(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;A(l,"bpmn:Group")&&r(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=Ee(l);if(!(!A(l,"bpmn:Group")||l.labelTarget)){var p=c.categoryValue=u.categoryValueRef;p&&(c.category=p.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=c.category,p=c.categoryValue,d=Ee(l);p&&(d.categoryValueRef=p,p.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!A(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!Ee(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||Ee(l).categoryValueRef||o(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!A(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||r(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",yb,function(s){var c=s.descriptor,l=s.element;if(!(!A(l,"bpmn:Group")||l.labelTarget)){var u=Ee(l);if(u.categoryValueRef){var p=u.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",yb,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})}Bf.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],Ne(Bf,_e);function Nf(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 vb(e){function t(i,o,r){var a={x:r.x,y:r.y-50},s={x:r.x-50,y:r.y},c=Nf(i,o,r,a),l=Nf(i,o,r,s),u;c&&l?xb(c,r)>xb(l,r)?u=l:u=c:u=c||l,i.original=u}function n(i){var o=i.waypoints;t(o[0],o[1],tt(i.source)),t(o[o.length-1],o[o.length-2],tt(i.target))}e.on("bpmnElement.added",function(i){var o=i.element;o.waypoints&&n(o)})}vb.$inject=["eventBus"];function xb(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $f(e){_e.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,o=Ee(i),r=xt(i);if(dt(o,t)){var a=r.get("isHorizontal");a===void 0&&(a=!0),r.set("isHorizontal",a)}})}$f.$inject=["eventBus"],Ne($f,_e);function bb(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function wb(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function RO(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 MO(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 Ff(e,t){var n=t[0],i=t[1],o={x:i.x-n.x,y:i.y-n.y},r=MO([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 _b(e,t){var n=Ff(e,t),i={x:n.x-e.x,y:n.y-e.y};return bb(i)}function Vs(e,t){return bb({x:e.x-t.x,y:e.y-t.y})}var Eb=Math.sqrt,Sb=Math.min,CO=Math.max,Rb=Math.abs;function Mb(e){return Math.pow(e,2)}function Ws(e,t){return Eb(Mb(e.x-t.x)+Mb(e.y-t.y))}function AO(e,t){var n=0,i,o,r,a,s,c,l,u,p,d,f;for(n=0;n<t.length-1;n++){if(i=t[n],o=t[n+1],Ab(i,o)?l=[i]:(r=Ws(e,i),a=Ws(e,o),c=Sb(r,a),l=TO(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:Ab(i,l[0])?n:n+1}),l.length===2&&(s=kO(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ws(i,s)/Ws(i,o)}),p=Ws(u.position,e),(!f||d>p)&&(f=u,d=p)}return f}function TO(e,t,n,i){var o=t.x-e.x,r=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=o*o+r*r,l=o*a+r*s,u=a*a+s*s-i*i,p=l/c,d=u/c,f=p*p-d;if(f<0&&f>-1e-6&&(f=0),f<0)return[];var m=Eb(f),g=-p+m,y=-p-m,_={x:e.x-o*g,y:e.y-r*g};if(f===0)return[_];var h={x:e.x-o*y,y:e.y-r*y};return[_,h].filter(function(v){return PO(v,e,t)})}function PO(e,t,n){return Cb(e.x,t.x,n.x)&&Cb(e.y,t.y,n.y)}function Cb(e,t,n){return e>=Sb(t,n)-Kl&&e<=CO(t,n)+Kl}function kO(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Kl=.1;function Ab(e,t){return Rb(e.x-t.x)<=Kl&&Rb(e.y-t.y)<=Kl}function OO(e,t,n,i){var o=n.segmentIndex,r=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return o===a?s:o>=s?o+r<s?s:o+r:o}if(i.bendpointMove){var c=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex,u;if(r===0)return o;if(o>=l&&(u=c?o+1:o-1),o<l&&(u=o,c&&n.type!=="bendpoint"&&l-1===o)){var p=Pb(t,l);p<n.relativeLocation&&u++}return u}return r===0?o:i.connectionStart&&o===0?0:i.connectionEnd&&o===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Tb(e,t,n,i){var o=0,r=0,a={point:e,delta:{x:0,y:0}},s=AO(e,n),c=s.segmentIndex,l=OO(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=kb(n,c),p=kb(t,l),d=s.position,f=LO(u,d),m=DO(u,p);if(s.type==="bendpoint"){var g=t.length-n.length,y=s.bendpointIndex,_=n[y];if(t.indexOf(_)!==-1)return a;if(g===0){var h=t[y];return o=h.x-s.position.x,r=h.y-s.position.y,{delta:{x:o,y:r},point:{x:e.x+o,y:e.y+r}}}g<0&&y!==0&&y<n.length-1&&(f=Pb(n,y))}var v={x:(p[1].x-p[0].x)*f+p[0].x,y:(p[1].y-p[0].y)*f+p[0].y},b=RO({x:e.x-d.x,y:e.y-d.y},m);return o=v.x+b.x-e.x,r=v.y+b.y-e.y,{point:Ro(v),delta:Ro({x:o,y:r})}}function Pb(e,t){var n=Vs(e[t-1],e[t]),i=Vs(e[t],e[t+1]),o=n/(n+i);return o}function DO(e,t){var n=wb(e),i=wb(t);return i-n}function kb(e,t){return[e[t],e[t+1]]}function LO(e,t){var n=Vs(e[0],e[1]),i=Vs(e[0],t);return n===0?0:i/n}function IO(e,t,n,i){var o=tt(e);return Tb(o,t,n,i).delta}function Us(e,t,n){var i=Hs(t),o=Hs(n),r=Wi(e,i),a={x:r.x*(n.width/t.width),y:r.y*(n.height/t.height)};return Ro({x:o.x+a.x,y:o.y+a.y})}function Ob(e,t,n){var i=Hs(e),o=Hs(t),r=Hs(n),a=Wi(e,i),s=Wi(i,o),c=BO(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 Ro({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function BO(e,t,n){var i=Ze(t),o=Ze(n);if(NO(i,o))return null;var r=Nn(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=Nn(n,s),c!==r?null:a}function NO(e,t){return $O(e,t)||FO(e,t)}function $O(e,t){return e.right!==t.right&&e.left!==t.left}function FO(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Db="name",Lb="text";function jf(e,t,n,i){_e.call(this,e),this.postExecute("element.updateProperties",o),this.postExecute("element.updateModdleProperties",a=>{Ee(a.context.element)===a.context.moddleElement&&o(a)});function o(a){var s=a.context,c=s.element,l=s.properties;if(Db in l&&t.updateLabel(c,l[Db]),Lb in l&&A(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Lb]||"");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;ut(l)||!or(l)||ui(l)&&t.updateLabel(l,ui(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=Z({},s.hints),p=s.newWaypoints||c.waypoints,d=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),IO(l,p,d,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,p;!u||!u.parent||(p=r(a),t.moveShape(u,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=Ee(c);u&&or(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(!(!ut(c)||l.autoResize)){var u=s.newBounds,p=i.getDimensions(ui(c)||"",{box:u,style:i.getExternalStyle()}),d=Math.ceil(p.height),f=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:d,x:u.x,y:f?m-d:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Ol(c)){var p=c.label,d=tt(p),f=zO(u),m=HO(d,f),g=jO(m,u,l);t.moveShape(p,g)}})}Ne(jf,_e),jf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function jO(e,t,n){var i=Us(e,t,n);return Ro(Wi(i,e))}function HO(e,t){if(t.length){var n=GO(e,t);return Ff(e,n)}}function zO(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 GO(e,t){var n=t.map(function(o){return{line:o,distance:_b(e,o)}}),i=Xi(n,"distance");return i[0].line}function VO(e,t,n,i){return Tb(e,t,n,i).point}function Hf(e,t){_e.call(this,e);function n(i,o){var r=i.context,a=r.connection,s=Z({},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),VO(o,c,l,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming;s.forEach(function(c){var l=c.waypoints[c.waypoints.length-1],u=n(i,l),p=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,p)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),p=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var o=i.context,r=o.connection,a=r.outgoing,s=r.incoming,c=o.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],p={x:u.x+c.x,y:u.y+c.y},d=[].concat(l.waypoints.slice(0,-1),[p]);t.updateWaypoints(l,d)}),a.forEach(function(l){var u=l.waypoints[0],p={x:u.x+c.x,y:u.y+c.y},d=[].concat([p],l.waypoints.slice(1));t.updateWaypoints(l,d)})})}Ne(Hf,_e),Hf.$inject=["eventBus","modeling"];function Xl(e,t,n){var i=Jl(e),o=Bb(i,t),r=i[0];return o.length?o[o.length-1]:Us(r.original||r,n,t)}function Zl(e,t,n){var i=Jl(e),o=Bb(i,t),r=i[i.length-1];return o.length?o[0]:Us(r.original||r,n,t)}function zf(e,t,n){var i=Jl(e),o=Ib(t,n),r=i[0];return Us(r.original||r,o,t)}function Gf(e,t,n){var i=Jl(e),o=Ib(t,n),r=i[i.length-1];return Us(r.original||r,o,t)}function Ib(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Jl(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Bb(e,t){var n=zn(e,UO);return ft(n,function(i){return WO(i,t)})}function WO(e,t){return Nn(t,e,1)==="intersect"}function UO(e){return e.original||e}function Vf(e,t){_e.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,o=n.newShape;if(qO(i,o)){var r=YO(i);r.incoming.forEach(function(a){var s=Zl(a,o,i);t.reconnectEnd(a,o,s)}),r.outgoing.forEach(function(a){var s=Xl(a,o,i);t.reconnectStart(a,o,s)})}},!0)}Vf.$inject=["eventBus","modeling"],Ne(Vf,_e);function qO(e,t){return A(e,"bpmn:Participant")&&yt(e)&&A(t,"bpmn:Participant")&&!yt(t)}function YO(e){var t=ks([e]),n=[],i=[];return t.forEach(function(o){o!==e&&(o.incoming.forEach(function(r){A(r,"bpmn:MessageFlow")&&n.push(r)}),o.outgoing.forEach(function(r){A(r,"bpmn:MessageFlow")&&i.push(r)}))},[]),{incoming:n,outgoing:i}}const KO=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Nb(e){const t=Ee(e);if(!A(t,"bpmn:BoundaryEvent")&&!(A(t,"bpmn:StartEvent")&&Un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:KO.some(i=>A(n[0],i))}function $b(e){return A(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Wf(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,o=n.context.newShape,r=n.context.hints;if(!Nb(o))return;const a=$b(o);if(r.targetElement&&r.targetElement[a]!==void 0)return;const c=Ee(i).get(a),l=Ee(o).get(a);c!==l&&t.updateProperties(o,{[a]:c})})}Wf.$inject=["injector","modeling"],Ne(Wf,_e);function Uf(e,t){_e.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,o=xt(i),r=o&&o.get("label"),a=r&&r.get("bounds");a&&t.updateModdleProperties(i,r,{bounds:void 0})},!0)}Ne(Uf,_e),Uf.$inject=["eventBus","modeling"];function qf(e,t,n){_e.call(this,e),this.preExecute("shape.delete",function(i){var o=i.context.shape;if(!(o.incoming.length!==1||o.outgoing.length!==1)){var r=o.incoming[0],a=o.outgoing[0];if(!(!A(r,"bpmn:SequenceFlow")||!A(a,"bpmn:SequenceFlow"))&&t.canConnect(r.source,a.target,r)){var s=XO(r.waypoints,a.waypoints);n.reconnectEnd(r,a.target,s)}}})}Ne(qf,_e),qf.$inject=["eventBus","bpmnRules","modeling"];function La(e){return e.original||e}function XO(e,t){var n=Nf(La(e[e.length-2]),La(e[e.length-1]),La(t[1]),La(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[La(e[0]),La(t[t.length-1])]}function Yf(e,t){_e.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,o=i.parent;A(i,"bpmn:Participant")&&(n.collaborationRoot=o)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var o=t.makeProcess(),r=i.children.slice();t.moveElements(r,{x:0,y:0},o)}},!0)}Yf.$inject=["eventBus","modeling"],Ne(Yf,_e);function Kf(e,t,n,i){_e.call(this,e);var o=i.get("dragging",!1);function r(c){var l=c.source,u=c.target,p=c.parent;if(p){var d,f;A(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(f=!0),n.canConnectMessageFlow(l,u)&&(d="bpmn:MessageFlow")),A(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(f=!0),n.canConnectSequenceFlow(l,u)&&(d="bpmn:SequenceFlow")),f&&t.removeConnection(c),d&&t.connect(l,u,{type:d,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,p=l.newSource||u.source,d=l.newTarget||u.target,f,m;f=n.canConnect(p,d),!(!f||f.type===u.type)&&(m=t.connect(p,d,{type:f.type,associationDirection:f.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,o&&s(u,m))}function s(c,l){var u=o.context(),p=u&&u.payload.previousSelection,d;!p||!p.length||(d=p.indexOf(c),d!==-1&&p.splice(d,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;U(u,r)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,p=l.element,d=p.businessObject,f;u.default&&(f=$t(p.outgoing,ma({id:p.businessObject.default.id})),f&&t.updateProperties(f,{conditionExpression:void 0})),u.conditionExpression&&d.sourceRef.default===d&&t.updateProperties(p.source,{default:void 0})})}Ne(Kf,_e),Kf.$inject=["eventBus","modeling","bpmnRules","injector"];function Ql(e,t,n,i,o,r){i.invoke(_e,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=r,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=si(l,function(p,d){var f=t.canReplace([d],d.host||d.parent||c);return f?p.concat(f.replacements):p},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];U(s.closure.topLevel,function(d){Un(d)?u=u.concat(d.children):u=u.concat(d)}),u.length===1&&l&&(c=l);var p=t.canReplace(u,c);p&&this._replaceElements(u,p.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,p;u&&u.length&&(p=t.canReplace(u,l),this._replaceElements(u,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;o.unclaimId(c.businessObject.id,c.businessObject),o.updateProperties(l,{id:c.id})})}Ne(Ql,_e),Ql.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,o=this._selection;U(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)},Ql.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var ZO=1500,JO={width:140,height:120},Xf={width:300,height:60},Zf={width:60,height:300},eu={width:300,height:150},tu={width:150,height:300},Fb={width:140,height:120},jb={width:100,height:40};function Hb(e){e.on("resize.start",ZO,function(t){var n=t.context,i=n.shape,o=n.direction,r=n.balanced;(A(i,"bpmn:Lane")||A(i,"bpmn:Participant"))&&(n.resizeConstraints=iD(i,o,r)),A(i,"bpmn:SubProcess")&&yt(i)&&(n.minDimensions=Fb),A(i,"bpmn:TextAnnotation")&&(n.minDimensions=jb)})}Hb.$inject=["eventBus"];var sr=Math.abs,QO=Math.min,eD=Math.max;function zb(e,t,n,i){var o=e[t];e[t]=o===void 0?n:i(n,o)}function Ia(e,t,n){return zb(e,t,n,QO)}function Ba(e,t,n){return zb(e,t,n,eD)}var tD={top:20,left:50,right:20,bottom:20},nD={top:50,left:20,right:20,bottom:20};function iD(e,t,n){var i=Ai(e),o=!0,r=!0,a=Wl(i,[i]),s=Ze(e),c={},l={},u=Rn(e),p=u?Xf:Zf;/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(m){var g=Ze(m);u?(g.top<s.top-10&&(o=!1),g.bottom>s.bottom+10&&(r=!1)):(g.left<s.left-10&&(o=!1),g.right>s.right+10&&(r=!1)),/n/.test(t)&&(n&&sr(s.top-g.bottom)<10&&Ba(c,"top",g.top+p.height),sr(s.top-g.top)<5&&Ia(l,"top",g.bottom-p.height)),/e/.test(t)&&(n&&sr(s.right-g.left)<10&&Ia(c,"right",g.right-p.width),sr(s.right-g.right)<5&&Ba(l,"right",g.left+p.width)),/s/.test(t)&&(n&&sr(s.bottom-g.top)<10&&Ia(c,"bottom",g.bottom-p.height),sr(s.bottom-g.bottom)<5&&Ba(l,"bottom",g.top+p.height)),/w/.test(t)&&(n&&sr(s.left-g.right)<10&&Ba(c,"left",g.left+p.width),sr(s.left-g.left)<5&&Ia(l,"left",g.right-p.width))});var d=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(A(m,"bpmn:FlowElement")||A(m,"bpmn:Artifact"))}),f=u?tD:nD;return d.forEach(function(m){var g=Ze(m);/n/.test(t)&&(!u||o)&&Ia(l,"top",g.top-f.top),/e/.test(t)&&(u||r)&&Ba(l,"right",g.right+f.right),/s/.test(t)&&(!u||r)&&Ba(l,"bottom",g.bottom+f.bottom),/w/.test(t)&&(u||o)&&Ia(l,"left",g.left-f.left)}),{min:l,max:c}}function Gb(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Na(e){return e.originalEvent||e.srcEvent}function Jf(e){Gb(e),Gb(Na(e))}function qr(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 Vb(){return/mac/i.test(navigator.platform)}function Wb(e,t){return(Na(e)||e).button===t}function cr(e){return Wb(e,0)}function oD(e){return Wb(e,1)}function qs(e){var t=Na(e)||e;return cr(e)?Vb()?t.metaKey:t.ctrlKey:!1}function nu(e){var t=Na(e)||e;return cr(e)&&t.shiftKey}var Ub=1001;function qb(e,t){e.on("resize.start",Ub+500,function(n){var i=n.context,o=i.shape;(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))&&(i.balanced=!qs(n))}),e.on("resize.end",Ub,function(n){var i=n.context,o=i.shape,r=i.canExecute,a=i.newBounds;if(A(o,"bpmn:Lane")||A(o,"bpmn:Participant"))return r&&(a=bx(a),t.resizeLane(o,a,i.balanced)),!1})}qb.$inject=["eventBus","modeling"];var rD=500;function Qf(e,t,n,i,o){n.invoke(_e,this);function r(u){return dt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||aD(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var p=e.getDefinitions(),d=p.get("rootElements");return!!$t(d,ma({id:u.id}))}function s(u){if(A(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(A(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(A(u,"bpmn:MessageEventDefinition"))return"messageRef";if(A(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(dt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var p=u.get("eventDefinitions"),d=p[0];return d.get(s(d))}function l(u,p){if(dt(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",p);var d=u.get("eventDefinitions"),f=d[0];return f.set(s(f),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.shape||u.element;if(r(p)){var d=Ee(p),f=c(d),m;f&&!a(f)&&(m=e.getDefinitions().get("rootElements"),sn(m,f),u.addedRootElement=f)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var p=u.addedRootElement;if(p){var d=e.getDefinitions().get("rootElements");rn(d,p)}},!0),t.on("copyPaste.copyElement",function(u){var p=u.descriptor,d=u.element;if(!(d.labelTarget||!r(d))){var f=Ee(d),m=c(f);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",rD,function(u){var p=u.descriptor,d=p.businessObject,f=p.referencedRootElement;f&&(a(f)||(f=i.copyElement(f,o.create(f.$type))),l(d,f),delete p.referencedRootElement)})}Qf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ne(Qf,_e);function aD(e,t){return Qe(t)||(t=[t]),Go(t,function(n){return Aa(e,n)})}var Yb=Math.max;function Kb(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,o=t.start,r={};return U(n,function(a){var s=a.id;A(a,"bpmn:Participant")&&(r[s]=cD(a,i,o)),A(a,"bpmn:Lane")&&(r[s]=Rn(a)?Xf:Zf),A(a,"bpmn:SubProcess")&&yt(a)&&(r[s]=Fb),A(a,"bpmn:TextAnnotation")&&(r[s]=jb),A(a,"bpmn:Group")&&(r[s]=JO)}),r})}Kb.$inject=["eventBus"];function sD(e){return e==="x"}function cD(e,t,n){var i=Rn(e);if(!pD(e))return i?eu:tu;var o=sD(t),r={};return o?i?r=eu:r={width:uD(e,n,o),height:tu.height}:i?r={width:eu.width,height:lD(e,n,o)}:r=tu,r}function lD(e,t,n){var i;return i=dD(e,t,n),Yb(eu.height,i)}function uD(e,t,n){var i;return i=fD(e,t,n),Yb(tu.width,i)}function pD(e){return!!ar(e).length}function dD(e,t,n){var i=ar(e),o;return o=eh(i,t,n),e.height-o.height+Xf.height}function fD(e,t,n){var i=ar(e),o;return o=eh(i,t,n),e.width-o.width+Zf.width}function eh(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=ar(o),r.length?eh(r,t,n):o}var Xb="_plane";function Zb(e){var t=e.id;return hD(t)}function so(e){var t=e.id;return A(e,"bpmn:SubProcess")?Jb(t):t}function Yr(e){return Jb(e)}function iu(e){var t=xt(e);return A(t,"bpmndi:BPMNPlane")}function Jb(e){return e+Xb}function hD(e){return e.replace(new RegExp(Xb+"$"),"")}var Qb=400,gD=600,ew={x:180,y:160};function To(e,t,n,i,o,r,a){_e.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=o,this._bpmnjs=r,this._elementRegistry=a;var s=this;function c(p){return A(p,"bpmn:SubProcess")&&!yt(p)}function l(p){var d=p.shape,f=p.newRootElement,m=Ee(d);f=s._addDiagram(f||m),p.newRootElement=e.addRootElement(f)}function u(p){var d=p.shape,f=Ee(d);s._removeDiagram(f);var m=p.newRootElement=a.get(so(f));e.removeRootElement(m)}this.executed("shape.create",function(p){var d=p.shape;c(d)&&l(p)},!0),this.postExecuted("elements.create",function(p){var d=p.elements;U(d,function(f){if(c(f)){var m=a.get(so(f));if(!(!m||!f.children||!f.children.length)){var g=tw(f);s._showRecursively(g),s._moveChildrenToShape(g,m)}}})},!0),this.reverted("shape.create",function(p){var d=p.shape;c(d)&&u(p)},!0),this.preExecute("shape.delete",function(p){var d=p.shape;!A(d,"bpmn:SubProcess")||!yt(d)||U(Ns([d]),f=>{n.removeShape(f.annotation)})},!0),this.preExecuted("shape.delete",function(p){var d=p.shape;if(c(d)){var f=a.get(so(d));f&&n.removeElements(f.children.slice())}},!0),this.executed("shape.delete",function(p){var d=p.shape;c(d)&&u(p)},!0),this.reverted("shape.delete",function(p){var d=p.shape;c(d)&&l(p)},!0),this.preExecuted("shape.replace",function(p){var d=p.oldShape,f=p.newShape;!c(d)||!c(f)||(p.oldRoot=e.removeRootElement(so(d)))},!0),this.postExecuted("shape.replace",function(p){var d=p.newShape,f=p.oldRoot,m=e.findRoot(so(d));if(!(!f||!m)){var g=f.children;n.moveElements(g,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,Yr(y)),a.updateId(g,y);return}var _=a.get(Yr(g));_&&a.updateId(Yr(g),Yr(y))}}},!0),this.reverted("element.updateProperties",function(p){var d=p.element;if(A(d,"bpmn:SubProcess")){var f=p.properties,m=p.oldProperties,g=m.id,y=f.id;if(g!==y){if(iu(d)){a.updateId(d,Yr(g)),a.updateId(y,g);return}var _=a.get(Yr(y));_&&a.updateId(_,Yr(g))}}},!0),t.on("element.changed",function(p){var d=p.element;if(iu(d)){var f=d,m=a.get(Zb(f));!m||m===f||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Qb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(yt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.reverted("shape.toggleCollapse",Qb,function(p){var d=p.shape;A(d,"bpmn:SubProcess")&&(yt(d)?u(p):(l(p),s._showRecursively(d.children)))},!0),this.postExecuted("shape.toggleCollapse",gD,function(p){var d=p.shape;if(A(d,"bpmn:SubProcess")){var f=p.newRootElement;if(f)if(yt(d))s._moveChildrenToShape(f.children.slice(),d),U(Ns(d.children),g=>{n.moveShape(g.annotation,{x:0,y:0},d.parent),U(g.associations,y=>{n.moveConnection(y,{x:0,y:0},d.parent)})});else{s._disconnectSharedAnnotations(d);var m=tw(d);s._moveChildrenToShape(m,f)}}},!0),t.on("copyPaste.createTree",function(p){var d=p.element,f=p.children;if(c(d)){var m=so(d),g=a.get(m);g&&f.push.apply(f,g.children)}}),t.on("copyPaste.copyElement",function(p){var d=p.descriptor,f=p.element,m=p.elements,g=f.parent,y=A(xt(g),"bpmndi:BPMNPlane");if(y){var _=Zb(g),h=$t(m,function(v){return v.id===_});h&&(d.parent=h.id)}}),t.on("copyPaste.pasteElement",function(p){var d=p.descriptor;d.parent&&(c(d.parent)||d.parent.hidden)&&(d.hidden=!0)})}Ne(To,_e),To.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=dn(i),r;if(!t.x)r={x:ew.x-o.x,y:ew.y-o.y};else{var a=tt(t),s=tt(o);r={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,r,t,{autoResize:!1})}},To.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Wx(e).map(i=>i.annotation));n.size&&U(Ns(e.children),i=>{n.has(i.annotation)&&U(i.associations,o=>{t.removeConnection(o)})})},To.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},To.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},To.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:so(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return r},To.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=$t(n,function(o){return o.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},To.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function mD(e){var t=[];return U(Ns(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function tw(e){return e.children.slice().concat(mD(e.children)).concat(yD(e))}function yD(e){return rf(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function th(e,t){e.invoke(_e,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,o=n.context.newShape;if(!(!A(o,"bpmn:SubProcess")||A(o,"bpmn:AdHocSubProcess")||!(A(i,"bpmn:Task")||A(i,"bpmn:CallActivity"))||!yt(o))){var r=vD(o);t.createShape({type:"bpmn:StartEvent"},r,o)}})}th.$inject=["injector","modeling"],Ne(th,_e);function vD(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function nh(e,t){_e.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;A(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&A(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,o=i.shape,r=i.hints||{};if(!(!A(o,"bpmn:TextAnnotation")||r.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,ui(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}}})}Ne(nh,_e),nh.$inject=["eventBus","textRenderer"];function ih(e,t){_e.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(yt(i))return;var o=ks(i);o.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();U(s,function(l){r(l,!0)}),U(c,function(l){r(l,!1)})});function r(a,s){o.indexOf(a.source)!==-1&&o.indexOf(a.target)!==-1||A(a,"bpmn:Association")&&(A(a.source,"bpmn:TextAnnotation")||A(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,tt(i)):t.reconnectStart(a,i,tt(i)))}},!0)}Ne(ih,_e),ih.$inject=["eventBus","modeling"];var oh=500;function rh(e,t,n){_e.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function o(a,s){var c=a.children,l=s,u,p;return u=xD(c).concat([a]),p=lb(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"],oh,function(a){var s=a.context,c=s.shape;A(c,"bpmn:SubProcess")&&(c.collapsed?xt(c).isExpanded=!1:(i(c.children),xt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],oh,function(a){var s=a.context,c=s.shape;c.collapsed?xt(c).isExpanded=!1:xt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],oh,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"})})}Ne(rh,_e),rh.$inject=["eventBus","elementFactory","modeling"];function xD(e){return e.filter(function(t){return!t.hidden})}function ah(e,t,n,i){t.invoke(_e,this),this.preExecute("shape.delete",function(o){var r=o.context,a=r.shape,s=a.businessObject;ut(a)||(A(a,"bpmn:Participant")&&yt(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(o){var r=o.context,a=r.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var o=e.getRootElement(),r=o.businessObject;A(o,"bpmn:Collaboration")&&n.ids.unclaim(r.id)})}Ne(ah,_e),ah.$inject=["canvas","injector","moddle","modeling"];function sh(e,t){_e.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,o=i.connection,r=o.source;bD(o,r)&&t.updateProperties(r,{default:null})})}Ne(sh,_e),sh.$inject=["eventBus","modeling"];function bD(e,t){if(!A(e,"bpmn:SequenceFlow"))return!1;var n=Ee(t),i=Ee(e);return n.get("default")===i}var wD=500,_D=5e3,nw=["shape.create","shape.delete","shape.move","shape.resize"],iw=[...nw,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function ch(e,t){_e.call(this,e);var n;function i(){return n=n||new ED,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(iw,_D,function(){i()}),this.postExecuted(iw,wD,function(){r()}),this.preExecute(nw,function(a){var s=a.context,c=s.shape,l=o();!c||c.labelTarget||(A(c,"bpmn:Lane")&&l.addLane(c),A(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}ch.$inject=["eventBus","modeling"],Ne(ch,_e);function ED(){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 SD=500,RD=5e3,ow=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],rw=[...ow,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function lh(e,t){_e.call(this,e);var n;function i(){return n=n||new MD,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(rw,RD,function(){i()}),this.postExecuted(rw,SD,function(){r()}),this.preExecute(ow,function(a){var s=a.context.connection||a.context.shape,c=o();!s||s.labelTarget||(A(s,"bpmn:FlowElement")&&c.addFlowElement(s),A(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;A(s,"bpmn:Group")&&o().addGroup(s)})}lh.$inject=["eventBus","modeling"],Ne(lh,_e);function MD(){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 uh(e,t){_e.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,o=i.elements;for(const r of o)CD(r)&&!TD(r)&&t.updateProperties(r,{isForCompensation:void 0})})}Ne(uh,_e),uh.$inject=["eventBus","modeling"];function CD(e){const t=Ee(e);return t&&t.isForCompensation}function AD(e){return e&&A(e,"bpmn:BoundaryEvent")&&Aa(e,"bpmn:CompensateEventDefinition")}function TD(e){return e.incoming.filter(n=>AD(n.source)).length>0}const PD={__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",vf],appendBehavior:["type",xf],associationBehavior:["type",wf],attachEventBehavior:["type",$l],artifactBehavior:["type",bf],boundaryEventBehavior:["type",_f],categoryRootElementReferenceBehavior:["type",Ef],compensateBoundaryEventBehaviour:["type",Sf],createBehavior:["type",Rf],createDataObjectBehavior:["type",Mf],createParticipantBehavior:["type",Tf],dataInputAssociationBehavior:["type",Pf],dataStoreBehavior:["type",kf],deleteLaneBehavior:["type",Of],detachEventBehavior:["type",Ul],dropOnFlowBehavior:["type",Lf],eventBasedGatewayBehavior:["type",If],fixHoverBehavior:["type",mb],groupBehavior:["type",Bf],importDockingFix:["type",vb],isHorizontalFix:["type",$f],labelBehavior:["type",jf],layoutConnectionBehavior:["type",Hf],messageFlowBehavior:["type",Vf],nonInterruptingBehavior:["type",Wf],removeElementBehavior:["type",qf],removeEmbeddedLabelBoundsBehavior:["type",Uf],removeParticipantBehavior:["type",Yf],replaceConnectionBehavior:["type",Kf],replaceElementBehaviour:["type",Ql],resizeBehavior:["type",Hb],resizeLaneBehavior:["type",qb],rootElementReferenceBehavior:["type",Qf],spaceToolBehavior:["type",Kb],subProcessPlaneBehavior:["type",To],subProcessStartEventBehavior:["type",th],textAnnotationBehavior:["type",nh],toggleCollapseConnectionBehaviour:["type",ih],toggleElementCollapseBehaviour:["type",rh],unclaimIdBehavior:["type",ah],unsetDefaultFlowBehavior:["type",sh],updateFlowNodeRefsBehavior:["type",ch],updateCategoryValueRefsBehavior:["type",lh],setCompensationActivityAfterPasteBehavior:["type",uh]};function ph(e){this._commandStack=e.get("commandStack",!1)}ph.$inject=["injector"],ph.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const co={__init__:["rules"],rules:["type",ph]};function Ti(e){_e.call(this,e),this.init()}Ti.$inject=["eventBus"],Ne(Ti,_e),Ti.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)})},Ti.prototype.init=function(){};function aw(e,t){var n=Nn(e,t,-15);return n!=="intersect"?n:null}function Fn(e){Ti.call(this,e)}Ne(Fn,Ti),Fn.$inject=["eventBus"],Fn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return kD(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 ru(t,n)}finally{o&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ru(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 xw(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Lt(i)&&!au(t,i)?!1:zo(t,function(o){return Lt(o)?ru(o.source,o.target,o):o.host?Ys(o,o.host,null,n):gh(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 fw(a)&&!n.includes(a.host)})?!1:Ys(n,t,null,i)||yw(n,t,i)||vw(n,t)||au(n,t)}),this.addRule("shape.create",function(e){return gh(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ys(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Sw(n,t)})},Fn.prototype.canConnectMessageFlow=_w,Fn.prototype.canConnectSequenceFlow=Ew,Fn.prototype.canConnectDataAssociation=mh,Fn.prototype.canConnectAssociation=bw,Fn.prototype.canConnectCompensationAssociation=ww,Fn.prototype.canMove=vw,Fn.prototype.canAttach=Ys,Fn.prototype.canReplace=yw,Fn.prototype.canDrop=$a,Fn.prototype.canInsert=au,Fn.prototype.canCreate=gh,Fn.prototype.canConnect=ru,Fn.prototype.canResize=xw,Fn.prototype.canCopy=Sw;function kD(e){return dh(e)?null:dt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function dh(e){return!e||ut(e)}function sw(e){do{if(A(e,"bpmn:Process"))return Ee(e);if(A(e,"bpmn:Participant"))return Ee(e).processRef||Ee(e)}while(e=e.parent)}function fh(e){return A(e,"bpmn:TextAnnotation")}function hh(e){return A(e,"bpmn:Group")&&!e.labelTarget}function cw(e){return A(e,"bpmn:BoundaryEvent")&&lo(e,"bpmn:CompensateEventDefinition")}function ou(e){return Ee(e).isForCompensation}function OD(e,t){var n=sw(e),i=sw(t);return n===i}function DD(e){return A(e,"bpmn:InteractionNode")&&!A(e,"bpmn:BoundaryEvent")&&(!A(e,"bpmn:Event")||A(e,"bpmn:ThrowEvent")&&pw(e,"bpmn:MessageEventDefinition"))}function LD(e){return A(e,"bpmn:InteractionNode")&&!ou(e)&&(!A(e,"bpmn:Event")||A(e,"bpmn:CatchEvent")&&pw(e,"bpmn:MessageEventDefinition"))&&!(A(e,"bpmn:BoundaryEvent")&&!lo(e,"bpmn:MessageEventDefinition"))}function lw(e){for(var t=e;t=t.parent;){if(A(t,"bpmn:FlowElementsContainer"))return Ee(t);if(A(t,"bpmn:Participant"))return Ee(t).processRef}return null}function uw(e,t){var n=lw(e),i=lw(t);return n===i}function lo(e,t){var n=Ee(e);return!!$t(n.eventDefinitions||[],function(i){return A(i,t)})}function pw(e,t){var n=Ee(e);return(n.eventDefinitions||[]).every(function(i){return A(i,t)})}function ID(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:EndEvent")&&!Un(e)&&!(A(e,"bpmn:IntermediateThrowEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!cw(e)&&!ou(e)}function BD(e){return A(e,"bpmn:FlowNode")&&!A(e,"bpmn:StartEvent")&&!A(e,"bpmn:BoundaryEvent")&&!Un(e)&&!(A(e,"bpmn:IntermediateCatchEvent")&&lo(e,"bpmn:LinkEventDefinition"))&&!ou(e)}function ND(e){return A(e,"bpmn:ReceiveTask")||A(e,"bpmn:IntermediateCatchEvent")&&(lo(e,"bpmn:MessageEventDefinition")||lo(e,"bpmn:TimerEventDefinition")||lo(e,"bpmn:ConditionalEventDefinition")||lo(e,"bpmn:SignalEventDefinition"))}function $D(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function dw(e,t){var n=$D(t);return n.indexOf(e)!==-1}function ru(e,t,n){if(dh(e)||dh(t))return null;if(!A(n,"bpmn:DataAssociation")){if(_w(e,t))return{type:"bpmn:MessageFlow"};if(Ew(e,t))return{type:"bpmn:SequenceFlow"}}var i=mh(e,t);return i||(ww(e,t)?{type:"bpmn:Association",associationDirection:"One"}:bw(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function $a(e,t){return ut(e)||hh(e)?!0:A(t,"bpmn:Participant")&&!yt(t)?!1:A(e,"bpmn:Participant")?A(t,"bpmn:Process")||A(t,"bpmn:Collaboration"):dt(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:A(e,"bpmn:Lane")?A(t,"bpmn:Participant")||A(t,"bpmn:Lane"):A(e,"bpmn:BoundaryEvent")&&!FD(e)?!1:A(e,"bpmn:FlowElement")&&!A(e,"bpmn:DataStoreReference")?A(t,"bpmn:FlowElementsContainer")?yt(t):dt(t,["bpmn:Participant","bpmn:Lane"]):A(e,"bpmn:DataStoreReference")&&A(t,"bpmn:Collaboration")?Go(Ee(t).get("participants"),function(n){return!!n.get("processRef")}):dt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?dt(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):A(e,"bpmn:MessageFlow")?A(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function FD(e){return Ee(e).cancelActivity&&(hw(e)||gw(e))}function fw(e){return!ut(e)&&A(e,"bpmn:BoundaryEvent")}function jD(e){return A(e,"bpmn:Lane")}function HD(e){return fw(e)||A(e,"bpmn:IntermediateThrowEvent")&&hw(e)?!0:A(e,"bpmn:IntermediateCatchEvent")&&gw(e)}function hw(e){var t=Ee(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function gw(e){return mw(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function mw(e,t){return t.some(function(n){return lo(e,n)})}function zD(e){return A(e,"bpmn:ReceiveTask")&&$t(e.incoming,function(t){return A(t.source,"bpmn:EventBasedGateway")})}function Ys(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var o=e[0];return ut(o)||!HD(o)||Un(t)||!A(t,"bpmn:Activity")||ou(t)||i&&!aw(i,t)||zD(t)?!1:"attach"}function yw(e,t,n){if(!t)return!1;var i={replacements:[]};return U(e,function(o){Un(t)||A(o,"bpmn:StartEvent")&&o.type!=="label"&&$a(o,t)&&(J2(o)||i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),(Q2(o)||ek(o)||tk(o))&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"}),mw(o,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&A(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:StartEvent"})),A(t,"bpmn:Transaction")||lo(o,"bpmn:CancelEventDefinition")&&o.type!=="label"&&(A(o,"bpmn:EndEvent")&&$a(o,t)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:EndEvent"}),A(o,"bpmn:BoundaryEvent")&&Ys(o,t,null,n)&&i.replacements.push({oldElementId:o.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function vw(e,t){return Go(e,jD)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return $a(n,t)})}function gh(e,t,n,i){return t?ut(e)||hh(e)?!0:$a(e,t)||au(e,t):!1}function xw(e,t,n){return A(e,"bpmn:SubProcess")?yt(e)&&(!t||t.width>=100&&t.height>=80):A(e,"bpmn:Lane")||A(e,"bpmn:Participant")?!0:fh(e)?n?n==="e"||n==="w":!0:hh(e)?!0:ut(e)?n?n==="e"||n==="w":!0:!1}function GD(e,t){var n=fh(e),i=fh(t);return(n||i)&&n!==i}function bw(e,t){return dw(t,e)||dw(e,t)?!1:GD(e,t)?!0:!!mh(e,t)}function ww(e,t){return uw(e,t)&&cw(e)&&A(t,"bpmn:Activity")&&!WD(t,e)&&!Un(t)}function _w(e,t){return Mw(e)&&!Mw(t)?!1:DD(e)&&LD(t)&&!OD(e,t)}function Ew(e,t){return ID(e)&&BD(t)&&uw(e,t)&&!(A(e,"bpmn:EventBasedGateway")&&!ND(t))}function mh(e,t){return dt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&dt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:dt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&dt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function au(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:dt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!ut(t)&&A(e,"bpmn:FlowNode")&&!A(e,"bpmn:BoundaryEvent")&&$a(e,t.parent)}function yh(e,t){return e&&t&&e.indexOf(t)!==-1}function Sw(e,t){return ut(t)?!0:!(A(t,"bpmn:Lane")&&!yh(e,t.parent)||A(t,"bpmn:MessageFlow")&&!VD(e,t))}function VD(e,t){var n=Rw(t.source),i=Rw(t.target);return yh(e,n)&&yh(e,i)}function Rw(e){for(;e;e=e.parent)if(A(e,"bpmn:Participant"))return e;return null}function Mw(e){return ka(e,"bpmn:Process")||ka(e,"bpmn:Collaboration")}function WD(e,t){return e.attachers.includes(t)}const UD={__depends__:[co],__init__:["bpmnRules"],bpmnRules:["type",Fn]};var qD=2e3;function Cw(e,t){e.on("saveXML.start",qD,n);function n(){var i=t.getRootElements();U(i,function(o){var r=xt(o),a,s;a=ks([o]),a=ft(a,function(c){return c!==o&&!c.labelTarget}),s=zn(a,xt),r.set("planeElement",s)})}}Cw.$inject=["eventBus","canvas"];const YD={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Cw]};function su(e){_e.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,o=i.shape||i.connection,r=i.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,o=i.shape||i.connection,r=i.newParent||o.parent,a=t.getOrdering(o,r);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}su.prototype.getOrdering=function(e,t){return null},Ne(su,_e);function vh(e,t){su.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=$t(n,function(c){return dt(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&&!dt(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}this.getOrdering=function(a,s){if(a.labelTarget||A(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=o(a);c.containers&&(s=r(a,s,c.containers));var l=s.children.indexOf(a),u=wm(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}}}vh.$inject=["eventBus","canvas"],Ne(vh,su);const KD={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",vh]};function Ks(){}Ks.prototype.get=function(){return this._data},Ks.prototype.set=function(e){this._data=e},Ks.prototype.clear=function(){var e=this._data;return delete this._data,e},Ks.prototype.isEmpty=function(){return!this._data};const XD={clipboard:["type",Ks]};var Aw=1500;function Tw(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",Aw,function(s){r(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Aw,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=qr(a),c=document.elementFromPoint(s.x,s.y),ZD(c)}}Tw.$inject=["elementRegistry","eventBus","injector"];function ZD(e){return Hr(e,"svg, .djs-element",!0)}const JD={__init__:["hoverFix"],hoverFix:["type",Tw]};function QD(e){return!0}function cu(e){return cr(e)||oD(e)}var Pw=500;function kw(e,t,n){var i=this;function o(P,k,N){if(!s(P,k)){var G,q,Y;N?q=t.getGraphics(N):(G=k.delegateTarget||k.target,G&&(q=G,N=t.get(q))),!(!q||!N)&&(Y=e.fire(P,{element:N,gfx:q,originalEvent:k}),Y===!1&&(k.stopPropagation(),k.preventDefault()))}}var r={};function a(P){return r[P]}function s(P,k){var N=l[P]||cr;return!N(k)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":QD,"element.mousedown":cu,"element.mouseup":cu,"element.click":cu,"element.dblclick":cu};function u(P,k,N){var G=c[P];if(!G)throw new Error("unmapped DOM event name <"+P+">");return o(G,k,N)}var p="svg, .djs-element";function d(P,k,N,G){var q=r[N]=function(Y){o(N,Y)};G&&(l[N]=G),q.$delegate=ci.bind(P,p,k,q)}function f(P,k,N){var G=a(N);G&&ci.unbind(P,k,G.$delegate)}function m(P){U(c,function(k,N){d(P,N,k)})}function g(P){U(c,function(k,N){f(P,N,k)})}e.on("canvas.destroy",function(P){g(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.createHit",{element:k,gfx:N})}),e.on(["shape.changed","connection.changed"],Pw,function(P){var k=P.element,N=P.gfx;e.fire("interactionEvents.updateHit",{element:k,gfx:N})}),e.on("interactionEvents.createHit",Pw,function(P){var k=P.element,N=P.gfx;i.createDefaultHit(k,N)}),e.on("interactionEvents.updateHit",function(P){var k=P.element,N=P.gfx;i.updateDefaultHit(k,N)});var y=E("djs-hit djs-hit-stroke"),_=E("djs-hit djs-hit-click-stroke"),h=E("djs-hit djs-hit-all"),v=E("djs-hit djs-hit-no-move"),b={all:h,"click-stroke":_,stroke:y,"no-move":v};function E(P,k){return k=Z({stroke:"white",strokeWidth:15},k||{}),n.cls(P,["no-fill","no-border"],k)}function M(P,k){var N=b[k];if(!N)throw new Error("invalid hit type <"+k+">");return De(P,N),P}function B(P,k){ot(P,k)}this.removeHits=function(P){var k=Ms(".djs-hit",P);U(k,pn)},this.createDefaultHit=function(P,k){var N=P.waypoints,G=P.isFrame,q;return N?this.createWaypointsHit(k,N):(q=G?"stroke":"all",this.createBoxHit(k,q,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,k){var N=Ps(k);return M(N,"stroke"),B(P,N),N},this.createBoxHit=function(P,k,N){N=Z({x:0,y:0},N);var G=He("rect");return M(G,k),De(G,N),B(P,G),G},this.updateDefaultHit=function(P,k){var N=Ct(".djs-hit",k);if(N)return P.waypoints?of(N,P.waypoints):De(N,{width:P.width,height:P.height}),N},this.fire=o,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=d,this.unregisterEvent=f}kw.$inject=["eventBus","elementRegistry","styles"];const lu={__init__:["interactionEvents"],interactionEvents:["type",kw]};function Fa(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)})}Fa.$inject=["eventBus","canvas"],Fa.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()})}},Fa.prototype.get=function(){return Array.from(this._selectedElements)},Fa.prototype.isSelected=function(e){return this._selectedElements.has(e)},Fa.prototype.select=function(e,t){var n=this.get();Qe(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?U(e,r=>{this._selectedElements.add(r)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ow="hover",Dw="selected";function Lw(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,Ow)}),t.on("element.out",function(o){i(o.element,Ow)}),t.on("selection.changed",function(o){function r(l){i(l,Dw)}function a(l){n(l,Dw)}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)})}Lw.$inject=["canvas","eventBus"];function Iw(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;Qe(l)?t.select(l):t.select(s.filter(eL))}}),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=$t(r,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(o){if(cr(o)){var r=o.element;r===n.getRootElement()&&(r=null);var a=t.isSelected(r),s=t.get().length>1,c=nu(o);if(a&&s)return c?t.deselect(r):t.select(r);a?t.deselect(r):t.select(r,c)}})}Iw.$inject=["eventBus","selection","canvas","elementRegistry"];function eL(e){return!e.hidden}const Pi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[lu],selection:["type",Fa],selectionVisuals:["type",Lw],selectionBehavior:["type",Iw]};var tL=/^djs-cursor-.*$/;function uu(e){var t=Pt(document.body);t.removeMatching(tL),e&&t.add("djs-cursor-"+e)}function Bw(){uu(null)}var nL=5e3;function Nw(e,t){t=t||"element.click";function n(){return!1}return e.once(t,nL,n),function(){e.off(t,n)}}var iL=["c","C"],oL=["v","V"],rL=["d","D"],aL=["x","X"],sL=["y","Y"],$w=["z","Z"];function cL(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function di(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function _n(e,t){return e=Qe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function xh(e){return e.shiftKey}function lL(e){return di(e)&&_n(iL,e)}function uL(e){return di(e)&&_n(oL,e)}function pL(e){return di(e)&&_n(rL,e)}function dL(e){return di(e)&&_n(aL,e)}function fL(e){return di(e)&&!xh(e)&&_n($w,e)}function hL(e){return di(e)&&(_n(sL,e)||_n($w,e)&&xh(e))}var ja=Math.round,Fw="djs-drag-active";function Kr(e){e.preventDefault()}function gL(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function mL(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jw(e,t,n,i){var o={threshold:5,trapClick:!0},r;function a(v){var b=t.viewbox(),E=t._container.getBoundingClientRect();return{x:b.x+(v.x-E.left)/b.scale,y:b.y+(v.y-E.top)/b.scale}}function s(v,b){b=b||r;var E=e.createEvent(Z({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+v,E)===!1?!1:e.fire(b.prefix+"."+v,E)}function c(v){var b=v.filter(function(E){return i.get(E.id)});b.length&&n.select(b)}function l(v,b){var E=r.payload,M=r.displacement,B=r.globalStart,P=qr(v),k=Wi(P,B),N=r.localStart,G=a(P),q=Wi(G,N);if(!r.active&&(b||mL(k)>r.threshold)){if(Z(E,{x:ja(N.x+M.x),y:ja(N.y+M.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return y();r.active=!0,r.keepSelection||(E.previousSelection=n.get(),n.select(null)),r.cursor&&uu(r.cursor),t.addMarker(t.getRootElement(),Fw)}Jf(v),r.active&&(Z(E,{x:ja(G.x+M.x),y:ja(G.y+M.y),dx:ja(q.x),dy:ja(q.y)},{originalEvent:v}),s("move"))}function u(v){var b,E=!0;r.active&&(v&&(r.payload.originalEvent=v,Jf(v)),E=s("end")),E===!1&&s("rejected"),b=_(E!==!0),s("ended",b)}function p(v){_n("Escape",v)&&(Kr(v),y())}function d(v){var b;r.active&&(b=Nw(e),setTimeout(b,400),Kr(v)),u(v)}function f(v){l(v)}function m(v){var b=r.payload;b.hoverGfx=v.gfx,b.hover=v.element,s("hover")}function g(v){s("out");var b=r.payload;b.hoverGfx=null,b.hover=null}function y(v){var b;if(r){var E=r.active;E&&s("cancel"),b=_(v),E&&s("canceled",b)}}function _(v){var b,E;s("cleanup"),Bw(),r.trapClick?E=d:E=u,Ye.unbind(document,"mousemove",l),Ye.unbind(document,"dragstart",Kr),Ye.unbind(document,"selectstart",Kr),Ye.unbind(document,"mousedown",E,!0),Ye.unbind(document,"mouseup",E,!0),Ye.unbind(document,"keyup",p),Ye.unbind(document,"touchstart",f,!0),Ye.unbind(document,"touchcancel",y,!0),Ye.unbind(document,"touchmove",l,!0),Ye.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",g),t.removeMarker(t.getRootElement(),Fw);var M=r.payload.previousSelection;return v!==!1&&M&&!n.get().length&&c(M),b=r,r=null,b}function h(v,b,E,M){r&&y(!1),typeof b=="string"&&(M=E,E=b,b=null),M=Z({},o,M||{});var B=M.data||{},P,k,N,G,q;if(M.trapClick?G=d:G=u,v?(P=Na(v)||v,k=qr(v),Jf(v),P.type==="dragstart"&&Kr(P)):(P=null,k={x:0,y:0}),N=a(k),b||(b=N),q=gL(P),r=Z({prefix:E,data:B,payload:{},globalStart:k,displacement:Wi(b,N),localStart:N,isTouch:q},M),M.manual||(q?(Ye.bind(document,"touchstart",f,!0),Ye.bind(document,"touchcancel",y,!0),Ye.bind(document,"touchmove",l,!0),Ye.bind(document,"touchend",u,!0)):(Ye.bind(document,"mousemove",l),Ye.bind(document,"dragstart",Kr),Ye.bind(document,"selectstart",Kr),Ye.bind(document,"mousedown",G,!0),Ye.bind(document,"mouseup",G,!0)),Ye.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",g)),s("init")===!1)return y(),!1;M.autoActivate&&l(v,!0)}e.on("diagram.destroy",y),this.init=h,this.move=l,this.hover=m,this.out=g,this.end=u,this.cancel=y,this.context=function(){return r},this.setOptions=function(v){Z(o,v)}}jw.$inject=["eventBus","canvas","selection","elementRegistry"];const Po={__depends__:[JD,Pi],dragging:["type",jw]};function Xr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Xr.prototype.next=function(){return this._prefix+ ++this._counter};const yL=new Xr("ps");var vL=["marker-start","marker-mid","marker-end"],xL=["circle","ellipse","line","path","polygon","polyline","path","rect"];function lr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}lr.$inject=["elementRegistry","eventBus","canvas","styles"],lr.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")},lr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},lr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var o=Kd(n);return this._cloneMarkers(nr(o),i),De(o,this._styles.cls(i,[])),ot(t,o),De(o,"data-preview-support-element-id",e.id),o},lr.prototype.addFrame=function(e,t){var n=He("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ot(t,n),De(n,"data-preview-support-element-id",e.id),n},lr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(o=>{i._cloneMarkers(o,t,n)}),EL(e)&&vL.forEach(function(o){if(De(e,o)){var r=bL(e,o,i._canvas.getContainer());r&&i._cloneMarker(n,e,r,o,t)}})},lr.prototype._cloneMarker=function(e,t,n,i,o="djs-dragger"){var r=[n.id,o,yL.next()].join("-"),a=Ct("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Kd(n);s.id=r,mt(s).add(o);var c=Ct(":scope > defs",e);c||(c=He("defs"),ot(e,c)),ot(c,s);var l=_L(s.id);De(t,i,l)};function bL(e,t,n){var i=wL(De(e,t));return Ct("marker#"+i,n||document)}function wL(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function _L(e){return"url(#"+e+")"}function EL(e){return xL.indexOf(e.nodeName)!==-1}const Ha={__init__:["previewSupport"],previewSupport:["type",lr]};var SL="drop-ok",Hw="drop-not-ok",zw="attach-ok",Gw="new-parent",Vw="create",RL=2e3;function Ww(e,t,n,i,o){function r(c,l,u,p,d){if(!l)return!1;c=ft(c,function(h){var v=h.labelTarget;return!h.parent&&!(ut(h)&&c.indexOf(v)!==-1)});var f=$t(c,function(h){return!Lt(h)}),m=!1,g=!1,y=!1;qw(c)&&(m=o.allowed("shape.attach",{position:u,shape:f,target:l})),m||(qw(c)?y=o.allowed("shape.create",{position:u,shape:f,source:p,target:l}):y=o.allowed("elements.create",{elements:c,position:u,target:l}));var _=d.connectionTarget;return y||m?(f&&p&&(g=o.allowed("connection.create",{source:_===p?f:p,target:_===p?p:f,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:g}):y===null||m===null?null:!1}function a(c,l){[zw,SL,Hw,Gw].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,p=c.hover,d=l.source,f=l.hints||{};if(!p){l.canExecute=!1,l.target=null;return}Uw(c);var m={x:c.x,y:c.y},g=l.canExecute=p&&r(u,p,m,d,f);p&&g!==null&&(l.target=p,g&&g.attach?a(p,zw):a(p,g?Gw:Hw))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,p=l.shape,d=l.elements,f=l.target,m=l.canExecute,g=m&&m.attach,y=m&&m.connect,_=l.hints||{};if(m===!1||!f)return!1;Uw(c);var h={x:c.x,y:c.y};y?p=i.appendShape(u,p,h,f,{attach:g,connection:y===!0?{}:y,connectionTarget:_.connectionTarget}):(d=i.createElements(d,h,f,Z({},_,{attach:g})),p=$t(d,function(v){return!Lt(v)})),Z(l,{elements:d,shape:p}),Z(c,{elements:d,shape:p})});function s(){var c=t.context();c&&c.prefix===Vw&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],RL,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Qe(l)||(l=[l]);var p=$t(l,function(m){return!Lt(m)});if(p){u=Z({elements:l,hints:{},shape:p},u||{}),U(l,function(m){et(m.x)||(m.x=0),et(m.y)||(m.y=0)});var d=ft(l,function(m){return!m.hidden}),f=dn(d);U(l,function(m){Lt(m)&&(m.waypoints=zn(m.waypoints,function(g){return{x:g.x-f.x-f.width/2,y:g.y-f.y-f.height/2}})),Z(m,{x:m.x-f.x-f.width/2,y:m.y-f.y-f.height/2})}),t.init(c,Vw,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:l,context:u}})}}}Ww.$inject=["canvas","dragging","eventBus","modeling","rules"];function Uw(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 qw(e){return e&&e.length===1&&!Lt(e[0])}var ML=750;function Yw(e,t,n,i,o){function r(a){var s=He("g");De(s,o.cls("djs-drag-group",["no-events"]));var c=He("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(nr(u),l)):(u=n._createContainer("shape",c),n.drawShape(nr(u),l),$n(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",ML,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(),ot(p,u)),$n(u,a.x,a.y)):pn(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&pn(c)})}Yw.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const pu={__depends__:[Po,Ha,co,Pi],__init__:["create","createPreview"],create:["type",Ww],createPreview:["type",Yw]};function bh(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)})}bh.$inject=["eventBus"],bh.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||CL(0,0)};function CL(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 Xs={__init__:["mouse"],mouse:["type",bh]};var Kw=2e3;function fi(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),AL(u)&&(l.priority=2,l.host=u.host.id),Lt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=TL(u)),ut(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),U(["x","y","width","height"],function(d){et(u[d])&&(l[d]=u[d])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),o.on("copyPaste.elementsCopied",Kw,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),o.on("copyPaste.pasteElements",Kw,function(c){c.tree||(c.tree=n.get())}),o.on("copyPaste.pasteElements",function(c){var l=c.hints;Z(l,{createElementsBehavior:!1})})}fi.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],fi.prototype.copy=function(e,t={}){var n,i;return Qe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Qe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},fi.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})}}},fi.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},fi.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},fi.prototype._getElementIdsFromTree=function(e){var t={};return U(e,function(n){U(n,function(i){i.id&&(t[i.id]=!0)})}),t},fi.prototype._paste=function(e,t,n,i){U(e,function(r){et(r.x)||(r.x=0),et(r.y)||(r.y=0)});var o=dn(e);return U(e,function(r){Lt(r)&&(r.waypoints=zn(r.waypoints,function(a){return{x:a.x-o.x-o.width/2,y:a.y-o.y-o.height/2}})),Z(r,{x:r.x-o.x-o.width/2,y:r.y-o.y-o.height/2})}),this._modeling.createElements(e,n,t,Z({},i))},fi.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},o=[];return U(e,function(r,a){r=Xi(r,"priority"),U(r,function(s){var c=Z({},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(Lt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),o.push(l);return}if(ut(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},fi.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Zi(e,["id"]));return t},fi.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Zi(e,["id"]));return t},fi.prototype.createShape=function(e){var t=this._elementFactory.createShape(Zi(e,["id"]));return t},fi.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Lt(e)&&(!n.has(e.source)||!n.has(e.target))||ut(e)&&!n.has(e.labelTarget))},fi.prototype.createTree=function(e){var t=this._rules,n=this,i={},o=[],r=new Map,a=El(e);function s(p,d){return t.allowed("element.copy",{element:p,elements:d})}function c(p,d){var f=r.get(p);if(!f){var m={element:p,depth:d};o.push(m),r.set(p,m);return}if(f.depth<d){o=l(f,o);var g={element:f.element,depth:d};o.push(g),r.set(p,g)}}function l(p,d){var f=d.indexOf(p);return f!==-1&&d.splice(f,1),d}Gr(a,function(p,d,f){if(ut(p))return;U(p.labels,function(y){c(y,f)});function m(y){y&&y.length&&U(y,function(_){U(_.labels,function(h){c(h,f)}),c(_,f)})}U([p.attachers,p.incoming,p.outgoing],m),c(p,f);var g=[];return p.children&&(g=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:g}),g}),e=zn(o,function(p){return p.element});var u=new Set(e);return o=zn(o,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:u}),p}),o=Xi(o,function(p){return p.descriptor.priority}),e=zn(o,function(p){return p.element}),U(o,function(p){var d=p.depth;if(!n.hasRelations(p.element,e,u)){Zw(p.element,e),u.delete(p.element);return}if(!s(p.element,e)){Zw(p.element,e),u.delete(p.element);return}i[d]||(i[d]=[]),i[d].push(p.descriptor)}),i};function AL(e){return!!e.host}function TL(e){return zn(e.waypoints,function(t){return t=Xw(t),t.original&&(t.original=Xw(t.original)),t})}function Xw(e){return Z({},e)}function Zw(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const PL={__depends__:[XD,pu,Xs,co],__init__:["copyPaste"],copyPaste:["type",fi]};function wh(e,t,n){Qe(n)||(n=[n]),U(n,function(i){kr(e[i])||(t[i]=e[i])})}var _h=750;function Jw(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",_h,function(c){var l=c.descriptor,u=c.element,p=Ee(u);if(ut(u))return l;var d=l.businessObject=i(p,!0),f=l.di=i(xt(u),!0);f.bpmnElement=d,wh(d,l,"name"),wh(f,l,"isExpanded"),p.default&&(l.default=p.default.id)});var o="-bpmn-js-refs";function r(c){return c[o]=c[o]||{}}function a(c,l){c[o]=l}function s(c,l,u){var p=Ee(c);return c.default&&(u[c.default]={element:p,property:"default"}),c.host&&(Ee(c).attachedToRef=Ee(l[c.host])),Zi(u,si(u,function(d,f,m){var g=f.element,y=f.property;return m===c.id&&(g.set(y,p),d.push(c.id)),d},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,p=u.businessObject,d=u.di;if(ut(u)){u.businessObject=Ee(l[u.labelTarget]),u.di=xt(l[u.labelTarget]);return}p=u.businessObject=i(p),d=u.di=i(d),d.bpmnElement=p,wh(u,p,["isExpanded","name"]),u.type=p.$type}),t.on("copyPaste.copyElement",_h,function(c){var l=c.descriptor,u=c.element;if(A(u,"bpmn:Participant")){var p=Ee(u);p.processRef&&(l.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;A(l,"bpmn:SubProcess")&&U(Ns(u),p=>{u.push(p.annotation)})}),t.on("copyPaste.pasteElement",_h,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,r(l)))})}Jw.$inject=["bpmnFactory","eventBus","moddleCopy"];const kL=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],OL=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Zs(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 Xi(o,r=>r==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:o,property:r,propertyName:a}=i,s=bn(o)&&o.$descriptor;if(a&&OL.includes(a))return r;if(a&&kL.includes(a)||a&&s&&!$t(s.properties,ma({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:o}=i;if(A(o,"bpmn:ExtensionElements")&&(!o.values||!o.values.length))return!1})}Zs.$inject=["eventBus","bpmnFactory","moddle"],Zs.prototype.copyElement=function(e,t,n,i=!1){n&&!Qe(n)&&(n=[n]),n=n||Eh(e.$descriptor);const o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return o===!1||(Qe(o)&&(n=o),U(n,r=>{let a;ai(e,r)&&(a=e.get(r));const s=this.copyProperty(a,t,r,i);!xn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:r})===!1||t.set(r,s)})),t},Zs.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 bn(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):Qe(e)?si(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):bn(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},Zs.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 Eh(e,t){return si(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Qw={__depends__:[PL],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Jw],moddleCopy:["type",Zs]};var e_=Math.round;function Sh(e,t){this._modeling=e,this._eventBus=t}Sh.$inject=["modeling","eventBus"],Sh.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=e_(s+r/2),u=e_(c+a/2),p=i.replaceShape(e,Z({},t,{x:l,y:u,width:r,height:a}),n);return o.fire("replace.end",{element:e,newElement:p,hints:n}),p};function t_(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:o={}}=n;o.select!==!1&&e.select(i)})}t_.$inject=["selection","eventBus"];const DL={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",t_],replace:["type",Sh]};function LL(e,t,n){Qe(n)||(n=[n]),U(n,function(i){kr(e[i])||(t[i]=e[i])})}var IL=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function BL(e,t){var n=e&&ai(e,"collapsed")?e.collapsed:!yt(e),i;return t&&(ai(t,"collapsed")||ai(t,"isExpanded"))?i=ai(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function n_(e,t,n,i,o,r){function a(s,c,l){l=l||{};var u=c.type,p=s.businessObject;if(du(p)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&BL(s,c))return i.toggleCollapse(s),s;var d=e.create(u),f={type:u,businessObject:d};f.di={},u==="bpmn:ExclusiveGateway"&&(f.di.isMarkerVisible=!0),LL(s.di,f.di,["fill","stroke","background-color","border-color","color"]);var m=Eh(p.$descriptor),g=Eh(d.$descriptor,!0),y=NL(m,g);Z(d,ji(c,IL));var _=ft(y,function(b){return b==="eventDefinitions"?i_(s,c.eventDefinitionType):b==="loopCharacteristics"?!Un(d):ai(d,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Un(d):!0});if(d=n.copyElement(p,d,_),c.eventDefinitionType&&(i_(d,c.eventDefinitionType)||(f.eventDefinitionType=c.eventDefinitionType,f.eventDefinitionAttrs=c.eventDefinitionAttrs)),A(p,"bpmn:Activity")){if(du(p))f.isExpanded=yt(s);else if(c&&ai(c,"isExpanded")){f.isExpanded=c.isExpanded;var h=t.getDefaultSize(d,{isExpanded:f.isExpanded});f.width=h.width,f.height=h.height,f.x=s.x-(f.width-s.width)/2,f.y=s.y-(f.height-s.height)/2}yt(s)&&!A(p,"bpmn:Task")&&f.isExpanded&&(f.width=s.width,f.height=s.height)}if(du(p)&&!du(d)&&(l.moveChildren=!1),A(p,"bpmn:Participant")){c.isExpanded===!0?d.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var v=Rn(s);xt(s).isHorizontal||(xt(f).isHorizontal=v),f.width=v?s.width:t.getDefaultSize(f).width,f.height=v?t.getDefaultSize(f).height:s.height}return r.allowed("shape.resize",{shape:d})||(f.height=t.getDefaultSize(f).height,f.width=t.getDefaultSize(f).width),d.name=p.name,dt(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&dt(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),c.host&&!A(p,"bpmn:BoundaryEvent")&&A(d,"bpmn:BoundaryEvent")&&(f.host=c.host),(f.type==="bpmn:DataStoreReference"||f.type==="bpmn:DataObjectReference")&&(f.x=s.x+(s.width-f.width)/2),o.replaceElement(s,f,{...l,targetElement:c})}this.replaceElement=a}n_.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function du(e){return A(e,"bpmn:SubProcess")}function i_(e,t){var n=Ee(e);return t&&n.get("eventDefinitions").some(function(i){return A(i,t)})}function NL(e,t){return e.filter(function(n){return t.includes(n)})}const o_={__depends__:[Qw,DL,Pi],bpmnReplace:["type",n_]};var $L=250;function Zr(e){this._eventBus=e,this._tools=[],this._active=null}Zr.$inject=["eventBus"],Zr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Zr.prototype.isActive=function(e){return e&&this._active===e},Zr.prototype.length=function(e){return this._tools.length},Zr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Zr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(o){var r=o.context;if(!r.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),U(t,function(o){i.push(o+".ended"),i.push(o+".canceled")}),n.on(i,$L,function(o){this._active&&(FL(o)||this.setActive(null))},this)};function FL(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Hr(t,'.group[data-group="tools"]')}const fu={__depends__:[Po],__init__:["toolManager"],toolManager:["type",Zr]};function jL(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 HL(e,t){var n=[],i=new Set(e);U(t,function(r){i.add(r)});var o=new Set;return i.forEach(function(r){var a=r.incoming,s=r.outgoing;U(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 zL(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 Rh=Math.abs,GL=Math.round,ko={x:"width",y:"height"},r_="crosshair",ur={n:"top",w:"left",s:"bottom",e:"right"},VL=1500,hu={n:"s",w:"e",s:"n",e:"w"},gu=20;function ki(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",VL,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&s_(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,p=l.direction,d=l.movingShapes,f=l.resizingShapes,m=l.start;if(l.initialized){s_(c);var g={x:0,y:0};g[u]=GL(c["d"+u]),s.makeSpace(d,f,g,p,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}ki.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ki.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:r_,data:{context:{reactivate:n}},trapClick:!1})},ki.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:r_,data:{context:{}}})},ki.prototype.makeSpace=function(e,t,n,i,o){return this._modeling.createSpace(e,t,n,i,o)},ki.prototype.init=function(e,t){var n=Rh(e.dx)>Rh(e.dy)?"x":"y",i=e["d"+n],o=e[n]-i;if(Rh(i)<5)return!1;i<0&&(i*=-1),qs(e)&&(i*=-1);var r=jL(n,i),a=this._canvas.getRootElement();!nu(e)&&e.hover&&(a=e.hover);var s=[...ks(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=WL(c,n,r,o,l);return Z(t,c,{axis:n,direction:r,spaceToolConstraints:u,start:o}),uu("resize-"+(n==="x"?"ew":"ns")),!0},ki.prototype.calculateAdjustments=function(e,t,n,i){var o=this._rules,r=[],a=[],s=new Set,c=new Set,l=[],u=[];function p(f){s.has(f)||(s.add(f),r.push(f));var m=f.label;m&&!s.has(m)&&(s.add(m),r.push(m))}function d(f){c.has(f)||(c.add(f),a.push(f))}return U(e,function(f){if(!(!f.parent||ut(f))){if(Lt(f)){u.push(f);return}var m=f[t],g=m+f[ko[t]];if(UL(f)&&(n>0&&tt(f)[t]>i||n<0&&tt(f)[t]<i)){l.push(f);return}if(n>0&&m>i||n<0&&g<i){p(f);return}if(m<i&&g>i&&o.allowed("shape.resize",{shape:f})){d(f);return}}}),U(r,function(f){var m=f.attachers;m&&U(m,function(g){p(g)})}),U(l,function(f){var m=f.host;(s.has(m)||c.has(m))&&p(f)}),U(u,function(f){var m=f.source,g=f.target,y=f.label;(s.has(m)||c.has(m))&&(s.has(g)||c.has(g))&&y&&p(y)}),{movingShapes:r,resizingShapes:a}},ki.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ki.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function a_(e){return{top:e.top-gu,right:e.right+gu,bottom:e.bottom+gu,left:e.left-gu}}function s_(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,o;et(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),et(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),et(n.top)&&(o=Math.max(e.y,n.top),e.dy=e.dy+o-e.y,e.y=o),et(n.bottom)&&(o=Math.min(e.y,n.bottom),e.dy=e.dy+o-e.y,e.y=o)}}function WL(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 U(a,function(d){var f=d.attachers,m=d.children,g=Ze(d),y=ft(m,function(q){return!Lt(q)&&!ut(q)&&!u.has(q)&&!p.has(q)}),_=ft(m,function(q){return!Lt(q)&&!ut(q)&&u.has(q)}),h,v,b,E=[],M=[],B,P,k,N;y.length&&(v=a_(Ze(dn(y))),h=i-g[ur[n]]+v[ur[n]],n==="n"?s.bottom=l=et(l)?Math.min(l,h):h:n==="w"?s.right=l=et(l)?Math.min(l,h):h:n==="s"?s.top=c=et(c)?Math.max(c,h):h:n==="e"&&(s.left=c=et(c)?Math.max(c,h):h)),_.length&&(b=a_(Ze(dn(_))),h=i-b[ur[hu[n]]]+g[ur[hu[n]]],n==="n"?s.bottom=l=et(l)?Math.min(l,h):h:n==="w"?s.right=l=et(l)?Math.min(l,h):h:n==="s"?s.top=c=et(c)?Math.max(c,h):h:n==="e"&&(s.left=c=et(c)?Math.max(c,h):h)),f&&f.length&&(f.forEach(function(q){u.has(q)?E.push(q):M.push(q)}),E.length&&(B=Ze(dn(E.map(tt))),P=g[ur[hu[n]]]-(B[ur[hu[n]]]-i)),M.length&&(k=Ze(dn(M.map(tt))),N=k[ur[n]]-(g[ur[n]]-i)),n==="n"?(h=Math.min(P||1/0,N||1/0),s.bottom=l=et(l)?Math.min(l,h):h):n==="w"?(h=Math.min(P||1/0,N||1/0),s.right=l=et(l)?Math.min(l,h):h):n==="s"?(h=Math.max(P||-1/0,N||-1/0),s.top=c=et(c)?Math.max(c,h):h):n==="e"&&(h=Math.max(P||-1/0,N||-1/0),s.left=c=et(c)?Math.max(c,h):h));var G=o&&o[d.id];G&&(n==="n"?(h=i+d[ko[t]]-G[ko[t]],s.bottom=l=et(l)?Math.min(l,h):h):n==="w"?(h=i+d[ko[t]]-G[ko[t]],s.right=l=et(l)?Math.min(l,h):h):n==="s"?(h=i-d[ko[t]]+G[ko[t]],s.top=c=et(c)?Math.max(c,h):h):n==="e"&&(h=i-d[ko[t]]+G[ko[t]],s.left=c=et(c)?Math.max(c,h):h))}),s}}function UL(e){return!!e.host}var Mh="djs-dragging",c_="djs-resizing",qL=250,mu=Math.max;function l_(e,t,n,i,o){function r(a,s){U(a,function(c){o.addDragger(c,s),n.addMarker(c,Mh)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=He("g");De(u,i.cls("djs-crosshair-group",["no-events"])),ot(s,u);var p=He("path");De(p,"d",l.x),mt(p).add("djs-crosshair"),ot(u,p);var d=He("path");De(d,"d",l.y),mt(d).add("djs-crosshair"),ot(u,d),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;$n(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&pn(c)}),e.on("spaceTool.move",qL,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var d=n.getLayer("space");c=He("path"),De(c,"d","M0,0 L0,0"),mt(c).add("djs-crosshair"),ot(d,c),s.line=c;var f=He("g");De(f,i.cls("djs-drag-group",["no-events"])),ot(n.getActiveLayer(),f),r(u,f);var m=new Set(u);U(p,function(M){m.add(M)});var g=new Set,y=s.movingConnections=[];m.forEach(function(M){U(M.outgoing,function(B){g.has(B)||!Lt(B)||!m.has(B.target)||(g.add(B),y.push(B))})}),r(y,f),s.dragGroup=f}if(!s.frameGroup){var _=He("g");De(_,i.cls("djs-frame-group",["no-events"])),ot(n.getActiveLayer(),_);var h=[];U(p,function(M){var B=o.addFrame(M,_),P=B.getBBox();h.push({element:B,initialBounds:P}),n.addMarker(M,c_)}),s.frameGroup=_,s.frames=h}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};De(c,{d:v[l]});var b={x:"y",y:"x"},E={x:a.dx,y:a.dy};E[b[s.axis]]=0,$n(s.dragGroup,E.x,E.y),U(s.frames,function(M){var B=M.element,P=M.initialBounds,k,N;s.direction==="e"?De(B,{width:mu(P.width+E.x,5)}):(k=mu(P.width-E.x,5),De(B,{width:k,x:P.x+P.width-k})),s.direction==="s"?De(B,{height:mu(P.height+E.y,5)}):(N=mu(P.height-E.y,5),De(B,{height:N,y:P.y+P.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,p=s.line,d=s.dragGroup,f=s.frameGroup;U(c,function(m){n.removeMarker(m,Mh)}),U(l,function(m){n.removeMarker(m,Mh)}),d&&(pn(p),pn(d)),U(u,function(m){n.removeMarker(m,c_)}),f&&pn(f)})}l_.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const YL={__init__:["spaceToolPreview"],__depends__:[Po,co,fu,Ha,Xs],spaceTool:["type",ki],spaceToolPreview:["type",l_]};function yu(e,t){e.invoke(ki,this),this._canvas=t}yu.$inject=["injector","canvas"],Ne(yu,ki),yu.prototype.calculateAdjustments=function(e,t,n,i){var o=this._canvas.getRootElement(),r=e[0]===o?null:e[0],a=[];r&&(a=ha(Ra(o.children.filter(l=>A(l,"bpmn:Artifact")),dn(r))));const s=[...e,...a];var c=ki.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(A(l,"bpmn:TextAnnotation")||KL(l)&&(t==="y"&&Rn(l)||t==="x"&&!Rn(l)))}),c};function KL(e){return A(e,"bpmn:Participant")&&!Ee(e).processRef}const u_={__depends__:[YL],spaceTool:["type",yu]};function Zt(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)}Zt.$inject=["eventBus","injector"],Zt.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()},Zt.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},Zt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Zt.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()}},Zt.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()}},Zt.prototype.register=function(e,t){this._setHandler(e,t)},Zt.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)},Zt.prototype.canUndo=function(){return!!this._getUndoAction()},Zt.prototype.canRedo=function(){return!!this._getRedoAction()},Zt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Zt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Zt.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)})},Zt.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},Zt.prototype._createId=function(){return this._uid++},Zt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Zt.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()},Zt.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)},Zt.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:_m("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Zt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Qe(e)?e:[e],t.dirty=t.dirty.concat(e))},Zt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Zt.prototype._revertedAction=function(e){this._stackIdx--},Zt.prototype._getHandler=function(e){return this._handlerMap[e]},Zt.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 XL={commandStack:["type",Zt]};function pr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var ZL=250,p_=1400;function Ch(e,t,n){_e.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",p_,function(o){var r=o.context,a=r.shapes,s=r.validatedShapes;r.shapes=d_(a),r.validatedShapes=d_(s)}),i&&t.on("shape.move.start",ZL,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",p_,function(o){var r=o.context,a=r.closure,s=a.enclosedElements,c=[];U(s,function(l){U(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;pr(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=af(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&&(sn(s.labels,a,c),a.labelTarget=s)})}Ne(Ch,_e),Ch.$inject=["injector","eventBus","modeling"];function d_(e){var t=new Set(e);return ft(e,function(n){return!t.has(n.labelTarget)})}const JL={__init__:["labelSupport"],labelSupport:["type",Ch]};var QL=251,f_=1401,h_="attach-ok";function Ah(e,t,n,i,o){_e.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",f_,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=eI(c),s.validatedShapes=tI(l)}),r&&t.on("shape.move.start",QL,function(a){var s=a.context,c=s.shapes,l=Th(c);U(l,function(u){r.makeDraggable(s,u,!0),U(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,h_),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,h_)}))}}),this.preExecuted("elements.move",f_,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Th(l);U(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=ft(c,function(p){var d=p.host;return nI(p)&&!iI(c,d)}),U(u,function(p){o.updateAttachment(p,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;U(s,function(c){U(c.attachers,function(l){U(l.outgoing.slice(),function(u){var p=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});p||o.removeConnection(u)}),U(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;pr(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&&U(l.attachers,function(u){var p=Ob(u,c,l);o.moveShape(u,p,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,p=c.attachers,d=s.hints||{};d.attachSupport!==!1&&U(p,function(f){var m=Ob(f,l,u);o.moveShape(f,m,f.parent),U(f.labels,function(g){o.moveShape(g,m,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){o.removeShape(c)}),s.host&&o.updateAttachment(s,null)})}Ne(Ah,_e),Ah.$inject=["injector","eventBus","canvas","rules","modeling"];function Th(e){return zp(zn(e,function(t){return t.attachers||[]}))}function eI(e){var t=Th(e);return DR("id",e,t)}function tI(e){var t=ga(e,"id");return ft(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function nI(e){return!!e.host}function iI(e,t){return e.indexOf(t)!==-1}const oI={__depends__:[co],__init__:["attachSupport"],attachSupport:["type",Ah]};function g_(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(rx(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)})}g_.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Ph={__init__:["changeSupport"],changeSupport:["type",g_]};function Oi(e){this._model=e}Oi.$inject=["moddle"],Oi.prototype._needsId=function(e){return dt(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"])},Oi.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;A(e,"bpmn:Activity")?t="Activity":A(e,"bpmn:Event")?t="Event":A(e,"bpmn:Gateway")?t="Gateway":dt(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))},Oi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Oi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Oi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",Z({bpmnElement:e,bounds:this.createDiBounds()},t))},Oi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Oi.prototype.createDiWaypoints=function(e){var t=this;return zn(e,function(n){return t.createDiWaypoint(n)})},Oi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ji(e,["x","y"]))},Oi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",Z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Oi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",Z({bpmnElement:e},t))};function hi(e,t,n){_e.call(this,e),this._bpmnFactory=t;var i=this;function o(f){var m=f.context,g=m.hints||{},y;!m.cropped&&g.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),m.cropped=!0)}this.executed(["connection.layout","connection.create"],o),this.reverted(["connection.layout"],function(f){delete f.context.cropped});function r(f){var m=f.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(f){var m=f.context,g=m.shape||m.connection,y=m.parent||m.newParent;i.updateParent(g,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],gi(r)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],gi(a));function s(f){var m=f.context,g=m.oldRoot,y=g.children;U(y,function(_){A(_,"bpmn:BaseElement")&&i.updateParent(_)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(f){var m=f.context.shape;A(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],gi(function(f){f.context.shape.type!=="label"&&c(f)})),this.reverted(["shape.move","shape.create","shape.resize"],gi(function(f){f.context.shape.type!=="label"&&c(f)})),e.on("shape.changed",function(f){f.element.type==="label"&&c({context:{shape:f.element}})});function l(f){i.updateConnection(f.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],gi(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],gi(l));function u(f){i.updateConnectionWaypoints(f.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],gi(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],gi(u)),this.executed("connection.reconnect",gi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=Ee(g),v=Ee(y),b=Ee(_);h.conditionExpression&&!dt(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=h.conditionExpression,delete h.conditionExpression),y!==_&&v.default===h&&(m.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",gi(function(f){var m=f.context,g=m.connection,y=m.oldSource,_=m.newSource,h=Ee(g),v=Ee(y),b=Ee(_);m.oldConditionExpression&&(h.conditionExpression=m.oldConditionExpression),m.oldDefault&&(v.default=m.oldDefault,delete b.default)}));function p(f){i.updateAttachment(f.context)}this.executed(["element.updateAttachment"],gi(p)),this.reverted(["element.updateAttachment"],gi(p)),this.executed("element.updateLabel",gi(d)),this.reverted("element.updateLabel",gi(d));function d(f){const{element:m}=f.context,g=ui(m),y=xt(m),_=y&&y.get("label");or(m)||iu(m)||(g&&!_?y.set("label",t.create("bpmndi:BPMNLabel")):!g&&_&&y.set("label",void 0))}}Ne(hi,_e),hi.$inject=["eventBus","bpmnFactory","connectionDocking"],hi.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},hi.prototype.updateParent=function(e,t){if(!ut(e)&&!(A(e,"bpmn:DataStoreReference")&&e.parent&&A(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,o=xt(e),r=n&&n.businessObject,a=xt(n);A(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),A(e,"bpmn:DataOutputAssociation")&&(e.source?r=e.source.businessObject:r=null),A(e,"bpmn:DataInputAssociation")&&(e.target?r=e.target.businessObject:r=null),this.updateSemanticParent(i,r),A(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(o,a)}},hi.prototype.updateBounds=function(e){var t=xt(e),n=aI(e);if(n){var i=Wi(n,t.get("bounds"));Z(n,{x:e.x+i.x,y:e.y+i.y})}var o=ut(e)?this._getLabel(t):t,r=o.bounds;r||(r=this._bpmnFactory.createDiBounds(),o.set("bounds",r)),Z(r,{x:e.x,y:e.y,width:e.width,height:e.height})},hi.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,o;A(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),rn(i,e)),A(t,"bpmn:Lane")&&(o=t.get("flowNodeRef"),sn(o,e))}},hi.prototype.updateDiConnection=function(e,t,n){var i=xt(e),o=xt(t),r=xt(n);i.sourceElement&&i.sourceElement.bpmnElement!==Ee(t)&&(i.sourceElement=t&&o),i.targetElement&&i.targetElement.bpmnElement!==Ee(n)&&(i.targetElement=n&&r)},hi.prototype.updateDiParent=function(e,t){if(t&&!A(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(rn(n,e),e.$parent=null)}};function rI(e){for(;e&&!A(e,"bpmn:Definitions");)e=e.$parent;return e}hi.prototype.getLaneSet=function(e){var t,n;return A(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(A(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},hi.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((A(e,"bpmn:DataInput")||A(e,"bpmn:DataOutput"))&&(A(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(A(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(A(e,"bpmn:FlowElement")){if(t){if(A(t,"bpmn:Participant"))t=t.processRef;else if(A(t,"bpmn:Lane"))do t=t.$parent.$parent;while(A(t,"bpmn:Lane"))}i="flowElements"}else if(A(e,"bpmn:Artifact")){for(;t&&!A(t,"bpmn:Process")&&!A(t,"bpmn:SubProcess")&&!A(t,"bpmn:Collaboration");)if(A(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(A(e,"bpmn:MessageFlow"))i="messageFlows";else if(A(e,"bpmn:Participant")){i="participants";var o=e.processRef,r;o&&(r=rI(e.$parent||t),e.$parent&&(rn(r.get("rootElements"),o),o.$parent=null),t&&(sn(r.get("rootElements"),o),o.$parent=r))}else A(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":A(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),rn(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);rn(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},hi.prototype.updateConnectionWaypoints=function(e){var t=xt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},hi.prototype.updateConnection=function(e){var t=e.connection,n=Ee(t),i=t.source,o=Ee(i),r=t.target,a=Ee(t.target),s;if(A(n,"bpmn:DataAssociation"))A(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=o,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):A(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||o,this.updateSemanticParent(n,o,s),n.targetRef=a);else{var c=A(n,"bpmn:SequenceFlow");n.sourceRef!==o&&(c&&(rn(n.sourceRef&&n.sourceRef.get("outgoing"),n),o&&o.get("outgoing")&&o.get("outgoing").push(n)),n.sourceRef=o),n.targetRef!==a&&(c&&(rn(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)},hi.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function gi(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;A(i,"bpmn:BaseElement")&&e(t)}}function aI(e){if(A(e,"bpmn:Activity")){var t=xt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function dr(e,t){Mo.call(this),this._bpmnFactory=e,this._moddle=t}Ne(dr,Mo),dr.$inject=["bpmnFactory","moddle"],dr.prototype._baseCreate=Mo.prototype.create,dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,Z({type:"label",di:n},Wr,t))}return this.createElement(e,t)},dr.prototype.createElement=function(e,t){t=Z({},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(!cI(o)){var r=Z({},o||{},{id:i.id+"_di"});e==="root"?o=this._bpmnFactory.createDiPlane(i,r):e==="connection"?o=this._bpmnFactory.createDiEdge(i,r):o=this._bpmnFactory.createDiShape(i,r)}A(i,"bpmn:Group")&&(t=Z({isFrame:!0},t)),t=sI(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=kh(o,t,"isExpanded")),dt(i,["bpmn:Lane","bpmn:Participant"])&&(t=kh(o,t,"isHorizontal")),A(i,"bpmn:SubProcess")&&(t.collapsed=!yt(i,o)),A(i,"bpmn:ExclusiveGateway")&&(ai(o,"isMarkerVisible")?o.isMarkerVisible===void 0&&(o.isMarkerVisible=!1):o.isMarkerVisible=!0),xn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),xn(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=Z({id:i.id},n,t,{businessObject:i,di:o}),this._baseCreate(e,t)},dr.prototype.getDefaultSize=function(e,t){var n=Ee(e);if(t=t||xt(e),A(n,"bpmn:SubProcess"))return yt(n,t)?{width:350,height:200}:{width:100,height:80};if(A(n,"bpmn:Task"))return{width:100,height:80};if(A(n,"bpmn:Gateway"))return{width:50,height:50};if(A(n,"bpmn:Event"))return{width:36,height:36};if(A(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return yt(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return A(n,"bpmn:Lane")?{width:400,height:100}:A(n,"bpmn:DataObjectReference")?{width:36,height:50}:A(n,"bpmn:DataStoreReference")?{width:50,height:50}:A(n,"bpmn:TextAnnotation")?{width:100,height:40}:A(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dr.prototype.createParticipantShape=function(e){return bn(e)||(e={isExpanded:e}),e=Z({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function sI(e,t,n){return U(n,function(i){t=kh(e,t,i)}),t}function kh(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Zi(t,[n]))}function cI(e){return dt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function vu(e,t){this._modeling=e,this._canvas=t}vu.$inject=["modeling","canvas"],vu.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;U(n,function(o){var r={x:0,y:0};xn(i.left)?r.x=i.left-o.x:xn(i.right)?r.x=i.right-o.width-o.x:xn(i.center)?r.x=i.center-Math.round(o.width/2)-o.x:xn(i.top)?r.y=i.top-o.y:xn(i.bottom)?r.y=i.bottom-o.height-o.y:xn(i.middle)&&(r.y=i.middle-Math.round(o.height/2)-o.y),t.moveElements([o],r,o.parent)})},vu.prototype.postExecute=function(e){};function xu(e){this._modeling=e}xu.$inject=["modeling"],xu.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},xu.prototype.postExecute=function(e){var t=e.hints||{};lI(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 lI(e,t){return Go(e.outgoing,function(n){return n.target===t})}function bu(e,t){this._canvas=e,this._layouter=t}bu.$inject=["canvas","layouter"],bu.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},bu.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var wu=Math.round;function Oh(e){this._modeling=e}Oh.$inject=["modeling"],Oh.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,o=e.position,r=e.hints,a=this._modeling;U(t,function(p){et(p.x)||(p.x=0),et(p.y)||(p.y=0)});var s=ft(t,function(p){return!p.hidden}),c=dn(s);U(t,function(p){Lt(p)&&(p.waypoints=zn(p.waypoints,function(d){return{x:wu(d.x-c.x-c.width/2+o.x),y:wu(d.y-c.y-c.height/2+o.y)}})),Z(p,{x:wu(p.x-c.x-c.width/2+o.x),y:wu(p.y-c.y-c.height/2+o.y)})});var l=new Set(El(t)),u={};U(t,function(p){if(Lt(p)){u[p.id]=et(i)?a.createConnection(u[p.source.id],u[p.target.id],i,p,p.parent||n,r):a.createConnection(u[p.source.id],u[p.target.id],p,p.parent||n,r);return}var d=Z({},r);l.has(p)||(d.autoResize=!1),ut(p)&&(d=Zi(d,["attach"])),u[p.id]=et(i)?a.createShape(p,ji(p,["x","y","width","height"]),p.parent||n,i,d):a.createShape(p,ji(p,["x","y","width","height"]),p.parent||n,d)}),e.elements=ha(u)};var m_=Math.round;function fr(e){this._canvas=e}fr.$inject=["canvas"],fr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,o=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?Z(t,n):Z(t,{x:n.x-m_(t.width/2),y:n.y-m_(t.height/2)}),this._canvas.addShape(t,i,o),t},fr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Js(e){fr.call(this,e)}Ne(Js,fr),Js.$inject=["canvas"];var uI=fr.prototype.execute;Js.prototype.execute=function(e){var t=e.shape;return dI(t),t.labelTarget=e.labelTarget,uI.call(this,e)};var pI=fr.prototype.revert;Js.prototype.revert=function(e){return e.shape.labelTarget=null,pI.call(this,e)};function dI(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Qs(e,t){this._canvas=e,this._modeling=t}Qs.$inject=["canvas","modeling"],Qs.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Qs.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=af(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Qs.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,sn(n.children,t,i),this._canvas.addConnection(t,n),t};function Dh(e,t){this._modeling=e,this._elementRegistry=t}Dh.$inject=["modeling","elementRegistry"],Dh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;U(i,function(o){n.get(o.id)&&(o.waypoints?t.removeConnection(o):t.removeShape(o))})};function ec(e,t){this._canvas=e,this._modeling=t}ec.$inject=["canvas","modeling"],ec.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){Lt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ec.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=af(i.children,n),t.removeShape(n),n},ec.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,o=e.oldParentIndex;return sn(i.children,n,o),t.addShape(n,i),n};function _u(e){this._modeling=e}_u.$inject=["modeling"];var y_={x:"y",y:"x"};_u.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,o=e.dimension;function r(y,_){y.range.min=Math.min(_[i],y.range.min),y.range.max=Math.max(_[i]+_[o],y.range.max)}function a(y){return y[i]+y[o]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,_){var h={y:0};h[i]=y-a(_),h[i]&&(h[y_[i]]=0,t.moveElements([_],h,_.parent))}var u=n[0],p=s(n),d=n[p],f,m,g=0;U(n,function(y,_){var h,v,b;if(y.elements.length<2){_&&_!==n.length-1&&(r(y,y.elements[0]),g+=c(y.range));return}h=Xi(y.elements,i),v=h[0],_===p&&(v=h[s(h)]),b=a(v),y.range=null,U(h,function(E){if(l(b,E),y.range===null){y.range={min:E[i],max:E[i]+E[o]};return}r(y,E)}),_&&_!==n.length-1&&(g+=c(y.range))}),m=Math.abs(d.range.min-u.range.max),f=Math.round((m-g)/(n.length-1)),!(f<n.length-1)&&U(n,function(y,_){var h={},v;y===u||y===d||(v=n[_-1],y.range.max=0,U(y.elements,function(b,E){h[y_[i]]=0,h[i]=v.range.max-b[i]+f,y.range.min!==b[i]&&(h[i]+=b[i]-y.range.min),h[i]&&t.moveElements([b],h,b.parent),y.range.max=Math.max(b[i]+b[o],E?y.range.max:0)}))})},_u.prototype.postExecute=function(e){};function Eu(e,t){this._layouter=e,this._canvas=t}Eu.$inject=["layouter","canvas"],Eu.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return Z(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Eu.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Lh(){}Lh.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=rn(r.children,t),sn(i.children,t,o),t.parent=i,U(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},Lh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,o=e.oldParentIndex,r=e.delta;return rn(n.children,t),sn(i.children,t,o),t.parent=i,U(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 Ih(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Ih.prototype.add=function(e,t){return this.addAll([e],t)},Ih.prototype.addAll=function(e,t){var n=VP(e,!!t,this);return Z(this,n),this};function tc(e){this._modeling=e}tc.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},tc.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),U(a,function(p){r.moveShape(p,t,l[p.id]&&!u&&n,{recurse:!1,layout:!1})}),U(s,function(p){var d=!!a[p.source.id],f=!!a[p.target.id];c[p.id]&&d&&f?r.moveConnection(p,t,l[p.id]&&!u&&n):r.layoutConnection(p,{connectionStart:d&&zf(p,p.source,t),connectionEnd:f&&Gf(p,p.target,t)})})},tc.prototype.getClosure=function(e){return new Ih().addAll(e,!0)};function Su(e){this._helper=new tc(e)}Su.$inject=["modeling"],Su.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Su.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Jr(e){this._modeling=e,this._helper=new tc(e)}Jr.$inject=["modeling"],Jr.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=ji(t,["x","y","width","height"]),e.oldParent=r,e.oldParentIndex=rn(r.children,t),sn(i.children,t,o),Z(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Jr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,o=this._modeling;i.layout!==!1&&(U(t.incoming,function(r){o.layoutConnection(r,{connectionEnd:Gf(r,t,n)})}),U(t.outgoing,function(r){o.layoutConnection(r,{connectionStart:zf(r,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Jr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,o=e.delta;return sn(n.children,t,i),Z(t,{parent:n,x:t.x-o.x,y:t.y-o.y}),t},Jr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Jr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function nc(e){this._modeling=e}nc.$inject=["modeling"],nc.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 Qe(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},nc.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||v_(Qe(o)?o[0]:o)),i&&(!n||r.docking==="target")&&(a.connectionEnd=a.connectionEnd||v_(Qe(o)?o[o.length-1]:o)),r.newWaypoints&&(a.waypoints=r.newWaypoints),this._modeling.layoutConnection(t,a))},nc.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 v_(e){return e.original||e}function Oo(e,t){this._modeling=e,this._rules=t}Oo.$inject=["modeling","rules"],Oo.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(m,g,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:g})}var l={x:r.x,y:r.y},u={x:o.x,y:o.y,width:o.width,height:o.height};s=e.newShape=e.newShape||t.createShape(r,l,o.parent,a),o.host&&n.updateAttachment(s,o.host);var p;a.moveChildren!==!1&&(p=o.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var d=o.incoming.slice(),f=o.outgoing.slice();U(d,function(m){var g=m.source,y=c(g,s,m);y&&t.reconnectEnd(m,s,Zl(m,s,u),a)}),U(f,function(m){var g=m.target,y=c(s,g,m);y&&t.reconnectStart(m,s,Xl(m,s,u),a)})},Oo.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Oo.prototype.execute=function(e){},Oo.prototype.revert=function(e){},Oo.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Oo.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Oo.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ic(e){this._modeling=e}ic.$inject=["modeling"],ic.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},Z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ic.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,o=e.hints||{};o.layout!==!1&&(U(n.incoming,function(r){t.layoutConnection(r,{connectionEnd:Zl(r,n,i)})}),U(n.outgoing,function(r){t.layoutConnection(r,{connectionStart:Xl(r,n,i)})}))},ic.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return Z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.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),U(o,function(s){a[s.id]=hI(s)}),this.resizeShapes(o,t,n),this.updateConnectionWaypoints(HL(i,o),t,n,r,i,o,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;U(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;U(e,function(o){var r=zL(o,n,t);i._modeling.resizeShape(o,r,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,o,r,a){var s=this,c=new Set(o),l=new Set(r);U(e,function(u){var p=u.source,d=u.target,f=fI(u),m=b_(n),g={},y=c.has(p)||l.has(p),_=c.has(d)||l.has(d);y&&_?(f=zn(f,function(h){return w_(h,i,n)&&(h[m]=h[m]+t[m]),h.original&&w_(h.original,i,n)&&(h.original[m]=h.original[m]+t[m]),h}),s._modeling.updateWaypoints(u,f,{labelBehavior:!1})):(y||_)&&(c.has(p)?g.connectionStart=zf(u,p,t):c.has(d)?g.connectionEnd=Gf(u,d,t):l.has(p)?g.connectionStart=Xl(u,p,a[p.id]):l.has(d)&&(g.connectionEnd=Zl(u,d,a[d.id])),s._modeling.layoutConnection(u,g))})};function x_(e){return Z({},e)}function fI(e){return zn(e.waypoints,function(t){return t=x_(t),t.original&&(t.original=x_(t.original)),t})}function b_(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function w_(e,t,n){var i=b_(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function hI(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ru(e){this._modeling=e}Ru.$inject=["modeling"],Ru.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=__(n),t.collapsed=!t.collapsed;var i=E_(n,t.collapsed);return[t].concat(i)},Ru.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,o=S_(i,n);return t.collapsed=!t.collapsed,[t].concat(o)};function __(e){var t={};return U(e,function(n){t[n.id]=n.hidden,n.children&&(t=Z({},t,__(n.children)))}),t}function E_(e,t){var n=[];return U(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(E_(i.children,i.collapsed||t)))}),n}function S_(e,t){var n=[];return U(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(S_(i.children,t)))}),n}function Mu(e){this._modeling=e}Mu.$inject=["modeling"],Mu.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=R_(i,t),M_(n,t),t.host=n,t},Mu.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,o=e.attacherIdx;return t.host=i,R_(n,t),M_(i,t,o),t};function R_(e,t){return rn(e&&e.attachers,t)}function M_(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),sn(i,t,n)}}function Bh(){}Bh.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Bh.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function It(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}It.$inject=["eventBus","elementFactory","commandStack"],It.prototype.getHandlers=function(){return{"shape.append":xu,"shape.create":fr,"shape.delete":ec,"shape.move":Jr,"shape.resize":ic,"shape.replace":Oo,"shape.toggleCollapse":Ru,spaceTool:hr,"label.create":Js,"connection.create":bu,"connection.delete":Qs,"connection.move":Lh,"connection.layout":Eu,"connection.updateWaypoints":Bh,"connection.reconnect":nc,"elements.create":Oh,"elements.move":Su,"elements.delete":Dh,"elements.distribute":_u,"elements.align":vu,"element.updateAttachment":Mu}},It.prototype.registerHandlers=function(e){U(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},It.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)},It.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},It.prototype.moveElements=function(e,t,n,i){i=i||{};var 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)},It.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)},It.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},It.prototype.createConnection=function(e,t,n,i,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},It.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},It.prototype.createElements=function(e,t,n,i,o){Qe(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},It.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},It.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},It.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},It.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},It.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},It.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},It.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},It.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},It.prototype.resizeShape=function(e,t,n,i){var o={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",o)},It.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)},It.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},It.prototype.reconnect=function(e,t,n,i,o){var r={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:o||{}};this._commandStack.execute("connection.reconnect",r)},It.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,Z(i,{docking:"source"}))},It.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,Z(i,{docking:"target"}))},It.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},It.prototype._create=function(e,t){return T2(t)?t:this._elementFactory.create(e,t)},It.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function oc(e){this._elementRegistry=e}oc.$inject=["elementRegistry"],oc.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||gI(n,zc(i));return C_(n,i),e.oldProperties=r,e.changed=o,o},oc.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return C_(n,t),i},oc.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return A(e,"bpmn:DataObject")?mI(e,t):[]};function gI(e,t){return si(t,function(n,i){return n[i]=e.get(i),n},{})}function C_(e,t){U(t,function(n,i){e.set(i,n)})}function mI(e,t){return t.filter(function(n){return A(n,"bpmn:DataObjectReference")&&Ee(n).dataObjectRef===e})}var rc="default",Do="id",A_="di",yI={width:0,height:0};function ac(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ac.$inject=["elementRegistry","moddle","modeling","textRenderer"],ac.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=_I(e.properties),s=e.oldProperties||vI(t,a);return T_(a,r)&&(o.unclaim(r[Do]),i.updateId(t,a[Do]),o.claim(a[Do],r)),rc in a&&(a[rc]&&n.push(i.get(a[rc].id)),r[rc]&&n.push(i.get(r[rc].id))),P_(t,a),e.oldProperties=s,e.changed=n,n},ac.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Ee(n).name;if(i){var o=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,o,yI)}},ac.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,o=t.businessObject,r=this._elementRegistry,a=this._moddle.ids;return P_(t,i),T_(n,o)&&(a.unclaim(n[Do]),r.updateId(t,i[Do]),a.claim(i[Do],o)),e.changed};function T_(e,t){return Do in e&&e[Do]!==t[Do]}function vI(e,t){var n=zc(t),i=e.businessObject,o=xt(e);return si(n,function(r,a){return a!==A_?r[a]=i.get(a):r[a]=xI(o,zc(t.di)),r},{})}function xI(e,t){return si(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function P_(e,t){var n=e.businessObject,i=xt(e);U(t,function(o,r){r!==A_?n.set(r,o):i&&bI(i,o)})}function bI(e,t){U(t,function(n,i){e.set(i,n)})}var wI=["default"];function _I(e){var t=Z({},e);return wI.forEach(function(n){n in e&&(t[n]=Ee(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=xt(o);return t.setRootElement(n),t.removeRootElement(o),sn(a.rootElements,i),i.$parent=a,rn(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=xt(n);return t.setRootElement(o),t.removeRootElement(n),rn(a.rootElements,i),i.$parent=null,sn(a.rootElements,r),r.$parent=a,n.di=null,s.bpmnElement=r,o.di=s,[]};function Nh(e,t){this._modeling=e,this._spaceTool=t}Nh.$inject=["modeling","spaceTool"],Nh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,o=e.location,r=Ai(i),a=r===i,s=a?i:i.parent,c=ar(s),l=Rn(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+Ci,y:i.y,width:i.width-Ci,height:i.height}:{x:i.x,y:i.y+Ci,width:i.width,height:i.height-Ci};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var p=[];Gr(r,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:ft(b.children,function(E){return E!==i})});var d,f,m,g,y;o==="top"?(d=-120,f=i.y,m=f+10,g="n",y="y"):o==="left"?(d=-120,f=i.x,m=f+10,g="w",y="x"):o==="bottom"?(d=120,f=i.y+i.height,m=f-10,g="s",y="y"):o==="right"&&(d=120,f=i.x+i.width,m=f-10,g="e",y="x");var _=t.calculateAdjustments(p,y,d,m),h=l?{x:0,y:d}:{x:d,y:0};t.makeSpace(_.movingShapes,_.resizingShapes,h,g,m);var v=l?{x:i.x+(a?Ci:0),y:f-(o==="top"?120:0),width:i.width-(a?Ci:0),height:120}:{x:f-(o==="left"?120:0),y:i.y+(a?Ci:0),width:120,height:i.height-(a?Ci:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},v,s)};function $h(e){this._modeling=e}$h.$inject=["modeling"],$h.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,o=ar(n),r=o.length;if(r>i)throw new Error(`more than <${i}> child lanes`);var a=Rn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,p,d;for(d=0;d<i;d++)d===i-1?l=s-c*d:l=c,u=a?{x:n.x+Ci,y:n.y+d*c,width:n.width-Ci,height:l}:{x:n.x+d*c,y:n.y+Ci,width:l,height:n.height-Ci},d<r?t.resizeShape(o[d],u):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,u,n))};function sc(e,t){this._modeling=e,this._spaceTool=t}sc.$inject=["modeling","spaceTool"],sc.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},sc.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=mO(e,t);n.resizeShape(e,t),i.forEach(function(o){n.resizeShape(o.shape,o.newBounds)})},sc.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ze(e),o=Ze(t),r=cb(o,i),a=Ai(e),s=[],c=[];Gr(a,function(m){return s.push(m),(A(m,"bpmn:Lane")||A(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,p,d,f;(r.bottom||r.top)&&(l=r.bottom||r.top,u=e.y+(r.bottom?e.height:0)+(r.bottom?-10:10),p=r.bottom?"s":"n",d=r.top>0||r.bottom<0?-l:l,f=n.calculateAdjustments(s,"y",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:l},p)),(r.left||r.right)&&(l=r.right||r.left,u=e.x+(r.right?e.width:0)+(r.right?-10:100),p=r.right?"e":"w",d=r.left>0||r.right<0?-l:l,f=n.calculateAdjustments(c,"x",d,u),n.makeSpace(f.movingShapes,f.resizingShapes,{x:l,y:0},p))};var cc="flowNodeRef",Fh="lanes";function Au(){}Au.prototype._computeUpdates=function(e,t){var n=[],i=[],o={},r=[];function a(u,p){var d=Ze(p),f={x:u.x+u.width/2,y:u.y+u.height/2};return f.x>d.left&&f.x<d.right&&f.y>d.top&&f.y<d.bottom}function s(u){n.indexOf(u)===-1&&(r.push(u),n.push(u))}function c(u){var p=Ai(u);return o[p.id]||(o[p.id]=Wl(p)),o[p.id]}function l(u){if(!u.parent)return[];var p=c(u);return p.filter(function(d){return a(u,d)}).map(function(d){return d.businessObject})}return t.forEach(function(u){var p=Ai(u);if(!(!p||n.indexOf(p)!==-1)){var d=p.children.filter(function(f){return A(f,"bpmn:FlowNode")});d.forEach(s),n.push(p)}}),e.forEach(s),r.forEach(function(u){var p=u.businessObject,d=p.get(Fh),f=d.slice(),m=l(u);i.push({flowNode:p,remove:f,add:m})}),t.forEach(function(u){var p=u.businessObject;u.parent||p.get(cc).forEach(function(d){i.push({flowNode:d,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(Fh);n.remove.forEach(function(r){rn(o,r),rn(r.get(cc),i)}),n.add.forEach(function(r){sn(o,r),sn(r.get(cc),i)})}),[]},Au.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,o=i.get(Fh);n.add.forEach(function(r){rn(o,r),rn(r.get(cc),i)}),n.remove.forEach(function(r){sn(o,r),sn(r.get(cc),i)})}),[]};var jh="categoryValueRef";function lc(e,t){this._bpmnFactory=e,this._elementRegistry=t}lc.$inject=["bpmnFactory","elementRegistry"],lc.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,o=new Map,r=[],a=new Map;function s(h,v,b){if(v){var E=a.get(h);E||(E={},a.set(h,E)),!(b&&E.present)&&(!b&&E.past||(b?E.present={categoryValue:v,root:Hh(h)}:E.past={categoryValue:v}))}}function c(h){o.set(h,Ee(h))}function l(){n.filter(function(h){return A(h,"bpmn:FlowElement")&&!ut(h)&&h.parent}).forEach(c)}function u(h){var v=Ee(h),b=v.get("categoryValueRef");return b||(b=ib(i,v),r.push(EI(h,b))),b}function p(h){return h.reduce(function(v,b){var E=Hh(b),M=v.get(E);return M||(M=[],v.set(E,M)),M.push(b),v},new Map)}e=Array.from(e||[]);var d=p(e);t.length&&l(),e.forEach(c),n.filter(function(h){return A(h,"bpmn:Group")&&!ut(h)&&h.parent}).forEach(function(h){var v=Ee(h).get("categoryValueRef");if(!v){var b=Hh(h),E=d.get(b)||[],M=Ra(E,h),B=Object.keys(M).length>0;B&&(v=u(h))}s(h,v,!0)}),t.forEach(function(h){s(h.groupShape,h.categoryValue,!1)}),r.length&&l();var f=Array.from(o.keys()),m=Array.from(a.values()).reduce(function(h,v){return v.present&&h.add(v.present.categoryValue),v.past&&h.add(v.past.categoryValue),h},new Set),g=new Map,y=p(f);a.forEach(function(h,v){var b=h.present;if(b){var E=y.get(b.root)||[],M=Ra(E,v);E.forEach(function(B){if(M[B.id]){var P=g.get(B);P||(P=new Set,g.set(B,P)),P.add(b.categoryValue)}})}});var _=f.reduce(function(h,v){var b=o.get(v),E=b.get(jh),M=new Set(E),B=g.get(v)||new Set,P=Array.from(B).filter(function(N){return!M.has(N)}),k=E.filter(function(N){return m.has(N)&&!B.has(N)});return(P.length||k.length)&&h.push({businessObject:b,categoryValuesToAdd:P,categoryValuesToRemove:k}),h},[]);return{flowElements:_,groups:r}},lc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),SI(t.groups),MI(t.flowElements),[]},lc.prototype.revert=function(e){var t=e.updates;return CI(t.flowElements),RI(t.groups),[]};function EI(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function SI(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function RI(e){e.forEach(function(t){Ee(t.groupShape).categoryValueRef=null})}function MI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jh);t.categoryValuesToRemove.forEach(function(o){rn(i,o)}),t.categoryValuesToAdd.forEach(function(o){sn(i,o,!0)})})}function CI(e){e.forEach(function(t){var n=t.businessObject,i=n.get(jh);t.categoryValuesToAdd.forEach(function(o){rn(i,o)}),t.categoryValuesToRemove.forEach(function(o){sn(i,o,!0)})})}function Hh(e){for(;e.parent;)e=e.parent;return e}function Tu(e){this._moddle=e}Tu.$inject=["moddle"],Tu.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,o=e.claiming;return o?t.claim(n,i):t.unclaim(n),[]},Tu.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 AI={fill:void 0,stroke:void 0};function zh(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(ri(t)){var n=TI(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}zh.$inject=["commandStack"],zh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||AI,i=this,o={};"fill"in n&&Z(o,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&Z(o,{"border-color":this._normalizeColor(n.stroke)}),U(t,function(r){var a=Lt(r)?ji(o,["border-color"]):o,s=xt(r);if(PI(a),ut(r)){if(!s||!A(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:r,moddleElement:s.label,properties:{color:o["border-color"]}})}else{if(!dt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:r,properties:{di:a}})}})};function TI(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 PI(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var kI={width:0,height:0};function k_(e,t,n){function i(c,l){var u=c.label||c,p=c.labelTarget||c;return rk(u,l),[u,p]}function o(c){var l=c.element,u=l.businessObject,p=c.newLabel;if(!ut(l)&&or(l)&&!Ol(l)&&!O_(p)){var d=7,f=df(l);f={x:f.x,y:f.y+d},e.createLabel(l,f,{id:u.id+"_label",businessObject:u,di:l.di})}}function r(c){return c.oldLabel=ui(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,p=c.newLabel,d=c.newBounds,f=c.hints||{};if(!(!ut(u)&&!A(u,"bpmn:TextAnnotation"))){if(ut(u)&&O_(p)){f.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=ui(l);typeof d>"u"&&(d=t.getExternalLabelBounds(u,m)),d&&e.resizeShape(u,d,kI)}}this.preExecute=o,this.execute=r,this.revert=a,this.postExecute=s}k_.$inject=["modeling","textRenderer","bpmnFactory"];function O_(e){return!e||!e.trim()}function jn(e,t,n,i){It.call(this,e,t,n),this._bpmnRules=i}Ne(jn,It),jn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],jn.prototype.getHandlers=function(){var e=It.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=oc,e["element.updateProperties"]=ac,e["canvas.updateRoot"]=Cu,e["lane.add"]=Nh,e["lane.resize"]=sc,e["lane.split"]=$h,e["lane.updateRefs"]=Au,e["group.updateRefs"]=lc,e["id.updateClaim"]=Tu,e["element.setColor"]=zh,e["element.updateLabel"]=k_,e},jn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},jn.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)},jn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},jn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},jn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},jn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},jn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},jn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},jn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},jn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},jn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},jn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},jn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},jn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function D_(){}D_.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||tt(t.source||e.source),t.connectionEnd||tt(t.target||e.target)]};var Pu=20,OI=5,ku=Math.round,L_=20,DI={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function LI(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function II(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function I_(e,t,n){var i=Nn(t,e,OI),o=n.split(":")[0],r=ku((t.x-e.x)/2+e.x),a=ku((t.y-e.y)/2+e.y),s,c,l=II(o,i),u=/h|r|l/.test(o),p=!1,d=!1;return l?(s=u?{x:r,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(p=LI(i,o),c=u?"h:v":"v:h",p?u?(d=a===e.y,s={x:e.x+Pu*(/l/.test(o)?-1:1),y:d?a+Pu:a}):(d=r===e.x,s={x:d?r+Pu:r,y:e.y+Pu*(/t/.test(o)?-1:1)}):s={x:r,y:a}),{waypoints:Gh(e,s,c).concat(s),directions:c,turnNextDirections:d}}function BI(e,t,n){return I_(e,t,n)}function NI(e,t,n){var i=I_(t,e,B_(n));return{waypoints:i.waypoints.slice().reverse(),directions:B_(i.directions),turnNextDirections:i.turnNextDirections}}function $I(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=Gh(e.waypoints[e.waypoints.length-1],t.waypoints[0],o);return{waypoints:r,directions:o}}function B_(e){return e.split(":").reverse().join(":")}function FI(e,t,n){var i=ku((t.x-e.x)/2+e.x),o=ku((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 Gh(e,t,n){if(n=n||"h:h",!YI(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if($_(n)){var i=BI(e,t,n),o=NI(e,t,n),r=$I(i,o);return[].concat(i.waypoints,r.waypoints,o.waypoints)}return FI(e,t,n)}function jI(e,t,n){var i=Gh(e,t,n);return i.unshift(e),i.push(t),j_(i)}function HI(e,t,n,i,o){var r=o&&o.preferredLayouts||[],a=kR(r,"straight")[0]||"h:h",s=DI[a]||0,c=Nn(e,t,s),l=qI(c,a);n=n||tt(e),i=i||tt(t);var u=l.split(":"),p=F_(n,e,u[0],KI(c)),d=F_(i,t,u[1],c);return jI(p,d,l)}function zI(e,t,n,i,o,r){Qe(n)&&(o=n,r=i,n=tt(e),i=tt(t)),r=Z({preferredLayouts:[]},r),o=o||[];var a=r.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&VI(e,t,n,i,r),c||(c=r.connectionEnd&&UI(t,e,i,o),c)||(c=r.connectionStart&&WI(e,t,n,o),c)?c:!r.connectionStart&&!r.connectionEnd&&o&&o.length?o:HI(e,t,n,i,r)}function GI(e,t,n){return e>=t&&e<=n}function N_(e,t,n){var i={x:"width",y:"height"};return GI(t[e],n[e],n[e]+n[i[e]])}function VI(e,t,n,i,o){var r={},a,s;return s=Nn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),o.preserveDocking==="target"?N_(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:N_(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 WI(e,t,n,i){return Vh(e,t,n,i)}function UI(e,t,n,i){var o=i.slice().reverse();return o=Vh(e,t,n,o),o?o.reverse():null}function Vh(e,t,n,i){function o(u){return u.length<3?!0:u.length>4?!1:!!$t(u,function(p,d){var f=u[d-1];return f&&Ds(p,f)<3})}function r(u,p,d){var f=So(p,u);switch(f){case"v":return{x:d.x,y:u.y};case"h":return{x:u.x,y:d.y}}return{x:u.x,y:u.y}}function a(u,p,d){var f;for(f=u.length-2;f!==0;f--)if(sx(u[f],p,L_)||sx(u[f],d,L_))return u.slice(f);return u}if(o(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=r(c[1],s,n),l=a(c,e,t),l!==c&&(c=Vh(e,t,n,l)),c&&So(c)?null:c}function qI(e,t){if($_(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 YI(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function $_(e){return e&&/t|r|b|l/.test(e)}function KI(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 j_(e){return e.reduce(function(t,n,i){var o=t[t.length-1],r=e[i+1];return sf(o,r,n,0)||t.push(n),t},[])}var XI=-10,ZI=40,JI={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},QI={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},Wh={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},uc={top:"t",right:"r",bottom:"b",left:"l"};function Ou(e){this._elementRegistry=e}Ne(Ou,D_),Ou.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)),(A(e,"bpmn:Association")||A(e,"bpmn:DataAssociation"))&&o&&!z_(n,i))return[].concat([r],o.slice(1,-1),[a]);var u=Qx(n,s)?JI:QI;return A(e,"bpmn:MessageFlow")?c=tB(n,i,u):(A(e,"bpmn:SequenceFlow")||z_(n,i))&&(n===i?c={preferredLayouts:sB(n,e,u)}:A(n,"bpmn:BoundaryEvent")?c={preferredLayouts:cB(n,i,a,u)}:pc(n)||pc(i)?c={preferredLayouts:u.subProcess,preserveDocking:iB(n)}:A(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:A(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=Z(c,t),l=j_(zI(n,i,r,a,o,c))),l||[r,a]};function eB(e){var t=e.host;return Nn(tt(e),t,XI)}function tB(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:nB(e,t)}}function nB(e,t){return A(t,"bpmn:Participant")?"source":A(e,"bpmn:Participant")?"target":pc(t)?"source":pc(e)||A(t,"bpmn:Event")?"target":A(e,"bpmn:Event")?"source":null}function iB(e){return pc(e)?"target":"source"}function H_(e,t){return e?e.original||e:tt(t)}function z_(e,t){return A(t,"bpmn:Activity")&&A(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function pc(e){return A(e,"bpmn:SubProcess")&&yt(e)}function Qr(e,t){return e===t}function oB(e,t){return t.indexOf(e)!==-1}function za(e){var t=/right|left/.exec(e);return t&&t[0]}function Ga(e){var t=/top|bottom/.exec(e);return t&&t[0]}function G_(e,t){return Wh[e]===t}function rB(e,t){var n=za(e),i=Wh[n];return t.indexOf(i)!==-1}function aB(e,t){var n=Ga(e),i=Wh[n];return t.indexOf(i)!==-1}function V_(e){return e==="right"||e==="left"}function sB(e,t,n){var i=t.waypoints,o=i&&i.length&&Nn(i[0],e);return o==="top"?n.loop.fromTop:o==="right"?n.loop.fromRight:o==="left"?n.loop.fromLeft:n.loop.fromBottom}function cB(e,t,n,i){var o=tt(e),r=tt(t),a=eB(e),s,c,l=Qr(e.host,t),u=oB(a,["top","right","bottom","left"]),p=Nn(r,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?lB(a,u,e,t,n,i):(s=uB(a,p,u,i.isHorizontal),c=pB(a,p,u,i.isHorizontal),[s+":"+c])}function lB(e,t,n,i,o,r){var a=t?e:r.isHorizontal?Ga(e):za(e),s=uc[a],c;return t?V_(e)?c=W_("y",n,i,o)?"h":r.boundaryLoop.alternateHorizontalSide:c=W_("x",n,i,o)?"v":r.boundaryLoop.alternateVerticalSide:c=r.boundaryLoop.default,[s+":"+c]}function W_(e,t,n,i){var o=ZI;return!(Uh(e,i,n,o)||Uh(e,i,{x:n.x+n.width,y:n.y+n.height},o)||Uh(e,i,tt(t),o))}function Uh(e,t,n,i){return Math.abs(t[e]-n[e])<i}function uB(e,t,n,i){if(n)return uc[e];var o=Ga(e),r=za(e),a=Ga(t),s=za(t);if(i){if(Qr(o,a)||G_(r,s))return uc[o]}else if(Qr(r,s)||G_(o,a))return uc[r];return uc[i?r:o]}function pB(e,t,n,i){if(n)return V_(e)?rB(e,t)||Qr(e,t)?"h":"v":aB(e,t)||Qr(e,t)?"v":"h";var o=Ga(e),r=za(e),a=Ga(t),s=za(t);return a&&!s?"v":s&&!a?"h":i?Qr(o,a)?"h":"v":Qr(r,s)?"v":"h"}Ou.$inject=["elementRegistry"];function U_(e){return Z({original:e.point.original||e.point},e.actual)}function gr(e,t){this._elementRegistry=e,this._graphicsFactory=t}gr.$inject=["elementRegistry","graphicsFactory"],gr.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(U_(i)),r.push(U_(o)),r},gr.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}},gr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),o=this._getConnectionPath(t);return Ls(i,o,n)},gr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},gr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},gr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const qh={__init__:["modeling","bpmnUpdater"],__depends__:[PD,UD,YD,KD,o_,XL,JL,oI,Pi,Ph,u_],bpmnFactory:["type",Oi],bpmnUpdater:["type",hi],elementFactory:["type",dr],modeling:["type",jn],layouter:["type",Ou],connectionDocking:["type",gr]};var dB=10,q_=50,fB=250;function Yh(e,t,n,i){for(var o;o=hB(e,n,t);)n=i(t,n,o);return n}function Kh(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 hB(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},o=mB(e);return $t(o,function(r){if(r===n)return!1;var a=Nn(r,i,dB);return a==="intersect"})}function gB(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||q_,o=t.direction||"e",r=t.filter,a=t.getWeight||n,s=t.maxDistance||fB,c=t.reference||"start";r||(r=xB);function l(m,g){return o==="n"?c==="start"?Ze(m).top-Ze(g).bottom:c==="center"?Ze(m).top-tt(g).y:Ze(m).top-Ze(g).top:o==="w"?c==="start"?Ze(m).left-Ze(g).right:c==="center"?Ze(m).left-tt(g).x:Ze(m).left-Ze(g).left:o==="s"?c==="start"?Ze(g).top-Ze(m).bottom:c==="center"?tt(g).y-Ze(m).bottom:Ze(g).bottom-Ze(m).bottom:c==="start"?Ze(g).left-Ze(m).right:c==="center"?tt(g).x-Ze(m).right:Ze(g).right-Ze(m).right}var u=e.incoming.filter(r).map(function(m){var g=a(m),y=g<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:g}}),p=e.outgoing.filter(r).map(function(m){var g=a(m),y=g>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:g}}),d=u.concat(p).reduce(function(m,g){return m[g.id+"__weight_"+g.weight]=g,m},{}),f=si(d,function(m,g){var y=g.distance,_=g.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*_,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return f.distance||i}function mB(e){var t=Xh(e);return e.host&&(t=t.concat(Xh(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Xh(i))},[]))),t}function Xh(e){return vB(e).concat(yB(e))}function yB(e){return e.incoming.map(function(t){return t.source})}function vB(e){return e.outgoing.map(function(t){return t.target})}function xB(){return!0}var bB=100;function Y_(e,t,n){e.on("autoPlace",bB,function(i){var o=i.shape,r=i.source;return wB(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}}Y_.$inject=["eventBus","modeling","canvas"];function wB(e,t,n){n||(n={});var i=n.defaultDistance||q_,o=tt(e),r=Ze(e);return{x:r.right+i+t.width/2,y:o.y}}function K_(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}K_.$inject=["eventBus","selection"];const _B={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Y_],autoPlaceSelectionBehavior:["type",K_]};function X_(e,t,n){var i=Qx(e,n);if(A(t,"bpmn:TextAnnotation"))return SB(e,t,i);if(dt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return RB(e,t,i);if(A(t,"bpmn:FlowNode"))return EB(e,t,i)}function EB(e,t,n){var i=Ze(e),o=tt(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=gB(e,{filter:function(f){return A(f,"bpmn:SequenceFlow")},direction:r.directionHint}),s=30,c=r.minDistance,l=r.baseOrientation;A(e,"bpmn:BoundaryEvent")&&(l=Nn(e,e.host,-25),l.indexOf(r.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:o.y+Z_(l,c,r)}:{x:o.x+Z_(l,c,r),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},d=n?{y:p}:{x:p};return Yh(e,t,u,Kh(d))}function Z_(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function SB(e,t,n){var i=Ze(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};Lt(e)&&(o=tt(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 Yh(e,t,o,Kh(a))}function RB(e,t,n){var i=Ze(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 Yh(e,t,o,Kh(a))}function J_(e,t){e.on("autoPlace",function(n){var i=n.shape,o=n.source;return X_(o,i,t)})}J_.$inject=["eventBus","elementRegistry"];const Du={__depends__:[_B],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",J_]};function Lo(e,t,n,i){_e.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(r){var a=r.context,s=a.hints||{},c=a.shape,l=a.parent||a.newParent;s.autoResize!==!1&&o._expand([c],l)}),this.postExecuted(["elements.move"],function(r){var a=r.context,s=zp(ha(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=ga(s,function(p){return p.parent.id});U(u,function(p,d){Qe(l)&&(p=p.filter(function(f){return $t(l,ma({id:f.id}))})),o._expand(p,d)})}}),this.postExecuted(["shape.toggleCollapse"],function(r){var a=r.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||o._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(r){var a=r.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&o._expand([c],l)})}Lo.$inject=["eventBus","elementRegistry","modeling","rules"],Ne(Lo,_e),Lo.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),o=Ze(dn(e)),r=Ze(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),Ml(Z({},r,a))},Lo.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(MB(i,t)){var o=CB(ji(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:o});var r=t.parent;r&&this._expand([t],r)}}},Lo.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Lo.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Lo.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function MB(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function CB(e,t){var n="";return e=Ze(e),t=Ze(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 Lu(e){e.invoke(Lo,this)}Lu.$inject=["injector"],Ne(Lu,Lo),Lu.prototype.resize=function(e,t,n){A(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function dc(e){Ti.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}dc.$inject=["eventBus"],Ne(dc,Ti),dc.prototype.canResize=function(e,t){return!1};function Iu(e,t){dc.call(this,e),this._modeling=t}Ne(Iu,dc),Iu.$inject=["eventBus","modeling"],Iu.prototype.canResize=function(e,t){if(A(t.di,"bpmndi:BPMNPlane")||!A(t,"bpmn:Participant")&&!A(t,"bpmn:Lane")&&!A(t,"bpmn:SubProcess"))return!1;var n=!0;return U(e,function(i){if(A(i,"bpmn:Lane")||ut(i)){n=!1;return}}),n};const Q_={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Lu],bpmnAutoResizeProvider:["type",Iu]},AB=1500;class e0{constructor(t){t.on("moddleCopy.canCopyProperties",AB,({sourceElement:n,targetElement:i})=>{var r;if(!((r=n==null?void 0:n.$instanceOf)!=null&&r.call(n,Or)))return;const o=An(n);o!==void 0&&i.set("xml:lang",o)})}}ln(e0,"$inject",["eventBus"]);const t0={__init__:["translationLocaleCopy"],translationLocaleCopy:["type",e0]},TB=500,Bu=1,n0=(e,t)=>{if((e==null?void 0:e.type)!=="bpmn:TextAnnotation"||!(t!=null&&t.original))return;const{x:n,y:i}=t.original;(n<e.x-Bu||n>e.x+e.width+Bu||i<e.y-Bu||i>e.y+e.height+Bu)&&(t.original={x:Math.round(e.x+e.width/2),y:Math.round(e.y+e.height/2)})};class i0{constructor(t){t.on("bpmnElement.added",TB,({element:n})=>{if((n==null?void 0:n.type)!=="bpmn:Association")return;const i=n.waypoints;!i||i.length<2||(n0(n.source,i[0]),n0(n.target,i[i.length-1]))})}}ln(i0,"$inject",["eventBus"]);const o0={__init__:["annotationImportDocking"],annotationImportDocking:["type",i0]},Zh=[Zx,js,qh,Du,Q_,Jp,t0,o0,dv];function PB(e={}){qm(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Vr({container:t,moddleExtensions:e.moddleExtensions??gs,additionalModules:[...Zh,...e.additionalModules??[]]})}const r0={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","merge-before-predecessor":"연결","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":"풀"},kB={이:["이","가"],을:["을","를"],와:["과","와"]};function OB(e,t){const[n,i]=kB[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 DB={"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":"연관선"},LB="요소";function Jh(e){return(e&&DB[e.type])??LB}const a0=20;function IB(e){const t=e.replace(/\s+/g," ").trim();return t.length>a0?`${t.slice(0,a0)}…`:t}function Nu(e,t,n,i=""){const o=e(t),r=(o==null?void 0:o.name)===void 0?void 0:IB(o.name),a=r===void 0?i+Jh(o):r,s=r===void 0?a:`「${r}」`;return n?s+OB(a,n).slice(a.length):s}function BB(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&&Jh(r)===Jh(a);return[Nu(e,t,i),Nu(e,n,o,s?"다른 ":"")]}function NB(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 $B(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];case"merge-before-predecessor":return[e.merge,e.edge]}}const $u={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function FB(e,t){const n=(o,r)=>Nu(t,o,r),i=(o,r,a,s)=>BB(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)}의 ${$u[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)}의 ${$u[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${$u[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${$u[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} 겹칩니다.`}case"merge-before-predecessor":return`합류 ${n(e.merge,"이")} 앞 단계보다 앞에 놓여 ${n(e.edge,"이")} 거꾸로 들어갑니다.`}}function jB(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Nu(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const s0="기타",Qh={error:0,warning:1,info:2};function c0(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${lt(i)}`,source:"geometry",code:i.kind,severity:NB(i),targetRefs:$B(i),category:r0[i.kind]??s0,message:FB(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:r0[i.ruleId]??s0,message:jB(i,t)});return n}function l0(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function Va(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function eg(e,t){if(t===void 0||e.length===0)return!1;const n=Va(e[0],t);return e.some(i=>Va(i,t)!==n)}function u0(e,t){const n=eg(e,t);return e.slice().sort((i,o)=>(n?Number(Va(o,t))-Number(Va(i,t)):0)||Qh[i.severity]-Qh[o.severity])}const p0="i18n-untranslated",d0="i18n-review-requested",fc="i18nDisplay.redrawn",f0=[["untranslated",p0],["reviewRequested",d0]];class tg{constructor(t,n,i,o,r,a,s,c){ln(this,"config");ln(this,"displayLocale");this.eventBus=t,this.elementRegistry=n,this.canvas=a,this.textRenderer=s,this.graphicsFactory=c;const l=o.drawShape.bind(o);o.drawShape=(d,f,m)=>this.withDisplayText(f,()=>l(d,f,m),d);const u=r.activate.bind(r);r.activate=d=>this.withDisplayText(d,()=>u(d));const p=r.update.bind(r);r.update=(d,f,m,g)=>{const y=this.resolve(d);if(!y||y.native)return p(d,f,m,g);(f??"").trim()!==(m??"").trim()&&i.execute(Vc,{element:d.labelTarget??d,locale:this.displayLocale,text:f,designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang()})},t.on("commandStack.element.updateLabel.postExecute",d=>{if(!this.config)return;const{element:f,newLabel:m,oldLabel:g}=d.context;(m??"")!==(g??"")&&i.execute(Vc,{element:f.labelTarget??f,locale:this.displayLocale,text:m??"",designLocale:this.config.designLocale,locales:this.locales(),rootLang:this.rootLang(),nameChangedFrom:g??""})})}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=Dr(n);if(!i)return;const o=this.displayLocale,r=i.target[i.key]??"",a=Vo(n).filter(d=>An(d)),s=d=>d.body??"",c=a.find(d=>An(d)===o&&s(d)),l=Wo(n).some(d=>d.locale===o)?"reviewRequested":"ok";if(!r)return c?{text:s(c),status:l,native:!1}:void 0;const u=a.filter(d=>s(d)===r).map(An);return(u.length?u:[this.rootLang()??this.config.designLocale]).includes(o)?{text:r,status:l,native:!0}:c?{text:s(c),status:l,native:!1}:{text:r,status:"untranslated",native:!1}}untranslatedCount(t){return this.countStatus(t,"untranslated")}reviewRequestedCount(t){return this.countStatus(t,"reviewRequested")}countStatus(t,n){var r;if(!this.config)return 0;const i=this.displayLocale;this.displayLocale=t;let o=0;try{for(const a of this.elementRegistry.getAll())a.type!=="label"&&((r=this.resolve(a))==null?void 0:r.status)===n&&o++}finally{this.displayLocale=i}return o}withDisplayText(t,n,i){var d;if(!this.config)return n();const o=this.resolve(t),r=(d=i==null?void 0:i.parentNode)==null?void 0:d.classList;if(r)for(const[f,m]of f0)r.toggle(m,(o==null?void 0:o.status)===f);if(!o||o.native)return n();const{target:a,key:s}=Dr((t.labelTarget??t).businessObject),c=Object.prototype.hasOwnProperty.call(a,s),l=a[s];if(l===o.text)return n();a[s]=o.text;const u=this.config.adaptiveExternalLabel??!0,p=t.type==="label"&&u?this.widen(t,o.text):void 0;try{const f=n();return p&&(f!=null&&f.setAttribute)&&f.setAttribute("transform",`translate(${p.dx}, 0)`),f}finally{c?a[s]=l:delete a[s],p==null||p.restore()}}widen(t,n){const{width:i,height:o}=t,r=this.textRenderer.getExternalLabelBounds(t,n);return t.width=r.width,t.height=r.height,{dx:(i-r.width)/2,restore:()=>(t.width=i,t.height=o)}}rerenderAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);if(i){if(!this.config)for(const[,o]of f0)i.classList.remove(o);this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}}this.eventBus.fire(fc)}}ln(tg,"$inject",["eventBus","elementRegistry","commandStack","bpmnRenderer","labelEditingProvider","canvas","textRenderer","graphicsFactory"]);const h0={__depends__:[Jp],__init__:["i18nDisplay"],i18nDisplay:["type",tg]};var HB=2e3;function ng(e,t,n){e.on("autoPlace",HB,function(i){var o=i.source,r=tt(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],A(a,"bpmn:TextAnnotation")&&(zB(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}ng.$inject=["eventBus","gridSnapping","elementRegistry"];function zB(e){return e==="x"}var GB=3e3;function Wa(e,t,n){_e.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],GB,function(o){var r=o.context,a=r.connection,s=r.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||VB(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Wa.$inject=["eventBus","gridSnapping","modeling"],Ne(Wa,_e),Wa.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=qB(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function VB(e){return e.length>3}function WB(e){return e==="h"}function UB(e){return e==="v"}function qB(e,t,n){var i=So(t,n),o={};return WB(i)&&(o.y=e.snapValue(t.y)),UB(i)&&(o.x=e.snapValue(t.x)),("x"in o||"y"in o)&&(t=Z({},t,o),n=Z({},n,o)),[t,n]}function YB(e){var n;const t=Number.parseFloat(((n=String(this.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:n[1])??"12");return{width:Nr(e,t),fontBoundingBoxAscent:t*Qi.ascentEm,fontBoundingBoxDescent:t*Qi.descentEm,actualBoundingBoxAscent:t*Qi.ascentEm,actualBoundingBoxDescent:t*Qi.descentEm}}class ig{constructor(t,n,i,o,r,a){ln(this,"active",!1);ln(this,"shadow");ln(this,"shadowContainer");this.eventBus=t,this.elementRegistry=n,this.textRenderer=i,this.graphicsFactory=o,this.canvas=r,this.bpmnjs=a,t.on("diagram.destroy",()=>this.disposeShadow());let s=[];t.on("elements.changed",c=>{this.active||(s=c.elements??[])}),t.on("commandStack.changed",c=>{const l=s;s=[],!(this.active||(c==null?void 0:c.trigger)!=="undo"&&(c==null?void 0:c.trigger)!=="redo")&&this.remeasureLabelsOf(l)})}isActive(){return this.active}run(t){if(this.active)throw new Error("headlessReplay.run: 이미 창 안이다(중첩 금지)");const n=typeof CanvasRenderingContext2D>"u"?void 0:CanvasRenderingContext2D.prototype,i=n==null?void 0:n.measureText;n&&(n.measureText=YB),this.active=!0;try{return this.reproject(),t()}finally{this.active=!1,n&&i&&(n.measureText=i),this.relabel(),this.syncGraphicsOrder(),this.redrawAll()}}atBatchBoundary(){if(!this.active)throw new Error("headlessReplay.atBatchBoundary: 창 밖이다");this.eventBus.fire("saveXML.start",{definitions:this.bpmnjs.getDefinitions()}),this.reproject()}reproject(){const t=this.ensureShadow();t.get("eventBus").fire("diagram.clear");let n=!1;t.get("eventBus").once("import.render.complete",()=>n=!0);let i;if(Ix(t,this.bpmnjs.getDefinitions()).catch(u=>i=u),!n)throw new Error(`headlessReplay: 그림자 import 가 동기로 끝나지 않았다${i?` — ${String(i)}`:""}`);const o=t.get("elementRegistry"),r=this.elementRegistry,a=u=>u?r.get(u.id):void 0,s=o.getAll();for(const u of s){const p=r.get(u.id);if(!p)continue;u.waypoints?p.waypoints=u.waypoints.map(f=>({x:f.x,y:f.y,...f.original?{original:{x:f.original.x,y:f.original.y}}:{}})):u.parent&&(p.x=u.x,p.y=u.y,p.width=u.width,p.height=u.height),p.collapsed=u.collapsed,p.hidden=u.hidden,p.isFrame=u.isFrame;const d=a(u.parent);d&&p.parent!==d&&(p.parent=d);for(const f of["incoming","outgoing"]){const m=(u[f]??[]).map(a).filter(Boolean),g=p[f];g&&m.length===g.length&&m.every(y=>g.includes(y))&&m.forEach((y,_)=>g[_]=y)}}for(const u of s){const p=r.get(u.id);if(!(p!=null&&p.children)||!u.children)continue;const d=u.children.map(a).filter(Boolean),f=p.children.filter(m=>!d.includes(m)&&m.parent===p);p.children.length=0,p.children.push(...d,...f)}const c=r._elements,l={};for(const u of s)u.id in c&&(l[u.id]=c[u.id]);for(const u of Object.keys(c))u in l||(l[u]=c[u]);r._elements=l}relabel(){for(const t of this.elementRegistry.filter(n=>n.type==="label"))this.remeasure(t)}remeasure(t){const n=t.labelTarget,i=n&&ui(n);if(!i)return!1;const o=this.textRenderer.getExternalLabelBounds(Gx(xt(n),n),i),r={x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)};return r.x===t.x&&r.y===t.y&&r.width===t.width&&r.height===t.height?!1:(Object.assign(t,r),!0)}remeasureLabelsOf(t){const n=new Set;for(const o of t){(o==null?void 0:o.type)==="label"&&n.add(o);for(const r of(o==null?void 0:o.labels)??[])n.add(r)}let i=0;for(const o of n){if(!this.elementRegistry.get(o.id)||!this.remeasure(o))continue;const r=this.elementRegistry.getGraphics(o);r&&this.graphicsFactory.update("shape",o,r),i++}i&&this.eventBus.fire(fc)}syncGraphicsOrder(){var t,n;for(const i of this.elementRegistry.getAll()){if(!((t=i.children)!=null&&t.length))continue;const o=this.graphicsFactory._getChildrenContainer(i);for(const r of i.children){const a=(n=this.elementRegistry.getGraphics(r))==null?void 0:n.parentNode;a&&o.appendChild(a)}}}redrawAll(){const t=this.canvas.getRootElement();for(const n of this.elementRegistry.getAll()){if(n===t)continue;const i=this.elementRegistry.getGraphics(n);i&&this.graphicsFactory.update(n.waypoints?"connection":"shape",n,i)}this.eventBus.fire(fc)}ensureShadow(){if(this.shadow)return this.shadow;const t=document.createElement("div");return t.style.cssText="position:absolute;left:-10000px;top:0;width:800px;height:600px;visibility:hidden",document.body.appendChild(t),this.shadowContainer=t,this.shadow=new Vr({container:t,moddleExtensions:gs,additionalModules:[...Zh]}),this.shadow}disposeShadow(){var t,n;(t=this.shadow)==null||t.destroy(),this.shadow=void 0,(n=this.shadowContainer)==null||n.remove(),this.shadowContainer=void 0}}ln(ig,"$inject",["eventBus","elementRegistry","textRenderer","graphicsFactory","canvas","bpmnjs"]);function g0(e,t){const n=Object.create(e);return n.on=(i,o,r,a)=>{typeof o=="function"&&(a=r,r=o,o=1e3);const s=function(...c){return t.isActive()?void 0:r.apply(this,c)};return e.on(i,o,s,a)},n}function og(e,t,n,i){ng.call(this,g0(e,i),t,n)}og.$inject=["eventBus","gridSnapping","elementRegistry","headlessReplay"];function Fu(e,t,n,i){Wa.call(this,g0(e,i),t,n)}Fu.prototype=Object.create(Wa.prototype),Fu.$inject=["eventBus","gridSnapping","modeling","headlessReplay"];function KB(e){return e instanceof og||e instanceof Fu}const m0={__init__:["headlessReplay"],headlessReplay:["type",ig],gridSnappingAutoPlaceBehavior:["type",og],gridSnappingLayoutConnectionBehavior:["type",Fu]};function ea(e){return CSS.escape(e)}var XB={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function y0(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return XB[t]})}var ju=50,ZB=new Xr,v0={min:.2,max:4},JB=10,QB=.1,eN=250,tN=100,nN=2e3;function Hn(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=ZB.next(),this._init(),this.toggle(this._config.open||!1);function a(u){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var p=Hu({x:u.x-r._state._svgClientRect.left,y:u.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg(p,r._canvas),r._update()}function s(u){return function(d){var f=ag(d);(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),u&&a(f);var m=Hu({x:f.x-r._state._svgClientRect.left,y:f.y-r._state._svgClientRect.top},r._svg,r._lastViewbox),g=i.viewbox(),y=oN(m,g),_=r._viewportDom.getBoundingClientRect(),h={x:f.x-_.left+1,y:f.y-_.top+1};Z(r._state,{cachedViewbox:g,initialDragPosition:{x:f.x,y:f.y},isDragging:!0,offsetViewport:y,offsetViewportDom:h,viewportClientRect:r._viewport.getBoundingClientRect(),parentClientRect:r._parent.getBoundingClientRect()}),Ye.bind(document,"mousemove",c),Ye.bind(document,"mouseup",l)}}function c(u){var p=ag(u);if(r._state.isDragging){(!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect());var d=r._state.offsetViewportDom,f=r._state.viewportClientRect,m=r._state.parentClientRect;Z(r._viewportDom.style,{top:p.y-d.y-m.top+"px",left:p.x-d.x-m.left+"px"});var g=b0(m,{top:p.y-d.y-m.top,left:p.x-d.x-m.left,width:f.width,height:f.height});Z(r._overlay.style,{clipPath:g});var y=Hu({x:p.x-r._state._svgClientRect.left,y:p.y-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg({x:y.x-r._state.offsetViewport.x,y:y.y-r._state.offsetViewport.y},r._canvas)}}function l(u){var p=ag(u);r._state.isDragging&&(r._state.initialDragPosition.x===p.x&&r._state.initialDragPosition.y===p.y&&a(u),r._update(),Z(r._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),Ye.unbind(document,"mousemove",c),Ye.unbind(document,"mouseup",l))}Ye.bind(this._viewportDom,"mousedown",s(!1)),Ye.bind(this._svg,"mousedown",s(!0)),Ye.bind(this._parent,"wheel",function(u){if(u.preventDefault(),u.stopPropagation(),!!u.ctrlKey&&((!r._state._svgClientRect||zu(r._state._svgClientRect))&&(r._state._svgClientRect=r._svg.getBoundingClientRect()),!!lN(u,r._state._svgClientRect))){var p=u.deltaMode===0?.02:.32,d=Math.sqrt(Math.pow(u.deltaY,2)+Math.pow(u.deltaX,2))*uN(u.deltaY)*-p;if(r._state.zoomDelta+=d,Math.abs(r._state.zoomDelta)>QB){var f=d>0?1:-1,m=Math.log(i.zoom())/Math.log(10),g=pN(v0,JB*2),y=Math.round(m/g)*g;y+=g*f;var _=Math.pow(10,y);i.zoom(dN(v0,_),h),r._state.zoomDelta=0;var h=Hu({x:u.clientX-r._state._svgClientRect.left,y:u.clientY-r._state._svgClientRect.top},r._svg,r._lastViewbox);rg(h,r._canvas),r._update()}}}),Ye.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",eN,function(u){if(!r.isOpen()){r._dirty=!0;return}u.elements.forEach(function(p){r._updateElement(p)}),r._scheduleUpdate()}),n.on("element.updateId",function(u){var p=u.element,d=u.newId;r._updateElementId(p,d)}),n.on("canvas.viewbox.changed",function(){r._state.isDragging||r._update()}),n.on("canvas.resized",function(){document.body.contains(r._parent)&&(r._state.isDragging||r._update(),r._state._svgClientRect=r._svg.getBoundingClientRect())}),n.on(["root.set","plane.set"],function(u){if(!r.isOpen()){r._dirty=!0;return}r._clear();var p=u.element||u.plane.rootElement;p.children.forEach(function(d){r._addElement(d)}),r._update()}),n.on("diagram.destroy",function(){r._updateTimeout&&(clearTimeout(r._updateTimeout),r._updateTimeout=null)})}Hn.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Hn.prototype._init=function(){var e=this._canvas,t=e.getContainer(),n=this._parent=document.createElement("div");Pt(n).add("djs-minimap").add("bio-theme-parent"),t.appendChild(n);var i=this._toggle=document.createElement("div");Pt(i).add("toggle"),n.appendChild(i);var o=this._map=document.createElement("div");Pt(o).add("map"),n.appendChild(o);var r=this._svg=He("svg");De(r,{width:"100%",height:"100%"}),ot(o,r);var a=this._elementsGroup=He("g");ot(r,a);var s=this._viewportGroup=He("g");ot(r,s);var c=this._viewport=He("rect");mt(c).add("viewport"),ot(s,c),Ye.bind(n,"mousedown",function(p){p.stopPropagation()});var l=this._viewportDom=document.createElement("div");Pt(l).add("viewport-dom"),this._parent.appendChild(l);var u=this._overlay=document.createElement("div");Pt(u).add("overlay"),this._parent.appendChild(u)},Hn.prototype._scheduleUpdate=function(){var e=this;if(this.isOpen()){var t=et(this._config.debounceDelay)?this._config.debounceDelay:tN,n=et(this._config.debounceSkipDelay)?this._config.debounceSkipDelay:nN,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)}},Hn.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)})}},Hn.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(w0(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-ju,o=o-ju,r=r+ju*2,a=a+ju*2,this._lastViewbox={x:i,y:o,width:r,height:a},De(this._svg,{viewBox:i+", "+o+", "+r+", "+a}),De(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};Z(this._viewportDom.style,{top:p.top+"px",left:p.left+"px",width:p.width+"px",height:p.height+"px"});var d=b0(l,p);Z(this._overlay.style,{clipPath:d})}}},Hn.prototype.open=function(){Z(this._state,{isOpen:!0}),Pt(this._parent).add("open");var e=this._injector.get("translate",!1)||function(t){return t};Tn(this._toggle,"title",e("Close minimap")),this._dirty&&(this._rebuild(),this._dirty=!1),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Hn.prototype.close=function(){Z(this._state,{isOpen:!1}),Pt(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(t){return t};Tn(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Hn.prototype.toggle=function(e){var t=this.isOpen();typeof e>"u"&&(e=!t),e!=t&&(e?this.open():this.close())},Hn.prototype.isOpen=function(){return this._state.isOpen},Hn.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)}},Hn.prototype._updateElementId=function(e,t){try{var n=Ct("#"+ea(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(i){console.warn("Minimap#_updateElementId errored",i)}},Hn.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():t.findPlane?t.findPlane(e)===t.getActivePlane():!0},Hn.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=Ct("#"+ea(this._prefixId(e.parent.id)),this._elementsGroup);if(r){var s=aN(e);return s!==-1?a?sN(r,a,s):this._elementsGroup.appendChild(r):this._elementsGroup.appendChild(r),iN(e)?(n=e.parent,i=0,o=0,typeof n.x<"u"&&typeof n.y<"u"&&(i=-n.x,o=-n.y),De(r,{transform:"translate("+i+" "+o+")"})):(i=e.x,o=e.y,a&&(n=e.parent,i-=n.x,o-=n.y),De(r,{transform:"translate("+i+" "+o+")"})),e.children&&e.children.length&&e.children.forEach(function(c){t._addElement(c)}),r}}},Hn.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&pn(t)},Hn.prototype._createElement=function(e){var t=this._elementRegistry.getGraphics(e),n;if(t&&(n=nr(t),n)){var i=fN(Kd(n));return De(i,{id:this._prefixId(e.id)}),i}},Hn.prototype._clear=function(){Cs(this._elementsGroup)},Hn.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};function iN(e){return e.waypoints}function oN(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 Hu(e,t,n){var i=t.getBoundingClientRect(),o=rN(n,i.width/i.height),r=x0(e.x,0,i.width,o.x,o.x+o.width),a=x0(e.y,0,i.height,o.y,o.y+o.height);return{x:r,y:a}}function rg(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 rN(e,t){var n=e.width/e.height,i=Z({},{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;Z(i,{y:r,height:o})}else if(n<t){var a=i.height*t,s=i.x-(a-i.width)/2;Z(i,{x:s,width:a})}return i}function x0(e,t,n,i,o){var r=n-t,a=o-i;return(e-t)*a/r+i}function aN(e){var t=e.parent;return!t||!t.children?-1:t.children.indexOf(e)}function sN(e,t,n){var i=cN(t),o=i[n];o?t.insertBefore(e,o):t.appendChild(e)}function cN(e){return Array.from(e.childNodes).filter(function(t){return t.id})}function zu(e){return e.width===0&&e.height===0}function lN(e,t){return e.x>t.left&&e.x<t.left+t.width&&e.y>t.top&&e.y<t.top+t.height}var uN=Math.sign||function(e){return e>=0?1:-1};function pN(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 dN(e,t){return Math.max(e.min,Math.min(e.max,t))}function b0(e,t){var n=[uo(t.left,t.top),uo(t.left+t.width,t.top),uo(t.left+t.width,t.top+t.height),uo(t.left,t.top+t.height),uo(t.left,e.height),uo(e.width,e.height),uo(e.width,0),uo(0,0),uo(0,e.height),uo(t.left,e.height)].join(", ");return"polygon("+n+")"}function uo(e,t){return e+"px "+t+"px"}function w0(e){return zo(e,function(t){return bn(t)?w0(t):et(t)&&isFinite(t)})}function ag(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}function fN(e){return Ms("[id]",e).forEach(function(t){t.remove()}),e}var hN={__init__:["minimap"],minimap:["type",Hn]};const _0={closed:"미니맵",open:"접기"};class E0{constructor(t,n,i){this.minimap=n,this.canvas=i,t.on(fc,()=>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?_0.open:_0.closed)}}ln(E0,"$inject",["eventBus","minimap","canvas"]);const S0=[h0,{__depends__:[hN],__init__:["minimapI18n"],minimapI18n:["type",E0]},t0,o0,dv,m0];var gN=new Xr("ov"),mN=500;function Pn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=gN,this._overlayDefaults=Z({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=yN(n.getContainer()),this._init()}Pn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Pn.prototype.get=function(e){if(ri(e)&&(e={id:e}),ri(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ft(t.overlays,ma({type:e.type})):t.overlays.slice():[]}else return e.type?ft(this._overlays,ma({type:e.type})):e.id?this._overlays[e.id]:null},Pn.prototype.add=function(e,t,n){if(bn(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=Z({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Pn.prototype.remove=function(e){var t=this.get(e)||[];Qe(t)||(t=[t]);var n=this;U(t,function(i){var o=n._getOverlayContainer(i.element,!0);if(i&&(no(i.html),no(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),o){var r=o.overlays.indexOf(i);r!==-1&&o.overlays.splice(r,1)}})},Pn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Pn.prototype.show=function(){Gu(this._overlayRoot)},Pn.prototype.hide=function(){Gu(this._overlayRoot,!1)},Pn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],xl(this._overlayRoot)},Pn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,o=t.y;if(t.waypoints){var r=dn(t);i=r.x,o=r.y}R0(n,i,o),Tn(e.html,"data-container-id",t.id)},Pn.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,o=t.left,r=t.top;if(t.right!==void 0){var a;i.waypoints?a=dn(i).width:a=i.width,o=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=dn(i).height:s=i.height,r=t.bottom*-1+s}R0(n,o||0,r||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Pn.prototype._createOverlayContainer=function(e){var t=Vt('<div class="djs-overlays" />');Kn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Pn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";M0(this._overlayRoot,n)},Pn.prototype._getOverlayContainer=function(e,t){var n=$t(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Pn.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,o,r;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),ri(i)&&(i=Vt(i)),r=this._getOverlayContainer(n),o=Vt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Kn(o,{position:"absolute"}),o.appendChild(i),e.type&&Pt(o).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Gu(o,a===s),e.htmlContainer=o,r.overlays.push(e),r.html.appendChild(o),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Pn.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),o=n&&n.minZoom,r=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(xn(o)&&o>t.scale||xn(r)&&r<t.scale))&&(c=!1),Gu(a,c),this._updateOverlayScale(e,t)},Pn.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,o,r=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,o=1):(i=n.min,o=n.max),xn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),xn(o)&&t.scale>o&&(a=(1/t.scale||1)*o)),xn(a)&&(s="scale("+a+","+a+")"),M0(r,s)},Pn.prototype._updateOverlaysVisibilty=function(e){var t=this;U(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Pn.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var o=i.element,r=t.get({element:o});U(r,function(c){t.remove(c.id)});var a=t._getOverlayContainer(o);if(a){no(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",mN,function(i){var o=i.element,r=t._getOverlayContainer(o,!0);r&&(U(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&&Pt(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 yN(e){var t=Vt('<div class="djs-overlay-container" />');return Kn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function R0(e,t,n){Kn(e,{left:t+"px",top:n+"px"})}function Gu(e,t){e.style.display=t===!1?"none":""}function M0(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Vu={__init__:["overlays"],overlays:["type",Pn]};function sg(e,t){t.invoke(_e,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ne(sg,_e),sg.$inject=["canvas","injector"];const vN={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",sg]};var xN="bjs-breadcrumbs-shown";function C0(e,t,n){var i=Vt('<ul class="bjs-breadcrumbs"></ul>'),o=n.getContainer(),r=Pt(o);o.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=Ee(l),p=$t(a,function(d){return d===u});p&&s()});function s(c){c&&(a=bN(c));var l=a.flatMap(function(p){var d=n.findRoot(so(p))||n.findRoot(p.id);if(!d&&A(p,"bpmn:Process")){var f=t.find(function(y){var _=Ee(y);return _&&_.get("processRef")===p});d=f&&n.findRoot(f.id)}if(!d)return[];var m=y0(p.name||p.id),g=Vt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return g.addEventListener("click",function(){n.setRootElement(d)}),g});i.innerHTML="";var u=l.length>1;r.toggle(xN,u),l.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}C0.$inject=["eventBus","elementRegistry","canvas"];function bN(e){for(var t=Ee(e),n=[],i=t;i;i=i.$parent)(A(i,"bpmn:SubProcess")||A(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function A0(e,t){var n=null,i=new wN;e.on("root.set",function(o){var r=o.element,a=t.viewbox(),s=i.get(r);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=r,!(!A(r,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}A0.$inject=["eventBus","canvas"];function wN(){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 T0={x:180,y:160};function ta(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,o){n._handleImport(o.definitions)})}ta.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)})}},ta.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(r){var a=r.bpmnElement;if(a){var s=a.$parent;A(a,"bpmn:SubProcess")&&!r.isExpanded&&n.push(a),EN(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},ta.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=_N(e),i={x:n.x-T0.x,y:n.y-T0.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)})},ta.prototype._moveToDiPlane=function(e,t){var n=P0(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},ta.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},ta.$inject=["eventBus","moddle"];function P0(e){return A(e,"bpmndi:BPMNDiagram")?e:P0(e.$parent)}function _N(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=Ze(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ml(t)}function EN(e,t){var n=e.$parent;return!(!A(n,"bpmn:SubProcess")||n===t.bpmnElement||dt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Wu=250,SN='<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>',RN="bjs-drilldown-empty";function mr(e,t,n,i,o){_e.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=o;var r=this;this.executed("shape.toggleCollapse",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Wu,function(a){var s=a.shape;r._canDrillDown(s)?r._addOverlay(s):r._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Wu,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"],Wu,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)})})}Ne(mr,_e),mr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},mr.prototype._canDrillDown=function(e){var t=this._canvas;return A(e,"bpmn:SubProcess")&&t.findRoot(so(e))},mr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Ee(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var o=n&&n.get("flowElements")&&n.get("flowElements").length;Pt(i.html).toggle(RN,!o)}},mr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Ee(e),o=n.get({element:e,type:"drilldown"});o.length&&this._removeOverlay(e);var r=Vt('<button type="button" class="bjs-drilldown">'+SN+"</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(so(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:r}),this._updateOverlayVisibility(e)},mr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},mr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const MN={__depends__:[Vu,Ph,vN],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",C0],drilldownCentering:["type",A0],drilldownOverlayBehavior:["type",mr],subprocessCompatibility:["type",ta]};function yr(e){Xt.call(this,e)}Ne(yr,Xt),yr.prototype._modules=[Zx,MN,Vu,Pi,js],yr.prototype._moddleExtensions={};var Uu="keyboard.keydown",CN="keyboard.keyup",AN=1e3,k0="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 Xn(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(k0));var i=e&&e.bind!==!1;t.on("canvas.init",function(o){n._target=o.svg,i&&n.bind(),n._fire("init")})}Xn.$inject=["config.keyboard","eventBus"],Xn.prototype._keydownHandler=function(e){this._keyHandler(e,Uu)},Xn.prototype._keyupHandler=function(e){this._keyHandler(e,CN)},Xn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Uu,i),n&&e.preventDefault()}},Xn.prototype._isEventIgnored=function(e){return!1},Xn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(k0)),this.unbind(),e=this._node=this._target,Ye.bind(e,"keydown",this._keydownHandler),Ye.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Xn.prototype.getBinding=function(){return this._node},Xn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ye.unbind(e,"keydown",this._keydownHandler),Ye.unbind(e,"keyup",this._keyupHandler)),this._node=null},Xn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Xn.prototype.addListener=function(e,t,n){Sn(e)&&(n=t,t=e,e=AN),this._eventBus.on(n||Uu,e,t)},Xn.prototype.removeListener=function(e,t){this._eventBus.off(t||Uu,e)},Xn.prototype.hasModifier=cL,Xn.prototype.isCmd=di,Xn.prototype.isShift=xh,Xn.prototype.isKey=_n;var TN=500;function Ua(e,t){var n=this;e.on("editorActions.init",TN,function(i){var o=i.editorActions;n.registerBindings(t,o)})}Ua.$inject=["eventBus","keyboard"],Ua.prototype.registerBindings=function(e,t){function n(i,o){t.isRegistered(i)&&e.addListener(o)}n("undo",function(i){var o=i.keyEvent;if(fL(o))return t.trigger("undo"),!0}),n("redo",function(i){var o=i.keyEvent;if(hL(o))return t.trigger("redo"),!0}),n("copy",function(i){var o=i.keyEvent;if(lL(o))return t.trigger("copy"),!0}),n("paste",function(i){var o=i.keyEvent;if(uL(o))return t.trigger("paste"),!0}),n("duplicate",function(i){var o=i.keyEvent;if(pL(o))return t.trigger("duplicate"),!0}),n("cut",function(i){var o=i.keyEvent;if(dL(o))return t.trigger("cut"),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(_n(["+","Add","="],o)&&di(o))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var o=i.keyEvent;if(_n(["-","Subtract"],o)&&di(o))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var o=i.keyEvent;if(_n("0",o)&&di(o))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var o=i.keyEvent;if(_n(["Backspace","Delete","Del"],o))return t.trigger("removeSelection"),!0})};const cg={__init__:["keyboard","keyboardBindings"],keyboard:["type",Xn],keyboardBindings:["type",Ua]};var PN={moveSpeed:50,moveSpeedAccelerated:200};function O0(e,t,n){var i=this;this._config=Z({},PN,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})}}O0.$inject=["config.keyboardMove","keyboard","canvas"];const D0={__depends__:[cg],__init__:["keyboardMove"],keyboardMove:["type",O0]};var kN=15;function L0(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=qr(s),p=Wi(u,c);if(!n.dragging&&ON(p)>kN&&(n.dragging=!0,l===0&&Nw(e),uu("grab")),n.dragging){var d=n.last||n.start;p=Wi(u,d),t.scroll({dx:p.x,dy:p.y}),n.last=u}s.preventDefault()}function r(s){Ye.unbind(document,"mousemove",o),Ye.unbind(document,"mouseup",r),n=null,Bw()}function a(s){if(!Hr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:qr(s)},Ye.bind(document,"mousemove",o),Ye.bind(document,"mouseup",r),!0}}this.isActive=function(){return!!n}}L0.$inject=["eventBus","canvas"];function ON(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const I0={__init__:["moveCanvas"],moveCanvas:["type",L0]};function B0(e,t){var n=mf(e.min),i=mf(e.max),o=Math.abs(n)+Math.abs(i);return o/t}function DN(e,t){return Math.max(e.min,Math.min(e.max,t))}var LN=Math.sign||function(e){return e>=0?1:-1},lg={min:.2,max:4},N0=10,IN=.1,BN=.75;function po(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||BN;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}po.$inject=["config.zoomScroll","eventBus","canvas"],po.prototype.scroll=function(t){this._canvas.scroll(t)},po.prototype.reset=function(){this._canvas.zoom("fit-viewport")},po.prototype.zoom=function(t,n){var i=B0(lg,N0*2);this._totalDelta+=t,Math.abs(this._totalDelta)>IN&&(this._zoom(t,n,i),this._totalDelta=0)},po.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Vb()&&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))*LN(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)}},po.prototype.stepZoom=function(t,n){var i=B0(lg,N0);this._zoom(t,n,i)},po.prototype._zoom=function(e,t,n){var i=this._canvas,o=e>0?1:-1,r=mf(i.zoom()),a=Math.round(r/n)*n;a+=n*o;var s=Math.pow(10,a);i.zoom(DN(lg,s),t)},po.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,o=this._enabled;return typeof t>"u"&&(t=!o),o!==t&&Ye[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},po.prototype._init=function(e){this.toggle(e)};const $0={__init__:["zoomScroll"],zoomScroll:["type",po]};function hc(e){yr.call(this,e)}Ne(hc,yr),hc.prototype._navigationModules=[D0,I0,$0],hc.prototype._modules=[].concat(yr.prototype._modules,hc.prototype._navigationModules);function ug(e){return e&&e[e.length-1]}function F0(e){return e.y}function j0(e){return e.x}var NN={left:j0,center:j0,right:function(e){return e.x+e.width},top:F0,middle:F0,bottom:function(e){return e.y+e.height}};function qa(e,t){this._modeling=e,this._rules=t}qa.$inject=["modeling","rules"],qa.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}},qa.prototype._isType=function(e,t){return t.indexOf(e)!==-1},qa.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,o=n.dimension,r={},a={},s=!1,c,l,u;function p(d,f){return Math.round((d[i]+f[i]+f[o])/2)}if(this._isType(e,["left","top"]))r[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=ug(t),r[e]=u[i]+u[o];else if(this._isType(e,["center","middle"])){if(U(t,function(d){var f=d[i]+Math.round(d[o]/2);a[f]?a[f].elements.push(d):a[f]={elements:[d],center:f}}),c=Xi(a,function(d){return d.elements.length>1&&(s=!0),d.elements.length}),s)return r[e]=ug(c).center,r;l=t[0],t=Xi(t,function(d){return d[i]+d[o]}),u=ug(t),r[e]=p(l,u)}return r},qa.prototype.trigger=function(e,t){var n=this._modeling,i,o=ft(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:o}),Qe(i)&&(o=i),!(o.length<2||!i)){var r=NN[t],a=Xi(o,r),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const $N={__init__:["alignElements"],alignElements:["type",qa]},FN=new Xr;function Ya(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Ya.$inject=["eventBus"],Ya.prototype.schedule=function(e,t=FN.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Ya.prototype._schedule=function(e,t){const n=jN();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}},Ya.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Ya.prototype._cancel=function(e){clearTimeout(e.executionId)};function jN(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const HN={scheduler:["type",Ya]};var zN="djs-element-hidden",qu=".entry",GN=1e3,H0=8,VN=300;function hn(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}hn.$inject=["canvas","elementRegistry","eventBus","scheduler"],hn.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=Qe(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=Qe(i.target)?i.target:[i.target];o.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},hn.prototype._createContainer=function(){var e=Vt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},hn.prototype.registerProvider=function(e,t){t||(t=e,e=GN),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},hn.prototype.getEntries=function(e){var t=this._getProviders(),n=Qe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return U(t,function(o){if(Sn(o[n])){var r=o[n](e);Sn(r)?i=r(i):U(r,function(a,s){i[s]=a})}}),i},hn.prototype.trigger=function(e,t,n){var i=this,o,r,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(o=Tn(a,"data-action"),r=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(o,"hover",r,n)},VN);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(o,e,r,n)},hn.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(Sn(s)){if(t==="click")return s(n,o,i)}else if(s[t])return s[t](n,o,i);n.preventDefault()}}}},hn.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))}},hn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},hn.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;U(t,function(o,r){var a=o.group||"default",s=Vt(o.html||'<div class="entry" draggable="true"></div>'),c;Tn(s,"data-action",r),c=Ct("[data-group="+ea(a)+"]",n),c||(c=Vt('<div class="group"></div>'),Tn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),o.className&&WN(s,o.className),o.title&&Tn(s,"title",o.title),o.imageUrl&&(i=Vt("<img>"),Tn(i,"src",o.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Pt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},hn.prototype._createHtml=function(e){var t=this,n=Vt('<div class="djs-context-pad"></div>');return ci.bind(n,qu,"click",function(i){t.trigger("click",i)}),ci.bind(n,qu,"dragstart",function(i){t.trigger("dragstart",i)}),ci.bind(n,qu,"mouseover",function(i){t.trigger("mouseover",i)}),ci.bind(n,qu,"mouseout",function(i){t.trigger("mouseout",i)}),Ye.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},hn.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()&&qN(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},hn.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},hn.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Qe(e)!==Qe(n)?!1:Qe(e)?e.length===n.length&&zo(e,function(i){return n.includes(i)}):n===e},hn.prototype.isShown=function(){return this.isOpen()&&Pt(this._current.html).has("open")},hn.prototype.show=function(){this.isOpen()&&(Pt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},hn.prototype.hide=function(){this.isOpen()&&(Pt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},hn.prototype._getPosition=function(e){if(!Qe(e)&&Lt(e)){var t=this._canvas.viewbox(),n=UN(e),i=n.x*t.scale-t.x*t.scale,o=n.y*t.scale-t.y*t.scale;return{left:i+H0*this._canvas.zoom(),top:o}}var r=this._canvas.getContainer(),a=r.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+H0*this._canvas.zoom(),top:s.top-a.top}},hn.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")},hn.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Qe(n)?n:[n],o=i.some(function(r){return t._canvas.hasMarker(r,zN)});o?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},hn.prototype._getTargetBounds=function(e){var t=this,n=Qe(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 WN(e,t){var n=Pt(e);t=Qe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function UN(e){return e.waypoints[e.waypoints.length-1]}function qN(e,t){return e=Qe(e)?e:[e],t=Qe(t)?t:[t],e.length===t.length&&zo(e,function(n){return t.includes(n)})}const z0={__depends__:[lu,HN,Vu],contextPad:["type",hn]};var Yu,Jt,G0,vr,V0,W0,U0,pg,Ku,gc,q0,dg,fg,hg,Xu={},Zu=[],YN=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ju=Array.isArray;function Io(e,t){for(var n in t)e[n]=t[n];return e}function gg(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Y0(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?Yu.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 Qu(e,a,i,o,null)}function Qu(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??++G0,__i:-1,__u:0};return o==null&&Jt.vnode!=null&&Jt.vnode(r),r}function ep(e){return e.children}function tp(e,t){this.props=e,this.context=t}function na(e,t){if(t==null)return e.__?na(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"?na(e):null}function KN(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],o=[],r=Io({},t);r.__v=t.__v+1,Jt.vnode&&Jt.vnode(r),mg(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??na(t),!!(32&t.__u),o),r.__v=t.__v,r.__.__k[r.__i]=r,nE(i,r,o),t.__e=t.__=null,r.__e!=n&&K0(r)}}function K0(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}),K0(e)}function X0(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!np.__r++||V0!=Jt.debounceRendering)&&((V0=Jt.debounceRendering)||W0)(np)}function np(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(U0),e=vr.shift(),t=vr.length,KN(e)}finally{vr.length=np.__r=0}}function Z0(e,t,n,i,o,r,a,s,c,l,u){var p,d,f,m,g,y,_=i&&i.__k||Zu,h=t.length;for(c=XN(n,t,_,c,h),p=0;p<h;p++)(f=n.__k[p])!=null&&(d=f.__i!=-1&&_[f.__i]||Xu,f.__i=p,y=mg(e,f,d,o,r,a,s,c,l,u),m=f.__e,f.ref&&d.ref!=f.ref&&(d.ref&&yg(d.ref,null,f),u.push(f.ref,f.__c||m,f)),g==null&&m!=null&&(g=m),4&f.__u?(c=J0(f,c,e),d.__e&&(d.__e=null)):typeof f.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function XN(e,t,n,i,o){var r,a,s,c,l,u=n.length,p=u,d=0;for(e.__k=new Array(o),r=0;r<o;r++)(a=t[r])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[r]=Qu(null,a,null,null,null):Ju(a)?a=e.__k[r]=Qu(ep,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[r]=Qu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[r]=a,c=r+d,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=ZN(a,n,c,p))!=-1&&(p--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(o>u?d--:o<u&&d++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?d--:l==c+1?d++:(l>c?d--:d++,a.__u|=4))):e.__k[r]=null;if(p)for(r=0;r<u;r++)(s=n[r])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=na(s)),oE(s,s));return i}function J0(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=J0(i[o],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=na(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function ZN(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 Q0(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||YN.test(t)?n:n+"px"}function ip(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||Q0(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Q0(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(q0,"$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[gc]=i[gc]:(n[gc]=dg,e.addEventListener(t,r?hg:fg,r)):e.removeEventListener(t,r?hg:fg,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 eE(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ku]==null)t[Ku]=dg++;else if(t[Ku]<n[gc])return;return n(Jt.event?Jt.event(t):t)}}}function mg(e,t,n,i,o,r,a,s,c,l){var u,p,d,f,m,g,y,_,h,v,b,E,M,B,P,k,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),r=[s=t.__e=n.__e]),(u=Jt.__b)&&u(t);e:if(typeof N=="function"){p=a.length;try{if(h=t.props,v=N.prototype&&N.prototype.render,b=(u=N.contextType)&&i[u.__c],E=u?b?b.props.value:u.__:i,n.__c?_=(d=t.__c=n.__c).__=d.__E:(v?t.__c=d=new N(h,E):(t.__c=d=new tp(h,E),d.constructor=N,d.render=QN),b&&b.sub(d),d.state||(d.state={}),d.__n=i,f=d.__d=!0,d.__h=[],d._sb=[]),v&&d.__s==null&&(d.__s=d.state),v&&N.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Io({},d.__s)),Io(d.__s,N.getDerivedStateFromProps(h,d.__s))),m=d.props,g=d.state,d.__v=t,f)v&&N.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),v&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(v&&N.getDerivedStateFromProps==null&&h!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(h,E),t.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(h,d.__s,E)===!1){t.__v!=n.__v&&(d.props=h,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(G){G&&(G.__=t)}),Zu.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&a.push(d),s=na(n);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(h,d.__s,E),v&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,g,y)})}if(d.context=E,d.props=h,d.__P=e,d.__e=!1,M=Jt.__r,B=0,v)d.state=d.__s,d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),Zu.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,M&&M(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++B<25);d.state=d.__s,d.getChildContext!=null&&(i=Io(Io({},i),d.getChildContext())),v&&!f&&d.getSnapshotBeforeUpdate!=null&&(y=d.getSnapshotBeforeUpdate(m,g)),P=u!=null&&u.type===ep&&u.key==null?iE(u.props.children):u,s=Z0(e,Ju(P)?P:[P],t,n,i,o,r,a,s,c,l),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),_&&(d.__E=d.__=null)}catch(G){if(a.length=p,t.__v=null,c||r!=null){if(G.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(k=r.length;k--;)gg(r[k])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),G.then||tE(t),Jt.__e(G,t,n)}}else r==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=JN(n.__e,t,n,i,o,r,a,c,l);return(u=Jt.diffed)&&u(t),128&t.__u?void 0:s}function tE(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(tE))}function nE(e,t,n){for(var i=0;i<n.length;i++)yg(n[i],n[++i],n[++i]);Jt.__c&&Jt.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(r){r.call(o)})}catch(r){Jt.__e(r,o.__v)}})}function iE(e){return typeof e!="object"||e==null||e.__b>0?e:Ju(e)?e.map(iE):e.constructor!==void 0?null:Io({},e)}function JN(e,t,n,i,o,r,a,s,c){var l,u,p,d,f,m,g,y=n.props||Xu,_=t.props,h=t.type;if(h=="svg"?o="http://www.w3.org/2000/svg":h=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(l=0;l<r.length;l++)if((f=r[l])&&"setAttribute"in f==!!h&&(h?f.localName==h:f.nodeType==3)){e=f,r[l]=null;break}}if(e==null){if(h==null)return document.createTextNode(_);e=document.createElementNS(o,h,_.is&&_),s&&(Jt.__m&&Jt.__m(t,r),s=!1),r=null}if(h==null)y===_||s&&e.data==_||(e.data=_);else{if(r=h=="textarea"&&_.defaultValue!=null?null:r&&Yu.call(e.childNodes),!s&&r!=null)for(y={},l=0;l<e.attributes.length;l++)y[(f=e.attributes[l]).name]=f.value;for(l in y)f=y[l],l=="dangerouslySetInnerHTML"?p=f:l=="children"||l in _||l=="value"&&"defaultValue"in _||l=="checked"&&"defaultChecked"in _||ip(e,l,null,f,o);for(l in _)f=_[l],l=="children"?d=f:l=="dangerouslySetInnerHTML"?u=f:l=="value"?m=f:l=="checked"?g=f:s&&typeof f!="function"||y[l]===f||ip(e,l,f,y[l],o);if(u)s||p&&(u.__html==p.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(p&&(e.innerHTML=""),Z0(t.type=="template"?e.content:e,Ju(d)?d:[d],t,n,i,h=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,a,r?r[0]:n.__k&&na(n,0),s,c),r!=null)for(l=r.length;l--;)gg(r[l]);s&&h!="textarea"||(l="value",h=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||h=="progress"&&!m||h=="option"&&m!=y[l])&&ip(e,l,m,y[l],o),l="checked",g!=null&&g!=e[l]&&ip(e,l,g,y[l],o))}return e}function yg(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){Jt.__e(o,n)}}function oE(e,t,n){var i,o;if(Jt.unmount&&Jt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||yg(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){Jt.__e(r,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(o=0;o<i.length;o++)i[o]&&oE(i[o],t,n||typeof e.type!="function");n||gg(e.__e),e.__c=e.__=e.__e=void 0}function QN(e,t,n){return this.constructor(e,n)}function rE(e,t,n){var i,o,r,a;t==document&&(t=document.documentElement),Jt.__&&Jt.__(e,t),o=(i=!1)?null:t.__k,r=[],a=[],mg(t,e=t.__k=Y0(ep,null,[e]),o||Xu,Xu,t.namespaceURI,o?null:t.firstChild?Yu.call(t.childNodes):null,r,o?o.__e:t.firstChild,i,a),nE(r,e,a),e.props.children=null}Yu=Zu.slice,Jt={__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}},G0=0,tp.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Io({},this.state),typeof e=="function"&&(e=e(Io({},n),this.props)),e&&Io(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),X0(this))},tp.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),X0(this))},tp.prototype.render=ep,vr=[],W0=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,U0=function(e,t){return e.__v.__b-t.__v.__b},np.__r=0,pg=Math.random().toString(8),Ku="__d"+pg,gc="__a"+pg,q0=/(PointerCapture)$|Capture$/i,dg=0,fg=eE(!1),hg=eE(!0);var aE=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,aE(e,s,n,["",null])),i.push(o),s[0]?t[0]|=2:(t[r-2]=0,t[r]=o)):i.push(s)}return i},sE=new Map;function e$(e){var t=sE.get(this);return t||(t=new Map,sE.set(this,t)),(t=aE(this,t.get(e)||(t.set(e,t=(function(n){for(var i,o,r=1,a="",s="",c=[0],l=function(d){r===1&&(d||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,d,a):r===3&&(d||a)?(c.push(3,d,a),r=2):r===2&&a==="..."&&d?c.push(4,d,0):r===2&&a&&!d?c.push(5,0,!0,a):r>=5&&((a||!d&&r===5)&&(c.push(r,0,a,o),r=6),d&&(c.push(r,d,0,o),r=6)),a=""},u=0;u<n.length;u++){u&&(r===1&&l(),l(u));for(var p=0;p<n[u].length;p++)i=n[u][p],r===1?i==="<"?(l(),c=[c],r=3):a+=i:r===4?a==="--"&&i===">"?(r=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(l(),r=1):r&&(i==="="?(r=5,o=a,a=""):i==="/"&&(r<5||n[u][p+1]===">")?(l(),r===3&&(c=c[0]),r=c,(c=c[0]).push(2,0,r),r=0):i===" "||i===" "||i===`
10
+ `||i==="\r"?(l(),r=2):a+=i),r===3&&a==="!--"&&(r=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var Bt=e$.bind(Y0),Ka,gn,vg,cE,mc=0,lE=[],En=Jt,uE=En.__b,pE=En.__r,dE=En.diffed,fE=En.__c,hE=En.unmount,gE=En.__;function op(e,t){En.__h&&En.__h(gn,e,mc||t),mc=0;var n=gn.__H||(gn.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function xg(e){return mc=1,t$(yE,e)}function t$(e,t,n){var i=op(Ka++,2);if(i.t=e,!i.__c&&(i.__=[yE(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=gn,!gn.__f)){var o=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(f){if(f.__N){u=!0;var m=f.__[0];f.__=f.__N,f.__N=void 0,m!==f.__[0]&&(p=!0)}}),r){var d=r.call(this,s,c,l);return u?d||p:d}return!u||p};gn.__f=!0;var r=gn.shouldComponentUpdate,a=gn.componentWillUpdate;gn.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)},gn.shouldComponentUpdate=o}return i.__N||i.__}function rp(e,t){var n=op(Ka++,3);!En.__s&&_g(n.__H,t)&&(n.__=e,n.u=t,gn.__H.__h.push(n))}function bg(e,t){var n=op(Ka++,4);!En.__s&&_g(n.__H,t)&&(n.__=e,n.u=t,gn.__h.push(n))}function ap(e){return mc=5,Bo(function(){return{current:e}},[])}function Bo(e,t){var n=op(Ka++,7);return _g(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function yc(e,t){return mc=8,Bo(function(){return e},t)}function n$(){for(var e;e=lE.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(sp),t.__h.some(wg),t.__h=[]}catch(n){t.__h=[],En.__e(n,e.__v)}}}En.__b=function(e){gn=null,uE&&uE(e)},En.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gE&&gE(e,t)},En.__r=function(e){pE&&pE(e),Ka=0;var t=(gn=e.__c).__H;t&&(vg===gn?(t.__h=[],gn.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(sp),t.__h.some(wg),t.__h=[],Ka=0)),vg=gn},En.diffed=function(e){dE&&dE(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(lE.push(t)!==1&&cE===En.requestAnimationFrame||((cE=En.requestAnimationFrame)||i$)(n$)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),vg=gn=null},En.__c=function(e,t){t.some(function(n){try{n.__h.some(sp),n.__h=n.__h.filter(function(i){return!i.__||wg(i)})}catch(i){t.some(function(o){o.__h&&(o.__h=[])}),t=[],En.__e(i,n.__v)}}),fE&&fE(e,t)},En.unmount=function(e){hE&&hE(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{sp(i)}catch(o){t=o}}),n.__H=void 0,t&&En.__e(t,n.__v))};var mE=typeof requestAnimationFrame=="function";function i$(e){var t,n=function(){clearTimeout(i),mE&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);mE&&(t=requestAnimationFrame(n))}function sp(e){var t=gn,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),gn=t}function wg(e){var t=gn;e.__c=e.__(),gn=t}function _g(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function yE(e,t){return typeof t=="function"?t(e):t}function o$(e){const{navigationStack:t,setNavigationStack:n}=e,i=Bo(()=>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 Bt`
11
11
  <div class="djs-popup-breadcrumbs">
12
12
  ${o&&Bt`
13
13
  <button
@@ -40,7 +40,7 @@
40
40
  </span>
41
41
  `}
42
42
  </div>
43
- `}function vE(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=vE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function cp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=vE(e))&&(i&&(i+=" "),i+=t);return i}function o$(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Bo(()=>r$(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Bt`
43
+ `}function vE(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=vE(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function cp(){for(var e,t,n=0,i="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=vE(e))&&(i&&(i+=" "),i+=t);return i}function r$(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:o,title:r}=e,a=Bo(()=>a$(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Bt`
44
44
  <div class="djs-popup-header">
45
45
  <h3 class="djs-popup-title" title=${r}>${r}</h3>
46
46
  ${a.map(l=>Bt`
@@ -49,7 +49,7 @@
49
49
  ${l.entries.map(u=>Bt`
50
50
  <li key=${u.id}>
51
51
  <${s(u)?"button":"span"}
52
- class=${a$(u,u===i)}
52
+ class=${s$(u,u===i)}
53
53
  onClick=${p=>c(p,u)}
54
54
  title=${u.title||u.label}
55
55
  data-id=${u.id}
@@ -69,7 +69,7 @@
69
69
  </ul>
70
70
  `)}
71
71
  </div>
72
- `}function r$(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 a$(e,t){return cp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function xE(e,t){return`${e}-entry-${t.id}`}function s$(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 Bt`
72
+ `}function a$(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 s$(e,t){return cp("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function xE(e,t){return`${e}-entry-${t.id}`}function c$(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 Bt`
73
73
  <li
74
74
  class=${cp("entry",{selected:i,disabled:n.disabled})}
75
75
  data-id=${n.id}
@@ -130,7 +130,7 @@
130
130
  </div>
131
131
  `}
132
132
  </li>
133
- `}function c$(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=ap();bg(()=>{if(!o||!o.current)return;const g=p.current;if(!g)return;const y=g.querySelector(".selected");y&&l$(y)},[t]);const d=()=>{o.current=!1},f=g=>{o.current||n(g)},m=()=>{o.current||n(null)};return Bt`
133
+ `}function l$(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:o,idPrefix:r,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,p=ap();bg(()=>{if(!o||!o.current)return;const g=p.current;if(!g)return;const y=g.querySelector(".selected");y&&u$(y)},[t]);const d=()=>{o.current=!1},f=g=>{o.current||n(g)},m=()=>{o.current||n(null)};return Bt`
134
134
  <div
135
135
  class="djs-popup-results"
136
136
  ref=${p}
@@ -154,7 +154,7 @@
154
154
  aria-labelledby=${g.name?bE(r,g):void 0}
155
155
  >
156
156
  ${g.entries.map(y=>Bt`
157
- <${s$}
157
+ <${c$}
158
158
  key=${y.id}
159
159
  idPrefix=${r}
160
160
  entry=${y}
@@ -167,7 +167,7 @@
167
167
  </ul>
168
168
  `)}
169
169
  </div>
170
- `}function bE(e,t){return`${e}-group-${t.id}`}function l$(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const u$=new Xr("djs-popup");function p$(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:d,onOpened:f,onClosed:m}=e,[g,y]=xg([]);rp(()=>{y([])},[d]);const[_,h]=xg(""),v=_.trim().length>0,b=Bo(()=>h$(d),[d]),E=Bo(()=>xn(l)?b.length>5:!1,[l,b]),M=Bo(()=>{const V=g.length?g[g.length-1].entries:d;return E?v?p(b.filter(({searchable:X})=>X!==!1),_,{keys:["label","search","description"]}).map(({item:X})=>X):V.filter(({rank:X=0})=>X>=0):V},[E,v,b,_,p,g,d]),B=Bo(()=>v?M.length?[{id:"default",entries:M}]:[]:g$(M),[M,v]),[P,k]=xg(M[0]),N=ap(null),G=ap(!1),q=Bo(()=>u$.next(),[]),Y=`${q}-results`,re=P&&xE(q,P);rp(()=>{const V=N.current;V&&M.includes(V)?k(V):k(M[0]),N.current=null},[M]);const K=yc(V=>{const X=f$(B);let be=X.indexOf(P)+V;be<0&&(be=X.length-1),be>=X.length&&(be=0),G.current=!0,k(X[be])},[B,P]),Ce=yc(V=>{V>0&&P&&P.entries&&(G.current=!0,y(X=>[...X,P])),V<0&&g.length>0&&(G.current=!0,N.current=g[g.length+V],y(X=>X.slice(0,V)))},[P,g]),Ae=yc((V,X,ue)=>{if(!(!X||X.disabled))return X.entries?(V.preventDefault(),Ce(1)):n(V,X,ue)},[n,Ce]),Te=yc(V=>{if(V.key==="Enter"&&P){const X=V.target;return!!Hr(X,"a, button",!0)||P.disabled?void 0:Ae(V,P)}if(V.key==="Backspace"){const X=V.target;if(!(qd(X,"input")&&X.value!==""))return Ce(-1),V.preventDefault()}if(V.key==="ArrowUp")return K(-1),V.preventDefault();if(V.key==="ArrowDown")return K(1),V.preventDefault();if(V.key==="ArrowRight")return Ce(1),V.preventDefault();if(V.key==="ArrowLeft")return Ce(-1),V.preventDefault()},[P,K,Ce,Ae]),de=yc(V=>{qd(V.target,"input")&&h(()=>V.target.value)},[h]);rp(()=>(f(),()=>{m()}),[]);const z=!v&&g.length>0,oe=(a||o.length>0)&&!z;return Bt`
170
+ `}function bE(e,t){return`${e}-group-${t.id}`}function u$(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const p$=new Xr("djs-popup");function d$(e){const{onClose:t,onSelect:n,className:i,headerEntries:o,position:r,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:p,entries:d,onOpened:f,onClosed:m}=e,[g,y]=xg([]);rp(()=>{y([])},[d]);const[_,h]=xg(""),v=_.trim().length>0,b=Bo(()=>g$(d),[d]),E=Bo(()=>xn(l)?b.length>5:!1,[l,b]),M=Bo(()=>{const V=g.length?g[g.length-1].entries:d;return E?v?p(b.filter(({searchable:X})=>X!==!1),_,{keys:["label","search","description"]}).map(({item:X})=>X):V.filter(({rank:X=0})=>X>=0):V},[E,v,b,_,p,g,d]),B=Bo(()=>v?M.length?[{id:"default",entries:M}]:[]:m$(M),[M,v]),[P,k]=xg(M[0]),N=ap(null),G=ap(!1),q=Bo(()=>p$.next(),[]),Y=`${q}-results`,re=P&&xE(q,P);rp(()=>{const V=N.current;V&&M.includes(V)?k(V):k(M[0]),N.current=null},[M]);const K=yc(V=>{const X=h$(B);let be=X.indexOf(P)+V;be<0&&(be=X.length-1),be>=X.length&&(be=0),G.current=!0,k(X[be])},[B,P]),Ce=yc(V=>{V>0&&P&&P.entries&&(G.current=!0,y(X=>[...X,P])),V<0&&g.length>0&&(G.current=!0,N.current=g[g.length+V],y(X=>X.slice(0,V)))},[P,g]),Ae=yc((V,X,ue)=>{if(!(!X||X.disabled))return X.entries?(V.preventDefault(),Ce(1)):n(V,X,ue)},[n,Ce]),Te=yc(V=>{if(V.key==="Enter"&&P){const X=V.target;return!!Hr(X,"a, button",!0)||P.disabled?void 0:Ae(V,P)}if(V.key==="Backspace"){const X=V.target;if(!(qd(X,"input")&&X.value!==""))return Ce(-1),V.preventDefault()}if(V.key==="ArrowUp")return K(-1),V.preventDefault();if(V.key==="ArrowDown")return K(1),V.preventDefault();if(V.key==="ArrowRight")return Ce(1),V.preventDefault();if(V.key==="ArrowLeft")return Ce(-1),V.preventDefault()},[P,K,Ce,Ae]),de=yc(V=>{qd(V.target,"input")&&h(()=>V.target.value)},[h]);rp(()=>(f(),()=>{m()}),[]);const z=!v&&g.length>0,oe=(a||o.length>0)&&!z;return Bt`
171
171
  <${wE}
172
172
  onClose=${t}
173
173
  onKeyup=${de}
@@ -179,7 +179,7 @@
179
179
  navigationStack=${g}
180
180
  >
181
181
  ${oe&&Bt`
182
- <${o$}
182
+ <${r$}
183
183
  headerEntries=${o}
184
184
  onSelect=${n}
185
185
  selectedEntry=${P}
@@ -188,7 +188,7 @@
188
188
  />
189
189
  `}
190
190
  ${z&&Bt`
191
- <${i$}
191
+ <${o$}
192
192
  navigationStack=${g}
193
193
  setNavigationStack=${y}
194
194
  />
@@ -220,7 +220,7 @@
220
220
  </div>
221
221
  `}
222
222
 
223
- <${c$}
223
+ <${l$}
224
224
  groupedEntries=${B}
225
225
  selectedEntry=${P}
226
226
  setSelectedEntry=${k}
@@ -260,7 +260,7 @@
260
260
  `}function wE(e){const{onClose:t,onKeydown:n,onKeyup:i,className:o,children:r,navigationStack:a,position:s}=e,c=ap();return bg(()=>{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]),bg(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),rp(()=>{const l=p=>{if(p.key==="Escape")return p.preventDefault(),t()},u=p=>{if(!Hr(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)}},[]),Bt`
261
261
  <div
262
262
  class=${cp("djs-popup",o)}
263
- style=${d$(e)}
263
+ style=${f$(e)}
264
264
  onKeydown=${n}
265
265
  onKeyup=${i}
266
266
  ref=${c}
@@ -268,8 +268,8 @@
268
268
  >
269
269
  ${r}
270
270
  </div>
271
- `}function d$(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:xn(t)?n:void 0,maxWidth:xn(t)?"unset":void 0,"transform-origin":"top left"}}function f$(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function h$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function g$(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 m$="data-id",_E=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],y$=1e3;function Qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=xn(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}Qt.$inject=["config.popupMenu","eventBus","canvas","search"],Qt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=EE(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);rE(Bt`
272
- <${p$}
271
+ `}function f$(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:xn(t)?n:void 0,maxWidth:xn(t)?"unset":void 0,"transform-origin":"top left"}}function h$(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function g$(e){const t=[];function n(i){i.forEach(o=>{if(o.entries){n(o.entries);return}t.push(o)})}return n(e),t}function m$(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 y$="data-id",_E=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],v$=1e3;function Qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var o=xn(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:o},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",r=>{const a=this.isOpen()&&this._current.target;r.element===a&&this.refresh()})}Qt.$inject=["config.popupMenu","eventBus","canvas","search"],Qt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:o,options:r}=this._current,a=EE(n),s=Object.entries(i).map(([d,f])=>({id:d,...f})),c=e&&(d=>this._ensureVisible(d,e)),l=this._updateScale(this._current.container);rE(Bt`
272
+ <${d$}
273
273
  onClose=${d=>this.close(d)}
274
274
  onSelect=${(d,f,m)=>this.trigger(d,f,m)}
275
275
  position=${c}
@@ -283,7 +283,7 @@
283
283
  searchFn=${this._search}
284
284
  ...${{...r}}
285
285
  />
286
- `,this._current.container)},Qt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Qt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Qt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},Qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Qt.prototype.reset=function(){const e=this._current.container;rE(null,e),no(e)},Qt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Qt.prototype._onOpened=function(){this._emit("opened")},Qt.prototype._onClosed=function(){this._emit("closed")},Qt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Vt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Qt.prototype._bindAutoClose=function(){this._eventBus.once(_E,this.close,this)},Qt.prototype._unbindAutoClose=function(){this._eventBus.off(_E,this.close,this)},Qt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),xn(n)&&e<n&&(o=n),xn(i)&&e>i&&(o=i)),o},Qt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},Qt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},Qt.prototype.registerProvider=function(e,t,n){n||(n=t,t=y$),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Qt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Qt.prototype._getEntries=function(e,t){var n={};return U(t,function(i){if(!i.getPopupMenuEntries){U(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);Sn(o)?n=o(n):U(o,function(r,a){n[a]=r})}),n},Qt.prototype._getHeaderEntries=function(e,t){var n={};return U(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;U(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);Sn(o)?n=o(n):U(o,function(r,a){n[a]=r})}),n},Qt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Sn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Qt.prototype.isOpen=function(){return!!this._current},Qt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Hr(e.delegateTarget||e.target,".entry",!0),r=Tn(o,m$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Sn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Qt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function EE(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=EE(o.entries,[...t,...SE(o.search)]):t.length&&(o.search=[...t,...SE(o.search)]),o})}function SE(e){return e?Qe(e)?e:[e]:[]}function v$(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=x$(r,o,i);return a?{item:r,tokens:a}:[]}).sort(b$(i))}function x$(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Qe(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=TE(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):TE(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function b$(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=w$(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=RE;continue}const s=_$(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=RE;continue}}return i}}function w$(e,t){return ME(t)-ME(e)}const RE=.5,Xa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function ME(e){const t=e.reduce((s,c)=>s+CE(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 CE(e){if(Qe(e))return Math.max(...e.map(CE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Xa.FULL:e.wordEnd?Xa.START_FULL_WORD:Xa.START_WORD_PART:e.wordStart?Xa.WORD_START:Xa.WORD_PART)*t:Xa.NO_MATCH*t}function AE(e=""){return Qe(e)?e.join(", "):e}function _$(e,t){return AE(e).localeCompare(AE(t))}function TE(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(E$),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),a=new RegExp(r,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,d=s.index+u.length,f=p===0,m=d===e.length,g=!!((l=s.groups)!=null&&l.all),y=f||/\s/.test(e.charAt(p-1)),_=m||/\s/.test(e.charAt(d));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:_,start:f,end:m,all:g});const h=g?t:[u];for(const v of h)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function E$(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const PE={search:["value",v$]},Eg={__depends__:[PE],__init__:["popupMenu"],popupMenu:["type",Qt]};var kE={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
286
+ `,this._current.container)},Qt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var o=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(o===!1)return;this.isOpen()&&this.close();const{entries:r,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Qt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:o}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:o},this._emit("refresh"),this._render()},Qt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),o=this._getHeaderEntries(e,n),r=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:o,emptyPlaceholder:r,empty:!(Object.keys(i).length||Object.keys(o).length)}},Qt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Qt.prototype.reset=function(){const e=this._current.container;rE(null,e),no(e)},Qt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Qt.prototype._onOpened=function(){this._emit("opened")},Qt.prototype._onClosed=function(){this._emit("closed")},Qt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Vt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Qt.prototype._bindAutoClose=function(){this._eventBus.once(_E,this.close,this)},Qt.prototype._unbindAutoClose=function(){this._eventBus.off(_E,this.close,this)},Qt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,o=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),xn(n)&&e<n&&(o=n),xn(i)&&e>i&&(o=i)),o},Qt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),o={},r=t.x,a=t.y;return t.x+i.width>n.width&&(o.x=!0),t.y+i.height>n.height&&(o.y=!0),o.x&&o.y?(r=t.x-i.width,a=t.y-i.height):o.x?(r=t.x-i.width,a=t.y):o.y&&t.y<i.height?(r=t.x,a=10):o.y&&(r=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:r,y:a}},Qt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},Qt.prototype.registerProvider=function(e,t,n){n||(n=t,t=v$),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Qt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Qt.prototype._getEntries=function(e,t){var n={};return U(t,function(i){if(!i.getPopupMenuEntries){U(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);Sn(o)?n=o(n):U(o,function(r,a){n[a]=r})}),n},Qt.prototype._getHeaderEntries=function(e,t){var n={};return U(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;U(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);Sn(o)?n=o(n):U(o,function(r,a){n[a]=r})}),n},Qt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Sn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Qt.prototype.isOpen=function(){return!!this._current},Qt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let o=Hr(e.delegateTarget||e.target,".entry",!0),r=Tn(o,y$);t={id:r,...this._getEntry(r)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Sn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Qt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function EE(e,t=[]){return Object.entries(e).map(([n,i])=>{const o={id:n,...i};return o.entries?o.entries=EE(o.entries,[...t,...SE(o.search)]):t.length&&(o.search=[...t,...SE(o.search)]),o})}function SE(e){return e?Qe(e)?e:[e]:[]}function x$(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=b$(r,o,i);return a?{item:r,tokens:a}:[]}).sort(w$(i))}function b$(e,t,n){const{matchedWords:i,tokens:o}=n.reduce((r,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Qe(s)?s.reduce((u,p)=>{const{tokens:d,matchedWords:f}=TE(p,t);return{tokens:[...u.tokens,d],matchedWords:{...u.matchedWords,...f}}},{matchedWords:{},tokens:[]}):TE(s,t);return{tokens:{...r.tokens,[a]:c},matchedWords:{...r.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:o}function w$(e){return(t,n)=>{let i=0,o=1;for(const r of e){const a=_$(t.tokens[r],n.tokens[r]);if(a!==0){i+=a*o,o*=RE;continue}const s=E$(t.item[r],n.item[r]);if(s!==0){i+=s*o,o*=RE;continue}}return i}}function _$(e,t){return ME(t)-ME(e)}const RE=.5,Xa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function ME(e){const t=e.reduce((s,c)=>s+CE(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 CE(e){if(Qe(e))return Math.max(...e.map(CE));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Xa.FULL:e.wordEnd?Xa.START_FULL_WORD:Xa.START_WORD_PART:e.wordStart?Xa.WORD_START:Xa.WORD_PART)*t:Xa.NO_MATCH*t}function AE(e=""){return Qe(e)?e.join(", "):e}function E$(e,t){return AE(e).localeCompare(AE(t))}function TE(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},o=t.map(S$),r=[`(?<all>${o.join("\\s+")})`,...o].join("|"),a=new RegExp(r,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,p=s.index,d=s.index+u.length,f=p===0,m=d===e.length,g=!!((l=s.groups)!=null&&l.all),y=f||/\s/.test(e.charAt(p-1)),_=m||/\s/.test(e.charAt(d));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:_,start:f,end:m,all:g});const h=g?t:[u];for(const v of h)i[v.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function S$(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const PE={search:["value",x$]},Eg={__depends__:[PE],__init__:["popupMenu"],popupMenu:["type",Qt]};var kE={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
287
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
288
288
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
289
289
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -311,8 +311,8 @@
311
311
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
312
312
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
313
313
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
314
- </svg>`},S$=900;function Za(e,t,n,i){e.registerProvider(S$,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Za.$inject=["contextPad","popupMenu","translate","canvas"],Za.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&Z(t,this._getEntries(e)),t},Za.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Za.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${kE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);Z(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Za.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 R$=["left","center","right","top","middle","bottom"];function vc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}vc.$inject=["popupMenu","alignElements","translate","rules"],vc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Z(t,this._getEntries(e)),t},vc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},vc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return U(R$,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:kE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function lp(e){Ti.call(this,e)}lp.$inject=["eventBus"],Ne(lp,Ti),lp.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ft(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=El(n),n.length<2?!1:n})};const M$={__depends__:[NN,z0,Eg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Za],alignElementsMenuProvider:["type",vc],bpmnAlignElements:["type",lp]};function Ja(e,t,n){this._canvas=n,this._opts=Z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ja.$inject=["config.autoScroll","eventBus","canvas"],Ja.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++)C$(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 C$(e,t,n){return t<e&&e<n}Ja.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ja.prototype.setOptions=function(e){this._opts=Z({},this._opts,e)},Ja.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=qr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const A$={__depends__:[Po],__init__:["autoScroll"],autoScroll:["type",Ja]};var OE="djs-bendpoint",DE="djs-segment-dragger";function T$(e,t){var n=qr(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 Sg(e,t,n){var i=T$(e,n),o=Df(t,i);return o}function Rg(e,t){var n=He("g");mt(n).add(OE),ot(e,n);var i=He("circle");De(i,{cx:0,cy:0,r:4}),mt(i).add("djs-visual"),ot(n,i);var o=He("circle");return De(o,{cx:0,cy:0,r:10}),mt(o).add("djs-hit"),ot(n,o),t&&mt(n).add(t),n}function P$(e,t,n,i){var o=He("g");ot(e,o);var r=18,a=6,s=11,c=O$(t,n,i),l=a+s,u=He("rect");De(u,{x:-r/2,y:-a/2,width:r,height:a}),mt(u).add("djs-visual"),ot(o,u);var p=He("rect");return De(p,{x:-c/2,y:-l/2,width:c,height:l}),mt(p).add("djs-hit"),ot(o,p),Lx(o,i==="v"?90:0),o}function LE(e,t,n){var i=He("g"),o=cf(t,n),r=So(t,n);return ot(e,i),P$(i,t,n,r),mt(i).add(DE),mt(i).add(r==="h"?"horizontal":"vertical"),$n(i,o.x,o.y),i}function Mg(e){return Math.abs(Math.round(e*2/3))}function k$(e,t){var n=D$(e,t);return Ff(e,n)}function O$(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Mg(n==="h"?i:o)}function D$(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=_b(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function IE(e,t,n,i,o){function r(v,b,E){var M=v.index,B=v.point,P,k,N,G,q,Y;return M<=0||v.bendpoint?!1:(P=b[M-1],k=b[M],N=cf(P,k),G=So(P,k),q=Math.abs(B.x-N.x),Y=Math.abs(B.y-N.y),G&&q<=E&&Y<=E)}function a(v,b){var E=v.waypoints,M,B,P,k;return b.index<=0||b.bendpoint||(M={start:E[b.index-1],end:E[b.index]},B=So(M.start,M.end),!B)?null:(B==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,k=Mg(P)/2,k)}function s(v,b){var E=b.waypoints,M=Sg(t,E,v),B;if(M){B=a(b,M);var P;if(r(M,E,B)?P=o.start(v,b,M.index):P=i.start(v,b,M.index,!M.bendpoint),P!==!1)return!0}}function c(v,b,E){Ye.bind(v,b,function(M){n.triggerMouseEvent(b,M,E),M.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),M=Ct('.djs-bendpoints[data-element-id="'+ea(v.id)+'"]',E);return!M&&b&&(M=He("g"),De(M,{"data-element-id":v.id}),mt(M).add("djs-bendpoints"),ot(E,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,b){return Ct('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,M){var B=Rg(v);ot(v,B),$n(B,E.x,E.y)}),Rg(v,"floating")}function d(v,b){for(var E=b.waypoints,M,B,P,k=1;k<E.length;k++)M=E[k-1],B=E[k],So(M,B)&&(P=LE(v,M,B),De(P,{"data-segment-idx":k}),c(P,"mousemove",b))}function f(v){U(Ms("."+OE,v),function(b){pn(b)})}function m(v){U(Ms("."+DE,v),function(b){pn(b)})}function g(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function y(v){var b=l(v);b&&(m(b),f(b),d(b,v),p(b,v))}function _(v,b){var E=Ct(".floating",v),M=b.point;E&&($n(E,M.x,M.y),mt(E).add("positioned"))}function h(v,b,E){var M=u(b.index,v),B=E[b.index-1],P=E[b.index],k=b.point,N=cf(B,P),G=So(B,P),q,Y;M&&(q=L$(M),Y={x:k.x-N.x,y:k.y-N.y},G==="v"&&(Y={x:Y.y,y:Y.x}),$n(q,Y.x,Y.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&pn(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=g(b),v.add?mt(E).add(v.marker):mt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,E=b.waypoints,M,B;if(E){if(M=l(b,!0),B=Sg(t,E,v.originalEvent),!B)return;_(M,B),B.bendpoint||h(M,B,E)}}),e.on("element.mousedown",function(v){if(cr(v)){var b=v.originalEvent,E=v.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(v){var b=v.newSelection,E=b[0];E&&E.waypoints&&g(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&g(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var M=Ct(".floating",E);M&&mt(M).remove("positioned")}}}),e.on("element.updateId",function(v){var b=v.element,E=v.newId;if(b.waypoints){var M=l(b);M&&De(M,{"data-element-id":E})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}IE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function L$(e){return Ct(".djs-visual",e)}var BE=Math.round,ia="reconnectStart",oa="reconnectEnd",xc="updateWaypoints";function Cg(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,d=s.target,f=s.waypoints,m;!l&&c===0?m=ia:!l&&c===f.length-1?m=oa:m=xc;var g=m===xc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(g,{connection:s,source:p,target:d});if(y===!1&&(y=o.allowed(g,{connection:s,source:d,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:d,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,d=s.type;s.hover=p;var f;if(p){var m=d===xc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(m,{connection:c,source:d===ia?p:l,target:d===oa?p:u}),f){s.source=d===ia?p:l,s.target=d===oa?p:u;return}f===!1&&(f=s.allowed=o.allowed(m,{connection:c,source:d===oa?p:u,target:d===ia?p:l})),f&&(s.source=d===oa?p:u,s.target=d===ia?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!==xc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,d=u.waypoints.slice(),f=s.source,m=s.target,g=s.type,y=s.hints||{},_={x:BE(a.x),y:BE(a.y)};if(!c)return!1;g===xc?(p?d.splice(l,0,_):d[l]=_,y.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,g2(d),y)):(g===ia?(y.docking="source",up(s)&&(y.docking="target",y.newWaypoints=d.reverse())):g===oa&&(y.docking="target",up(s)&&(y.docking="source",y.newWaypoints=d.reverse())),r.reconnect(u,f,m,_,y))},this)}Cg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Cg.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 up(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===ia)return t&&i&&t===i&&n!==i;if(o===oa)return t&&n&&t===n&&n!==i}var I$="reconnectStart",B$="reconnectEnd",NE="updateWaypoints",bc="connect-ok",pp="connect-not-ok",$E="connect-hover",FE="djs-updating",jE="djs-dragging",HE=1100;function zE(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p;var d=a.draggerGfx=Rg(i.getLayer("overlays"));mt(d).add("djs-dragging"),i.addMarker(c,jE),i.addMarker(c,FE)}),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,$E),l===NE)return;s?(i.removeMarker(c,pp),i.addMarker(c,bc)):s===!1&&(i.removeMarker(c,bc),i.addMarker(c,pp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],HE,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,$E),i.removeMarker(s,c?bc:pp))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,d=a.connection,f=d.source,m=d.target,g=d.waypoints.slice(),y={x:r.x,y:r.y},_=a.hints||{},h={};o&&(_.connectionStart&&(h.connectionStart=_.connectionStart),_.connectionEnd&&(h.connectionEnd=_.connectionEnd),p===I$?up(a)?(h.connectionEnd=h.connectionEnd||y,h.source=m,h.target=u||f,g=g.reverse()):(h.connectionStart=h.connectionStart||y,h.source=u||f,h.target=m):p===B$?up(a)?(h.connectionStart=h.connectionStart||y,h.source=u||m,h.target=f,g=g.reverse()):(h.connectionEnd=h.connectionEnd||y,h.source=f,h.target=u||m):(h.noCropping=!0,h.noLayout=!0,g[c]=y),p===NE&&(g=e.cropWaypoints(d,g)),h.waypoints=g,o.drawPreview(a,s,h)),$n(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],HE,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,pn(c),i.removeMarker(s,FE),i.removeMarker(s,jE),l&&(i.removeMarker(l,bc),i.removeMarker(l,u?bc:pp)),o&&o.cleanUp(a)})}zE.$inject=["bendpointMove","injector","eventBus","canvas"];var GE="connect-hover",VE="djs-updating";function WE(e,t,n){return Ag(e,t,e[t]+n)}function Ag(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function N$(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 Ag(t,i,s)}function UE(e){return e==="x"?"y":"x"}function qE(e,t,n){var i,o;return e.original?e.original:(i=tt(t),o=UE(n),Ag(e,o,i[o]))}function YE(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var m,g=n.getGraphics(d),y=f-1,_=f,h=d.waypoints,v=h[y],b=h[_],E=Sg(n,h,p),M,B,P;if(M=So(v,b),!!M)return B=M==="v"?"x":"y",y===0&&(v=qE(v,d.source,B)),_===h.length-1&&(b=qE(b,d.target,B)),E?P=E.point:P={x:(v.x+b.x)/2,y:(v.y+b.y)/2},m={connection:d,segmentStartIndex:y,segmentEndIndex:_,segmentStart:v,segmentEnd:b,axis:B,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:g,context:m}})};function s(p,d){if(!a)return d;var f=p.waypoints,m;return p.waypoints=d,m=a.getCroppedWaypoints(p),p.waypoints=f,m}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var m=p.newWaypoints,g=p.segmentStartIndex+d,y=m[g],_=p.segmentEndIndex+d,h=m[_],v=UE(p.axis),b=N$(f,y,h,v);$n(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,m=p.filter(function(g,y){return sf(p[y-1],p[y+1],g)?(f=y<=d?f-1:f,!1):!0});return{waypoints:m,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,m=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=LE(m,d.segmentStart,d.segmentEnd),mt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,VE)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,m=d.segmentStartIndex,g=d.segmentEndIndex,y=d.segmentStart,_=d.segmentEnd,h=d.axis,v=d.originalWaypoints.slice(),b=WE(y,h,p["d"+h]),E=WE(_,h,p["d"+h]),M=v.length,B=0;v[m]=b,v[g]=E;var P,k;m<2&&(P=Nn(f.source,b),m===1?P==="intersect"&&(v.shift(),v[0]=b,B--):P!=="intersect"&&(v.unshift(y),B++)),g>M-3&&(k=Nn(f.target,E),g===M-2?k==="intersect"&&(v.pop(),v[v.length-1]=E):k!=="intersect"&&v.push(_)),d.newWaypoints=f.waypoints=s(f,v),l(d,B,p),d.newSegmentStartIndex=m+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,GE)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,GE)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&pn(d.draggerGfx),n.removeMarker(f,VE)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var d=p.context,f=d.connection;f.waypoints=d.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var d=p.context,f=d.connection,m=d.newWaypoints,g=d.newSegmentStartIndex;m=m.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var y=u(m,g),_=y.waypoints,h=s(f,_),v=y.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:g+v}};r.updateWaypoints(f,h,b)})}YE.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var $$=Math.abs,KE=Math.round;function F$(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],$$(o-e)<=n)return o}function XE(e){return{x:e.x,y:e.y}}function ZE(e){return{x:e.x+e.width,y:e.y+e.height}}function Di(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:KE(e.x+e.width/2),y:KE(e.y+e.height/2)}}function Qa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function mn(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 JE(e){return e.children||[]}var j$=Math.abs,QE=Math.round,Tg=10;function e1(e){function t(r,a){if(Qe(r)){for(var s=r.length;s--;)if(j$(r[s]-a)<=Tg)return r[s]}else{r=+r;var c=a%r;if(c<Tg)return a-c;if(c>r-Tg)return a-c+r}return a}function n(r,a){if(r.waypoints)return k$(a,r);if(r.width)return{x:QE(r.width/2+r.x),y:QE(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,d=a.segmentEnd,f=a.segmentEndIndex,m=a.axis;if(s)return s;var g=[l[p-1],u,d,l[f+1]];return p<2&&g.unshift(n(c.source,r)),f>l.length-3&&g.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},U(g,function(y){y&&(y=y.original||y,m==="y"&&s.horizontal.push(y.y),m==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,d=c-u;Z(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&mn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&mn(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:[]},U(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);!Lt(s)||!c||!c.x||!c.y||(mn(r,"x",c.x),mn(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,d,f;if(s){d=t(l?s.vertical.concat([l.x]):s.vertical,u),f=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var m=u-d,g=p-f;Z(r,{dx:r.dx-m,dy:r.dy-g,x:r.x-m,y:r.y-g}),(m||s.vertical.indexOf(u)!==-1)&&mn(r,"x",d),(g||s.horizontal.indexOf(p)!==-1)&&mn(r,"y",f)}})}e1.$inject=["eventBus"];const H$={__depends__:[Po,co],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",IE],bendpointMove:["type",Cg],bendpointMovePreview:["type",zE],connectionSegmentMove:["type",YE],bendpointSnapping:["type",e1]};function t1(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),!fa(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!fa(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,d=s.target;if(!c)return!1;var f=null,m={connectionStart:Pg(s)?u:l,connectionEnd:Pg(s)?l:u};bn(c)&&(f=c),s.connection=n.connect(p,d,f,m)}),this.start=function(a,s,c,l){bn(c)||(l=c,c=tt(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}t1.$inject=["eventBus","dragging","modeling","rules"];function Pg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var z$=1100,G$=900,n1="connect-ok",i1="connect-not-ok";function o1(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,d=r.connectionStart||u,f=r.connectionEnd||{x:o.x,y:o.y},m=d,g=f;Pg(r)&&(m=f,g=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",G$,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?n1:i1)}),t.on(["connect.out","connect.cleanup"],z$,function(o){var r=o.hover;r&&(n.removeMarker(r,n1),n.removeMarker(r,i1))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}o1.$inject=["injector","eventBus","canvas"];const kg={__depends__:[Pi,co,Po],__init__:["connectPreview"],connect:["type",t1],connectPreview:["type",o1]};var V$="djs-dragger";function No(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)}No.$inject=["injector","canvas","graphicsFactory","elementFactory"],No.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,d=n.noNoop,f,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Cs(i),o||(o=e.getConnection=W$(function(g,y,_){return m.getConnection(g,y,_)})),t&&(f=o(t,r,a)),!f){!d&&this.drawNoopPreview(i,n);return}f.waypoints=s||[],this._layouter&&!u&&(f.waypoints=this._layouter.layoutConnection(f,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||f.waypoints})),(!f.waypoints||!f.waypoints.length)&&(f.waypoints=[r?tt(r):c,a?tt(a):l]),this._connectionDocking&&(r||a)&&!p&&(f.waypoints=this._connectionDocking.getCroppedWaypoints(f,r,a)),this._graphicsFactory.drawConnection(i,f,{stroke:"var(--element-dragger-color)"})},No.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||tt(n),r=t.connectionEnd||tt(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ot(e,s)},No.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&&Ls(r,s,!0)||e,t=i&&Ls(a,s,!1)||t,[e,t]},No.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&pn(e.connectionPreviewGfx)},No.prototype.getConnection=function(e){var t=U$(e);return this._elementFactory.createConnection(t)},No.prototype.createConnectionPreviewGfx=function(){var e=He("g");return De(e,{pointerEvents:"none"}),mt(e).add(V$),ot(this._canvas.getActiveLayer(),e),e},No.prototype.createNoopConnection=function(e,t){return Ps([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function W$(e){var t={};return function(n){var i=JSON.stringify(n),o=t[i];return o||(o=t[i]=e.apply(null,arguments)),o}}function U$(e){return bn(e)?e:{}}const q$={__init__:["connectionPreview"],connectionPreview:["type",No]},dp="complex-preview";class r1{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(dp);n.filter(s=>!Y$(s)).forEach(s=>{let c;Lt(s)?(c=this._graphicsFactory._createContainer("connection",He("g")),this._graphicsFactory.drawConnection(nr(c),s)):(c=this._graphicsFactory._createContainer("shape",He("g")),this._graphicsFactory.drawShape(nr(c),s),$n(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);Lt(s)?$n(l,c.x,c.y):$n(l,s.x+c.x,s.y+c.y)}),o.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),r.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",He("g"));this._graphicsFactory.drawShape(nr(l),s,{width:c.width,height:c.height}),$n(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Cs(this._canvas.getLayer(dp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(dp)}hide(){this._canvas.hideLayer(dp)}}r1.$inject=["canvas","graphicsFactory","previewSupport"];function Y$(e){return e.hidden}const K$={__depends__:[Ha],__init__:["complexPreview"],complexPreview:["type",r1]},a1=Math.round;function fp(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}fp.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(Z({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;Z(l,{x:u.x-a1(l.width/2),y:u.y-a1(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;p&&(d=r.createConnection(p),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=o.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter(f=>!fa(f))})},fp.prototype.cleanUp=function(){this._complexPreview.cleanUp()},fp.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const X$={__depends__:[Du,K$,qh],__init__:["appendPreview"],appendPreview:["type",fp]};var s1=Math.min,c1=Math.max;function Og(e){e.preventDefault()}function wc(e){e.stopPropagation()}function Z$(e){return e.nodeType===Node.TEXT_NODE}function J$(e){return[].slice.call(e)}function Ui(e){this.container=e.container,this.parent=Vt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ct("[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)}Ui.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=ji(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);Z(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=ji(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return Z(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&Z(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ye.bind(a,"keydown",this.keyHandler),Ye.bind(a,"mousedown",wc),Ye.bind(a,"paste",o.handlePaste),Ye.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ye.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Ui.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)}},Ui.prototype.insertText=function(e){e=Q$(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Ui.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=J$(a.childNodes),c,l;if(Z$(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var d=s.indexOf(n),f=s.indexOf(i);s.forEach(function(m,g){g===d?m.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):g>d&&g<=f&&no(m)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Ui.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})}},Ui.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=Vt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(m){Og(m),wc(m),s=m.clientX,c=m.clientY;var g=t.getBoundingClientRect();l=g.width,u=g.height,Ye.bind(document,"mousemove",d),Ye.bind(document,"mouseup",f)},d=function(m){Og(m),wc(m);var g=s1(c1(l+m.clientX-s,i),r),y=s1(c1(u+m.clientY-c,o),a);t.style.width=g+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},f=function(m){Og(m),wc(m),Ye.unbind(document,"mousemove",d,!1),Ye.unbind(document,"mouseup",f,!1)};Ye.bind(n,"mousedown",p)}Z(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Ui.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ye.unbind(t,"keydown",this.keyHandler),Ye.unbind(t,"mousedown",wc),Ye.unbind(t,"input",this.autoResize),Ye.unbind(t,"paste",this.handlePaste),Ye.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),no(n)),no(e)},Ui.prototype.getValue=function(){return this.content.innerText.trim()},Ui.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Ui.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 Q$(e){return e.replace(/\r\n|\r|\n/g,`
315
- `)}function mi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ui({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())}mi.$inject=["eventBus","canvas"],mi.prototype.registerProvider=function(e){this._providers.push(e)},mi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},mi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},mi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},mi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},mi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},mi.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()}},mi.prototype.getValue=function(){return this._textbox.getValue()},mi.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()},mi.prototype._handleResize=function(e){this._fire("resize",e)},mi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},mi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=$t(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 l1={__depends__:[lu],__init__:["directEditing"],directEditing:["type",mi]};function e5(e){return function(t){var n=t.target,i=Ee(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===yt(e);return!r||!a||!s||!c}}const t5={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 we(e,t={}){var n=t5[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var n5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing"),we("none-end-event",{actionName:"replace-with-none-end"}),we("message-start"),we("timer-start"),we("conditional-start"),we("signal-start")],i5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing"),we("none-end-event",{actionName:"replace-with-none-end"})],o5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),we("none-end-event",{actionName:"replace-with-none-end"}),we("message-intermediate-catch"),we("message-intermediate-throw"),we("timer-intermediate-catch"),we("escalation-intermediate-throw"),we("conditional-intermediate-catch"),we("link-intermediate-catch"),we("link-intermediate-throw"),we("compensation-intermediate-throw"),we("signal-intermediate-catch"),we("signal-intermediate-throw")],r5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),we("none-end-event",{actionName:"replace-with-none-end"}),we("message-end"),we("escalation-end"),we("error-end"),we("cancel-end"),we("compensation-end"),we("signal-end"),we("terminate-end")],a5=[we("exclusive-gateway"),we("parallel-gateway"),we("inclusive-gateway"),we("complex-gateway"),we("event-based-gateway")],s5=[we("transaction"),we("event-subprocess"),we("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),we("collapsed-subprocess")],c5=[we("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),we("transaction"),we("event-subprocess"),we("collapsed-ad-hoc-subprocess")],u1=[we("transaction"),we("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),we("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),we("event-subprocess")],l5=u1,p1=[we("task"),we("user-task"),we("service-task"),we("send-task"),we("receive-task"),we("manual-task"),we("rule-task"),we("script-task"),we("call-activity"),we("collapsed-subprocess"),we("expanded-subprocess"),we("collapsed-ad-hoc-subprocess"),we("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],u5=[we("data-store-reference")],p5=[we("data-object-reference")],d5=[we("message-boundary"),we("timer-boundary"),we("escalation-boundary"),we("conditional-boundary"),we("error-boundary"),we("cancel-boundary"),we("signal-boundary"),we("compensation-boundary"),we("non-interrupting-message-boundary"),we("non-interrupting-timer-boundary"),we("non-interrupting-escalation-boundary"),we("non-interrupting-conditional-boundary"),we("non-interrupting-signal-boundary")],f5=[we("message-start"),we("timer-start"),we("conditional-start"),we("signal-start"),we("error-start"),we("escalation-start"),we("compensation-start"),we("non-interrupting-message-start"),we("non-interrupting-timer-start"),we("non-interrupting-conditional-start"),we("non-interrupting-signal-start"),we("non-interrupting-escalation-start")],h5=[{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"}],g5=[we("expanded-pool"),we("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],m5={"bpmn:MessageEventDefinition":[we("message-start"),we("message-intermediate-catch"),we("message-intermediate-throw"),we("message-end")],"bpmn:TimerEventDefinition":[we("timer-start"),we("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[we("conditional-start"),we("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[we("signal-start"),we("signal-intermediate-catch"),we("signal-intermediate-throw"),we("signal-end")],"bpmn:ErrorEventDefinition":[we("error-start"),we("error-end")],"bpmn:EscalationEventDefinition":[we("escalation-start"),we("escalation-intermediate-throw"),we("escalation-end")],"bpmn:CompensateEventDefinition":[we("compensation-start"),we("compensation-intermediate-throw"),we("compensation-end")]};const d1={"start-event-non-interrupting":`
314
+ </svg>`},R$=900;function Za(e,t,n,i){e.registerProvider(R$,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Za.$inject=["contextPad","popupMenu","translate","canvas"],Za.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&Z(t,this._getEntries(e)),t},Za.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Za.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${kE.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);Z(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Za.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 M$=["left","center","right","top","middle","bottom"];function vc(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}vc.$inject=["popupMenu","alignElements","translate","rules"],vc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Z(t,this._getEntries(e)),t},vc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},vc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,o={};return U(M$,function(r){o["align-elements-"+r]={group:"align",title:n("Align elements "+r),className:"bjs-align-elements-menu-entry",imageHtml:kE[r],action:function(){t.trigger(e,r),i.close()}}}),o};function lp(e){Ti.call(this,e)}lp.$inject=["eventBus"],Ne(lp,Ti),lp.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ft(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=El(n),n.length<2?!1:n})};const C$={__depends__:[$N,z0,Eg],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Za],alignElementsMenuProvider:["type",vc],bpmnAlignElements:["type",lp]};function Ja(e,t,n){this._canvas=n,this._opts=Z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(o){var r=i._toBorderPoint(o);i.startScroll(r)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ja.$inject=["config.autoScroll","eventBus","canvas"],Ja.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++)A$(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 A$(e,t,n){return t<e&&e<n}Ja.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ja.prototype.setOptions=function(e){this._opts=Z({},this._opts,e)},Ja.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=qr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const T$={__depends__:[Po],__init__:["autoScroll"],autoScroll:["type",Ja]};var OE="djs-bendpoint",DE="djs-segment-dragger";function P$(e,t){var n=qr(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 Sg(e,t,n){var i=P$(e,n),o=Df(t,i);return o}function Rg(e,t){var n=He("g");mt(n).add(OE),ot(e,n);var i=He("circle");De(i,{cx:0,cy:0,r:4}),mt(i).add("djs-visual"),ot(n,i);var o=He("circle");return De(o,{cx:0,cy:0,r:10}),mt(o).add("djs-hit"),ot(n,o),t&&mt(n).add(t),n}function k$(e,t,n,i){var o=He("g");ot(e,o);var r=18,a=6,s=11,c=D$(t,n,i),l=a+s,u=He("rect");De(u,{x:-r/2,y:-a/2,width:r,height:a}),mt(u).add("djs-visual"),ot(o,u);var p=He("rect");return De(p,{x:-c/2,y:-l/2,width:c,height:l}),mt(p).add("djs-hit"),ot(o,p),Lx(o,i==="v"?90:0),o}function LE(e,t,n){var i=He("g"),o=cf(t,n),r=So(t,n);return ot(e,i),k$(i,t,n,r),mt(i).add(DE),mt(i).add(r==="h"?"horizontal":"vertical"),$n(i,o.x,o.y),i}function Mg(e){return Math.abs(Math.round(e*2/3))}function O$(e,t){var n=L$(e,t);return Ff(e,n)}function D$(e,t,n){var i=t.x-e.x,o=t.y-e.y;return Mg(n==="h"?i:o)}function L$(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=_b(e,[a,s]);c<i&&(i=c,o=r)}return[n[o],n[o+1]]}function IE(e,t,n,i,o){function r(v,b,E){var M=v.index,B=v.point,P,k,N,G,q,Y;return M<=0||v.bendpoint?!1:(P=b[M-1],k=b[M],N=cf(P,k),G=So(P,k),q=Math.abs(B.x-N.x),Y=Math.abs(B.y-N.y),G&&q<=E&&Y<=E)}function a(v,b){var E=v.waypoints,M,B,P,k;return b.index<=0||b.bendpoint||(M={start:E[b.index-1],end:E[b.index]},B=So(M.start,M.end),!B)?null:(B==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,k=Mg(P)/2,k)}function s(v,b){var E=b.waypoints,M=Sg(t,E,v),B;if(M){B=a(b,M);var P;if(r(M,E,B)?P=o.start(v,b,M.index):P=i.start(v,b,M.index,!M.bendpoint),P!==!1)return!0}}function c(v,b,E){Ye.bind(v,b,function(M){n.triggerMouseEvent(b,M,E),M.stopPropagation()})}function l(v,b){var E=t.getLayer("overlays"),M=Ct('.djs-bendpoints[data-element-id="'+ea(v.id)+'"]',E);return!M&&b&&(M=He("g"),De(M,{"data-element-id":v.id}),mt(M).add("djs-bendpoints"),ot(E,M),c(M,"mousedown",v),c(M,"click",v),c(M,"dblclick",v)),M}function u(v,b){return Ct('.djs-segment-dragger[data-segment-idx="'+v+'"]',b)}function p(v,b){b.waypoints.forEach(function(E,M){var B=Rg(v);ot(v,B),$n(B,E.x,E.y)}),Rg(v,"floating")}function d(v,b){for(var E=b.waypoints,M,B,P,k=1;k<E.length;k++)M=E[k-1],B=E[k],So(M,B)&&(P=LE(v,M,B),De(P,{"data-segment-idx":k}),c(P,"mousemove",b))}function f(v){U(Ms("."+OE,v),function(b){pn(b)})}function m(v){U(Ms("."+DE,v),function(b){pn(b)})}function g(v){var b=l(v);return b||(b=l(v,!0),p(b,v),d(b,v)),b}function y(v){var b=l(v);b&&(m(b),f(b),d(b,v),p(b,v))}function _(v,b){var E=Ct(".floating",v),M=b.point;E&&($n(E,M.x,M.y),mt(E).add("positioned"))}function h(v,b,E){var M=u(b.index,v),B=E[b.index-1],P=E[b.index],k=b.point,N=cf(B,P),G=So(B,P),q,Y;M&&(q=I$(M),Y={x:k.x-N.x,y:k.y-N.y},G==="v"&&(Y={x:Y.y,y:Y.x}),$n(q,Y.x,Y.y))}e.on("connection.changed",function(v){y(v.element)}),e.on("connection.remove",function(v){var b=l(v.element);b&&pn(b)}),e.on("element.marker.update",function(v){var b=v.element,E;b.waypoints&&(E=g(b),v.add?mt(E).add(v.marker):mt(E).remove(v.marker))}),e.on("element.mousemove",function(v){var b=v.element,E=b.waypoints,M,B;if(E){if(M=l(b,!0),B=Sg(t,E,v.originalEvent),!B)return;_(M,B),B.bendpoint||h(M,B,E)}}),e.on("element.mousedown",function(v){if(cr(v)){var b=v.originalEvent,E=v.element;if(E.waypoints)return s(b,E)}}),e.on("selection.changed",function(v){var b=v.newSelection,E=b[0];E&&E.waypoints&&g(E)}),e.on("element.hover",function(v){var b=v.element;b.waypoints&&g(b)}),e.on("element.out",function(v){var b=v.element;if(b.waypoints){var E=l(b);if(E){var M=Ct(".floating",E);M&&mt(M).remove("positioned")}}}),e.on("element.updateId",function(v){var b=v.element,E=v.newId;if(b.waypoints){var M=l(b);M&&De(M,{"data-element-id":E})}}),this.addHandles=g,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}IE.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function I$(e){return Ct(".djs-visual",e)}var BE=Math.round,ia="reconnectStart",oa="reconnectEnd",xc="updateWaypoints";function Cg(e,t,n,i,o,r){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),p=s.source,d=s.target,f=s.waypoints,m;!l&&c===0?m=ia:!l&&c===f.length-1?m=oa:m=xc;var g=m===xc?"connection.updateWaypoints":"connection.reconnect",y=o.allowed(g,{connection:s,source:p,target:d});if(y===!1&&(y=o.allowed(g,{connection:s,source:d,target:p})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:p,target:d,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,p=a.hover,d=s.type;s.hover=p;var f;if(p){var m=d===xc?"connection.updateWaypoints":"connection.reconnect";if(f=s.allowed=o.allowed(m,{connection:c,source:d===ia?p:l,target:d===oa?p:u}),f){s.source=d===ia?p:l,s.target=d===oa?p:u;return}f===!1&&(f=s.allowed=o.allowed(m,{connection:c,source:d===oa?p:u,target:d===ia?p:l})),f&&(s.source=d===oa?p:u,s.target=d===ia?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!==xc&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,p=s.insert,d=u.waypoints.slice(),f=s.source,m=s.target,g=s.type,y=s.hints||{},_={x:BE(a.x),y:BE(a.y)};if(!c)return!1;g===xc?(p?d.splice(l,0,_):d[l]=_,y.bendpointMove={insert:p,bendpointIndex:l},d=this.cropWaypoints(u,d),r.updateWaypoints(u,m2(d),y)):(g===ia?(y.docking="source",up(s)&&(y.docking="target",y.newWaypoints=d.reverse())):g===oa&&(y.docking="target",up(s)&&(y.docking="source",y.newWaypoints=d.reverse())),r.reconnect(u,f,m,_,y))},this)}Cg.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Cg.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 up(e){var t=e.hover,n=e.source,i=e.target,o=e.type;if(o===ia)return t&&i&&t===i&&n!==i;if(o===oa)return t&&n&&t===n&&n!==i}var B$="reconnectStart",N$="reconnectEnd",NE="updateWaypoints",bc="connect-ok",pp="connect-not-ok",$E="connect-hover",FE="djs-updating",jE="djs-dragging",HE=1100;function zE(e,t,n,i){this._injector=t;var o=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(r){var a=r.context,s=a.bendpointIndex,c=a.connection,l=a.insert,u=c.waypoints,p=u.slice();a.waypoints=u,l&&p.splice(s,0,{x:r.x,y:r.y}),c.waypoints=p;var d=a.draggerGfx=Rg(i.getLayer("overlays"));mt(d).add("djs-dragging"),i.addMarker(c,jE),i.addMarker(c,FE)}),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,$E),l===NE)return;s?(i.removeMarker(c,pp),i.addMarker(c,bc)):s===!1&&(i.removeMarker(c,bc),i.addMarker(c,pp))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],HE,function(r){var a=r.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,$E),i.removeMarker(s,c?bc:pp))}),n.on("bendpoint.move.move",function(r){var a=r.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,p=a.type,d=a.connection,f=d.source,m=d.target,g=d.waypoints.slice(),y={x:r.x,y:r.y},_=a.hints||{},h={};o&&(_.connectionStart&&(h.connectionStart=_.connectionStart),_.connectionEnd&&(h.connectionEnd=_.connectionEnd),p===B$?up(a)?(h.connectionEnd=h.connectionEnd||y,h.source=m,h.target=u||f,g=g.reverse()):(h.connectionStart=h.connectionStart||y,h.source=u||f,h.target=m):p===N$?up(a)?(h.connectionStart=h.connectionStart||y,h.source=u||m,h.target=f,g=g.reverse()):(h.connectionEnd=h.connectionEnd||y,h.source=f,h.target=u||m):(h.noCropping=!0,h.noLayout=!0,g[c]=y),p===NE&&(g=e.cropWaypoints(d,g)),h.waypoints=g,o.drawPreview(a,s,h)),$n(l,r.x,r.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],HE,function(r){var a=r.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,p=a.waypoints;s.waypoints=p,pn(c),i.removeMarker(s,FE),i.removeMarker(s,jE),l&&(i.removeMarker(l,bc),i.removeMarker(l,u?bc:pp)),o&&o.cleanUp(a)})}zE.$inject=["bendpointMove","injector","eventBus","canvas"];var GE="connect-hover",VE="djs-updating";function WE(e,t,n){return Ag(e,t,e[t]+n)}function Ag(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function $$(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 Ag(t,i,s)}function UE(e){return e==="x"?"y":"x"}function qE(e,t,n){var i,o;return e.original?e.original:(i=tt(t),o=UE(n),Ag(e,o,i[o]))}function YE(e,t,n,i,o,r){var a=e.get("connectionDocking",!1);this.start=function(p,d,f){var m,g=n.getGraphics(d),y=f-1,_=f,h=d.waypoints,v=h[y],b=h[_],E=Sg(n,h,p),M,B,P;if(M=So(v,b),!!M)return B=M==="v"?"x":"y",y===0&&(v=qE(v,d.source,B)),_===h.length-1&&(b=qE(b,d.target,B)),E?P=E.point:P={x:(v.x+b.x)/2,y:(v.y+b.y)/2},m={connection:d,segmentStartIndex:y,segmentEndIndex:_,segmentStart:v,segmentEnd:b,axis:B,dragPosition:P},i.init(p,P,"connectionSegment.move",{cursor:B==="x"?"resize-ew":"resize-ns",data:{connection:d,connectionGfx:g,context:m}})};function s(p,d){if(!a)return d;var f=p.waypoints,m;return p.waypoints=d,m=a.getCroppedWaypoints(p),p.waypoints=f,m}function c(p){o.update("connection",p.connection,p.connectionGfx)}function l(p,d,f){var m=p.newWaypoints,g=p.segmentStartIndex+d,y=m[g],_=p.segmentEndIndex+d,h=m[_],v=UE(p.axis),b=$$(f,y,h,v);$n(p.draggerGfx,b.x,b.y)}function u(p,d){var f=0,m=p.filter(function(g,y){return sf(p[y-1],p[y+1],g)?(f=y<=d?f-1:f,!1):!0});return{waypoints:m,segmentOffset:f}}t.on("connectionSegment.move.start",function(p){var d=p.context,f=p.connection,m=n.getLayer("overlays");d.originalWaypoints=f.waypoints.slice(),d.draggerGfx=LE(m,d.segmentStart,d.segmentEnd),mt(d.draggerGfx).add("djs-dragging"),n.addMarker(f,VE)}),t.on("connectionSegment.move.move",function(p){var d=p.context,f=d.connection,m=d.segmentStartIndex,g=d.segmentEndIndex,y=d.segmentStart,_=d.segmentEnd,h=d.axis,v=d.originalWaypoints.slice(),b=WE(y,h,p["d"+h]),E=WE(_,h,p["d"+h]),M=v.length,B=0;v[m]=b,v[g]=E;var P,k;m<2&&(P=Nn(f.source,b),m===1?P==="intersect"&&(v.shift(),v[0]=b,B--):P!=="intersect"&&(v.unshift(y),B++)),g>M-3&&(k=Nn(f.target,E),g===M-2?k==="intersect"&&(v.pop(),v[v.length-1]=E):k!=="intersect"&&v.push(_)),d.newWaypoints=f.waypoints=s(f,v),l(d,B,p),d.newSegmentStartIndex=m+B,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,GE)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var d=p.context.hover;d&&n.removeMarker(d,GE)}),t.on("connectionSegment.move.cleanup",function(p){var d=p.context,f=d.connection;d.draggerGfx&&pn(d.draggerGfx),n.removeMarker(f,VE)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var d=p.context,f=d.connection;f.waypoints=d.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var d=p.context,f=d.connection,m=d.newWaypoints,g=d.newSegmentStartIndex;m=m.map(function(E){return{original:E.original,x:Math.round(E.x),y:Math.round(E.y)}});var y=u(m,g),_=y.waypoints,h=s(f,_),v=y.segmentOffset,b={segmentMove:{segmentStartIndex:d.segmentStartIndex,newSegmentStartIndex:g+v}};r.updateWaypoints(f,h,b)})}YE.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var F$=Math.abs,KE=Math.round;function j$(e,t,n){n=n===void 0?10:n;var i,o;for(i=0;i<t.length;i++)if(o=t[i],F$(o-e)<=n)return o}function XE(e){return{x:e.x,y:e.y}}function ZE(e){return{x:e.x+e.width,y:e.y+e.height}}function Di(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:KE(e.x+e.width/2),y:KE(e.y+e.height/2)}}function Qa(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function mn(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 JE(e){return e.children||[]}var H$=Math.abs,QE=Math.round,Tg=10;function e1(e){function t(r,a){if(Qe(r)){for(var s=r.length;s--;)if(H$(r[s]-a)<=Tg)return r[s]}else{r=+r;var c=a%r;if(c<Tg)return a-c;if(c>r-Tg)return a-c+r}return a}function n(r,a){if(r.waypoints)return O$(a,r);if(r.width)return{x:QE(r.width/2+r.x),y:QE(r.height/2+r.y)}}function i(r){var a=r.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,p=a.segmentStartIndex,d=a.segmentEnd,f=a.segmentEndIndex,m=a.axis;if(s)return s;var g=[l[p-1],u,d,l[f+1]];return p<2&&g.unshift(n(c.source,r)),f>l.length-3&&g.unshift(n(c.target,r)),a.snapPoints=s={horizontal:[],vertical:[]},U(g,function(y){y&&(y=y.original||y,m==="y"&&s.horizontal.push(y.y),m==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(r){var a=i(r),s=r.x,c=r.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var p=s-l,d=c-u;Z(r,{dx:r.dx-p,dy:r.dy-d,x:l,y:u}),(p||a.vertical.indexOf(s)!==-1)&&mn(r,"x",l),(d||a.horizontal.indexOf(c)!==-1)&&mn(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:[]},U(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);!Lt(s)||!c||!c.x||!c.y||(mn(r,"x",c.x),mn(r,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(r){var a=r.context,s=o(a),c=a.hover,l=c&&n(c,r),u=r.x,p=r.y,d,f;if(s){d=t(l?s.vertical.concat([l.x]):s.vertical,u),f=t(l?s.horizontal.concat([l.y]):s.horizontal,p);var m=u-d,g=p-f;Z(r,{dx:r.dx-m,dy:r.dy-g,x:r.x-m,y:r.y-g}),(m||s.vertical.indexOf(u)!==-1)&&mn(r,"x",d),(g||s.horizontal.indexOf(p)!==-1)&&mn(r,"y",f)}})}e1.$inject=["eventBus"];const z$={__depends__:[Po,co],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",IE],bendpointMove:["type",Cg],bendpointMovePreview:["type",zE],connectionSegmentMove:["type",YE],bendpointSnapping:["type",e1]};function t1(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),!fa(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=r(c,l),!fa(u)&&u!==!1&&(s.source=l,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,l=s.connectionStart,u={x:a.x,y:a.y},p=s.source,d=s.target;if(!c)return!1;var f=null,m={connectionStart:Pg(s)?u:l,connectionEnd:Pg(s)?l:u};bn(c)&&(f=c),s.connection=n.connect(p,d,f,m)}),this.start=function(a,s,c,l){bn(c)||(l=c,c=tt(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}t1.$inject=["eventBus","dragging","modeling","rules"];function Pg(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var G$=1100,V$=900,n1="connect-ok",i1="connect-not-ok";function o1(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(o){var r=o.context,a=r.canExecute,s=r.hover,c=r.source,l=r.start,u=r.startPosition,p=r.target,d=r.connectionStart||u,f=r.connectionEnd||{x:o.x,y:o.y},m=d,g=f;Pg(r)&&(m=f,g=d),i.drawPreview(r,a,{source:c||l,target:p||s,connectionStart:m,connectionEnd:g})}),t.on("connect.hover",V$,function(o){var r=o.context,a=o.hover,s=r.canExecute;s!==null&&n.addMarker(a,s?n1:i1)}),t.on(["connect.out","connect.cleanup"],G$,function(o){var r=o.hover;r&&(n.removeMarker(r,n1),n.removeMarker(r,i1))}),i&&t.on("connect.cleanup",function(o){i.cleanUp(o.context)})}o1.$inject=["injector","eventBus","canvas"];const kg={__depends__:[Pi,co,Po],__init__:["connectPreview"],connect:["type",t1],connectPreview:["type",o1]};var W$="djs-dragger";function No(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)}No.$inject=["injector","canvas","graphicsFactory","elementFactory"],No.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,o=e.getConnection,r=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,l=n.connectionEnd,u=n.noLayout,p=n.noCropping,d=n.noNoop,f,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Cs(i),o||(o=e.getConnection=U$(function(g,y,_){return m.getConnection(g,y,_)})),t&&(f=o(t,r,a)),!f){!d&&this.drawNoopPreview(i,n);return}f.waypoints=s||[],this._layouter&&!u&&(f.waypoints=this._layouter.layoutConnection(f,{source:r,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||f.waypoints})),(!f.waypoints||!f.waypoints.length)&&(f.waypoints=[r?tt(r):c,a?tt(a):l]),this._connectionDocking&&(r||a)&&!p&&(f.waypoints=this._connectionDocking.getCroppedWaypoints(f,r,a)),this._graphicsFactory.drawConnection(i,f,{stroke:"var(--element-dragger-color)"})},No.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,o=t.connectionStart||tt(n),r=t.connectionEnd||tt(i),a=this.cropWaypoints(o,r,n,i),s=this.createNoopConnection(a[0],a[1]);ot(e,s)},No.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&&Ls(r,s,!0)||e,t=i&&Ls(a,s,!1)||t,[e,t]},No.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&pn(e.connectionPreviewGfx)},No.prototype.getConnection=function(e){var t=q$(e);return this._elementFactory.createConnection(t)},No.prototype.createConnectionPreviewGfx=function(){var e=He("g");return De(e,{pointerEvents:"none"}),mt(e).add(W$),ot(this._canvas.getActiveLayer(),e),e},No.prototype.createNoopConnection=function(e,t){return Ps([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function U$(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 q$(e){return bn(e)?e:{}}const Y$={__init__:["connectionPreview"],connectionPreview:["type",No]},dp="complex-preview";class r1{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(dp);n.filter(s=>!K$(s)).forEach(s=>{let c;Lt(s)?(c=this._graphicsFactory._createContainer("connection",He("g")),this._graphicsFactory.drawConnection(nr(c),s)):(c=this._graphicsFactory._createContainer("shape",He("g")),this._graphicsFactory.drawShape(nr(c),s),$n(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);Lt(s)?$n(l,c.x,c.y):$n(l,s.x+c.x,s.y+c.y)}),o.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),r.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const l=this._graphicsFactory._createContainer("shape",He("g"));this._graphicsFactory.drawShape(nr(l),s,{width:c.width,height:c.height}),$n(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){Cs(this._canvas.getLayer(dp)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(dp)}hide(){this._canvas.hideLayer(dp)}}r1.$inject=["canvas","graphicsFactory","previewSupport"];function K$(e){return e.hidden}const X$={__depends__:[Ha],__init__:["complexPreview"],complexPreview:["type",r1]},a1=Math.round;function fp(e,t,n,i,o,r){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=o,this._rules=r}fp.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(Z({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;Z(l,{x:u.x-a1(l.width/2),y:u.y-a1(l.height/2)});const p=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let d=null;p&&(d=r.createConnection(p),d.waypoints=s.layoutConnection(d,{source:e,target:l}),d.waypoints=o.getCroppedWaypoints(d,e,l)),i.create({created:[l,d].filter(f=>!fa(f))})},fp.prototype.cleanUp=function(){this._complexPreview.cleanUp()},fp.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const Z$={__depends__:[Du,X$,qh],__init__:["appendPreview"],appendPreview:["type",fp]};var s1=Math.min,c1=Math.max;function Og(e){e.preventDefault()}function wc(e){e.stopPropagation()}function J$(e){return e.nodeType===Node.TEXT_NODE}function Q$(e){return[].slice.call(e)}function Ui(e){this.container=e.container,this.parent=Vt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ct("[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)}Ui.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=ji(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);Z(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=ji(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return Z(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&Z(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,Ye.bind(a,"keydown",this.keyHandler),Ye.bind(a,"mousedown",wc),Ye.bind(a,"paste",o.handlePaste),Ye.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ye.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),r},Ui.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)}},Ui.prototype.insertText=function(e){e=e5(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Ui.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,o=t.startOffset,r=t.endOffset,a=t.commonAncestorContainer,s=Q$(a.childNodes),c,l;if(J$(a)){var u=n.textContent;n.textContent=u.substring(0,o)+e+u.substring(r),c=n,l=o+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[o]),c=p,l=p.textContent.length}else{var d=s.indexOf(n),f=s.indexOf(i);s.forEach(function(m,g){g===d?m.textContent=n.textContent.substring(0,o)+e+i.textContent.substring(r):g>d&&g<=f&&no(m)}),c=n,l=o+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Ui.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})}},Ui.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=Vt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,p=function(m){Og(m),wc(m),s=m.clientX,c=m.clientY;var g=t.getBoundingClientRect();l=g.width,u=g.height,Ye.bind(document,"mousemove",d),Ye.bind(document,"mouseup",f)},d=function(m){Og(m),wc(m);var g=s1(c1(l+m.clientX-s,i),r),y=s1(c1(u+m.clientY-c,o),a);t.style.width=g+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},f=function(m){Og(m),wc(m),Ye.unbind(document,"mousemove",d,!1),Ye.unbind(document,"mouseup",f,!1)};Ye.bind(n,"mousedown",p)}Z(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Ui.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ye.unbind(t,"keydown",this.keyHandler),Ye.unbind(t,"mousedown",wc),Ye.unbind(t,"input",this.autoResize),Ye.unbind(t,"paste",this.handlePaste),Ye.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),no(n)),no(e)},Ui.prototype.getValue=function(){return this.content.innerText.trim()},Ui.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Ui.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 e5(e){return e.replace(/\r\n|\r|\n/g,`
315
+ `)}function mi(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ui({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())}mi.$inject=["eventBus","canvas"],mi.prototype.registerProvider=function(e){this._providers.push(e)},mi.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},mi.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},mi.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},mi.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},mi.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},mi.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()}},mi.prototype.getValue=function(){return this._textbox.getValue()},mi.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()},mi.prototype._handleResize=function(e){this._fire("resize",e)},mi.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},mi.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=$t(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 l1={__depends__:[lu],__init__:["directEditing"],directEditing:["type",mi]};function t5(e){return function(t){var n=t.target,i=Ee(e),o=i.eventDefinitions&&i.eventDefinitions[0],r=i.$type===n.type,a=(o&&o.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===yt(e);return!r||!a||!s||!c}}const n5={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 we(e,t={}){var n=n5[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var i5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing"),we("none-end-event",{actionName:"replace-with-none-end"}),we("message-start"),we("timer-start"),we("conditional-start"),we("signal-start")],o5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing"),we("none-end-event",{actionName:"replace-with-none-end"})],r5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),we("none-end-event",{actionName:"replace-with-none-end"}),we("message-intermediate-catch"),we("message-intermediate-throw"),we("timer-intermediate-catch"),we("escalation-intermediate-throw"),we("conditional-intermediate-catch"),we("link-intermediate-catch"),we("link-intermediate-throw"),we("compensation-intermediate-throw"),we("signal-intermediate-catch"),we("signal-intermediate-throw")],a5=[we("none-start-event",{actionName:"replace-with-none-start"}),we("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),we("none-end-event",{actionName:"replace-with-none-end"}),we("message-end"),we("escalation-end"),we("error-end"),we("cancel-end"),we("compensation-end"),we("signal-end"),we("terminate-end")],s5=[we("exclusive-gateway"),we("parallel-gateway"),we("inclusive-gateway"),we("complex-gateway"),we("event-based-gateway")],c5=[we("transaction"),we("event-subprocess"),we("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),we("collapsed-subprocess")],l5=[we("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),we("transaction"),we("event-subprocess"),we("collapsed-ad-hoc-subprocess")],u1=[we("transaction"),we("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),we("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),we("event-subprocess")],u5=u1,p1=[we("task"),we("user-task"),we("service-task"),we("send-task"),we("receive-task"),we("manual-task"),we("rule-task"),we("script-task"),we("call-activity"),we("collapsed-subprocess"),we("expanded-subprocess"),we("collapsed-ad-hoc-subprocess"),we("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],p5=[we("data-store-reference")],d5=[we("data-object-reference")],f5=[we("message-boundary"),we("timer-boundary"),we("escalation-boundary"),we("conditional-boundary"),we("error-boundary"),we("cancel-boundary"),we("signal-boundary"),we("compensation-boundary"),we("non-interrupting-message-boundary"),we("non-interrupting-timer-boundary"),we("non-interrupting-escalation-boundary"),we("non-interrupting-conditional-boundary"),we("non-interrupting-signal-boundary")],h5=[we("message-start"),we("timer-start"),we("conditional-start"),we("signal-start"),we("error-start"),we("escalation-start"),we("compensation-start"),we("non-interrupting-message-start"),we("non-interrupting-timer-start"),we("non-interrupting-conditional-start"),we("non-interrupting-signal-start"),we("non-interrupting-escalation-start")],g5=[{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"}],m5=[we("expanded-pool"),we("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],y5={"bpmn:MessageEventDefinition":[we("message-start"),we("message-intermediate-catch"),we("message-intermediate-throw"),we("message-end")],"bpmn:TimerEventDefinition":[we("timer-start"),we("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[we("conditional-start"),we("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[we("signal-start"),we("signal-intermediate-catch"),we("signal-intermediate-throw"),we("signal-end")],"bpmn:ErrorEventDefinition":[we("error-start"),we("error-end")],"bpmn:EscalationEventDefinition":[we("escalation-start"),we("escalation-intermediate-throw"),we("escalation-end")],"bpmn:CompensateEventDefinition":[we("compensation-start"),we("compensation-intermediate-throw"),we("compensation-end")]};const d1={"start-event-non-interrupting":`
316
316
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
317
317
  <g transform="translate(0 995.64)">
318
318
  <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
@@ -323,7 +323,7 @@
323
323
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
324
324
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
325
325
  </g>
326
- </svg>`};function Li(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()}Li.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Li.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Li.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Qe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=e5(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,u5):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,p5):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=m5[o]||[],!Un(t.$parent)&&A(t.$parent,"bpmn:SubProcess")&&(i=ft(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),A(t,"bpmn:StartEvent")&&!A(t.$parent,"bpmn:SubProcess")?(r=ft(n5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=ft(g5,function(c){return yt(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Un(t.$parent)?(r=ft(f5.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&!Un(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=ft(i5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=ft(r5.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):A(t,"bpmn:BoundaryEvent")?(r=ft(d5,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:IntermediateCatchEvent")||A(t,"bpmn:IntermediateThrowEvent")?(r=ft(o5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=ft(a5,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=ft(u1,a),this._createEntries(e,r)):Un(t)&&yt(e)?(r=ft(l5,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&yt(e)?(r=ft(c5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&yt(e)?(r=ft(s5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!yt(e)?(r=ft(p1,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):A(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,h5):A(t,"bpmn:FlowNode")?(r=ft(p1,a),this._createEntries(e,r)):{})},Li.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Nb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Li.prototype._createEntries=function(e,t){var n={},i=this;return U(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Li.prototype._createSequenceFlowEntries=function(e,t){var n=Ee(e),i={},o=this._modeling,r=this._moddle,a=this;return U(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&A(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:A(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Li.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}},Li.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&A(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=Ee(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Li.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}}},Li.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}}},Li.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ee(e),i=this,o=$b(e),r=A(e,"bpmn:BoundaryEvent")?d1["intermediate-event-non-interrupting"]:d1["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 y5={__depends__:[Eg,o_,Du],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Li]};function _c(e,t,n,i,o,r,a,s,c,l,u,p,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=d,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(f){var m=f.context,g=m.shape;if(!(!qs(f)||!i.isOpen(g))){var y=i.getEntries(g);y.replace&&y.replace.action.click(f,g)}}),n.on("contextPad.close",function(){d.cleanUp()})}_c.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],_c.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&Z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},_c.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Qe(t)?zo(e,n=>t.includes(n)):t},_c.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])&&Z(u,m()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function g(v){var b=5,E=t.getPad(v).html,M=E.getBoundingClientRect(),B={x:M.left,y:M.bottom+b};return B}function y(v,b,E,M){function B(N,G){var q=i.createShape(Z({type:v},M));r.start(N,q,{source:G})}var P=s?function(N,G){var q=i.createShape(Z({type:v},M));s.append(G,q)}:B,k=s?function(N,G){return l.create(G,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:B,click:P,hover:k}}}function _(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(dt(p,["bpmn:Lane","bpmn:Participant"])&&yt(e)){var h=ar(e);Z(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,b){n.addLane(b,"top")}}}}),h.length<2&&((Rn(e)?e.height>=120:e.width>=120)&&Z(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(Rn(e)?e.height>=180:e.width>=180)&&Z(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),Z(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,b){n.addLane(b,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?Z(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):f1(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?Z(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!f1(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Un(p)&&Z(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||Z(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=Z(g(b),{cursor:{x:v.x,y:v.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),dt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:d,dragstart:d}}}),A(p,"bpmn:TextAnnotation")&&Z(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),dt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Z(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),A(p,"bpmn:Group")&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&Z(u,m()),u};function f1(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return U(r,function(a){a.$type===n&&(o=!0)}),i&&o}const v5={__depends__:[X$,l1,z0,Pi,kg,pu,y5],__init__:["contextPadProvider"],contextPadProvider:["type",_c]};var x5={horizontal:["x","width"],vertical:["y","height"]},h1=5;function $o(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Qe(i)?i:i?n:[]})}$o.$inject=["modeling","rules"],$o.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},$o.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},$o.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(U(t,function(r){o=r(o,n,i)}),o):e},$o.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=Xi(e,i);return U(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},$o.prototype._setOrientation=function(e){var t=x5[e];this._axis=t[0],this._dimension=t[1]},$o.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)},$o.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+h1,max:t+n-h1}};const b5={__init__:["distributeElements"],distributeElements:["type",$o]};function hp(e){Ti.call(this,e)}hp.$inject=["eventBus"],Ne(hp,Ti),hp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ft(t,function(n){var i=dt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=El(t),t.length<3?!1:t})};var g1={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
326
+ </svg>`};function Li(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()}Li.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Li.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Li.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],o,r=[];if(Qe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=t5(e);return A(t,"bpmn:DataObjectReference")?this._createEntries(e,p5):A(t,"bpmn:DataStoreReference")&&!A(e.parent,"bpmn:Collaboration")?this._createEntries(e,d5):(A(t,"bpmn:Event")&&!A(t,"bpmn:BoundaryEvent")&&(o=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=y5[o]||[],!Un(t.$parent)&&A(t.$parent,"bpmn:SubProcess")&&(i=ft(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),A(t,"bpmn:StartEvent")&&!A(t.$parent,"bpmn:SubProcess")?(r=ft(i5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Participant")?(r=ft(m5,function(c){return yt(e)!==c.target.isExpanded}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&Un(t.$parent)?(r=ft(h5.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,p=t.isInterrupting===u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:StartEvent")&&!Un(t.$parent)&&A(t.$parent,"bpmn:SubProcess")?(r=ft(o5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:EndEvent")?(r=ft(a5.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,r)):A(t,"bpmn:BoundaryEvent")?(r=ft(f5,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!A(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,p=t.cancelActivity==u;return a(c)||!a(c)&&!p}),this._createEntries(e,r)):A(t,"bpmn:IntermediateCatchEvent")||A(t,"bpmn:IntermediateThrowEvent")?(r=ft(r5.concat(i),a),this._createEntries(e,r)):A(t,"bpmn:Gateway")?(r=ft(s5,a),this._createEntries(e,r)):A(t,"bpmn:Transaction")?(r=ft(u1,a),this._createEntries(e,r)):Un(t)&&yt(e)?(r=ft(u5,a),this._createEntries(e,r)):A(t,"bpmn:AdHocSubProcess")&&yt(e)?(r=ft(l5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&yt(e)?(r=ft(c5,a),this._createEntries(e,r)):A(t,"bpmn:SubProcess")&&!yt(e)?(r=ft(p1,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,r)):A(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,g5):A(t,"bpmn:FlowNode")?(r=ft(p1,a),this._createEntries(e,r)):{})},Li.prototype.getPopupMenuHeaderEntries=function(e){var t={};return A(e,"bpmn:Activity")&&!Un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),A(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),A(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Nb(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Li.prototype._createEntries=function(e,t){var n={},i=this;return U(t,function(o){n[o.actionName]=i._createEntry(o,e)}),n},Li.prototype._createSequenceFlowEntries=function(e,t){var n=Ee(e),i={},o=this._modeling,r=this._moddle,a=this;return U(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&A(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=r.create("bpmn:FormalExpression",{body:""});o.updateProperties(e,{conditionExpression:c})})});break;default:A(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e,{conditionExpression:void 0})})}),(A(n.sourceRef,"bpmn:ExclusiveGateway")||A(n.sourceRef,"bpmn:InclusiveGateway")||A(n.sourceRef,"bpmn:ComplexGateway")||A(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){o.updateProperties(e.source,{default:void 0})})})}}),i},Li.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}},Li.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&A(p,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:u.options.isSequential}):(p=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var o=Ee(e),r=o.loopCharacteristics,a,s,c;return r&&(a=r.isSequential,s=r.isSequential===void 0,c=r.isSequential!==void 0&&!r.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Li.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}}},Li.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}}},Li.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Ee(e),i=this,o=$b(e),r=A(e,"bpmn:BoundaryEvent")?d1["intermediate-event-non-interrupting"]:d1["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 v5={__depends__:[Eg,o_,Du],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Li]};function _c(e,t,n,i,o,r,a,s,c,l,u,p,d){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=o,this._elementFactory=r,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=p,this._eventBus=n,this._appendPreview=d,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(f){var m=f.context,g=m.shape;if(!(!qs(f)||!i.isOpen(g))){var y=i.getEntries(g);y.replace&&y.replace.action.click(f,g)}}),n.on("contextPad.close",function(){d.cleanUp()})}_c.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],_c.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&Z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,o){t.removeElements(o.slice())}}}}),n},_c.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Qe(t)?zo(e,n=>t.includes(n)):t},_c.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])&&Z(u,m()),u;var p=e.businessObject;function d(v,b){o.start(v,b)}function f(v,b){n.removeElements([b])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:f}}}}function g(v){var b=5,E=t.getPad(v).html,M=E.getBoundingClientRect(),B={x:M.left,y:M.bottom+b};return B}function y(v,b,E,M){function B(N,G){var q=i.createShape(Z({type:v},M));r.start(N,q,{source:G})}var P=s?function(N,G){var q=i.createShape(Z({type:v},M));s.append(G,q)}:B,k=s?function(N,G){return l.create(G,v,M),()=>{l.cleanUp()}}:null;return{group:"model",className:b,title:E,action:{dragstart:B,click:P,hover:k}}}function _(v){return function(b,E){n.splitLane(E,v),t.open(E,!0)}}if(dt(p,["bpmn:Lane","bpmn:Participant"])&&yt(e)){var h=ar(e);Z(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,b){n.addLane(b,"top")}}}}),h.length<2&&((Rn(e)?e.height>=120:e.width>=120)&&Z(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:_(2)}}}),(Rn(e)?e.height>=180:e.width>=180)&&Z(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:_(3)}}})),Z(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,b){n.addLane(b,"bottom")}}}})}return A(p,"bpmn:FlowNode")&&(A(p,"bpmn:EventBasedGateway")?Z(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):f1(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?Z(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!A(p,"bpmn:EndEvent")&&!p.isForCompensation&&!f1(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Un(p)&&Z(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||Z(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,b){var E=Z(g(b),{cursor:{x:v.x,y:v.y}});a.open(b,"bpmn-replace",E,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),A(p,"bpmn:SequenceFlow")&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),A(p,"bpmn:MessageFlow")&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),dt(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:d,dragstart:d}}}),A(p,"bpmn:TextAnnotation")&&Z(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:d,dragstart:d}}}),dt(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Z(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:d,dragstart:d}}}),A(p,"bpmn:Group")&&Z(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&Z(u,m()),u};function f1(e,t,n){var i=e.$instanceOf(t),o=!1,r=e.eventDefinitions||[];return U(r,function(a){a.$type===n&&(o=!0)}),i&&o}const x5={__depends__:[Z$,l1,z0,Pi,kg,pu,v5],__init__:["contextPadProvider"],contextPadProvider:["type",_c]};var b5={horizontal:["x","width"],vertical:["y","height"]},h1=5;function $o(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Qe(i)?i:i?n:[]})}$o.$inject=["modeling","rules"],$o.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},$o.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},$o.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,o=[].concat(e);return t.length?(U(t,function(r){o=r(o,n,i)}),o):e},$o.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=Xi(e,i);return U(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},$o.prototype._setOrientation=function(e){var t=b5[e];this._axis=t[0],this._dimension=t[1]},$o.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)},$o.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+h1,max:t+n-h1}};const w5={__init__:["distributeElements"],distributeElements:["type",$o]};function hp(e){Ti.call(this,e)}hp.$inject=["eventBus"],Ne(hp,Ti),hp.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ft(t,function(n){var i=dt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=El(t),t.length<3?!1:t})};var g1={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
327
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
328
328
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
329
329
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -331,7 +331,7 @@
331
331
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
332
332
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
333
333
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
334
- </svg>`},w5=900;function Ec(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",w5,this)}Ec.$inject=["popupMenu","distributeElements","translate","rules"],Ec.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Z(t,this._getEntries(e)),t},Ec.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ec.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:g1.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:g1.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const _5={__depends__:[Eg,b5],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",hp],distributeElementsMenuProvider:["type",Ec]};var m1="is not a registered action",E5="is already registered";function Ii(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ii.$inject=["eventBus","injector"],Ii.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var d=Qe(p)?p:u;return r.cut(d.slice())}}}),o&&this.register("stepZoom",function(u){o.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),d;p!==!1&&(Qe(p)?d=p:d=u,d.length&&n.removeElements(d.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ii.prototype.trigger=function(e,t){if(!this._actions[e])throw Dg(e,m1);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ii.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);U(e,function(i,o){n._registerAction(o,i)})},Ii.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Dg(e,E5);this._actions[e]=t},Ii.prototype.unregister=function(e){if(!this.isRegistered(e))throw Dg(e,m1);this._actions[e]=void 0},Ii.prototype.getActions=function(){return Object.keys(this._actions)},Ii.prototype.isRegistered=function(e){return!!this._actions[e]};function Dg(e,t){return new Error(e+" "+t)}const S5={__init__:["editorActions"],editorActions:["type",Ii]};function gp(e){e.invoke(Ii,this)}Ne(gp,Ii),gp.$inject=["injector"],gp.prototype._registerDefaultActions=function(e){Ii.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),d=e.get("modeling",!1),f=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),g=n.filter(function(y){return y!==m});return i.select(g),g}),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(m){var g=i.get(),y=m.type;g.length&&c.trigger(g,y)}),i&&l&&this._registerAction("alignElements",function(m){var g=i.get(),y=[],_=m.type;g.length&&(y=ft(g,function(h){return!A(h,"bpmn:Lane")}),l.trigger(y,_))}),i&&d&&this._registerAction("setColor",function(m){var g=i.get();g.length&&d.setColor(g,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&d&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),g,y;A(m,"bpmn:Collaboration")?y=n.filter(function(_){return A(_.parent,"bpmn:Collaboration")}):y=n.filter(function(_){return _!==m&&!A(_.parent,"bpmn:SubProcess")}),g=dn(y),d.moveElements(y,{x:-g.x,y:-g.y},m)}),i&&f&&this._registerAction("replaceElement",function(m){f.triggerEntry("replace","click",m)})};const R5={__depends__:[S5],editorActions:["type",gp]};function y1(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;dt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}y1.$inject=["eventBus"];function ra(e,t){_e.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;ri(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}ra.$inject=["eventBus","gridSnapping","modeling"],Ne(ra,_e),ra.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},ra.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},ra.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),Z(e,r),e},ra.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),Z(e,r),e};var M5=2e3;function v1(e,t){e.on(["spaceTool.move","spaceTool.end"],M5,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)}})}v1.$inject=["eventBus","gridSnapping"];const C5={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ra],gridSnappingSpaceToolBehavior:["type",v1]};var mp=10;function Lg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var A5=1200,T5=800;function xr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",T5,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"],A5,function(r){var a=r.originalEvent;if(!(!o.active||a&&di(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=k5(r,l,e);p&&(u.offset=p);var d=P5(r,l);d&&Z(u,d),Qa(r,l)||o.snapEvent(r,l,u)})}})}xr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);mn(e,t,i)},xr.prototype.getGridSpacing=function(){return mp},xr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Lg(e,mp);var i,o;return t&&t.min&&(i=t.min,et(i)&&(i=Lg(i+n,mp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,et(o)&&(o=Lg(o+n,mp,"floor"),e=Math.min(e,o))),e-=n,e},xr.prototype.isActive=function(){return this.active},xr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},xr.prototype.toggleActive=function(){this.setActive(!this.active)},xr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function P5(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&&(yp(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&&(yp(t)?b1(s)?a.x.max=c.left:a.x.min=c.right:x1(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(yp(t)?b1(s)?a.x.min=l.left:a.x.max=l.right:x1(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function k5(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&et(s[t])||(s||(s=r.snapOffset={}),et(s[t])||(s[t]=0),!o)||(n.get(o.id)||(yp(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 yp(e){return e==="x"}function x1(e){return e.indexOf("n")!==-1}function b1(e){return e.indexOf("w")!==-1}const O5={__depends__:[C5],__init__:["gridSnapping"],gridSnapping:["type",xr]};var D5=1750;function w1(e,t,n){t.on(["create.start","shape.move.start"],D5,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!A(r,"bpmn:Participant")||!A(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}w1.$inject=["canvas","eventBus","gridSnapping"];const L5={__depends__:[O5,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",ng],gridSnappingParticipantBehavior:["type",w1],gridSnappingLayoutConnectionBehavior:["type",Wa]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",y1]};var I5=30,_1=30;function Sc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return yt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return yt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}Sc.$inject=["eventBus","interactionEvents"],Sc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Sc.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=Rn(e)?{width:I5,height:e.height}:{width:e.width,height:_1};return this._interactionEvents.createBoxHit(t,"all",n),!0},Sc.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:_1}),!0};const B5={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Sc]};function vp(e){e.invoke(Ua,this)}Ne(vp,Ua),vp.$inject=["injector"],vp.prototype.registerBindings=function(e,t){Ua.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 N5={__depends__:[cg],__init__:["keyboardBindings"],keyboardBindings:["type",vp]};var $5={moveSpeed:1,moveSpeedAccelerated:10},F5=1500,E1="left",S1="up",R1="right",M1="down",j5={ArrowLeft:E1,Left:E1,ArrowUp:S1,Up:S1,ArrowRight:R1,Right:R1,ArrowDown:M1,Down:M1},H5={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function C1(e,t,n,i,o){var r=this;this._config=Z({},$5,e||{}),t.addListener(F5,function(a){var s=a.keyEvent,c=j5[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=H5[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}C1.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const z5={__depends__:[cg,Pi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",C1]};var A1=10;function Rc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,d=c.resizeConstraints,f;c.delta=l,f=sO(u,p,l),c.newBounds=lO(f,d),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:Ze(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=bx(p),!G5(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)})}Rc.prototype.canResize=function(e){var t=this._rules,n=ji(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Rc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=Z({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,T1(t,r),"resize",{autoActivate:!0,cursor:V5(r),data:{shape:t,context:o}})},Rc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:A1,height:A1},o=lb(t,e.childrenBoxPadding),uO(n,t,i,o)},Rc.$inject=["eventBus","rules","modeling","dragging"];function G5(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function T1(e,t){var n=tt(e),i=Ze(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 V5(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var P1="djs-resizing",k1="resize-not-ok",W5=500;function O1(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,P1)),s.width>5&&De(c,{x:s.x,width:s.width}),s.height>5&&De(c,{y:s.y,height:s.height}),r.canExecute?mt(c).remove(k1):mt(c).add(k1)}function o(r){var a=r.shape,s=r.frame;s&&pn(r.frame),t.removeMarker(a,P1)}e.on("resize.move",W5,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}O1.$inject=["eventBus","canvas","previewSupport"];var xp=-6,bp=8,wp=20,Mc="djs-resizer",U5=["n","w","s","e","nw","ne","se","sw"];function br(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&&U(a,Qn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){cr(r)&&i.activate(r,e,n)}Ye.bind(t,"mousedown",o),Ye.bind(t,"touchstart",o)},br.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=q5(i),a=He("g");mt(a).add(Mc),mt(a).add(Mc+"-"+e.id),mt(a).add(Mc+"-"+i),ot(o,a);var s=He("rect");De(s,{x:-bp/2+r.x,y:-bp/2+r.y,width:bp,height:bp}),mt(s).add(Mc+"-visual"),ot(a,s);var c=He("rect");return De(c,{x:-wp/2+r.x,y:-wp/2+r.y,width:wp,height:wp}),mt(c).add(Mc+"-hit"),ot(a,c),Tl(a,t,n),a},br.prototype.createResizer=function(e,t){var n=T1(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;Lt(e)||U(U5,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();Cs(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function q5(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-xp:e.indexOf("w")!==-1&&(t.x=xp),e.indexOf("s")!==-1?t.y=-xp:e.indexOf("n")!==-1&&(t.y=xp),t}const D1={__depends__:[co,Po,Ha],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Rc],resizePreview:["type",O1],resizeHandles:["type",br]};var Y5=2e3;function Cc(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"],Y5,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,d=c.isTouch;d||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||dt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Cc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Cc.prototype.activate=function(e){var t=ui(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);Z(n,i);var o={},r=n.style||{};return Z(r,{backgroundColor:null,border:null}),(dt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||L1(e))&&Z(o,{centerVertically:!0}),or(e)&&(Z(o,{resizable:!0,autoResize:!0}),Z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(Z(o,{resizable:!0,autoResize:!0}),Z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),Z(n,{options:o,style:r}),n}},Cc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(A(e,"bpmn:Lane")||Z5(e)){var m=Rn(e),g=m?{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};Z(r,g),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(X5(e)){var y=Rn(e),_=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};Z(r,_),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(dt(e,["bpmn:Task","bpmn:CallActivity"])||L1(e))&&(Z(r,{width:i.width,height:i.height}),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),K5(e)&&(Z(r,{width:i.width,x:i.x}),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var h=1,v=i.width+2*h;if(n.labelTarget&&(Z(r,{width:v,height:i.height+2*h,x:i.x-h,y:i.y-h}),Z(f,{fontSize:l+"px",lineHeight:u})),or(n)&&!Ol(n)&&!ut(n)){var b=df(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),M=l,B=Wr.width*a+2*h;Z(r,{width:B,height:M+2*h,x:E.x-B/2,y:E.y-M/2-h}),Z(f,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(Z(r,{width:i.width+2*h,height:i.height+2*h,x:i.x-h,y:i.y-h,minWidth:30*a,minHeight:10*a}),Z(f,{textAlign:"left",paddingTop:Ta*a+"px",paddingBottom:Ta*a+"px",paddingLeft:Ta*a+"px",paddingRight:Ta*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Cc.prototype.update=function(e,t,n,i){var o,r;A(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),J5(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function L1(e){return A(e,"bpmn:SubProcess")&&!yt(e)}function K5(e){return A(e,"bpmn:SubProcess")&&yt(e)}function X5(e){return A(e,"bpmn:Participant")&&!yt(e)}function Z5(e){return A(e,"bpmn:Participant")&&yt(e)}function J5(e){return!e||!e.trim()}var I1="djs-element-hidden",B1="djs-label-hidden";function N1(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,A(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=He("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=He("path");De(p,{d:u,strokeWidth:2,stroke:Q5(r)}),ot(s,p),ot(o,s),$n(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,I1):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,B1)}),e.on("directEditing.resize",function(c){if(A(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),d=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});De(i.path,{d})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,I1),t.removeMarker(r,B1)),r=void 0,a=void 0,s&&(pn(s),s=void 0)})}N1.$inject=["eventBus","canvas","pathMap"];function Q5(e,t){var n=xt(e);return n.get("stroke")||t||"black"}const e3={__depends__:[Ph,D1,l1],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Cc],labelEditingPreview:["type",N1]};var t3=500,n3=1e3;function fo(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){p2(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){U(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],t3,function(r){var a=r.element,s=r.gfx,c=Ct(".djs-outline",s);c&&i.updateOutline(a,c)})}fo.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Ct(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ot(t,n),this.updateOutline(e,n)),n},fo.prototype._createOutlineGfx=function(){var e=He("rect");return De(e,Z({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},fo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},fo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&U(i,function(o){n=n||o.updateOutline(t,e)}),n||De(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},fo.prototype.updateConnectionOutline=function(e,t){var n=dn(t);De(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},fo.prototype.registerProvider=function(e,t){t||(t=e,e=n3),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},fo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},fo.prototype.getOutline=function(e){var t,n=this._getProviders();return U(n,function(i){Sn(i.getOutline)&&(t=t||i.getOutline(e))}),t},fo.$inject=["eventBus","styles","elementRegistry"];var _p=6;function Ig(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)})}Ig.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Cs(t);var n=e.length>1,i=this._canvas.getContainer();if(mt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=i3(dn(e)),r=He("rect");De(r,Z({rx:3},o)),mt(r).add("djs-selection-outline"),ot(t,r)}},Ig.$inject=["eventBus","canvas","selection"];function i3(e){return{x:e.x-_p,y:e.y-_p,width:e.width+_p*2,height:e.height+_p*2}}const Bg={__depends__:[Pi],__init__:["outline","multiSelectionOutline"],outline:["type",fo],multiSelectionOutline:["type",Ig]},$1=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],F1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},o3=15,Ep=2;function j1(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var f;const d=p.filter(m=>dt(m,$1));if(d.length===1){const m=d[0];ut(m)?a(m,m.labelTarget):(f=m.labels)!=null&&f.length&&a(m.labels[0],m)}if(d.length===2){const m=d.find(ut),g=d.find(y=>{var _;return(_=y.labels)==null?void 0:_.includes(m)});m&&g&&a(m,g)}}),e.on("shape.changed",function({element:p}){var d;!dt(p,$1)||!u(p)||(ut(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=Ps([tt(d),tt(p)],F1),m=f.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),_=Ls(y,m);if(!_)return;const v=o.isSelected(d)?c(d):l(d),b=Ls(v,m)||tt(d);Vs(b,_)<o3||(of(f,[b,_]),ot(r,f))}function s(){Ms(`.${F1.class}`,r).forEach(pn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+wr(d,"x")-Ep,y:p.y+wr(d,"y")-Ep,width:wr(d,"width")+Ep*2,height:wr(d,"height")+Ep*2};return hf(f,wr(d,"rx"))}if(d.cx){const f=wr(d,"r"),m={x:p.x+wr(d,"cx")-f,y:p.y+wr(d,"cy")-f,width:f*2,height:f*2};return Ux(m)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}j1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function wr(e,t){return parseFloat(De(e,t)||0)}const r3={__depends__:[Pi,Bg],__init__:["labelLink"],labelLink:["type",j1]};var a3=new Xr("tt");function s3(e){var t=Vt('<div class="djs-tooltip-container" />');return Kn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function c3(e,t,n){Kn(e,{left:t+"px",top:n+"px"})}function Ng(e,t){e.style.display=t===!1?"none":""}var H1="djs-tooltip",$g="."+H1;function ni(e,t){this._eventBus=e,this._canvas=t,this._ids=a3,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=s3(t.getContainer());var n=this;ci.bind(this._tooltipRoot,$g,"mousedown",function(i){i.stopPropagation()}),ci.bind(this._tooltipRoot,$g,"mouseover",function(i){n.trigger("mouseover",i)}),ci.bind(this._tooltipRoot,$g,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ni.$inject=["eventBus","canvas"],ni.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=Z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ni.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Tn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ni.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ni.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ni.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)}},ni.prototype.remove=function(e){var t=this.get(e);t&&(no(t.html),no(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ni.prototype.show=function(){Ng(this._tooltipRoot)},ni.prototype.hide=function(){Ng(this._tooltipRoot,!1)},ni.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},ni.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)),ri(n)&&(n=Vt(n)),i=Vt('<div data-tooltip-id="'+t+'" class="'+H1+'">'),Kn(i,{position:"absolute"}),i.appendChild(n),e.type&&Pt(i).add("djs-tooltip-"+e.type),e.className&&Pt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ni.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;c3(n,t.x,t.y)},ni.prototype._updateTooltipVisibilty=function(e){U(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Ng(i,o))})},ni.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 l3={__init__:["tooltips"],tooltips:["type",ni]};var u3="flow elements must be children of pools/participants",p3="Data object must be placed within a pool/participant.";function z1(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(u3)):A(a,"bpmn:DataObjectReference")&&i(o,n(p3)))})}z1.$inject=["eventBus","tooltips","translate"];const d3={__depends__:[l3],__init__:["modelingFeedback"],modelingFeedback:["type",z1]};var f3=500,h3=1250,g3=1500,Sp=Math.round;function m3(e){return{x:e.x+Sp(e.width/2),y:e.y+Sp(e.height/2)}}function G1(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",g3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=y3(u),Z(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",h3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",f3,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},d={x:s.x,y:s.y},f;if(f=r(l,p,d,u),c.delta=p,c.canExecute=f,f===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",d=c.shapes;if(u===!1)return!1;l.x=Sp(l.x),l.y=Sp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(d,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(cr(s)){var c=Na(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(bn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!mt(s.target).has("djs-hit-no-move")){var p=m3(c),d=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(d!==!1)return!0}}this.start=a}G1.$inject=["eventBus","dragging","modeling","selection","rules"];function y3(e){var t=ga(e,"id");return ft(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var V1=499,Fg="djs-dragging",W1="drop-ok",U1="drop-not-ok",q1="new-parent",Y1="attach-ok";function K1(e,t,n,i){function o(c){var l=r(c),u=v3(l);return u}function r(c){var l=ks(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[Y1,W1,U1,q1].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,Fg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",V1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=He("g");De(f,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();ot(m,f),l.dragGroup=f}d.forEach(function(g){i.addDragger(g,l.dragGroup)}),p?p=zp([p,r(u)]):p=r(u),U(p,function(g){t.addMarker(g,Fg)}),l.allDraggedElements=p,l.differentParents=x3(u)}),e.on("shape.move.move",V1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,Y1):l.canExecute&&d&&p.id!==d.id?a(p,q1):a(p,l.canExecute?W1:U1)),$n(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;U(u,function(d){t.removeMarker(d,Fg)}),p&&pn(p)}),this.makeDraggable=s}K1.$inject=["eventBus","canvas","styles","previewSupport"];function v3(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ft(e,function(i){return Lt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function x3(e){return OR(ga(e,function(t){return t.parent&&t.parent.id}))!==1}const b3={__depends__:[lu,Pi,Bg,co,Po,Ha],__init__:["move","movePreview"],move:["type",G1],movePreview:["type",K1]};var X1=".djs-palette-toggle",Z1=".entry",w3=X1+", "+Z1,jg="djs-palette-",_3="shown",Hg="open",J1="two-column",E3=1e3;function yn(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()})}yn.$inject=["eventBus","canvas"],yn.prototype.registerProvider=function(e,t){t||(t=e,e=E3),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},yn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(R3,{})},yn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},yn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Vt(yn.HTML_MARKUP);n.appendChild(i),Pt(n).add(jg+_3),ci.bind(i,w3,"click",function(o){var r=o.delegateTarget;if(qd(r,X1))return e.toggle();e.trigger("click",o)}),Ye.bind(i,"mousedown",function(o){o.stopPropagation()}),ci.bind(i,Z1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},yn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},yn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Pt(n),a=Pt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(J1,o),a.toggle(jg+J1,o),"open"in e&&(r.toggle(Hg,e.open),a.toggle(jg+Hg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},yn.prototype._update=function(){var e=Ct(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xl(e),U(t,function(n,i){var o=n.group||"default",r=Ct("[data-group="+ea(o)+"]",e);r||(r=Vt('<div class="group"></div>'),Tn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Vt(a);if(r.appendChild(s),!n.separator&&(Tn(s,"data-action",i),n.title&&Tn(s,"title",n.title),n.className&&S3(s,n.className),n.imageUrl)){var c=Vt("<img>");Tn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},yn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Tn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},yn.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(Sn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},yn.prototype._layoutChanged=function(){this._toggleState({})},yn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},yn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},yn.prototype.open=function(){this._toggleState({open:!0})},yn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},yn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},yn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ct(".djs-palette-entries",this._container),this._toolsContainer=Ct("[data-group=tools]",t)),n=this._toolsContainer,U(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Pt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},yn.prototype.isOpen=function(){return Pt(this._container).has(Hg)},yn.prototype._getParentContainer=function(){return this._canvas.getContainer()},yn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function S3(e,t){var n=Pt(e),i=Qe(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function R3(e,t){var n=t.getPaletteEntries();return Sn(n)?n(e):(U(n,function(i,o){e[o]=i}),e)}const M3={__init__:["palette"],palette:["type",yn]};var Q1="crosshair",eS="selected",C3="djs-dragging-active-lasso";function _r(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var d=t.getActiveLayer(),f=p.frame=He("rect");De(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ot(d,f),l(!0),this.update(p)},update:function(p){var d=p.frame,f=p.bbox;d&&f&&De(d,{x:f.x,y:f.y,width:f.width,height:f.height});var m=p.marked,g=p.lastMarked;if(m&&g){for(const y of g)m.has(y)||t.removeMarker(y,eS);for(const y of m)g.has(y)||t.addMarker(y,eS)}},remove:function(p){this.update(p),p.frame&&pn(p.frame),l(!1)}};function l(p){mt(t.getContainer()).toggle(C3,p)}function u(p){var d=i.getAll();return new Set(ha(Ra(d,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var d=p.originalEvent.target;!p.hover&&!(d instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var d=p.context;s._select(Array.from(d.marked))}),e.on("lasso.start",function(p){var d=p.context;d.bbox=tS(p),d.add=nu(p),d.lastMarked=new Set(o.get()),d.add?d.marked=d.lastMarked:d.marked=new Set,d.initialMarked=d.marked,c.create(d)}),e.on("lasso.move",function(p){var d=p.context,f=d.bbox=tS(p),m=u(f),g=d.initialMarked.union(m);d.lastMarked=d.marked,d.marked=g,c.update(d)}),e.on("lasso.cleanup",function(p){var d=p.context;d.lastMarked=d.marked,d.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(nu(p))return s.activateLasso(p.originalEvent),!0})}_r.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],_r.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Q1,data:{context:{}},keepSelection:!0})},_r.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Q1,data:{context:{}},keepSelection:!0})},_r.prototype._select=function(e){this._selection.select(e)},_r.prototype.select=function(e,t,n=[]){var i=ha(Ra(e,t));this._select([...n,...i])},_r.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},_r.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function tS(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 A3={__depends__:[fu,Xs],__init__:["lassoTool"],lassoTool:["type",_r]};var zg=1500,nS="grab";function es(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",zg,function(c){if(qs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(zg,function(c){if(!(!iS(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(zg,function(c){!iS(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!qs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}es.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],es.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:nS,data:{context:n||{}}})},es.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:nS,data:{context:{reactivate:n}}})},es.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},es.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function iS(e){return _n("Space",e)}const T3={__depends__:[fu,Xs],__init__:["handTool"],handTool:["type",es]};var oS="connect-ok",rS="connect-not-ok";function ts(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?oS:rS))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?oS:rS)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},d=s.canStartConnect(u);if(d)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}ts.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ts.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ts.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ts.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ts.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const P3={__depends__:[kg,co,Po,fu,Xs],globalConnect:["type",ts]};function Gg(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)}Gg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Gg.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,d,f,m,g){function y(_){var h=n.createShape(Z({type:p},g));t.start(_,h)}return{group:d,className:f,title:m,action:{dragstart:y,click:y}}}function l(p){var d=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),f=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:d});t.start(p,[d,f],{hints:{autoSelect:[d]}})}function u(p){t.start(p,n.createParticipantShape())}return Z(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 k3={__depends__:[M3,pu,u_,A3,T3,P3,js],__init__:["paletteProvider"],paletteProvider:["type",Gg]};var O3=250;function Vg(e,t,n,i,o){_e.call(this,e);function r(s){var c=s.canExecute.replacements;U(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);Z(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var m=Ct('[data-element-id="'+ea(d.id)+'"]',s.dragGroup);m&&De(m,{display:"none"});var g=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=g,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;U(c,function(l,u){var p=Ct('[data-element-id="'+ea(u)+'"]',s.dragGroup);p&&De(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",O3,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Vg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ne(Vg,_e);const D3={__depends__:[Ha],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Vg]};var L3=1250,Wg=40,I3=20,B3=10,aS=20,sS=["x","y"],N3=Math.abs;function cS(e){e.on(["connect.hover","connect.move","connect.end"],L3,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&di(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&$3(t,r,z3(r)),r&&H3(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Di(o),dt(r,["bpmn:Event","bpmn:Gateway"])&&lS(t,Di(r)),dt(r,["bpmn:Task","bpmn:SubProcess"])&&F3(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&j3(t)):uS(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=Di(o)),A(r,"bpmn:Event")&&lS(t,Di(r))):n.connectionStart=n.initialConnectionStart)})}cS.$inject=["eventBus"];function $3(e,t,n){sS.forEach(function(i){var o=pS(i,t);e[i]<t[i]+n?mn(e,i,t[i]+n):e[i]>t[i]+o-n&&mn(e,i,t[i]+o-n)})}function F3(e,t){var n=Di(t);sS.forEach(function(i){G3(e,t,i)&&mn(e,i,n[i])})}function j3(e){var t=e.context,n=t.source,i=t.target;if(!V3(t)){var o=Di(n),r=Nn(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;N3(c-o[s])<Wg&&(c>o[s]?l=o[s]+Wg:l=o[s]-Wg,mn(e,s,l))})}}function lS(e,t){mn(e,"x",t.x),mn(e,"y",t.y)}function uS(e,t){return e&&e.type===t}function H3(e,t){return Go(t,function(n){return uS(e,n)})}function pS(e,t){return e==="x"?t.width:t.height}function z3(e){return A(e,"bpmn:Task")?B3:I3}function G3(e,t,n){return e[n]>t[n]+aS&&e[n]<t[n]+pS(n,t)-aS}function V3(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Rp,n.initDefaults(this._defaultSnaps)),n};function Rp(){this._snapValues={}}Rp.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)},Rp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&F$(e[n],o[n],i)},Rp.prototype.initDefaults=function(e){var t=this;U(e||{},function(n,i){U(n,function(o){t.add(i,o)})})};var W3=1250;function ho(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"],W3,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&di(o.originalEvent))&&!(Qa(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()})}ho.$inject=["elementRegistry","eventBus","snapping"],ho.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new Er);var r;t.get(i.id)?r=Di(i,e):r={x:e.x+Di(i).x,y:e.y+Di(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}),ut(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},ho.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return U(i,function(o){if(ut(o)){ut(t)&&e.add("mid",Di(o));return}if(Lt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);U(r,function(a){e.add("mid",a)});return}e.add("mid",Di(o))}),!et(t.x)||!et(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Di(t)),e},ho.prototype.getSnapTargets=function(e,t){return JE(t).filter(function(n){return!U3(n)})};function U3(e){return!!e.hidden}var dS=1500;function ns(e,t){t.invoke(ho,this),e.on(["create.move","create.end"],dS,X3),e.on(["create.move","create.end","shape.move.move","shape.move.end"],dS,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Qa(n)&&q3(n,r)})}Ne(ns,ho),ns.$inject=["eventBus","injector"],ns.prototype.initSnap=function(e){var t=ho.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return U(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",hS(r,i,e))}),U(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",hS(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ns.prototype.addSnapTargetPoints=function(e,t,n){ho.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);U(i,function(r){(K3(r)||Y3([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",XE(r)),e.add("bottom-right",ZE(r)))});var o=this._elementRegistry;return U(t.incoming,function(r){if(o.get(t.id)){fS(i,r.source)||e.add("mid",tt(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),U(t.outgoing,function(r){if(o.get(t.id)){fS(i,r.target)||e.add("mid",tt(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),A(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},ns.prototype.getSnapTargets=function(e,t){return ho.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function q3(e,t){var n=Ze(t),i=aw(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=tt(r),/top/.test(i)?mn(e,"y",n.top-a.y):/bottom/.test(i)&&mn(e,"y",n.bottom-a.y),/left/.test(i)?mn(e,"x",n.left-a.x):/right/.test(i)&&mn(e,"x",n.right-a.x)}function Y3(e,t){return e.every(function(n){return A(n,t)})}function K3(e){return A(e,"bpmn:SubProcess")&&yt(e)?!0:A(e,"bpmn:Participant")}function X3(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)&&mn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&mn(e,"y",e.y)}}function fS(e,t){return e.indexOf(t)!==-1}function hS(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var Z3=1250;function Ac(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],Z3,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&di(i.originalEvent))&&!Qa(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),eF(s)&&mn(i,"x",i.x),tF(s)&&mn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ac.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new Er);var r=gS(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Ac.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return U(o,function(r){e.add("corner",ZE(r)),e.add("corner",XE(r))}),e.add("corner",gS(t,i)),e},Ac.$inject=["eventBus","snapping"],Ac.prototype.getSnapTargets=function(e,t){return JE(t).filter(function(n){return!J3(n,e)&&!Lt(n)&&!Q3(n)&&!ut(n)})};function gS(e,t){var n=tt(e),i=Ze(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 J3(e,t){return e.host===t}function Q3(e){return!!e.hidden}function eF(e){return e==="n"||e==="s"}function tF(e){return e==="e"||e==="w"}var nF=7,iF=1e3;function Sr(e){this._canvas=e,this._asyncHide=Vp(Qn(this.hide,this),iF)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Qa(e,"x"),y:Qa(e,"y")};U(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(U(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,nF),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),U(["x","y"],function(a){var s=r[a];bn(s)&&mn(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=He("path");return De(n,{d:"M0,0 L0,0"}),mt(n).add("djs-snap-line"),ot(t,n),{update:function(i){et(i)?e==="horizontal"?De(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):De(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):De(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){U(this._snapLines,function(e){e.update()})};const oF={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ho],resizeSnapping:["type",Ac],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",cS],createMoveSnapping:["type",ns]};var mS=300;function at(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=Ct(at.INPUT_SELECTOR,this._container),this._resultsContainer=Ct(at.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}at.$inject=["canvas","eventBus","selection","translate"],at.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ci.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,at.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,at.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,at.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,at.INPUT_SELECTOR,"keydown",function(n){_n("ArrowUp",n)&&n.preventDefault(),_n("ArrowDown",n)&&n.preventDefault()}),t(this._container,at.INPUT_SELECTOR,"keyup",function(n){if(_n("Escape",n))return e.close();if(_n("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(_n("ArrowUp",n))return e._scrollToDirection(!0);if(_n("ArrowDown",n))return e._scrollToDirection();_n(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},at.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ci.unbind(e.el,e.type,e.listener)})},at.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=Ct(at.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},at.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},at.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)}},at.prototype._clearResults=function(){xl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},at.prototype._getCurrentResult=function(){return Ct(at.RESULT_SELECTED_SELECTOR,this._resultsContainer)},at.prototype._createResultNode=function(e,t){var n=Vt(at.RESULT_HTML);return e.primaryTokens.length>0&&yS(n,e.primaryTokens,at.RESULT_PRIMARY_HTML),yS(n,e.secondaryTokens,at.RESULT_SECONDARY_HTML),Tn(n,at.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},at.prototype.registerProvider=function(e){this._searchProvider=e},at.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,Pt(this._canvas.getContainer()).add("djs-search-open"),Pt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},at.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,Pt(this._canvas.getContainer()).remove("djs-search-open"),Pt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},at.prototype.toggle=function(){this.isOpen()?this.close():this.open()},at.prototype.isOpen=function(){return this._open},at.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Pt(t).remove(at.RESULT_SELECTED_CLASS);var n=Tn(e,at.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Pt(e).add(at.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:mS}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},at.prototype._select=function(e){var t=Tn(e,at.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:mS}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},at.prototype._getBoxHtml=function(){const e=Vt(at.BOX_HTML),t=Ct(at.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function yS(e,t,n){var i=rF(t),o=Vt(n);o.innerHTML=i,e.appendChild(o)}function rF(e){var t="";return e.forEach(function(n){var i=y0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+at.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}at.CONTAINER_SELECTOR=".djs-search-container",at.INPUT_SELECTOR=".djs-search-input input",at.RESULTS_CONTAINER_SELECTOR=".djs-search-results",at.RESULT_SELECTOR=".djs-search-result",at.RESULT_SELECTED_CLASS="djs-search-result-selected",at.RESULT_SELECTED_SELECTOR="."+at.RESULT_SELECTED_CLASS,at.RESULT_ID_ATTRIBUTE="data-result-id",at.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",at.BOX_HTML=`<div class="djs-search-container djs-scrollable">
334
+ </svg>`},_5=900;function Ec(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",_5,this)}Ec.$inject=["popupMenu","distributeElements","translate","rules"],Ec.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&Z(t,this._getEntries(e)),t},Ec.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ec.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:g1.horizontal,action:function(r,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:g1.vertical,action:function(r,a){t.trigger(e,"vertical"),i.close()}}};return o};const E5={__depends__:[Eg,w5],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",hp],distributeElementsMenuProvider:["type",Ec]};var m1="is not a registered action",S5="is already registered";function Ii(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}Ii.$inject=["eventBus","injector"],Ii.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),o=e.get("zoomScroll",!1),r=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),r&&i&&this.register("copy",function(){var u=i.get();if(u.length)return r.copy(u)}),r&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return r.duplicate(u)}),r&&this.register("paste",function(){r.paste()}),r&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u});if(p!==!1){var d=Qe(p)?p:u;return r.cut(d.slice())}}}),o&&this.register("stepZoom",function(u){o.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var p=s.allowed("elements.delete",{elements:u}),d;p!==!1&&(Qe(p)?d=p:d=u,d.length&&n.removeElements(d.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},Ii.prototype.trigger=function(e,t){if(!this._actions[e])throw Dg(e,m1);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},Ii.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);U(e,function(i,o){n._registerAction(o,i)})},Ii.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Dg(e,S5);this._actions[e]=t},Ii.prototype.unregister=function(e){if(!this.isRegistered(e))throw Dg(e,m1);this._actions[e]=void 0},Ii.prototype.getActions=function(){return Object.keys(this._actions)},Ii.prototype.isRegistered=function(e){return!!this._actions[e]};function Dg(e,t){return new Error(e+" "+t)}const R5={__init__:["editorActions"],editorActions:["type",Ii]};function gp(e){e.invoke(Ii,this)}Ne(gp,Ii),gp.$inject=["injector"],gp.prototype._registerDefaultActions=function(e){Ii.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),o=e.get("spaceTool",!1),r=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),l=e.get("alignElements",!1),u=e.get("directEditing",!1),p=e.get("searchPad",!1),d=e.get("modeling",!1),f=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),g=n.filter(function(y){return y!==m});return i.select(g),g}),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(m){var g=i.get(),y=m.type;g.length&&c.trigger(g,y)}),i&&l&&this._registerAction("alignElements",function(m){var g=i.get(),y=[],_=m.type;g.length&&(y=ft(g,function(h){return!A(h,"bpmn:Lane")}),l.trigger(y,_))}),i&&d&&this._registerAction("setColor",function(m){var g=i.get();g.length&&d.setColor(g,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&d&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),g,y;A(m,"bpmn:Collaboration")?y=n.filter(function(_){return A(_.parent,"bpmn:Collaboration")}):y=n.filter(function(_){return _!==m&&!A(_.parent,"bpmn:SubProcess")}),g=dn(y),d.moveElements(y,{x:-g.x,y:-g.y},m)}),i&&f&&this._registerAction("replaceElement",function(m){f.triggerEntry("replace","click",m)})};const M5={__depends__:[R5],editorActions:["type",gp]};function y1(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;dt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}y1.$inject=["eventBus"];function ra(e,t){_e.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var o=i.context,r=o.hints||{},a=r.autoResize;if(a){var s=o.shape,c=o.newBounds;ri(a)?o.newBounds=n.snapComplex(c,a):o.newBounds=n.snapSimple(s,c)}})}ra.$inject=["eventBus","gridSnapping","modeling"],Ne(ra,_e),ra.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},ra.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},ra.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),Z(e,r),e},ra.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),Z(e,r),e};var C5=2e3;function v1(e,t){e.on(["spaceTool.move","spaceTool.end"],C5,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)}})}v1.$inject=["eventBus","gridSnapping"];const A5={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",ra],gridSnappingSpaceToolBehavior:["type",v1]};var mp=10;function Lg(e,t,n){return n||(n="round"),Math[n](e/t)*t}var T5=1200,P5=800;function xr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var o=this;t.on("diagram.init",P5,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"],T5,function(r){var a=r.originalEvent;if(!(!o.active||a&&di(a))){var s=r.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},p=O5(r,l,e);p&&(u.offset=p);var d=k5(r,l);d&&Z(u,d),Qa(r,l)||o.snapEvent(r,l,u)})}})}xr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);mn(e,t,i)},xr.prototype.getGridSpacing=function(){return mp},xr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Lg(e,mp);var i,o;return t&&t.min&&(i=t.min,et(i)&&(i=Lg(i+n,mp,"ceil"),e=Math.max(e,i))),t&&t.max&&(o=t.max,et(o)&&(o=Lg(o+n,mp,"floor"),e=Math.min(e,o))),e-=n,e},xr.prototype.isActive=function(){return this.active},xr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},xr.prototype.toggleActive=function(){this.setActive(!this.active)},xr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function k5(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&&(yp(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&&(yp(t)?b1(s)?a.x.max=c.left:a.x.min=c.right:x1(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(yp(t)?b1(s)?a.x.min=l.left:a.x.max=l.right:x1(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function O5(e,t,n){var i=e.context,o=e.shape,r=i.gridSnappingContext,a=r.snapLocation,s=r.snapOffset;return s&&et(s[t])||(s||(s=r.snapOffset={}),et(s[t])||(s[t]=0),!o)||(n.get(o.id)||(yp(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 yp(e){return e==="x"}function x1(e){return e.indexOf("n")!==-1}function b1(e){return e.indexOf("w")!==-1}const D5={__depends__:[A5],__init__:["gridSnapping"],gridSnapping:["type",xr]};var L5=1750;function w1(e,t,n){t.on(["create.start","shape.move.start"],L5,function(i){var o=i.context,r=o.shape,a=e.getRootElement();if(!(!A(r,"bpmn:Participant")||!A(a,"bpmn:Process")||!a.children.length)){var s=o.createConstraints;s&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height}))}})}w1.$inject=["canvas","eventBus","gridSnapping"];const I5={__depends__:[D5,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",ng],gridSnappingParticipantBehavior:["type",w1],gridSnappingLayoutConnectionBehavior:["type",Wa]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",y1]};var B5=30,_1=30;function Sc(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var o=i.element,r=i.gfx;if(A(o,"bpmn:Lane"))return n._createParticipantHit(o,r);if(A(o,"bpmn:Participant"))return yt(o)?n._createParticipantHit(o,r):n._createDefaultHit(o,r);if(A(o,"bpmn:SubProcess"))return yt(o)?n._createSubProcessHit(o,r):n._createDefaultHit(o,r)})}Sc.$inject=["eventBus","interactionEvents"],Sc.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Sc.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=Rn(e)?{width:B5,height:e.height}:{width:e.width,height:_1};return this._interactionEvents.createBoxHit(t,"all",n),!0},Sc.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:_1}),!0};const N5={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Sc]};function vp(e){e.invoke(Ua,this)}Ne(vp,Ua),vp.$inject=["injector"],vp.prototype.registerBindings=function(e,t){Ua.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 $5={__depends__:[cg],__init__:["keyboardBindings"],keyboardBindings:["type",vp]};var F5={moveSpeed:1,moveSpeedAccelerated:10},j5=1500,E1="left",S1="up",R1="right",M1="down",H5={ArrowLeft:E1,Left:E1,ArrowUp:S1,Up:S1,ArrowRight:R1,Right:R1,ArrowDown:M1,Down:M1},z5={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function C1(e,t,n,i,o){var r=this;this._config=Z({},F5,e||{}),t.addListener(j5,function(a){var s=a.keyEvent,c=H5[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=z5[a](l),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,u)}}}C1.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const G5={__depends__:[cg,Pi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",C1]};var A1=10;function Rc(e,t,n,i){this._dragging=i,this._rules=t;var o=this;function r(c,l){var u=c.shape,p=c.direction,d=c.resizeConstraints,f;c.delta=l,f=cO(u,p,l),c.newBounds=uO(f,d),c.canExecute=o.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=o.computeMinResizeBox(c)),c.resizeConstraints={min:Ze(u)})}function s(c){var l=c.shape,u=c.canExecute,p=c.newBounds;if(u){if(p=bx(p),!V5(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)})}Rc.prototype.canResize=function(e){var t=this._rules,n=ji(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Rc.prototype.activate=function(e,t,n){var i=this._dragging,o,r;if(typeof n=="string"&&(n={direction:n}),o=Z({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,T1(t,r),"resize",{autoActivate:!0,cursor:W5(r),data:{shape:t,context:o}})},Rc.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,o;return i=e.minDimensions||{width:A1,height:A1},o=lb(t,e.childrenBoxPadding),pO(n,t,i,o)},Rc.$inject=["eventBus","rules","modeling","dragging"];function V5(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function T1(e,t){var n=tt(e),i=Ze(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 W5(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var P1="djs-resizing",k1="resize-not-ok",U5=500;function O1(e,t,n){function i(r){var a=r.shape,s=r.newBounds,c=r.frame;c||(c=r.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,P1)),s.width>5&&De(c,{x:s.x,width:s.width}),s.height>5&&De(c,{y:s.y,height:s.height}),r.canExecute?mt(c).remove(k1):mt(c).add(k1)}function o(r){var a=r.shape,s=r.frame;s&&pn(r.frame),t.removeMarker(a,P1)}e.on("resize.move",U5,function(r){i(r.context)}),e.on("resize.cleanup",function(r){o(r.context)})}O1.$inject=["eventBus","canvas","previewSupport"];var xp=-6,bp=8,wp=20,Mc="djs-resizer",q5=["n","w","s","e","nw","ne","se","sw"];function br(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&&U(a,Qn(o.addResizer,o))}),e.on("shape.changed",function(r){var a=r.element;n.isSelected(a)&&(o.removeResizers(),o.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function o(r){cr(r)&&i.activate(r,e,n)}Ye.bind(t,"mousedown",o),Ye.bind(t,"touchstart",o)},br.prototype._createResizer=function(e,t,n,i){var o=this._getResizersParent(),r=Y5(i),a=He("g");mt(a).add(Mc),mt(a).add(Mc+"-"+e.id),mt(a).add(Mc+"-"+i),ot(o,a);var s=He("rect");De(s,{x:-bp/2+r.x,y:-bp/2+r.y,width:bp,height:bp}),mt(s).add(Mc+"-visual"),ot(a,s);var c=He("rect");return De(c,{x:-wp/2+r.x,y:-wp/2+r.y,width:wp,height:wp}),mt(c).add(Mc+"-hit"),ot(a,c),Tl(a,t,n),a},br.prototype.createResizer=function(e,t){var n=T1(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;Lt(e)||U(q5,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();Cs(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function Y5(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-xp:e.indexOf("w")!==-1&&(t.x=xp),e.indexOf("s")!==-1?t.y=-xp:e.indexOf("n")!==-1&&(t.y=xp),t}const D1={__depends__:[co,Po,Ha],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Rc],resizePreview:["type",O1],resizeHandles:["type",br]};var K5=2e3;function Cc(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"],K5,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){r.removeResizers()}),e.on("create.end",500,function(c){var l=c.context,u=l.shape,p=c.context.canExecute,d=c.isTouch;d||p&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||dt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Cc.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Cc.prototype.activate=function(e){var t=ui(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);Z(n,i);var o={},r=n.style||{};return Z(r,{backgroundColor:null,border:null}),(dt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||L1(e))&&Z(o,{centerVertically:!0}),or(e)&&(Z(o,{resizable:!0,autoResize:!0}),Z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),A(e,"bpmn:TextAnnotation")&&(Z(o,{resizable:!0,autoResize:!0}),Z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),Z(n,{options:o,style:r}),n}},Cc.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),o={x:i.x+i.width/2,y:i.y+i.height/2},r={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),l=c.fontSize*a,u=c.lineHeight,p=s.fontSize*a,d=s.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(A(e,"bpmn:Lane")||J5(e)){var m=Rn(e),g=m?{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};Z(r,g),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(Z5(e)){var y=Rn(e),_=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:o.x-i.height/2,y:o.y-i.width/2};Z(r,_),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(dt(e,["bpmn:Task","bpmn:CallActivity"])||L1(e))&&(Z(r,{width:i.width,height:i.height}),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),X5(e)&&(Z(r,{width:i.width,x:i.x}),Z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var h=1,v=i.width+2*h;if(n.labelTarget&&(Z(r,{width:v,height:i.height+2*h,x:i.x-h,y:i.y-h}),Z(f,{fontSize:l+"px",lineHeight:u})),or(n)&&!Ol(n)&&!ut(n)){var b=df(e),E=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),M=l,B=Wr.width*a+2*h;Z(r,{width:B,height:M+2*h,x:E.x-B/2,y:E.y-M/2-h}),Z(f,{fontSize:l+"px",lineHeight:u})}return A(e,"bpmn:TextAnnotation")&&(Z(r,{width:i.width+2*h,height:i.height+2*h,x:i.x-h,y:i.y-h,minWidth:30*a,minHeight:10*a}),Z(f,{textAlign:"left",paddingTop:Ta*a+"px",paddingBottom:Ta*a+"px",paddingLeft:Ta*a+"px",paddingRight:Ta*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:r,style:f}},Cc.prototype.update=function(e,t,n,i){var o,r;A(e,"bpmn:TextAnnotation")&&(r=this._canvas.getAbsoluteBBox(e),o={x:e.x,y:e.y,width:e.width/r.width*i.width,height:e.height/r.height*i.height}),Q5(t)&&(t=null),this._modeling.updateLabel(e,t,o)};function L1(e){return A(e,"bpmn:SubProcess")&&!yt(e)}function X5(e){return A(e,"bpmn:SubProcess")&&yt(e)}function Z5(e){return A(e,"bpmn:Participant")&&!yt(e)}function J5(e){return A(e,"bpmn:Participant")&&yt(e)}function Q5(e){return!e||!e.trim()}var I1="djs-element-hidden",B1="djs-label-hidden";function N1(e,t,n){var i=this,o=t.getDefaultLayer(),r,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(r=l.element.label||l.element,A(r,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(r),s=He("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=i.path=He("path");De(p,{d:u,strokeWidth:2,stroke:e3(r)}),ot(s,p),ot(o,s),$n(s,r.x,r.y)}A(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,I1):(A(r,"bpmn:Task")||A(r,"bpmn:CallActivity")||A(r,"bpmn:SubProcess")||A(r,"bpmn:Participant")||A(r,"bpmn:Lane"))&&t.addMarker(r,B1)}),e.on("directEditing.resize",function(c){if(A(r,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,p=Math.max(r.height/a.height*(l+u),0),d=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:p,position:{mx:0,my:0}});De(i.path,{d})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,I1),t.removeMarker(r,B1)),r=void 0,a=void 0,s&&(pn(s),s=void 0)})}N1.$inject=["eventBus","canvas","pathMap"];function e3(e,t){var n=xt(e);return n.get("stroke")||t||"black"}const t3={__depends__:[Ph,D1,l1],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Cc],labelEditingPreview:["type",N1]};var n3=500,i3=1e3;function fo(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){d2(r)||i.createOutline(r)}e.on("element.hover",function(r){o(r.element)}),e.on("selection.changed",function(r){U(r.newSelection,o)}),e.on(["shape.changed","connection.changed"],n3,function(r){var a=r.element,s=r.gfx,c=Ct(".djs-outline",s);c&&i.updateOutline(a,c)})}fo.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Ct(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ot(t,n),this.updateOutline(e,n)),n},fo.prototype._createOutlineGfx=function(){var e=He("rect");return De(e,Z({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},fo.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},fo.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&U(i,function(o){n=n||o.updateOutline(t,e)}),n||De(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},fo.prototype.updateConnectionOutline=function(e,t){var n=dn(t);De(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},fo.prototype.registerProvider=function(e,t){t||(t=e,e=i3),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},fo.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},fo.prototype.getOutline=function(e){var t,n=this._getProviders();return U(n,function(i){Sn(i.getOutline)&&(t=t||i.getOutline(e))}),t},fo.$inject=["eventBus","styles","elementRegistry"];var _p=6;function Ig(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)})}Ig.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Cs(t);var n=e.length>1,i=this._canvas.getContainer();if(mt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var o=o3(dn(e)),r=He("rect");De(r,Z({rx:3},o)),mt(r).add("djs-selection-outline"),ot(t,r)}},Ig.$inject=["eventBus","canvas","selection"];function o3(e){return{x:e.x-_p,y:e.y-_p,width:e.width+_p*2,height:e.height+_p*2}}const Bg={__depends__:[Pi],__init__:["outline","multiSelectionOutline"],outline:["type",fo],multiSelectionOutline:["type",Ig]},$1=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],F1={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},r3=15,Ep=2;function j1(e,t,n,i,o){const r=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var f;const d=p.filter(m=>dt(m,$1));if(d.length===1){const m=d[0];ut(m)?a(m,m.labelTarget):(f=m.labels)!=null&&f.length&&a(m.labels[0],m)}if(d.length===2){const m=d.find(ut),g=d.find(y=>{var _;return(_=y.labels)==null?void 0:_.includes(m)});m&&g&&a(m,g)}}),e.on("shape.changed",function({element:p}){var d;!dt(p,$1)||!u(p)||(ut(p)?a(p,p.labelTarget):(d=p.labels)!=null&&d.length&&a(p.labels[0],p))});function a(p,d){const f=Ps([tt(d),tt(p)],F1),m=f.getAttribute("d"),y=o.isSelected(p)?c(p):l(p),_=Ls(y,m);if(!_)return;const v=o.isSelected(d)?c(d):l(d),b=Ls(v,m)||tt(d);Vs(b,_)<r3||(of(f,[b,_]),ot(r,f))}function s(){Ms(`.${F1.class}`,r).forEach(pn)}function c(p){const d=i.getOutline(p);if(!d)return l(p);if(d.x){const f={x:p.x+wr(d,"x")-Ep,y:p.y+wr(d,"y")-Ep,width:wr(d,"width")+Ep*2,height:wr(d,"height")+Ep*2};return hf(f,wr(d,"rx"))}if(d.cx){const f=wr(d,"r"),m={x:p.x+wr(d,"cx")-f,y:p.y+wr(d,"cy")-f,width:f*2,height:f*2};return Ux(m)}}function l(p){return n.getShapePath(p)}function u(p){return o.isSelected(p)}}j1.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function wr(e,t){return parseFloat(De(e,t)||0)}const a3={__depends__:[Pi,Bg],__init__:["labelLink"],labelLink:["type",j1]};var s3=new Xr("tt");function c3(e){var t=Vt('<div class="djs-tooltip-container" />');return Kn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function l3(e,t,n){Kn(e,{left:t+"px",top:n+"px"})}function Ng(e,t){e.style.display=t===!1?"none":""}var H1="djs-tooltip",$g="."+H1;function ni(e,t){this._eventBus=e,this._canvas=t,this._ids=s3,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=c3(t.getContainer());var n=this;ci.bind(this._tooltipRoot,$g,"mousedown",function(i){i.stopPropagation()}),ci.bind(this._tooltipRoot,$g,"mouseover",function(i){n.trigger("mouseover",i)}),ci.bind(this._tooltipRoot,$g,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}ni.$inject=["eventBus","canvas"],ni.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=Z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ni.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Tn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},ni.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},ni.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ni.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)}},ni.prototype.remove=function(e){var t=this.get(e);t&&(no(t.html),no(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ni.prototype.show=function(){Ng(this._tooltipRoot)},ni.prototype.hide=function(){Ng(this._tooltipRoot,!1)},ni.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},ni.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)),ri(n)&&(n=Vt(n)),i=Vt('<div data-tooltip-id="'+t+'" class="'+H1+'">'),Kn(i,{position:"absolute"}),i.appendChild(n),e.type&&Pt(i).add("djs-tooltip-"+e.type),e.className&&Pt(i).add(e.className),e.htmlContainer=i,o.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},ni.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;l3(n,t.x,t.y)},ni.prototype._updateTooltipVisibilty=function(e){U(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,o=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(o=!1),Ng(i,o))})},ni.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 u3={__init__:["tooltips"],tooltips:["type",ni]};var p3="flow elements must be children of pools/participants",d3="Data object must be placed within a pool/participant.";function z1(e,t,n){function i(o,r,a){t.add({position:{x:o.x+5,y:o.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(o){var r=o.context,a=r.shape,s=r.target;A(s,"bpmn:Collaboration")&&(A(a,"bpmn:FlowNode")?i(o,n(p3)):A(a,"bpmn:DataObjectReference")&&i(o,n(d3)))})}z1.$inject=["eventBus","tooltips","translate"];const f3={__depends__:[u3],__init__:["modelingFeedback"],modelingFeedback:["type",z1]};var h3=500,g3=1250,m3=1500,Sp=Math.round;function y3(e){return{x:e.x+Sp(e.width/2),y:e.y+Sp(e.height/2)}}function G1(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",m3,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=v3(u),Z(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",g3,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=r(l),!u)return!1}),e.on("shape.move.move",h3,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,p={x:s.dx,y:s.dy},d={x:s.x,y:s.y},f;if(f=r(l,p,d,u),c.delta=p,c.canExecute=f,f===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,p=u==="attach",d=c.shapes;if(u===!1)return!1;l.x=Sp(l.x),l.y=Sp(l.y),!(l.x===0&&l.y===0)&&n.moveElements(d,l,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(cr(s)){var c=Na(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(bn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!mt(s.target).has("djs-hit-no-move")){var p=y3(c),d=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(d!==!1)return!0}}this.start=a}G1.$inject=["eventBus","dragging","modeling","selection","rules"];function v3(e){var t=ga(e,"id");return ft(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var V1=499,Fg="djs-dragging",W1="drop-ok",U1="drop-not-ok",q1="new-parent",Y1="attach-ok";function K1(e,t,n,i){function o(c){var l=r(c),u=x3(l);return u}function r(c){var l=ks(c),u=l.flatMap(f=>(f.incoming||[]).concat(f.outgoing||[])),p=l.concat(u),d=[...new Set(p)];return d}function a(c,l){[Y1,W1,U1,q1].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,Fg),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",V1,function(c){var l=c.context,u=l.shapes,p=l.allDraggedElements,d=o(u);if(!l.dragGroup){var f=He("g");De(f,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();ot(m,f),l.dragGroup=f}d.forEach(function(g){i.addDragger(g,l.dragGroup)}),p?p=zp([p,r(u)]):p=r(u),U(p,function(g){t.addMarker(g,Fg)}),l.allDraggedElements=p,l.differentParents=b3(u)}),e.on("shape.move.move",V1,function(c){var l=c.context,u=l.dragGroup,p=l.target,d=l.shape.parent,f=l.canExecute;p&&(f==="attach"?a(p,Y1):l.canExecute&&d&&p.id!==d.id?a(p,q1):a(p,l.canExecute?W1:U1)),$n(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;U(u,function(d){t.removeMarker(d,Fg)}),p&&pn(p)}),this.makeDraggable=s}K1.$inject=["eventBus","canvas","styles","previewSupport"];function x3(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ft(e,function(i){return Lt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function b3(e){return OR(ga(e,function(t){return t.parent&&t.parent.id}))!==1}const w3={__depends__:[lu,Pi,Bg,co,Po,Ha],__init__:["move","movePreview"],move:["type",G1],movePreview:["type",K1]};var X1=".djs-palette-toggle",Z1=".entry",_3=X1+", "+Z1,jg="djs-palette-",E3="shown",Hg="open",J1="two-column",S3=1e3;function yn(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()})}yn.$inject=["eventBus","canvas"],yn.prototype.registerProvider=function(e,t){t||(t=e,e=S3),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},yn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(M3,{})},yn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},yn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Vt(yn.HTML_MARKUP);n.appendChild(i),Pt(n).add(jg+E3),ci.bind(i,_3,"click",function(o){var r=o.delegateTarget;if(qd(r,X1))return e.toggle();e.trigger("click",o)}),Ye.bind(i,"mousedown",function(o){o.stopPropagation()}),ci.bind(i,Z1,"dragstart",function(o){e.trigger("dragstart",o)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},yn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},yn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,o,r=Pt(n),a=Pt(t);"twoColumn"in e?o=e.twoColumn:o=this._needsCollapse(t.clientHeight,this._entries||{}),r.toggle(J1,o),a.toggle(jg+J1,o),"open"in e&&(r.toggle(Hg,e.open),a.toggle(jg+Hg,e.open)),i.fire("palette.changed",{twoColumn:o,open:this.isOpen()})},yn.prototype._update=function(){var e=Ct(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xl(e),U(t,function(n,i){var o=n.group||"default",r=Ct("[data-group="+ea(o)+"]",e);r||(r=Vt('<div class="group"></div>'),Tn(r,"data-group",o),e.appendChild(r));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Vt(a);if(r.appendChild(s),!n.separator&&(Tn(s,"data-action",i),n.title&&Tn(s,"title",n.title),n.className&&R3(s,n.className),n.imageUrl)){var c=Vt("<img>");Tn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},yn.prototype.trigger=function(e,t,n){var i,o,r=t.delegateTarget||t.target;return r?(i=Tn(r,"data-action"),o=t.originalEvent||t,this.triggerEntry(i,e,o,n)):t.preventDefault()},yn.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(Sn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},yn.prototype._layoutChanged=function(){this._toggleState({})},yn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},yn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},yn.prototype.open=function(){this._toggleState({open:!0})},yn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},yn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},yn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ct(".djs-palette-entries",this._container),this._toolsContainer=Ct("[data-group=tools]",t)),n=this._toolsContainer,U(n.children,function(i){var o=i.getAttribute("data-action");if(o){var r=Pt(i);o=o.replace("-tool",""),r.contains("entry")&&o===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}})},yn.prototype.isOpen=function(){return Pt(this._container).has(Hg)},yn.prototype._getParentContainer=function(){return this._canvas.getContainer()},yn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function R3(e,t){var n=Pt(e),i=Qe(t)?t:t.split(/\s+/g);i.forEach(function(o){n.add(o)})}function M3(e,t){var n=t.getPaletteEntries();return Sn(n)?n(e):(U(n,function(i,o){e[o]=i}),e)}const C3={__init__:["palette"],palette:["type",yn]};var Q1="crosshair",eS="selected",A3="djs-dragging-active-lasso";function _r(e,t,n,i,o,r,a){this._selection=o,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var d=t.getActiveLayer(),f=p.frame=He("rect");De(f,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ot(d,f),l(!0),this.update(p)},update:function(p){var d=p.frame,f=p.bbox;d&&f&&De(d,{x:f.x,y:f.y,width:f.width,height:f.height});var m=p.marked,g=p.lastMarked;if(m&&g){for(const y of g)m.has(y)||t.removeMarker(y,eS);for(const y of m)g.has(y)||t.addMarker(y,eS)}},remove:function(p){this.update(p),p.frame&&pn(p.frame),l(!1)}};function l(p){mt(t.getContainer()).toggle(A3,p)}function u(p){var d=i.getAll();return new Set(ha(Ra(d,p)))}r.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var d=p.originalEvent.target;!p.hover&&!(d instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var d=p.context;s._select(Array.from(d.marked))}),e.on("lasso.start",function(p){var d=p.context;d.bbox=tS(p),d.add=nu(p),d.lastMarked=new Set(o.get()),d.add?d.marked=d.lastMarked:d.marked=new Set,d.initialMarked=d.marked,c.create(d)}),e.on("lasso.move",function(p){var d=p.context,f=d.bbox=tS(p),m=u(f),g=d.initialMarked.union(m);d.lastMarked=d.marked,d.marked=g,c.update(d)}),e.on("lasso.cleanup",function(p){var d=p.context;d.lastMarked=d.marked,d.marked=new Set(o.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(nu(p))return s.activateLasso(p.originalEvent),!0})}_r.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],_r.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Q1,data:{context:{}},keepSelection:!0})},_r.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Q1,data:{context:{}},keepSelection:!0})},_r.prototype._select=function(e){this._selection.select(e)},_r.prototype.select=function(e,t,n=[]){var i=ha(Ra(e,t));this._select([...n,...i])},_r.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},_r.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function tS(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 T3={__depends__:[fu,Xs],__init__:["lassoTool"],lassoTool:["type",_r]};var zg=1500,nS="grab";function es(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",zg,function(c){if(qs(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(zg,function(c){if(!(!iS(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(zg,function(c){!iS(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!qs(c)&&u&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}es.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],es.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:nS,data:{context:n||{}}})},es.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:nS,data:{context:{reactivate:n}}})},es.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},es.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function iS(e){return _n("Space",e)}const P3={__depends__:[fu,Xs],__init__:["handTool"],handTool:["type",es]};var oS="connect-ok",rS="connect-not-ok";function ts(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?oS:rS))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?oS:rS)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,p={x:c.x,y:c.y},d=s.canStartConnect(u);if(d)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,p)}),!1})}ts.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ts.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ts.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ts.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ts.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const k3={__depends__:[kg,co,Po,fu,Xs],globalConnect:["type",ts]};function Gg(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)}Gg.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Gg.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,o=this._lassoTool,r=this._handTool,a=this._globalConnect,s=this._translate;function c(p,d,f,m,g){function y(_){var h=n.createShape(Z({type:p},g));t.start(_,h)}return{group:d,className:f,title:m,action:{dragstart:y,click:y}}}function l(p){var d=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),f=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:d});t.start(p,[d,f],{hints:{autoSelect:[d]}})}function u(p){t.start(p,n.createParticipantShape())}return Z(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 O3={__depends__:[C3,pu,u_,T3,P3,k3,js],__init__:["paletteProvider"],paletteProvider:["type",Gg]};var D3=250;function Vg(e,t,n,i,o){_e.call(this,e);function r(s){var c=s.canExecute.replacements;U(c,function(l){var u=l.oldElementId,p={type:l.newElementType};if(!s.visualReplacements[u]){var d=t.get(u);Z(p,{x:d.x,y:d.y});var f=n.createShape(p);i.addShape(f,d.parent);var m=Ct('[data-element-id="'+ea(d.id)+'"]',s.dragGroup);m&&De(m,{display:"none"});var g=o.addDragger(f,s.dragGroup);s.visualReplacements[u]=g,i.removeShape(f)}})}function a(s){var c=s.visualReplacements;U(c,function(l,u){var p=Ct('[data-element-id="'+ea(u)+'"]',s.dragGroup);p&&De(p,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",D3,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?r(c):a(c)})}Vg.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ne(Vg,_e);const L3={__depends__:[Ha],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Vg]};var I3=1250,Wg=40,B3=20,N3=10,aS=20,sS=["x","y"],$3=Math.abs;function cS(e){e.on(["connect.hover","connect.move","connect.end"],I3,function(t){var n=t.context,i=n.canExecute,o=n.start,r=n.hover,a=n.source,s=n.target;t.originalEvent&&di(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&r&&F3(t,r,G3(r)),r&&z3(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Di(o),dt(r,["bpmn:Event","bpmn:Gateway"])&&lS(t,Di(r)),dt(r,["bpmn:Task","bpmn:SubProcess"])&&j3(t,r),A(a,"bpmn:BoundaryEvent")&&s===a.host&&H3(t)):uS(i,"bpmn:MessageFlow")?(A(o,"bpmn:Event")&&(n.connectionStart=Di(o)),A(r,"bpmn:Event")&&lS(t,Di(r))):n.connectionStart=n.initialConnectionStart)})}cS.$inject=["eventBus"];function F3(e,t,n){sS.forEach(function(i){var o=pS(i,t);e[i]<t[i]+n?mn(e,i,t[i]+n):e[i]>t[i]+o-n&&mn(e,i,t[i]+o-n)})}function j3(e,t){var n=Di(t);sS.forEach(function(i){V3(e,t,i)&&mn(e,i,n[i])})}function H3(e){var t=e.context,n=t.source,i=t.target;if(!W3(t)){var o=Di(n),r=Nn(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;$3(c-o[s])<Wg&&(c>o[s]?l=o[s]+Wg:l=o[s]-Wg,mn(e,s,l))})}}function lS(e,t){mn(e,"x",t.x),mn(e,"y",t.y)}function uS(e,t){return e&&e.type===t}function z3(e,t){return Go(t,function(n){return uS(e,n)})}function pS(e,t){return e==="x"?t.width:t.height}function G3(e){return A(e,"bpmn:Task")?N3:B3}function V3(e,t,n){return e[n]>t[n]+aS&&e[n]<t[n]+pS(n,t)-aS}function W3(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Rp,n.initDefaults(this._defaultSnaps)),n};function Rp(){this._snapValues={}}Rp.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)},Rp.prototype.snap=function(e,t,n,i){var o=this._snapValues[t];return o&&j$(e[n],o[n],i)},Rp.prototype.initDefaults=function(e){var t=this;U(e||{},function(n,i){U(n,function(o){t.add(i,o)})})};var U3=1250;function ho(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"],U3,function(o){var r=o.context,a=r.shape,s=r.snapContext,c=r.target;if(!(o.originalEvent&&di(o.originalEvent))&&!(Qa(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()})}ho.$inject=["elementRegistry","eventBus","snapping"],ho.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,o=n.snapContext;o||(o=n.snapContext=new Er);var r;t.get(i.id)?r=Di(i,e):r={x:e.x+Di(i).x,y:e.y+Di(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}),ut(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},ho.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return U(i,function(o){if(ut(o)){ut(t)&&e.add("mid",Di(o));return}if(Lt(o)){if(o.waypoints.length<3)return;var r=o.waypoints.slice(1,-1);U(r,function(a){e.add("mid",a)});return}e.add("mid",Di(o))}),!et(t.x)||!et(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Di(t)),e},ho.prototype.getSnapTargets=function(e,t){return JE(t).filter(function(n){return!q3(n)})};function q3(e){return!!e.hidden}var dS=1500;function ns(e,t){t.invoke(ho,this),e.on(["create.move","create.end"],dS,Z3),e.on(["create.move","create.end","shape.move.move","shape.move.end"],dS,function(n){var i=n.context,o=i.canExecute,r=i.target,a=o&&(o==="attach"||o.attach);a&&!Qa(n)&&Y3(n,r)})}Ne(ns,ho),ns.$inject=["eventBus","injector"],ns.prototype.initSnap=function(e){var t=ho.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return U(n.outgoing,function(o){var r=o.waypoints[0];r=r.original||r,t.setSnapOrigin(o.id+"-docking",hS(r,i,e))}),U(n.incoming,function(o){var r=o.waypoints[o.waypoints.length-1];r=r.original||r,t.setSnapOrigin(o.id+"-docking",hS(r,i,e))}),A(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ns.prototype.addSnapTargetPoints=function(e,t,n){ho.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);U(i,function(r){(X3(r)||K3([t,r],"bpmn:TextAnnotation"))&&(e.add("top-left",XE(r)),e.add("bottom-right",ZE(r)))});var o=this._elementRegistry;return U(t.incoming,function(r){if(o.get(t.id)){fS(i,r.source)||e.add("mid",tt(r.source));var a=r.waypoints[0];e.add(r.id+"-docking",a.original||a)}}),U(t.outgoing,function(r){if(o.get(t.id)){fS(i,r.target)||e.add("mid",tt(r.target));var a=r.waypoints[r.waypoints.length-1];e.add(r.id+"-docking",a.original||a)}}),A(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},ns.prototype.getSnapTargets=function(e,t){return ho.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!A(n,"bpmn:Lane")})};function Y3(e,t){var n=Ze(t),i=aw(e,t),o=e.context,r=o.shape,a;r.parent?a={x:0,y:0}:a=tt(r),/top/.test(i)?mn(e,"y",n.top-a.y):/bottom/.test(i)&&mn(e,"y",n.bottom-a.y),/left/.test(i)?mn(e,"x",n.left-a.x):/right/.test(i)&&mn(e,"x",n.right-a.x)}function K3(e,t){return e.every(function(n){return A(n,t)})}function X3(e){return A(e,"bpmn:SubProcess")&&yt(e)?!0:A(e,"bpmn:Participant")}function Z3(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)&&mn(e,"x",e.x),(i&&i>=e.y||r&&r<=e.y)&&mn(e,"y",e.y)}}function fS(e,t){return e.indexOf(t)!==-1}function hS(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var J3=1250;function Ac(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],J3,function(i){var o=i.context,r=o.shape,a=r.parent,s=o.direction,c=o.snapContext;if(!(i.originalEvent&&di(i.originalEvent))&&!Qa(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,r,a,s),l.initialized=!0),tF(s)&&mn(i,"x",i.x),nF(s)&&mn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ac.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,o=t.snapContext;o||(o=t.snapContext=new Er);var r=gS(n,i);return o.setSnapOrigin("corner",{x:r.x-e.x,y:r.y-e.y}),o},Ac.prototype.addSnapTargetPoints=function(e,t,n,i){var o=this.getSnapTargets(t,n);return U(o,function(r){e.add("corner",ZE(r)),e.add("corner",XE(r))}),e.add("corner",gS(t,i)),e},Ac.$inject=["eventBus","snapping"],Ac.prototype.getSnapTargets=function(e,t){return JE(t).filter(function(n){return!Q3(n,e)&&!Lt(n)&&!eF(n)&&!ut(n)})};function gS(e,t){var n=tt(e),i=Ze(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 Q3(e,t){return e.host===t}function eF(e){return!!e.hidden}function tF(e){return e==="n"||e==="s"}function nF(e){return e==="e"||e==="w"}var iF=7,oF=1e3;function Sr(e){this._canvas=e,this._asyncHide=Vp(Qn(this.hide,this),oF)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,o=i.getSnapLocations(),r={x:Qa(e,"x"),y:Qa(e,"y")};U(o,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(U(["x","y"],function(l){var u;r[l]||(u=t.snap(c,a,l,iF),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),U(["x","y"],function(a){var s=r[a];bn(s)&&mn(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=He("path");return De(n,{d:"M0,0 L0,0"}),mt(n).add("djs-snap-line"),ot(t,n),{update:function(i){et(i)?e==="horizontal"?De(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):De(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):De(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){U(this._snapLines,function(e){e.update()})};const rF={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ho],resizeSnapping:["type",Ac],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",cS],createMoveSnapping:["type",ns]};var mS=300;function at(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=Ct(at.INPUT_SELECTOR,this._container),this._resultsContainer=Ct(at.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}at.$inject=["canvas","eventBus","selection","translate"],at.prototype._bindEvents=function(){var e=this;function t(n,i,o,r){e._eventMaps.push({el:n,type:o,listener:ci.bind(n,i,o,r)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,at.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,at.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,at.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,at.INPUT_SELECTOR,"keydown",function(n){_n("ArrowUp",n)&&n.preventDefault(),_n("ArrowDown",n)&&n.preventDefault()}),t(this._container,at.INPUT_SELECTOR,"keyup",function(n){if(_n("Escape",n))return e.close();if(_n("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(_n("ArrowUp",n))return e._scrollToDirection(!0);if(_n("ArrowDown",n))return e._scrollToDirection();_n(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},at.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ci.unbind(e.el,e.type,e.listener)})},at.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=Ct(at.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},at.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},at.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)}},at.prototype._clearResults=function(){xl(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},at.prototype._getCurrentResult=function(){return Ct(at.RESULT_SELECTED_SELECTOR,this._resultsContainer)},at.prototype._createResultNode=function(e,t){var n=Vt(at.RESULT_HTML);return e.primaryTokens.length>0&&yS(n,e.primaryTokens,at.RESULT_PRIMARY_HTML),yS(n,e.secondaryTokens,at.RESULT_SECONDARY_HTML),Tn(n,at.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},at.prototype.registerProvider=function(e){this._searchProvider=e},at.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,Pt(this._canvas.getContainer()).add("djs-search-open"),Pt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},at.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,Pt(this._canvas.getContainer()).remove("djs-search-open"),Pt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},at.prototype.toggle=function(){this.isOpen()?this.close():this.open()},at.prototype.isOpen=function(){return this._open},at.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Pt(t).remove(at.RESULT_SELECTED_CLASS);var n=Tn(e,at.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Pt(e).add(at.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:mS}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},at.prototype._select=function(e){var t=Tn(e,at.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:mS}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},at.prototype._getBoxHtml=function(){const e=Vt(at.BOX_HTML),t=Ct(at.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function yS(e,t,n){var i=aF(t),o=Vt(n);o.innerHTML=i,e.appendChild(o)}function aF(e){var t="";return e.forEach(function(n){var i=y0(n.value||n.matched||n.normal),o=n.match||n.matched;o?t+='<b class="'+at.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}at.CONTAINER_SELECTOR=".djs-search-container",at.INPUT_SELECTOR=".djs-search-input input",at.RESULTS_CONTAINER_SELECTOR=".djs-search-results",at.RESULT_SELECTOR=".djs-search-result",at.RESULT_SELECTED_CLASS="djs-search-result-selected",at.RESULT_SELECTED_SELECTOR="."+at.RESULT_SELECTED_CLASS,at.RESULT_ID_ATTRIBUTE="data-result-id",at.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",at.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
335
  <div class="djs-search-input">
336
336
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
337
337
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -339,4 +339,4 @@
339
339
  <input type="text" spellcheck="false" />
340
340
  </div>
341
341
  <div class="djs-search-results" />
342
- </div>`,at.RESULT_HTML='<div class="djs-search-result"></div>',at.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',at.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const aF={__depends__:[js,Vu,Pi],searchPad:["type",at]};function Ug(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Ug.$inject=["elementRegistry","searchPad","canvas","search"],Ug.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ut(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ui(i),id:i.id})),e,{keys:["label","id"]}).map(sF)};function sF(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const cF={__depends__:[aF,PE],__init__:["bpmnSearch"],bpmnSearch:["type",Ug]},lF="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",uF="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",pF={width:36,height:50},dF={width:50,height:50};function vS(e,t,n){return He("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Bi=5;function Mp(e,t){this._styles=t,e.registerProvider(this)}Mp.$inject=["outline","styles"],Mp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(rk(e))return n=He("rect"),De(n,Z({x:-Bi,y:-Bi,rx:4,width:e.width+Bi*2,height:e.height+Bi*2},t)),n;if(!ut(e))return A(e,"bpmn:Gateway")?(n=He("rect"),Z(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),De(n,Z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):dt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=He("rect"),De(n,Z({x:-Bi,y:-Bi,rx:14,width:e.width+Bi*2,height:e.height+Bi*2},t))):A(e,"bpmn:EndEvent")?(n=He("circle"),De(n,Z({cx:e.width/2,cy:e.height/2,r:e.width/2+Bi+1},t))):A(e,"bpmn:Event")?(n=He("circle"),De(n,Z({cx:e.width/2,cy:e.height/2,r:e.width/2+Bi},t))):A(e,"bpmn:DataObjectReference")&&xS(e,"bpmn:DataObjectReference")?n=vS(lF,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&xS(e,"bpmn:DataStoreReference")&&(n=vS(uF,{x:-6,y:-6},t)),n},Mp.prototype.updateOutline=function(e,t){if(!ut(e))return dt(e,["bpmn:SubProcess","bpmn:Group"])?(De(t,{width:e.width+Bi*2,height:e.height+Bi*2}),!0):!!dt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function xS(e,t){var n;return t==="bpmn:DataObjectReference"?n=pF:t==="bpmn:DataStoreReference"&&(n=dF),e.width===n.width&&e.height===n.height}const fF={__depends__:[Bg],__init__:["outlineProvider"],outlineProvider:["type",Mp]};var hF='<?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 go(e){Vr.call(this,e)}Ne(go,Vr),go.Viewer=yr,go.NavigatedViewer=hc,go.prototype.createDiagram=function(){return this.importXML(hF)},go.prototype._interactionModules=[D0,I0,$0],go.prototype._modelingModules=[M$,Du,A$,Q_,H$,kg,q$,v5,Qw,pu,_5,R5,L5,B5,N5,z5,e3,r3,qh,d3,b3,k3,D3,D1,oF,cF,fF],go.prototype._modules=[].concat(yr.prototype._modules,go.prototype._interactionModules,go.prototype._modelingModules);const gF=Se.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Se.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=pd(u);return o("imported",p),{warnings:p}}catch(u){throw o("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return Se.onMounted(async()=>{a=new go({container:r.value,moddleExtensions:gs,additionalModules:[...S0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Se.watch(()=>i.xml,l=>{l&&a&&s(l)}),Se.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Se.openBlock(),Se.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),qg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},mF=qg(gF,[["__scopeId","data-v-7cfbebdb"]]),yF=["title","aria-expanded"],vF=["title","onClick"],xF={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},bF={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},wF={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},_F={key:0,class:"bwl-validation__body"},EF={key:0,class:"bwl-validation__empty"},SF={key:1,class:"bwl-validation__empty"},RF={key:2,class:"bwl-validation__list"},MF=["onClick"],CF={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},AF={class:"bwl-validation__msg"},TF=["title"],PF=qg(Se.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Se.computed(()=>c0(n.issues.value,n.describeElement)),o=Se.computed(()=>l0(i.value)),r=m=>Va(m,n.changeScope.value),a=Se.computed(()=>eg(i.value,n.changeScope.value)),s=Se.ref({error:!0,warning:!0,info:!0}),c=Se.computed(()=>u0(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=Se.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function f(m){const g=m.targetRefs[0];g&&n.requestFocus(g)}return(m,g)=>(Se.openBlock(),Se.createElementBlock("section",{class:Se.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Se.createElementVNode("header",{class:"bwl-validation__head",onClick:g[1]||(g[1]=y=>l.value=!l.value)},[Se.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Se.openBlock(),Se.createElementBlock("svg",{class:Se.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...g[2]||(g[2]=[Se.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),g[3]||(g[3]=Se.createElementVNode("span",null,"검증",-1))],8,yF),Se.createElementVNode("div",{class:"bwl-validation__counts",onClick:g[0]||(g[0]=Se.withModifiers(()=>{},["stop"]))},[(Se.openBlock(),Se.createElementBlock(Se.Fragment,null,Se.renderList(u,y=>Se.createElementVNode("button",{key:y,type:"button",class:Se.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>d(y)},[(Se.openBlock(),Se.createElementBlock("svg",xF,[g[4]||(g[4]=Se.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(Se.openBlock(),Se.createElementBlock("path",bF)):(Se.openBlock(),Se.createElementBlock("path",wF))])),Se.createElementVNode("span",null,Se.toDisplayString(o.value[y]),1)],10,vF)),64))])]),l.value?(Se.openBlock(),Se.createElementBlock("div",_F,[i.value.length===0?(Se.openBlock(),Se.createElementBlock("p",EF,"발견된 문제가 없습니다.")):c.value.length===0?(Se.openBlock(),Se.createElementBlock("p",SF," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Se.openBlock(),Se.createElementBlock("ul",RF,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(c.value,y=>(Se.openBlock(),Se.createElementBlock("li",{key:y.key,class:Se.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:_=>f(y)},[g[5]||(g[5]=Se.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(Se.openBlock(),Se.createElementBlock("span",CF,"이번 변경")):Se.createCommentVNode("",!0),Se.createElementVNode("span",AF,Se.toDisplayString(y.message),1),Se.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},Se.toDisplayString(y.category),9,TF)],10,MF))),128))]))])):Se.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),kF={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},OF=["aria-checked","title","data-locale","onClick"],DF={class:"bwl-locale__label"},LF={key:0,class:"bwl-locale__badge"},IF=qg(Se.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=Se.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(Se.openBlock(),Se.createElementBlock("div",kF,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(o.value,s=>(Se.openBlock(),Se.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Se.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>Se.unref(n).setDisplayLocale(s.locale)},[Se.createElementVNode("span",DF,Se.toDisplayString(s.label),1),s.pending>0?(Se.openBlock(),Se.createElementBlock("span",LF,Se.toDisplayString(s.pending),1)):Se.createCommentVNode("",!0)],10,OF))),128))])):Se.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ie.ADDABLE_FLOW_NODE_TYPES=Nc,ie.APPLY_BPMN_OPS_SCHEMA=tM,ie.BPMN_EVENT_DEFINITION_TYPES=Fc,ie.BPMN_MODDLE_EXTENSIONS=gs,ie.BPMN_MODELER_VIEW_MODULES=S0,ie.BWL_MODDLE_SCHEMA=mm,ie.BWL_NS=gm,ie.BWL_PREFIX=Fp,ie.BWL_REVIEW_REQUEST_TYPE=Hc,ie.BWL_SIDES=jp,ie.BpmnDisplayLocaleSwitcher=IF,ie.BpmnModelerView=mF,ie.BpmnValidationPanel=PF,ie.EDITOR=KT,ie.FLOW_LABEL_INDENT=Qm,ie.GROUP_BORDER_MIN_RUN=dd,ie.GROUP_BORDER_NEAR=ba,ie.HEADLESS_BPMN_MODULES=Zh,ie.HEADLESS_TEXT_METRICS=Qi,ie.HeadlessReplay=ig,ie.HeadlessReplayModule=m0,ie.I18N_DISPLAY_REDRAWN_EVENT=fc,ie.I18N_NS=NR,ie.I18N_PREFIX=Em,ie.I18N_REVIEW_REQUESTED_CLASS=d0,ie.I18N_TRANSLATION_TYPE=Or,ie.I18N_UNTRANSLATED_CLASS=p0,ie.I18nDisplay=tg,ie.I18nDisplayModule=h0,ie.IR_EVENT_DEFINITIONS=$c,ie.IR_FLOW_NODE_TYPES=Pr,ie.IR_TEXT_LOCALES=jc,ie.LABEL_FORK_MARGIN=gd,ie.LABEL_SHAPE_MIN_DEPTH=py,ie.SET_TRANSLATIONS_COMMAND=Yp,ie.SEVERITY_ORDER=Qh,ie.SYMBOLIC_OP_KINDS=Sm,ie.SYMBOLIC_OP_SCHEMA=Rm,ie.SetTranslationsHandler=Kp,ie.TranslationCommands=Zp,ie.TranslationCommandsModule=Jp,ie.TranslationStateIndex=nP,ie.UNDO_EPISODE_COMMAND=Hp,ie.UPDATE_TRANSLATION_COMMAND=Vc,ie.UpdateTranslationHandler=qp,ie.applyBpmnOpBatch=Iv,ie.applyBpmnOps=Fd,ie.applyLocaleBackfill=tP,ie.applyTranslationLocaleRestore=sP,ie.approximateTextWidth=Nr,ie.auditBpmnGeometry=hy,ie.auditBpmnGeometryXml=JC,ie.auditBpmnSemantics=Hd,ie.auditBpmnSemanticsXml=BT,ie.auditGeometry=ht,ie.auditTargetsOf=Ln,ie.axisSegmentsOf=un,ie.blackBoxNameRect=fd,ie.buildBpmnOpBatch=VT,ie.buildRegistryIndex=my,ie.collectTranslationStates=Gv,ie.containerBoundarySegments=_a,ie.countBySeverity=l0,ie.createBpmnEditorController=XT,ie.createBpmnModdle=Vm,ie.createHeadlessBpmnModeler=TB,ie.crossedShapesOf=Ot,ie.crossingCost=Vn,ie.describeProcess=Cv,ie.describeProcessXml=PT,ie.diffBpmnElements=Pv,ie.diffBpmnElementsXml=zT,ie.documentLocalesOf=ps,ie.edgeCrossCount=ys,ie.edgeCrossingPairsOf=eo,ie.edgeCrossingStatsOf=ay,ie.executeAsUndoEpisode=vm,ie.feedGeneratedIds=Lv,ie.followMovedEdgeLabels=Ky,ie.forwardThreePointCandidates=nl,ie.geometryFindingKey=lt,ie.inferScriptLocale=vl,ie.installHeadlessBpmnDom=qm,ie.irEventDefinitionOf=$p,ie.isAddableFlowNodeType=fm,ie.isChangeScopeMixed=eg,ie.isEdgeOverlapFinding=hd,ie.isGuardedGridSnapping=YB,ie.isInChangeScope=Va,ie.isIrEventDefinition=hm,ie.isIrFlowNodeType=dm,ie.isIrTextLocale=CR,ie.labelRectsOf=Ko,ie.labelShapeDepth=dy,ie.labelSlot=Dr,ie.lineCrossesLabel=Hi,ie.lineThroughLabel=ty,ie.lineThroughShapeLabel=uy,ie.loadBpmnXml=xa,ie.localeTextsOf=Up,ie.lowerOps=_v,ie.mergeUndoSteps=bm,ie.oppositeOverlapCount=NC,ie.oppositeOverlapOf=Jm,ie.planBackEdgeBoundaryClearance=Ly,ie.planCrossPoolRoute=Ty,ie.planEdgeRepair=ol,ie.planLabelLineClearance=Dd,ie.planLabelPlacement=Uy,ie.planLocaleBackfill=eP,ie.planMiddleSegmentShifts=_y,ie.planOppositeOverlapRepair=Fy,ie.planSegmentDetours=tl,ie.planShapeLabelClearance=Jy,ie.planTranslationLocaleRestore=aP,ie.poolOverlapsOf=vd,ie.recordGeneratedIds=Dv,ie.redockIntroducedDetachedEndpoints=ev,ie.repairIntroducedBoundaryHugging=Iy,ie.repairIntroducedCrossings=_d,ie.repairIntroducedEdgeCrossings=Sy,ie.repairIntroducedFakeMerges=Hy,ie.repairIntroducedLabelLines=Xy,ie.repairIntroducedOppositeOverlaps=Wy,ie.repairIntroducedShapeLabelLines=Qy,ie.repairIntroducedSharedSegmentLabels=Zy,ie.replayAgentTurn=Bv,ie.rerouteIntroducedCrossPoolEdges=Py,ie.resolverServicesOf=fv,ie.reviewRequestValuesOf=Xp,ie.reviewRequestsOf=Wo,ie.rootLangOf=Wp,ie.saveBpmnXml=RC,ie.sceneCrossingCost=ry,ie.sceneFromDefinitions=fy,ie.sceneFromRegistry=We,ie.segmentShapeClearance=wo,ie.shapesUnderLabel=vs,ie.sharedEndpointCrossingPairsOf=Ei,ie.sharedSegmentUnderLabel=el,ie.sharedSpansOf=Qc,ie.sortPanelIssues=u0,ie.toPanelIssues=c0,ie.touchedElements=GT,ie.translationLocale=An,ie.translationsOf=Vo,ie.undoStepMark=xm,ie.unreadableOverlapCount=ei,ie.unreadableOverlapOf=$r,ie.validateOps=ov,ie.warningMessages=pd,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})}));
342
+ </div>`,at.RESULT_HTML='<div class="djs-search-result"></div>',at.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',at.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const sF={__depends__:[js,Vu,Pi],searchPad:["type",at]};function Ug(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Ug.$inject=["elementRegistry","searchPad","canvas","search"],Ug.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!ut(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ui(i),id:i.id})),e,{keys:["label","id"]}).map(cF)};function cF(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const lF={__depends__:[sF,PE],__init__:["bpmnSearch"],bpmnSearch:["type",Ug]},uF="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",pF="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",dF={width:36,height:50},fF={width:50,height:50};function vS(e,t,n){return He("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Bi=5;function Mp(e,t){this._styles=t,e.registerProvider(this)}Mp.$inject=["outline","styles"],Mp.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(ak(e))return n=He("rect"),De(n,Z({x:-Bi,y:-Bi,rx:4,width:e.width+Bi*2,height:e.height+Bi*2},t)),n;if(!ut(e))return A(e,"bpmn:Gateway")?(n=He("rect"),Z(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),De(n,Z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):dt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=He("rect"),De(n,Z({x:-Bi,y:-Bi,rx:14,width:e.width+Bi*2,height:e.height+Bi*2},t))):A(e,"bpmn:EndEvent")?(n=He("circle"),De(n,Z({cx:e.width/2,cy:e.height/2,r:e.width/2+Bi+1},t))):A(e,"bpmn:Event")?(n=He("circle"),De(n,Z({cx:e.width/2,cy:e.height/2,r:e.width/2+Bi},t))):A(e,"bpmn:DataObjectReference")&&xS(e,"bpmn:DataObjectReference")?n=vS(uF,{x:-6,y:-6},t):A(e,"bpmn:DataStoreReference")&&xS(e,"bpmn:DataStoreReference")&&(n=vS(pF,{x:-6,y:-6},t)),n},Mp.prototype.updateOutline=function(e,t){if(!ut(e))return dt(e,["bpmn:SubProcess","bpmn:Group"])?(De(t,{width:e.width+Bi*2,height:e.height+Bi*2}),!0):!!dt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function xS(e,t){var n;return t==="bpmn:DataObjectReference"?n=dF:t==="bpmn:DataStoreReference"&&(n=fF),e.width===n.width&&e.height===n.height}const hF={__depends__:[Bg],__init__:["outlineProvider"],outlineProvider:["type",Mp]};var gF='<?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 go(e){Vr.call(this,e)}Ne(go,Vr),go.Viewer=yr,go.NavigatedViewer=hc,go.prototype.createDiagram=function(){return this.importXML(gF)},go.prototype._interactionModules=[D0,I0,$0],go.prototype._modelingModules=[C$,Du,T$,Q_,z$,kg,Y$,x5,Qw,pu,E5,M5,I5,N5,$5,G5,t3,a3,qh,f3,w3,O3,L3,D1,rF,lF,hF],go.prototype._modules=[].concat(yr.prototype._modules,go.prototype._interactionModules,go.prototype._modelingModules);const mF=Se.defineComponent({__name:"BpmnModelerView",props:{xml:{},labelFontFamily:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,o=n,r=Se.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),p=pd(u);return o("imported",p),{warnings:p}}catch(u){throw o("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return Se.onMounted(async()=>{a=new go({container:r.value,moddleExtensions:gs,additionalModules:[...S0],...i.labelFontFamily?{textRenderer:{defaultStyle:{fontFamily:i.labelFontFamily}}}:{}}),i.xml&&await s(i.xml),o("ready")}),Se.watch(()=>i.xml,l=>{l&&a&&s(l)}),Se.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(Se.openBlock(),Se.createElementBlock("div",{ref_key:"container",ref:r,class:"bpmn-modeler-view"},null,512))}}),qg=(e,t)=>{const n=e.__vccOpts||e;for(const[i,o]of t)n[i]=o;return n},yF=qg(mF,[["__scopeId","data-v-7cfbebdb"]]),vF=["title","aria-expanded"],xF=["title","onClick"],bF={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},wF={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"},EF={key:0,class:"bwl-validation__body"},SF={key:0,class:"bwl-validation__empty"},RF={key:1,class:"bwl-validation__empty"},MF={key:2,class:"bwl-validation__list"},CF=["onClick"],AF={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},TF={class:"bwl-validation__msg"},PF=["title"],kF=qg(Se.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=Se.computed(()=>c0(n.issues.value,n.describeElement)),o=Se.computed(()=>l0(i.value)),r=m=>Va(m,n.changeScope.value),a=Se.computed(()=>eg(i.value,n.changeScope.value)),s=Se.ref({error:!0,warning:!0,info:!0}),c=Se.computed(()=>u0(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=Se.ref(!1),u=["error","warning","info"],p={error:"오류",warning:"경고",info:"정보"};function d(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function f(m){const g=m.targetRefs[0];g&&n.requestFocus(g)}return(m,g)=>(Se.openBlock(),Se.createElementBlock("section",{class:Se.normalizeClass(["bwl-validation",{"is-open":l.value}])},[Se.createElementVNode("header",{class:"bwl-validation__head",onClick:g[1]||(g[1]=y=>l.value=!l.value)},[Se.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(Se.openBlock(),Se.createElementBlock("svg",{class:Se.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...g[2]||(g[2]=[Se.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),g[3]||(g[3]=Se.createElementVNode("span",null,"검증",-1))],8,vF),Se.createElementVNode("div",{class:"bwl-validation__counts",onClick:g[0]||(g[0]=Se.withModifiers(()=>{},["stop"]))},[(Se.openBlock(),Se.createElementBlock(Se.Fragment,null,Se.renderList(u,y=>Se.createElementVNode("button",{key:y,type:"button",class:Se.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${p[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:_=>d(y)},[(Se.openBlock(),Se.createElementBlock("svg",bF,[g[4]||(g[4]=Se.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(Se.openBlock(),Se.createElementBlock("path",wF)):(Se.openBlock(),Se.createElementBlock("path",_F))])),Se.createElementVNode("span",null,Se.toDisplayString(o.value[y]),1)],10,xF)),64))])]),l.value?(Se.openBlock(),Se.createElementBlock("div",EF,[i.value.length===0?(Se.openBlock(),Se.createElementBlock("p",SF,"발견된 문제가 없습니다.")):c.value.length===0?(Se.openBlock(),Se.createElementBlock("p",RF," 선택한 심각도에 해당하는 항목이 없습니다. ")):(Se.openBlock(),Se.createElementBlock("ul",MF,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(c.value,y=>(Se.openBlock(),Se.createElementBlock("li",{key:y.key,class:Se.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:_=>f(y)},[g[5]||(g[5]=Se.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&r(y)?(Se.openBlock(),Se.createElementBlock("span",AF,"이번 변경")):Se.createCommentVNode("",!0),Se.createElementVNode("span",TF,Se.toDisplayString(y.message),1),Se.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},Se.toDisplayString(y.category),9,PF)],10,CF))),128))]))])):Se.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]),OF={key:0,class:"bwl-locale",role:"radiogroup","aria-label":"표시 언어"},DF=["aria-checked","title","data-locale","onClick"],LF={class:"bwl-locale__label"},IF={key:0,class:"bwl-locale__badge"},BF=qg(Se.defineComponent({__name:"BpmnDisplayLocaleSwitcher",props:{controller:{}},setup(e){const n=e.controller;function i(r){try{return new Intl.DisplayNames([r],{type:"language"}).of(r)??r}catch{return r}}const o=Se.computed(()=>{const r=n.i18n.value;return r?r.locales.map(a=>{const s=r.counts[a]??{untranslated:0,reviewRequested:0},c=a===r.designLocale?"설계 언어":"병기 언어";return{locale:a,label:i(a),active:a===r.displayLocale,design:a===r.designLocale,pending:s.untranslated+s.reviewRequested,title:`${c} — 미번역 ${s.untranslated} · 확인 요청 ${s.reviewRequested}`}}):[]});return(r,a)=>o.value.length?(Se.openBlock(),Se.createElementBlock("div",OF,[(Se.openBlock(!0),Se.createElementBlock(Se.Fragment,null,Se.renderList(o.value,s=>(Se.openBlock(),Se.createElementBlock("button",{key:s.locale,type:"button",role:"radio",class:Se.normalizeClass(["bwl-locale__item",{"is-active":s.active,"is-design":s.design}]),"aria-checked":s.active,title:s.title,"data-locale":s.locale,onClick:c=>Se.unref(n).setDisplayLocale(s.locale)},[Se.createElementVNode("span",LF,Se.toDisplayString(s.label),1),s.pending>0?(Se.openBlock(),Se.createElementBlock("span",IF,Se.toDisplayString(s.pending),1)):Se.createCommentVNode("",!0)],10,DF))),128))])):Se.createCommentVNode("",!0)}}),[["__scopeId","data-v-04311925"]]);ie.ADDABLE_FLOW_NODE_TYPES=Nc,ie.APPLY_BPMN_OPS_SCHEMA=tM,ie.BPMN_EVENT_DEFINITION_TYPES=Fc,ie.BPMN_MODDLE_EXTENSIONS=gs,ie.BPMN_MODELER_VIEW_MODULES=S0,ie.BWL_MODDLE_SCHEMA=mm,ie.BWL_NS=gm,ie.BWL_PREFIX=Fp,ie.BWL_REVIEW_REQUEST_TYPE=Hc,ie.BWL_SIDES=jp,ie.BpmnDisplayLocaleSwitcher=BF,ie.BpmnModelerView=yF,ie.BpmnValidationPanel=kF,ie.EDITOR=XT,ie.FLOW_LABEL_INDENT=Qm,ie.GROUP_BORDER_MIN_RUN=dd,ie.GROUP_BORDER_NEAR=ba,ie.HEADLESS_BPMN_MODULES=Zh,ie.HEADLESS_TEXT_METRICS=Qi,ie.HeadlessReplay=ig,ie.HeadlessReplayModule=m0,ie.I18N_DISPLAY_REDRAWN_EVENT=fc,ie.I18N_NS=NR,ie.I18N_PREFIX=Em,ie.I18N_REVIEW_REQUESTED_CLASS=d0,ie.I18N_TRANSLATION_TYPE=Or,ie.I18N_UNTRANSLATED_CLASS=p0,ie.I18nDisplay=tg,ie.I18nDisplayModule=h0,ie.IR_EVENT_DEFINITIONS=$c,ie.IR_FLOW_NODE_TYPES=Pr,ie.IR_TEXT_LOCALES=jc,ie.LABEL_FORK_MARGIN=gd,ie.LABEL_SHAPE_MIN_DEPTH=py,ie.SET_TRANSLATIONS_COMMAND=Yp,ie.SEVERITY_ORDER=Qh,ie.SYMBOLIC_OP_KINDS=Sm,ie.SYMBOLIC_OP_SCHEMA=Rm,ie.SetTranslationsHandler=Kp,ie.TranslationCommands=Zp,ie.TranslationCommandsModule=Jp,ie.TranslationStateIndex=iP,ie.UNDO_EPISODE_COMMAND=Hp,ie.UPDATE_TRANSLATION_COMMAND=Vc,ie.UpdateTranslationHandler=qp,ie.applyBpmnOpBatch=Iv,ie.applyBpmnOps=Fd,ie.applyLocaleBackfill=nP,ie.applyTranslationLocaleRestore=cP,ie.approximateTextWidth=Nr,ie.auditBpmnGeometry=hy,ie.auditBpmnGeometryXml=JC,ie.auditBpmnSemantics=Hd,ie.auditBpmnSemanticsXml=NT,ie.auditGeometry=ht,ie.auditTargetsOf=Ln,ie.axisSegmentsOf=un,ie.blackBoxNameRect=fd,ie.buildBpmnOpBatch=WT,ie.buildRegistryIndex=my,ie.collectTranslationStates=Gv,ie.containerBoundarySegments=_a,ie.countBySeverity=l0,ie.createBpmnEditorController=ZT,ie.createBpmnModdle=Vm,ie.createHeadlessBpmnModeler=PB,ie.crossedShapesOf=Ot,ie.crossingCost=Vn,ie.describeProcess=Cv,ie.describeProcessXml=kT,ie.diffBpmnElements=Pv,ie.diffBpmnElementsXml=GT,ie.documentLocalesOf=ps,ie.edgeCrossCount=ys,ie.edgeCrossingPairsOf=eo,ie.edgeCrossingStatsOf=ay,ie.executeAsUndoEpisode=vm,ie.feedGeneratedIds=Lv,ie.followMovedEdgeLabels=Ky,ie.forwardThreePointCandidates=nl,ie.geometryFindingKey=lt,ie.inferScriptLocale=vl,ie.installHeadlessBpmnDom=qm,ie.irEventDefinitionOf=$p,ie.isAddableFlowNodeType=fm,ie.isChangeScopeMixed=eg,ie.isEdgeOverlapFinding=hd,ie.isGuardedGridSnapping=KB,ie.isInChangeScope=Va,ie.isIrEventDefinition=hm,ie.isIrFlowNodeType=dm,ie.isIrTextLocale=CR,ie.labelRectsOf=Ko,ie.labelShapeDepth=dy,ie.labelSlot=Dr,ie.lineCrossesLabel=Hi,ie.lineThroughLabel=ty,ie.lineThroughShapeLabel=uy,ie.loadBpmnXml=xa,ie.localeTextsOf=Up,ie.lowerOps=_v,ie.mergeUndoSteps=bm,ie.oppositeOverlapCount=NC,ie.oppositeOverlapOf=Jm,ie.planBackEdgeBoundaryClearance=Ly,ie.planCrossPoolRoute=Ty,ie.planEdgeRepair=ol,ie.planLabelLineClearance=Dd,ie.planLabelPlacement=Uy,ie.planLocaleBackfill=tP,ie.planMiddleSegmentShifts=_y,ie.planOppositeOverlapRepair=Fy,ie.planSegmentDetours=tl,ie.planShapeLabelClearance=Jy,ie.planTranslationLocaleRestore=sP,ie.poolOverlapsOf=vd,ie.recordGeneratedIds=Dv,ie.redockIntroducedDetachedEndpoints=ev,ie.repairIntroducedBoundaryHugging=Iy,ie.repairIntroducedCrossings=_d,ie.repairIntroducedEdgeCrossings=Sy,ie.repairIntroducedFakeMerges=Hy,ie.repairIntroducedLabelLines=Xy,ie.repairIntroducedOppositeOverlaps=Wy,ie.repairIntroducedShapeLabelLines=Qy,ie.repairIntroducedSharedSegmentLabels=Zy,ie.replayAgentTurn=Bv,ie.rerouteIntroducedCrossPoolEdges=Py,ie.resolverServicesOf=fv,ie.reviewRequestValuesOf=Xp,ie.reviewRequestsOf=Wo,ie.rootLangOf=Wp,ie.saveBpmnXml=RC,ie.sceneCrossingCost=ry,ie.sceneFromDefinitions=fy,ie.sceneFromRegistry=We,ie.segmentShapeClearance=wo,ie.shapesUnderLabel=vs,ie.sharedEndpointCrossingPairsOf=Ei,ie.sharedSegmentUnderLabel=el,ie.sharedSpansOf=Qc,ie.sortPanelIssues=u0,ie.toPanelIssues=c0,ie.touchedElements=VT,ie.translationLocale=An,ie.translationsOf=Vo,ie.undoStepMark=xm,ie.unreadableOverlapCount=ei,ie.unreadableOverlapOf=$r,ie.validateOps=ov,ie.warningMessages=pd,Object.defineProperty(ie,Symbol.toStringTag,{value:"Module"})}));