astrion-website/demo/static/dist/assets/WorkflowDemoShell.js

40 lines
305 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{d as ye,m as L,c as j,f as k,z as ue,u as P,t as Y,F as Ce,r as it,B as bi,j as me,L as Ht,I as oa,w as $e,o as rt,a6 as Ie,n as Oe,ad as pu,H as ke,k as se,ae as ia,U as mu,s as be,x as ze,a4 as rn,N as ra,O as oo,P as Ge,af as wu,a as Zi,ag as yu,b as Me,e as Ne,a2 as Et,y as _u,E as qi,Q as bu,a3 as ku,ah as pe,a0 as Pt,a1 as xe,a9 as sa,ai as Ki,W as vo,J as io,aj as Eu,_ as Nt,h as $u,S as xu,ak as dn,l as ee,al as Fn,g as Fe,i as Ye,D as Nu}from"./index.js";import{I as ge,C as Su}from"./CloseButton.js";import{_ as Ft}from"./_plugin-vue_export-helper.js";const Cu={class:"wf-library"},Mu={class:"wf-library__topbar"},Iu={class:"wf-library__container"},Tu={class:"wf-library__heading"},Ou={class:"wf-library__title-block"},Du={class:"wf-library__title"},Au={class:"wf-library__subtitle"},Pu={key:0,class:"wf-library__list"},Ru=["onClick"],zu={class:"wf-row__icon"},Bu={class:"wf-row__main"},Vu={class:"wf-row__name"},Lu={class:"wf-row__desc"},Hu={class:"wf-row__meta"},Fu=["aria-label","title","onClick"],Yu=["aria-label","title","onClick"],Gu=["aria-label","title","onClick"],Xu=["onClick"],Wu={key:1,class:"wf-library__empty"},ju={class:"wf-library__empty-title"},Uu={class:"wf-library__empty-hint"},Zu=ye({__name:"WorkflowLibraryView",props:{workflows:{}},emits:["open","create","duplicate","delete","exit"],setup(e,{emit:t}){const n=t,o=me("");function i(s){n("delete",s),o.value=""}function r(s){return{"--icon-src":`url(${s})`}}return(s,a)=>(L(),j("div",Cu,[k("header",Mu,[k("button",{type:"button",class:"wf-btn wf-btn--ghost",onClick:a[0]||(a[0]=l=>s.$emit("exit"))},[k("span",{class:"icon",style:ue(r(P(ge).arrowLeft)),"aria-hidden":"true"},null,4),k("span",null,Y(s.$t("workflow.backToConversation")),1)])]),k("div",Iu,[k("div",Tu,[k("div",Ou,[k("h1",Du,Y(s.$t("workflow.libraryTitle")),1),k("p",Au,Y(s.$t("workflow.librarySubtitle")),1)]),k("button",{type:"button",class:"wf-btn wf-btn--primary",onClick:a[1]||(a[1]=l=>s.$emit("create"))},[k("span",{class:"icon",style:ue(r(P(ge).plus)),"aria-hidden":"true"},null,4),k("span",null,Y(s.$t("workflow.newWorkflow")),1)])]),e.workflows.length?(L(),j("div",Pu,[(L(!0),j(Ce,null,it(e.workflows,l=>(L(),j("div",{key:l.name,class:"wf-row",onClick:u=>s.$emit("open",l.name)},[k("div",zu,[k("span",{class:"icon icon-md",style:ue(r(P(ge).workflow)),"aria-hidden":"true"},null,4)]),k("div",Bu,[k("div",Vu,Y(l.name),1),k("div",Lu,Y(l.description||s.$t("workflow.noDescription")),1)]),k("div",Hu,[k("span",null,Y(s.$t("workflow.nodeCountLabel",{n:l.nodeCount})),1),a[4]||(a[4]=k("span",{class:"wf-row__meta-sep"},"·",-1)),k("span",null,Y(l.source==="builtin"?s.$t("workflow.badgeBuiltin"):s.$t("workflow.badgeUser")),1),a[5]||(a[5]=k("span",{class:"wf-row__meta-sep"},"·",-1)),k("span",null,Y(l.updatedAt),1)]),k("div",{class:"wf-row__actions",onClick:a[2]||(a[2]=bi(()=>{},["stop"]))},[k("button",{type:"button",class:"wf-icon-btn","aria-label":s.$t("workflow.edit"),title:s.$t("workflow.edit"),onClick:u=>s.$emit("open",l.name)},[k("span",{class:"icon",style:ue(r(P(ge).pencil)),"aria-hidden":"true"},null,4)],8,Fu),k("button",{type:"button",class:"wf-icon-btn","aria-label":s.$t("common.copy"),title:s.$t("common.copy"),onClick:u=>s.$emit("duplicate",l.name)},[k("span",{class:"icon",style:ue(r(P(ge).copy)),"aria-hidden":"true"},null,4)],8,Yu),o.value!==l.name?(L(),j("button",{key:0,type:"button",class:"wf-icon-btn wf-icon-btn--danger","aria-label":s.$t("common.delete"),title:s.$t("common.delete"),onClick:u=>o.value=l.name},[k("span",{class:"icon",style:ue(r(P(ge).trash)),"aria-hidden":"true"},null,4)],8,Gu)):(L(),j("button",{key:1,type:"button",class:"wf-btn wf-btn--danger-confirm",onClick:u=>i(l.name)},Y(s.$t("workflow.confirmDelete")),9,Xu))])],8,Ru))),128))])):(L(),j("div",Wu,[k("span",{class:"icon icon-xl",style:ue(r(P(ge).workflow)),"aria-hidden":"true"},null,4),k("p",ju,Y(s.$t("workflow.emptyTitle")),1),k("p",Uu,Y(s.$t("workflow.emptyHint")),1),k("button",{type:"button",class:"wf-btn wf-btn--primary",onClick:a[3]||(a[3]=l=>s.$emit("create"))},[k("span",{class:"icon",style:ue(r(P(ge).plus)),"aria-hidden":"true"},null,4),k("span",null,Y(s.$t("workflow.newWorkflow")),1)])]))])]))}}),qu=Ft(Zu,[["__scopeId","data-v-9572f14a"]]);function bn(e){return ra()?(oo(e),!0):!1}function ct(e){return typeof e=="function"?e():P(e)}const Ku=typeof window<"u"&&typeof document<"u",Ju=e=>typeof e<"u",Qu=Object.prototype.toString,ec=e=>Qu.call(e)==="[object Object]",tc=()=>{};function nc(e,t){function n(...o){return new Promise((i,r)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(r)})}return n}const aa=e=>e();function oc(e=aa){const t=me(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:Eu(t),pause:n,resume:o,eventFilter:i}}function $r(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function ic(e,t,n={}){const{eventFilter:o=aa,...i}=n;return $e(e,nc(o,t),i)}function Gt(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:s,resume:a,isActive:l}=oc(o);return{stop:ic(e,t,{...i,eventFilter:r}),pause:s,resume:a,isActive:l}}function rc(e,t={}){if(!qi(e))return bu(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=ku(()=>({get(){return e.value[o]},set(i){var r;if((r=ct(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const a=[...e.value];a[o]=i,e.value=a}else{const a={...e.value,[o]:i};Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[o]=i}}));return n}function ki(e,t=!1){function n(d,{flush:f="sync",deep:h=!1,timeout:_,throwOnTimeout:b}={}){let S=null;const N=[new Promise(m=>{S=$e(e,E=>{d(E)!==t&&(S==null||S(),m(E))},{flush:f,deep:h,immediate:!0})})];return _!=null&&N.push($r(_,b).then(()=>ct(e)).finally(()=>S==null?void 0:S())),Promise.race(N)}function o(d,f){if(!qi(d))return n(E=>E===d,f);const{flush:h="sync",deep:_=!1,timeout:b,throwOnTimeout:S}=f??{};let $=null;const m=[new Promise(E=>{$=$e([e,d],([A,V])=>{t!==(A===V)&&($==null||$(),E(A))},{flush:h,deep:_,immediate:!0})})];return b!=null&&m.push($r(b,S).then(()=>ct(e)).finally(()=>($==null||$(),ct(e)))),Promise.race(m)}function i(d){return n(f=>!!f,d)}function r(d){return o(null,d)}function s(d){return o(void 0,d)}function a(d){return n(Number.isNaN,d)}function l(d,f){return n(h=>{const _=Array.from(h);return _.includes(d)||_.includes(ct(d))},f)}function u(d){return c(1,d)}function c(d=1,f){let h=-1;return n(()=>(h+=1,h>=d),f)}return Array.isArray(ct(e))?{toMatch:n,toContains:l,changed:u,changedTimes:c,get not(){return ki(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:a,toBeUndefined:s,changed:u,changedTimes:c,get not(){return ki(e,!t)}}}function Ei(e){return ki(e)}function sc(e){var t;const n=ct(e);return(t=n==null?void 0:n.$el)!=null?t:n}const la=Ku?window:void 0;function ua(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=la):[t,n,o,i]=e,!t)return tc;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],s=()=>{r.forEach(c=>c()),r.length=0},a=(c,d,f,h)=>(c.addEventListener(d,f,h),()=>c.removeEventListener(d,f,h)),l=$e(()=>[sc(t),ct(i)],([c,d])=>{if(s(),!c)return;const f=ec(d)?{...d}:d;r.push(...n.flatMap(h=>o.map(_=>a(c,h,_,f))))},{immediate:!0,flush:"post"}),u=()=>{l(),s()};return bn(u),u}function ac(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function xr(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=la,eventName:r="keydown",passive:s=!1,dedupe:a=!1}=o,l=ac(t);return ua(i,r,c=>{c.repeat&&ct(a)||l(c)&&n(c)},s)}function lc(e){return JSON.parse(JSON.stringify(e))}function Qo(e,t,n,o={}){var i,r,s;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:d,shouldEmit:f}=o,h=rn(),_=n||(h==null?void 0:h.emit)||((i=h==null?void 0:h.$emit)==null?void 0:i.bind(h))||((s=(r=h==null?void 0:h.proxy)==null?void 0:r.$emit)==null?void 0:s.bind(h==null?void 0:h.proxy));let b=u;t||(t="modelValue"),b=b||`update:${t.toString()}`;const S=m=>a?typeof a=="function"?a(m):lc(m):m,$=()=>Ju(e[t])?S(e[t]):d,N=m=>{f?f(m)&&_(b,m):_(b,m)};if(l){const m=$(),E=me(m);let A=!1;return $e(()=>e[t],V=>{A||(A=!0,E.value=S(V),Ge(()=>A=!1))}),$e(E,V=>{!A&&(V!==e[t]||c)&&N(V)},{deep:c}),E}else return se({get(){return $()},set(m){N(m)}})}var uc={value:()=>{}};function Ro(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ro(n)}function ro(e){this._=e}function cc(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ro.prototype=Ro.prototype={constructor:ro,on:function(e,t){var n=this._,o=cc(e+"",n),i,r=-1,s=o.length;if(arguments.length<2){for(;++r<s;)if((i=(e=o[r]).type)&&(i=dc(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<s;)if(i=(e=o[r]).type)n[i]=Nr(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Nr(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ro(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,r;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)}};function dc(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Nr(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=uc,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var $i="http://www.w3.org/1999/xhtml";const Sr={svg:"http://www.w3.org/2000/svg",xhtml:$i,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function zo(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Sr.hasOwnProperty(t)?{space:Sr[t],local:e}:e}function fc(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$i&&t.documentElement.namespaceURI===$i?t.createElement(e):t.createElementNS(n,e)}}function hc(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ca(e){var t=zo(e);return(t.local?hc:fc)(t)}function gc(){}function Ji(e){return e==null?gc:function(){return this.querySelector(e)}}function vc(e){typeof e!="function"&&(e=Ji(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=new Array(s),l,u,c=0;c<s;++c)(l=r[c])&&(u=e.call(l,l.__data__,c,r))&&("__data__"in l&&(u.__data__=l.__data__),a[c]=u);return new Le(o,this._parents)}function pc(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function mc(){return[]}function da(e){return e==null?mc:function(){return this.querySelectorAll(e)}}function wc(e){return function(){return pc(e.apply(this,arguments))}}function yc(e){typeof e=="function"?e=wc(e):e=da(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var s=t[r],a=s.length,l,u=0;u<a;++u)(l=s[u])&&(o.push(e.call(l,l.__data__,u,s)),i.push(l));return new Le(o,i)}function fa(e){return function(){return this.matches(e)}}function ha(e){return function(t){return t.matches(e)}}var _c=Array.prototype.find;function bc(e){return function(){return _c.call(this.children,e)}}function kc(){return this.firstElementChild}function Ec(e){return this.select(e==null?kc:bc(typeof e=="function"?e:ha(e)))}var $c=Array.prototype.filter;function xc(){return Array.from(this.children)}function Nc(e){return function(){return $c.call(this.children,e)}}function Sc(e){return this.selectAll(e==null?xc:Nc(typeof e=="function"?e:ha(e)))}function Cc(e){typeof e!="function"&&(e=fa(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=[],l,u=0;u<s;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new Le(o,this._parents)}function ga(e){return new Array(e.length)}function Mc(){return new Le(this._enter||this._groups.map(ga),this._parents)}function po(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}po.prototype={constructor:po,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Ic(e){return function(){return e}}function Tc(e,t,n,o,i,r){for(var s=0,a,l=t.length,u=r.length;s<u;++s)(a=t[s])?(a.__data__=r[s],o[s]=a):n[s]=new po(e,r[s]);for(;s<l;++s)(a=t[s])&&(i[s]=a)}function Oc(e,t,n,o,i,r,s){var a,l,u=new Map,c=t.length,d=r.length,f=new Array(c),h;for(a=0;a<c;++a)(l=t[a])&&(f[a]=h=s.call(l,l.__data__,a,t)+"",u.has(h)?i[a]=l:u.set(h,l));for(a=0;a<d;++a)h=s.call(e,r[a],a,r)+"",(l=u.get(h))?(o[a]=l,l.__data__=r[a],u.delete(h)):n[a]=new po(e,r[a]);for(a=0;a<c;++a)(l=t[a])&&u.get(f[a])===l&&(i[a]=l)}function Dc(e){return e.__data__}function Ac(e,t){if(!arguments.length)return Array.from(this,Dc);var n=t?Oc:Tc,o=this._parents,i=this._groups;typeof e!="function"&&(e=Ic(e));for(var r=i.length,s=new Array(r),a=new Array(r),l=new Array(r),u=0;u<r;++u){var c=o[u],d=i[u],f=d.length,h=Pc(e.call(c,c&&c.__data__,u,o)),_=h.length,b=a[u]=new Array(_),S=s[u]=new Array(_),$=l[u]=new Array(f);n(c,d,b,S,$,h,t);for(var N=0,m=0,E,A;N<_;++N)if(E=b[N]){for(N>=m&&(m=N+1);!(A=S[m])&&++m<_;);E._next=A||null}}return s=new Le(s,o),s._enter=a,s._exit=l,s}function Pc(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Rc(){return new Le(this._exit||this._groups.map(ga),this._parents)}function zc(e,t,n){var o=this.enter(),i=this,r=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?r.remove():n(r),o&&i?o.merge(i).order():i}function Bc(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,s=Math.min(i,r),a=new Array(i),l=0;l<s;++l)for(var u=n[l],c=o[l],d=u.length,f=a[l]=new Array(d),h,_=0;_<d;++_)(h=u[_]||c[_])&&(f[_]=h);for(;l<i;++l)a[l]=n[l];return new Le(a,this._parents)}function Vc(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],s;--i>=0;)(s=o[i])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function Lc(e){e||(e=Hc);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var s=n[r],a=s.length,l=i[r]=new Array(a),u,c=0;c<a;++c)(u=s[c])&&(l[c]=u);l.sort(t)}return new Le(i,this._parents).order()}function Hc(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Fc(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Yc(){return Array.from(this)}function Gc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var s=o[i];if(s)return s}return null}function Xc(){let e=0;for(const t of this)++e;return e}function Wc(){return!this.node()}function jc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,s=i.length,a;r<s;++r)(a=i[r])&&e.call(a,a.__data__,r,i);return this}function Uc(e){return function(){this.removeAttribute(e)}}function Zc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qc(e,t){return function(){this.setAttribute(e,t)}}function Kc(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Jc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Qc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function ed(e,t){var n=zo(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Zc:Uc:typeof t=="function"?n.local?Qc:Jc:n.local?Kc:qc)(n,t))}function va(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function td(e){return function(){this.style.removeProperty(e)}}function nd(e,t,n){return function(){this.style.setProperty(e,t,n)}}function od(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function id(e,t,n){return arguments.length>1?this.each((t==null?td:typeof t=="function"?od:nd)(e,t,n??"")):Kt(this.node(),e)}function Kt(e,t){return e.style.getPropertyValue(t)||va(e).getComputedStyle(e,null).getPropertyValue(t)}function rd(e){return function(){delete this[e]}}function sd(e,t){return function(){this[e]=t}}function ad(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function ld(e,t){return arguments.length>1?this.each((t==null?rd:typeof t=="function"?ad:sd)(e,t)):this.node()[e]}function pa(e){return e.trim().split(/^|\s+/)}function Qi(e){return e.classList||new ma(e)}function ma(e){this._node=e,this._names=pa(e.getAttribute("class")||"")}ma.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function wa(e,t){for(var n=Qi(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function ya(e,t){for(var n=Qi(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function ud(e){return function(){wa(this,e)}}function cd(e){return function(){ya(this,e)}}function dd(e,t){return function(){(t.apply(this,arguments)?wa:ya)(this,e)}}function fd(e,t){var n=pa(e+"");if(arguments.length<2){for(var o=Qi(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?dd:t?ud:cd)(n,t))}function hd(){this.textContent=""}function gd(e){return function(){this.textContent=e}}function vd(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function pd(e){return arguments.length?this.each(e==null?hd:(typeof e=="function"?vd:gd)(e)):this.node().textContent}function md(){this.innerHTML=""}function wd(e){return function(){this.innerHTML=e}}function yd(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _d(e){return arguments.length?this.each(e==null?md:(typeof e=="function"?yd:wd)(e)):this.node().innerHTML}function bd(){this.nextSibling&&this.parentNode.appendChild(this)}function kd(){return this.each(bd)}function Ed(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function $d(){return this.each(Ed)}function xd(e){var t=typeof e=="function"?e:ca(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Nd(){return null}function Sd(e,t){var n=typeof e=="function"?e:ca(e),o=t==null?Nd:typeof t=="function"?t:Ji(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Cd(){var e=this.parentNode;e&&e.removeChild(this)}function Md(){return this.each(Cd)}function Id(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Td(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Od(e){return this.select(e?Td:Id)}function Dd(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ad(e){return function(t){e.call(this,t,this.__data__)}}function Pd(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Rd(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,r;n<i;++n)r=t[n],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++o]=r;++o?t.length=o:delete this.__on}}}function zd(e,t,n){return function(){var o=this.__on,i,r=Ad(t);if(o){for(var s=0,a=o.length;s<a;++s)if((i=o[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=t;return}}this.addEventListener(e.type,r,n),i={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(i):this.__on=[i]}}function Bd(e,t,n){var o=Pd(e+""),i,r=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,u=a.length,c;l<u;++l)for(i=0,c=a[l];i<r;++i)if((s=o[i]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?zd:Rd,i=0;i<r;++i)this.each(a(o[i],t,n));return this}function _a(e,t,n){var o=va(e),i=o.CustomEvent;typeof i=="function"?i=new i(t,n):(i=o.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Vd(e,t){return function(){return _a(this,e,t)}}function Ld(e,t){return function(){return _a(this,e,t.apply(this,arguments))}}function Hd(e,t){return this.each((typeof t=="function"?Ld:Vd)(e,t))}function*Fd(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,s;i<r;++i)(s=o[i])&&(yield s)}var ba=[null];function Le(e,t){this._groups=e,this._parents=t}function Pn(){return new Le([[document.documentElement]],ba)}function Yd(){return this}Le.prototype=Pn.prototype={constructor:Le,select:vc,selectAll:yc,selectChild:Ec,selectChildren:Sc,filter:Cc,data:Ac,enter:Mc,exit:Rc,join:zc,merge:Bc,selection:Yd,order:Vc,sort:Lc,call:Fc,nodes:Yc,node:Gc,size:Xc,empty:Wc,each:jc,attr:ed,style:id,property:ld,classed:fd,text:pd,html:_d,raise:kd,lower:$d,append:xd,insert:Sd,remove:Md,clone:Od,datum:Dd,on:Bd,dispatch:Hd,[Symbol.iterator]:Fd};function Xe(e){return typeof e=="string"?new Le([[document.querySelector(e)]],[document.documentElement]):new Le([[e]],ba)}function Gd(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Je(e,t){if(e=Gd(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const Xd={passive:!1},kn={capture:!0,passive:!1};function ei(e){e.stopImmediatePropagation()}function Wt(e){e.preventDefault(),e.stopImmediatePropagation()}function ka(e){var t=e.document.documentElement,n=Xe(e).on("dragstart.drag",Wt,kn);"onselectstart"in t?n.on("selectstart.drag",Wt,kn):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ea(e,t){var n=e.document.documentElement,o=Xe(e).on("dragstart.drag",null);t&&(o.on("click.drag",Wt,kn),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Yn=e=>()=>e;function xi(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:s,y:a,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}xi.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Wd(e){return!e.ctrlKey&&!e.button}function jd(){return this.parentNode}function Ud(e,t){return t??{x:e.x,y:e.y}}function Zd(){return navigator.maxTouchPoints||"ontouchstart"in this}function qd(){var e=Wd,t=jd,n=Ud,o=Zd,i={},r=Ro("start","drag","end"),s=0,a,l,u,c,d=0;function f(E){E.on("mousedown.drag",h).filter(o).on("touchstart.drag",S).on("touchmove.drag",$,Xd).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(E,A){if(!(c||!e.call(this,E,A))){var V=m(this,t.call(this,E,A),E,A,"mouse");V&&(Xe(E.view).on("mousemove.drag",_,kn).on("mouseup.drag",b,kn),ka(E.view),ei(E),u=!1,a=E.clientX,l=E.clientY,V("start",E))}}function _(E){if(Wt(E),!u){var A=E.clientX-a,V=E.clientY-l;u=A*A+V*V>d}i.mouse("drag",E)}function b(E){Xe(E.view).on("mousemove.drag mouseup.drag",null),Ea(E.view,u),Wt(E),i.mouse("end",E)}function S(E,A){if(e.call(this,E,A)){var V=E.changedTouches,F=t.call(this,E,A),B=V.length,X,H;for(X=0;X<B;++X)(H=m(this,F,E,A,V[X].identifier,V[X]))&&(ei(E),H("start",E,V[X]))}}function $(E){var A=E.changedTouches,V=A.length,F,B;for(F=0;F<V;++F)(B=i[A[F].identifier])&&(Wt(E),B("drag",E,A[F]))}function N(E){var A=E.changedTouches,V=A.length,F,B;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),F=0;F<V;++F)(B=i[A[F].identifier])&&(ei(E),B("end",E,A[F]))}function m(E,A,V,F,B,X){var H=r.copy(),z=Je(X||V,A),C,W,v;if((v=n.call(E,new xi("beforestart",{sourceEvent:V,target:f,identifier:B,active:s,x:z[0],y:z[1],dx:0,dy:0,dispatch:H}),F))!=null)return C=v.x-z[0]||0,W=v.y-z[1]||0,function x(y,O,T){var R=z,D;switch(y){case"start":i[B]=x,D=s++;break;case"end":delete i[B],--s;case"drag":z=Je(T||O,A),D=s;break}H.call(y,E,new xi(y,{sourceEvent:O,subject:v,target:f,identifier:B,active:D,x:z[0]+C,y:z[1]+W,dx:z[0]-R[0],dy:z[1]-R[1],dispatch:H}),F)}}return f.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Yn(!!E),f):e},f.container=function(E){return arguments.length?(t=typeof E=="function"?E:Yn(E),f):t},f.subject=function(E){return arguments.length?(n=typeof E=="function"?E:Yn(E),f):n},f.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:Yn(!!E),f):o},f.on=function(){var E=r.on.apply(r,arguments);return E===r?f:E},f.clickDistance=function(E){return arguments.length?(d=(E=+E)*E,f):Math.sqrt(d)},f}function er(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function $a(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Rn(){}var En=.7,mo=1/En,jt="\\s*([+-]?\\d+)\\s*",$n="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",nt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kd=/^#([0-9a-f]{3,8})$/,Jd=new RegExp(`^rgb\\(${jt},${jt},${jt}\\)$`),Qd=new RegExp(`^rgb\\(${nt},${nt},${nt}\\)$`),ef=new RegExp(`^rgba\\(${jt},${jt},${jt},${$n}\\)$`),tf=new RegExp(`^rgba\\(${nt},${nt},${nt},${$n}\\)$`),nf=new RegExp(`^hsl\\(${$n},${nt},${nt}\\)$`),of=new RegExp(`^hsla\\(${$n},${nt},${nt},${$n}\\)$`),Cr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};er(Rn,Rt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Mr,formatHex:Mr,formatHex8:rf,formatHsl:sf,formatRgb:Ir,toString:Ir});function Mr(){return this.rgb().formatHex()}function rf(){return this.rgb().formatHex8()}function sf(){return xa(this).formatHsl()}function Ir(){return this.rgb().formatRgb()}function Rt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Kd.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Tr(t):n===3?new Be(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Gn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Gn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Jd.exec(e))?new Be(t[1],t[2],t[3],1):(t=Qd.exec(e))?new Be(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ef.exec(e))?Gn(t[1],t[2],t[3],t[4]):(t=tf.exec(e))?Gn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=nf.exec(e))?Ar(t[1],t[2]/100,t[3]/100,1):(t=of.exec(e))?Ar(t[1],t[2]/100,t[3]/100,t[4]):Cr.hasOwnProperty(e)?Tr(Cr[e]):e==="transparent"?new Be(NaN,NaN,NaN,0):null}function Tr(e){return new Be(e>>16&255,e>>8&255,e&255,1)}function Gn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Be(e,t,n,o)}function af(e){return e instanceof Rn||(e=Rt(e)),e?(e=e.rgb(),new Be(e.r,e.g,e.b,e.opacity)):new Be}function Ni(e,t,n,o){return arguments.length===1?af(e):new Be(e,t,n,o??1)}function Be(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}er(Be,Ni,$a(Rn,{brighter(e){return e=e==null?mo:Math.pow(mo,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?En:Math.pow(En,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Be(Ot(this.r),Ot(this.g),Ot(this.b),wo(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Or,formatHex:Or,formatHex8:lf,formatRgb:Dr,toString:Dr}));function Or(){return`#${It(this.r)}${It(this.g)}${It(this.b)}`}function lf(){return`#${It(this.r)}${It(this.g)}${It(this.b)}${It((isNaN(this.opacity)?1:this.opacity)*255)}`}function Dr(){const e=wo(this.opacity);return`${e===1?"rgb(":"rgba("}${Ot(this.r)}, ${Ot(this.g)}, ${Ot(this.b)}${e===1?")":`, ${e})`}`}function wo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ot(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function It(e){return e=Ot(e),(e<16?"0":"")+e.toString(16)}function Ar(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new We(e,t,n,o)}function xa(e){if(e instanceof We)return new We(e.h,e.s,e.l,e.opacity);if(e instanceof Rn||(e=Rt(e)),!e)return new We;if(e instanceof We)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),s=NaN,a=r-i,l=(r+i)/2;return a?(t===r?s=(n-o)/a+(n<o)*6:n===r?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?r+i:2-r-i,s*=60):a=l>0&&l<1?0:s,new We(s,a,l,e.opacity)}function uf(e,t,n,o){return arguments.length===1?xa(e):new We(e,t,n,o??1)}function We(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}er(We,uf,$a(Rn,{brighter(e){return e=e==null?mo:Math.pow(mo,e),new We(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?En:Math.pow(En,e),new We(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new Be(ti(e>=240?e-240:e+120,i,o),ti(e,i,o),ti(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new We(Pr(this.h),Xn(this.s),Xn(this.l),wo(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=wo(this.opacity);return`${e===1?"hsl(":"hsla("}${Pr(this.h)}, ${Xn(this.s)*100}%, ${Xn(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Pr(e){return e=(e||0)%360,e<0?e+360:e}function Xn(e){return Math.max(0,Math.min(1,e||0))}function ti(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const tr=e=>()=>e;function cf(e,t){return function(n){return e+n*t}}function df(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function ff(e){return(e=+e)==1?Na:function(t,n){return n-t?df(t,n,e):tr(isNaN(t)?n:t)}}function Na(e,t){var n=t-e;return n?cf(e,n):tr(isNaN(e)?t:e)}const yo=function e(t){var n=ff(t);function o(i,r){var s=n((i=Ni(i)).r,(r=Ni(r)).r),a=n(i.g,r.g),l=n(i.b,r.b),u=Na(i.opacity,r.opacity);return function(c){return i.r=s(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return o.gamma=e,o}(1);function hf(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),i;return function(r){for(i=0;i<n;++i)o[i]=e[i]*(1-r)+t[i]*r;return o}}function gf(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function vf(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,i=new Array(o),r=new Array(n),s;for(s=0;s<o;++s)i[s]=wn(e[s],t[s]);for(;s<n;++s)r[s]=t[s];return function(a){for(s=0;s<o;++s)r[s]=i[s](a);return r}}function pf(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Qe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mf(e,t){var n={},o={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=wn(e[i],t[i]):o[i]=t[i];return function(r){for(i in n)o[i]=n[i](r);return o}}var Si=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ni=new RegExp(Si.source,"g");function wf(e){return function(){return e}}function yf(e){return function(t){return e(t)+""}}function Sa(e,t){var n=Si.lastIndex=ni.lastIndex=0,o,i,r,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Si.exec(e))&&(i=ni.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),a[s]?a[s]+=r:a[++s]=r),(o=o[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:Qe(o,i)})),n=ni.lastIndex;return n<t.length&&(r=t.slice(n),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?yf(l[0].x):wf(t):(t=l.length,function(u){for(var c=0,d;c<t;++c)a[(d=l[c]).i]=d.x(u);return a.join("")})}function wn(e,t){var n=typeof t,o;return t==null||n==="boolean"?tr(t):(n==="number"?Qe:n==="string"?(o=Rt(t))?(t=o,yo):Sa:t instanceof Rt?yo:t instanceof Date?pf:gf(t)?hf:Array.isArray(t)?vf:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?mf:Qe)(e,t)}var Rr=180/Math.PI,Ci={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ca(e,t,n,o,i,r){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*Rr,skewX:Math.atan(l)*Rr,scaleX:s,scaleY:a}}var Wn;function _f(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ci:Ca(t.a,t.b,t.c,t.d,t.e,t.f)}function bf(e){return e==null||(Wn||(Wn=document.createElementNS("http://www.w3.org/2000/svg","g")),Wn.setAttribute("transform",e),!(e=Wn.transform.baseVal.consolidate()))?Ci:(e=e.matrix,Ca(e.a,e.b,e.c,e.d,e.e,e.f))}function Ma(e,t,n,o){function i(u){return u.length?u.pop()+" ":""}function r(u,c,d,f,h,_){if(u!==d||c!==f){var b=h.push("translate(",null,t,null,n);_.push({i:b-4,x:Qe(u,d)},{i:b-2,x:Qe(c,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function s(u,c,d,f){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,o)-2,x:Qe(u,c)})):c&&d.push(i(d)+"rotate("+c+o)}function a(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,o)-2,x:Qe(u,c)}):c&&d.push(i(d)+"skewX("+c+o)}function l(u,c,d,f,h,_){if(u!==d||c!==f){var b=h.push(i(h)+"scale(",null,",",null,")");_.push({i:b-4,x:Qe(u,d)},{i:b-2,x:Qe(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),r(u.translateX,u.translateY,c.translateX,c.translateY,d,f),s(u.rotate,c.rotate,d,f),a(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var _=-1,b=f.length,S;++_<b;)d[(S=f[_]).i]=S.x(h);return d.join("")}}}var kf=Ma(_f,"px, ","px)","deg)"),Ef=Ma(bf,", ",")",")"),$f=1e-12;function zr(e){return((e=Math.exp(e))+1/e)/2}function xf(e){return((e=Math.exp(e))-1/e)/2}function Nf(e){return((e=Math.exp(2*e))-1)/(e+1)}const so=function e(t,n,o){function i(r,s){var a=r[0],l=r[1],u=r[2],c=s[0],d=s[1],f=s[2],h=c-a,_=d-l,b=h*h+_*_,S,$;if(b<$f)$=Math.log(f/u)/t,S=function(F){return[a+F*h,l+F*_,u*Math.exp(t*F*$)]};else{var N=Math.sqrt(b),m=(f*f-u*u+o*b)/(2*u*n*N),E=(f*f-u*u-o*b)/(2*f*n*N),A=Math.log(Math.sqrt(m*m+1)-m),V=Math.log(Math.sqrt(E*E+1)-E);$=(V-A)/t,S=function(F){var B=F*$,X=zr(A),H=u/(n*N)*(X*Nf(t*B+A)-xf(A));return[a+H*h,l+H*_,u*X/zr(t*B+A)]}}return S.duration=$*1e3*t/Math.SQRT2,S}return i.rho=function(r){var s=Math.max(.001,+r),a=s*s,l=a*a;return e(s,a,l)},i}(Math.SQRT2,2,4);var Jt=0,fn=0,an=0,Ia=1e3,_o,hn,bo=0,zt=0,Bo=0,xn=typeof performance=="object"&&performance.now?performance:Date,Ta=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function nr(){return zt||(Ta(Sf),zt=xn.now()+Bo)}function Sf(){zt=0}function ko(){this._call=this._time=this._next=null}ko.prototype=Oa.prototype={constructor:ko,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?nr():+n)+(t==null?0:+t),!this._next&&hn!==this&&(hn?hn._next=this:_o=this,hn=this),this._call=e,this._time=n,Mi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mi())}};function Oa(e,t,n){var o=new ko;return o.restart(e,t,n),o}function Cf(){nr(),++Jt;for(var e=_o,t;e;)(t=zt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jt}function Br(){zt=(bo=xn.now())+Bo,Jt=fn=0;try{Cf()}finally{Jt=0,If(),zt=0}}function Mf(){var e=xn.now(),t=e-bo;t>Ia&&(Bo-=t,bo=e)}function If(){for(var e,t=_o,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:_o=n);hn=e,Mi(o)}function Mi(e){if(!Jt){fn&&(fn=clearTimeout(fn));var t=e-zt;t>24?(e<1/0&&(fn=setTimeout(Br,e-xn.now()-Bo)),an&&(an=clearInterval(an))):(an||(bo=xn.now(),an=setInterval(Mf,Ia)),Jt=1,Ta(Br))}}function Vr(e,t,n){var o=new ko;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var Tf=Ro("start","end","cancel","interrupt"),Of=[],Da=0,Lr=1,Ii=2,ao=3,Hr=4,Ti=5,lo=6;function Vo(e,t,n,o,i,r){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Df(e,n,{name:t,index:o,group:i,on:Tf,tween:Of,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Da})}function or(e,t){var n=Ue(e,t);if(n.state>Da)throw new Error("too late; already scheduled");return n}function st(e,t){var n=Ue(e,t);if(n.state>ao)throw new Error("too late; already running");return n}function Ue(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Df(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=Oa(r,0,n.time);function r(u){n.state=Lr,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,d,f,h;if(n.state!==Lr)return l();for(c in o)if(h=o[c],h.name===n.name){if(h.state===ao)return Vr(s);h.state===Hr?(h.state=lo,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[c]):+c<t&&(h.state=lo,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[c])}if(Vr(function(){n.state===ao&&(n.state=Hr,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Ii,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ii){for(n.state=ao,i=new Array(f=n.tween.length),c=0,d=-1;c<f;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=h);i.length=d+1}}function a(u){for(var c=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=Ti,1),d=-1,f=i.length;++d<f;)i[d].call(e,c);n.state===Ti&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=lo,n.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function uo(e,t){var n=e.__transition,o,i,r=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){r=!1;continue}i=o.state>Ii&&o.state<Ti,o.state=lo,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}r&&delete e.__transition}}function Af(e){return this.each(function(){uo(this,e)})}function Pf(e,t){var n,o;return function(){var i=st(this,e),r=i.tween;if(r!==n){o=n=r;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}i.tween=o}}function Rf(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=st(this,e),s=r.tween;if(s!==o){i=(o=s).slice();for(var a={name:t,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===t){i[l]=a;break}l===u&&i.push(a)}r.tween=i}}function zf(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Ue(this.node(),n).tween,i=0,r=o.length,s;i<r;++i)if((s=o[i]).name===e)return s.value;return null}return this.each((t==null?Pf:Rf)(n,e,t))}function ir(e,t,n){var o=e._id;return e.each(function(){var i=st(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ue(i,o).value[t]}}function Aa(e,t){var n;return(typeof t=="number"?Qe:t instanceof Rt?yo:(n=Rt(t))?(t=n,yo):Sa)(e,t)}function Bf(e){return function(){this.removeAttribute(e)}}function Vf(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lf(e,t,n){var o,i=n+"",r;return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function Hf(e,t,n){var o,i=n+"",r;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function Ff(e,t,n){var o,i,r;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a)))}}function Yf(e,t,n){var o,i,r;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a)))}}function Gf(e,t){var n=zo(e),o=n==="transform"?Ef:Aa;return this.attrTween(e,typeof t=="function"?(n.local?Yf:Ff)(n,o,ir(this,"attr."+e,t)):t==null?(n.local?Vf:Bf)(n):(n.local?Hf:Lf)(n,o,t))}function Xf(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wf(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function jf(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Wf(e,r)),n}return i._value=t,i}function Uf(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Xf(e,r)),n}return i._value=t,i}function Zf(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=zo(e);return this.tween(n,(o.local?jf:Uf)(o,t))}function qf(e,t){return function(){or(this,e).delay=+t.apply(this,arguments)}}function Kf(e,t){return t=+t,function(){or(this,e).delay=t}}function Jf(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?qf:Kf)(t,e)):Ue(this.node(),t).delay}function Qf(e,t){return function(){st(this,e).duration=+t.apply(this,arguments)}}function eh(e,t){return t=+t,function(){st(this,e).duration=t}}function th(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Qf:eh)(t,e)):Ue(this.node(),t).duration}function nh(e,t){if(typeof t!="function")throw new Error;return function(){st(this,e).ease=t}}function oh(e){var t=this._id;return arguments.length?this.each(nh(t,e)):Ue(this.node(),t).ease}function ih(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;st(this,e).ease=n}}function rh(e){if(typeof e!="function")throw new Error;return this.each(ih(this._id,e))}function sh(e){typeof e!="function"&&(e=fa(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=[],l,u=0;u<s;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new gt(o,this._parents,this._name,this._id)}function ah(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),s=new Array(o),a=0;a<r;++a)for(var l=t[a],u=n[a],c=l.length,d=s[a]=new Array(c),f,h=0;h<c;++h)(f=l[h]||u[h])&&(d[h]=f);for(;a<o;++a)s[a]=t[a];return new gt(s,this._parents,this._name,this._id)}function lh(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function uh(e,t,n){var o,i,r=lh(t)?or:st;return function(){var s=r(this,e),a=s.on;a!==o&&(i=(o=a).copy()).on(t,n),s.on=i}}function ch(e,t){var n=this._id;return arguments.length<2?Ue(this.node(),n).on.on(e):this.each(uh(n,e,t))}function dh(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function fh(){return this.on("end.remove",dh(this._id))}function hh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ji(e));for(var o=this._groups,i=o.length,r=new Array(i),s=0;s<i;++s)for(var a=o[s],l=a.length,u=r[s]=new Array(l),c,d,f=0;f<l;++f)(c=a[f])&&(d=e.call(c,c.__data__,f,a))&&("__data__"in c&&(d.__data__=c.__data__),u[f]=d,Vo(u[f],t,n,f,u,Ue(c,n)));return new gt(r,this._parents,t,n)}function gh(e){var t=this._name,n=this._id;typeof e!="function"&&(e=da(e));for(var o=this._groups,i=o.length,r=[],s=[],a=0;a<i;++a)for(var l=o[a],u=l.length,c,d=0;d<u;++d)if(c=l[d]){for(var f=e.call(c,c.__data__,d,l),h,_=Ue(c,n),b=0,S=f.length;b<S;++b)(h=f[b])&&Vo(h,t,n,b,f,_);r.push(f),s.push(c)}return new gt(r,s,t,n)}var vh=Pn.prototype.constructor;function ph(){return new vh(this._groups,this._parents)}function mh(e,t){var n,o,i;return function(){var r=Kt(this,e),s=(this.style.removeProperty(e),Kt(this,e));return r===s?null:r===n&&s===o?i:i=t(n=r,o=s)}}function Pa(e){return function(){this.style.removeProperty(e)}}function wh(e,t,n){var o,i=n+"",r;return function(){var s=Kt(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}function yh(e,t,n){var o,i,r;return function(){var s=Kt(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),Kt(this,e))),s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a))}}function _h(e,t){var n,o,i,r="style."+t,s="end."+r,a;return function(){var l=st(this,e),u=l.on,c=l.value[r]==null?a||(a=Pa(t)):void 0;(u!==n||i!==c)&&(o=(n=u).copy()).on(s,i=c),l.on=o}}function bh(e,t,n){var o=(e+="")=="transform"?kf:Aa;return t==null?this.styleTween(e,mh(e,o)).on("end.style."+e,Pa(e)):typeof t=="function"?this.styleTween(e,yh(e,o,ir(this,"style."+e,t))).each(_h(this._id,e)):this.styleTween(e,wh(e,o,t),n).on("end.style."+e,null)}function kh(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Eh(e,t,n){var o,i;function r(){var s=t.apply(this,arguments);return s!==i&&(o=(i=s)&&kh(e,s,n)),o}return r._value=t,r}function $h(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Eh(e,t,n??""))}function xh(e){return function(){this.textContent=e}}function Nh(e){return function(){var t=e(this);this.textContent=t??""}}function Sh(e){return this.tween("text",typeof e=="function"?Nh(ir(this,"text",e)):xh(e==null?"":e+""))}function Ch(e){return function(t){this.textContent=e.call(this,t)}}function Mh(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&Ch(i)),t}return o._value=e,o}function Ih(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Mh(e))}function Th(){for(var e=this._name,t=this._id,n=Ra(),o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],a=s.length,l,u=0;u<a;++u)if(l=s[u]){var c=Ue(l,t);Vo(l,e,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new gt(o,this._parents,e,n)}function Oh(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,s){var a={value:s},l={value:function(){--i===0&&r()}};n.each(function(){var u=st(this,o),c=u.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),u.on=t}),i===0&&r()})}var Dh=0;function gt(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ra(){return++Dh}var lt=Pn.prototype;gt.prototype={constructor:gt,select:hh,selectAll:gh,selectChild:lt.selectChild,selectChildren:lt.selectChildren,filter:sh,merge:ah,selection:ph,transition:Th,call:lt.call,nodes:lt.nodes,node:lt.node,size:lt.size,empty:lt.empty,each:lt.each,on:ch,attr:Gf,attrTween:Zf,style:bh,styleTween:$h,text:Sh,textTween:Ih,remove:fh,tween:zf,delay:Jf,duration:th,ease:oh,easeVarying:rh,end:Oh,[Symbol.iterator]:lt[Symbol.iterator]};function Ah(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ph={time:null,delay:0,duration:250,ease:Ah};function Rh(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function zh(e){var t,n;e instanceof gt?(t=e._id,e=e._name):(t=Ra(),(n=Ph).time=nr(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],a=s.length,l,u=0;u<a;++u)(l=s[u])&&Vo(l,e,t,u,s,n||Rh(l,t));return new gt(o,this._parents,e,t)}Pn.prototype.interrupt=Af;Pn.prototype.transition=zh;const jn=e=>()=>e;function Bh(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function dt(e,t,n){this.k=e,this.x=t,this.y=n}dt.prototype={constructor:dt,scale:function(e){return e===1?this:new dt(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new dt(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qt=new dt(1,0,0);dt.prototype;function oi(e){e.stopImmediatePropagation()}function ln(e){e.preventDefault(),e.stopImmediatePropagation()}function Vh(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Lh(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Fr(){return this.__zoom||Qt}function Hh(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Fh(){return navigator.maxTouchPoints||"ontouchstart"in this}function Yh(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}function Gh(){var e=Vh,t=Lh,n=Yh,o=Hh,i=Fh,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=so,u=Ro("start","zoom","end"),c,d,f,h=500,_=150,b=0,S=10;function $(v){v.property("__zoom",Fr).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",X).on("dblclick.zoom",H).filter(i).on("touchstart.zoom",z).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}$.transform=function(v,x,y,O){var T=v.selection?v.selection():v;T.property("__zoom",Fr),v!==T?A(v,x,y,O):T.interrupt().each(function(){V(this,arguments).event(O).start().zoom(null,typeof x=="function"?x.apply(this,arguments):x).end()})},$.scaleBy=function(v,x,y,O){$.scaleTo(v,function(){var T=this.__zoom.k,R=typeof x=="function"?x.apply(this,arguments):x;return T*R},y,O)},$.scaleTo=function(v,x,y,O){$.transform(v,function(){var T=t.apply(this,arguments),R=this.__zoom,D=y==null?E(T):typeof y=="function"?y.apply(this,arguments):y,G=R.invert(D),K=typeof x=="function"?x.apply(this,arguments):x;return n(m(N(R,K),D,G),T,s)},y,O)},$.translateBy=function(v,x,y,O){$.transform(v,function(){return n(this.__zoom.translate(typeof x=="function"?x.apply(this,arguments):x,typeof y=="function"?y.apply(this,arguments):y),t.apply(this,arguments),s)},null,O)},$.translateTo=function(v,x,y,O,T){$.transform(v,function(){var R=t.apply(this,arguments),D=this.__zoom,G=O==null?E(R):typeof O=="function"?O.apply(this,arguments):O;return n(Qt.translate(G[0],G[1]).scale(D.k).translate(typeof x=="function"?-x.apply(this,arguments):-x,typeof y=="function"?-y.apply(this,arguments):-y),R,s)},O,T)};function N(v,x){return x=Math.max(r[0],Math.min(r[1],x)),x===v.k?v:new dt(x,v.x,v.y)}function m(v,x,y){var O=x[0]-y[0]*v.k,T=x[1]-y[1]*v.k;return O===v.x&&T===v.y?v:new dt(v.k,O,T)}function E(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function A(v,x,y,O){v.on("start.zoom",function(){V(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){V(this,arguments).event(O).end()}).tween("zoom",function(){var T=this,R=arguments,D=V(T,R).event(O),G=t.apply(T,R),K=y==null?E(G):typeof y=="function"?y.apply(T,R):y,ie=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),ae=T.__zoom,q=typeof x=="function"?x.apply(T,R):x,J=l(ae.invert(K).concat(ie/ae.k),q.invert(K).concat(ie/q.k));return function(te){if(te===1)te=q;else{var fe=J(te),we=ie/fe[2];te=new dt(we,K[0]-fe[0]*we,K[1]-fe[1]*we)}D.zoom(null,te)}})}function V(v,x,y){return!y&&v.__zooming||new F(v,x)}function F(v,x){this.that=v,this.args=x,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,x),this.taps=0}F.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,x){return this.mouse&&v!=="mouse"&&(this.mouse[1]=x.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=x.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=x.invert(this.touch1[0])),this.that.__zoom=x,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var x=Xe(this.that).datum();u.call(v,this.that,new Bh(v,{sourceEvent:this.sourceEvent,target:$,transform:this.that.__zoom,dispatch:u}),x)}};function B(v,...x){if(!e.apply(this,arguments))return;var y=V(this,x).event(v),O=this.__zoom,T=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,o.apply(this,arguments)))),R=Je(v);if(y.wheel)(y.mouse[0][0]!==R[0]||y.mouse[0][1]!==R[1])&&(y.mouse[1]=O.invert(y.mouse[0]=R)),clearTimeout(y.wheel);else{if(O.k===T)return;y.mouse=[R,O.invert(R)],uo(this),y.start()}ln(v),y.wheel=setTimeout(D,_),y.zoom("mouse",n(m(N(O,T),y.mouse[0],y.mouse[1]),y.extent,s));function D(){y.wheel=null,y.end()}}function X(v,...x){if(f||!e.apply(this,arguments))return;var y=v.currentTarget,O=V(this,x,!0).event(v),T=Xe(v.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",ie,!0),R=Je(v,y),D=v.clientX,G=v.clientY;ka(v.view),oi(v),O.mouse=[R,this.__zoom.invert(R)],uo(this),O.start();function K(ae){if(ln(ae),!O.moved){var q=ae.clientX-D,J=ae.clientY-G;O.moved=q*q+J*J>b}O.event(ae).zoom("mouse",n(m(O.that.__zoom,O.mouse[0]=Je(ae,y),O.mouse[1]),O.extent,s))}function ie(ae){T.on("mousemove.zoom mouseup.zoom",null),Ea(ae.view,O.moved),ln(ae),O.event(ae).end()}}function H(v,...x){if(e.apply(this,arguments)){var y=this.__zoom,O=Je(v.changedTouches?v.changedTouches[0]:v,this),T=y.invert(O),R=y.k*(v.shiftKey?.5:2),D=n(m(N(y,R),O,T),t.apply(this,x),s);ln(v),a>0?Xe(this).transition().duration(a).call(A,D,O,v):Xe(this).call($.transform,D,O,v)}}function z(v,...x){if(e.apply(this,arguments)){var y=v.touches,O=y.length,T=V(this,x,v.changedTouches.length===O).event(v),R,D,G,K;for(oi(v),D=0;D<O;++D)G=y[D],K=Je(G,this),K=[K,this.__zoom.invert(K),G.identifier],T.touch0?!T.touch1&&T.touch0[2]!==K[2]&&(T.touch1=K,T.taps=0):(T.touch0=K,R=!0,T.taps=1+!!c);c&&(c=clearTimeout(c)),R&&(T.taps<2&&(d=K[0],c=setTimeout(function(){c=null},h)),uo(this),T.start())}}function C(v,...x){if(this.__zooming){var y=V(this,x).event(v),O=v.changedTouches,T=O.length,R,D,G,K;for(ln(v),R=0;R<T;++R)D=O[R],G=Je(D,this),y.touch0&&y.touch0[2]===D.identifier?y.touch0[0]=G:y.touch1&&y.touch1[2]===D.identifier&&(y.touch1[0]=G);if(D=y.that.__zoom,y.touch1){var ie=y.touch0[0],ae=y.touch0[1],q=y.touch1[0],J=y.touch1[1],te=(te=q[0]-ie[0])*te+(te=q[1]-ie[1])*te,fe=(fe=J[0]-ae[0])*fe+(fe=J[1]-ae[1])*fe;D=N(D,Math.sqrt(te/fe)),G=[(ie[0]+q[0])/2,(ie[1]+q[1])/2],K=[(ae[0]+J[0])/2,(ae[1]+J[1])/2]}else if(y.touch0)G=y.touch0[0],K=y.touch0[1];else return;y.zoom("touch",n(m(D,G,K),y.extent,s))}}function W(v,...x){if(this.__zooming){var y=V(this,x).event(v),O=v.changedTouches,T=O.length,R,D;for(oi(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),R=0;R<T;++R)D=O[R],y.touch0&&y.touch0[2]===D.identifier?delete y.touch0:y.touch1&&y.touch1[2]===D.identifier&&delete y.touch1;if(y.touch1&&!y.touch0&&(y.touch0=y.touch1,delete y.touch1),y.touch0)y.touch0[1]=this.__zoom.invert(y.touch0[0]);else if(y.end(),y.taps===2&&(D=Je(D,this),Math.hypot(d[0]-D[0],d[1]-D[1])<S)){var G=Xe(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return $.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:jn(+v),$):o},$.filter=function(v){return arguments.length?(e=typeof v=="function"?v:jn(!!v),$):e},$.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:jn(!!v),$):i},$.extent=function(v){return arguments.length?(t=typeof v=="function"?v:jn([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),$):t},$.scaleExtent=function(v){return arguments.length?(r[0]=+v[0],r[1]=+v[1],$):[r[0],r[1]]},$.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],$):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},$.constrain=function(v){return arguments.length?(n=v,$):n},$.duration=function(v){return arguments.length?(a=+v,$):a},$.interpolate=function(v){return arguments.length?(l=v,$):l},$.on=function(){var v=u.on.apply(u,arguments);return v===u?$:v},$.clickDistance=function(v){return arguments.length?(b=(v=+v)*v,$):Math.sqrt(b)},$.tapDistance=function(v){return arguments.length?(S=+v,$):S},$}var Q=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Q||{}),rr=(e=>(e.Partial="partial",e.Full="full",e))(rr||{}),St=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(St||{}),$t=(e=>(e.Strict="strict",e.Loose="loose",e))($t||{}),Ut=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Ut||{}),yn=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(yn||{}),za=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(za||{});const Xh=["INPUT","SELECT","TEXTAREA"],Wh=typeof document<"u"?document:null;function Oi(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,i=typeof(o==null?void 0:o.hasAttribute)=="function"?o.hasAttribute("contenteditable"):!1,r=typeof(o==null?void 0:o.closest)=="function"?o.closest(".nokey"):null;return Xh.includes(o==null?void 0:o.nodeName)||i||!!r}function jh(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Yr(e,t,n,o){const i=t.replace("+",`
`).replace(`
`,`
+`).split(`
`).map(s=>s.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((s,a)=>n.has(s)&&Array.from(n.values())[a]===i[a]);return o&&n.delete(e.toLowerCase()),r}function Uh(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Zh(n.code,e);return Array.isArray(e)?e.some(i=>Yr(n[o],i,t,n.type==="keyup")):Yr(n[o],e,t,n.type==="keyup")}}function Zh(e,t){return t.includes(e)?"code":"key"}function _n(e,t){const n=se(()=>pe(t==null?void 0:t.target)??Wh),o=Et(pe(e)===!0);let i=!1;const r=new Set;let s=l(pe(e));$e(()=>pe(e),(u,c)=>{typeof c=="boolean"&&typeof u!="boolean"&&a(),s=l(u)},{immediate:!0}),ua(["blur","contextmenu"],a),xr((...u)=>s(...u),u=>{var c,d;const f=pe(t==null?void 0:t.actInsideInputWithModifier)??!0,h=pe(t==null?void 0:t.preventDefault)??!1;if(i=jh(u),(!i||i&&!f)&&Oi(u))return;const b=((d=(c=u.composedPath)==null?void 0:c.call(u))==null?void 0:d[0])||u.target,S=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";!h&&(i||!S)&&u.preventDefault(),o.value=!0},{eventName:"keydown",target:n}),xr((...u)=>s(...u),u=>{const c=pe(t==null?void 0:t.actInsideInputWithModifier)??!0;if(o.value){if((!i||i&&!c)&&Oi(u))return;i=!1,o.value=!1}},{eventName:"keyup",target:n});function a(){i=!1,r.clear(),o.value=pe(e)===!0}function l(u){return u===null?(a(),()=>!1):typeof u=="boolean"?(a(),o.value=u,()=>!1):Array.isArray(u)||typeof u=="string"?Uh(u,r):u}return o}const Ba="vue-flow__node-desc",Va="vue-flow__edge-desc",qh="vue-flow__aria-live",La=["Enter"," ","Escape"],Zt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Eo(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function $o(e,t){const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)}function Lo(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Bt(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ha(e,t){return{x:Bt(e.x,t[0][0],t[1][0]),y:Bt(e.y,t[0][1],t[1][1])}}function Gr(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function xt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Dt(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!xt(e)}function gn(e){return Dt(e)&&"computedPosition"in e}function Un(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Kh(e){return Un(e.width)&&Un(e.height)&&Un(e.x)&&Un(e.y)}function Jh(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:io({width:0,height:0}),computedPosition:io({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:Te(e.data)?e.data:{},events:io(Te(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Fa(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??(n==null?void 0:n.updatable),selectable:e.selectable??(n==null?void 0:n.selectable),focusable:e.focusable??(n==null?void 0:n.focusable),data:Te(e.data)?e.data:{},events:io(Te(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(n==null?void 0:n.interactionWidth),...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Ya(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,s=o==="source"?"target":"source";for(const a of n)a[s]===i&&r.add(a[o]);return t.filter(a=>r.has(a.id))}function Qh(...e){if(e.length===3){const[r,s,a]=e;return Ya(r,s,a,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>xt(r)&&r.source===o).map(r=>n.find(s=>Dt(s)&&s.id===r.target))}function eg(...e){if(e.length===3){const[r,s,a]=e;return Ya(r,s,a,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>xt(r)&&r.target===o).map(r=>n.find(s=>Dt(s)&&s.id===r.source))}function Ga({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function tg(e,t){return t.some(n=>xt(n)&&n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle))}function Nn({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function Sn({x:e,y:t},{x:n,y:o,zoom:i},r=!1,s=[1,1]){const a={x:(e-n)/i,y:(t-o)/i};return r?Ho(a,s):a}function Xa(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function xo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Wa({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function ng(e,t){return Wa(Xa(xo(e),xo(t)))}function sr(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<e.length;n++){const o=e[n];t=Xa(t,xo({...o.computedPosition,...o.dimensions}))}return Wa(t)}function ja(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...Sn(t,n),width:t.width/n.zoom,height:t.height/n.zoom},s=[];for(const a of e){const{dimensions:l,selectable:u=!0,hidden:c=!1}=a,d=l.width??a.width??null,f=l.height??a.height??null;if(i&&!u||c)continue;const h=$o(r,Eo(a)),_=d===null||f===null,b=o&&h>0,S=(d??0)*(f??0);(_||b||h>=S||a.dragging)&&s.push(a)}return s}function Ct(e,t){const n=new Set;if(typeof e=="string")n.add(e);else if(e.length>=1)for(const o of e)n.add(o.id);return t.filter(o=>n.has(o.source)||n.has(o.target))}function Xt(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return zn(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function og(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Xt(e,n),i=Xt(e,t);return{top:o,right:i,bottom:o,left:i,x:i*2,y:o*2}}if(typeof e=="object"){const o=Xt(e.top??e.y??0,n),i=Xt(e.bottom??e.y??0,n),r=Xt(e.left??e.x??0,t),s=Xt(e.right??e.x??0,t);return{top:o,right:s,bottom:i,left:r,x:r+s,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function ig(e,t,n,o,i,r){const{x:s,y:a}=Nn(e,{x:t,y:n,zoom:o}),{x:l,y:u}=Nn({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:o}),c=i-l,d=r-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(c),bottom:Math.floor(d)}}function Xr(e,t,n,o,i,r=.1){const s=og(r,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,u=Math.min(a,l),c=Bt(u,o,i),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*c,_=n/2-f*c,b=ig(e,h,_,c,t,n),S={left:Math.min(b.left-s.left,0),top:Math.min(b.top-s.top,0),right:Math.min(b.right-s.right,0),bottom:Math.min(b.bottom-s.bottom,0)};return{x:h-S.left+S.right,y:_-S.top+S.bottom,zoom:c}}function rg(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Ua(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:Ua(n,t):!1}function Cn(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Di(e){const t=e.ctrlKey&&Mn()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t}function Wr(e,t,n){return e<t?Bt(Math.abs(e-t),1,t)/t:e>n?-Bt(Math.abs(e-n),1,t)/t:0}function Za(e,t,n=15,o=40){const i=Wr(e.x,o,t.width-o)*n,r=Wr(e.y,o,t.height-o)*n;return[i,r]}function ii(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const s=Number(i.width.replace("px",""));i.width=`${s+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const s=Number(i.height.replace("px",""));i.height=`${s+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const s=t.style;return{...s(r),...i}}:t.style={...t.style,...i}}}}function No(e,t){var n,o;const i=e.filter(s=>s.type==="add"||s.type==="remove");for(const s of i)if(s.type==="add")t.findIndex(l=>l.id===s.item.id)===-1&&t.push(s.item);else if(s.type==="remove"){const a=t.findIndex(l=>l.id===s.id);a!==-1&&t.splice(a,1)}const r=t.map(s=>s.id);for(const s of t)for(const a of e)if(a.id===s.id)switch(a.type){case"select":s.selected=a.selected;break;case"position":if(gn(s)&&(typeof a.position<"u"&&(s.position=a.position),typeof a.dragging<"u"&&(s.dragging=a.dragging),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&gn(l)&&ii(s,l)}break;case"dimensions":if(gn(s)&&(typeof a.dimensions<"u"&&(s.dimensions=a.dimensions),typeof a.updateStyle<"u"&&a.updateStyle&&(s.style={...s.style||{},width:`${(n=a.dimensions)==null?void 0:n.width}px`,height:`${(o=a.dimensions)==null?void 0:o.height}px`}),typeof a.resizing<"u"&&(s.resizing=a.resizing),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&gn(l)&&(!!l.dimensions.width&&!!l.dimensions.height?ii(s,l):Ge(()=>{ii(s,l)}))}break}return t}function sg(e,t){return No(e,t)}function ag(e,t){return No(e,t)}function wt(e,t){return{id:e,type:"select",selected:t}}function jr(e){return{item:e,type:"add"}}function Ur(e){return{id:e,type:"remove"}}function Zr(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function _t(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const s=t.has(i);!(r.selected===void 0&&!s)&&r.selected!==s&&(n&&(r.selected=s),o.push(wt(r.id,s)))}return o}const qr=()=>{};function oe(e){const t=new Set;let n=qr,o=()=>!1;const i=()=>t.size>0||o(),r=f=>{n=f},s=()=>{n=qr},a=f=>{o=f},l=()=>{o=()=>!1},u=f=>{t.delete(f)};return{on:f=>{t.add(f);const h=()=>u(f);return bn(h),{off:h}},off:u,trigger:f=>{const h=[n];return i()?h.push(...t):e&&h.push(e),Promise.allSettled(h.map(_=>_(f)))},hasListeners:i,listeners:t,setEmitter:r,removeEmitter:s,setHasEmitListeners:a,removeHasEmitListeners:l}}function Kr(e,t,n){let o=e;do{if(o&&o.matches(t))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function lg(e,t,n,o){var i,r;const s=new Map;for(const[a,l]of e)(l.selected||l.id===o)&&(!l.parentNode||!Ua(l,e))&&(l.draggable||t&&typeof l.draggable>"u")&&e.get(a)&&s.set(a,{id:l.id,position:l.position||{x:0,y:0},distance:{x:n.x-((i=l.computedPosition)==null?void 0:i.x)||0,y:n.y-((r=l.computedPosition)==null?void 0:r.y)||0},from:{x:l.computedPosition.x,y:l.computedPosition.y},extent:l.extent,parentNode:l.parentNode,dimensions:{...l.dimensions},expandParent:l.expandParent});return Array.from(s.values())}function ri({id:e,dragItems:t,findNode:n}){const o=[];for(const i of t){const r=n(i.id);r&&o.push(r)}return[e?o.find(i=>i.id===e):o[0],o]}function qa(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function ug(e,t,n){const[o,i,r,s]=typeof e!="string"?qa(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+s,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function cg(e,t,n,o){let i=e.extent||n;if((i==="parent"||!Array.isArray(i)&&(i==null?void 0:i.range)==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const r=ug(i,e,o);r&&(i=r)}else t(new Ae(De.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,s=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+s],[i[1][0]+r,i[1][1]+s]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,s,a,l]=qa(i.padding),u=(o==null?void 0:o.computedPosition.x)||0,c=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+u+l,i.range[0][1]+c+r],[i.range[1][0]+u-s,i.range[1][1]+c-a]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function dg({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function ar(e,t,n,o,i){const r=dg(e.dimensions,cg(e,n,o,i)),s=Ha(t,r);return{position:{x:s.x-((i==null?void 0:i.computedPosition.x)||0),y:s.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:s}}function en(e,t,n=Q.Left,o=!1){const i=((t==null?void 0:t.x)??0)+e.computedPosition.x,r=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:s,height:a}=t??vg(e);if(o)return{x:i+s/2,y:r+a/2};switch((t==null?void 0:t.position)??n){case Q.Top:return{x:i+s/2,y:r};case Q.Right:return{x:i+s,y:r+a/2};case Q.Bottom:return{x:i+s/2,y:r+a};case Q.Left:return{x:i,y:r+a/2}}}function Jr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function fg({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:s,height:a,viewport:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=xo({x:(0-l.x)/l.zoom,y:(0-l.y)/l.zoom,width:s/l.zoom,height:a/l.zoom}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function hg(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),s=t(e.target);return!r||!s?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,s.computedPosition.z||0)),i)}var De=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(De||{});const Qr={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
Node: ${e}
Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent
Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target
Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing
Edge: ${e}
Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing
Edge: ${e}
Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing
Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same
Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing
Edge: ${e}
Source: ${t}
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Ae extends Error{constructor(t,...n){var o;super((o=Qr[t])==null?void 0:o.call(Qr,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function lr(e){return"clientX"in e}function gg(e){return"sourceEvent"in e}function et(e,t){const n=lr(e);let o,i;return n?(o=e.clientX,i=e.clientY):"touches"in e&&e.touches.length>0?(o=e.touches[0].clientX,i=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(o=e.changedTouches[0].clientX,i=e.changedTouches[0].clientY):(o=0,i=0),{x:o-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}}const Mn=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function vg(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function Ho(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const pg=()=>!0;function si(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function mg(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())$o(i,Eo(r))>0&&o.push(r);return o}const wg=250;function yg(e,t,n,o){var i,r;let s=[],a=Number.POSITIVE_INFINITY;const l=mg(e,n,t+wg);for(const u of l){const c=[...((i=u.handleBounds)==null?void 0:i.source)??[],...((r=u.handleBounds)==null?void 0:r.target)??[]];for(const d of c){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:f,y:h}=en(u,d,d.position,!0),_=Math.sqrt((f-e.x)**2+(h-e.y)**2);_>t||(_<a?(s=[{...d,x:f,y:h}],a=_):_===a&&s.push({...d,x:f,y:h}))}}if(!s.length)return null;if(s.length>1){const u=o.type==="source"?"target":"source";return s.find(c=>c.type===u)??s[0]}return s[0]}function es(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:s,lib:a,flowId:l,isValidConnection:u=pg},c,d,f,h){const _=r==="target",b=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:S,y:$}=et(e),N=s.elementFromPoint(S,$),m=N!=null&&N.classList.contains(`${a}-flow__handle`)?N:b,E={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const A=Ka(void 0,m),V=m.getAttribute("data-nodeid"),F=m.getAttribute("data-handleid"),B=m.classList.contains("connectable"),X=m.classList.contains("connectableend");if(!V||!A)return E;const H={source:_?V:o,sourceHandle:_?F:i,target:_?o:V,targetHandle:_?i:F};E.connection=H;const C=B&&X&&(n===$t.Strict?_&&A==="source"||!_&&A==="target":V!==o||F!==i);E.isValid=C&&u(H,{nodes:d,edges:c,sourceNode:f(H.source),targetNode:f(H.target)}),E.toHandle=Ja(V,A,F,h,n,!0)}return E}function Ka(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function _g(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function bg(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function Ja(e,t,n,o,i,r=!1){var s,a,l;const u=o.get(e);if(!u)return null;const c=i===$t.Strict?(s=u.handleBounds)==null?void 0:s[t]:[...((a=u.handleBounds)==null?void 0:a.source)??[],...((l=u.handleBounds)==null?void 0:l.target)??[]],d=(n?c==null?void 0:c.find(f=>f.id===n):c==null?void 0:c[0])??null;return d&&r?{...d,...en(u,d,d.position,!0)}:d}const Ai={[Q.Left]:Q.Right,[Q.Right]:Q.Left,[Q.Top]:Q.Bottom,[Q.Bottom]:Q.Top},kg=["production","prod"];function zn(e,...t){Qa()&&console.warn(`[Vue Flow]: ${e}`,...t)}function Qa(){return!kg.includes("production")}function ts(e,t,n,o,i){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return r!=null&&r.length?Array.from(r).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:i,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Lo(s)}}):null}function Pi(e,t,n,o,i,r=!1,s){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),Ge(()=>{s.blur()})):n([e])}function Te(e){return typeof P(e)<"u"}function Eg(e,t,n,o){if(!e||!e.source||!e.target)return n(new Ae(De.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return xt(e)?i=e:i={...e,id:Ga(e)},i=Fa(i,void 0,o),tg(i,t)?!1:i}function $g(e,t,n,o,i){if(!t.source||!t.target)return i(new Ae(De.EDGE_INVALID,e.id)),!1;if(!n)return i(new Ae(De.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...s}=e;return{...s,id:o?Ga(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function ns(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const s=e[r];if(!Dt(s)){n(new Ae(De.NODE_INVALID,s==null?void 0:s.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const a=Jh(s,t(s.id),s.parentNode);s.parentNode&&(o[s.parentNode]=!0),i[r]=a}for(const r of i){const s=t(r.parentNode)||i.find(a=>a.id===r.parentNode);r.parentNode&&!s&&n(new Ae(De.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),s&&(s.isParent=!0))}return i}function os(e,t,n,o,i,r){let s=i;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${i}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),r){s=`${i}-${e}-${r}`;const u=o.get(s)||new Map;o.set(s,u.set(n,t))}}function ai(e,t,n){e.clear();for(const o of n){const{source:i,target:r,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:i,target:r,sourceHandle:s,targetHandle:a},u=`${i}-${s}--${r}-${a}`,c=`${r}-${a}--${i}-${s}`;os("source",l,c,e,i,s),os("target",l,u,e,r,a)}}function is(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function li(e,t,n,o,i,r,s,a){const l=[];for(const u of e){const c=xt(u)?u:Eg(u,a,i,r);if(!c)continue;const d=n(c.source),f=n(c.target);if(!d||!f){i(new Ae(De.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!d){i(new Ae(De.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!f){i(new Ae(De.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:a,nodes:s,sourceNode:d,targetNode:f})){i(new Ae(De.EDGE_INVALID,c.id));continue}const h=o(c.id);l.push({...Fa(c,h,r),sourceNode:d,targetNode:f})}return l}const rs=Symbol("vueFlow"),el=Symbol("nodeId"),tl=Symbol("nodeRef"),xg=Symbol("edgeId"),Ng=Symbol("edgeRef"),Fo=Symbol("slots");function nl(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodeLookup:r,nodeExtent:s,nodeDragThreshold:a,viewport:l,autoPanOnNodeDrag:u,autoPanSpeed:c,nodesDraggable:d,panBy:f,findNode:h,multiSelectionActive:_,nodesSelectionActive:b,selectNodesOnDrag:S,removeSelectedElements:$,addSelectedNodes:N,updateNodePositions:m,emits:E}=Se(),{onStart:A,onDrag:V,onStop:F,onClick:B,el:X,disabled:H,id:z,selectable:C,dragHandle:W}=e,v=Et(!1);let x=[],y,O=null,T={x:void 0,y:void 0},R={x:0,y:0},D=null,G=!1,K=!1,ie=0,ae=!1;const q=Mg(),J=({x:ce,y:ne})=>{T={x:ce,y:ne};let g=!1;if(x=x.map(p=>{const w={x:ce-p.distance.x,y:ne-p.distance.y},{computedPosition:I}=ar(p,n.value?Ho(w,o.value):w,E.error,s.value,p.parentNode?h(p.parentNode):void 0);return g=g||p.position.x!==I.x||p.position.y!==I.y,p.position=I,p}),K=K||g,!!g&&(m(x,!0,!0),v.value=!0,D)){const[p,w]=ri({id:z,dragItems:x,findNode:h});V({event:D,node:p,nodes:w})}},te=()=>{if(!O)return;const[ce,ne]=Za(R,O,c.value);if(ce!==0||ne!==0){const g={x:(T.x??0)-ce/l.value.zoom,y:(T.y??0)-ne/l.value.zoom};f({x:ce,y:ne})&&J(g)}ie=requestAnimationFrame(te)},fe=(ce,ne)=>{G=!0;const g=h(z);!S.value&&!_.value&&g&&(g.selected||$()),g&&pe(C)&&S.value&&Pi(g,_.value,N,$,b,!1,ne);const p=q(ce.sourceEvent);if(T=p,x=lg(r.value,d.value,p,z),x.length){const[w,I]=ri({id:z,dragItems:x,findNode:h});A({event:ce.sourceEvent,node:w,nodes:I})}},we=(ce,ne)=>{var g;ce.sourceEvent.type==="touchmove"&&ce.sourceEvent.touches.length>1||(K=!1,a.value===0&&fe(ce,ne),T=q(ce.sourceEvent),O=((g=t.value)==null?void 0:g.getBoundingClientRect())||null,R=et(ce.sourceEvent,O))},de=(ce,ne)=>{const g=q(ce.sourceEvent);if(!ae&&G&&u.value&&(ae=!0,te()),!G){const p=g.xSnapped-(T.x??0),w=g.ySnapped-(T.y??0);Math.sqrt(p*p+w*w)>a.value&&fe(ce,ne)}(T.x!==g.xSnapped||T.y!==g.ySnapped)&&x.length&&G&&(D=ce.sourceEvent,R=et(ce.sourceEvent,O),J(g))},_e=ce=>{let ne=!1;if(!G&&!v.value&&!_.value){const g=ce.sourceEvent,p=q(g),w=p.xSnapped-(T.x??0),I=p.ySnapped-(T.y??0),M=Math.sqrt(w*w+I*I);M!==0&&M<=a.value&&(B==null||B(g),ne=!0)}if(x.length&&!ne){K&&(m(x,!1,!1),K=!1);const[g,p]=ri({id:z,dragItems:x,findNode:h});F({event:ce.sourceEvent,node:g,nodes:p})}x=[],v.value=!1,ae=!1,G=!1,T={x:void 0,y:void 0},cancelAnimationFrame(ie)};return $e([()=>pe(H),X],([ce,ne],g,p)=>{if(ne){const w=Xe(ne);ce||(y=qd().on("start",I=>we(I,ne)).on("drag",I=>de(I,ne)).on("end",I=>_e(I)).filter(I=>{const M=I.target,U=pe(W);return!I.button&&(!i.value||!Kr(M,`.${i.value}`,ne)&&(!U||Kr(M,U,ne)))}),w.call(y)),p(()=>{w.on(".drag",null),y&&(y.on("start",null),y.on("drag",null),y.on("end",null))})}}),v}function Sg(){return{doubleClick:oe(),click:oe(),mouseEnter:oe(),mouseMove:oe(),mouseLeave:oe(),contextMenu:oe(),updateStart:oe(),update:oe(),updateEnd:oe()}}function Cg(e,t){const n=Sg();return n.doubleClick.on(o=>{var i,r;t.edgeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.edgeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.edgeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.edgeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.edgeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.edgeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.updateStart.on(o=>{var i,r;t.edgeUpdateStart(o),(r=(i=e.events)==null?void 0:i.updateStart)==null||r.call(i,o)}),n.update.on(o=>{var i,r;t.edgeUpdate(o),(r=(i=e.events)==null?void 0:i.update)==null||r.call(i,o)}),n.updateEnd.on(o=>{var i,r;t.edgeUpdateEnd(o),(r=(i=e.events)==null?void 0:i.updateEnd)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function Mg(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=Se();return i=>{var r;const s=((r=o.value)==null?void 0:r.getBoundingClientRect())??{left:0,top:0},a=gg(i)?i.sourceEvent:i,{x:l,y:u}=et(a,s),c=Sn({x:l,y:u},e.value),{x:d,y:f}=n.value?Ho(c,t.value):c;return{xSnapped:d,ySnapped:f,...c}}}function Zn(){return!0}function ol({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:s}){const{id:a,vueFlowRef:l,connectionMode:u,connectionRadius:c,connectOnClick:d,connectionClickStartHandle:f,nodesConnectable:h,autoPanOnConnect:_,autoPanSpeed:b,findNode:S,panBy:$,startConnection:N,updateConnection:m,endConnection:E,emits:A,viewport:V,edges:F,nodes:B,isValidConnection:X,nodeLookup:H}=Se();let z=null,C=!1,W=null;function v(y){var O;const T=pe(n)==="target",R=lr(y),D=Gr(y.target),G=y.currentTarget;if(G&&(R&&y.button===0||!R)){let K=function(le){g=et(le,_e),J=yg(Sn(g,V.value,!1,[1,1]),c.value,H.value,I),p||(w(),p=!0);const he=es(le,{handle:J,connectionMode:u.value,fromNodeId:pe(t),fromHandleId:pe(e),fromType:T?"target":"source",isValidConnection:q,doc:D,lib:"vue",flowId:a,nodeLookup:H.value},F.value,B.value,S,H.value);W=he.handleDomNode,z=he.connection,C=bg(!!J,he.isValid);const ve={...re,isValid:C,to:he.toHandle&&C?Nn({x:he.toHandle.x,y:he.toHandle.y},V.value):g,toHandle:he.toHandle,toPosition:C&&he.toHandle?he.toHandle.position:Ai[I.position],toNode:he.toHandle?H.value.get(he.toHandle.nodeId):null};if(C&&J&&(re!=null&&re.toHandle)&&ve.toHandle&&re.toHandle.type===ve.toHandle.type&&re.toHandle.nodeId===ve.toHandle.nodeId&&re.toHandle.id===ve.toHandle.id&&re.to.x===ve.to.x&&re.to.y===ve.to.y)return;const Ee=J??he.toHandle;if(m(Ee&&C?Nn({x:Ee.x,y:Ee.y},V.value):g,Ee,_g(!!Ee,C)),re=ve,!J&&!C&&!W)return si(ne);z&&z.source!==z.target&&W&&(si(ne),ne=W,W.classList.add("connecting","vue-flow__handle-connecting"),W.classList.toggle("valid",!!C),W.classList.toggle("vue-flow__handle-valid",!!C))},ie=function(le){"touches"in le&&le.touches.length>0||((J||W)&&z&&C&&(r?r(le,z):A.connect(z)),A.connectEnd(le),i&&(s==null||s(le)),si(ne),cancelAnimationFrame(te),E(le),p=!1,C=!1,z=null,W=null,D.removeEventListener("mousemove",K),D.removeEventListener("mouseup",ie),D.removeEventListener("touchmove",K),D.removeEventListener("touchend",ie))};const ae=S(pe(t));let q=pe(o)||X.value||Zn;!q&&ae&&(q=(T?ae.isValidSourcePos:ae.isValidTargetPos)||Zn);let J,te=0;const{x:fe,y:we}=et(y),de=Ka(pe(i),G),_e=(O=l.value)==null?void 0:O.getBoundingClientRect();if(!_e||!de)return;const ce=Ja(pe(t),de,pe(e),H.value,u.value);if(!ce)return;let ne,g=et(y,_e),p=!1;const w=()=>{if(!_.value)return;const[le,he]=Za(g,_e,b.value);$({x:le,y:he}),te=requestAnimationFrame(w)},I={...ce,nodeId:pe(t),type:de,position:ce.position},M=H.value.get(pe(t)),Z={inProgress:!0,isValid:null,from:en(M,I,Q.Left,!0),fromHandle:I,fromPosition:I.position,fromNode:M,to:g,toHandle:null,toPosition:Ai[I.position],toNode:null};N({nodeId:pe(t),id:pe(e),type:de,position:(G==null?void 0:G.getAttribute("data-handlepos"))||Q.Top,...g},{x:fe-_e.left,y:we-_e.top}),A.connectStart({event:y,nodeId:pe(t),handleId:pe(e),handleType:de});let re=Z;D.addEventListener("mousemove",K),D.addEventListener("mouseup",ie),D.addEventListener("touchmove",K),D.addEventListener("touchend",ie)}}function x(y){var O,T;if(!d.value)return;const R=pe(n)==="target";if(!f.value){A.clickConnectStart({event:y,nodeId:pe(t),handleId:pe(e)}),N({nodeId:pe(t),type:pe(n),id:pe(e),position:Q.Top,...et(y)},void 0,!0);return}let D=pe(o)||X.value||Zn;const G=S(pe(t));if(!D&&G&&(D=(R?G.isValidSourcePos:G.isValidTargetPos)||Zn),G&&(typeof G.connectable>"u"?h.value:G.connectable)===!1)return;const K=Gr(y.target),ie=es(y,{handle:{nodeId:pe(t),id:pe(e),type:pe(n),position:Q.Top,...et(y)},connectionMode:u.value,fromNodeId:f.value.nodeId,fromHandleId:f.value.id??null,fromType:f.value.type,isValidConnection:D,doc:K,lib:"vue",flowId:a,nodeLookup:H.value},F.value,B.value,S,H.value),ae=((O=ie.connection)==null?void 0:O.source)===((T=ie.connection)==null?void 0:T.target);ie.isValid&&ie.connection&&!ae&&A.connect(ie.connection),A.clickConnectEnd(y),E(y,!0)}return{handlePointerDown:v,handleClick:x}}function Ig(){return Ht(el,"")}function il(e){const t=e??Ig()??"",n=Ht(tl,me(null)),{findNode:o,edges:i,emits:r}=Se(),s=o(t);return s||r.error(new Ae(De.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:se(()=>o(s.parentNode)),connectedEdges:se(()=>Ct([s],i.value))}}function Tg(){return{doubleClick:oe(),click:oe(),mouseEnter:oe(),mouseMove:oe(),mouseLeave:oe(),contextMenu:oe(),dragStart:oe(),drag:oe(),dragStop:oe()}}function Og(e,t){const n=Tg();return n.doubleClick.on(o=>{var i,r;t.nodeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.nodeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.nodeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.nodeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.nodeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.nodeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.dragStart.on(o=>{var i,r;t.nodeDragStart(o),(r=(i=e.events)==null?void 0:i.dragStart)==null||r.call(i,o)}),n.drag.on(o=>{var i,r;t.nodeDrag(o),(r=(i=e.events)==null?void 0:i.drag)==null||r.call(i,o)}),n.dragStop.on(o=>{var i,r;t.nodeDragStop(o),(r=(i=e.events)==null?void 0:i.dragStop)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function rl(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:s,emits:a}=Se();return(l,u=!1)=>{const c=r.value?i.value[0]:5,d=r.value?i.value[1]:5,f=u?4:1,h=l.x*c*f,_=l.y*d*f,b=[];for(const S of e.value)if(S.draggable||s&&typeof S.draggable>"u"){const $={x:S.computedPosition.x+h,y:S.computedPosition.y+_},{position:N}=ar(S,$,a.error,t.value,S.parentNode?o(S.parentNode):void 0);b.push({id:S.id,position:N,from:S.position,distance:{x:l.x,y:l.y},dimensions:S.dimensions})}n(b,!0,!1)}}const qn=.1,Dg=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function mt(){return zn("Viewport not initialized yet."),Promise.resolve(!1)}const Ag={zoomIn:mt,zoomOut:mt,zoomTo:mt,fitView:mt,setCenter:mt,fitBounds:mt,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:mt,setTransform:mt,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Pg(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((i==null?void 0:i.interpolate)==="linear"?wn:so).scaleBy(ui(e.d3Selection,i==null?void 0:i.duration,i==null?void 0:i.ease,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,s){return new Promise(a=>{var l;const{x:u,y:c}=Ha({x:-o,y:-i},e.translateExtent),d=Qt.translate(-u,-c).scale(r);e.d3Selection&&e.d3Zoom?(l=e.d3Zoom)==null||l.interpolate((s==null?void 0:s.interpolate)==="linear"?wn:so).transform(ui(e.d3Selection,s==null?void 0:s.duration,s==null?void 0:s.ease,()=>{a(!0)}),d):a(!1)})}return se(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i),zoomOut:i=>t(1/1.2,i),zoomTo:(i,r)=>new Promise(s=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate((r==null?void 0:r.interpolate)==="linear"?wn:so).scaleTo(ui(e.d3Selection,r==null?void 0:r.duration,r==null?void 0:r.ease,()=>{s(!0)}),i):s(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:qn,includeHiddenNodes:!1,duration:0})=>{var r,s;const a=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!f.hidden)&&(!((r=i.nodes)!=null&&r.length)||(s=i.nodes)!=null&&s.length&&i.nodes.includes(f.id))&&a.push(f);if(!a.length)return Promise.resolve(!1);const l=sr(a),{x:u,y:c,zoom:d}=Xr(l,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??qn);return n(u,c,d,i)},setCenter:(i,r,s)=>{const a=typeof(s==null?void 0:s.zoom)<"u"?s.zoom:e.maxZoom,l=e.dimensions.width/2-i*a,u=e.dimensions.height/2-r*a;return n(l,u,a,s)},fitBounds:(i,r={padding:qn})=>{const{x:s,y:a,zoom:l}=Xr(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding??qn);return n(s,a,l,r)},project:i=>Sn(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:s}=e.vueFlowRef.getBoundingClientRect(),a={x:i.x-r,y:i.y-s};return Sn(a,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:s}=e.vueFlowRef.getBoundingClientRect(),a={x:i.x+r,y:i.y+s};return Nn(a,e.viewport)}return{x:0,y:0}}}:Ag)}function ui(e,t=0,n=Dg,o=()=>{}){const i=typeof t=="number"&&t>0;return i||o(),i?e.transition().duration(t).ease(n).on("end",o):e}function Rg(e,t,n){const o=oa(!0);return o.run(()=>{const i=()=>{o.run(()=>{let b,S,$=!!(n.nodes.value.length||n.edges.value.length);b=Gt([e.modelValue,()=>{var N,m;return(m=(N=e.modelValue)==null?void 0:N.value)==null?void 0:m.length}],([N])=>{N&&Array.isArray(N)&&(S==null||S.pause(),n.setElements(N),!S&&!$&&N.length?$=!0:S==null||S.resume())}),S=Gt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([N,m])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...N,...m],Ge(()=>{b==null||b.resume()}))},{immediate:$}),oo(()=>{b==null||b.stop(),S==null||S.stop()})})},r=()=>{o.run(()=>{let b,S,$=!!n.nodes.value.length;b=Gt([e.nodes,()=>{var N,m;return(m=(N=e.nodes)==null?void 0:N.value)==null?void 0:m.length}],([N])=>{N&&Array.isArray(N)&&(S==null||S.pause(),n.setNodes(N),!S&&!$&&N.length?$=!0:S==null||S.resume())}),S=Gt([n.nodes,()=>n.nodes.value.length],([N])=>{var m;(m=e.nodes)!=null&&m.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...N],Ge(()=>{b==null||b.resume()}))},{immediate:$}),oo(()=>{b==null||b.stop(),S==null||S.stop()})})},s=()=>{o.run(()=>{let b,S,$=!!n.edges.value.length;b=Gt([e.edges,()=>{var N,m;return(m=(N=e.edges)==null?void 0:N.value)==null?void 0:m.length}],([N])=>{N&&Array.isArray(N)&&(S==null||S.pause(),n.setEdges(N),!S&&!$&&N.length?$=!0:S==null||S.resume())}),S=Gt([n.edges,()=>n.edges.value.length],([N])=>{var m;(m=e.edges)!=null&&m.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...N],Ge(()=>{b==null||b.resume()}))},{immediate:$}),oo(()=>{b==null||b.stop(),S==null||S.stop()})})},a=()=>{o.run(()=>{$e(()=>t.maxZoom,()=>{t.maxZoom&&Te(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},l=()=>{o.run(()=>{$e(()=>t.minZoom,()=>{t.minZoom&&Te(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},u=()=>{o.run(()=>{$e(()=>t.translateExtent,()=>{t.translateExtent&&Te(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{$e(()=>t.nodeExtent,()=>{t.nodeExtent&&Te(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},d=()=>{o.run(()=>{$e(()=>t.applyDefault,()=>{Te(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},f=()=>{o.run(()=>{const b=async S=>{let $=S;typeof t.autoConnect=="function"&&($=await t.autoConnect(S)),$!==!1&&n.addEdges([$])};$e(()=>t.autoConnect,()=>{Te(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),$e(n.autoConnect,(S,$,N)=>{S?n.onConnect(b):n.hooks.value.connect.off(b),N(()=>{n.hooks.value.connect.off(b)})},{immediate:!0})})},h=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const S of Object.keys(t)){const $=S;if(!b.includes($)){const N=ke(()=>t[$]),m=n[$];qi(m)&&o.run(()=>{$e(N,E=>{Te(E)&&(m.value=E)},{immediate:!0})})}}};(()=>{i(),r(),s(),l(),a(),u(),c(),d(),f(),h()})()}),()=>o.stop()}function zg(){return{edgesChange:oe(),nodesChange:oe(),nodeDoubleClick:oe(),nodeClick:oe(),nodeMouseEnter:oe(),nodeMouseMove:oe(),nodeMouseLeave:oe(),nodeContextMenu:oe(),nodeDragStart:oe(),nodeDrag:oe(),nodeDragStop:oe(),nodesInitialized:oe(),miniMapNodeClick:oe(),miniMapNodeDoubleClick:oe(),miniMapNodeMouseEnter:oe(),miniMapNodeMouseMove:oe(),miniMapNodeMouseLeave:oe(),connect:oe(),connectStart:oe(),connectEnd:oe(),clickConnectStart:oe(),clickConnectEnd:oe(),paneReady:oe(),init:oe(),move:oe(),moveStart:oe(),moveEnd:oe(),selectionDragStart:oe(),selectionDrag:oe(),selectionDragStop:oe(),selectionContextMenu:oe(),selectionStart:oe(),selectionEnd:oe(),viewportChangeStart:oe(),viewportChange:oe(),viewportChangeEnd:oe(),paneScroll:oe(),paneClick:oe(),paneContextMenu:oe(),paneMouseEnter:oe(),paneMouseMove:oe(),paneMouseLeave:oe(),edgeContextMenu:oe(),edgeMouseEnter:oe(),edgeMouseMove:oe(),edgeMouseLeave:oe(),edgeDoubleClick:oe(),edgeClick:oe(),edgeUpdateStart:oe(),edgeUpdate:oe(),edgeUpdateEnd:oe(),updateNodeInternals:oe(),error:oe(e=>zn(e.message))}}function Bg(e,t){const n=rn();wu(()=>{for(const[i,r]of Object.entries(t.value)){const s=a=>{e(i,a)};r.setEmitter(s),bn(r.removeEmitter),r.setHasEmitListeners(()=>o(i)),bn(r.removeHasEmitListeners)}});function o(i){var r;const s=Vg(i);return!!((r=n==null?void 0:n.vnode.props)==null?void 0:r[s])}}function Vg(e){const[t,...n]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(i,r)=>r.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}function sl(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:rr.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:yn.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:St.Bezier,style:{}},connectionMode:$t.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Mn()?"Meta":"Control",zoomActivationKeyCode:Mn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:zg(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const Lg=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function Hg(e,t,n){const o=Pg(e),i=g=>{const p=g??[];e.hooks.updateNodeInternals.trigger(p)},r=g=>eg(g,e.nodes,e.edges),s=g=>Qh(g,e.nodes,e.edges),a=g=>Ct(g,e.edges),l=({id:g,type:p,nodeId:w})=>{var I;const M=g?`-${p}-${g}`:`-${p}`;return Array.from(((I=e.connectionLookup.get(`${w}${M}`))==null?void 0:I.values())??[])},u=g=>{if(g)return t.value.get(g)},c=g=>{if(g)return n.value.get(g)},d=(g,p,w)=>{var I,M;const U=[];for(const Z of g){const re={id:Z.id,type:"position",dragging:w,from:Z.from};if(p&&(re.position=Z.position,Z.parentNode)){const le=u(Z.parentNode);re.position={x:re.position.x-(((I=le==null?void 0:le.computedPosition)==null?void 0:I.x)??0),y:re.position.y-(((M=le==null?void 0:le.computedPosition)==null?void 0:M.y)??0)}}U.push(re)}U!=null&&U.length&&e.hooks.nodesChange.trigger(U)},f=g=>{if(!e.vueFlowRef)return;const p=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!p)return;const w=window.getComputedStyle(p),{m22:I}=new window.DOMMatrixReadOnly(w.transform),M=[];for(const U of g){const Z=U,re=u(Z.id);if(re){const le=Lo(Z.nodeElement);if(!!(le.width&&le.height&&(re.dimensions.width!==le.width||re.dimensions.height!==le.height||Z.forceUpdate))){const ve=Z.nodeElement.getBoundingClientRect();re.dimensions=le,re.handleBounds.source=ts("source",Z.nodeElement,ve,I,re.id),re.handleBounds.target=ts("target",Z.nodeElement,ve,I,re.id),M.push({id:re.id,type:"dimensions",dimensions:le})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),M.length&&e.hooks.nodesChange.trigger(M)},h=(g,p)=>{const w=new Set,I=new Set;for(const Z of g)Dt(Z)?w.add(Z.id):xt(Z)&&I.add(Z.id);const M=_t(t.value,w,!0),U=_t(n.value,I);if(e.multiSelectionActive){for(const Z of w)M.push(wt(Z,p));for(const Z of I)U.push(wt(Z,p))}M.length&&e.hooks.nodesChange.trigger(M),U.length&&e.hooks.edgesChange.trigger(U)},_=g=>{if(e.multiSelectionActive){const p=g.map(w=>wt(w.id,!0));e.hooks.nodesChange.trigger(p);return}e.hooks.nodesChange.trigger(_t(t.value,new Set(g.map(p=>p.id)),!0)),e.hooks.edgesChange.trigger(_t(n.value))},b=g=>{if(e.multiSelectionActive){const p=g.map(w=>wt(w.id,!0));e.hooks.edgesChange.trigger(p);return}e.hooks.edgesChange.trigger(_t(n.value,new Set(g.map(p=>p.id)))),e.hooks.nodesChange.trigger(_t(t.value,new Set,!0))},S=g=>{h(g,!0)},$=g=>{const w=(g||e.nodes).map(I=>(I.selected=!1,wt(I.id,!1)));e.hooks.nodesChange.trigger(w)},N=g=>{const w=(g||e.edges).map(I=>(I.selected=!1,wt(I.id,!1)));e.hooks.edgesChange.trigger(w)},m=g=>{if(!g||!g.length)return h([],!1);const p=g.reduce((w,I)=>{const M=wt(I.id,!1);return Dt(I)?w.nodes.push(M):w.edges.push(M),w},{nodes:[],edges:[]});p.nodes.length&&e.hooks.nodesChange.trigger(p.nodes),p.edges.length&&e.hooks.edgesChange.trigger(p.edges)},E=g=>{var p;(p=e.d3Zoom)==null||p.scaleExtent([g,e.maxZoom]),e.minZoom=g},A=g=>{var p;(p=e.d3Zoom)==null||p.scaleExtent([e.minZoom,g]),e.maxZoom=g},V=g=>{var p;(p=e.d3Zoom)==null||p.translateExtent(g),e.translateExtent=g},F=g=>{e.nodeExtent=g,i()},B=g=>{var p;(p=e.d3Zoom)==null||p.clickDistance(g)},X=g=>{e.nodesDraggable=g,e.nodesConnectable=g,e.elementsSelectable=g},H=g=>{const p=g instanceof Function?g(e.nodes):g;!e.initialized&&!p.length||(e.nodes=ns(p,u,e.hooks.error.trigger))},z=g=>{const p=g instanceof Function?g(e.edges):g;if(!e.initialized&&!p.length)return;const w=li(p,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ai(e.connectionLookup,n.value,w),e.edges=w},C=g=>{const p=g instanceof Function?g([...e.nodes,...e.edges]):g;!e.initialized&&!p.length||(H(p.filter(Dt)),z(p.filter(xt)))},W=g=>{let p=g instanceof Function?g(e.nodes):g;p=Array.isArray(p)?p:[p];const w=ns(p,u,e.hooks.error.trigger),I=[];for(const M of w)I.push(jr(M));I.length&&e.hooks.nodesChange.trigger(I)},v=g=>{let p=g instanceof Function?g(e.edges):g;p=Array.isArray(p)?p:[p];const w=li(p,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),I=[];for(const M of w)I.push(jr(M));I.length&&e.hooks.edgesChange.trigger(I)},x=(g,p=!0,w=!1)=>{const I=g instanceof Function?g(e.nodes):g,M=Array.isArray(I)?I:[I],U=[],Z=[];function re(he){const ve=a(he);for(const Ee of ve)(!Te(Ee.deletable)||Ee.deletable)&&Z.push(Zr(Ee.id,Ee.source,Ee.target,Ee.sourceHandle,Ee.targetHandle))}function le(he){const ve=[];for(const Ee of e.nodes)Ee.parentNode===he&&ve.push(Ee);if(ve.length){for(const Ee of ve)U.push(Ur(Ee.id));p&&re(ve);for(const Ee of ve)le(Ee.id)}}for(const he of M){const ve=typeof he=="string"?u(he):he;ve&&(Te(ve.deletable)&&!ve.deletable||(U.push(Ur(ve.id)),p&&re([ve]),w&&le(ve.id)))}Z.length&&e.hooks.edgesChange.trigger(Z),U.length&&e.hooks.nodesChange.trigger(U)},y=g=>{const p=g instanceof Function?g(e.edges):g,w=Array.isArray(p)?p:[p],I=[];for(const M of w){const U=typeof M=="string"?c(M):M;U&&(Te(U.deletable)&&!U.deletable||I.push(Zr(typeof M=="string"?M:M.id,U.source,U.target,U.sourceHandle,U.targetHandle)))}e.hooks.edgesChange.trigger(I)},O=(g,p,w=!0)=>{const I=c(g.id);if(!I)return!1;const M=e.edges.indexOf(I),U=$g(g,p,I,w,e.hooks.error.trigger);if(U){const[Z]=li([U],e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((re,le)=>le===M?Z:re),ai(e.connectionLookup,n.value,[Z]),Z}return!1},T=(g,p,w={replace:!1})=>{const I=c(g);if(!I)return;const M=typeof p=="function"?p(I):p;I.data=w.replace?M:{...I.data,...M}},R=g=>No(g,e.nodes),D=g=>{const p=No(g,e.edges);return ai(e.connectionLookup,n.value,p),p},G=(g,p,w={replace:!1})=>{const I=u(g);if(!I)return;const M=typeof p=="function"?p(I):p;w.replace?e.nodes.splice(e.nodes.indexOf(I),1,M):Object.assign(I,M)},K=(g,p,w={replace:!1})=>{const I=u(g);if(!I)return;const M=typeof p=="function"?p(I):p;I.data=w.replace?M:{...I.data,...M}},ie=(g,p,w=!1)=>{w?e.connectionClickStartHandle=g:e.connectionStartHandle=g,e.connectionEndHandle=null,e.connectionStatus=null,p&&(e.connectionPosition=p)},ae=(g,p=null,w=null)=>{e.connectionStartHandle&&(e.connectionPosition=g,e.connectionEndHandle=p,e.connectionStatus=w)},q=(g,p)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,p?e.connectionClickStartHandle=null:e.connectionStartHandle=null},J=g=>{const p=Kh(g),w=p?null:gn(g)?g:u(g.id);return!p&&!w?[null,null,p]:[p?g:Eo(w),w,p]},te=(g,p=!0,w=e.nodes)=>{const[I,M,U]=J(g);if(!I)return[];const Z=[];for(const re of w||e.nodes){if(!U&&(re.id===M.id||!re.computedPosition))continue;const le=Eo(re),he=$o(le,I);(p&&he>0||he>=le.width*le.height||he>=Number(I.width)*Number(I.height))&&Z.push(re)}return Z},fe=(g,p,w=!0)=>{const[I]=J(g);if(!I)return!1;const M=$o(I,p);return w&&M>0||M>=Number(I.width)*Number(I.height)},we=g=>{const{viewport:p,dimensions:w,d3Zoom:I,d3Selection:M,translateExtent:U}=e;if(!I||!M||!g.x&&!g.y)return!1;const Z=Qt.translate(p.x+g.x,p.y+g.y).scale(p.zoom),re=[[0,0],[w.width,w.height]],le=I.constrain()(Z,re,U),he=e.viewport.x!==le.x||e.viewport.y!==le.y||e.viewport.zoom!==le.k;return I.transform(M,le),he},de=g=>{const p=g instanceof Function?g(e):g,w=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Te(p.defaultEdgeOptions)&&(e.defaultEdgeOptions=p.defaultEdgeOptions);const I=p.modelValue||p.nodes||p.edges?[]:void 0;I&&(p.modelValue&&I.push(...p.modelValue),p.nodes&&I.push(...p.nodes),p.edges&&I.push(...p.edges),C(I));const M=()=>{Te(p.maxZoom)&&A(p.maxZoom),Te(p.minZoom)&&E(p.minZoom),Te(p.translateExtent)&&V(p.translateExtent)};for(const U of Object.keys(p)){const Z=U,re=p[Z];![...Lg,...w].includes(Z)&&Te(re)&&(e[Z]=re)}Ei(()=>e.d3Zoom).not.toBeNull().then(M),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:f,setElements:C,setNodes:H,setEdges:z,addNodes:W,addEdges:v,removeNodes:x,removeEdges:y,findNode:u,findEdge:c,updateEdge:O,updateEdgeData:T,updateNode:G,updateNodeData:K,applyEdgeChanges:D,applyNodeChanges:R,addSelectedElements:S,addSelectedNodes:_,addSelectedEdges:b,setMinZoom:E,setMaxZoom:A,setTranslateExtent:V,setNodeExtent:F,setPaneClickDistance:B,removeSelectedElements:m,removeSelectedNodes:$,removeSelectedEdges:N,startConnection:ie,updateConnection:ae,endConnection:q,setInteractive:X,setState:de,getIntersectingNodes:te,getIncomers:r,getOutgoers:s,getConnectedEdges:a,getHandleConnections:l,isNodeIntersecting:fe,panBy:we,fitView:g=>o.value.fitView(g),zoomIn:g=>o.value.zoomIn(g),zoomOut:g=>o.value.zoomOut(g),zoomTo:(g,p)=>o.value.zoomTo(g,p),setViewport:(g,p)=>o.value.setViewport(g,p),setTransform:(g,p)=>o.value.setTransform(g,p),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(g,p,w)=>o.value.setCenter(g,p,w),fitBounds:(g,p)=>o.value.fitBounds(g,p),project:g=>o.value.project(g),screenToFlowCoordinate:g=>o.value.screenToFlowCoordinate(g),flowToScreenCoordinate:g=>o.value.flowToScreenCoordinate(g),toObject:()=>{const g=[],p=[];for(const w of e.nodes){const{computedPosition:I,handleBounds:M,selected:U,dimensions:Z,isParent:re,resizing:le,dragging:he,events:ve,...Ee}=w;g.push(Ee)}for(const w of e.edges){const{selected:I,sourceNode:M,targetNode:U,events:Z,...re}=w;p.push(re)}return JSON.parse(JSON.stringify({nodes:g,edges:p,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:g=>new Promise(p=>{const{nodes:w,edges:I,position:M,zoom:U,viewport:Z}=g;w&&H(w),I&&z(I);const[re,le]=Z!=null&&Z.x&&(Z!=null&&Z.y)?[Z.x,Z.y]:M??[null,null];if(re&&le){const he=(Z==null?void 0:Z.zoom)||U||e.viewport.zoom;return Ei(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:re,y:le,zoom:he}).then(()=>{p(!0)})})}else p(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const g=sl();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const p=Qt.translate(g.defaultViewport.x??0,g.defaultViewport.y??0).scale(Bt(g.defaultViewport.zoom??1,g.minZoom,g.maxZoom)),w=e.viewportRef.getBoundingClientRect(),I=[[0,0],[w.width,w.height]],M=e.d3Zoom.constrain()(p,I,g.translateExtent);e.d3Zoom.transform(e.d3Selection,M)}de(g)},$destroy:()=>{}}}const Fg=["data-id","data-handleid","data-nodeid","data-handlepos"],Yg={name:"Handle",compatConfig:{MODE:3}},Pe=ye({...Yg,props:{id:{default:null},type:{},position:{default:()=>Q.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=pu(e,["position","connectable","connectableStart","connectableEnd","id"]),o=ke(()=>n.type??"source"),i=ke(()=>n.isValidConnection??null),{id:r,connectionStartHandle:s,connectionClickStartHandle:a,connectionEndHandle:l,vueFlowRef:u,nodesConnectable:c,noDragClassName:d,noPanClassName:f}=Se(),{id:h,node:_,nodeEl:b,connectedEdges:S}=il(),$=me(),N=ke(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),m=ke(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),E=ke(()=>{var z,C,W,v,x,y;return((z=s.value)==null?void 0:z.nodeId)===h&&((C=s.value)==null?void 0:C.id)===e.id&&((W=s.value)==null?void 0:W.type)===o.value||((v=l.value)==null?void 0:v.nodeId)===h&&((x=l.value)==null?void 0:x.id)===e.id&&((y=l.value)==null?void 0:y.type)===o.value}),A=ke(()=>{var z,C,W;return((z=a.value)==null?void 0:z.nodeId)===h&&((C=a.value)==null?void 0:C.id)===e.id&&((W=a.value)==null?void 0:W.type)===o.value}),{handlePointerDown:V,handleClick:F}=ol({nodeId:h,handleId:e.id,isValidConnection:i,type:o}),B=se(()=>typeof e.connectable=="string"&&e.connectable==="single"?!S.value.some(z=>{const C=z[`${o.value}Handle`];return z[o.value]!==h?!1:C?C===e.id:!0}):typeof e.connectable=="number"?S.value.filter(z=>{const C=z[`${o.value}Handle`];return z[o.value]!==h?!1:C?C===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(_,S.value):Te(e.connectable)?e.connectable:c.value);rt(()=>{var z;if(!_.dimensions.width||!_.dimensions.height)return;const C=(z=_.handleBounds[o.value])==null?void 0:z.find(R=>R.id===e.id);if(!u.value||C)return;const W=u.value.querySelector(".vue-flow__transformationpane");if(!b.value||!$.value||!W||!e.id)return;const v=b.value.getBoundingClientRect(),x=$.value.getBoundingClientRect(),y=window.getComputedStyle(W),{m22:O}=new window.DOMMatrixReadOnly(y.transform),T={id:e.id,position:e.position,x:(x.left-v.left)/O,y:(x.top-v.top)/O,type:o.value,nodeId:h,...Lo($.value)};_.handleBounds[o.value]=[..._.handleBounds[o.value]??[],T]});function X(z){const C=lr(z);B.value&&N.value&&(C&&z.button===0||!C)&&V(z)}function H(z){!h||!a.value&&!N.value||B.value&&F(z)}return t({handleClick:F,handlePointerDown:V,onClick:H,onPointerDown:X}),(z,C)=>(L(),j("div",{ref_key:"handle",ref:$,"data-id":`${P(r)}-${P(h)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":P(h),"data-handlepos":z.position,class:Oe(["vue-flow__handle",[`vue-flow__handle-${z.position}`,`vue-flow__handle-${e.id}`,P(d),P(f),o.value,{connectable:B.value,connecting:A.value,connectablestart:N.value,connectableend:m.value,connectionindicator:B.value&&(N.value&&!E.value||m.value&&E.value)}]]),onMousedown:X,onTouchstartPassive:X,onClick:H},[Ie(z.$slots,"default",{id:z.id})],42,Fg))}}),Yo=function({sourcePosition:e=Q.Bottom,targetPosition:t=Q.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:s}){const a=s.label??n;return[xe(Pe,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof a!="string"&&a?xe(a):xe(Ce,[a]),xe(Pe,{type:"source",position:e,connectable:o,isValidConnection:r})]};Yo.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];Yo.inheritAttrs=!1;Yo.compatConfig={MODE:3};const Gg=Yo,Go=function({targetPosition:e=Q.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??t;return[xe(Pe,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?xe(r):xe(Ce,[r])]};Go.props=["targetPosition","label","isValidTargetPos","connectable","data"];Go.inheritAttrs=!1;Go.compatConfig={MODE:3};const Xg=Go,Xo=function({sourcePosition:e=Q.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??t;return[typeof r!="string"&&r?xe(r):xe(Ce,[r]),xe(Pe,{type:"source",position:e,connectable:n,isValidConnection:o})]};Xo.props=["sourcePosition","label","isValidSourcePos","connectable","data"];Xo.inheritAttrs=!1;Xo.compatConfig={MODE:3};const Wg=Xo,jg=["transform"],Ug=["width","height","x","y","rx","ry"],Zg=["y"],qg={name:"EdgeText",compatConfig:{MODE:3}},Kg=ye({...qg,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=me({x:0,y:0,width:0,height:0}),n=me(null),o=se(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);rt(i),$e([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,s)=>(L(),j("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(L(),j("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:ue(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,Ug)):Ne("",!0),k("text",vo(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[Ie(r.$slots,"default",{},()=>[typeof r.label!="string"?(L(),Me(Nt(r.label),{key:0})):(L(),j(Ce,{key:1},[$u(Y(r.label),1)],64))])],16,Zg)],8,jg))}}),Jg=["id","d","marker-end","marker-start"],Qg=["d","stroke-width"],ev={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Wo=ye({...ev,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=me(null),o=me(null),i=me(null),r=Ki();return t({pathEl:n,interactionEl:o,labelEl:i}),(s,a)=>(L(),j(Ce,null,[k("path",vo(P(r),{id:s.id,ref_key:"pathEl",ref:n,d:s.path,class:"vue-flow__edge-path","marker-end":s.markerEnd,"marker-start":s.markerStart}),null,16,Jg),s.interactionWidth?(L(),j("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:s.path,"stroke-width":s.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,Qg)):Ne("",!0),s.label&&s.labelX&&s.labelY?(L(),Me(Kg,{key:1,ref_key:"labelEl",ref:i,x:s.labelX,y:s.labelY,label:s.label,"label-show-bg":s.labelShowBg,"label-bg-style":s.labelBgStyle,"label-bg-padding":s.labelBgPadding,"label-bg-border-radius":s.labelBgBorderRadius,"label-style":s.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):Ne("",!0)],64))}});function al({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[r,a,i,s]}function ll({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:s,targetControlY:a}){const l=e*.125+i*.375+s*.375+n*.125,u=t*.125+r*.375+a*.375+o*.125,c=Math.abs(l-e),d=Math.abs(u-t);return[l,u,c,d]}function Kn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ss({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let s,a;switch(e){case Q.Left:s=t-Kn(t-o,r),a=n;break;case Q.Right:s=t+Kn(o-t,r),a=n;break;case Q.Top:s=t,a=n-Kn(n-i,r);break;case Q.Bottom:s=t,a=n+Kn(i-n,r);break}return[s,a]}function ul(e){const{sourceX:t,sourceY:n,sourcePosition:o=Q.Bottom,targetX:i,targetY:r,targetPosition:s=Q.Top,curvature:a=.25}=e,[l,u]=ss({pos:o,x1:t,y1:n,x2:i,y2:r,c:a}),[c,d]=ss({pos:s,x1:i,y1:r,x2:t,y2:n,c:a}),[f,h,_,b]=ll({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:l,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${l},${u} ${c},${d} ${i},${r}`,f,h,_,b]}function as({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,s;switch(e){case Q.Left:case Q.Right:r=.5*(t+o),s=n;break;case Q.Top:case Q.Bottom:r=t,s=.5*(n+i);break}return[r,s]}function cl(e){const{sourceX:t,sourceY:n,sourcePosition:o=Q.Bottom,targetX:i,targetY:r,targetPosition:s=Q.Top}=e,[a,l]=as({pos:o,x1:t,y1:n,x2:i,y2:r}),[u,c]=as({pos:s,x1:i,y1:r,x2:t,y2:n}),[d,f,h,_]=ll({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${t},${n} C${a},${l} ${u},${c} ${i},${r}`,d,f,h,_]}const ls={[Q.Left]:{x:-1,y:0},[Q.Right]:{x:1,y:0},[Q.Top]:{x:0,y:-1},[Q.Bottom]:{x:0,y:1}};function tv({source:e,sourcePosition:t=Q.Bottom,target:n}){return t===Q.Left||t===Q.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function us(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function nv({source:e,sourcePosition:t=Q.Bottom,target:n,targetPosition:o=Q.Top,center:i,offset:r}){const s=ls[t],a=ls[o],l={x:e.x+s.x*r,y:e.y+s.y*r},u={x:n.x+a.x*r,y:n.y+a.y*r},c=tv({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h,_,b;const S={x:0,y:0},$={x:0,y:0},[N,m,E,A]=al({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){_=i.x??N,b=i.y??m;const F=[{x:_,y:l.y},{x:_,y:u.y}],B=[{x:l.x,y:b},{x:u.x,y:b}];s[d]===f?h=d==="x"?F:B:h=d==="x"?B:F}else{const F=[{x:l.x,y:u.y}],B=[{x:u.x,y:l.y}];if(d==="x"?h=s.x===f?B:F:h=s.y===f?F:B,t===o){const W=Math.abs(e[d]-n[d]);if(W<=r){const v=Math.min(r-1,r-W);s[d]===f?S[d]=(l[d]>e[d]?-1:1)*v:$[d]=(u[d]>n[d]?-1:1)*v}}if(t!==o){const W=d==="x"?"y":"x",v=s[d]===a[W],x=l[W]>u[W],y=l[W]<u[W];(s[d]===1&&(!v&&x||v&&y)||s[d]!==1&&(!v&&y||v&&x))&&(h=d==="x"?F:B)}const X={x:l.x+S.x,y:l.y+S.y},H={x:u.x+$.x,y:u.y+$.y},z=Math.max(Math.abs(X.x-h[0].x),Math.abs(H.x-h[0].x)),C=Math.max(Math.abs(X.y-h[0].y),Math.abs(H.y-h[0].y));z>=C?(_=(X.x+H.x)/2,b=h[0].y):(_=h[0].x,b=(X.y+H.y)/2)}return[[e,{x:l.x+S.x,y:l.y+S.y},...h,{x:u.x+$.x,y:u.y+$.y},n],_,b,E,A]}function ov(e,t,n,o){const i=Math.min(us(e,t)/2,us(t,n)/2,o),{x:r,y:s}=t;if(e.x===r&&r===n.x||e.y===s&&s===n.y)return`L${r} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${r+i*u},${s}Q ${r},${s} ${r},${s+i*c}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${r},${s+i*l}Q ${r},${s} ${r+i*a},${s}`}function Ri(e){const{sourceX:t,sourceY:n,sourcePosition:o=Q.Bottom,targetX:i,targetY:r,targetPosition:s=Q.Top,borderRadius:a=5,centerX:l,centerY:u,offset:c=20}=e,[d,f,h,_,b]=nv({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:s,center:{x:l,y:u},offset:c});return[d.reduce(($,N,m)=>{let E;return m>0&&m<d.length-1?E=ov(d[m-1],N,d[m+1],a):E=`${m===0?"M":"L"}${N.x} ${N.y}`,$+=E,$},""),f,h,_,b]}function iv(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,s,a,l]=al({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,s,a,l]}const rv=ye({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=iv(e);return xe(Wo,{path:n,labelX:o,labelY:i,...t,...e})}}}),sv=rv,av=ye({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Ri({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return xe(Wo,{path:n,labelX:o,labelY:i,...t,...e})}}}),dl=av,lv=ye({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>xe(dl,{...e,...t,borderRadius:0})}}),uv=lv,cv=ye({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=ul({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return xe(Wo,{path:n,labelX:o,labelY:i,...t,...e})}}}),dv=cv,fv=ye({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=cl({...e,sourcePosition:e.sourcePosition??Q.Bottom,targetPosition:e.targetPosition??Q.Top});return xe(Wo,{path:n,labelX:o,labelY:i,...t,...e})}}}),hv=fv,gv={input:Wg,default:Gg,output:Xg},vv={default:dv,straight:sv,step:uv,smoothstep:dl,simplebezier:hv};function pv(e,t,n){const o=se(()=>b=>t.value.get(b)),i=se(()=>b=>n.value.get(b)),r=se(()=>{const b={...vv,...e.edgeTypes},S=Object.keys(b);for(const $ of e.edges)$.type&&!S.includes($.type)&&(b[$.type]=$.type);return b}),s=se(()=>{const b={...gv,...e.nodeTypes},S=Object.keys(b);for(const $ of e.nodes)$.type&&!S.includes($.type)&&(b[$.type]=$.type);return b}),a=se(()=>e.onlyRenderVisibleElements?ja(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),l=se(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const S of e.edges){const $=t.value.get(S.source),N=t.value.get(S.target);fg({sourcePos:$.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:$.dimensions.width,sourceHeight:$.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(S)}return b}return e.edges}),u=se(()=>[...a.value,...l.value]),c=se(()=>{const b=[];for(const S of e.nodes)S.selected&&b.push(S);return b}),d=se(()=>{const b=[];for(const S of e.edges)S.selected&&b.push(S);return b}),f=se(()=>[...c.value,...d.value]),h=se(()=>{const b=[];for(const S of e.nodes)S.dimensions.width&&S.dimensions.height&&S.handleBounds!==void 0&&b.push(S);return b}),_=se(()=>a.value.length>0&&h.value.length===a.value.length);return{getNode:o,getEdge:i,getElements:u,getEdgeTypes:r,getNodeTypes:s,getEdges:l,getNodes:a,getSelectedElements:f,getSelectedNodes:c,getSelectedEdges:d,getNodesInitialized:h,areNodesInitialized:_}}class Mt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=rn())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??Mt.instance;return Mt.instance=o??new Mt,n&&(n.config.globalProperties.$vueFlowStorage=Mt.instance),Mt.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=sl(),i=_u(o),r={};for(const[f,h]of Object.entries(i.hooks)){const _=`on${f.charAt(0).toUpperCase()+f.slice(1)}`;r[_]=h.on}const s={};for(const[f,h]of Object.entries(i.hooks))s[f]=h.trigger;const a=se(()=>{const f=new Map;for(const h of i.nodes)f.set(h.id,h);return f}),l=se(()=>{const f=new Map;for(const h of i.edges)f.set(h.id,h);return f}),u=pv(i,a,l),c=Hg(i,a,l);c.setState({...i,...n});const d={...r,...u,...c,...rc(i),nodeLookup:a,edgeLookup:l,emits:s,id:t,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(t)}};return this.set(t,d),d}getId(){return`vue-flow-${this.currentId++}`}}function Se(e){const t=Mt.getInstance(),n=ra(),o=typeof e=="object",i=o?e:{id:e},r=i.id,s=r??(n==null?void 0:n.vueFlowId);let a;if(n){const l=Ht(rs,null);typeof l<"u"&&l!==null&&(!s||l.id===s)&&(a=l)}if(a||s&&(a=t.get(s)),!a||s&&a.id!==s){const l=r??t.getId(),u=t.create(l,i);a=u,(n??oa(!0)).run(()=>{$e(u.applyDefault,(d,f,h)=>{const _=S=>{u.applyNodeChanges(S)},b=S=>{u.applyEdgeChanges(S)};d?(u.onNodesChange(_),u.onEdgesChange(b)):(u.hooks.value.nodesChange.off(_),u.hooks.value.edgesChange.off(b)),h(()=>{u.hooks.value.nodesChange.off(_),u.hooks.value.edgesChange.off(b)})},{immediate:!0}),bn(()=>{if(a){const d=t.get(a.id);d?d.$destroy():zn(`No store instance found for id ${a.id} in storage.`)}})})}else o&&a.setState(i);if(n&&(Pt(rs,a),n.vueFlowId=a.id),o){const l=rn();(l==null?void 0:l.type.name)!=="VueFlow"&&a.emits.error(new Ae(De.USEVUEFLOW_OPTIONS))}return a}function mv(e){const{emits:t,dimensions:n}=Se();let o;rt(()=>{const i=()=>{var r,s;if(!e.value||!(((s=(r=e.value).checkVisibility)==null?void 0:s.call(r))??!0))return;const a=Lo(e.value);(a.width===0||a.height===0)&&t.error(new Ae(De.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:a.width||500,height:a.height||500}};i(),window.addEventListener("resize",i),e.value&&(o=new ResizeObserver(()=>i()),o.observe(e.value)),Zi(()=>{window.removeEventListener("resize",i),o&&e.value&&o.unobserve(e.value)})})}const wv={name:"UserSelection",compatConfig:{MODE:3}},yv=ye({...wv,props:{userSelectionRect:{}},setup(e){return(t,n)=>(L(),j("div",{class:"vue-flow__selection vue-flow__container",style:ue({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),_v=["tabIndex"],bv={name:"NodesSelection",compatConfig:{MODE:3}},kv=ye({...bv,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:s}=Se(),a=rl(),l=me(null),u=nl({el:l,onStart(_){t.selectionDragStart(_),t.nodeDragStart(_)},onDrag(_){t.selectionDrag(_),t.nodeDrag(_)},onStop(_){t.selectionDragStop(_),t.nodeDragStop(_)}});rt(()=>{var _;r.value||(_=l.value)==null||_.focus({preventScroll:!0})});const c=se(()=>sr(o.value)),d=se(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function f(_){t.selectionContextMenu({event:_,nodes:o.value})}function h(_){r.value||Zt[_.key]&&(_.preventDefault(),a({x:Zt[_.key].x,y:Zt[_.key].y},_.shiftKey))}return(_,b)=>!P(s)&&c.value.width&&c.value.height?(L(),j("div",{key:0,class:Oe(["vue-flow__nodesselection vue-flow__container",P(i)]),style:ue({transform:`translate(${P(n).x}px,${P(n).y}px) scale(${P(n).zoom})`})},[k("div",{ref_key:"el",ref:l,class:Oe([{dragging:P(u)},"vue-flow__nodesselection-rect"]),style:ue(d.value),tabIndex:P(r)?void 0:-1,onContextmenu:f,onKeydown:h},null,46,_v)],6)):Ne("",!0)}});function Ev(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const $v={name:"Pane",compatConfig:{MODE:3}},xv=ye({...$v,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:s,userSelectionRect:a,elementsSelectable:l,nodesSelectionActive:u,getSelectedEdges:c,getSelectedNodes:d,removeNodes:f,removeEdges:h,selectionMode:_,deleteKeyCode:b,multiSelectionKeyCode:S,multiSelectionActive:$,edgeLookup:N,nodeLookup:m,connectionLookup:E,defaultEdgeOptions:A,connectionStartHandle:V,panOnDrag:F}=Se(),B=Et(null),X=Et(new Set),H=Et(new Set),z=Et(null),C=ke(()=>l.value&&(e.isSelecting||r.value)),W=ke(()=>V.value!==null);let v=!1,x=!1;const y=_n(b,{actInsideInputWithModifier:!1}),O=_n(S);$e(y,q=>{q&&(f(d.value),h(c.value),u.value=!1)}),$e(O,q=>{$.value=q});function T(q,J){return te=>{te.target===J&&(q==null||q(te))}}function R(q){if(v||W.value){v=!1;return}i.paneClick(q),s(),u.value=!1}function D(q){var J;if(Array.isArray(F.value)&&((J=F.value)!=null&&J.includes(2))){q.preventDefault();return}i.paneContextMenu(q)}function G(q){i.paneScroll(q)}function K(q){var J,te,fe;if(z.value=((J=t.value)==null?void 0:J.getBoundingClientRect())??null,!l.value||!e.isSelecting||q.button!==0||q.target!==B.value||!z.value)return;(fe=(te=q.target)==null?void 0:te.setPointerCapture)==null||fe.call(te,q.pointerId);const{x:we,y:de}=Ev(q,z.value);x=!0,v=!1,s(),a.value={width:0,height:0,startX:we,startY:de,x:we,y:de},i.selectionStart(q)}function ie(q){var J;if(!z.value||!a.value)return;v=!0;const{x:te,y:fe}=et(q,z.value),{startX:we=0,startY:de=0}=a.value,_e={startX:we,startY:de,x:te<we?te:we,y:fe<de?fe:de,width:Math.abs(te-we),height:Math.abs(fe-de)},ce=X.value,ne=H.value;X.value=new Set(ja(n.value,_e,o.value,_.value===rr.Partial,!0).map(p=>p.id)),H.value=new Set;const g=((J=A.value)==null?void 0:J.selectable)??!0;for(const p of X.value){const w=E.value.get(p);if(w)for(const{edgeId:I}of w.values()){const M=N.value.get(I);M&&(M.selectable??g)&&H.value.add(I)}}if(!is(ce,X.value)){const p=_t(m.value,X.value,!0);i.nodesChange(p)}if(!is(ne,H.value)){const p=_t(N.value,H.value);i.edgesChange(p)}a.value=_e,r.value=!0,u.value=!1}function ae(q){var J;q.button!==0||!x||((J=q.target)==null||J.releasePointerCapture(q.pointerId),!r.value&&a.value&&q.target===B.value&&R(q),r.value=!1,a.value=null,u.value=X.value.size>0,i.selectionEnd(q),e.selectionKeyPressed&&(v=!1),x=!1)}return(q,J)=>(L(),j("div",{ref_key:"container",ref:B,class:Oe(["vue-flow__pane vue-flow__container",{selection:q.isSelecting}]),onClick:J[0]||(J[0]=te=>C.value?void 0:T(R,B.value)(te)),onContextmenu:J[1]||(J[1]=te=>T(D,B.value)(te)),onWheelPassive:J[2]||(J[2]=te=>T(G,B.value)(te)),onPointerenter:J[3]||(J[3]=te=>C.value?void 0:P(i).paneMouseEnter(te)),onPointerdown:J[4]||(J[4]=te=>C.value?K(te):P(i).paneMouseMove(te)),onPointermove:J[5]||(J[5]=te=>C.value?ie(te):P(i).paneMouseMove(te)),onPointerup:J[6]||(J[6]=te=>C.value?ae(te):void 0),onPointerleave:J[7]||(J[7]=te=>P(i).paneMouseLeave(te))},[Ie(q.$slots,"default"),P(r)&&P(a)?(L(),Me(yv,{key:0,"user-selection-rect":P(a)},null,8,["user-selection-rect"])):Ne("",!0),P(u)&&P(d).length?(L(),Me(kv,{key:1})):Ne("",!0)],34))}}),Nv={name:"Transform",compatConfig:{MODE:3}},Sv=ye({...Nv,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=Se(),i=se(()=>n.value?!o.value:!1),r=se(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(s,a)=>(L(),j("div",{class:"vue-flow__transformationpane vue-flow__container",style:ue({transform:r.value,opacity:i.value?0:void 0})},[Ie(s.$slots,"default")],4))}}),Cv={name:"Viewport",compatConfig:{MODE:3}},Mv=ye({...Cv,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:s,panActivationKeyCode:a,panOnScroll:l,panOnScrollMode:u,panOnScrollSpeed:c,panOnDrag:d,zoomOnDoubleClick:f,zoomOnPinch:h,zoomOnScroll:_,preventScrolling:b,noWheelClassName:S,noPanClassName:$,emits:N,connectionStartHandle:m,userSelectionActive:E,paneDragging:A,d3Zoom:V,d3Selection:F,d3ZoomHandler:B,viewport:X,viewportRef:H,paneClickDistance:z}=Se();mv(H);const C=Et(!1),W=Et(!1);let v=null,x=!1,y=0,O={x:0,y:0,zoom:0};const T=_n(a),R=_n(s),D=_n(r),G=ke(()=>(!R.value||R.value&&s.value===!0)&&(T.value||d.value)),K=ke(()=>T.value||l.value),ie=ke(()=>s.value===!0&&G.value!==!0),ae=ke(()=>R.value&&s.value!==!0||E.value||ie.value),q=ke(()=>m.value!==null);rt(()=>{if(!H.value){zn("Viewport element is missing");return}const de=H.value,_e=de.getBoundingClientRect(),ce=Gh().clickDistance(z.value).scaleExtent([t.value,n.value]).translateExtent(i.value),ne=Xe(de).call(ce),g=ne.on("wheel.zoom"),p=Qt.translate(o.value.x??0,o.value.y??0).scale(Bt(o.value.zoom??1,t.value,n.value)),w=[[0,0],[_e.width,_e.height]],I=ce.constrain()(p,w,i.value);ce.transform(ne,I),ce.wheelDelta(Di),V.value=ce,F.value=ne,B.value=g,X.value={x:I.x,y:I.y,zoom:I.k},ce.on("start",M=>{var U;if(!M.sourceEvent)return null;y=M.sourceEvent.button,C.value=!0;const Z=fe(M.transform);((U=M.sourceEvent)==null?void 0:U.type)==="mousedown"&&(A.value=!0),O=Z,N.viewportChangeStart(Z),N.moveStart({event:M,flowTransform:Z})}),ce.on("end",M=>{if(!M.sourceEvent)return null;if(C.value=!1,A.value=!1,J(G.value,y??0)&&!x&&N.paneContextMenu(M.sourceEvent),x=!1,te(O,M.transform)){const U=fe(M.transform);O=U,N.viewportChangeEnd(U),N.moveEnd({event:M,flowTransform:U})}}),ce.filter(M=>{var U;const Z=D.value||_.value,re=h.value&&M.ctrlKey,le=M.button,he=M.type==="wheel";if(le===1&&M.type==="mousedown"&&(we(M,"vue-flow__node")||we(M,"vue-flow__edge")))return!0;if(!G.value&&!Z&&!K.value&&!f.value&&!h.value||E.value||q.value&&!he||!f.value&&M.type==="dblclick"||we(M,S.value)&&he||we(M,$.value)&&(!he||K.value&&he&&!D.value)||!h.value&&M.ctrlKey&&he||!Z&&!K.value&&!re&&he)return!1;if(!h&&M.type==="touchstart"&&((U=M.touches)==null?void 0:U.length)>1)return M.preventDefault(),!1;if(!G.value&&(M.type==="mousedown"||M.type==="touchstart")||ie.value&&Array.isArray(d.value)&&d.value.includes(0)&&le===0||Array.isArray(d.value)&&!d.value.includes(le)&&(M.type==="mousedown"||M.type==="touchstart"))return!1;const ve=Array.isArray(d.value)&&d.value.includes(le)||s.value===!0&&Array.isArray(d.value)&&!d.value.includes(0)||!le||le<=1;return(!M.ctrlKey||T.value||he)&&ve}),$e([E,G],()=>{E.value&&!C.value?ce.on("zoom",null):E.value||ce.on("zoom",M=>{X.value={x:M.transform.x,y:M.transform.y,zoom:M.transform.k};const U=fe(M.transform);x=J(G.value,y??0),N.viewportChange(U),N.move({event:M,flowTransform:U})})},{immediate:!0}),$e([E,K,u,D,h,b,S],()=>{K.value&&!D.value&&!E.value?ne.on("wheel.zoom",M=>{if(we(M,S.value))return!1;const U=D.value||_.value,Z=h.value&&M.ctrlKey;if(!(!b.value||K.value||U||Z))return!1;M.preventDefault(),M.stopImmediatePropagation();const le=ne.property("__zoom").k||1,he=Mn();if(!T.value&&M.ctrlKey&&h.value&&he){const hu=Je(M),gu=Di(M),vu=le*2**gu;ce.scaleTo(ne,vu,hu,M);return}const ve=M.deltaMode===1?20:1;let Ee=u.value===yn.Vertical?0:M.deltaX*ve,pt=u.value===yn.Horizontal?0:M.deltaY*ve;!he&&M.shiftKey&&u.value!==yn.Vertical&&!Ee&&pt&&(Ee=pt,pt=0),ce.translateBy(ne,-(Ee/le)*c.value,-(pt/le)*c.value);const Ke=fe(ne.property("__zoom"));v&&clearTimeout(v),W.value?(N.move({event:M,flowTransform:Ke}),N.viewportChange(Ke),v=setTimeout(()=>{N.moveEnd({event:M,flowTransform:Ke}),N.viewportChangeEnd(Ke),W.value=!1},150)):(W.value=!0,N.moveStart({event:M,flowTransform:Ke}),N.viewportChangeStart(Ke))},{passive:!1}):typeof g<"u"&&ne.on("wheel.zoom",function(M,U){const Z=!b.value&&M.type==="wheel"&&!M.ctrlKey,re=D.value||_.value,le=h.value&&M.ctrlKey;if(!re&&!l.value&&!le&&M.type==="wheel"||Z||we(M,S.value))return null;M.preventDefault(),g.call(this,M,U)},{passive:!1})},{immediate:!0})});function J(de,_e){return _e===2&&Array.isArray(de)&&de.includes(2)}function te(de,_e){return de.x!==_e.x&&!Number.isNaN(_e.x)||de.y!==_e.y&&!Number.isNaN(_e.y)||de.zoom!==_e.k&&!Number.isNaN(_e.k)}function fe(de){return{x:de.x,y:de.y,zoom:de.k}}function we(de,_e){return de.target.closest(`.${_e}`)}return(de,_e)=>(L(),j("div",{ref_key:"viewportRef",ref:H,class:"vue-flow__viewport vue-flow__container"},[be(xv,{"is-selecting":ae.value,"selection-key-pressed":P(R),class:Oe({connecting:q.value,dragging:P(A),draggable:P(d)===!0||Array.isArray(P(d))&&P(d).includes(0)})},{default:ze(()=>[be(Sv,null,{default:ze(()=>[Ie(de.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Iv=["id"],Tv=["id"],Ov=["id"],Dv={name:"A11yDescriptions",compatConfig:{MODE:3}},Av=ye({...Dv,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=Se();return(i,r)=>(L(),j(Ce,null,[k("div",{id:`${P(Ba)}-${P(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+Y(P(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,Iv),k("div",{id:`${P(Va)}-${P(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,Tv),P(n)?Ne("",!0):(L(),j("div",{key:0,id:`${P(qh)}-${P(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},Y(P(o)),9,Ov))],64))}});function Pv(){const e=Se();$e(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Rv(e,t,n){return n===Q.Left?e-t:n===Q.Right?e+t:e}function zv(e,t,n){return n===Q.Top?e-t:n===Q.Bottom?e+t:e}const ur=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=Q.Top,type:i}){return xe("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Rv(t,e,o),cy:zv(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};ur.props=["radius","centerX","centerY","position","type"];ur.compatConfig={MODE:3};const cs=ur,Bv=ye({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:s,noPanClassName:a,getEdgeTypes:l,removeSelectedEdges:u,findEdge:c,findNode:d,isValidConnection:f,multiSelectionActive:h,disableKeyboardA11y:_,elementsSelectable:b,edgesUpdatable:S,edgesFocusable:$,hooks:N}=Se(),m=se(()=>c(e.id)),{emit:E,on:A}=Cg(m.value,r),V=Ht(Fo),F=rn(),B=me(!1),X=me(!1),H=me(""),z=me(null),C=me("source"),W=me(null),v=ke(()=>typeof m.value.selectable>"u"?b.value:m.value.selectable),x=ke(()=>typeof m.value.updatable>"u"?S.value:m.value.updatable),y=ke(()=>typeof m.value.focusable>"u"?$.value:m.value.focusable);Pt(xg,e.id),Pt(Ng,W);const O=se(()=>m.value.class instanceof Function?m.value.class(m.value):m.value.class),T=se(()=>m.value.style instanceof Function?m.value.style(m.value):m.value.style),R=se(()=>{const p=m.value.type||"default",w=V==null?void 0:V[`edge-${p}`];if(w)return w;let I=m.value.template??l.value[p];if(typeof I=="string"&&F){const M=Object.keys(F.appContext.components);M&&M.includes(p)&&(I=sa(p,!1))}return I&&typeof I!="string"?I:(r.error(new Ae(De.EDGE_TYPE_MISSING,I)),!1)}),{handlePointerDown:D}=ol({nodeId:H,handleId:z,type:C,isValidConnection:f,edgeUpdaterType:C,onEdgeUpdate:ie,onEdgeUpdateEnd:ae});return()=>{const p=d(m.value.source),w=d(m.value.target),I="pathOptions"in m.value?m.value.pathOptions:{};if(!p&&!w)return r.error(new Ae(De.EDGE_SOURCE_TARGET_MISSING,m.value.id,m.value.source,m.value.target)),null;if(!p)return r.error(new Ae(De.EDGE_SOURCE_MISSING,m.value.id,m.value.source)),null;if(!w)return r.error(new Ae(De.EDGE_TARGET_MISSING,m.value.id,m.value.target)),null;if(!m.value||m.value.hidden||p.hidden||w.hidden)return null;let M;o.value===$t.Strict?M=p.handleBounds.source:M=[...p.handleBounds.source||[],...p.handleBounds.target||[]];const U=Jr(M,m.value.sourceHandle);let Z;o.value===$t.Strict?Z=w.handleBounds.target:Z=[...w.handleBounds.target||[],...w.handleBounds.source||[]];const re=Jr(Z,m.value.targetHandle),le=(U==null?void 0:U.position)||Q.Bottom,he=(re==null?void 0:re.position)||Q.Top,{x:ve,y:Ee}=en(p,U,le),{x:pt,y:Ke}=en(w,re,he);return m.value.sourceX=ve,m.value.sourceY=Ee,m.value.targetX=pt,m.value.targetY=Ke,xe("g",{ref:W,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${R.value===!1?"default":m.value.type||"default"}`,a.value,O.value,{updating:B.value,selected:m.value.selected,animated:m.value.animated,inactive:!v.value&&!N.value.edgeClick.hasListeners()}],tabIndex:y.value?0:void 0,"aria-label":m.value.ariaLabel===null?void 0:m.value.ariaLabel??`Edge from ${m.value.source} to ${m.value.target}`,"aria-describedby":y.value?`${Va}-${t}`:void 0,"aria-roledescription":"edge",role:y.value?"group":"img",...m.value.domAttributes,onClick:J,onContextmenu:te,onDblclick:fe,onMouseenter:we,onMousemove:de,onMouseleave:_e,onKeyDown:y.value?g:void 0},[X.value?null:xe(R.value===!1?l.value.default:R.value,{id:e.id,sourceNode:p,targetNode:w,source:m.value.source,target:m.value.target,type:m.value.type,updatable:x.value,selected:m.value.selected,animated:m.value.animated,label:m.value.label,labelStyle:m.value.labelStyle,labelShowBg:m.value.labelShowBg,labelBgStyle:m.value.labelBgStyle,labelBgPadding:m.value.labelBgPadding,labelBgBorderRadius:m.value.labelBgBorderRadius,data:m.value.data,events:{...m.value.events,...A},style:T.value,markerStart:`url('#${Cn(m.value.markerStart,t)}')`,markerEnd:`url('#${Cn(m.value.markerEnd,t)}')`,sourcePosition:le,targetPosition:he,sourceX:ve,sourceY:Ee,targetX:pt,targetY:Ke,sourceHandleId:m.value.sourceHandle,targetHandleId:m.value.targetHandle,interactionWidth:m.value.interactionWidth,...I}),[x.value==="source"||x.value===!0?[xe("g",{onMousedown:ce,onMouseenter:G,onMouseout:K},xe(cs,{position:le,centerX:ve,centerY:Ee,radius:i.value,type:"source","data-type":"source"}))]:null,x.value==="target"||x.value===!0?[xe("g",{onMousedown:ne,onMouseenter:G,onMouseout:K},xe(cs,{position:he,centerX:pt,centerY:Ke,radius:i.value,type:"target","data-type":"target"}))]:null]])};function G(){B.value=!0}function K(){B.value=!1}function ie(p,w){E.update({event:p,edge:m.value,connection:w})}function ae(p){E.updateEnd({event:p,edge:m.value}),X.value=!1}function q(p,w){p.button===0&&(X.value=!0,H.value=w?m.value.target:m.value.source,z.value=(w?m.value.targetHandle:m.value.sourceHandle)??null,C.value=w?"target":"source",E.updateStart({event:p,edge:m.value}),D(p))}function J(p){var w;const I={event:p,edge:m.value};v.value&&(s.value=!1,m.value.selected&&h.value?(u([m.value]),(w=W.value)==null||w.blur()):n([m.value])),E.click(I)}function te(p){E.contextMenu({event:p,edge:m.value})}function fe(p){E.doubleClick({event:p,edge:m.value})}function we(p){E.mouseEnter({event:p,edge:m.value})}function de(p){E.mouseMove({event:p,edge:m.value})}function _e(p){E.mouseLeave({event:p,edge:m.value})}function ce(p){q(p,!0)}function ne(p){q(p,!1)}function g(p){var w;!_.value&&La.includes(p.key)&&v.value&&(p.key==="Escape"?((w=W.value)==null||w.blur(),u([c(e.id)])):n([c(e.id)]))}}}),Vv=Bv,Lv=ye({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:s,connectionLineStyle:a,connectionLineOptions:l,connectionStatus:u,viewport:c,findNode:d}=Se(),f=(e=Ht(Fo))==null?void 0:e["connection-line"],h=se(()=>{var N;return d((N=o.value)==null?void 0:N.nodeId)}),_=se(()=>{var N;return d((N=i.value)==null?void 0:N.nodeId)??null}),b=se(()=>({x:(r.value.x-c.value.x)/c.value.zoom,y:(r.value.y-c.value.y)/c.value.zoom})),S=se(()=>l.value.markerStart?`url(#${Cn(l.value.markerStart,t)})`:""),$=se(()=>l.value.markerEnd?`url(#${Cn(l.value.markerEnd,t)})`:"");return()=>{var N,m,E;if(!h.value||!o.value)return null;const A=o.value.id,V=o.value.type,F=h.value.handleBounds;let B=(F==null?void 0:F[V])??[];if(n.value===$t.Loose){const T=(F==null?void 0:F[V==="source"?"target":"source"])??[];B=[...B,...T]}if(!B)return null;const X=(A?B.find(T=>T.id===A):B[0])??null,H=(X==null?void 0:X.position)??Q.Top,{x:z,y:C}=en(h.value,X,H);let W=null;_.value&&(n.value===$t.Strict?W=((N=_.value.handleBounds[V==="source"?"target":"source"])==null?void 0:N.find(T=>{var R;return T.id===((R=i.value)==null?void 0:R.id)}))||null:W=((m=[..._.value.handleBounds.source??[],..._.value.handleBounds.target??[]])==null?void 0:m.find(T=>{var R;return T.id===((R=i.value)==null?void 0:R.id)}))||null);const v=((E=i.value)==null?void 0:E.position)??(H?Ai[H]:null);if(!H||!v)return null;const x=s.value??l.value.type??St.Bezier;let y="";const O={sourceX:z,sourceY:C,sourcePosition:H,targetX:b.value.x,targetY:b.value.y,targetPosition:v};return x===St.Bezier?[y]=ul(O):x===St.Step?[y]=Ri({...O,borderRadius:0}):x===St.SmoothStep?[y]=Ri(O):x===St.SimpleBezier?[y]=cl(O):y=`M${z},${C} ${b.value.x},${b.value.y}`,xe("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},xe("g",{class:"vue-flow__connection"},f?xe(f,{sourceX:z,sourceY:C,sourcePosition:H,targetX:b.value.x,targetY:b.value.y,targetPosition:v,sourceNode:h.value,sourceHandle:X,targetNode:_.value,targetHandle:W,markerEnd:$.value,markerStart:S.value,connectionStatus:u.value}):xe("path",{d:y,class:[l.value.class,u.value,"vue-flow__connection-path"],style:{...a.value,...l.value.style},"marker-end":$.value,"marker-start":S.value})))}}}),Hv=Lv,Fv=["id","markerWidth","markerHeight","markerUnits","orient"],Yv={name:"MarkerType",compatConfig:{MODE:3}},Gv=ye({...Yv,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(L(),j("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===P(Ut).ArrowClosed?(L(),j("polyline",{key:0,style:ue({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):Ne("",!0),t.type===P(Ut).Arrow?(L(),j("polyline",{key:1,style:ue({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):Ne("",!0)],8,Fv))}}),Xv={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},Wv={name:"MarkerDefinitions",compatConfig:{MODE:3}},jv=ye({...Wv,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=Se(),r=se(()=>{const s=new Set,a=[],l=u=>{if(u){const c=Cn(u,t);s.has(c)||(typeof u=="object"?a.push({...u,id:c,color:u.color||i.value}):a.push({id:c,color:i.value,type:u}),s.add(c))}};for(const u of[o.value.markerEnd,o.value.markerStart])l(u);for(const u of n.value)for(const c of[u.markerStart,u.markerEnd])l(c);return a.sort((u,c)=>u.id.localeCompare(c.id))});return(s,a)=>(L(),j("svg",Xv,[k("defs",null,[(L(!0),j(Ce,null,it(r.value,l=>(L(),Me(Gv,{id:l.id,key:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,"stroke-width":l.strokeWidth,orient:l.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),Uv={name:"Edges",compatConfig:{MODE:3}},Zv=ye({...Uv,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=Se();return(i,r)=>(L(),j(Ce,null,[be(jv),(L(!0),j(Ce,null,it(P(n),s=>(L(),j("svg",{key:s.id,class:"vue-flow__edges vue-flow__container",style:ue({zIndex:P(hg)(s,P(t),P(o))})},[be(P(Vv),{id:s.id},null,8,["id"])],4))),128)),be(P(Hv))],64))}}),qv=ye({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:s,removeSelectedNodes:a,addSelectedNodes:l,updateNodeDimensions:u,onUpdateNodeInternals:c,getNodeTypes:d,nodeExtent:f,elevateNodesOnSelect:h,disableKeyboardA11y:_,ariaLiveMessage:b,snapToGrid:S,snapGrid:$,nodeDragThreshold:N,nodesDraggable:m,elementsSelectable:E,nodesConnectable:A,nodesFocusable:V,hooks:F}=Se(),B=me(null);Pt(tl,B),Pt(el,e.id);const X=Ht(Fo),H=rn(),z=rl(),{node:C,parentNode:W}=il(e.id),{emit:v,on:x}=Og(C,s),y=ke(()=>typeof C.draggable>"u"?m.value:C.draggable),O=ke(()=>typeof C.selectable>"u"?E.value:C.selectable),T=ke(()=>typeof C.connectable>"u"?A.value:C.connectable),R=ke(()=>typeof C.focusable>"u"?V.value:C.focusable),D=se(()=>O.value||y.value||F.value.nodeClick.hasListeners()||F.value.nodeDoubleClick.hasListeners()||F.value.nodeMouseEnter.hasListeners()||F.value.nodeMouseMove.hasListeners()||F.value.nodeMouseLeave.hasListeners()),G=ke(()=>!!C.dimensions.width&&!!C.dimensions.height),K=se(()=>{const w=C.type||"default",I=X==null?void 0:X[`node-${w}`];if(I)return I;let M=C.template||d.value[w];if(typeof M=="string"&&H){const U=Object.keys(H.appContext.components);U&&U.includes(w)&&(M=sa(w,!1))}return M&&typeof M!="string"?M:(s.error(new Ae(De.NODE_TYPE_MISSING,M)),!1)}),ie=nl({id:e.id,el:B,disabled:()=>!y.value,selectable:O,dragHandle:()=>C.dragHandle,onStart(w){v.dragStart(w)},onDrag(w){v.drag(w)},onStop(w){v.dragStop(w)},onClick(w){g(w)}}),ae=se(()=>C.class instanceof Function?C.class(C):C.class),q=se(()=>{const w=(C.style instanceof Function?C.style(C):C.style)||{},I=C.width instanceof Function?C.width(C):C.width,M=C.height instanceof Function?C.height(C):C.height;return!w.width&&I&&(w.width=typeof I=="string"?I:`${I}px`),!w.height&&M&&(w.height=typeof M=="string"?M:`${M}px`),w}),J=ke(()=>Number(C.zIndex??q.value.zIndex??0));return c(w=>{(w.includes(e.id)||!w.length)&&fe()}),rt(()=>{$e(()=>C.hidden,(w=!1,I,M)=>{!w&&B.value&&(e.resizeObserver.observe(B.value),M(()=>{B.value&&e.resizeObserver.unobserve(B.value)}))},{immediate:!0,flush:"post"})}),$e([()=>C.type,()=>C.sourcePosition,()=>C.targetPosition],()=>{Ge(()=>{u([{id:e.id,nodeElement:B.value,forceUpdate:!0}])})}),$e([()=>C.position.x,()=>C.position.y,()=>{var w;return(w=W.value)==null?void 0:w.computedPosition.x},()=>{var w;return(w=W.value)==null?void 0:w.computedPosition.y},()=>{var w;return(w=W.value)==null?void 0:w.computedPosition.z},J,()=>C.selected,()=>C.dimensions.height,()=>C.dimensions.width,()=>{var w;return(w=W.value)==null?void 0:w.dimensions.height},()=>{var w;return(w=W.value)==null?void 0:w.dimensions.width}],([w,I,M,U,Z,re])=>{const le={x:w,y:I,z:re+(h.value&&C.selected?1e3:0)};typeof M<"u"&&typeof U<"u"?C.computedPosition=rg({x:M,y:U,z:Z},le):C.computedPosition=le},{flush:"post",immediate:!0}),$e([()=>C.extent,f],([w,I],[M,U])=>{(w!==M||I!==U)&&te()}),C.extent==="parent"||typeof C.extent=="object"&&"range"in C.extent&&C.extent.range==="parent"?Ei(()=>G).toBe(!0).then(te):te(),()=>C.hidden?null:xe("div",{ref:B,"data-id":C.id,class:["vue-flow__node",`vue-flow__node-${K.value===!1?"default":C.type||"default"}`,{[n.value]:y.value,dragging:ie==null?void 0:ie.value,draggable:y.value,selected:C.selected,selectable:O.value,parent:C.isParent},ae.value],style:{visibility:G.value?"visible":"hidden",zIndex:C.computedPosition.z??J.value,transform:`translate(${C.computedPosition.x}px,${C.computedPosition.y}px)`,pointerEvents:D.value?"all":"none",...q.value},tabIndex:R.value?0:void 0,role:R.value?"group":void 0,"aria-describedby":_.value?void 0:`${Ba}-${t}`,"aria-label":C.ariaLabel,"aria-roledescription":"node",...C.domAttributes,onMouseenter:we,onMousemove:de,onMouseleave:_e,onContextmenu:ce,onClick:g,onDblclick:ne,onKeydown:p},[xe(K.value===!1?d.value.default:K.value,{id:C.id,type:C.type,data:C.data,events:{...C.events,...x},selected:C.selected,resizing:C.resizing,dragging:ie.value,connectable:T.value,position:C.computedPosition,dimensions:C.dimensions,isValidTargetPos:C.isValidTargetPos,isValidSourcePos:C.isValidSourcePos,parent:C.parentNode,parentNodeId:C.parentNode,zIndex:C.computedPosition.z??J.value,targetPosition:C.targetPosition,sourcePosition:C.sourcePosition,label:C.label,dragHandle:C.dragHandle,onUpdateNodeInternals:fe})]);function te(){const w=C.computedPosition,{computedPosition:I,position:M}=ar(C,S.value?Ho(w,$.value):w,s.error,f.value,W.value);(C.computedPosition.x!==I.x||C.computedPosition.y!==I.y)&&(C.computedPosition={...C.computedPosition,...I}),(C.position.x!==M.x||C.position.y!==M.y)&&(C.position=M)}function fe(){B.value&&u([{id:e.id,nodeElement:B.value,forceUpdate:!0}])}function we(w){ie!=null&&ie.value||v.mouseEnter({event:w,node:C})}function de(w){ie!=null&&ie.value||v.mouseMove({event:w,node:C})}function _e(w){ie!=null&&ie.value||v.mouseLeave({event:w,node:C})}function ce(w){return v.contextMenu({event:w,node:C})}function ne(w){return v.doubleClick({event:w,node:C})}function g(w){O.value&&(!o.value||!y.value||N.value>0)&&Pi(C,r.value,l,a,i,!1,B.value),v.click({event:w,node:C})}function p(w){if(!(Oi(w)||_.value))if(La.includes(w.key)&&O.value){const I=w.key==="Escape";Pi(C,r.value,l,a,i,I,B.value)}else y.value&&C.selected&&Zt[w.key]&&(w.preventDefault(),b.value=`Moved selected node ${w.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~C.position.x}, y: ${~~C.position.y}`,z({x:Zt[w.key].x,y:Zt[w.key].y},w.shiftKey))}}}),Kv=qv;function Jv(e={includeHiddenNodes:!1}){const{nodes:t}=Se();return se(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&((n==null?void 0:n.handleBounds)===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Qv={class:"vue-flow__nodes vue-flow__container"},ep={name:"Nodes",compatConfig:{MODE:3}},tp=ye({...ep,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=Se(),i=Jv(),r=me();return $e(i,s=>{s&&Ge(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),rt(()=>{r.value=new ResizeObserver(s=>{const a=s.map(l=>({id:l.target.getAttribute("data-id"),nodeElement:l.target,forceUpdate:!0}));Ge(()=>n(a))})}),Zi(()=>{var s;return(s=r.value)==null?void 0:s.disconnect()}),(s,a)=>(L(),j("div",Qv,[r.value?(L(!0),j(Ce,{key:0},it(P(t),(l,u,c,d)=>{const f=[l.id];if(d&&d.key===l.id&&yu(d,f))return d;const h=(L(),Me(P(Kv),{id:l.id,key:l.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return h.memo=f,h},a,0),128)):Ne("",!0)]))}});function np(){const{emits:e}=Se();rt(()=>{if(Qa()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ae(De.MISSING_STYLES))}})}const op=k("div",{class:"vue-flow__edge-labels"},null,-1),ip={name:"VueFlow",compatConfig:{MODE:3}},rp=ye({...ip,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=ia(),r=Qo(o,"modelValue",n),s=Qo(o,"nodes",n),a=Qo(o,"edges",n),l=Se(o),u=Rg({modelValue:r,nodes:s,edges:a},o,l);return Bg(n,l.hooks),Pv(),np(),Pt(Fo,i),mu(u),t(l),(c,d)=>(L(),j("div",{ref:P(l).vueFlowRef,class:"vue-flow"},[be(Mv,null,{default:ze(()=>[be(Zv),op,be(tp),Ie(c.$slots,"zoom-pane")]),_:3}),Ie(c.$slots,"default"),be(Av)],512))}}),sp={name:"Panel",compatConfig:{MODE:3}},fl=ye({...sp,props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=Se(),o=se(()=>`${t.position}`.split("-"));return(i,r)=>(L(),j("div",{class:Oe(["vue-flow__panel",o.value]),style:ue({pointerEvents:P(n)?"none":"all"})},[Ie(i.$slots,"default")],6))}});var ft=(e=>(e.Lines="lines",e.Dots="dots",e))(ft||{});const hl=function({dimensions:e,size:t,color:n}){return xe("path",{stroke:n,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},gl=function({radius:e,color:t}){return xe("circle",{cx:e,cy:e,r:e,fill:t})};ft.Lines+"",ft.Dots+"";const ap={[ft.Dots]:"#81818a",[ft.Lines]:"#eee"},lp=["id","x","y","width","height","patternTransform"],up={key:2,height:"100",width:"100"},cp=["fill"],dp=["x","y","fill"],fp={name:"Background",compatConfig:{MODE:3}},hp=ye({...fp,props:{id:{},variant:{default:()=>ft.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:n}=Se(),o=se(()=>{const s=n.value.zoom,[a,l]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],u=[a*s||1,l*s||1],c=e.size*s,[d,f]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],h=[d*s||1+u[0]/2,f*s||1+u[1]/2];return{scaledGap:u,offset:h,size:c}}),i=ke(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=ke(()=>e.color||e.patternColor||ap[e.variant||ft.Dots]);return(s,a)=>(L(),j("svg",{class:"vue-flow__background vue-flow__container",style:ue({height:`${s.height>100?100:s.height}%`,width:`${s.width>100?100:s.width}%`})},[Ie(s.$slots,"pattern-container",{id:i.value},()=>[k("pattern",{id:i.value,x:P(n).x%o.value.scaledGap[0],y:P(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[Ie(s.$slots,"pattern",{},()=>[s.variant===P(ft).Lines?(L(),Me(P(hl),{key:0,size:s.lineWidth,color:r.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):s.variant===P(ft).Dots?(L(),Me(P(gl),{key:1,color:r.value,radius:o.value.size/2},null,8,["color","radius"])):Ne("",!0),s.bgColor?(L(),j("svg",up,[k("rect",{width:"100%",height:"100%",fill:s.bgColor},null,8,cp)])):Ne("",!0)])],8,lp)]),k("rect",{x:s.x,y:s.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,dp),Ie(s.$slots,"default",{id:i.value})],4))}}),gp={name:"ControlButton",compatConfig:{MODE:3}},vp=(e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n},pp={type:"button",class:"vue-flow__controls-button"};function mp(e,t,n,o,i,r){return L(),j("button",pp,[Ie(e.$slots,"default")])}const Jn=vp(gp,[["render",mp]]),wp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},yp=k("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1),_p=[yp];function bp(e,t){return L(),j("svg",wp,_p)}const kp={render:bp},Ep={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},$p=k("path",{d:"M0 0h32v4.2H0z"},null,-1),xp=[$p];function Np(e,t){return L(),j("svg",Ep,xp)}const Sp={render:Np},Cp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},Mp=k("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0 0 27.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1),Ip=[Mp];function Tp(e,t){return L(),j("svg",Cp,Ip)}const Op={render:Tp},Dp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Ap=k("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"},null,-1),Pp=[Ap];function Rp(e,t){return L(),j("svg",Dp,Pp)}const zp={render:Rp},Bp={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},Vp=k("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1),Lp=[Vp];function Hp(e,t){return L(),j("svg",Bp,Lp)}const Fp={render:Hp},Yp={name:"Controls",compatConfig:{MODE:3}},Gp=ye({...Yp,props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>za.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:r,zoomIn:s,zoomOut:a,fitView:l,viewport:u,minZoom:c,maxZoom:d}=Se(),f=ke(()=>n.value||o.value||i.value),h=ke(()=>u.value.zoom<=c.value),_=ke(()=>u.value.zoom>=d.value);function b(){s(),t("zoomIn")}function S(){a(),t("zoomOut")}function $(){l(e.fitViewParams),t("fitView")}function N(){r(!f.value),t("interactionChange",!f.value)}return(m,E)=>(L(),Me(P(fl),{class:"vue-flow__controls",position:m.position},{default:ze(()=>[Ie(m.$slots,"top"),m.showZoom?(L(),j(Ce,{key:0},[Ie(m.$slots,"control-zoom-in",{},()=>[be(Jn,{class:"vue-flow__controls-zoomin",disabled:_.value,onClick:b},{default:ze(()=>[Ie(m.$slots,"icon-zoom-in",{},()=>[(L(),Me(Nt(P(kp))))])]),_:3},8,["disabled"])]),Ie(m.$slots,"control-zoom-out",{},()=>[be(Jn,{class:"vue-flow__controls-zoomout",disabled:h.value,onClick:S},{default:ze(()=>[Ie(m.$slots,"icon-zoom-out",{},()=>[(L(),Me(Nt(P(Sp))))])]),_:3},8,["disabled"])])],64)):Ne("",!0),m.showFitView?Ie(m.$slots,"control-fit-view",{key:1},()=>[be(Jn,{class:"vue-flow__controls-fitview",onClick:$},{default:ze(()=>[Ie(m.$slots,"icon-fit-view",{},()=>[(L(),Me(Nt(P(Op))))])]),_:3})]):Ne("",!0),m.showInteractive?Ie(m.$slots,"control-interactive",{key:2},()=>[m.showInteractive?(L(),Me(Jn,{key:0,class:"vue-flow__controls-interactive",onClick:N},{default:ze(()=>[f.value?Ie(m.$slots,"icon-unlock",{key:0},()=>[(L(),Me(Nt(P(Fp))))]):Ne("",!0),f.value?Ne("",!0):Ie(m.$slots,"icon-lock",{key:1},()=>[(L(),Me(Nt(P(zp))))])]),_:3})):Ne("",!0)]):Ne("",!0),Ie(m.$slots,"default")]),_:3},8,["position"]))}});var Xp={value:()=>{}};function cr(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new co(n)}function co(e){this._=e}function Wp(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}co.prototype=cr.prototype={constructor:co,on:function(e,t){var n=this._,o=Wp(e+"",n),i,r=-1,s=o.length;if(arguments.length<2){for(;++r<s;)if((i=(e=o[r]).type)&&(i=jp(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<s;)if(i=(e=o[r]).type)n[i]=ds(n[i],e.name,t);else if(t==null)for(i in n)n[i]=ds(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new co(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,r;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)}};function jp(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function ds(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Xp,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var zi="http://www.w3.org/1999/xhtml";const fs={svg:"http://www.w3.org/2000/svg",xhtml:zi,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jo(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),fs.hasOwnProperty(t)?{space:fs[t],local:e}:e}function Up(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===zi&&t.documentElement.namespaceURI===zi?t.createElement(e):t.createElementNS(n,e)}}function Zp(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vl(e){var t=jo(e);return(t.local?Zp:Up)(t)}function qp(){}function dr(e){return e==null?qp:function(){return this.querySelector(e)}}function Kp(e){typeof e!="function"&&(e=dr(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=new Array(s),l,u,c=0;c<s;++c)(l=r[c])&&(u=e.call(l,l.__data__,c,r))&&("__data__"in l&&(u.__data__=l.__data__),a[c]=u);return new He(o,this._parents)}function Jp(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Qp(){return[]}function pl(e){return e==null?Qp:function(){return this.querySelectorAll(e)}}function em(e){return function(){return Jp(e.apply(this,arguments))}}function tm(e){typeof e=="function"?e=em(e):e=pl(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var s=t[r],a=s.length,l,u=0;u<a;++u)(l=s[u])&&(o.push(e.call(l,l.__data__,u,s)),i.push(l));return new He(o,i)}function ml(e){return function(){return this.matches(e)}}function wl(e){return function(t){return t.matches(e)}}var nm=Array.prototype.find;function om(e){return function(){return nm.call(this.children,e)}}function im(){return this.firstElementChild}function rm(e){return this.select(e==null?im:om(typeof e=="function"?e:wl(e)))}var sm=Array.prototype.filter;function am(){return Array.from(this.children)}function lm(e){return function(){return sm.call(this.children,e)}}function um(e){return this.selectAll(e==null?am:lm(typeof e=="function"?e:wl(e)))}function cm(e){typeof e!="function"&&(e=ml(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=[],l,u=0;u<s;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new He(o,this._parents)}function yl(e){return new Array(e.length)}function dm(){return new He(this._enter||this._groups.map(yl),this._parents)}function So(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}So.prototype={constructor:So,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fm(e){return function(){return e}}function hm(e,t,n,o,i,r){for(var s=0,a,l=t.length,u=r.length;s<u;++s)(a=t[s])?(a.__data__=r[s],o[s]=a):n[s]=new So(e,r[s]);for(;s<l;++s)(a=t[s])&&(i[s]=a)}function gm(e,t,n,o,i,r,s){var a,l,u=new Map,c=t.length,d=r.length,f=new Array(c),h;for(a=0;a<c;++a)(l=t[a])&&(f[a]=h=s.call(l,l.__data__,a,t)+"",u.has(h)?i[a]=l:u.set(h,l));for(a=0;a<d;++a)h=s.call(e,r[a],a,r)+"",(l=u.get(h))?(o[a]=l,l.__data__=r[a],u.delete(h)):n[a]=new So(e,r[a]);for(a=0;a<c;++a)(l=t[a])&&u.get(f[a])===l&&(i[a]=l)}function vm(e){return e.__data__}function pm(e,t){if(!arguments.length)return Array.from(this,vm);var n=t?gm:hm,o=this._parents,i=this._groups;typeof e!="function"&&(e=fm(e));for(var r=i.length,s=new Array(r),a=new Array(r),l=new Array(r),u=0;u<r;++u){var c=o[u],d=i[u],f=d.length,h=mm(e.call(c,c&&c.__data__,u,o)),_=h.length,b=a[u]=new Array(_),S=s[u]=new Array(_),$=l[u]=new Array(f);n(c,d,b,S,$,h,t);for(var N=0,m=0,E,A;N<_;++N)if(E=b[N]){for(N>=m&&(m=N+1);!(A=S[m])&&++m<_;);E._next=A||null}}return s=new He(s,o),s._enter=a,s._exit=l,s}function mm(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function wm(){return new He(this._exit||this._groups.map(yl),this._parents)}function ym(e,t,n){var o=this.enter(),i=this,r=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?r.remove():n(r),o&&i?o.merge(i).order():i}function _m(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,s=Math.min(i,r),a=new Array(i),l=0;l<s;++l)for(var u=n[l],c=o[l],d=u.length,f=a[l]=new Array(d),h,_=0;_<d;++_)(h=u[_]||c[_])&&(f[_]=h);for(;l<i;++l)a[l]=n[l];return new He(a,this._parents)}function bm(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],s;--i>=0;)(s=o[i])&&(r&&s.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(s,r),r=s);return this}function km(e){e||(e=Em);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var s=n[r],a=s.length,l=i[r]=new Array(a),u,c=0;c<a;++c)(u=s[c])&&(l[c]=u);l.sort(t)}return new He(i,this._parents).order()}function Em(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function $m(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function xm(){return Array.from(this)}function Nm(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var s=o[i];if(s)return s}return null}function Sm(){let e=0;for(const t of this)++e;return e}function Cm(){return!this.node()}function Mm(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,s=i.length,a;r<s;++r)(a=i[r])&&e.call(a,a.__data__,r,i);return this}function Im(e){return function(){this.removeAttribute(e)}}function Tm(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Om(e,t){return function(){this.setAttribute(e,t)}}function Dm(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Am(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Pm(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Rm(e,t){var n=jo(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Tm:Im:typeof t=="function"?n.local?Pm:Am:n.local?Dm:Om)(n,t))}function _l(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zm(e){return function(){this.style.removeProperty(e)}}function Bm(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Vm(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Lm(e,t,n){return arguments.length>1?this.each((t==null?zm:typeof t=="function"?Vm:Bm)(e,t,n??"")):tn(this.node(),e)}function tn(e,t){return e.style.getPropertyValue(t)||_l(e).getComputedStyle(e,null).getPropertyValue(t)}function Hm(e){return function(){delete this[e]}}function Fm(e,t){return function(){this[e]=t}}function Ym(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Gm(e,t){return arguments.length>1?this.each((t==null?Hm:typeof t=="function"?Ym:Fm)(e,t)):this.node()[e]}function bl(e){return e.trim().split(/^|\s+/)}function fr(e){return e.classList||new kl(e)}function kl(e){this._node=e,this._names=bl(e.getAttribute("class")||"")}kl.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function El(e,t){for(var n=fr(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function $l(e,t){for(var n=fr(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Xm(e){return function(){El(this,e)}}function Wm(e){return function(){$l(this,e)}}function jm(e,t){return function(){(t.apply(this,arguments)?El:$l)(this,e)}}function Um(e,t){var n=bl(e+"");if(arguments.length<2){for(var o=fr(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?jm:t?Xm:Wm)(n,t))}function Zm(){this.textContent=""}function qm(e){return function(){this.textContent=e}}function Km(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Jm(e){return arguments.length?this.each(e==null?Zm:(typeof e=="function"?Km:qm)(e)):this.node().textContent}function Qm(){this.innerHTML=""}function ew(e){return function(){this.innerHTML=e}}function tw(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nw(e){return arguments.length?this.each(e==null?Qm:(typeof e=="function"?tw:ew)(e)):this.node().innerHTML}function ow(){this.nextSibling&&this.parentNode.appendChild(this)}function iw(){return this.each(ow)}function rw(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function sw(){return this.each(rw)}function aw(e){var t=typeof e=="function"?e:vl(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function lw(){return null}function uw(e,t){var n=typeof e=="function"?e:vl(e),o=t==null?lw:typeof t=="function"?t:dr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function cw(){var e=this.parentNode;e&&e.removeChild(this)}function dw(){return this.each(cw)}function fw(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hw(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function gw(e){return this.select(e?hw:fw)}function vw(e){return arguments.length?this.property("__data__",e):this.node().__data__}function pw(e){return function(t){e.call(this,t,this.__data__)}}function mw(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function ww(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,r;n<i;++n)r=t[n],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++o]=r;++o?t.length=o:delete this.__on}}}function yw(e,t,n){return function(){var o=this.__on,i,r=pw(t);if(o){for(var s=0,a=o.length;s<a;++s)if((i=o[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=t;return}}this.addEventListener(e.type,r,n),i={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(i):this.__on=[i]}}function _w(e,t,n){var o=mw(e+""),i,r=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,u=a.length,c;l<u;++l)for(i=0,c=a[l];i<r;++i)if((s=o[i]).type===c.type&&s.name===c.name)return c.value}return}for(a=t?yw:ww,i=0;i<r;++i)this.each(a(o[i],t,n));return this}function xl(e,t,n){var o=_l(e),i=o.CustomEvent;typeof i=="function"?i=new i(t,n):(i=o.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function bw(e,t){return function(){return xl(this,e,t)}}function kw(e,t){return function(){return xl(this,e,t.apply(this,arguments))}}function Ew(e,t){return this.each((typeof t=="function"?kw:bw)(e,t))}function*$w(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,s;i<r;++i)(s=o[i])&&(yield s)}var Nl=[null];function He(e,t){this._groups=e,this._parents=t}function Bn(){return new He([[document.documentElement]],Nl)}function xw(){return this}He.prototype=Bn.prototype={constructor:He,select:Kp,selectAll:tm,selectChild:rm,selectChildren:um,filter:cm,data:pm,enter:dm,exit:wm,join:ym,merge:_m,selection:xw,order:bm,sort:km,call:$m,nodes:xm,node:Nm,size:Sm,empty:Cm,each:Mm,attr:Rm,style:Lm,property:Gm,classed:Um,text:Jm,html:nw,raise:iw,lower:sw,append:aw,insert:uw,remove:dw,clone:gw,datum:vw,on:_w,dispatch:Ew,[Symbol.iterator]:$w};function kt(e){return typeof e=="string"?new He([[document.querySelector(e)]],[document.documentElement]):new He([[e]],Nl)}function Nw(e){let t;for(;t=e.sourceEvent;)e=t;return e}function yt(e,t){if(e=Nw(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const Bi={capture:!0,passive:!1};function Vi(e){e.preventDefault(),e.stopImmediatePropagation()}function Sw(e){var t=e.document.documentElement,n=kt(e).on("dragstart.drag",Vi,Bi);"onselectstart"in t?n.on("selectstart.drag",Vi,Bi):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Cw(e,t){var n=e.document.documentElement,o=kt(e).on("dragstart.drag",null);t&&(o.on("click.drag",Vi,Bi),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function hr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Sl(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Vn(){}var In=.7,Co=1/In,qt="\\s*([+-]?\\d+)\\s*",Tn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ot="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Mw=/^#([0-9a-f]{3,8})$/,Iw=new RegExp(`^rgb\\(${qt},${qt},${qt}\\)$`),Tw=new RegExp(`^rgb\\(${ot},${ot},${ot}\\)$`),Ow=new RegExp(`^rgba\\(${qt},${qt},${qt},${Tn}\\)$`),Dw=new RegExp(`^rgba\\(${ot},${ot},${ot},${Tn}\\)$`),Aw=new RegExp(`^hsl\\(${Tn},${ot},${ot}\\)$`),Pw=new RegExp(`^hsla\\(${Tn},${ot},${ot},${Tn}\\)$`),hs={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};hr(Vn,On,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gs,formatHex:gs,formatHex8:Rw,formatHsl:zw,formatRgb:vs,toString:vs});function gs(){return this.rgb().formatHex()}function Rw(){return this.rgb().formatHex8()}function zw(){return Cl(this).formatHsl()}function vs(){return this.rgb().formatRgb()}function On(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Mw.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ps(t):n===3?new Ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Qn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Qn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Iw.exec(e))?new Ve(t[1],t[2],t[3],1):(t=Tw.exec(e))?new Ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ow.exec(e))?Qn(t[1],t[2],t[3],t[4]):(t=Dw.exec(e))?Qn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Aw.exec(e))?ys(t[1],t[2]/100,t[3]/100,1):(t=Pw.exec(e))?ys(t[1],t[2]/100,t[3]/100,t[4]):hs.hasOwnProperty(e)?ps(hs[e]):e==="transparent"?new Ve(NaN,NaN,NaN,0):null}function ps(e){return new Ve(e>>16&255,e>>8&255,e&255,1)}function Qn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Ve(e,t,n,o)}function Bw(e){return e instanceof Vn||(e=On(e)),e?(e=e.rgb(),new Ve(e.r,e.g,e.b,e.opacity)):new Ve}function Li(e,t,n,o){return arguments.length===1?Bw(e):new Ve(e,t,n,o??1)}function Ve(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}hr(Ve,Li,Sl(Vn,{brighter(e){return e=e==null?Co:Math.pow(Co,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?In:Math.pow(In,e),new Ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ve(At(this.r),At(this.g),At(this.b),Mo(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ms,formatHex:ms,formatHex8:Vw,formatRgb:ws,toString:ws}));function ms(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}`}function Vw(){return`#${Tt(this.r)}${Tt(this.g)}${Tt(this.b)}${Tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function ws(){const e=Mo(this.opacity);return`${e===1?"rgb(":"rgba("}${At(this.r)}, ${At(this.g)}, ${At(this.b)}${e===1?")":`, ${e})`}`}function Mo(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function At(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Tt(e){return e=At(e),(e<16?"0":"")+e.toString(16)}function ys(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new je(e,t,n,o)}function Cl(e){if(e instanceof je)return new je(e.h,e.s,e.l,e.opacity);if(e instanceof Vn||(e=On(e)),!e)return new je;if(e instanceof je)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),s=NaN,a=r-i,l=(r+i)/2;return a?(t===r?s=(n-o)/a+(n<o)*6:n===r?s=(o-t)/a+2:s=(t-n)/a+4,a/=l<.5?r+i:2-r-i,s*=60):a=l>0&&l<1?0:s,new je(s,a,l,e.opacity)}function Lw(e,t,n,o){return arguments.length===1?Cl(e):new je(e,t,n,o??1)}function je(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}hr(je,Lw,Sl(Vn,{brighter(e){return e=e==null?Co:Math.pow(Co,e),new je(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?In:Math.pow(In,e),new je(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new Ve(ci(e>=240?e-240:e+120,i,o),ci(e,i,o),ci(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new je(_s(this.h),eo(this.s),eo(this.l),Mo(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Mo(this.opacity);return`${e===1?"hsl(":"hsla("}${_s(this.h)}, ${eo(this.s)*100}%, ${eo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function _s(e){return e=(e||0)%360,e<0?e+360:e}function eo(e){return Math.max(0,Math.min(1,e||0))}function ci(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Ml=e=>()=>e;function Hw(e,t){return function(n){return e+n*t}}function Fw(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function Yw(e){return(e=+e)==1?Il:function(t,n){return n-t?Fw(t,n,e):Ml(isNaN(t)?n:t)}}function Il(e,t){var n=t-e;return n?Hw(e,n):Ml(isNaN(e)?t:e)}const bs=function e(t){var n=Yw(t);function o(i,r){var s=n((i=Li(i)).r,(r=Li(r)).r),a=n(i.g,r.g),l=n(i.b,r.b),u=Il(i.opacity,r.opacity);return function(c){return i.r=s(c),i.g=a(c),i.b=l(c),i.opacity=u(c),i+""}}return o.gamma=e,o}(1);function bt(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Hi=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,di=new RegExp(Hi.source,"g");function Gw(e){return function(){return e}}function Xw(e){return function(t){return e(t)+""}}function Ww(e,t){var n=Hi.lastIndex=di.lastIndex=0,o,i,r,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Hi.exec(e))&&(i=di.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),a[s]?a[s]+=r:a[++s]=r),(o=o[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,l.push({i:s,x:bt(o,i)})),n=di.lastIndex;return n<t.length&&(r=t.slice(n),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?Xw(l[0].x):Gw(t):(t=l.length,function(u){for(var c=0,d;c<t;++c)a[(d=l[c]).i]=d.x(u);return a.join("")})}var ks=180/Math.PI,Fi={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Tl(e,t,n,o,i,r){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*ks,skewX:Math.atan(l)*ks,scaleX:s,scaleY:a}}var to;function jw(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Fi:Tl(t.a,t.b,t.c,t.d,t.e,t.f)}function Uw(e){return e==null||(to||(to=document.createElementNS("http://www.w3.org/2000/svg","g")),to.setAttribute("transform",e),!(e=to.transform.baseVal.consolidate()))?Fi:(e=e.matrix,Tl(e.a,e.b,e.c,e.d,e.e,e.f))}function Ol(e,t,n,o){function i(u){return u.length?u.pop()+" ":""}function r(u,c,d,f,h,_){if(u!==d||c!==f){var b=h.push("translate(",null,t,null,n);_.push({i:b-4,x:bt(u,d)},{i:b-2,x:bt(c,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function s(u,c,d,f){u!==c?(u-c>180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,o)-2,x:bt(u,c)})):c&&d.push(i(d)+"rotate("+c+o)}function a(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,o)-2,x:bt(u,c)}):c&&d.push(i(d)+"skewX("+c+o)}function l(u,c,d,f,h,_){if(u!==d||c!==f){var b=h.push(i(h)+"scale(",null,",",null,")");_.push({i:b-4,x:bt(u,d)},{i:b-2,x:bt(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),r(u.translateX,u.translateY,c.translateX,c.translateY,d,f),s(u.rotate,c.rotate,d,f),a(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var _=-1,b=f.length,S;++_<b;)d[(S=f[_]).i]=S.x(h);return d.join("")}}}var Zw=Ol(jw,"px, ","px)","deg)"),qw=Ol(Uw,", ",")",")"),Kw=1e-12;function Es(e){return((e=Math.exp(e))+1/e)/2}function Jw(e){return((e=Math.exp(e))-1/e)/2}function Qw(e){return((e=Math.exp(2*e))-1)/(e+1)}const ey=function e(t,n,o){function i(r,s){var a=r[0],l=r[1],u=r[2],c=s[0],d=s[1],f=s[2],h=c-a,_=d-l,b=h*h+_*_,S,$;if(b<Kw)$=Math.log(f/u)/t,S=function(F){return[a+F*h,l+F*_,u*Math.exp(t*F*$)]};else{var N=Math.sqrt(b),m=(f*f-u*u+o*b)/(2*u*n*N),E=(f*f-u*u-o*b)/(2*f*n*N),A=Math.log(Math.sqrt(m*m+1)-m),V=Math.log(Math.sqrt(E*E+1)-E);$=(V-A)/t,S=function(F){var B=F*$,X=Es(A),H=u/(n*N)*(X*Qw(t*B+A)-Jw(A));return[a+H*h,l+H*_,u*X/Es(t*B+A)]}}return S.duration=$*1e3*t/Math.SQRT2,S}return i.rho=function(r){var s=Math.max(.001,+r),a=s*s,l=a*a;return e(s,a,l)},i}(Math.SQRT2,2,4);var nn=0,vn=0,un=0,Dl=1e3,Io,pn,To=0,Vt=0,Uo=0,Dn=typeof performance=="object"&&performance.now?performance:Date,Al=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function gr(){return Vt||(Al(ty),Vt=Dn.now()+Uo)}function ty(){Vt=0}function Oo(){this._call=this._time=this._next=null}Oo.prototype=Pl.prototype={constructor:Oo,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?gr():+n)+(t==null?0:+t),!this._next&&pn!==this&&(pn?pn._next=this:Io=this,pn=this),this._call=e,this._time=n,Yi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yi())}};function Pl(e,t,n){var o=new Oo;return o.restart(e,t,n),o}function ny(){gr(),++nn;for(var e=Io,t;e;)(t=Vt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nn}function $s(){Vt=(To=Dn.now())+Uo,nn=vn=0;try{ny()}finally{nn=0,iy(),Vt=0}}function oy(){var e=Dn.now(),t=e-To;t>Dl&&(Uo-=t,To=e)}function iy(){for(var e,t=Io,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Io=n);pn=e,Yi(o)}function Yi(e){if(!nn){vn&&(vn=clearTimeout(vn));var t=e-Vt;t>24?(e<1/0&&(vn=setTimeout($s,e-Dn.now()-Uo)),un&&(un=clearInterval(un))):(un||(To=Dn.now(),un=setInterval(oy,Dl)),nn=1,Al($s))}}function xs(e,t,n){var o=new Oo;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var ry=cr("start","end","cancel","interrupt"),sy=[],Rl=0,Ns=1,Gi=2,fo=3,Ss=4,Xi=5,ho=6;function Zo(e,t,n,o,i,r){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;ay(e,n,{name:t,index:o,group:i,on:ry,tween:sy,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Rl})}function vr(e,t){var n=Ze(e,t);if(n.state>Rl)throw new Error("too late; already scheduled");return n}function at(e,t){var n=Ze(e,t);if(n.state>fo)throw new Error("too late; already running");return n}function Ze(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ay(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=Pl(r,0,n.time);function r(u){n.state=Ns,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var c,d,f,h;if(n.state!==Ns)return l();for(c in o)if(h=o[c],h.name===n.name){if(h.state===fo)return xs(s);h.state===Ss?(h.state=ho,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[c]):+c<t&&(h.state=ho,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[c])}if(xs(function(){n.state===fo&&(n.state=Ss,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Gi,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Gi){for(n.state=fo,i=new Array(f=n.tween.length),c=0,d=-1;c<f;++c)(h=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=h);i.length=d+1}}function a(u){for(var c=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(l),n.state=Xi,1),d=-1,f=i.length;++d<f;)i[d].call(e,c);n.state===Xi&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=ho,n.timer.stop(),delete o[t];for(var u in o)return;delete e.__transition}}function go(e,t){var n=e.__transition,o,i,r=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){r=!1;continue}i=o.state>Gi&&o.state<Xi,o.state=ho,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}r&&delete e.__transition}}function ly(e){return this.each(function(){go(this,e)})}function uy(e,t){var n,o;return function(){var i=at(this,e),r=i.tween;if(r!==n){o=n=r;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}i.tween=o}}function cy(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=at(this,e),s=r.tween;if(s!==o){i=(o=s).slice();for(var a={name:t,value:n},l=0,u=i.length;l<u;++l)if(i[l].name===t){i[l]=a;break}l===u&&i.push(a)}r.tween=i}}function dy(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=Ze(this.node(),n).tween,i=0,r=o.length,s;i<r;++i)if((s=o[i]).name===e)return s.value;return null}return this.each((t==null?uy:cy)(n,e,t))}function pr(e,t,n){var o=e._id;return e.each(function(){var i=at(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ze(i,o).value[t]}}function zl(e,t){var n;return(typeof t=="number"?bt:t instanceof On?bs:(n=On(t))?(t=n,bs):Ww)(e,t)}function fy(e){return function(){this.removeAttribute(e)}}function hy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function gy(e,t,n){var o,i=n+"",r;return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function vy(e,t,n){var o,i=n+"",r;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function py(e,t,n){var o,i,r;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a)))}}function my(e,t,n){var o,i,r;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a)))}}function wy(e,t){var n=jo(e),o=n==="transform"?qw:zl;return this.attrTween(e,typeof t=="function"?(n.local?my:py)(n,o,pr(this,"attr."+e,t)):t==null?(n.local?hy:fy)(n):(n.local?vy:gy)(n,o,t))}function yy(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function _y(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function by(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&_y(e,r)),n}return i._value=t,i}function ky(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&yy(e,r)),n}return i._value=t,i}function Ey(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=jo(e);return this.tween(n,(o.local?by:ky)(o,t))}function $y(e,t){return function(){vr(this,e).delay=+t.apply(this,arguments)}}function xy(e,t){return t=+t,function(){vr(this,e).delay=t}}function Ny(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?$y:xy)(t,e)):Ze(this.node(),t).delay}function Sy(e,t){return function(){at(this,e).duration=+t.apply(this,arguments)}}function Cy(e,t){return t=+t,function(){at(this,e).duration=t}}function My(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Sy:Cy)(t,e)):Ze(this.node(),t).duration}function Iy(e,t){if(typeof t!="function")throw new Error;return function(){at(this,e).ease=t}}function Ty(e){var t=this._id;return arguments.length?this.each(Iy(t,e)):Ze(this.node(),t).ease}function Oy(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;at(this,e).ease=n}}function Dy(e){if(typeof e!="function")throw new Error;return this.each(Oy(this._id,e))}function Ay(e){typeof e!="function"&&(e=ml(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],s=r.length,a=o[i]=[],l,u=0;u<s;++u)(l=r[u])&&e.call(l,l.__data__,u,r)&&a.push(l);return new vt(o,this._parents,this._name,this._id)}function Py(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),s=new Array(o),a=0;a<r;++a)for(var l=t[a],u=n[a],c=l.length,d=s[a]=new Array(c),f,h=0;h<c;++h)(f=l[h]||u[h])&&(d[h]=f);for(;a<o;++a)s[a]=t[a];return new vt(s,this._parents,this._name,this._id)}function Ry(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function zy(e,t,n){var o,i,r=Ry(t)?vr:at;return function(){var s=r(this,e),a=s.on;a!==o&&(i=(o=a).copy()).on(t,n),s.on=i}}function By(e,t){var n=this._id;return arguments.length<2?Ze(this.node(),n).on.on(e):this.each(zy(n,e,t))}function Vy(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ly(){return this.on("end.remove",Vy(this._id))}function Hy(e){var t=this._name,n=this._id;typeof e!="function"&&(e=dr(e));for(var o=this._groups,i=o.length,r=new Array(i),s=0;s<i;++s)for(var a=o[s],l=a.length,u=r[s]=new Array(l),c,d,f=0;f<l;++f)(c=a[f])&&(d=e.call(c,c.__data__,f,a))&&("__data__"in c&&(d.__data__=c.__data__),u[f]=d,Zo(u[f],t,n,f,u,Ze(c,n)));return new vt(r,this._parents,t,n)}function Fy(e){var t=this._name,n=this._id;typeof e!="function"&&(e=pl(e));for(var o=this._groups,i=o.length,r=[],s=[],a=0;a<i;++a)for(var l=o[a],u=l.length,c,d=0;d<u;++d)if(c=l[d]){for(var f=e.call(c,c.__data__,d,l),h,_=Ze(c,n),b=0,S=f.length;b<S;++b)(h=f[b])&&Zo(h,t,n,b,f,_);r.push(f),s.push(c)}return new vt(r,s,t,n)}var Yy=Bn.prototype.constructor;function Gy(){return new Yy(this._groups,this._parents)}function Xy(e,t){var n,o,i;return function(){var r=tn(this,e),s=(this.style.removeProperty(e),tn(this,e));return r===s?null:r===n&&s===o?i:i=t(n=r,o=s)}}function Bl(e){return function(){this.style.removeProperty(e)}}function Wy(e,t,n){var o,i=n+"",r;return function(){var s=tn(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}function jy(e,t,n){var o,i,r;return function(){var s=tn(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),tn(this,e))),s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a))}}function Uy(e,t){var n,o,i,r="style."+t,s="end."+r,a;return function(){var l=at(this,e),u=l.on,c=l.value[r]==null?a||(a=Bl(t)):void 0;(u!==n||i!==c)&&(o=(n=u).copy()).on(s,i=c),l.on=o}}function Zy(e,t,n){var o=(e+="")=="transform"?Zw:zl;return t==null?this.styleTween(e,Xy(e,o)).on("end.style."+e,Bl(e)):typeof t=="function"?this.styleTween(e,jy(e,o,pr(this,"style."+e,t))).each(Uy(this._id,e)):this.styleTween(e,Wy(e,o,t),n).on("end.style."+e,null)}function qy(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Ky(e,t,n){var o,i;function r(){var s=t.apply(this,arguments);return s!==i&&(o=(i=s)&&qy(e,s,n)),o}return r._value=t,r}function Jy(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Ky(e,t,n??""))}function Qy(e){return function(){this.textContent=e}}function e0(e){return function(){var t=e(this);this.textContent=t??""}}function t0(e){return this.tween("text",typeof e=="function"?e0(pr(this,"text",e)):Qy(e==null?"":e+""))}function n0(e){return function(t){this.textContent=e.call(this,t)}}function o0(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&n0(i)),t}return o._value=e,o}function i0(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,o0(e))}function r0(){for(var e=this._name,t=this._id,n=Vl(),o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],a=s.length,l,u=0;u<a;++u)if(l=s[u]){var c=Ze(l,t);Zo(l,e,n,u,s,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new vt(o,this._parents,e,n)}function s0(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,s){var a={value:s},l={value:function(){--i===0&&r()}};n.each(function(){var u=at(this,o),c=u.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),u.on=t}),i===0&&r()})}var a0=0;function vt(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vl(){return++a0}var ut=Bn.prototype;vt.prototype={constructor:vt,select:Hy,selectAll:Fy,selectChild:ut.selectChild,selectChildren:ut.selectChildren,filter:Ay,merge:Py,selection:Gy,transition:r0,call:ut.call,nodes:ut.nodes,node:ut.node,size:ut.size,empty:ut.empty,each:ut.each,on:By,attr:wy,attrTween:Ey,style:Zy,styleTween:Jy,text:t0,textTween:i0,remove:Ly,tween:dy,delay:Ny,duration:My,ease:Ty,easeVarying:Dy,end:s0,[Symbol.iterator]:ut[Symbol.iterator]};function l0(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var u0={time:null,delay:0,duration:250,ease:l0};function c0(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function d0(e){var t,n;e instanceof vt?(t=e._id,e=e._name):(t=Vl(),(n=u0).time=gr(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],a=s.length,l,u=0;u<a;++u)(l=s[u])&&Zo(l,e,t,u,s,n||c0(l,t));return new vt(o,this._parents,e,t)}Bn.prototype.interrupt=ly;Bn.prototype.transition=d0;const no=e=>()=>e;function f0(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function ht(e,t,n){this.k=e,this.x=t,this.y=n}ht.prototype={constructor:ht,scale:function(e){return e===1?this:new ht(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ht(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var mr=new ht(1,0,0);ht.prototype;function fi(e){e.stopImmediatePropagation()}function cn(e){e.preventDefault(),e.stopImmediatePropagation()}function h0(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function g0(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Cs(){return this.__zoom||mr}function v0(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function p0(){return navigator.maxTouchPoints||"ontouchstart"in this}function m0(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s))}function w0(){var e=h0,t=g0,n=m0,o=v0,i=p0,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=ey,u=cr("start","zoom","end"),c,d,f,h=500,_=150,b=0,S=10;function $(v){v.property("__zoom",Cs).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",X).on("dblclick.zoom",H).filter(i).on("touchstart.zoom",z).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}$.transform=function(v,x,y,O){var T=v.selection?v.selection():v;T.property("__zoom",Cs),v!==T?A(v,x,y,O):T.interrupt().each(function(){V(this,arguments).event(O).start().zoom(null,typeof x=="function"?x.apply(this,arguments):x).end()})},$.scaleBy=function(v,x,y,O){$.scaleTo(v,function(){var T=this.__zoom.k,R=typeof x=="function"?x.apply(this,arguments):x;return T*R},y,O)},$.scaleTo=function(v,x,y,O){$.transform(v,function(){var T=t.apply(this,arguments),R=this.__zoom,D=y==null?E(T):typeof y=="function"?y.apply(this,arguments):y,G=R.invert(D),K=typeof x=="function"?x.apply(this,arguments):x;return n(m(N(R,K),D,G),T,s)},y,O)},$.translateBy=function(v,x,y,O){$.transform(v,function(){return n(this.__zoom.translate(typeof x=="function"?x.apply(this,arguments):x,typeof y=="function"?y.apply(this,arguments):y),t.apply(this,arguments),s)},null,O)},$.translateTo=function(v,x,y,O,T){$.transform(v,function(){var R=t.apply(this,arguments),D=this.__zoom,G=O==null?E(R):typeof O=="function"?O.apply(this,arguments):O;return n(mr.translate(G[0],G[1]).scale(D.k).translate(typeof x=="function"?-x.apply(this,arguments):-x,typeof y=="function"?-y.apply(this,arguments):-y),R,s)},O,T)};function N(v,x){return x=Math.max(r[0],Math.min(r[1],x)),x===v.k?v:new ht(x,v.x,v.y)}function m(v,x,y){var O=x[0]-y[0]*v.k,T=x[1]-y[1]*v.k;return O===v.x&&T===v.y?v:new ht(v.k,O,T)}function E(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function A(v,x,y,O){v.on("start.zoom",function(){V(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){V(this,arguments).event(O).end()}).tween("zoom",function(){var T=this,R=arguments,D=V(T,R).event(O),G=t.apply(T,R),K=y==null?E(G):typeof y=="function"?y.apply(T,R):y,ie=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),ae=T.__zoom,q=typeof x=="function"?x.apply(T,R):x,J=l(ae.invert(K).concat(ie/ae.k),q.invert(K).concat(ie/q.k));return function(te){if(te===1)te=q;else{var fe=J(te),we=ie/fe[2];te=new ht(we,K[0]-fe[0]*we,K[1]-fe[1]*we)}D.zoom(null,te)}})}function V(v,x,y){return!y&&v.__zooming||new F(v,x)}function F(v,x){this.that=v,this.args=x,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,x),this.taps=0}F.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,x){return this.mouse&&v!=="mouse"&&(this.mouse[1]=x.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=x.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=x.invert(this.touch1[0])),this.that.__zoom=x,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var x=kt(this.that).datum();u.call(v,this.that,new f0(v,{sourceEvent:this.sourceEvent,target:$,transform:this.that.__zoom,dispatch:u}),x)}};function B(v,...x){if(!e.apply(this,arguments))return;var y=V(this,x).event(v),O=this.__zoom,T=Math.max(r[0],Math.min(r[1],O.k*Math.pow(2,o.apply(this,arguments)))),R=yt(v);if(y.wheel)(y.mouse[0][0]!==R[0]||y.mouse[0][1]!==R[1])&&(y.mouse[1]=O.invert(y.mouse[0]=R)),clearTimeout(y.wheel);else{if(O.k===T)return;y.mouse=[R,O.invert(R)],go(this),y.start()}cn(v),y.wheel=setTimeout(D,_),y.zoom("mouse",n(m(N(O,T),y.mouse[0],y.mouse[1]),y.extent,s));function D(){y.wheel=null,y.end()}}function X(v,...x){if(f||!e.apply(this,arguments))return;var y=v.currentTarget,O=V(this,x,!0).event(v),T=kt(v.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",ie,!0),R=yt(v,y),D=v.clientX,G=v.clientY;Sw(v.view),fi(v),O.mouse=[R,this.__zoom.invert(R)],go(this),O.start();function K(ae){if(cn(ae),!O.moved){var q=ae.clientX-D,J=ae.clientY-G;O.moved=q*q+J*J>b}O.event(ae).zoom("mouse",n(m(O.that.__zoom,O.mouse[0]=yt(ae,y),O.mouse[1]),O.extent,s))}function ie(ae){T.on("mousemove.zoom mouseup.zoom",null),Cw(ae.view,O.moved),cn(ae),O.event(ae).end()}}function H(v,...x){if(e.apply(this,arguments)){var y=this.__zoom,O=yt(v.changedTouches?v.changedTouches[0]:v,this),T=y.invert(O),R=y.k*(v.shiftKey?.5:2),D=n(m(N(y,R),O,T),t.apply(this,x),s);cn(v),a>0?kt(this).transition().duration(a).call(A,D,O,v):kt(this).call($.transform,D,O,v)}}function z(v,...x){if(e.apply(this,arguments)){var y=v.touches,O=y.length,T=V(this,x,v.changedTouches.length===O).event(v),R,D,G,K;for(fi(v),D=0;D<O;++D)G=y[D],K=yt(G,this),K=[K,this.__zoom.invert(K),G.identifier],T.touch0?!T.touch1&&T.touch0[2]!==K[2]&&(T.touch1=K,T.taps=0):(T.touch0=K,R=!0,T.taps=1+!!c);c&&(c=clearTimeout(c)),R&&(T.taps<2&&(d=K[0],c=setTimeout(function(){c=null},h)),go(this),T.start())}}function C(v,...x){if(this.__zooming){var y=V(this,x).event(v),O=v.changedTouches,T=O.length,R,D,G,K;for(cn(v),R=0;R<T;++R)D=O[R],G=yt(D,this),y.touch0&&y.touch0[2]===D.identifier?y.touch0[0]=G:y.touch1&&y.touch1[2]===D.identifier&&(y.touch1[0]=G);if(D=y.that.__zoom,y.touch1){var ie=y.touch0[0],ae=y.touch0[1],q=y.touch1[0],J=y.touch1[1],te=(te=q[0]-ie[0])*te+(te=q[1]-ie[1])*te,fe=(fe=J[0]-ae[0])*fe+(fe=J[1]-ae[1])*fe;D=N(D,Math.sqrt(te/fe)),G=[(ie[0]+q[0])/2,(ie[1]+q[1])/2],K=[(ae[0]+J[0])/2,(ae[1]+J[1])/2]}else if(y.touch0)G=y.touch0[0],K=y.touch0[1];else return;y.zoom("touch",n(m(D,G,K),y.extent,s))}}function W(v,...x){if(this.__zooming){var y=V(this,x).event(v),O=v.changedTouches,T=O.length,R,D;for(fi(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),R=0;R<T;++R)D=O[R],y.touch0&&y.touch0[2]===D.identifier?delete y.touch0:y.touch1&&y.touch1[2]===D.identifier&&delete y.touch1;if(y.touch1&&!y.touch0&&(y.touch0=y.touch1,delete y.touch1),y.touch0)y.touch0[1]=this.__zoom.invert(y.touch0[0]);else if(y.end(),y.taps===2&&(D=yt(D,this),Math.hypot(d[0]-D[0],d[1]-D[1])<S)){var G=kt(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return $.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:no(+v),$):o},$.filter=function(v){return arguments.length?(e=typeof v=="function"?v:no(!!v),$):e},$.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:no(!!v),$):i},$.extent=function(v){return arguments.length?(t=typeof v=="function"?v:no([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),$):t},$.scaleExtent=function(v){return arguments.length?(r[0]=+v[0],r[1]=+v[1],$):[r[0],r[1]]},$.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],$):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},$.constrain=function(v){return arguments.length?(n=v,$):n},$.duration=function(v){return arguments.length?(a=+v,$):a},$.interpolate=function(v){return arguments.length?(l=v,$):l},$.on=function(){var v=u.on.apply(u,arguments);return v===u?$:v},$.clickDistance=function(v){return arguments.length?(b=(v=+v)*v,$):Math.sqrt(b)},$.tapDistance=function(v){return arguments.length?(S=+v,$):S},$}const Ll=Symbol("MiniMapSlots"),y0=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],_0={name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1},b0=ye({..._0,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(e,{emit:t}){const n=e,o=Ht(Ll),i=Ki(),r=ke(()=>i.style??{});function s(d){t("click",d)}function a(d){t("dblclick",d)}function l(d){t("mouseenter",d)}function u(d){t("mousemove",d)}function c(d){t("mouseleave",d)}return(d,f)=>!d.hidden&&d.dimensions.width!==0&&d.dimensions.height!==0?(L(),j(Ce,{key:0},[P(o)[`node-${n.type}`]?(L(),Me(Nt(P(o)[`node-${n.type}`]),dn(vo({key:0},{...n,...d.$attrs})),null,16)):(L(),j("rect",vo({key:1,id:d.id},d.$attrs,{class:["vue-flow__minimap-node",{selected:d.selected,dragging:d.dragging}],x:d.position.x,y:d.position.y,rx:d.borderRadius,ry:d.borderRadius,width:d.dimensions.width,height:d.dimensions.height,fill:d.color||r.value.background||r.value.backgroundColor,stroke:d.strokeColor,"stroke-width":d.strokeWidth,"shape-rendering":d.shapeRendering,onClick:s,onDblclick:a,onMouseenter:l,onMousemove:u,onMouseleave:c}),null,16,y0))],64)):Ne("",!0)}}),k0=["width","height","viewBox","aria-labelledby"],E0=["id"],$0=["d","fill","stroke","stroke-width"],x0={name:"MiniMap",compatConfig:{MODE:3}},N0=ye({...x0,props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const n=ia(),o=Ki(),i=200,r=150,{id:s,edges:a,viewport:l,translateExtent:u,dimensions:c,emits:d,d3Selection:f,d3Zoom:h,getNodesInitialized:_}=Se(),b=me();Pt(Ll,n);const S=ke(()=>{var T;return e.width??((T=o.style)==null?void 0:T.width)??i}),$=ke(()=>{var T;return e.height??((T=o.style)==null?void 0:T.height)??r}),N=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision",m=se(()=>typeof e.nodeColor=="string"?()=>e.nodeColor:e.nodeColor),E=se(()=>typeof e.nodeStrokeColor=="string"?()=>e.nodeStrokeColor:e.nodeStrokeColor),A=se(()=>typeof e.nodeClassName=="string"?()=>e.nodeClassName:typeof e.nodeClassName=="function"?e.nodeClassName:()=>""),V=se(()=>sr(_.value.filter(T=>!T.hidden))),F=se(()=>({x:-l.value.x/l.value.zoom,y:-l.value.y/l.value.zoom,width:c.value.width/l.value.zoom,height:c.value.height/l.value.zoom})),B=se(()=>_.value&&_.value.length?ng(V.value,F.value):F.value),X=se(()=>{const T=B.value.width/S.value,R=B.value.height/$.value;return Math.max(T,R)}),H=se(()=>{const T=X.value*S.value,R=X.value*$.value,D=e.offsetScale*X.value;return{offset:D,x:B.value.x-(T-B.value.width)/2-D,y:B.value.y-(R-B.value.height)/2-D,width:T+D*2,height:R+D*2}}),z=se(()=>!H.value.x||!H.value.y?"":`
M${H.value.x-H.value.offset},${H.value.y-H.value.offset}
h${H.value.width+H.value.offset*2}
v${H.value.height+H.value.offset*2}
h${-H.value.width-H.value.offset*2}z
M${F.value.x+e.maskBorderRadius},${F.value.y}
h${F.value.width-2*e.maskBorderRadius}
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}
v${F.value.height-2*e.maskBorderRadius}
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}
h${-(F.value.width-2*e.maskBorderRadius)}
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}
v${-(F.value.height-2*e.maskBorderRadius)}
a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`);xu(T=>{if(b.value){const R=kt(b.value),D=ie=>{if(ie.sourceEvent.type!=="wheel"||!f.value||!h.value)return;const ae=ie.sourceEvent.ctrlKey&&Mn()?10:1,q=-ie.sourceEvent.deltaY*(ie.sourceEvent.deltaMode===1?.05:ie.sourceEvent.deltaMode?1:.002)*e.zoomStep,J=l.value.zoom*2**(q*ae);h.value.scaleTo(f.value,J)},G=ie=>{if(ie.sourceEvent.type!=="mousemove"||!f.value||!h.value)return;const ae=X.value*Math.max(1,l.value.zoom)*(e.inversePan?-1:1),q={x:l.value.x-ie.sourceEvent.movementX*ae,y:l.value.y-ie.sourceEvent.movementY*ae},J=[[0,0],[c.value.width,c.value.height]],te=mr.translate(q.x,q.y).scale(l.value.zoom),fe=h.value.constrain()(te,J,u.value);h.value.transform(f.value,fe)},K=w0().wheelDelta(ie=>Di(ie)*(e.zoomStep/10)).on("zoom",e.pannable?G:()=>{}).on("zoom.wheel",e.zoomable?D:()=>{});R.call(K),T(()=>{R.on("zoom",null)})}},{flush:"post"});function C(T){const[R,D]=yt(T);t("click",{event:T,position:{x:R,y:D}})}function W(T,R){const D={event:T,node:R,connectedEdges:Ct([R],a.value)};d.miniMapNodeClick(D),t("nodeClick",D)}function v(T,R){const D={event:T,node:R,connectedEdges:Ct([R],a.value)};d.miniMapNodeDoubleClick(D),t("nodeDblclick",D)}function x(T,R){const D={event:T,node:R,connectedEdges:Ct([R],a.value)};d.miniMapNodeMouseEnter(D),t("nodeMouseenter",D)}function y(T,R){const D={event:T,node:R,connectedEdges:Ct([R],a.value)};d.miniMapNodeMouseMove(D),t("nodeMousemove",D)}function O(T,R){const D={event:T,node:R,connectedEdges:Ct([R],a.value)};d.miniMapNodeMouseLeave(D),t("nodeMouseleave",D)}return(T,R)=>(L(),Me(P(fl),{position:T.position,class:Oe(["vue-flow__minimap",{pannable:T.pannable,zoomable:T.zoomable}])},{default:ze(()=>[(L(),j("svg",{ref_key:"el",ref:b,width:S.value,height:$.value,viewBox:[H.value.x,H.value.y,H.value.width,H.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${P(s)}`,onClick:C},[T.ariaLabel?(L(),j("title",{key:0,id:`vue-flow__minimap-${P(s)}`},Y(T.ariaLabel),9,E0)):Ne("",!0),(L(!0),j(Ce,null,it(P(_),D=>(L(),Me(b0,{id:D.id,key:D.id,f:"",position:D.computedPosition,dimensions:D.dimensions,selected:D.selected,dragging:D.dragging,style:ue(D.style),class:Oe(A.value(D)),color:m.value(D),"border-radius":T.nodeBorderRadius,"stroke-color":E.value(D),"stroke-width":T.nodeStrokeWidth,"shape-rendering":P(N),type:D.type,hidden:D.hidden,onClick:G=>W(G,D),onDblclick:G=>v(G,D),onMouseenter:G=>x(G,D),onMousemove:G=>y(G,D),onMouseleave:G=>O(G,D)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),k("path",{class:"vue-flow__minimap-mask",d:z.value,fill:T.maskColor,stroke:T.maskStrokeColor,"stroke-width":T.maskStrokeWidth,"fill-rule":"evenodd"},null,8,$0)],8,k0))]),_:1},8,["position","class"]))}}),S0={class:"stage-node__head"},C0=["aria-label"],M0=["aria-label"],I0={key:2,class:"stage-node__dot","aria-hidden":"true"},T0={class:"stage-node__name"},O0={class:"stage-node__foot"},D0={class:"stage-node__id"},A0=ye({__name:"WorkflowStageNode",props:{id:{},data:{},selected:{type:Boolean}},setup(e){function t(n){return{"--icon-src":`url(${n})`}}return(n,o)=>(L(),j("div",{class:Oe(["stage-node",{"stage-node--selected":e.selected,"stage-node--issue":e.data.hasIssue}])},[be(P(Pe),{id:"in",type:"target",position:P(Q).Left},null,8,["position"]),be(P(Pe),{id:"out-0",type:"source",position:P(Q).Right},null,8,["position"]),be(P(Pe),{id:"in-top",type:"target",position:P(Q).Top,class:"stage-node__reject-in"},null,8,["position"]),be(P(Pe),{id:"in-bottom",type:"target",position:P(Q).Bottom,class:"stage-node__reject-in"},null,8,["position"]),k("div",S0,[e.data.isEntry?(L(),j("span",{key:0,class:"icon stage-node__flag stage-node__flag--entry",style:ue(t(P(ge).flag)),"aria-label":n.$t("workflow.entryStageAriaLabel")},null,12,C0)):e.data.isTerminal?(L(),j("span",{key:1,class:"icon stage-node__flag stage-node__flag--terminal",style:ue(t(P(ge).octagon)),"aria-label":n.$t("workflow.terminalStageAriaLabel")},null,12,M0)):(L(),j("span",I0)),k("span",T0,Y(e.data.node.name||e.data.node.id),1)]),k("div",{class:Oe(["stage-node__goal",{"stage-node__goal--empty":!e.data.node.goal}])},Y(e.data.node.goal||n.$t("workflow.stageGoalUnset")),3),k("div",O0,[k("span",D0,Y(e.data.node.id),1)])],2))}}),P0=Ft(A0,[["__scopeId","data-v-548e2455"]]),R0={class:"boundary-node__label"},z0=ye({__name:"WorkflowBoundaryNode",props:{id:{},data:{},selected:{type:Boolean}},setup(e){function t(n){return{"--icon-src":`url(${n})`}}return(n,o)=>(L(),j("div",{class:Oe(["boundary-node",[`boundary-node--${e.data.node.kind}`,{"boundary-node--selected":e.selected,"boundary-node--issue":e.data.hasIssue}]])},[e.data.node.kind==="end"?(L(!0),j(Ce,{key:0},it(e.data.inCount+1,i=>(L(),Me(P(Pe),{key:`in-${i-1}`,id:`in-${i-1}`,type:"target",position:P(Q).Left,class:Oe({"boundary-node__in--empty":i>e.data.inCount}),style:ue({top:`${i/(e.data.inCount+2)*100}%`})},null,8,["id","position","class","style"]))),128)):Ne("",!0),k("span",{class:"icon boundary-node__icon",style:ue(t(e.data.node.kind==="start"?P(ge).play:P(ge).octagon)),"aria-hidden":"true"},null,4),k("span",R0,Y(e.data.node.name||(e.data.node.kind==="start"?n.$t("workflow.start"):n.$t("workflow.end"))),1),e.data.node.kind==="start"?(L(),Me(P(Pe),{key:1,id:"out-0",type:"source",position:P(Q).Right},null,8,["position"])):Ne("",!0)],2))}}),B0=Ft(z0,[["__scopeId","data-v-e1b11385"]]),V0={class:"review-node__body"},L0={class:"review-node__name"},H0={class:"review-node__meta"},F0=ye({__name:"WorkflowReviewNode",props:{id:{},data:{},selected:{type:Boolean}},setup(e){function t(n){return{"--icon-src":`url(${n})`}}return(n,o)=>(L(),j("div",{class:Oe(["review-node",{"review-node--selected":e.selected,"review-node--issue":e.data.hasIssue}])},[o[0]||(o[0]=k("svg",{class:"review-node__shape",viewBox:"0 0 170 96",preserveAspectRatio:"none","aria-hidden":"true"},[k("polygon",{class:"review-node__polygon",points:"85,1 169,48 85,95 1,48"})],-1)),be(P(Pe),{id:"in",type:"target",position:P(Q).Left},null,8,["position"]),be(P(Pe),{id:"out-0",type:"source",position:P(Q).Right,class:"review-node__pass-out"},null,8,["position"]),be(P(Pe),{id:"reject-out",type:"source",position:P(Q).Top,class:"review-node__reject-out"},null,8,["position"]),be(P(Pe),{id:"reject-out-b",type:"source",position:P(Q).Bottom,class:"review-node__reject-out"},null,8,["position"]),k("div",V0,[k("span",{class:"icon review-node__eye",style:ue(t(P(ge).eye)),"aria-hidden":"true"},null,4),k("span",L0,Y(e.data.node.name||e.data.node.id),1),k("span",H0,Y(n.$t("workflow.rejectLimitMeta",{n:e.data.node.maxRejects})),1)])],2))}}),Y0=Ft(F0,[["__scopeId","data-v-b5fcb36f"]]),G0={class:"branch-node__body"},X0={class:"branch-node__name"},W0={class:"branch-node__meta"},j0=ye({__name:"WorkflowBranchNode",props:{id:{},data:{},selected:{type:Boolean}},setup(e){const t=e,n=se(()=>{const i=Math.max(t.data.inCount+1,t.data.outCount+1,2);return Math.max(64,i*22+28)});function o(i){return{"--icon-src":`url(${i})`}}return(i,r)=>(L(),j("div",{class:Oe(["branch-node",{"branch-node--selected":e.selected,"branch-node--issue":e.data.hasIssue}]),style:ue({minHeight:`${n.value}px`})},[(L(!0),j(Ce,null,it(e.data.inCount+1,s=>(L(),Me(P(Pe),{key:`in-${s-1}`,id:`in-${s-1}`,type:"target",position:P(Q).Left,class:Oe({"branch-node__in--empty":s>e.data.inCount}),style:ue({top:`${s/(e.data.inCount+2)*100}%`})},null,8,["id","position","class","style"]))),128)),(L(!0),j(Ce,null,it(e.data.outCount+1,s=>(L(),Me(P(Pe),{key:`out-${s-1}`,id:`out-${s-1}`,type:"source",position:P(Q).Right,class:Oe({"branch-node__out--empty":s>e.data.outCount}),style:ue({top:`${s/(e.data.outCount+2)*100}%`})},null,8,["id","position","class","style"]))),128)),be(P(Pe),{id:"in-top",type:"target",position:P(Q).Top,class:"branch-node__reject-in"},null,8,["position"]),be(P(Pe),{id:"in-bottom",type:"target",position:P(Q).Bottom,class:"branch-node__reject-in"},null,8,["position"]),k("div",G0,[k("span",{class:"icon branch-node__icon",style:ue(o(P(ge).gitBranch)),"aria-hidden":"true"},null,4),k("span",X0,Y(e.data.node.name||e.data.node.id),1),k("span",W0,Y(i.$t("workflow.branchOutMeta",{n:e.data.outCount})),1)])],6))}}),U0=Ft(j0,[["__scopeId","data-v-b05314d6"]]);var Hl=Object.defineProperty,Z0=(e,t,n)=>t in e?Hl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,q0=(e,t)=>{for(var n in t)Hl(e,n,{get:t[n],enumerable:!0})},K0=(e,t,n)=>Z0(e,t+"",n),Fl={};q0(Fl,{Graph:()=>qe,alg:()=>yr});var J0=Object.defineProperty,Yl=(e,t)=>{for(var n in t)J0(e,n,{get:t[n],enumerable:!0})},wr=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),o=this.successors(e);if(o)for(let i of o)n.add(i);return Array.from(n.values())}}isLeaf(e){var t;let n;return this.isDirected()?n=this.successors(e):n=this.neighbors(e),((t=n==null?void 0:n.length)!=null?t:0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([i,r])=>{e(i)&&t.setNode(i,r)}),Object.values(this._edgeObjs).forEach(i=>{t.hasNode(i.v)&&t.hasNode(i.w)&&t.setEdge(i,this.edge(i))});let n={},o=i=>{let r=this.parent(i);return!r||t.hasNode(r)?(n[i]=r,r):r in n?n[r]:o(r)};return this._isCompound&&t.nodes().forEach(i=>t.setParent(i,o(i))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,o)=>(t!==void 0?this.setEdge(n,o,t):this.setEdge(n,o),o)),this}setEdge(e,t,n,o){let i,r,s,a,l=!1;typeof e=="object"&&e!==null&&"v"in e?(i=e.v,r=e.w,s=e.name,arguments.length===2&&(a=t,l=!0)):(i=e,r=t,s=o,arguments.length>2&&(a=n,l=!0)),i=""+i,r=""+r,s!==void 0&&(s=""+s);let u=mn(this._isDirected,i,r,s);if(u in this._edgeLabels)return l&&(this._edgeLabels[u]=a),this;if(s!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(i),this.setNode(r),this._edgeLabels[u]=l?a:this._defaultEdgeLabelFn(i,r,s);let c=Q0(this._isDirected,i,r,s);return i=c.v,r=c.w,Object.freeze(c),this._edgeObjs[u]=c,Ms(this._preds[r],i),Ms(this._sucs[i],r),this._in[r][u]=c,this._out[i][u]=c,this._edgeCount++,this}edge(e,t,n){let o=arguments.length===1?hi(this._isDirected,e):mn(this._isDirected,e,t,n);return this._edgeLabels[o]}edgeAsObj(e,t,n){let o=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof o!="object"||o===null?{label:o}:o}hasEdge(e,t,n){return(arguments.length===1?hi(this._isDirected,e):mn(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let o=arguments.length===1?hi(this._isDirected,e):mn(this._isDirected,e,t,n),i=this._edgeObjs[o];if(i){let r=i.v,s=i.w;delete this._edgeLabels[o],delete this._edgeObjs[o],Is(this._preds[s],r),Is(this._sucs[r],s),delete this._in[s][o],delete this._out[r][o],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let o=Object.values(e);return n?o.filter(i=>i.v===t&&i.w===n||i.v===n&&i.w===t):o}};function Ms(e,t){e[t]?e[t]++:e[t]=1}function Is(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function mn(e,t,n,o){let i=""+t,r=""+n;if(!e&&i>r){let s=i;i=r,r=s}return i+""+r+""+(o===void 0?"\0":o)}function Q0(e,t,n,o){let i=""+t,r=""+n;if(!e&&i>r){let a=i;i=r,r=a}let s={v:i,w:r};return o&&(s.name=o),s}function hi(e,t){return mn(e,t.v,t.w,t.name)}var e1={};Yl(e1,{read:()=>i1,write:()=>t1});function t1(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:n1(e),edges:o1(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function n1(e){return e.nodes().map(t=>{let n=e.node(t),o=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),o!==void 0&&(i.parent=o),i})}function o1(e){return e.edges().map(t=>{let n=e.edge(t),o={v:t.v,w:t.w};return t.name!==void 0&&(o.name=t.name),n!==void 0&&(o.value=n),o})}function i1(e){let t=new wr(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var yr={};Yl(yr,{CycleException:()=>Ao,bellmanFord:()=>Gl,components:()=>a1,dijkstra:()=>Do,dijkstraAll:()=>c1,findCycles:()=>d1,floydWarshall:()=>h1,isAcyclic:()=>v1,postorder:()=>m1,preorder:()=>w1,prim:()=>y1,shortestPaths:()=>_1,tarjan:()=>Wl,topsort:()=>jl});var r1=()=>1;function Gl(e,t,n,o){return s1(e,String(t),n||r1,o||function(i){var r;return(r=e.outEdges(i))!=null?r:[]})}function s1(e,t,n,o){let i={},r,s=0,a=e.nodes(),l=function(d){let f=i[d.v],h=i[d.w];if(!f||!h)return;let _=n(d);f.distance+_<h.distance&&(i[d.w]={distance:f.distance+_,predecessor:d.v},r=!0)},u=function(){a.forEach(function(d){o(d).forEach(function(f){let h=f.v===d?f.v:f.w,_=h===f.v?f.w:f.v;l({v:h,w:_})})})};a.forEach(function(d){let f=d===t?0:Number.POSITIVE_INFINITY;i[d]={distance:f,predecessor:""}});let c=a.length;for(let d=1;d<c&&(r=!1,s++,u(),!!r);d++);if(s===c-1&&(r=!1,u(),r))throw new Error("The graph contains a negative weight cycle");return i}function a1(e){let t={},n=[],o;function i(r){var s,a;r in t||(t[r]=!0,o.push(r),(s=e.successors(r))==null||s.forEach(i),(a=e.predecessors(r))==null||a.forEach(i))}return e.nodes().forEach(function(r){o=[],i(r),o.length&&n.push(o)}),n}var Xl=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,o=String(e);if(!(o in n)){let i=this._arr,r=i.length;return n[o]=r,i.push({key:o,priority:t}),this._decrease(r),!0}return!1}removeMin(){if(this.size()===0)throw new Error("Queue underflow");this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let o=this._arr[n].priority;if(t>o)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${o} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,o=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,o<t.length&&(i=t[o].priority<t[i].priority?o:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,o;for(;e!==0&&(o=e>>1,!(t[o].priority<n));)this._swap(e,o),e=o}_swap(e,t){let n=this._arr,o=this._keyIndices,i=n[e],r=n[t];n[e]=r,n[t]=i,o[r.key]=e,o[i.key]=t}},l1=()=>1;function Do(e,t,n,o){let i=function(r){var s;return(s=e.outEdges(r))!=null?s:[]};return u1(e,String(t),n||l1,o||i)}function u1(e,t,n,o){let i={},r=new Xl,s,a,l=function(u){let c=u.v!==s?u.v:u.w,d=i[c];if(!d)return;let f=n(u),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h<d.distance&&(d.distance=h,d.predecessor=s,r.decrease(c,h))};for(e.nodes().forEach(function(u){let c=u===t?0:Number.POSITIVE_INFINITY;i[u]={distance:c,predecessor:""},r.add(u,c)});r.size()>0;){s=r.removeMin();let u=i[s];if(!u||u.distance===Number.POSITIVE_INFINITY)break;a=u,o(s).forEach(l)}return i}function c1(e,t,n){return e.nodes().reduce(function(o,i){return o[i]=Do(e,i,t,n),o},{})}function Wl(e){let t=0,n=[],o={},i=[];function r(s){var a;let l=o[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),(a=e.successors(s))==null||a.forEach(function(u){if(u in o){let c=o[u];c!=null&&c.onStack&&(l.lowlink=Math.min(l.lowlink,c.index))}else{r(u);let c=o[u];c&&(l.lowlink=Math.min(l.lowlink,c.lowlink))}}),l.lowlink===l.index){let u=[],c;do{c=n.pop();let d=o[c];d&&(d.onStack=!1),u.push(c)}while(s!==c);i.push(u)}}return e.nodes().forEach(function(s){s in o||r(s)}),i}function d1(e){return Wl(e).filter(function(t){var n;let o=t[0];return o?t.length>1||t.length===1&&((n=e.outEdges(o,o))!=null?n:[]).length>0:!1})}var f1=()=>1;function h1(e,t,n){return g1(e,t||f1,n||function(o){var i;return(i=e.outEdges(o))!=null?i:[]})}function g1(e,t,n){let o={},i=e.nodes();return i.forEach(function(r){let s={};o[r]=s,s[r]={distance:0,predecessor:""},i.forEach(function(a){r!==a&&(s[a]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(r).forEach(function(a){let l=a.v===r?a.w:a.v,u=t(a);s[l]={distance:u,predecessor:r}})}),i.forEach(function(r){let s=o[r];s&&i.forEach(function(a){let l=o[a];l&&i.forEach(function(u){let c=l[r],d=s[u],f=l[u];if(c&&d&&f){let h=c.distance+d.distance;h<f.distance&&(f.distance=h,f.predecessor=d.predecessor)}})})}),o}var Ao=class extends Error{constructor(e){super(e),this.name="CycleException"}};function jl(e){let t={},n={},o=[];function i(r){var s;if(r in n)throw new Ao;r in t||(n[r]=!0,t[r]=!0,(s=e.predecessors(r))==null||s.forEach(i),delete n[r],o.push(r))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new Ao;return o}function v1(e){try{jl(e)}catch(t){if(t instanceof Ao)return!1;throw t}return!0}function p1(e,t,n,o,i){Array.isArray(t)||(t=[t]);let r=a=>{var l;return(l=e.isDirected()?e.successors(a):e.neighbors(a))!=null?l:[]},s={};return t.forEach(function(a){if(!e.hasNode(a))throw new Error("Graph does not have node: "+a);i=Ul(e,a,n==="post",s,r,o,i)}),i}function Ul(e,t,n,o,i,r,s){return t in o||(o[t]=!0,n||(s=r(s,t)),i(t).forEach(function(a){s=Ul(e,a,n,o,i,r,s)}),n&&(s=r(s,t))),s}function Zl(e,t,n){return p1(e,t,n,function(o,i){return o.push(i),o},[])}function m1(e,t){return Zl(e,t,"post")}function w1(e,t){return Zl(e,t,"pre")}function y1(e,t){var n;let o=new wr,i={},r=new Xl,s;function a(c){let d=c.v===s?c.w:c.v,f=r.priority(d);if(f!==void 0){let h=t(c);h<f&&(i[d]=s,r.decrease(d,h))}}if(e.nodeCount()===0)return o;e.nodes().forEach(function(c){r.add(c,Number.POSITIVE_INFINITY),o.setNode(c)});let l=e.nodes()[0];l!==void 0&&r.decrease(l,0);let u=!1;for(;r.size()>0;){if(s=r.removeMin(),s in i)o.setEdge(s,i[s]);else{if(u)throw new Error("Input graph is not connected: "+e);u=!0}(n=e.nodeEdges(s))==null||n.forEach(a)}return o}function _1(e,t,n,o){return b1(e,t,n,o??(i=>{var r;return(r=e.outEdges(i))!=null?r:[]}))}function b1(e,t,n,o){if(n===void 0)return Do(e,t,n,o);let i=!1,r=e.nodes();for(let s=0;s<r.length;s++){let a=r[s];if(a===void 0)continue;let l=o(a);for(let u=0;u<l.length;u++){let c=l[u];if(!c)continue;let d=c.v===a?c.v:c.w,f=d===c.v?c.w:c.v;n({v:d,w:f})<0&&(i=!0)}if(i)return Gl(e,t,n,o)}return Do(e,t,n,o)}var qe=wr;function sn(e,t,n,o){let i=o;for(;e.hasNode(i);)i=_r(o);return n.dummy=t,e.setNode(i,n),i}function k1(e){let t=new qe().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let o=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:o.weight+i.weight,minlen:Math.max(o.minlen,i.minlen)})}),t}function ql(e){let t=new qe({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Ts(e,t){let n=e.x,o=e.y,i=t.x-n,r=t.y-o,s=e.width/2,a=e.height/2;if(!i&&!r)throw new Error("Not possible to find intersection inside of the rectangle");let l,u;return Math.abs(r)*s>Math.abs(i)*a?(r<0&&(a=-a),l=a*i/r,u=a):(i<0&&(s=-s),l=s,u=s*r/i),{x:n+l,y:o+u}}function Ln(e){let t=An(Jl(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let o=e.node(n),i=o.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][o.order]=n)}),t}function E1(e){let t=e.nodes().map(o=>{let i=e.node(o).rank;return i===void 0?Number.MAX_VALUE:i}),n=tt(Math.min,t);e.nodes().forEach(o=>{let i=e.node(o);Object.hasOwn(i,"rank")&&(i.rank-=n)})}function $1(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),n=tt(Math.min,t),o=[];e.nodes().forEach(s=>{let a=e.node(s).rank-n;o[a]||(o[a]=[]),o[a].push(s)});let i=0,r=e.graph().nodeRankFactor;Array.from(o).forEach((s,a)=>{s===void 0&&a%r!==0?--i:s!==void 0&&i&&s.forEach(l=>e.node(l).rank+=i)})}function Os(e,t,n,o){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=o),sn(e,"border",i,t)}function x1(e,t=Kl){let n=[];for(let o=0;o<e.length;o+=t){let i=e.slice(o,o+t);n.push(i)}return n}var Kl=65535;function tt(e,t){if(t.length>Kl){let n=x1(t);return e(...n.map(o=>e(...o)))}else return e(...t)}function Jl(e){let t=e.nodes().map(n=>{let o=e.node(n).rank;return o===void 0?Number.MIN_VALUE:o});return tt(Math.max,t)}function N1(e,t){let n={lhs:[],rhs:[]};return e.forEach(o=>{t(o)?n.lhs.push(o):n.rhs.push(o)}),n}function S1(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Ql(e,t){return t()}var C1=0;function _r(e){let t=++C1;return e+(""+t)}function An(e,t,n=1){t==null&&(t=e,e=0);let o=r=>r<t;n<0&&(o=r=>t<r);let i=[];for(let r=e;o(r);r+=n)i.push(r);return i}function Po(e,t){let n={};for(let o of t)e[o]!==void 0&&(n[o]=e[o]);return n}function qo(e,t){let n;return typeof t=="string"?n=o=>o[t]:n=t,Object.entries(e).reduce((o,[i,r])=>(o[i]=n(r,i),o),{})}function M1(e,t){return e.reduce((n,o,i)=>(n[o]=t[i],n),{})}var Ko="\0";function eu(e,t,n){var o,i,r,s,a,l;if(!(e&&t&&n&&t.dummy==="edge"&&n.dummy==="edge"&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let u=!0;t.edgeObj.w===n.edgeObj.w&&(u=!1);let c=u?(i=(o=e[t.edgeObj.v])==null?void 0:o.rank)!=null?i:NaN+1:(s=(r=e[t.edgeObj.w])==null?void 0:r.rank)!=null?s:NaN-1,d=Object.entries(e).find(b=>{var S,$;return((S=b[1].edgeObj)==null?void 0:S.v)===t.edgeObj.v&&(($=b[1].edgeObj)==null?void 0:$.w)===t.edgeObj.w&&b[1].rank===c}),f=Object.entries(e).find(b=>{var S,$;return((S=b[1].edgeObj)==null?void 0:S.v)===n.edgeObj.v&&(($=b[1].edgeObj)==null?void 0:$.w)===n.edgeObj.w&&b[1].rank===c});if(!d||!f)return 0;let h=(a=d[1].order)!=null?a:NaN,_=(l=f[1].order)!=null?l:NaN;return isNaN(h-_)?0:h-_}var I1="3.1.1",T1=class{constructor(){K0(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Ds(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Ds(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,O1)),n=n._prev;return"["+e.join(", ")+"]"}};function Ds(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function O1(e,t){if(e!=="_next"&&e!=="_prev")return t}var D1=T1,A1=()=>1;function P1(e,t){if(e.nodeCount()<=1)return[];let n=z1(e,t||A1);return R1(n.graph,n.buckets,n.zeroIdx).flatMap(o=>e.outEdges(o.v,o.w)||[])}function R1(e,t,n){var o;let i=[],r=t[t.length-1],s=t[0],a;for(;e.nodeCount();){for(;a=s.dequeue();)gi(e,t,n,a);for(;a=r.dequeue();)gi(e,t,n,a);if(e.nodeCount()){for(let l=t.length-2;l>0;--l)if(a=(o=t[l])==null?void 0:o.dequeue(),a){i=i.concat(gi(e,t,n,a,!0)||[]);break}}}return i}function gi(e,t,n,o,i){let r=[],s=i?r:void 0;return(e.inEdges(o.v)||[]).forEach(a=>{let l=e.edge(a),u=e.node(a.v);i&&r.push({v:a.v,w:a.w}),u.out-=l,Wi(t,n,u)}),(e.outEdges(o.v)||[]).forEach(a=>{let l=e.edge(a),u=a.w,c=e.node(u);c.in-=l,Wi(t,n,c)}),e.removeNode(o.v),s}function z1(e,t){let n=new qe,o=0,i=0;e.nodes().forEach(a=>{n.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let l=n.edge(a.v,a.w)||0,u=t(a),c=l+u;n.setEdge(a.v,a.w,c);let d=n.node(a.v),f=n.node(a.w);i=Math.max(i,d.out+=u),o=Math.max(o,f.in+=u)});let r=B1(i+o+3).map(()=>new D1),s=o+1;return n.nodes().forEach(a=>{Wi(r,s,n.node(a))}),{graph:n,buckets:r,zeroIdx:s}}function Wi(e,t,n){var o,i,r;n.out?n.in?(r=e[n.out-n.in+t])==null||r.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(o=e[0])==null||o.enqueue(n)}function B1(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function V1(e,t){(e.graph().acyclicer==="greedy"?P1(e,n(e)):L1(e,t??null)).forEach(o=>{let i=e.edge(o);e.removeEdge(o),i.forwardName=o.name,i.reversed=!0,e.setEdge(o.w,o.v,i,_r("rev"))});function n(o){return i=>o.edge(i).weight}}function L1(e,t){let n=[],o={},i={};function r(l){Object.hasOwn(i,l)||(i[l]=!0,o[l]=!0,e.outEdges(l).forEach(u=>{Object.hasOwn(o,u.w)?n.push(u):r(u.w)}),delete o[l])}function s(l){var u;Object.hasOwn(i,l)||(i[l]=!0,o[l]=!0,(u=e.outEdges(l))==null||u.forEach(c=>{var d,f;Object.hasOwn(o,c.w)||((d=t.node(l))==null?void 0:d.rank)>((f=t.node(c.w))==null?void 0:f.rank)&&F1(e,c.w,c)?n.push(c):s(c.w)}),delete o[l])}let a=r;return t&&typeof t.node=="function"&&(a=s),e.sources().forEach(a),e.nodes().forEach(a),n}function H1(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let o=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,o)}})}function F1(e,t,n){let o=new Set;function i(r){var s;if(e.sources().includes(r))return!0;o.add(r);for(let a of(s=e.inEdges(r))!=null?s:[])if(!(a.v===n.v&&a.w===n.w)&&!o.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Y1(e){e.graph().dummyChains=[],e.edges().forEach(t=>G1(e,t))}function G1(e,t){let n=t.v,o=e.node(n).rank,i=t.w,r=e.node(i).rank,s=t.name,a=e.edge(t),l=a.labelRank;if(r===o+1)return;e.removeEdge(t);let u,c,d;for(d=0,++o;o<r;++d,++o)a.points=[],c={width:0,height:0,edgeLabel:a,edgeObj:t,rank:o},u=sn(e,"edge",c,"_d"),o===l&&(c.width=a.width,c.height=a.height,c.dummy="edge-label",c.labelpos=a.labelpos),e.setEdge(n,u,{weight:a.weight},s),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:a.weight},s)}function X1(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),o=n.edgeLabel,i;for(e.setEdge(n.edgeObj,o);n.dummy;)i=e.successors(t)[0],e.removeNode(t),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),t=i,n=e.node(t)})}function br(e){let t={};function n(o){let i=e.node(o);if(Object.hasOwn(t,o))return i.rank;t[o]=!0;let r=e.outEdges(o),s=r?r.map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-e.edge(l).minlen):[],a=tt(Math.min,s);return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a}e.sources().forEach(n)}function on(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var tu=W1;function W1(e){let t=new qe({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let o=n[0],i=e.nodeCount();t.setNode(o,{});let r,s;for(;j1(t,e)<i&&(r=U1(t,e),!!r);)s=t.hasNode(r.v)?on(e,r):-on(e,r),Z1(t,e,s);return t}function j1(e,t){function n(o){let i=t.nodeEdges(o);i&&i.forEach(r=>{let s=r.v,a=o===s?r.w:s;!e.hasNode(a)&&!on(t,r)&&(e.setNode(a,{}),e.setEdge(o,a,{}),n(a))})}return e.nodes().forEach(n),e.nodeCount()}function U1(e,t){return t.edges().reduce((n,o)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(o.v)!==e.hasNode(o.w)&&(i=on(t,o)),i<n[0]?[i,o]:n},[Number.POSITIVE_INFINITY,null])[1]}function Z1(e,t,n){e.nodes().forEach(o=>t.node(o).rank+=n)}var{preorder:q1,postorder:K1}=yr,J1=Yt;Yt.initLowLimValues=Er;Yt.initCutValues=kr;Yt.calcCutValue=nu;Yt.leaveEdge=iu;Yt.enterEdge=ru;Yt.exchangeEdges=su;function Yt(e){e=k1(e),br(e);let t=tu(e);Er(t),kr(t,e);let n,o;for(;n=iu(t);)o=ru(t,e,n),su(t,e,n,o)}function kr(e,t){let n=K1(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(o=>Q1(e,t,o))}function Q1(e,t,n){let o=e.node(n).parent,i=e.edge(n,o);i.cutvalue=nu(e,t,n)}function nu(e,t,n){let o=e.node(n).parent,i=!0,r=t.edge(n,o),s=0;r||(i=!1,r=t.edge(o,n)),s=r.weight;let a=t.nodeEdges(n);return a&&a.forEach(l=>{let u=l.v===n,c=u?l.w:l.v;if(c!==o){let d=u===i,f=t.edge(l).weight;if(s+=d?f:-f,t_(e,n,c)){let h=e.edge(n,c).cutvalue;s+=d?-h:h}}}),s}function Er(e,t){arguments.length<2&&(t=e.nodes()[0]),ou(e,{},1,t)}function ou(e,t,n,o,i){let r=n,s=e.node(o);t[o]=!0;let a=e.neighbors(o);return a&&a.forEach(l=>{Object.hasOwn(t,l)||(n=ou(e,t,n,l,o))}),s.low=r,s.lim=n++,i?s.parent=i:delete s.parent,n}function iu(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function ru(e,t,n){let o=n.v,i=n.w;t.hasEdge(o,i)||(o=n.w,i=n.v);let r=e.node(o),s=e.node(i),a=r,l=!1;return r.lim>s.lim&&(a=s,l=!0),t.edges().filter(u=>l===As(e,e.node(u.v),a)&&l!==As(e,e.node(u.w),a)).reduce((u,c)=>on(t,c)<on(t,u)?c:u)}function su(e,t,n,o){let i=n.v,r=n.w;e.removeEdge(i,r),e.setEdge(o.v,o.w,{}),Er(e),kr(e,t),e_(e,t)}function e_(e,t){let n=e.nodes().find(i=>!e.node(i).parent);if(!n)return;let o=q1(e,[n]);o=o.slice(1),o.forEach(i=>{let r=e.node(i).parent,s=t.edge(i,r),a=!1;s||(s=t.edge(r,i),a=!0),t.node(i).rank=t.node(r).rank+(a?s.minlen:-s.minlen)})}function t_(e,t,n){return e.hasEdge(t,n)}function As(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var n_=o_;function o_(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":Ps(e);break;case"tight-tree":r_(e);break;case"longest-path":i_(e);break;case"none":break;default:Ps(e)}}var i_=br;function r_(e){br(e),tu(e)}function Ps(e){J1(e)}var s_=a_;function a_(e){let t=u_(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(o=>{let i=e.node(o),r=i.edgeObj,s=l_(e,t,r.v,r.w),a=s.path,l=s.lca,u=0,c=a[u],d=!0;for(;o!==r.w;){if(i=e.node(o),d){for(;(c=a[u])!==l&&e.node(c).maxRank<i.rank;)u++;c===l&&(d=!1)}if(!d){for(;u<a.length-1&&e.node(a[u+1]).minRank<=i.rank;)u++;c=a[u]}c!==void 0&&e.setParent(o,c),o=e.successors(o)[0]}})}function l_(e,t,n,o){let i=[],r=[],s=Math.min(t[n].low,t[o].low),a=Math.max(t[n].lim,t[o].lim),l;l=n;do l=e.parent(l),i.push(l);while(l&&(t[l].low>s||a>t[l].lim));let u=l,c=o;for(;(c=e.parent(c))!==u;)r.push(c);return{path:i.concat(r.reverse()),lca:u}}function u_(e){let t={},n=0;function o(i){let r=n;e.children(i).forEach(o),t[i]={low:r,lim:n++}}return e.children(Ko).forEach(o),t}function c_(e){let t=sn(e,"root",{},"_root"),n=d_(e),o=Object.values(n),i=tt(Math.max,o)-1,r=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(a=>e.edge(a).minlen*=r);let s=f_(e)+1;e.children(Ko).forEach(a=>{au(e,t,r,s,i,n,a)}),e.graph().nodeRankFactor=r}function au(e,t,n,o,i,r,s){var a;let l=e.children(s);if(!l.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let u=Os(e,"_bt"),c=Os(e,"_bb"),d=e.node(s);e.setParent(u,s),d.borderTop=u,e.setParent(c,s),d.borderBottom=c,l.forEach(f=>{var h;au(e,t,n,o,i,r,f);let _=e.node(f),b=_.borderTop?_.borderTop:f,S=_.borderBottom?_.borderBottom:f,$=_.borderTop?o:2*o,N=b!==S?1:i-((h=r[s])!=null?h:0)+1;e.setEdge(u,b,{weight:$,minlen:N,nestingEdge:!0}),e.setEdge(S,c,{weight:$,minlen:N,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,u,{weight:0,minlen:i+((a=r[s])!=null?a:0)})}function d_(e){let t={};function n(o,i){let r=e.children(o);r&&r.length&&r.forEach(s=>n(s,i+1)),t[o]=i}return e.children(Ko).forEach(o=>n(o,1)),t}function f_(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function h_(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var g_=v_;function v_(e){function t(n){let o=e.children(n),i=e.node(n);if(o.length&&o.forEach(t),i&&Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let r=i.minRank,s=i.maxRank+1;r<s;++r)Rs(e,"borderLeft","_bl",n,i,r),Rs(e,"borderRight","_br",n,i,r)}}e.children(Ko).forEach(t)}function Rs(e,t,n,o,i,r){let s={width:0,height:0,rank:r,borderType:t},a=i[t][r-1],l=sn(e,"border",s,n);i[t][r]=l,e.setParent(l,o),a&&e.setEdge(a,l,{weight:1})}function p_(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&lu(e)}function m_(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&w_(e),(n==="lr"||n==="rl")&&(y_(e),lu(e))}function lu(e){e.nodes().forEach(t=>zs(e.node(t))),e.edges().forEach(t=>zs(e.edge(t)))}function zs(e){let t=e.width;e.width=e.height,e.height=t}function w_(e){e.nodes().forEach(t=>vi(e.node(t))),e.edges().forEach(t=>{var n;let o=e.edge(t);(n=o.points)==null||n.forEach(vi),Object.hasOwn(o,"y")&&vi(o)})}function vi(e){e.y=-e.y}function y_(e){e.nodes().forEach(t=>pi(e.node(t))),e.edges().forEach(t=>{var n;let o=e.edge(t);(n=o.points)==null||n.forEach(pi),Object.hasOwn(o,"x")&&pi(o)})}function pi(e){let t=e.x;e.x=e.y,e.y=t}function __(e,t=null){let n={},o=e.nodes().filter(u=>!e.children(u).length),i=o.map(u=>e.node(u).rank),r=tt(Math.max,i),s=An(r+1).map(()=>[]);function a(u){if(n[u])return;n[u]=!0;let c=e.node(u);s[c.rank].push(u);let d=e.successors(u);d&&[...d].sort((f,h)=>l(f,h)).forEach(a)}o.sort((u,c)=>e.node(u).rank-e.node(c).rank).forEach(a);function l(u,c){let d=e.node(u),f=e.node(c);return eu(t,d,f)}return s}function b_(e,t){let n=0;for(let o=1;o<t.length;++o)n+=k_(e,t[o-1],t[o]);return n}function k_(e,t,n){let o=M1(n,n.map((u,c)=>c)),i=t.flatMap(u=>{let c=e.outEdges(u);return c?c.map(d=>({pos:o[d.w],weight:e.edge(d).weight})).sort((d,f)=>d.pos-f.pos):[]}),r=1;for(;r<n.length;)r<<=1;let s=2*r-1;r-=1;let a=new Array(s).fill(0),l=0;return i.forEach(u=>{let c=u.pos+r;a[c]+=u.weight;let d=0;for(;c>0;)c%2&&(d+=a[c+1]),c=c-1>>1,a[c]+=u.weight;l+=u.weight*d}),l}function E_(e,t=[]){return t.map(n=>{let o=e.inEdges(n);if(!o||!o.length)return{v:n};{let i=o.reduce((r,s)=>{let a=e.edge(s),l=e.node(s.v);return{sum:r.sum+a.weight*l.order,weight:r.weight+a.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}})}function $_(e,t){let n={};e.forEach((i,r)=>{let s={indegree:0,in:[],out:[],vs:[i.v],i:r};i.barycenter!==void 0&&(s.barycenter=i.barycenter,s.weight=i.weight),n[i.v]=s}),t.edges().forEach(i=>{let r=n[i.v],s=n[i.w];r!==void 0&&s!==void 0&&(s.indegree++,r.out.push(s))});let o=Object.values(n).filter(i=>!i.indegree);return x_(o)}function x_(e){let t=[];function n(i){return r=>{r.merged||(r.barycenter===void 0||i.barycenter===void 0||r.barycenter>=i.barycenter)&&N_(i,r)}}function o(i){return r=>{r.in.push(i),--r.indegree===0&&e.push(r)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(o(i))}return t.filter(i=>!i.merged).map(i=>Po(i,["vs","i","barycenter","weight"]))}function N_(e,t){let n=0,o=0;e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/o,e.weight=o,e.i=Math.min(t.i,e.i),t.merged=!0}function S_(e,t,n,o,i){let r={},s=null,a=null,l=i;typeof t=="boolean"?(l=t,r={}):t&&(r=t,s=n??null,a=o??null);let u=N1(e,$=>Object.hasOwn($,"barycenter")),c=u.lhs,d=u.rhs.sort(($,N)=>N.i-$.i),f=[],h=0,_=0,b=0;c.sort(C_(a,s,!!l));for(let[$,N]of Object.entries(r)){let m=c.findIndex(E=>E.vs[0]===$);c.splice(m+1,0,N)}b=Bs(f,d,b),c.forEach($=>{b+=$.vs.length,f.push($.vs),h+=$.barycenter*$.weight,_+=$.weight,b=Bs(f,d,b)});let S={vs:f.flat(1)};return _&&(S.barycenter=h/_,S.weight=_),S}function Bs(e,t,n){let o;for(;t.length&&(o=t[t.length-1]).i<=n;)t.pop(),e.push(o.vs),n++;return n}function C_(e,t,n){return(o,i)=>{if(o.barycenter<i.barycenter)return-1;if(o.barycenter>i.barycenter)return 1;if(e&&(typeof o.vs[0]=="string"||typeof i.vs[0]=="string")){let r=e.node(o.vs[0]),s=e.node(i.vs[0]),a=eu(t,r,s);if(a!==0)return a}return n?i.i-o.i:o.i-i.i}}function uu(e,t,n,o,i){var r,s,a,l,u,c,d,f,h,_,b;let S=null,$=i;typeof o=="boolean"?($=o,S=null):o!==void 0&&(S=o);let N=e.children(t),m=e.node(t),E=m?m.borderLeft:void 0,A=m?m.borderRight:void 0,V={};E&&(N=N.filter(C=>C!==E&&C!==A));let F=E_(e,N);F.forEach(C=>{if(e.children(C.v).length){let{result:W}=uu(e,C.v,n,S,$);V[C.v]=W,Object.hasOwn(W,"barycenter")&&I_(C,W)}});let B=$_(F,n);M_(B,V);let X={},H=!1;for(let C=0;C<B.length;C++)for(let W=C+1;W<B.length;W++)if(!(!B[C]||!B[W]||!((r=B[C])!=null&&r.barycenter)||!((s=B[W])!=null&&s.barycenter))&&((a=B[C])==null?void 0:a.barycenter)===B[W].barycenter){let v=(u=(l=B[C])==null?void 0:l.vs[0])!=null?u:"",x=(d=(c=B[W])==null?void 0:c.vs[0])!=null?d:"",y=e.node(v),O=e.node(x);if(y.dummy==="edge"&&O.dummy==="edge"&&((f=y.edgeObj)==null?void 0:f.v)===((h=O.edgeObj)==null?void 0:h.v)&&((_=y.edgeObj)==null?void 0:_.w)===((b=O.edgeObj)==null?void 0:b.w))if(y.edgeLabel.reversed){X[x]=B[C],B.splice(C,1),C--;break}else X[v]=B[W],B.splice(W,1),W--;else H=!0}let z=S_(B,X,S,e,$);if(E&&A){z.vs=[E,z.vs,A].flat(1);let C=e.predecessors(E);if(C&&C.length){let W=e.node(C[0]),v=e.predecessors(A),x=e.node(v[0]);Object.hasOwn(z,"barycenter")||(z.barycenter=0,z.weight=0),z.barycenter=(z.barycenter*z.weight+W.order+x.order)/(z.weight+2),z.weight+=2}}return Object.defineProperty(z,"result",{value:z,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(z,"usedBias",{value:H,enumerable:!1,configurable:!0,writable:!0}),z}function M_(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(o=>t[o]?t[o].vs:o)})}function I_(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function T_(e,t,n,o){o||(o=e.nodes());let i=O_(e),r=new qe({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(s=>e.node(s));return o.forEach(s=>{let a=e.node(s),l=e.parent(s);if(a.rank===t||a.minRank<=t&&t<=a.maxRank){r.setNode(s),r.setParent(s,l||i);let u=e[n](s);u&&u.forEach(c=>{let d=c.v===s?c.w:c.v,f=r.edge(d,s),h=f!==void 0?f.weight:0;r.setEdge(d,s,{weight:e.edge(c).weight+h})}),Object.hasOwn(a,"minRank")&&r.setNode(s,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]})}}),r}function O_(e){let t;for(;e.hasNode(t=_r("_root")););return t}function D_(e,t,n){let o={},i;n.forEach(r=>{let s=e.parent(r),a,l;for(;s;){if(a=e.parent(s),a?(l=o[a],o[a]=s):(l=i,i=s),l&&l!==s){t.setEdge(l,s);return}s=a}})}function cu(e,t={},n=null){if(typeof t.customOrder=="function"){t.customOrder(e,cu);return}let o=Jl(e),i=Vs(e,An(1,o+1),"inEdges"),r=Vs(e,An(o-1,-1,-1),"outEdges"),s=__(e,n);if(Ls(e,s),t.disableOptimalOrderHeuristic)return;let a=Number.POSITIVE_INFINITY,l,u=t.constraints||[];for(let c=0,d=0;d<4;++c,++d){A_(c%2?i:r,c%4>=2,u,n),s=Ln(e);let f=b_(e,s);f<a?(d=0,l=Object.assign({},s),a=f):f===a&&(l=structuredClone(s))}Ls(e,l)}function Vs(e,t,n){let o=new Map,i=(r,s)=>{o.has(r)||o.set(r,[]),o.get(r).push(s)};for(let r of e.nodes()){let s=e.node(r);if(typeof s.rank=="number"&&i(s.rank,r),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&i(a,r)}return t.map(function(r){return T_(e,r,n,o.get(r)||[])})}function A_(e,t,n,o){let i=!0,r=new qe;e.forEach(function(s){n.forEach(c=>r.setEdge(c.left,c.right));let a=s.graph().root,{result:l,usedBias:u}=uu(s,a,r,o,i);t&&u&&(i=!i),l.vs.forEach((c,d)=>s.node(c).order=d),D_(s,r,l.vs)})}function Ls(e,t){Object.values(t).forEach(n=>n.forEach((o,i)=>e.node(o).order=i))}function P_(e,t){let n={};function o(i,r){let s=0,a=0,l=i.length,u=r[r.length-1];return r.forEach((c,d)=>{let f=z_(e,c),h=f?e.node(f).order:l;(f||c===u)&&(r.slice(a,d+1).forEach(_=>{let b=e.predecessors(_);b&&b.forEach(S=>{let $=e.node(S),N=$.order;(N<s||h<N)&&!($.dummy&&e.node(_).dummy)&&du(n,S,_)})}),a=d+1,s=h)}),r}return t.length&&t.reduce(o),n}function R_(e,t){let n={};function o(r,s,a,l,u){An(s,a).forEach(c=>{let d=r[c];if(d!==void 0&&e.node(d).dummy){let f=e.predecessors(d);f&&f.forEach(h=>{if(h===void 0)return;let _=e.node(h);_.dummy&&(_.order<l||_.order>u)&&du(n,h,d)})}})}function i(r,s){let a=-1,l=-1,u=0;return s.forEach((c,d)=>{if(e.node(c).dummy==="border"){let f=e.predecessors(c);if(f&&f.length){let h=f[0];if(h===void 0)return;l=e.node(h).order,o(s,u,d,a,l),u=d,a=l}}o(s,u,s.length,l,r.length)}),s}return t.length&&t.reduce(i),n}function z_(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(o=>e.node(o).dummy)}}function du(e,t,n){if(t>n){let i=t;t=n,n=i}let o=e[t];o||(e[t]=o={}),o[n]=!0}function B_(e,t,n){if(t>n){let i=t;t=n,n=i}let o=e[t];return o!==void 0&&Object.hasOwn(o,n)}function V_(e,t,n,o,i){let r={},s={},a={};return t.forEach(l=>{l.forEach((u,c)=>{r[u]=u,s[u]=u,a[u]=c})}),t.forEach(l=>{let u=-1,c=-1,d=!1,f=l,h=l.findIndex(_=>(i==null?void 0:i.includes(_))||Hs(_,e,i));h>0&&(f=[l[h],...l.slice(0,h),...l.slice(h+1)],d=!0),f.forEach(_=>{var b;let S=o(_);if(S&&S.length){i!=null&&i.includes(_)&&(S=S.filter(m=>Hs(m,e,i)));let $=S.sort((m,E)=>{let A=a[m],V=a[E];return(A!==void 0?A:0)-(V!==void 0?V:0)}),N=($.length-1)/2;for(let m=Math.floor(N),E=Math.ceil(N);m<=E;++m){let A=$[m];if(A===void 0)continue;let V=a[A];if(V!==void 0&&s[_]===_&&u<V&&a[A]!==c&&!B_(n,_,A)){let F=r[A];F!==void 0&&(s[A]=_,s[_]=r[_]=F,u=V,d&&(u=-1,c=(b=a[A])!=null?b:-1,d=!1))}}}})}),{root:r,align:s}}function L_(e,t,n,o,i=!1){let r={},s=H_(e,t,n,i),a=i?"borderLeft":"borderRight";function l(h,_){let b=s.nodes().slice(),S={},$=b.pop();for(;$;){if(S[$])h($);else{S[$]=!0,b.push($);for(let N of _($))b.push(N)}$=b.pop()}}function u(h){let _=s.inEdges(h);_?r[h]=_.reduce((b,S)=>{var $;let N=($=r[S.v])!=null?$:0,m=s.edge(S);return Math.max(b,N+(m!==void 0?m:0))},0):r[h]=0}function c(h){let _=s.outEdges(h),b=Number.POSITIVE_INFINITY;_&&(b=_.reduce(($,N)=>{let m=r[N.w],E=s.edge(N);return Math.min($,(m!==void 0?m:0)-(E!==void 0?E:0))},Number.POSITIVE_INFINITY));let S=e.node(h);b!==Number.POSITIVE_INFINITY&&S.borderType!==a&&(r[h]=Math.max(r[h]!==void 0?r[h]:0,b))}function d(h){return s.predecessors(h)||[]}function f(h){return s.successors(h)||[]}return l(u,d),l(c,f),Object.keys(o).forEach(h=>{var _;let b=n[h];b!==void 0&&(r[h]=(_=r[b])!=null?_:0)}),r}function H_(e,t,n,o){let i=new qe,r=e.graph(),s=W_(r.nodesep,r.edgesep,o);return t.forEach(a=>{let l;a.forEach(u=>{let c=n[u];if(c!==void 0){if(i.setNode(c),l!==void 0){let d=n[l];if(d!==void 0){let f=i.edge(d,c);i.setEdge(d,c,Math.max(s(e,u,l),f||0))}}l=u}})}),i}function F_(e,t){return Object.values(t).reduce((n,o)=>{let i=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(o).forEach(([a,l])=>{let u=j_(e,a)/2;i=Math.max(l+u,i),r=Math.min(l-u,r)});let s=i-r;return s<n[0]&&(n=[s,o]),n},[Number.POSITIVE_INFINITY,null])[1]}function Y_(e,t){let n=Object.values(t),o=tt(Math.min,n),i=tt(Math.max,n);["u","d"].forEach(r=>{["l","r"].forEach(s=>{let a=r+s,l=e[a];if(!l||l===t)return;let u=Object.values(l),c=o-tt(Math.min,u);s!=="l"&&(c=i-tt(Math.max,u)),c&&(e[a]=qo(l,d=>d+c))})})}function G_(e,t=void 0){let n=e.ul;return n?qo(n,(o,i)=>{var r,s;if(t){let l=t.toLowerCase(),u=e[l];if(u&&u[i]!==void 0)return u[i]}let a=Object.values(e).map(l=>{let u=l[i];return u!==void 0?u:0}).sort((l,u)=>l-u);return(((r=a[1])!=null?r:0)+((s=a[2])!=null?s:0))/2}):{}}function X_(e,t){let n=Ln(e),o=Object.assign(P_(e,n),R_(e,n)),i={},r;["u","d"].forEach(a=>{r=a==="u"?n:Object.values(n).reverse(),["l","r"].forEach(l=>{l==="r"&&(r=r.map(d=>Object.values(d).reverse()));let u=V_(e,r,o,d=>(a==="u"?e.predecessors(d):e.successors(d))||[],t),c=L_(e,r,u.root,u.align,l==="r");l==="r"&&(c=qo(c,d=>-d)),i[a+l]=c})});let s=F_(e,i);return Y_(i,s),G_(i,e.graph().align)}function W_(e,t,n){return(o,i,r)=>{let s=o.node(i),a=o.node(r),l=0,u;if(l+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(l+=n?u:-u),u=void 0,l+=(s.dummy?t:e)/2,l+=(a.dummy?t:e)/2,l+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=a.width/2;break;case"r":u=-a.width/2;break}return u&&(l+=n?u:-u),l}}function j_(e,t){return e.node(t).width}function Hs(e,t,n){var o;if(!n)return!1;let i=(o=t.node(e))==null?void 0:o.edgeObj;if(!i||t.node(e).edgeLabel.reversed)return!1;let r=n.indexOf(i==null?void 0:i.v),s=n.indexOf(i==null?void 0:i.w);return r!==-1&&s!==-1&&r===(s+1)%n.length||r===(s-1)%n.length}function U_(e,t){e=ql(e),Z_(e),Object.entries(X_(e,t)).forEach(([n,o])=>e.node(n).x=o)}function Z_(e){let t=Ln(e),n=e.graph(),o=n.ranksep,i=n.rankalign,r=0;t.forEach(s=>{let a=s.reduce((l,u)=>{var c;let d=(c=e.node(u).height)!=null?c:0;return l>d?l:d},0);s.forEach(l=>{let u=e.node(l);i==="top"?u.y=r+u.height/2:i==="bottom"?u.y=r+a-u.height/2:u.y=r+a/2}),r+=a+o})}var Fs=new WeakMap;function q_(e,t={}){return fu(e,Ql,t),e}function Ys(e,t,n){let o=t;for(;o!==void 0;){let i=e.parent(o);if(i===n)return o;o=i}}function fu(e,t,n){var o;let i=e.nodes().filter(N=>e.children(N).length),r={};i.forEach(N=>{let m=e.node(N);if(m&&m.rankdir){let E=new qe({multigraph:!0,compound:!0});E.setGraph({rankdir:m.rankdir});let A=e.children(N);A.forEach(v=>{let x={...e.node(v)};E.setNode(v,x);let y=e.parent(v);y&&y!==N&&A.includes(y)&&E.setParent(v,y)});let V=new Set;e.edges().forEach(v=>{let x=Ys(e,v.v,N),y=Ys(e,v.w,N);if(x&&y&&x!==y){let O=`${x}\0${y}`;V.has(O)||(V.add(O),E.setEdge(x,y,{...e.edge(v)}))}}),fu(E,t,n);let F=js(E);Gs(F,t,n,null),Xs(E,F);let B=1/0,X=1/0,H=-1/0,z=-1/0;E.nodes().forEach(v=>{if(v===N)return;let x=E.node(v);x&&typeof x.x=="number"&&typeof x.y=="number"&&typeof x.width=="number"&&typeof x.height=="number"&&(B=Math.min(B,x.x-x.width/2),H=Math.max(H,x.x+x.width/2),X=Math.min(X,x.y-x.height/2),z=Math.max(z,x.y+x.height/2))}),(!isFinite(B)||!isFinite(X)||!isFinite(H)||!isFinite(z))&&(B=X=0,H=z=0);let C=H-B,W=z-X;r[N]={minX:B,minY:X,maxX:H,maxY:z,width:C,height:W,offsetX:B,offsetY:X},m._dagreClusterSubgraph=E}});let s=[],a=N=>{let m=[],E=(e.children(N)||[]).filter(A=>A!==N);for(;E.length>0;){let A=E.shift();m.push(A),(e.children(A)||[]).filter(V=>V!==A).forEach(V=>E.push(V))}return m},l=new Map;i.forEach(N=>{let m=e.node(N);m&&m.rankdir&&r[N]&&l.set(N,(e.children(N)||[]).filter(E=>E!==N))});let u=new Set([...l.values()].flat()),c=new Map;l.forEach((N,m)=>{u.has(m)||c.set(m,a(m))});let d=new Set([...c.values()].flat()),f=N=>{for(let[m,E]of c)if(E.includes(N))return m;return N},h=[];e.edges().forEach(N=>{(d.has(N.v)||d.has(N.w))&&h.push({edge:N,label:e.edge(N)})});let _=new Map;d.forEach(N=>{let m=e.parent(N);_.set(N,typeof m=="string"?m:void 0)}),c.forEach((N,m)=>{let E=e.node(m),A=[];N.forEach(B=>{let X=e.node(B);X&&(A.push({id:B,node:X,parent:_.get(B)}),e.removeNode(B))});let V=h.filter(({edge:B})=>N.includes(B.v)||N.includes(B.w)),F=r[m];E&&(s.push({clusterId:m,subgraph:E._dagreClusterSubgraph,bounds:F,children:N,removedNodes:A,removedEdges:V}),E.width=F.width,E.height=F.height)});let b=new Set;h.forEach(({edge:N,label:m})=>{let E=f(N.v),A=f(N.w);if(E!==A&&e.hasNode(E)&&e.hasNode(A)){let V=`${E}\0${A}`;b.has(V)||(b.add(V),e.setEdge(E,A,{...m,width:0,height:0}))}});let S=js(e),$=Gs(S,t,n,(o=Fs.get(e))!=null?o:null);Fs.set(e,$),Xs(e,S),b.forEach(N=>{let m=N.indexOf("\0"),E=N.slice(0,m),A=N.slice(m+1);e.hasEdge(E,A)&&e.removeEdge(E,A)}),s.forEach(({clusterId:N,subgraph:m,bounds:E,removedNodes:A,removedEdges:V})=>{var F,B;let X=e.node(N),H=(F=X==null?void 0:X.x)!=null?F:0,z=(B=X==null?void 0:X.y)!=null?B:0,C=(E.minX+E.maxX)/2,W=(E.minY+E.maxY)/2;A.forEach(({id:v,node:x,parent:y})=>{e.setNode(v,x),y!==void 0&&e.setParent(v,y)}),V.forEach(({edge:v,label:x})=>{e.setEdge(v,x)}),m.nodes().forEach(v=>{if(v===N)return;let x=m.node(v),y=e.node(v);y&&x&&typeof x.x=="number"&&typeof x.y=="number"&&(y.x=H+(x.x-C),y.y=z+(x.y-W))}),delete X._dagreClusterSubgraph}),i.forEach(N=>{var m,E;let A=e.node(N),V=r[N];if(A&&A.rankdir&&A._dagreClusterSubgraph&&V){let F=A._dagreClusterSubgraph,B=(m=A.x)!=null?m:0,X=(E=A.y)!=null?E:0,H=(V.minX+V.maxX)/2,z=(V.minY+V.maxY)/2;F.nodes().forEach(C=>{if(C===N)return;let W=F.node(C),v=e.node(C);if(v&&W&&typeof W.x=="number"&&typeof W.y=="number"){let x=W.x-H,y=W.y-z;v.x=B+x,v.y=X+y}}),delete A._dagreClusterSubgraph}})}function Gs(e,t,n,o=null){var i,r;let s=(n==null?void 0:n.useDynamic)!==!1,a=s&&(i=o==null?void 0:o.graph)!=null?i:null,l=s&&(r=o==null?void 0:o.rawNodes)!=null?r:null;t(" makeSpaceForEdgeLabels",()=>ib(e)),t(" removeSelfEdges",()=>hb(e)),t(" acyclic",()=>V1(e,a)),t(" nestingGraph.run",()=>c_(e)),t(" rank",()=>n_(ql(e))),t(" injectEdgeLabelProxies",()=>rb(e)),t(" removeEmptyRanks",()=>$1(e)),t(" nestingGraph.cleanup",()=>h_(e)),t(" normalizeRanks",()=>E1(e)),t(" assignRankMinMax",()=>sb(e)),t(" removeEdgeLabelProxies",()=>ab(e)),t(" normalize.run",()=>Y1(e)),t(" parentDummyChains",()=>s_(e)),t(" addBorderSegments",()=>g_(e)),t(" order",()=>cu(e,n,l)),t(" insertSelfEdges",()=>gb(e)),t(" adjustCoordinateSystem",()=>p_(e)),t(" position",()=>U_(e,n.corePath)),t(" positionSelfEdges",()=>vb(e));let u=JSON.parse(JSON.stringify(e._nodes));return t(" removeBorderNodes",()=>fb(e)),t(" normalize.undo",()=>X1(e)),t(" fixupEdgeLabelCoords",()=>cb(e)),t(" undoCoordinateSystem",()=>m_(e)),t(" translateGraph",()=>lb(e)),t(" assignNodeIntersects",()=>ub(e)),t(" reversePoints",()=>db(e)),t(" acyclic.undo",()=>H1(e)),{graph:e,rawNodes:u}}function Xs(e,t){e.nodes().forEach(n=>{let o=e.node(n),i=t.node(n);o&&(o.x=i.x,o.y=i.y,o.order=i.order,o.rank=i.rank,t.children(n).length&&(o.width=i.width,o.height=i.height))}),e.edges().forEach(n=>{let o=e.edge(n),i=t.edge(n);o.points=i.points,Object.hasOwn(i,"x")&&(o.x=i.x,o.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var K_=["nodesep","edgesep","ranksep","marginx","marginy"],J_={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Q_=["acyclicer","ranker","rankdir","align","rankalign"],eb=["width","height","rank"],Ws={width:0,height:0},tb=["minlen","weight","width","height","labeloffset"],nb={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ob=["labelpos"];function js(e){let t=new qe({multigraph:!0,compound:!0}),n=wi(e.graph());return t.setGraph(Object.assign({},J_,mi(n,K_),Po(n,Q_))),e.nodes().forEach(o=>{let i=wi(e.node(o)),r=mi(i,eb);Object.keys(Ws).forEach(a=>{r[a]===void 0&&(r[a]=Ws[a])}),t.setNode(o,r);let s=e.parent(o);s!==void 0&&t.setParent(o,s)}),e.edges().forEach(o=>{let i=wi(e.edge(o));t.setEdge(o,Object.assign({},nb,mi(i,tb),Po(i,ob)))}),t}function ib(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{var o;let i=e.edge(n);i.minlen*=2,((o=i.labelpos)!=null?o:"r").toLowerCase()!=="c"&&(t.rankdir==="TB"||t.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function rb(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let o=e.node(t.v),i={rank:(e.node(t.w).rank-o.rank)/2+o.rank,e:t};sn(e,"edge-proxy",i,"_ep")}})}function sb(e){let t=0;e.nodes().forEach(n=>{let o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,t=Math.max(t,o.maxRank))}),e.graph().maxRank=t}function ab(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let o=n;e.edge(o.e).labelRank=n.rank,e.removeNode(t)}})}function lb(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,i=0,r=e.graph(),s=r.marginx||0,a=r.marginy||0;function l(u){let c=u.x,d=u.y,f=u.width,h=u.height;t=Math.min(t,c-f/2),n=Math.max(n,c+f/2),o=Math.min(o,d-h/2),i=Math.max(i,d+h/2)}e.nodes().forEach(u=>l(e.node(u))),e.edges().forEach(u=>{let c=e.edge(u);Object.hasOwn(c,"x")&&l(c)}),t-=s,o-=a,e.nodes().forEach(u=>{let c=e.node(u);c.x-=t,c.y-=o}),e.edges().forEach(u=>{let c=e.edge(u);c.points.forEach(d=>{d.x-=t,d.y-=o}),Object.hasOwn(c,"x")&&(c.x-=t),Object.hasOwn(c,"y")&&(c.y-=o)}),r.width=n-t+s,r.height=i-o+a}function ub(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),o=e.node(t.v),i=e.node(t.w),r,s;n.points?(r=n.points[0],s=n.points[n.points.length-1]):(n.points=[],r=i,s=o),n.points.unshift(Ts(o,r)),n.points.push(Ts(i,s))})}function cb(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function db(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function fb(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),o=e.node(n.borderTop),i=e.node(n.borderBottom),r=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-r.x),n.height=Math.abs(i.y-o.y),n.x=r.x+n.width/2,n.y=o.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function hb(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function gb(e){Ln(e).forEach(t=>{let n=0;t.forEach((o,i)=>{let r=e.node(o);typeof r.rank!="number"&&(r.rank=0),r.order=i+n,(r.selfEdges||[]).forEach(s=>{sn(e,"selfedge",{width:s.label.width,height:s.label.height,rank:r.rank,order:i+ ++n,e:s.e,edgeLabel:s.label},"_se"),(!Array.isArray(s.label.points)||s.label.points.length!==7)&&(s.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete r.selfEdges})})}function vb(e){e.nodes().forEach(t=>{let n=e.node(t),o=i=>typeof i=="number"&&isFinite(i);if(n.dummy==="selfedge"){let i=n,r=e.node(i.e.v),s=o(r==null?void 0:r.x)?r.x:0,a=o(r==null?void 0:r.y)?r.y:0,l=o(r==null?void 0:r.width)?r.width:0,u=o(r==null?void 0:r.height)?r.height:0,c=o(n.x)?n.x:s,d=o(n.y)?n.y:a,f=l/2,h=u/2;i.edgeLabel.points=[{x:c+f,y:d-h},{x:c+f,y:d-h},{x:c,y:d},{x:c-f,y:d+h},{x:c-f,y:d+h},{x:c,y:d},{x:c,y:d}],i.edgeLabel.x=c,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(i=>{if(!Array.isArray(i.label.points)||i.label.points.length!==7){let r=o(n.x)?n.x:0,s=o(n.y)?n.y:0,a=o(n.width)?n.width:0,l=o(n.height)?n.height:0,u=a/2,c=l/2;i.label.points=[{x:r+u,y:s-c},{x:r+u,y:s-c},{x:r,y:s},{x:r-u,y:s+c},{x:r-u,y:s+c},{x:r,y:s},{x:r,y:s}]}})})}function mi(e,t){return qo(Po(e,t),Number)}function wi(e){let t={};return e&&Object.entries(e).forEach(([n,o])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=o}),t}function pb(e){let t=Ln(e),n=new qe({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(o=>{n.setNode(o,{label:o}),n.setParent(o,"layer"+e.node(o).rank)}),e.edges().forEach(o=>n.setEdge(o.v,o.w,{},o.name)),t.forEach((o,i)=>{let r="layer"+i;n.setNode(r,{rank:"same"}),o.reduce((s,a)=>(n.setEdge(s,a,{style:"invis"}),a))}),n}var mb={graphlib:Fl,version:I1,layout:q_,debug:pb,util:{time:S1,notime:Ql}},Us=mb;/*! For license information please see dagre.esm.js.LEGAL.txt */function wb(e){return{name:e,description:"",reviewMode:"active",maxStageRounds:20,endConditions:"",body:ee("workflow.defaultBodyTemplate"),source:"user",updatedAt:"",nodes:[{kind:"start",id:"start-1",name:ee("workflow.defaultStartNode"),next:"end-1",position:{x:60,y:220}},{kind:"end",id:"end-1",name:ee("workflow.defaultEndNode"),position:{x:480,y:220}}]}}function Re(e,t){return e.nodes.find(n=>n.id===t)}function Lt(e,t){return e.nodes.some(n=>n.id===t)}function ji(e,t){var n,o;return((o=(n=Re(e,t))==null?void 0:n.position)==null?void 0:o.y)??Number.MAX_SAFE_INTEGER}const yb=210,_b=118,bb=170,kb=96,Eb=150,$b=80,xb=110,Nb=40,Zs="var(--text-secondary)",Sb="var(--state-info)",Cb="var(--state-danger)";function Mb(e,t){const n=new Map,o=(d,f,h=!1)=>{n.has(d)||n.set(d,[]),n.get(d).push({source:f,isReject:h})};for(const d of e.nodes)if(d.kind!=="end")if(d.kind==="branch")for(const f of d.next)o(f.target,d.id);else d.next&&o(d.next,d.id),d.kind==="review"&&d.rejectTo&&o(d.rejectTo,d.id,!0);const i=d=>ji(e,d),r=d=>{const f=Re(e,d),h=(f==null?void 0:f.kind)==="stage"||(f==null?void 0:f.kind)==="branch";return(n.get(d)??[]).filter(b=>!b.isReject||!h).map(b=>b.source).sort((b,S)=>i(b)-i(S))},s=(d,f)=>{const _=r(d).indexOf(f);return _>=0?_:0},a=(d,f,h,_=!0)=>{const b=Re(e,d);return h&&b&&(b.kind==="stage"||b.kind==="branch")?_?"in-top":"in-bottom":(b==null?void 0:b.kind)==="branch"||(b==null?void 0:b.kind)==="end"?`in-${s(d,f)}`:"in"},l=(d,f)=>{const h=Re(e,f);return!d.position||!(h!=null&&h.position)?!0:h.position.y<=d.position.y},u=e.nodes.map(d=>{const f=d.kind==="start"||d.kind==="end";return{id:d.id,type:f?"boundary":d.kind,position:d.position??{x:0,y:0},data:{node:d,hasIssue:t.has(d.id),inCount:r(d.id).length,outCount:d.kind==="branch"?d.next.length:1}}}),c=[];for(const d of e.nodes)if(d.kind!=="end"){if(d.kind==="branch"){[...d.next].sort((h,_)=>i(h.target)-i(_.target)).forEach((h,_)=>{const b=h.condition.length>14?`${h.condition.slice(0,14)}`:h.condition;c.push({id:`${d.id}->${h.target}`,source:d.id,target:h.target,sourceHandle:`out-${_}`,targetHandle:a(h.target,d.id,!1),...b?{label:b}:{},markerEnd:{type:Ut.ArrowClosed,color:Zs}})});continue}if(d.next&&c.push({id:`${d.id}->${d.next}`,source:d.id,target:d.next,sourceHandle:"out-0",targetHandle:a(d.next,d.id,!1),...d.kind==="review"?{class:"wf-edge-approved"}:{},markerEnd:{type:Ut.ArrowClosed,color:d.kind==="review"?Sb:Zs}}),d.kind==="review"&&d.rejectTo){const f=l(d,d.rejectTo);c.push({id:`reject:${d.id}->${d.rejectTo}`,source:d.id,target:d.rejectTo,sourceHandle:f?"reject-out":"reject-out-b",targetHandle:a(d.rejectTo,d.id,!0,f),class:"wf-edge-back",markerEnd:{type:Ut.ArrowClosed,color:Cb}})}}return{nodes:u,edges:c}}let qs=0;function Hn(e,t){qs+=1;let n=e.nodes.length+qs,o=`${t}-${n}`;for(;Lt(e,o);)n+=1,o=`${t}-${n}`;return o}function Ks(e,t){const n={kind:"stage",id:Hn(e,"stage"),name:ee("workflow.defaultStageName",{n:e.nodes.filter(o=>o.kind==="stage").length+1}),goal:"",instructions:"",next:null,position:t};return e.nodes.push(n),n}function Ib(e,t){const n={kind:"review",id:Hn(e,"review"),name:ee("workflow.defaultReviewName",{n:e.nodes.filter(o=>o.kind==="review").length+1}),prompt:"",next:null,rejectTo:null,maxRejects:3,position:t};return e.nodes.push(n),n}function Tb(e,t){const n={kind:"branch",id:Hn(e,"branch"),name:ee("workflow.defaultBranchName",{n:e.nodes.filter(o=>o.kind==="branch").length+1}),next:[],position:t};return e.nodes.push(n),n}function Ob(e,t){const n={kind:"start",id:Hn(e,"start"),name:ee("workflow.defaultStartNode"),next:null,position:t};return e.nodes.push(n),n}function Db(e,t){const n={kind:"end",id:Hn(e,"end"),name:ee("workflow.defaultEndNode"),position:t};return e.nodes.push(n),n}function Js(e,t){e.nodes=e.nodes.filter(n=>n.id!==t);for(const n of e.nodes)n.kind!=="end"&&(n.kind==="branch"?n.next=n.next.filter(o=>o.target!==t):(n.next===t&&(n.next=null),n.kind==="review"&&n.rejectTo===t&&(n.rejectTo=null)))}function Qs(e,t,n){var i;if(t===n)return ee("workflow.connectSelf");const o=Re(e,t);return o?o.kind==="end"?ee("workflow.endHasNoOut"):Lt(e,n)?((i=Re(e,n))==null?void 0:i.kind)==="start"?ee("workflow.connectToStart"):o.kind==="branch"?o.next.some(r=>r.target===n)?ee("workflow.routeExists"):(o.next.push({target:n,condition:""}),null):o.kind==="review"&&o.rejectTo===n?ee("workflow.targetIsRejectRoute"):(o.next=n,null):ee("workflow.targetMissing"):ee("workflow.sourceMissing")}function Ab(e,t,n,o){var l;const i=Re(e,t);if(!i)return ee("workflow.sourceMissing");if(i.kind!=="branch")return ee("workflow.onlyBranchHasOuts");if(!Lt(e,o))return ee("workflow.targetMissing");if(((l=Re(e,o))==null?void 0:l.kind)==="start")return ee("workflow.connectToStart");const s=[...i.next].sort((u,c)=>ji(e,u.target)-ji(e,c.target))[n];if(s===void 0)return ee("workflow.emptySlot");if(s.target===o)return null;if(i.next.some(u=>u.target===o))return ee("workflow.targetAlreadyOut");const a=i.next.find(u=>u.target===s.target);return a&&(a.target=o),null}function Pb(e,t,n){var i;if(t===n)return ee("workflow.rejectToSelf");const o=Re(e,t);return o?o.kind!=="review"?ee("workflow.onlyReviewHasReject"):Lt(e,n)?((i=Re(e,n))==null?void 0:i.kind)==="start"?ee("workflow.rejectToStart"):o.next===n?ee("workflow.targetIsPassRoute"):(o.rejectTo=n,null):ee("workflow.targetMissing"):ee("workflow.sourceMissing")}function yi(e,t,n){const o=Re(e,t);!o||o.kind==="end"||(o.kind==="branch"?o.next=o.next.filter(i=>i.target!==n):o.next===n&&(o.next=null))}function ea(e,t){const n=Re(e,t);!n||n.kind!=="review"||(n.rejectTo=null)}function Rb(e,t){var n;return((n=Re(e,t))==null?void 0:n.name)??t}function zb(e){const t=[];if(e.name.trim()||t.push({level:"error",message:ee("workflow.missingName")}),e.description.trim()||t.push({level:"warning",message:ee("workflow.missingDescription")}),e.nodes.length===0)return t.push({level:"error",message:ee("workflow.needStartEnd")}),t;const n=l=>Lt(e,l),o=l=>{var u;return((u=Re(e,l))==null?void 0:u.kind)==="start"},i=e.nodes.filter(l=>l.kind==="start"),r=e.nodes.filter(l=>l.kind==="end");i.length===0?t.push({level:"error",message:ee("workflow.missingStart")}):i.length>1&&t.push({level:"error",message:ee("workflow.multipleStarts",{n:i.length}),nodeId:i[1].id}),r.length===0&&t.push({level:"error",message:ee("workflow.missingEnd")});const s=new Set;for(const l of e.nodes)switch(s.has(l.id)&&t.push({level:"error",message:ee("workflow.dupNodeId",{id:l.id}),nodeId:l.id}),s.add(l.id),l.name.trim()||t.push({level:"error",message:ee("workflow.nodeMissingName",{id:l.id}),nodeId:l.id}),l.kind){case"start":l.next===null?t.push({level:"error",message:ee("workflow.startNotConnected"),nodeId:l.id}):n(l.next)||t.push({level:"error",message:ee("workflow.startBadTarget",{target:l.next}),nodeId:l.id});break;case"end":break;case"stage":l.goal.trim()||t.push({level:"warning",message:ee("workflow.stageMissingGoal",{name:l.name||l.id}),nodeId:l.id}),l.next===null?t.push({level:"error",message:ee("workflow.stageNotConnected",{name:l.name||l.id}),nodeId:l.id}):n(l.next)?o(l.next)&&t.push({level:"error",message:ee("workflow.stageToStart",{name:l.name}),nodeId:l.id}):t.push({level:"error",message:ee("workflow.stageBadTarget",{name:l.name,target:l.next}),nodeId:l.id});break;case"review":l.prompt.trim()||t.push({level:"warning",message:ee("workflow.reviewMissingFocus",{name:l.name||l.id}),nodeId:l.id}),l.next===null?t.push({level:"error",message:ee("workflow.reviewNoPassRoute",{name:l.name||l.id}),nodeId:l.id}):n(l.next)||t.push({level:"error",message:ee("workflow.reviewBadTarget",{name:l.name,target:l.next}),nodeId:l.id}),l.rejectTo===null?t.push({level:"error",message:ee("workflow.reviewNoRejectRoute",{name:l.name||l.id}),nodeId:l.id}):n(l.rejectTo)?o(l.rejectTo)&&t.push({level:"error",message:ee("workflow.reviewRejectToStart",{name:l.name}),nodeId:l.id}):t.push({level:"error",message:ee("workflow.reviewBadRejectTarget",{name:l.name,target:l.rejectTo}),nodeId:l.id}),(!Number.isFinite(l.maxRejects)||l.maxRejects<1)&&t.push({level:"error",message:ee("workflow.reviewBadMaxRejects",{name:l.name||l.id}),nodeId:l.id});break;case"branch":l.next.length===0&&t.push({level:"warning",message:ee("workflow.branchNoOutsNamed",{name:l.name||l.id}),nodeId:l.id});for(const u of l.next)n(u.target)?o(u.target)&&t.push({level:"error",message:ee("workflow.branchToStart",{name:l.name}),nodeId:l.id}):t.push({level:"error",message:ee("workflow.branchBadTarget",{name:l.name,target:u.target}),nodeId:l.id});if(l.next.length>=2)for(const u of l.next)u.condition.trim()||t.push({level:"warning",message:ee("workflow.branchRouteMissingCondition",{name:l.name,target:Rb(e,u.target)}),nodeId:l.id});break}const a=i[0];if(a&&a.kind==="start"&&a.next&&n(a.next)){const l=new Set([a.id]),u=[a.next];for(;u.length;){const c=u.shift();if(l.has(c))continue;l.add(c);const d=Re(e,c);if(!d||d.kind==="end")continue;const f=d.kind==="branch"?d.next.map(h=>h.target):[d.next,d.kind==="review"?d.rejectTo:null].filter(h=>!!h);for(const h of f)l.has(h)||u.push(h)}for(const c of e.nodes)l.has(c.id)||t.push({level:"warning",message:ee("workflow.nodeUnreachable",{name:c.name}),nodeId:c.id})}return t}function ta(e){if(e.nodes.length===0)return;const t=new Map;for(const i of e.nodes){if(i.kind==="end")continue;const r=i.kind==="branch"?i.next.map(s=>s.target):i.next?[i.next]:[];for(const s of r)Lt(e,s)&&t.set(s,(t.get(s)??0)+1)}const n=i=>{switch(i.kind){case"start":case"end":return{width:xb,height:Nb};case"review":return{width:bb,height:kb};case"branch":{const r=Math.max(t.get(i.id)??1,i.next.length,2);return{width:Eb,height:Math.max($b,r*24+40)}}default:return{width:yb,height:_b}}},o=new Us.graphlib.Graph;o.setGraph({rankdir:"LR",nodesep:70,ranksep:130,marginx:60,marginy:60}),o.setDefaultEdgeLabel(()=>({}));for(const i of e.nodes)o.setNode(i.id,n(i));for(const i of e.nodes){if(i.kind==="end")continue;const r=i.kind==="branch"?i.next.map(s=>s.target):[i.next,i.kind==="review"?i.rejectTo:null].filter(s=>!!s);for(const s of r)Lt(e,s)&&o.setEdge(i.id,s)}Us.layout(o);for(const i of e.nodes){const r=o.node(i.id),{width:s,height:a}=n(i);i.position={x:Math.round(r.x-s/2),y:Math.round(r.y-a/2)}}for(const i of e.nodes)i.kind==="review"&&i.rejectTo!==null&&i.position&&(i.position={x:i.position.x,y:i.position.y+170})}async function Jo(e,t){try{const n=await e.json();if(n&&typeof n.error=="string"&&n.error)return new Error(n.error)}catch{}return new Error(ee("workflow.httpError",{msg:t,status:e.status}))}async function Bb(){const e=await fetch("/api/workflows");if(!e.ok)throw await Jo(e,ee("workflow.loadListFailed"));const t=await e.json();return Array.isArray(t.workflows)?t.workflows:[]}async function _i(e){const t=await fetch(`/api/workflows/${encodeURIComponent(e)}`);if(!t.ok)throw await Jo(t,ee("workflow.loadFailed"));return(await t.json()).workflow}async function Ui(e){const t=await fetch(`/api/workflows/${encodeURIComponent(e.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({workflow:e})});if(!t.ok)throw await Jo(t,ee("workflow.saveFailed"))}async function na(e){const t=await fetch(`/api/workflows/${encodeURIComponent(e)}`,{method:"DELETE"});if(!t.ok)throw await Jo(t,ee("workflow.deleteFailed"))}const Vb={class:"wf-editor"},Lb={class:"wf-editor__topbar"},Hb={class:"wf-editor__topbar-left"},Fb=["aria-label","title"],Yb={class:"wf-editor__name"},Gb={class:"wf-editor__badge"},Xb={key:0,class:"wf-editor__dirty"},Wb={class:"wf-editor__topbar-right"},jb=["title"],Ub={key:0,class:"wf-editor__issues-pop"},Zb=["title"],qb=["title"],Kb={key:0,class:"wf-select__menu"},Jb={class:"wf-select__option-name"},Qb={class:"wf-select__option-desc"},ek={class:"wf-select__option-name"},tk={class:"wf-select__option-desc"},nk={class:"wf-select__option-name"},ok={class:"wf-select__option-desc"},ik={class:"wf-select__option-name"},rk={class:"wf-select__option-desc"},sk={class:"wf-select__option-name"},ak={class:"wf-select__option-desc"},lk=["disabled"],uk={key:0,class:"wf-editor__flash"},ck={class:"wf-editor__body"},dk={class:"wf-editor__canvas"},fk={class:"wf-panel"},hk={class:"wf-panel__section"},gk={class:"wf-panel__heading"},vk={class:"wf-field"},pk={class:"wf-field__label"},mk={class:"wf-field"},wk={class:"wf-field__label"},yk=["placeholder"],_k={class:"wf-field"},bk={class:"wf-field__label"},kk={class:"wf-segment"},Ek={class:"wf-field__hint"},$k={class:"wf-field"},xk={class:"wf-field__label"},Nk=["value"],Sk={class:"wf-field"},Ck={class:"wf-field__label"},Mk=["placeholder"],Ik={class:"wf-panel__section"},Tk={class:"wf-panel__heading"},Ok={class:"wf-field"},Dk={class:"wf-field__label"},Ak={class:"wf-panel__section"},Pk={class:"wf-panel__heading"},Rk={class:"wf-panel__heading-id"},zk={class:"wf-field"},Bk={class:"wf-field__label"},Vk={class:"wf-field"},Lk={class:"wf-field__label"},Hk=["placeholder"],Fk={class:"wf-field"},Yk={class:"wf-field__label"},Gk=["placeholder"],Xk={class:"wf-panel__section"},Wk={class:"wf-panel__heading"},jk={key:0,class:"wf-route-list"},Uk={class:"wf-route-row"},Zk={class:"wf-route-row__name"},qk=["aria-label"],Kk={key:1,class:"wf-panel__empty"},Jk={class:"wf-panel__hint"},Qk={class:"wf-panel__section"},eE={key:1,class:"wf-confirm-row"},tE={class:"wf-confirm-row__text"},nE={class:"wf-panel__section"},oE={class:"wf-panel__heading"},iE={class:"wf-panel__heading-id"},rE={class:"wf-field"},sE={class:"wf-field__label"},aE={class:"wf-field"},lE={class:"wf-field__label"},uE=["placeholder"],cE={class:"wf-field"},dE={class:"wf-field__label"},fE=["value"],hE={class:"wf-field__hint"},gE={class:"wf-panel__section"},vE={class:"wf-panel__heading"},pE={key:0,class:"wf-route-list"},mE={class:"wf-route-row"},wE={class:"wf-route-row__name"},yE=["aria-label"],_E={key:1,class:"wf-panel__empty"},bE={class:"wf-panel__hint"},kE={class:"wf-panel__section"},EE={class:"wf-panel__heading"},$E={key:0,class:"wf-route-list"},xE={class:"wf-route-row"},NE={class:"wf-route-row__name"},SE=["aria-label"],CE={key:1,class:"wf-panel__empty wf-panel__empty--error"},ME={class:"wf-panel__hint"},IE={class:"wf-panel__section"},TE={key:1,class:"wf-confirm-row"},OE={class:"wf-confirm-row__text"},DE={class:"wf-panel__section"},AE={class:"wf-panel__heading"},PE={class:"wf-panel__heading-id"},RE={class:"wf-field"},zE={class:"wf-field__label"},BE={class:"wf-panel__section"},VE={class:"wf-panel__heading"},LE={key:0,class:"wf-route-list"},HE={class:"wf-route-row"},FE={class:"wf-route-row__name"},YE=["aria-label","onClick"],GE=["onUpdate:modelValue","placeholder"],XE={key:1,class:"wf-panel__empty"},WE={class:"wf-panel__hint"},jE={class:"wf-panel__section"},UE={key:1,class:"wf-confirm-row"},ZE={class:"wf-confirm-row__text"},qE={class:"wf-panel__section"},KE={class:"wf-panel__heading"},JE={class:"wf-panel__heading-id"},QE={class:"wf-field"},e$={class:"wf-field__label"},t$={key:0,class:"wf-panel__section"},n$={class:"wf-panel__heading"},o$={key:0,class:"wf-route-list"},i$={class:"wf-route-row"},r$={class:"wf-route-row__name"},s$=["aria-label"],a$={key:1,class:"wf-panel__empty wf-panel__empty--error"},l$={class:"wf-panel__hint"},u$={class:"wf-panel__section"},c$={key:1,class:"wf-confirm-row"},d$={class:"wf-confirm-row__text"},f$=ye({__name:"WorkflowEditorView",props:{workflow:{}},emits:["back","save"],setup(e,{emit:t}){const n=e,o=t,i=me([]),r=me([]),s=me(""),a=me(!1),l=me(""),u=me(!1),c=me(!1),d=me(!1),f=me(null),h=me(null),_=me(!1);let b=null;const{project:S,fitView:$,getViewport:N,updateNodeInternals:m}=Se(),E=se(()=>zb(n.workflow)),A=se(()=>E.value.filter(g=>g.level==="error").length),V=se(()=>(Nu.value,A.value>0?ee("workflow.issueErrors",{n:A.value}):E.value.length>0?ee("workflow.issueWarnings",{n:E.value.length}):ee("workflow.issueOk"))),F=se(()=>new Set(E.value.map(g=>g.nodeId).filter(Boolean))),B=se(()=>Array.from(F.value).sort().join(",")),X=se(()=>n.workflow.nodes.find(g=>g.id===s.value)??null),H=se(()=>{var g;return((g=X.value)==null?void 0:g.kind)==="stage"?X.value:null}),z=se(()=>{var g;return((g=X.value)==null?void 0:g.kind)==="review"?X.value:null}),C=se(()=>{var g;return((g=X.value)==null?void 0:g.kind)==="branch"?X.value:null}),W=se(()=>{var g,p;return((g=X.value)==null?void 0:g.kind)==="start"||((p=X.value)==null?void 0:p.kind)==="end"?X.value:null});function v(g){var p;return((p=n.workflow.nodes.find(w=>w.id===g))==null?void 0:p.name)??g}function x(){n.workflow.nodes.length>0&&n.workflow.nodes.some(p=>!p.position)&&ta(n.workflow);const g=Mb(n.workflow,F.value);i.value=g.nodes,r.value=g.edges,Ge(()=>m())}$e(B,x),$e(()=>n.workflow,()=>{u.value=!0},{deep:!0});function y(g){const{source:p,target:w}=g;if(!p||!w||p===w)return;const I=g.sourceHandle??"",M=n.workflow.nodes.find(U=>U.id===p);if(!(!M||M.kind==="end")){if(I.startsWith("reject-")){const U=M.kind==="review"?M.rejectTo:null,Z=Pb(n.workflow,p,w);Z?de(Z):U&&U!==w&&de(ee("workflow.flashReplaceReject",{name:v(U)}))}else if(M.kind==="branch"){const U=/^out-(\d+)$/.exec(I),Z=U?parseInt(U[1],10):-1;if(Z>=0&&Z<M.next.length){const re=Ab(n.workflow,p,Z,w);de(re||ee("workflow.flashBranchRetarget",{name:v(w)}))}else{const re=Qs(n.workflow,p,w);re&&de(re)}}else{const U=M.next,Z=Qs(n.workflow,p,w);Z?de(Z):U&&U!==w&&de(ee("workflow.flashReplaceRoute",{name:v(U)}))}x()}}function O(g){let p=!1;for(const w of g){if(w.type==="position"&&w.position){const I=n.workflow.nodes.find(M=>M.id===w.id);I&&(I.position={...w.position})}w.type==="remove"&&(Js(n.workflow,w.id),s.value===w.id&&(s.value=""),p=!0),w.type==="select"&&(w.selected?s.value=w.id:s.value===w.id&&(s.value=""))}i.value=ag(g,i.value),p&&x()}function T(g){let p=!1;for(const w of g)if(w.type==="remove"){const I=w.id.startsWith("reject:"),[M,U]=(I?w.id.slice(7):w.id).split("->");if(!M||!U)continue;I?ea(n.workflow,M):yi(n.workflow,M,U),p=!0}r.value=sg(g,r.value),p&&x()}function R(g){s.value=g.node.id,_.value=!1}function D(){s.value="",_.value=!1}function G(g){if(!g.target.classList.contains("vue-flow__pane"))return;const w=S({x:g.clientX,y:g.clientY}),I=Ks(n.workflow,{x:w.x-105,y:w.y-48});x(),s.value=I.id}function K(g){d.value=!1;const p=N(),w=document.querySelector(".wf-editor__canvas"),I=w==null?void 0:w.getBoundingClientRect(),M=((I==null?void 0:I.width)??800)/2,U=((I==null?void 0:I.height)??500)/2,Z={x:(M-p.x)/p.zoom-90,y:(U-p.y)/p.zoom-50},re=g==="review"?Ib(n.workflow,Z):g==="branch"?Tb(n.workflow,Z):g==="start"?Ob(n.workflow,Z):g==="end"?Db(n.workflow,Z):Ks(n.workflow,Z);x(),s.value=re.id}function ie(g){const p=g.target.value.replace(/[^0-9]/g,"");g.target.value=p;const w=parseInt(p,10);Number.isFinite(w)&&w>0&&(n.workflow.maxStageRounds=w)}function ae(g){const p=g.target.value.replace(/[^0-9]/g,"");g.target.value=p;const w=parseInt(p,10);Number.isFinite(w)&&w>0&&z.value&&(z.value.maxRejects=w)}function q(g){X.value&&(yi(n.workflow,X.value.id,g),x())}function J(){const g=X.value;!g||g.kind==="branch"||!g.next||(yi(n.workflow,g.id,g.next),x())}function te(){const g=z.value;g!=null&&g.rejectTo&&(ea(n.workflow,g.id),x())}function fe(){X.value&&(Js(n.workflow,X.value.id),s.value="",_.value=!1,x())}function we(){ta(n.workflow),x(),Ge(()=>$({padding:.2,maxZoom:1}))}function de(g){l.value=g,b&&clearTimeout(b),b=setTimeout(()=>{l.value=""},2600)}async function _e(){if(A.value>0){a.value=!0,de(ee("workflow.flashFixErrors",{n:A.value}));return}if(!c.value){c.value=!0;try{await Ui(n.workflow),u.value=!1,o("save"),de(ee("workflow.flashSaved"))}catch(g){de(g instanceof Error?g.message:ee("workflow.saveFailed"))}finally{c.value=!1}}}function ce(g){d.value&&f.value&&!f.value.contains(g.target)&&(d.value=!1),a.value&&h.value&&!h.value.contains(g.target)&&(a.value=!1)}function ne(g){return{"--icon-src":`url(${g})`}}return rt(()=>{x(),document.addEventListener("click",ce),Ge(()=>$({padding:.2,maxZoom:1}))}),Zi(()=>{document.removeEventListener("click",ce),b&&clearTimeout(b)}),(g,p)=>(L(),j("div",Vb,[k("header",Lb,[k("div",Hb,[k("button",{type:"button",class:"wf-icon-btn","aria-label":g.$t("workflow.backToLibrary"),title:g.$t("workflow.backToLibrary"),onClick:p[0]||(p[0]=w=>g.$emit("back"))},[k("span",{class:"icon",style:ue(ne(P(ge).arrowLeft)),"aria-hidden":"true"},null,4)],8,Fb),k("span",{class:"icon wf-editor__logo",style:ue(ne(P(ge).workflow)),"aria-hidden":"true"},null,4),k("span",Yb,Y(e.workflow.name),1),k("span",Gb,Y(e.workflow.source==="builtin"?g.$t("workflow.badgeBuiltin"):g.$t("workflow.badgeUser")),1),u.value?(L(),j("span",Xb,Y(g.$t("workflow.unsaved")),1)):Ne("",!0)]),k("div",Wb,[k("div",{class:"wf-editor__issues-anchor",ref_key:"issuesAnchorRef",ref:h},[k("button",{type:"button",class:Oe(["wf-btn wf-btn--ghost",{"wf-btn--issue":A.value>0}]),title:g.$t("workflow.checkIssues"),onClick:p[1]||(p[1]=bi(w=>a.value=!a.value,["stop"]))},[k("span",{class:"icon",style:ue(ne(A.value>0?P(ge).circleAlert:P(ge).check)),"aria-hidden":"true"},null,4),k("span",null,Y(V.value),1)],10,jb),a.value&&E.value.length?(L(),j("div",Ub,[(L(!0),j(Ce,null,it(E.value,(w,I)=>(L(),j("div",{key:I,class:Oe(["wf-issue",`wf-issue--${w.level}`])},[k("span",{class:"icon",style:ue(ne(w.level==="error"?P(ge).circleAlert:P(ge).triangleAlert)),"aria-hidden":"true"},null,4),k("span",null,Y(w.message),1)],2))),128))])):Ne("",!0)],512),k("button",{type:"button",class:"wf-btn wf-btn--ghost",title:g.$t("workflow.autoLayout"),onClick:we},[k("span",{class:"icon",style:ue(ne(P(ge).layoutGrid)),"aria-hidden":"true"},null,4),k("span",null,Y(g.$t("workflow.autoLayout")),1)],8,Zb),k("div",{class:"wf-select wf-select--toolbar",ref_key:"addNodeSelectRef",ref:f},[k("button",{type:"button",class:"wf-btn wf-btn--ghost",title:g.$t("workflow.addNodeTitle"),onClick:p[2]||(p[2]=bi(w=>d.value=!d.value,["stop"]))},[k("span",{class:"icon",style:ue(ne(P(ge).plus)),"aria-hidden":"true"},null,4),k("span",null,Y(g.$t("workflow.addNode")),1),k("span",{class:"icon wf-select__caret",style:ue(ne(P(ge).chevronDown)),"aria-hidden":"true"},null,4)],8,qb),d.value?(L(),j("div",Kb,[k("button",{type:"button",class:"wf-select__option",onClick:p[3]||(p[3]=w=>K("stage"))},[k("span",{class:"icon",style:ue(ne(P(ge).plus)),"aria-hidden":"true"},null,4),k("span",Jb,Y(g.$t("workflow.stage")),1),k("span",Qb,Y(g.$t("workflow.stageDesc")),1)]),k("button",{type:"button",class:"wf-select__option",onClick:p[4]||(p[4]=w=>K("review"))},[k("span",{class:"icon",style:ue(ne(P(ge).eye)),"aria-hidden":"true"},null,4),k("span",ek,Y(g.$t("workflow.review")),1),k("span",tk,Y(g.$t("workflow.reviewDesc")),1)]),k("button",{type:"button",class:"wf-select__option",onClick:p[5]||(p[5]=w=>K("branch"))},[k("span",{class:"icon",style:ue(ne(P(ge).gitBranch)),"aria-hidden":"true"},null,4),k("span",nk,Y(g.$t("workflow.branch")),1),k("span",ok,Y(g.$t("workflow.branchDesc")),1)]),k("button",{type:"button",class:"wf-select__option",onClick:p[6]||(p[6]=w=>K("start"))},[k("span",{class:"icon",style:ue(ne(P(ge).play)),"aria-hidden":"true"},null,4),k("span",ik,Y(g.$t("workflow.start")),1),k("span",rk,Y(g.$t("workflow.startDesc")),1)]),k("button",{type:"button",class:"wf-select__option",onClick:p[7]||(p[7]=w=>K("end"))},[k("span",{class:"icon",style:ue(ne(P(ge).octagon)),"aria-hidden":"true"},null,4),k("span",sk,Y(g.$t("workflow.end")),1),k("span",ak,Y(g.$t("workflow.endDesc")),1)])])):Ne("",!0)],512),k("button",{type:"button",class:"wf-btn wf-btn--primary",disabled:c.value,onClick:_e},[k("span",{class:"icon",style:ue(ne(P(ge).save)),"aria-hidden":"true"},null,4),k("span",null,Y(c.value?g.$t("common.saving"):g.$t("common.save")),1)],8,lk)])]),l.value?(L(),j("div",uk,Y(l.value),1)):Ne("",!0),k("div",ck,[k("div",dk,[be(P(rp),{nodes:i.value,"onUpdate:nodes":p[8]||(p[8]=w=>i.value=w),edges:r.value,"onUpdate:edges":p[9]||(p[9]=w=>r.value=w),class:"wf-flow","delete-key-code":["Backspace","Delete"],"min-zoom":.2,"max-zoom":2,onConnect:y,onNodesChange:O,onEdgesChange:T,onNodeClick:R,onPaneClick:D,onDblclick:G},{"node-stage":ze(w=>[be(P0,dn(Fn(w)),null,16)]),"node-review":ze(w=>[be(Y0,dn(Fn(w)),null,16)]),"node-branch":ze(w=>[be(U0,dn(Fn(w)),null,16)]),"node-boundary":ze(w=>[be(B0,dn(Fn(w)),null,16)]),default:ze(()=>[be(P(hp),{gap:24,size:1.5,"pattern-color":"var(--border-strong)"}),be(P(Gp),{"show-interactive":!1,position:"bottom-left"}),be(P(N0),{pannable:"",zoomable:"",position:"bottom-right","node-color":"var(--text-tertiary)","mask-color":"color-mix(in srgb, var(--surface-base) 72%, transparent)"})]),_:1},8,["nodes","edges"])]),k("aside",fk,[X.value?H.value?(L(),j(Ce,{key:1},[k("div",Ak,[k("div",Pk,[k("span",null,Y(g.$t("workflow.stageProps")),1),k("span",Rk,Y(H.value.id),1)]),k("label",zk,[k("span",Bk,Y(g.$t("workflow.stageNameLabel")),1),Fe(k("input",{"onUpdate:modelValue":p[16]||(p[16]=w=>H.value.name=w),class:"wf-input",type:"text"},null,512),[[Ye,H.value.name]])]),k("label",Vk,[k("span",Lk,Y(g.$t("workflow.stageGoalLabel")),1),Fe(k("textarea",{"onUpdate:modelValue":p[17]||(p[17]=w=>H.value.goal=w),class:"wf-textarea",rows:"2",placeholder:g.$t("workflow.stageGoalPlaceholder")},null,8,Hk),[[Ye,H.value.goal]])]),k("label",Fk,[k("span",Yk,Y(g.$t("workflow.stageWorkLabel")),1),Fe(k("textarea",{"onUpdate:modelValue":p[18]||(p[18]=w=>H.value.instructions=w),class:"wf-textarea",rows:"4",placeholder:g.$t("workflow.stageWorkPlaceholder")},null,8,Gk),[[Ye,H.value.instructions]])])]),k("div",Xk,[k("div",Wk,Y(g.$t("workflow.forwardRoute")),1),H.value.next?(L(),j("div",jk,[k("div",Uk,[k("span",{class:"icon",style:ue(ne(P(ge).gitBranch)),"aria-hidden":"true"},null,4),k("span",Zk,Y(v(H.value.next)),1),k("button",{type:"button",class:"wf-icon-btn wf-icon-btn--sm","aria-label":g.$t("workflow.removeRouteAriaLabel",{name:v(H.value.next)}),onClick:J},[k("span",{class:"icon",style:ue(ne(P(ge).x)),"aria-hidden":"true"},null,4)],8,qk)])])):(L(),j("div",Kk,Y(g.$t("workflow.endStageEmpty")),1)),k("div",Jk,Y(g.$t("workflow.routeHint")),1)]),k("div",Qk,[_.value?(L(),j("div",eE,[k("span",tE,Y(g.$t("workflow.deleteNodeWarning")),1),k("button",{type:"button",class:"wf-btn wf-btn--danger-confirm",onClick:fe},Y(g.$t("workflow.confirmDelete")),1)])):(L(),j("button",{key:0,type:"button",class:"wf-btn wf-btn--danger-outline",onClick:p[19]||(p[19]=w=>_.value=!0)},[k("span",{class:"icon",style:ue(ne(P(ge).trash)),"aria-hidden":"true"},null,4),k("span",null,Y(g.$t("workflow.deleteNode")),1)]))])],64)):z.value?(L(),j(Ce,{key:2},[k("div",nE,[k("div",oE,[k("span",null,Y(g.$t("workflow.reviewProps")),1),k("span",iE,Y(z.value.id),1)]),k("label",rE,[k("span",sE,Y(g.$t("workflow.reviewNameLabel")),1),Fe(k("input",{"onUpdate:modelValue":p[20]||(p[20]=w=>z.value.name=w),class:"wf-input",type:"text"},null,512),[[Ye,z.value.name]])]),k("label",aE,[k("span",lE,Y(g.$t("workflow.reviewFocusLabel")),1),Fe(k("textarea",{"onUpdate:modelValue":p[21]||(p[21]=w=>z.value.prompt=w),class:"wf-textarea",rows:"3",placeholder:g.$t("workflow.reviewFocusPlaceholder")},null,8,uE),[[Ye,z.value.prompt]])]),k("label",cE,[k("span",dE,Y(g.$t("workflow.maxRejectsLabel")),1),k("input",{class:"wf-input",type:"text",inputmode:"numeric",value:z.value.maxRejects,onInput:ae},null,40,fE),k("span",hE,Y(g.$t("workflow.maxRejectsHint")),1)])]),k("div",gE,[k("div",vE,Y(g.$t("workflow.passRoute")),1),z.value.next?(L(),j("div",pE,[k("div",mE,[k("span",{class:"icon wf-route-row__icon--pass",style:ue(ne(P(ge).gitBranch)),"aria-hidden":"true"},null,4),k("span",wE,Y(v(z.value.next)),1),k("button",{type:"button",class:"wf-icon-btn wf-icon-btn--sm","aria-label":g.$t("workflow.removePassRouteAriaLabel",{name:v(z.value.next)}),onClick:J},[k("span",{class:"icon",style:ue(ne(P(ge).x)),"aria-hidden":"true"},null,4)],8,yE)])])):(L(),j("div",_E,Y(g.$t("workflow.passEndsWorkflow")),1)),k("div",bE,Y(g.$t("workflow.passRouteHint")),1)]),k("div",kE,[k("div",EE,Y(g.$t("workflow.rejectRoute")),1),z.value.rejectTo?(L(),j("div",$E,[k("div",xE,[k("span",{class:"icon wf-route-row__icon--back",style:ue(ne(P(ge).gitBranch)),"aria-hidden":"true"},null,4),k("span",NE,Y(v(z.value.rejectTo)),1),k("button",{type:"button",class:"wf-icon-btn wf-icon-btn--sm","aria-label":g.$t("workflow.removeRejectRouteAriaLabel",{name:v(z.value.rejectTo)}),onClick:te},[k("span",{class:"icon",style:ue(ne(P(ge).x)),"aria-hidden":"true"},null,4)],8,SE)])])):(L(),j("div",CE,Y(g.$t("workflow.rejectRequired")),1)),k("div",ME,Y(g.$t("workflow.rejectRouteHint")),1)]),k("div",IE,[_.value?(L(),j("div",TE,[k("span",OE,Y(g.$t("workflow.deleteNodeWarning")),1),k("button",{type:"button",class:"wf-btn wf-btn--danger-confirm",onClick:fe},Y(g.$t("workflow.confirmDelete")),1)])):(L(),j("button",{key:0,type:"button",class:"wf-btn wf-btn--danger-outline",onClick:p[22]||(p[22]=w=>_.value=!0)},[k("span",{class:"icon",style:ue(ne(P(ge).trash)),"aria-hidden":"true"},null,4),k("span",null,Y(g.$t("workflow.deleteNode")),1)]))])],64)):C.value?(L(),j(Ce,{key:3},[k("div",DE,[k("div",AE,[k("span",null,Y(g.$t("workflow.branchProps")),1),k("span",PE,Y(C.value.id),1)]),k("label",RE,[k("span",zE,Y(g.$t("workflow.branchNameLabel")),1),Fe(k("input",{"onUpdate:modelValue":p[23]||(p[23]=w=>C.value.name=w),class:"wf-input",type:"text"},null,512),[[Ye,C.value.name]])])]),k("div",BE,[k("div",VE,Y(g.$t("workflow.branchOuts",{n:C.value.next.length})),1),C.value.next.length?(L(),j("div",LE,[(L(!0),j(Ce,null,it(C.value.next,w=>(L(),j("div",{key:w.target,class:"wf-route-item"},[k("div",HE,[k("span",{class:"icon",style:ue(ne(P(ge).gitBranch)),"aria-hidden":"true"},null,4),k("span",FE,Y(v(w.target)),1),k("button",{type:"button",class:"wf-icon-btn wf-icon-btn--sm","aria-label":g.$t("workflow.removeOutAriaLabel",{name:v(w.target)}),onClick:I=>q(w.target)},[k("span",{class:"icon",style:ue(ne(P(ge).x)),"aria-hidden":"true"},null,4)],8,YE)]),Fe(k("input",{"onUpdate:modelValue":I=>w.condition=I,class:"wf-input wf-input--sm",type:"text",placeholder:g.$t("workflow.branchConditionPlaceholder")},null,8,GE),[[Ye,w.condition]])]))),128))])):(L(),j("div",XE,Y(g.$t("workflow.branchNoOuts")),1)),k("div",WE,Y(g.$t("workflow.branchRouteHint")),1)]),k("div",jE,[_.value?(L(),j("div",UE,[k("span",ZE,Y(g.$t("workflow.deleteNodeWarning")),1),k("button",{type:"button",class:"wf-btn wf-btn--danger-confirm",onClick:fe},Y(g.$t("workflow.confirmDelete")),1)])):(L(),j("button",{key:0,type:"button",class:"wf-btn wf-btn--danger-outline",onClick:p[24]||(p[24]=w=>_.value=!0)},[k("span",{class:"icon",style:ue(ne(P(ge).trash)),"aria-hidden":"true"},null,4),k("span",null,Y(g.$t("workflow.deleteNode")),1)]))])],64)):W.value?(L(),j(Ce,{key:4},[k("div",qE,[k("div",KE,[k("span",null,Y(W.value.kind==="start"?g.$t("workflow.startNode"):g.$t("workflow.endNode")),1),k("span",JE,Y(W.value.id),1)]),k("label",QE,[k("span",e$,Y(g.$t("workflow.boundaryNameLabel")),1),Fe(k("input",{"onUpdate:modelValue":p[25]||(p[25]=w=>W.value.name=w),class:"wf-input",type:"text"},null,512),[[Ye,W.value.name]])])]),W.value.kind==="start"?(L(),j("div",t$,[k("div",n$,Y(g.$t("workflow.entryRoute")),1),W.value.next?(L(),j("div",o$,[k("div",i$,[k("span",{class:"icon",style:ue(ne(P(ge).gitBranch)),"aria-hidden":"true"},null,4),k("span",r$,Y(v(W.value.next)),1),k("button",{type:"button",class:"wf-icon-btn wf-icon-btn--sm","aria-label":g.$t("workflow.disconnectEntryAriaLabel",{name:v(W.value.next)}),onClick:J},[k("span",{class:"icon",style:ue(ne(P(ge).x)),"aria-hidden":"true"},null,4)],8,s$)])])):(L(),j("div",a$,Y(g.$t("workflow.entryNotConnected")),1)),k("div",l$,Y(g.$t("workflow.startOnlyHint")),1)])):Ne("",!0),k("div",u$,[_.value?(L(),j("div",c$,[k("span",d$,Y(g.$t("workflow.deleteNodeWarning")),1),k("button",{type:"button",class:"wf-btn wf-btn--danger-confirm",onClick:fe},Y(g.$t("workflow.confirmDelete")),1)])):(L(),j("button",{key:0,type:"button",class:"wf-btn wf-btn--danger-outline",onClick:p[26]||(p[26]=w=>_.value=!0)},[k("span",{class:"icon",style:ue(ne(P(ge).trash)),"aria-hidden":"true"},null,4),k("span",null,Y(g.$t("workflow.deleteNode")),1)]))])],64)):Ne("",!0):(L(),j(Ce,{key:0},[k("div",hk,[k("div",gk,Y(g.$t("workflow.workflowProps")),1),k("label",vk,[k("span",pk,Y(g.$t("workflow.nameLabel")),1),Fe(k("input",{"onUpdate:modelValue":p[10]||(p[10]=w=>e.workflow.name=w),class:"wf-input",type:"text",spellcheck:"false"},null,512),[[Ye,e.workflow.name]])]),k("label",mk,[k("span",wk,Y(g.$t("workflow.descLabel")),1),Fe(k("input",{"onUpdate:modelValue":p[11]||(p[11]=w=>e.workflow.description=w),class:"wf-input",type:"text",placeholder:g.$t("workflow.descPlaceholder")},null,8,yk),[[Ye,e.workflow.description]])]),k("div",_k,[k("span",bk,Y(g.$t("workflow.reviewCapability")),1),k("div",kk,[k("button",{type:"button",class:Oe(["wf-segment__item",{"wf-segment__item--active":e.workflow.reviewMode==="readonly"}]),onClick:p[12]||(p[12]=w=>e.workflow.reviewMode="readonly")},Y(g.$t("workflow.reviewReadonly")),3),k("button",{type:"button",class:Oe(["wf-segment__item",{"wf-segment__item--active":e.workflow.reviewMode==="active"}]),onClick:p[13]||(p[13]=w=>e.workflow.reviewMode="active")},Y(g.$t("workflow.reviewActive")),3)]),k("span",Ek,Y(g.$t("workflow.reviewModeHint")),1)]),k("label",$k,[k("span",xk,Y(g.$t("workflow.maxRoundsLabel")),1),k("input",{class:"wf-input",type:"text",inputmode:"numeric",value:e.workflow.maxStageRounds,onInput:ie},null,40,Nk)]),k("label",Sk,[k("span",Ck,Y(g.$t("workflow.endMethodLabel")),1),Fe(k("input",{"onUpdate:modelValue":p[14]||(p[14]=w=>e.workflow.endConditions=w),class:"wf-input",type:"text",placeholder:g.$t("workflow.endMethodPlaceholder")},null,8,Mk),[[Ye,e.workflow.endConditions]])])]),k("div",Ik,[k("div",Tk,Y(g.$t("workflow.globalNotes")),1),k("label",Ok,[k("span",Dk,Y(g.$t("workflow.globalNotesLabel")),1),Fe(k("textarea",{"onUpdate:modelValue":p[15]||(p[15]=w=>e.workflow.body=w),class:"wf-textarea",rows:"8",spellcheck:"false"},null,512),[[Ye,e.workflow.body]])])])],64))])])]))}}),h$=Ft(f$,[["__scopeId","data-v-a47f35d2"]]),g$={class:"wf-shell"},v$={key:2,class:"wf-shell__loading"},p$={key:3,class:"wf-shell__error",role:"alert"},m$=ye({__name:"WorkflowDemoShell",props:{routePath:{}},setup(e){const t=e;function n(m){if(!m.startsWith("workflow/"))return"";const E=m.slice(9).replace(/\/+$/,"");return E.endsWith("/edit")?E.slice(0,-5):E}const o=me([]),i=me(!1),r=me(n(t.routePath)),s=me(null),a=me(""),l=se(()=>r.value?"editor":"library");function u(m,E){a.value=m instanceof Error?m.message:E}async function c(){try{o.value=await Bb()}catch(m){u(m,ee("workflow.loadListFailed"))}finally{i.value=!0}}async function d(m){try{s.value=await _i(m),r.value=m,history.replaceState({},"",`/workflow/${m}`)}catch(E){u(E,ee("workflow.loadFailed"))}}function f(){r.value="",s.value=null,history.replaceState({},"","/workflows"),c()}function h(m){const E=new Set(o.value.map(V=>V.name));if(!E.has(m))return m;let A=2;for(;E.has(`${m}-${A}`);)A+=1;return`${m}-${A}`}async function _(){const m=wb(h(`new-workflow-${Date.now().toString(36)}`));try{await Ui(m),await c(),await d(m.name)}catch(E){u(E,ee("workflow.createFailed"))}}async function b(m){try{const E=await _i(m),A=JSON.parse(JSON.stringify(E));A.name=h(`${m}-copy`),A.source="user",await Ui(A),await c()}catch(E){u(E,ee("workflow.duplicateFailed"))}}async function S(m){try{if(await na(m),r.value===m){f();return}await c()}catch(E){u(E,ee("workflow.deleteFailed"))}}async function $(){const m=s.value;if(m){if(m.name!==r.value){const E=r.value;r.value=m.name,history.replaceState({},"",`/workflow/${m.name}`);try{await na(E)}catch{}}c()}}function N(){window.location.assign("/new")}return rt(async()=>{if(await c(),r.value)try{s.value=await _i(r.value)}catch(m){u(m,ee("workflow.loadFailed")),f()}}),(m,E)=>(L(),j("div",g$,[l.value==="editor"&&s.value?(L(),Me(h$,{key:0,workflow:s.value,onBack:f,onSave:$},null,8,["workflow"])):l.value==="library"&&i.value?(L(),Me(qu,{key:1,workflows:o.value,onOpen:d,onCreate:_,onDuplicate:b,onDelete:S,onExit:N},null,8,["workflows"])):(L(),j("div",v$,Y(m.$t("common.loading")),1)),a.value?(L(),j("div",p$,[k("span",null,Y(a.value),1),be(Su,{label:m.$t("common.close"),onClick:E[0]||(E[0]=A=>a.value="")},null,8,["label"])])):Ne("",!0)]))}}),b$=Ft(m$,[["__scopeId","data-v-2190925d"]]);export{b$ as default};