vue-pure-admin/static/js/vue-flow-core-BWd71HaQ.js

22 lines
154 KiB
JavaScript

var wr=Object.defineProperty,br=Object.defineProperties;var xr=Object.getOwnPropertyDescriptors;var Lt=Object.getOwnPropertySymbols;var fo=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable;var dt=Math.pow,co=(e,t,n)=>t in e?wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,z=(e,t)=>{for(var n in t||(t={}))fo.call(t,n)&&co(e,n,t[n]);if(Lt)for(var n of Lt(t))ho.call(t,n)&&co(e,n,t[n]);return e},ge=(e,t)=>br(e,xr(t));var ft=(e,t)=>{var n={};for(var o in e)fo.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Lt)for(var o of Lt(e))t.indexOf(o)<0&&ho.call(e,o)&&(n[o]=e[o]);return n};var go=(e,t,n)=>new Promise((o,i)=>{var r=l=>{try{a(n.next(l))}catch(c){i(c)}},s=l=>{try{a(n.throw(l))}catch(c){i(c)}},a=l=>l.done?o(l.value):Promise.resolve(l.value).then(r,s);a((n=n.apply(e,t)).next())});import{g7 as ri,n as ve,Z as zt,r as Er,p as oe,ba as xt,b6 as yt,O as ue,b8 as si,b9 as qt,aH as Jn,b3 as Sr,g8 as Nr,d as xe,g9 as ai,P as ye,a as pe,m as Xe,o as li,f as fe,k as _e,Q as Ye,u as ee,v as ot,fB as Cr,g as it,s as Oe,j as ze,b as rt,F as st,T as Mr,aY as Ir,i as He,w as Dn,y as Fe,Y as kr,U as Pr,h as Tr,t as An,a3 as $r,l as Qn,z as ui,ga as Dr,be as gt,L as me,e as ci,gb as Ar}from"./index-AFhnwzwZ.js";function fn(e){return si()?(qt(e),!0):!1}function Ve(e){return typeof e=="function"?e():ee(e)}const Or=typeof window!="undefined"&&typeof document!="undefined",zr=e=>typeof e!="undefined",Br=Object.prototype.toString,Rr=e=>Br.call(e)==="[object Object]",Vr=()=>{};function Hr(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 di=e=>e();function Lr(e=di){const t=pe(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:Ar(t),pause:n,resume:o,eventFilter:i}}function vo(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Fr(e,t,n={}){const r=n,{eventFilter:o=di}=r,i=ft(r,["eventFilter"]);return ve(e,Hr(o,t),i)}function ht(e,t,n={}){const u=n,{eventFilter:o}=u,i=ft(u,["eventFilter"]),{eventFilter:r,pause:s,resume:a,isActive:l}=Lr(o);return{stop:Fr(e,t,ge(z({},i),{eventFilter:r})),pause:s,resume:a,isActive:l}}function Yr(e,t={}){if(!Jn(e))return Sr(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=Nr(()=>({get(){return e.value[o]},set(i){var r;if((r=Ve(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const a=[...e.value];a[o]=i,e.value=a}else{const a=ge(z({},e.value),{[o]:i});Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[o]=i}}));return n}function On(e,t=!1){function n(d,{flush:v="sync",deep:p=!1,timeout:N,throwOnTimeout:_}={}){let w=null;const I=[new Promise(m=>{w=ve(e,E=>{d(E)!==t&&(w==null||w(),m(E))},{flush:v,deep:p,immediate:!0})})];return N!=null&&I.push(vo(N,_).then(()=>Ve(e)).finally(()=>w==null?void 0:w())),Promise.race(I)}function o(d,v){if(!Jn(d))return n(E=>E===d,v);const{flush:p="sync",deep:N=!1,timeout:_,throwOnTimeout:w}=v!=null?v:{};let x=null;const m=[new Promise(E=>{x=ve([e,d],([R,Y])=>{t!==(R===Y)&&(x==null||x(),E(R))},{flush:p,deep:N,immediate:!0})})];return _!=null&&m.push(vo(_,w).then(()=>Ve(e)).finally(()=>(x==null||x(),Ve(e)))),Promise.race(m)}function i(d){return n(v=>!!v,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,v){return n(p=>{const N=Array.from(p);return N.includes(d)||N.includes(Ve(d))},v)}function c(d){return u(1,d)}function u(d=1,v){let p=-1;return n(()=>(p+=1,p>=d),v)}return Array.isArray(Ve(e))?{toMatch:n,toContains:l,changed:c,changedTimes:u,get not(){return On(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:a,toBeUndefined:s,changed:c,changedTimes:u,get not(){return On(e,!t)}}}function zn(e){return On(e)}function Gr(e){var t;const n=Ve(e);return(t=n==null?void 0:n.$el)!=null?t:n}const fi=Or?window:void 0;function hi(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=fi):[t,n,o,i]=e,!t)return Vr;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],s=()=>{r.forEach(u=>u()),r.length=0},a=(u,d,v,p)=>(u.addEventListener(d,v,p),()=>u.removeEventListener(d,v,p)),l=ve(()=>[Gr(t),Ve(i)],([u,d])=>{if(s(),!u)return;const v=Rr(d)?z({},d):d;r.push(...n.flatMap(p=>o.map(N=>a(u,p,N,v))))},{immediate:!0,flush:"post"}),c=()=>{l(),s()};return fn(c),c}function Xr(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function po(...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=fi,eventName:r="keydown",passive:s=!1,dedupe:a=!1}=o,l=Xr(t);return hi(i,r,u=>{u.repeat&&Ve(a)||l(u)&&n(u)},s)}function Ur(e){return JSON.parse(JSON.stringify(e))}function En(e,t,n,o={}){var i,r,s;const{clone:a=!1,passive:l=!1,eventName:c,deep:u=!1,defaultValue:d,shouldEmit:v}=o,p=zt(),N=n||(p==null?void 0:p.emit)||((i=p==null?void 0:p.$emit)==null?void 0:i.bind(p))||((s=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:s.bind(p==null?void 0:p.proxy));let _=c;t||(t="modelValue"),_=_||`update:${t.toString()}`;const w=m=>a?typeof a=="function"?a(m):Ur(m):m,x=()=>zr(e[t])?w(e[t]):d,I=m=>{v?v(m)&&N(_,m):N(_,m)};if(l){const m=x(),E=pe(m);let R=!1;return ve(()=>e[t],Y=>{R||(R=!0,E.value=w(Y),Fe(()=>R=!1))}),ve(E,Y=>{!R&&(Y!==e[t]||u)&&I(Y)},{deep:u}),E}else return oe({get(){return x()},set(m){I(m)}})}var Zr={value:()=>{}};function hn(){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 Jt(n)}function Jt(e){this._=e}function Kr(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}})}Jt.prototype=hn.prototype={constructor:Jt,on:function(e,t){var n=this._,o=Kr(e+"",n),i,r=-1,s=o.length;if(arguments.length<2){for(;++r<s;)if((i=(e=o[r]).type)&&(i=Wr(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]=mo(n[i],e.name,t);else if(t==null)for(i in n)n[i]=mo(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 Jt(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 Wr(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function mo(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Zr,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Bn="http://www.w3.org/1999/xhtml";const yo={svg:"http://www.w3.org/2000/svg",xhtml:Bn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function gn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),yo.hasOwnProperty(t)?{space:yo[t],local:e}:e}function qr(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Bn&&t.documentElement.namespaceURI===Bn?t.createElement(e):t.createElementNS(n,e)}}function Jr(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function gi(e){var t=gn(e);return(t.local?Jr:qr)(t)}function Qr(){}function jn(e){return e==null?Qr:function(){return this.querySelector(e)}}function jr(e){typeof e!="function"&&(e=jn(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,c,u=0;u<s;++u)(l=r[u])&&(c=e.call(l,l.__data__,u,r))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new Ie(o,this._parents)}function es(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ts(){return[]}function vi(e){return e==null?ts:function(){return this.querySelectorAll(e)}}function ns(e){return function(){return es(e.apply(this,arguments))}}function os(e){typeof e=="function"?e=ns(e):e=vi(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,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),i.push(l));return new Ie(o,i)}function pi(e){return function(){return this.matches(e)}}function mi(e){return function(t){return t.matches(e)}}var is=Array.prototype.find;function rs(e){return function(){return is.call(this.children,e)}}function ss(){return this.firstElementChild}function as(e){return this.select(e==null?ss:rs(typeof e=="function"?e:mi(e)))}var ls=Array.prototype.filter;function us(){return Array.from(this.children)}function cs(e){return function(){return ls.call(this.children,e)}}function ds(e){return this.selectAll(e==null?us:cs(typeof e=="function"?e:mi(e)))}function fs(e){typeof e!="function"&&(e=pi(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,c=0;c<s;++c)(l=r[c])&&e.call(l,l.__data__,c,r)&&a.push(l);return new Ie(o,this._parents)}function yi(e){return new Array(e.length)}function hs(){return new Ie(this._enter||this._groups.map(yi),this._parents)}function tn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}tn.prototype={constructor:tn,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 gs(e){return function(){return e}}function vs(e,t,n,o,i,r){for(var s=0,a,l=t.length,c=r.length;s<c;++s)(a=t[s])?(a.__data__=r[s],o[s]=a):n[s]=new tn(e,r[s]);for(;s<l;++s)(a=t[s])&&(i[s]=a)}function ps(e,t,n,o,i,r,s){var a,l,c=new Map,u=t.length,d=r.length,v=new Array(u),p;for(a=0;a<u;++a)(l=t[a])&&(v[a]=p=s.call(l,l.__data__,a,t)+"",c.has(p)?i[a]=l:c.set(p,l));for(a=0;a<d;++a)p=s.call(e,r[a],a,r)+"",(l=c.get(p))?(o[a]=l,l.__data__=r[a],c.delete(p)):n[a]=new tn(e,r[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(v[a])===l&&(i[a]=l)}function ms(e){return e.__data__}function ys(e,t){if(!arguments.length)return Array.from(this,ms);var n=t?ps:vs,o=this._parents,i=this._groups;typeof e!="function"&&(e=gs(e));for(var r=i.length,s=new Array(r),a=new Array(r),l=new Array(r),c=0;c<r;++c){var u=o[c],d=i[c],v=d.length,p=_s(e.call(u,u&&u.__data__,c,o)),N=p.length,_=a[c]=new Array(N),w=s[c]=new Array(N),x=l[c]=new Array(v);n(u,d,_,w,x,p,t);for(var I=0,m=0,E,R;I<N;++I)if(E=_[I]){for(I>=m&&(m=I+1);!(R=w[m])&&++m<N;);E._next=R||null}}return s=new Ie(s,o),s._enter=a,s._exit=l,s}function _s(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function ws(){return new Ie(this._exit||this._groups.map(yi),this._parents)}function bs(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 xs(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 c=n[l],u=o[l],d=c.length,v=a[l]=new Array(d),p,N=0;N<d;++N)(p=c[N]||u[N])&&(v[N]=p);for(;l<i;++l)a[l]=n[l];return new Ie(a,this._parents)}function Es(){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 Ss(e){e||(e=Ns);function t(d,v){return d&&v?e(d.__data__,v.__data__):!d-!v}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),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new Ie(i,this._parents).order()}function Ns(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Cs(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ms(){return Array.from(this)}function Is(){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 ks(){let e=0;for(const t of this)++e;return e}function Ps(){return!this.node()}function Ts(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 $s(e){return function(){this.removeAttribute(e)}}function Ds(e){return function(){this.removeAttributeNS(e.space,e.local)}}function As(e,t){return function(){this.setAttribute(e,t)}}function Os(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function zs(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Bs(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 Rs(e,t){var n=gn(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?Ds:$s:typeof t=="function"?n.local?Bs:zs:n.local?Os:As)(n,t))}function _i(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Vs(e){return function(){this.style.removeProperty(e)}}function Hs(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Ls(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Fs(e,t,n){return arguments.length>1?this.each((t==null?Vs:typeof t=="function"?Ls:Hs)(e,t,n==null?"":n)):_t(this.node(),e)}function _t(e,t){return e.style.getPropertyValue(t)||_i(e).getComputedStyle(e,null).getPropertyValue(t)}function Ys(e){return function(){delete this[e]}}function Gs(e,t){return function(){this[e]=t}}function Xs(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Us(e,t){return arguments.length>1?this.each((t==null?Ys:typeof t=="function"?Xs:Gs)(e,t)):this.node()[e]}function wi(e){return e.trim().split(/^|\s+/)}function eo(e){return e.classList||new bi(e)}function bi(e){this._node=e,this._names=wi(e.getAttribute("class")||"")}bi.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 xi(e,t){for(var n=eo(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function Ei(e,t){for(var n=eo(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Zs(e){return function(){xi(this,e)}}function Ks(e){return function(){Ei(this,e)}}function Ws(e,t){return function(){(t.apply(this,arguments)?xi:Ei)(this,e)}}function qs(e,t){var n=wi(e+"");if(arguments.length<2){for(var o=eo(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Ws:t?Zs:Ks)(n,t))}function Js(){this.textContent=""}function Qs(e){return function(){this.textContent=e}}function js(e){return function(){var t=e.apply(this,arguments);this.textContent=t==null?"":t}}function ea(e){return arguments.length?this.each(e==null?Js:(typeof e=="function"?js:Qs)(e)):this.node().textContent}function ta(){this.innerHTML=""}function na(e){return function(){this.innerHTML=e}}function oa(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t==null?"":t}}function ia(e){return arguments.length?this.each(e==null?ta:(typeof e=="function"?oa:na)(e)):this.node().innerHTML}function ra(){this.nextSibling&&this.parentNode.appendChild(this)}function sa(){return this.each(ra)}function aa(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function la(){return this.each(aa)}function ua(e){var t=typeof e=="function"?e:gi(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function ca(){return null}function da(e,t){var n=typeof e=="function"?e:gi(e),o=t==null?ca:typeof t=="function"?t:jn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function fa(){var e=this.parentNode;e&&e.removeChild(this)}function ha(){return this.each(fa)}function ga(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function va(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pa(e){return this.select(e?va:ga)}function ma(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ya(e){return function(t){e.call(this,t,this.__data__)}}function _a(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 wa(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 ba(e,t,n){return function(){var o=this.__on,i,r=ya(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 xa(e,t,n){var o=_a(e+""),i,r=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(i=0,u=a[l];i<r;++i)if((s=o[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?ba:wa,i=0;i<r;++i)this.each(a(o[i],t,n));return this}function Si(e,t,n){var o=_i(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 Ea(e,t){return function(){return Si(this,e,t)}}function Sa(e,t){return function(){return Si(this,e,t.apply(this,arguments))}}function Na(e,t){return this.each((typeof t=="function"?Sa:Ea)(e,t))}function*Ca(){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 Ni=[null];function Ie(e,t){this._groups=e,this._parents=t}function Bt(){return new Ie([[document.documentElement]],Ni)}function Ma(){return this}Ie.prototype=Bt.prototype={constructor:Ie,select:jr,selectAll:os,selectChild:as,selectChildren:ds,filter:fs,data:ys,enter:hs,exit:ws,join:bs,merge:xs,selection:Ma,order:Es,sort:Ss,call:Cs,nodes:Ms,node:Is,size:ks,empty:Ps,each:Ts,attr:Rs,style:Fs,property:Us,classed:qs,text:ea,html:ia,raise:sa,lower:la,append:ua,insert:da,remove:ha,clone:pa,datum:ma,on:xa,dispatch:Na,[Symbol.iterator]:Ca};function Pe(e){return typeof e=="string"?new Ie([[document.querySelector(e)]],[document.documentElement]):new Ie([[e]],Ni)}function Ia(e){let t;for(;t=e.sourceEvent;)e=t;return e}function De(e,t){if(e=Ia(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 ka={passive:!1},Pt={capture:!0,passive:!1};function Sn(e){e.stopImmediatePropagation()}function vt(e){e.preventDefault(),e.stopImmediatePropagation()}function Ci(e){var t=e.document.documentElement,n=Pe(e).on("dragstart.drag",vt,Pt);"onselectstart"in t?n.on("selectstart.drag",vt,Pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Mi(e,t){var n=e.document.documentElement,o=Pe(e).on("dragstart.drag",null);t&&(o.on("click.drag",vt,Pt),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 Ft=e=>()=>e;function Rn(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:s,y:a,dx:l,dy:c,dispatch:u}){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:c,enumerable:!0,configurable:!0},_:{value:u}})}Rn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Pa(e){return!e.ctrlKey&&!e.button}function Ta(){return this.parentNode}function $a(e,t){return t==null?{x:e.x,y:e.y}:t}function Da(){return navigator.maxTouchPoints||"ontouchstart"in this}function Aa(){var e=Pa,t=Ta,n=$a,o=Da,i={},r=hn("start","drag","end"),s=0,a,l,c,u,d=0;function v(E){E.on("mousedown.drag",p).filter(o).on("touchstart.drag",w).on("touchmove.drag",x,ka).on("touchend.drag touchcancel.drag",I).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(E,R){if(!(u||!e.call(this,E,R))){var Y=m(this,t.call(this,E,R),E,R,"mouse");Y&&(Pe(E.view).on("mousemove.drag",N,Pt).on("mouseup.drag",_,Pt),Ci(E.view),Sn(E),c=!1,a=E.clientX,l=E.clientY,Y("start",E))}}function N(E){if(vt(E),!c){var R=E.clientX-a,Y=E.clientY-l;c=R*R+Y*Y>d}i.mouse("drag",E)}function _(E){Pe(E.view).on("mousemove.drag mouseup.drag",null),Mi(E.view,c),vt(E),i.mouse("end",E)}function w(E,R){if(e.call(this,E,R)){var Y=E.changedTouches,G=t.call(this,E,R),X=Y.length,U,$;for(U=0;U<X;++U)($=m(this,G,E,R,Y[U].identifier,Y[U]))&&(Sn(E),$("start",E,Y[U]))}}function x(E){var R=E.changedTouches,Y=R.length,G,X;for(G=0;G<Y;++G)(X=i[R[G].identifier])&&(vt(E),X("drag",E,R[G]))}function I(E){var R=E.changedTouches,Y=R.length,G,X;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),G=0;G<Y;++G)(X=i[R[G].identifier])&&(Sn(E),X("end",E,R[G]))}function m(E,R,Y,G,X,U){var $=r.copy(),B=De(U||Y,R),S,ie,y;if((y=n.call(E,new Rn("beforestart",{sourceEvent:Y,target:v,identifier:X,active:s,x:B[0],y:B[1],dx:0,dy:0,dispatch:$}),G))!=null)return S=y.x-B[0]||0,ie=y.y-B[1]||0,function M(b,T,D){var A=B,L;switch(b){case"start":i[X]=M,L=s++;break;case"end":delete i[X],--s;case"drag":B=De(D||T,R),L=s;break}$.call(b,E,new Rn(b,{sourceEvent:T,subject:y,target:v,identifier:X,active:L,x:B[0]+S,y:B[1]+ie,dx:B[0]-A[0],dy:B[1]-A[1],dispatch:$}),G)}}return v.filter=function(E){return arguments.length?(e=typeof E=="function"?E:Ft(!!E),v):e},v.container=function(E){return arguments.length?(t=typeof E=="function"?E:Ft(E),v):t},v.subject=function(E){return arguments.length?(n=typeof E=="function"?E:Ft(E),v):n},v.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:Ft(!!E),v):o},v.on=function(){var E=r.on.apply(r,arguments);return E===r?v:E},v.clickDistance=function(E){return arguments.length?(d=(E=+E)*E,v):Math.sqrt(d)},v}function to(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ii(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Rt(){}var Tt=.7,nn=1/Tt,pt="\\s*([+-]?\\d+)\\s*",$t="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ae="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Oa=/^#([0-9a-f]{3,8})$/,za=new RegExp(`^rgb\\(${pt},${pt},${pt}\\)$`),Ba=new RegExp(`^rgb\\(${Ae},${Ae},${Ae}\\)$`),Ra=new RegExp(`^rgba\\(${pt},${pt},${pt},${$t}\\)$`),Va=new RegExp(`^rgba\\(${Ae},${Ae},${Ae},${$t}\\)$`),Ha=new RegExp(`^hsl\\(${$t},${Ae},${Ae}\\)$`),La=new RegExp(`^hsla\\(${$t},${Ae},${Ae},${$t}\\)$`),_o={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};to(Rt,Dt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:wo,formatHex:wo,formatHex8:Fa,formatHsl:Ya,formatRgb:bo,toString:bo});function wo(){return this.rgb().formatHex()}function Fa(){return this.rgb().formatHex8()}function Ya(){return ki(this).formatHsl()}function bo(){return this.rgb().formatRgb()}function Dt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Oa.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?xo(t):n===3?new Ce(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Yt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Yt(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=za.exec(e))?new Ce(t[1],t[2],t[3],1):(t=Ba.exec(e))?new Ce(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ra.exec(e))?Yt(t[1],t[2],t[3],t[4]):(t=Va.exec(e))?Yt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ha.exec(e))?No(t[1],t[2]/100,t[3]/100,1):(t=La.exec(e))?No(t[1],t[2]/100,t[3]/100,t[4]):_o.hasOwnProperty(e)?xo(_o[e]):e==="transparent"?new Ce(NaN,NaN,NaN,0):null}function xo(e){return new Ce(e>>16&255,e>>8&255,e&255,1)}function Yt(e,t,n,o){return o<=0&&(e=t=n=NaN),new Ce(e,t,n,o)}function Ga(e){return e instanceof Rt||(e=Dt(e)),e?(e=e.rgb(),new Ce(e.r,e.g,e.b,e.opacity)):new Ce}function Vn(e,t,n,o){return arguments.length===1?Ga(e):new Ce(e,t,n,o==null?1:o)}function Ce(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}to(Ce,Vn,Ii(Rt,{brighter(e){return e=e==null?nn:Math.pow(nn,e),new Ce(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Tt:Math.pow(Tt,e),new Ce(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ce(tt(this.r),tt(this.g),tt(this.b),on(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:Eo,formatHex:Eo,formatHex8:Xa,formatRgb:So,toString:So}));function Eo(){return`#${et(this.r)}${et(this.g)}${et(this.b)}`}function Xa(){return`#${et(this.r)}${et(this.g)}${et(this.b)}${et((isNaN(this.opacity)?1:this.opacity)*255)}`}function So(){const e=on(this.opacity);return`${e===1?"rgb(":"rgba("}${tt(this.r)}, ${tt(this.g)}, ${tt(this.b)}${e===1?")":`, ${e})`}`}function on(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function tt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function et(e){return e=tt(e),(e<16?"0":"")+e.toString(16)}function No(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Te(e,t,n,o)}function ki(e){if(e instanceof Te)return new Te(e.h,e.s,e.l,e.opacity);if(e instanceof Rt||(e=Dt(e)),!e)return new Te;if(e instanceof Te)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 Te(s,a,l,e.opacity)}function Ua(e,t,n,o){return arguments.length===1?ki(e):new Te(e,t,n,o==null?1:o)}function Te(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}to(Te,Ua,Ii(Rt,{brighter(e){return e=e==null?nn:Math.pow(nn,e),new Te(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Tt:Math.pow(Tt,e),new Te(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 Ce(Nn(e>=240?e-240:e+120,i,o),Nn(e,i,o),Nn(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new Te(Co(this.h),Gt(this.s),Gt(this.l),on(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=on(this.opacity);return`${e===1?"hsl(":"hsla("}${Co(this.h)}, ${Gt(this.s)*100}%, ${Gt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Co(e){return e=(e||0)%360,e<0?e+360:e}function Gt(e){return Math.max(0,Math.min(1,e||0))}function Nn(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 Pi=e=>()=>e;function Za(e,t){return function(n){return e+n*t}}function Ka(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 Wa(e){return(e=+e)==1?Ti:function(t,n){return n-t?Ka(t,n,e):Pi(isNaN(t)?n:t)}}function Ti(e,t){var n=t-e;return n?Za(e,n):Pi(isNaN(e)?t:e)}const Mo=function e(t){var n=Wa(t);function o(i,r){var s=n((i=Vn(i)).r,(r=Vn(r)).r),a=n(i.g,r.g),l=n(i.b,r.b),c=Ti(i.opacity,r.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=l(u),i.opacity=c(u),i+""}}return o.gamma=e,o}(1);function Ke(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Hn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Cn=new RegExp(Hn.source,"g");function qa(e){return function(){return e}}function Ja(e){return function(t){return e(t)+""}}function Qa(e,t){var n=Hn.lastIndex=Cn.lastIndex=0,o,i,r,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=Hn.exec(e))&&(i=Cn.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:Ke(o,i)})),n=Cn.lastIndex;return n<t.length&&(r=t.slice(n),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?Ja(l[0].x):qa(t):(t=l.length,function(c){for(var u=0,d;u<t;++u)a[(d=l[u]).i]=d.x(c);return a.join("")})}var Io=180/Math.PI,Ln={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function $i(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)*Io,skewX:Math.atan(l)*Io,scaleX:s,scaleY:a}}var Xt;function ja(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ln:$i(t.a,t.b,t.c,t.d,t.e,t.f)}function el(e){return e==null||(Xt||(Xt=document.createElementNS("http://www.w3.org/2000/svg","g")),Xt.setAttribute("transform",e),!(e=Xt.transform.baseVal.consolidate()))?Ln:(e=e.matrix,$i(e.a,e.b,e.c,e.d,e.e,e.f))}function Di(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,u,d,v,p,N){if(c!==d||u!==v){var _=p.push("translate(",null,t,null,n);N.push({i:_-4,x:Ke(c,d)},{i:_-2,x:Ke(u,v)})}else(d||v)&&p.push("translate("+d+t+v+n)}function s(c,u,d,v){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),v.push({i:d.push(i(d)+"rotate(",null,o)-2,x:Ke(c,u)})):u&&d.push(i(d)+"rotate("+u+o)}function a(c,u,d,v){c!==u?v.push({i:d.push(i(d)+"skewX(",null,o)-2,x:Ke(c,u)}):u&&d.push(i(d)+"skewX("+u+o)}function l(c,u,d,v,p,N){if(c!==d||u!==v){var _=p.push(i(p)+"scale(",null,",",null,")");N.push({i:_-4,x:Ke(c,d)},{i:_-2,x:Ke(u,v)})}else(d!==1||v!==1)&&p.push(i(p)+"scale("+d+","+v+")")}return function(c,u){var d=[],v=[];return c=e(c),u=e(u),r(c.translateX,c.translateY,u.translateX,u.translateY,d,v),s(c.rotate,u.rotate,d,v),a(c.skewX,u.skewX,d,v),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,d,v),c=u=null,function(p){for(var N=-1,_=v.length,w;++N<_;)d[(w=v[N]).i]=w.x(p);return d.join("")}}}var tl=Di(ja,"px, ","px)","deg)"),nl=Di(el,", ",")",")"),ol=1e-12;function ko(e){return((e=Math.exp(e))+1/e)/2}function il(e){return((e=Math.exp(e))-1/e)/2}function rl(e){return((e=Math.exp(2*e))-1)/(e+1)}const sl=function e(t,n,o){function i(r,s){var a=r[0],l=r[1],c=r[2],u=s[0],d=s[1],v=s[2],p=u-a,N=d-l,_=p*p+N*N,w,x;if(_<ol)x=Math.log(v/c)/t,w=function(G){return[a+G*p,l+G*N,c*Math.exp(t*G*x)]};else{var I=Math.sqrt(_),m=(v*v-c*c+o*_)/(2*c*n*I),E=(v*v-c*c-o*_)/(2*v*n*I),R=Math.log(Math.sqrt(m*m+1)-m),Y=Math.log(Math.sqrt(E*E+1)-E);x=(Y-R)/t,w=function(G){var X=G*x,U=ko(R),$=c/(n*I)*(U*rl(t*X+R)-il(R));return[a+$*p,l+$*N,c*U/ko(t*X+R)]}}return w.duration=x*1e3*t/Math.SQRT2,w}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 wt=0,Nt=0,Et=0,Ai=1e3,rn,Ct,sn=0,at=0,vn=0,At=typeof performance=="object"&&performance.now?performance:Date,Oi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function no(){return at||(Oi(al),at=At.now()+vn)}function al(){at=0}function an(){this._call=this._time=this._next=null}an.prototype=zi.prototype={constructor:an,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?no():+n)+(t==null?0:+t),!this._next&&Ct!==this&&(Ct?Ct._next=this:rn=this,Ct=this),this._call=e,this._time=n,Fn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fn())}};function zi(e,t,n){var o=new an;return o.restart(e,t,n),o}function ll(){no(),++wt;for(var e=rn,t;e;)(t=at-e._time)>=0&&e._call.call(void 0,t),e=e._next;--wt}function Po(){at=(sn=At.now())+vn,wt=Nt=0;try{ll()}finally{wt=0,cl(),at=0}}function ul(){var e=At.now(),t=e-sn;t>Ai&&(vn-=t,sn=e)}function cl(){for(var e,t=rn,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:rn=n);Ct=e,Fn(o)}function Fn(e){if(!wt){Nt&&(Nt=clearTimeout(Nt));var t=e-at;t>24?(e<1/0&&(Nt=setTimeout(Po,e-At.now()-vn)),Et&&(Et=clearInterval(Et))):(Et||(sn=At.now(),Et=setInterval(ul,Ai)),wt=1,Oi(Po))}}function To(e,t,n){var o=new an;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var dl=hn("start","end","cancel","interrupt"),fl=[],Bi=0,$o=1,Yn=2,Qt=3,Do=4,Gn=5,jt=6;function pn(e,t,n,o,i,r){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;hl(e,n,{name:t,index:o,group:i,on:dl,tween:fl,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Bi})}function oo(e,t){var n=$e(e,t);if(n.state>Bi)throw new Error("too late; already scheduled");return n}function Be(e,t){var n=$e(e,t);if(n.state>Qt)throw new Error("too late; already running");return n}function $e(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hl(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=zi(r,0,n.time);function r(c){n.state=$o,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,d,v,p;if(n.state!==$o)return l();for(u in o)if(p=o[u],p.name===n.name){if(p.state===Qt)return To(s);p.state===Do?(p.state=jt,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[u]):+u<t&&(p.state=jt,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[u])}if(To(function(){n.state===Qt&&(n.state=Do,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Yn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Yn){for(n.state=Qt,i=new Array(v=n.tween.length),u=0,d=-1;u<v;++u)(p=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++d]=p);i.length=d+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Gn,1),d=-1,v=i.length;++d<v;)i[d].call(e,u);n.state===Gn&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=jt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function en(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>Yn&&o.state<Gn,o.state=jt,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}r&&delete e.__transition}}function gl(e){return this.each(function(){en(this,e)})}function vl(e,t){var n,o;return function(){var i=Be(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 pl(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=Be(this,e),s=r.tween;if(s!==o){i=(o=s).slice();for(var a={name:t,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===t){i[l]=a;break}l===c&&i.push(a)}r.tween=i}}function ml(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=$e(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?vl:pl)(n,e,t))}function io(e,t,n){var o=e._id;return e.each(function(){var i=Be(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return $e(i,o).value[t]}}function Ri(e,t){var n;return(typeof t=="number"?Ke:t instanceof Dt?Mo:(n=Dt(t))?(t=n,Mo):Qa)(e,t)}function yl(e){return function(){this.removeAttribute(e)}}function _l(e){return function(){this.removeAttributeNS(e.space,e.local)}}function wl(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 bl(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 xl(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 El(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 Sl(e,t){var n=gn(e),o=n==="transform"?nl:Ri;return this.attrTween(e,typeof t=="function"?(n.local?El:xl)(n,o,io(this,"attr."+e,t)):t==null?(n.local?_l:yl)(n):(n.local?bl:wl)(n,o,t))}function Nl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Cl(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ml(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Cl(e,r)),n}return i._value=t,i}function Il(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&Nl(e,r)),n}return i._value=t,i}function kl(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=gn(e);return this.tween(n,(o.local?Ml:Il)(o,t))}function Pl(e,t){return function(){oo(this,e).delay=+t.apply(this,arguments)}}function Tl(e,t){return t=+t,function(){oo(this,e).delay=t}}function $l(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Pl:Tl)(t,e)):$e(this.node(),t).delay}function Dl(e,t){return function(){Be(this,e).duration=+t.apply(this,arguments)}}function Al(e,t){return t=+t,function(){Be(this,e).duration=t}}function Ol(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Dl:Al)(t,e)):$e(this.node(),t).duration}function zl(e,t){if(typeof t!="function")throw new Error;return function(){Be(this,e).ease=t}}function Bl(e){var t=this._id;return arguments.length?this.each(zl(t,e)):$e(this.node(),t).ease}function Rl(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Be(this,e).ease=n}}function Vl(e){if(typeof e!="function")throw new Error;return this.each(Rl(this._id,e))}function Hl(e){typeof e!="function"&&(e=pi(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,c=0;c<s;++c)(l=r[c])&&e.call(l,l.__data__,c,r)&&a.push(l);return new Ge(o,this._parents,this._name,this._id)}function Ll(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],c=n[a],u=l.length,d=s[a]=new Array(u),v,p=0;p<u;++p)(v=l[p]||c[p])&&(d[p]=v);for(;a<o;++a)s[a]=t[a];return new Ge(s,this._parents,this._name,this._id)}function Fl(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 Yl(e,t,n){var o,i,r=Fl(t)?oo:Be;return function(){var s=r(this,e),a=s.on;a!==o&&(i=(o=a).copy()).on(t,n),s.on=i}}function Gl(e,t){var n=this._id;return arguments.length<2?$e(this.node(),n).on.on(e):this.each(Yl(n,e,t))}function Xl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ul(){return this.on("end.remove",Xl(this._id))}function Zl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=jn(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,c=r[s]=new Array(l),u,d,v=0;v<l;++v)(u=a[v])&&(d=e.call(u,u.__data__,v,a))&&("__data__"in u&&(d.__data__=u.__data__),c[v]=d,pn(c[v],t,n,v,c,$e(u,n)));return new Ge(r,this._parents,t,n)}function Kl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=vi(e));for(var o=this._groups,i=o.length,r=[],s=[],a=0;a<i;++a)for(var l=o[a],c=l.length,u,d=0;d<c;++d)if(u=l[d]){for(var v=e.call(u,u.__data__,d,l),p,N=$e(u,n),_=0,w=v.length;_<w;++_)(p=v[_])&&pn(p,t,n,_,v,N);r.push(v),s.push(u)}return new Ge(r,s,t,n)}var Wl=Bt.prototype.constructor;function ql(){return new Wl(this._groups,this._parents)}function Jl(e,t){var n,o,i;return function(){var r=_t(this,e),s=(this.style.removeProperty(e),_t(this,e));return r===s?null:r===n&&s===o?i:i=t(n=r,o=s)}}function Vi(e){return function(){this.style.removeProperty(e)}}function Ql(e,t,n){var o,i=n+"",r;return function(){var s=_t(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}function jl(e,t,n){var o,i,r;return function(){var s=_t(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),_t(this,e))),s===l?null:s===o&&l===i?r:(i=l,r=t(o=s,a))}}function eu(e,t){var n,o,i,r="style."+t,s="end."+r,a;return function(){var l=Be(this,e),c=l.on,u=l.value[r]==null?a||(a=Vi(t)):void 0;(c!==n||i!==u)&&(o=(n=c).copy()).on(s,i=u),l.on=o}}function tu(e,t,n){var o=(e+="")=="transform"?tl:Ri;return t==null?this.styleTween(e,Jl(e,o)).on("end.style."+e,Vi(e)):typeof t=="function"?this.styleTween(e,jl(e,o,io(this,"style."+e,t))).each(eu(this._id,e)):this.styleTween(e,Ql(e,o,t),n).on("end.style."+e,null)}function nu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ou(e,t,n){var o,i;function r(){var s=t.apply(this,arguments);return s!==i&&(o=(i=s)&&nu(e,s,n)),o}return r._value=t,r}function iu(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,ou(e,t,n==null?"":n))}function ru(e){return function(){this.textContent=e}}function su(e){return function(){var t=e(this);this.textContent=t==null?"":t}}function au(e){return this.tween("text",typeof e=="function"?su(io(this,"text",e)):ru(e==null?"":e+""))}function lu(e){return function(t){this.textContent=e.call(this,t)}}function uu(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&lu(i)),t}return o._value=e,o}function cu(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,uu(e))}function du(){for(var e=this._name,t=this._id,n=Hi(),o=this._groups,i=o.length,r=0;r<i;++r)for(var s=o[r],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=$e(l,t);pn(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ge(o,this._parents,e,n)}function fu(){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 c=Be(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),i===0&&r()})}var hu=0;function Ge(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Hi(){return++hu}var Re=Bt.prototype;Ge.prototype={constructor:Ge,select:Zl,selectAll:Kl,selectChild:Re.selectChild,selectChildren:Re.selectChildren,filter:Hl,merge:Ll,selection:ql,transition:du,call:Re.call,nodes:Re.nodes,node:Re.node,size:Re.size,empty:Re.empty,each:Re.each,on:Gl,attr:Sl,attrTween:kl,style:tu,styleTween:iu,text:au,textTween:cu,remove:Ul,tween:ml,delay:$l,duration:Ol,ease:Bl,easeVarying:Vl,end:fu,[Symbol.iterator]:Re[Symbol.iterator]};function gu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var vu={time:null,delay:0,duration:250,ease:gu};function pu(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 mu(e){var t,n;e instanceof Ge?(t=e._id,e=e._name):(t=Hi(),(n=vu).time=no(),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,c=0;c<a;++c)(l=s[c])&&pn(l,e,t,c,s,n||pu(l,t));return new Ge(o,this._parents,e,t)}Bt.prototype.interrupt=gl;Bt.prototype.transition=mu;const Ut=e=>()=>e;function yu(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 Le(e,t,n){this.k=e,this.x=t,this.y=n}Le.prototype={constructor:Le,scale:function(e){return e===1?this:new Le(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Le(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 bt=new Le(1,0,0);Le.prototype;function Mn(e){e.stopImmediatePropagation()}function St(e){e.preventDefault(),e.stopImmediatePropagation()}function _u(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function wu(){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 Ao(){return this.__zoom||bt}function bu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function xu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Eu(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 Su(){var e=_u,t=wu,n=Eu,o=bu,i=xu,r=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=sl,c=hn("start","zoom","end"),u,d,v,p=500,N=150,_=0,w=10;function x(y){y.property("__zoom",Ao).on("wheel.zoom",X,{passive:!1}).on("mousedown.zoom",U).on("dblclick.zoom",$).filter(i).on("touchstart.zoom",B).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",ie).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(y,M,b,T){var D=y.selection?y.selection():y;D.property("__zoom",Ao),y!==D?R(y,M,b,T):D.interrupt().each(function(){Y(this,arguments).event(T).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},x.scaleBy=function(y,M,b,T){x.scaleTo(y,function(){var D=this.__zoom.k,A=typeof M=="function"?M.apply(this,arguments):M;return D*A},b,T)},x.scaleTo=function(y,M,b,T){x.transform(y,function(){var D=t.apply(this,arguments),A=this.__zoom,L=b==null?E(D):typeof b=="function"?b.apply(this,arguments):b,F=A.invert(L),j=typeof M=="function"?M.apply(this,arguments):M;return n(m(I(A,j),L,F),D,s)},b,T)},x.translateBy=function(y,M,b,T){x.transform(y,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof b=="function"?b.apply(this,arguments):b),t.apply(this,arguments),s)},null,T)},x.translateTo=function(y,M,b,T,D){x.transform(y,function(){var A=t.apply(this,arguments),L=this.__zoom,F=T==null?E(A):typeof T=="function"?T.apply(this,arguments):T;return n(bt.translate(F[0],F[1]).scale(L.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof b=="function"?-b.apply(this,arguments):-b),A,s)},T,D)};function I(y,M){return M=Math.max(r[0],Math.min(r[1],M)),M===y.k?y:new Le(M,y.x,y.y)}function m(y,M,b){var T=M[0]-b[0]*y.k,D=M[1]-b[1]*y.k;return T===y.x&&D===y.y?y:new Le(y.k,T,D)}function E(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function R(y,M,b,T){y.on("start.zoom",function(){Y(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){Y(this,arguments).event(T).end()}).tween("zoom",function(){var D=this,A=arguments,L=Y(D,A).event(T),F=t.apply(D,A),j=b==null?E(F):typeof b=="function"?b.apply(D,A):b,V=Math.max(F[1][0]-F[0][0],F[1][1]-F[0][1]),O=D.__zoom,W=typeof M=="function"?M.apply(D,A):M,ce=l(O.invert(j).concat(V/O.k),W.invert(j).concat(V/W.k));return function(ae){if(ae===1)ae=W;else{var he=ce(ae),te=V/he[2];ae=new Le(te,j[0]-he[0]*te,j[1]-he[1]*te)}L.zoom(null,ae)}})}function Y(y,M,b){return!b&&y.__zooming||new G(y,M)}function G(y,M){this.that=y,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,M),this.taps=0}G.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,M){return this.mouse&&y!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var M=Pe(this.that).datum();c.call(y,this.that,new yu(y,{sourceEvent:this.sourceEvent,target:x,type:y,transform:this.that.__zoom,dispatch:c}),M)}};function X(y,...M){if(!e.apply(this,arguments))return;var b=Y(this,M).event(y),T=this.__zoom,D=Math.max(r[0],Math.min(r[1],T.k*Math.pow(2,o.apply(this,arguments)))),A=De(y);if(b.wheel)(b.mouse[0][0]!==A[0]||b.mouse[0][1]!==A[1])&&(b.mouse[1]=T.invert(b.mouse[0]=A)),clearTimeout(b.wheel);else{if(T.k===D)return;b.mouse=[A,T.invert(A)],en(this),b.start()}St(y),b.wheel=setTimeout(L,N),b.zoom("mouse",n(m(I(T,D),b.mouse[0],b.mouse[1]),b.extent,s));function L(){b.wheel=null,b.end()}}function U(y,...M){if(v||!e.apply(this,arguments))return;var b=y.currentTarget,T=Y(this,M,!0).event(y),D=Pe(y.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",V,!0),A=De(y,b),L=y.clientX,F=y.clientY;Ci(y.view),Mn(y),T.mouse=[A,this.__zoom.invert(A)],en(this),T.start();function j(O){if(St(O),!T.moved){var W=O.clientX-L,ce=O.clientY-F;T.moved=W*W+ce*ce>_}T.event(O).zoom("mouse",n(m(T.that.__zoom,T.mouse[0]=De(O,b),T.mouse[1]),T.extent,s))}function V(O){D.on("mousemove.zoom mouseup.zoom",null),Mi(O.view,T.moved),St(O),T.event(O).end()}}function $(y,...M){if(e.apply(this,arguments)){var b=this.__zoom,T=De(y.changedTouches?y.changedTouches[0]:y,this),D=b.invert(T),A=b.k*(y.shiftKey?.5:2),L=n(m(I(b,A),T,D),t.apply(this,M),s);St(y),a>0?Pe(this).transition().duration(a).call(R,L,T,y):Pe(this).call(x.transform,L,T,y)}}function B(y,...M){if(e.apply(this,arguments)){var b=y.touches,T=b.length,D=Y(this,M,y.changedTouches.length===T).event(y),A,L,F,j;for(Mn(y),L=0;L<T;++L)F=b[L],j=De(F,this),j=[j,this.__zoom.invert(j),F.identifier],D.touch0?!D.touch1&&D.touch0[2]!==j[2]&&(D.touch1=j,D.taps=0):(D.touch0=j,A=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),A&&(D.taps<2&&(d=j[0],u=setTimeout(function(){u=null},p)),en(this),D.start())}}function S(y,...M){if(this.__zooming){var b=Y(this,M).event(y),T=y.changedTouches,D=T.length,A,L,F,j;for(St(y),A=0;A<D;++A)L=T[A],F=De(L,this),b.touch0&&b.touch0[2]===L.identifier?b.touch0[0]=F:b.touch1&&b.touch1[2]===L.identifier&&(b.touch1[0]=F);if(L=b.that.__zoom,b.touch1){var V=b.touch0[0],O=b.touch0[1],W=b.touch1[0],ce=b.touch1[1],ae=(ae=W[0]-V[0])*ae+(ae=W[1]-V[1])*ae,he=(he=ce[0]-O[0])*he+(he=ce[1]-O[1])*he;L=I(L,Math.sqrt(ae/he)),F=[(V[0]+W[0])/2,(V[1]+W[1])/2],j=[(O[0]+ce[0])/2,(O[1]+ce[1])/2]}else if(b.touch0)F=b.touch0[0],j=b.touch0[1];else return;b.zoom("touch",n(m(L,F,j),b.extent,s))}}function ie(y,...M){if(this.__zooming){var b=Y(this,M).event(y),T=y.changedTouches,D=T.length,A,L;for(Mn(y),v&&clearTimeout(v),v=setTimeout(function(){v=null},p),A=0;A<D;++A)L=T[A],b.touch0&&b.touch0[2]===L.identifier?delete b.touch0:b.touch1&&b.touch1[2]===L.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&(L=De(L,this),Math.hypot(d[0]-L[0],d[1]-L[1])<w)){var F=Pe(this).on("dblclick.zoom");F&&F.apply(this,arguments)}}}return x.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Ut(+y),x):o},x.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ut(!!y),x):e},x.touchable=function(y){return arguments.length?(i=typeof y=="function"?y:Ut(!!y),x):i},x.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Ut([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),x):t},x.scaleExtent=function(y){return arguments.length?(r[0]=+y[0],r[1]=+y[1],x):[r[0],r[1]]},x.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],x):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},x.constrain=function(y){return arguments.length?(n=y,x):n},x.duration=function(y){return arguments.length?(a=+y,x):a},x.interpolate=function(y){return arguments.length?(l=y,x):l},x.on=function(){var y=c.on.apply(c,arguments);return y===c?x:y},x.clickDistance=function(y){return arguments.length?(_=(y=+y)*y,x):Math.sqrt(_)},x.tapDistance=function(y){return arguments.length?(w=+y,x):w},x}var q=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(q||{}),ro=(e=>(e.Partial="partial",e.Full="full",e))(ro||{}),Qe=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Qe||{}),lt=(e=>(e.Strict="strict",e.Loose="loose",e))(lt||{}),Xn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Xn||{}),It=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(It||{});function Un(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["INPUT","SELECT","TEXTAREA"].includes(o==null?void 0:o.nodeName)||i||!!r}function Nu(e){return e.ctrlKey||e.metaKey||e.shiftKey}function Oo(e,t,n,o){const i=t.split("+").map(r=>r.trim().toLowerCase());return i.length===1?e.toLowerCase()===t.toLowerCase():(o?n.delete(e.toLowerCase()):n.add(e.toLowerCase()),i.every((r,s)=>n.has(r)&&Array.from(n.values())[s]===i[s]))}function Cu(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Mu(n.code,e);return Array.isArray(e)?e.some(i=>Oo(n[o],i,t,n.type==="keyup")):Oo(n[o],e,t,n.type==="keyup")}}function Mu(e,t){return typeof t=="string"?e===t?"code":"key":t.includes(e)?"code":"key"}function kt(e,t){const n=ye(()=>{var u;return(u=ue(t==null?void 0:t.actInsideInputWithModifier))!=null?u:!1}),o=ye(()=>{var u;return(u=ue(t==null?void 0:t.target))!=null?u:window}),i=pe(ue(e)===!0);let r=!1;const s=new Set;let a=c(ue(e));ve(()=>ue(e),(u,d)=>{typeof d=="boolean"&&typeof u!="boolean"&&l(),a=c(u)},{immediate:!0}),Xe(()=>{hi(window,["blur","contextmenu"],l)}),po((...u)=>a(...u),u=>{r=Nu(u),!((!r||r&&!n.value)&&Un(u))&&(u.preventDefault(),i.value=!0)},{eventName:"keydown",target:o}),po((...u)=>a(...u),u=>{if(i.value){if((!r||r&&!n.value)&&Un(u))return;l()}},{eventName:"keyup",target:o});function l(){r=!1,s.clear(),i.value=!1}function c(u){return u===null?(l(),()=>!1):typeof u=="boolean"?(l(),i.value=u,()=>!1):Array.isArray(u)||typeof u=="string"?Cu(u,s):u}return i}const Li="vue-flow__node-desc",Fi="vue-flow__edge-desc",Iu="vue-flow__aria-live",Yi=["Enter"," ","Escape"],mt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Zn(e){return ge(z({},e.computedPosition||{x:0,y:0}),{width:e.dimensions.width||0,height:e.dimensions.height||0})}function Kn(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 mn(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ut(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Gi(e,t){return{x:ut(e.x,t[0][0],t[1][0]),y:ut(e.y,t[0][1],t[1][1])}}function zo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Je(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function nt(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Je(e)}function Mt(e){return nt(e)&&"computedPosition"in e}function Zt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function ku(e){return Zt(e.width)&&Zt(e.height)&&Zt(e.x)&&Zt(e.y)}function Pu(e,t,n){var i;const o={id:e.id.toString(),type:(i=e.type)!=null?i:"default",dimensions:gt({width:0,height:0}),computedPosition:gt(z({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:Ee(e.data)?e.data:{},events:gt(Ee(e.events)?e.events:{})};return Object.assign(t!=null?t:o,e,{id:e.id.toString(),parentNode:n})}function Xi(e,t,n){var s,a,l,c,u,d,v;var o,i;const r=z({id:e.id.toString(),type:(a=(s=e.type)!=null?s:t==null?void 0:t.type)!=null?a:"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:(l=e.updatable)!=null?l:n==null?void 0:n.updatable,selectable:(c=e.selectable)!=null?c:n==null?void 0:n.selectable,focusable:(u=e.focusable)!=null?u:n==null?void 0:n.focusable,data:Ee(e.data)?e.data:{},events:gt(Ee(e.events)?e.events:{}),label:(d=e.label)!=null?d:"",interactionWidth:(v=e.interactionWidth)!=null?v:n==null?void 0:n.interactionWidth},n!=null?n:{});return Object.assign(t!=null?t:r,e,{id:e.id.toString()})}function Ui(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 Tu(...e){if(e.length===3){const[r,s,a]=e;return Ui(r,s,a,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Je(r)&&r.source===o).map(r=>n.find(s=>nt(s)&&s.id===r.target))}function $u(...e){if(e.length===3){const[r,s,a]=e;return Ui(r,s,a,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Je(r)&&r.target===o).map(r=>n.find(s=>nt(s)&&s.id===r.source))}function Zi({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t!=null?t:""}-${n}${o!=null?o:""}`}function Du(e,t){return t.some(n=>Je(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 Ki({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function ln({x:e,y:t},{x:n,y:o,zoom:i},r=!1,[s,a]=[1,1]){const l={x:(e-n)/i,y:(t-o)/i};return r?{x:s*Math.round(l.x/s),y:a*Math.round(l.y/a)}:l}function Au(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 Wi({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Ou({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function qi(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=Au(t,Wi(z(z({},o.computedPosition),o.dimensions)))}return Ou(t)}function Ji(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){var a,l,c,u;const r=ge(z({},ln(t,n)),{width:t.width/n.zoom,height:t.height/n.zoom}),s=[];for(const d of e){const{dimensions:v,selectable:p=!0,hidden:N=!1}=d,_=(l=(a=v.width)!=null?a:d.width)!=null?l:null,w=(u=(c=v.height)!=null?c:d.height)!=null?u:null;if(i&&!p||N)continue;const x=Kn(r,Zn(d)),I=_===null||w===null,m=o&&x>0,E=(_!=null?_:0)*(w!=null?w:0);(I||m||x>=E||d.dragging)&&s.push(d)}return s}function Qi(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 Bo(e,t,n,o,i,r=.1,s={x:0,y:0}){var _,w;const a=t/(e.width*(1+r)),l=n/(e.height*(1+r)),c=Math.min(a,l),u=ut(c,o,i),d=e.x+e.width/2,v=e.y+e.height/2,p=t/2-d*u+((_=s.x)!=null?_:0),N=n/2-v*u+((w=s.y)!=null?w:0);return{x:p,y:N,zoom:u}}function zu(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function ji(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:ji(n,t):!1}function Ot(e,t){return typeof e=="undefined"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Ro(e,t,n){return e<t?ut(Math.abs(e-t),1,t)/t:e>n?-ut(Math.abs(e-n),1,t)/t:0}function er(e,t,n=15,o=40){const i=Ro(e.x,o,t.width-o)*n,r=Ro(e.y,o,t.height-o)*n;return[i,r]}function In(e,t){var n,o;if(t){const i=e.position.x+e.dimensions.width-t.dimensions.width,r=e.position.y+e.dimensions.height-t.dimensions.height;if(i>0||r>0||e.position.x<0||e.position.y<0){let s={};if(typeof t.style=="function"?s=z({},t.style(t)):t.style&&(s=z({},t.style)),s.width=(n=s.width)!=null?n:`${t.dimensions.width}px`,s.height=(o=s.height)!=null?o:`${t.dimensions.height}px`,i>0)if(typeof s.width=="string"){const a=Number(s.width.replace("px",""));s.width=`${a+i}px`}else s.width+=i;if(r>0)if(typeof s.height=="string"){const a=Number(s.height.replace("px",""));s.height=`${a+r}px`}else s.height+=r;if(e.position.x<0){const a=Math.abs(e.position.x);if(t.position.x=t.position.x-a,typeof s.width=="string"){const l=Number(s.width.replace("px",""));s.width=`${l+a}px`}else s.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(t.position.y=t.position.y-a,typeof s.height=="string"){const l=Number(s.height.replace("px",""));s.height=`${l+a}px`}else s.height+=a;e.position.y=0}t.dimensions.width=Number(s.width.toString().replace("px","")),t.dimensions.height=Number(s.height.toString().replace("px","")),typeof t.style=="function"?t.style=a=>{const l=t.style;return z(z({},l(a)),s)}:t.style=z(z({},t.style),s)}}}function Vo(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(Mt(s)&&(typeof a.position!="undefined"&&(s.position=a.position),typeof a.dragging!="undefined"&&(s.dragging=a.dragging),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&Mt(l)&&In(s,l)}break;case"dimensions":if(Mt(s)&&(typeof a.dimensions!="undefined"&&(s.dimensions=a.dimensions),typeof a.updateStyle!="undefined"&&a.updateStyle&&(s.style=ge(z({},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!="undefined"&&(s.resizing=a.resizing),s.expandParent&&s.parentNode)){const l=t[r.indexOf(s.parentNode)];l&&Mt(l)&&(!!l.dimensions.width&&!!l.dimensions.height?In(s,l):Fe(()=>{In(s,l)}))}break}return t}function Ze(e,t){return{id:e,type:"select",selected:t}}function Ho(e){return{item:e,type:"add"}}function Lo(e){return{id:e,type:"remove"}}function Fo(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function We(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(Ze(r.id,s)))}return o}function H(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=a=>{t.delete(a)};return{on:a=>{e&&n&&t.delete(e),t.add(a);const l=()=>{i(a),e&&n&&t.add(e)};return fn(l),{off:l}},off:i,trigger:a=>Promise.all(Array.from(t).map(l=>l(a))),hasListeners:o,fns:t}}function Yo(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 Bu(e,t,n,o,i){var r,s;const a=[];for(const l of e)(l.selected||l.id===i)&&(!l.parentNode||!ji(l,o))&&(l.draggable||t&&typeof l.draggable=="undefined")&&a.push(gt({id:l.id,position:l.position||{x:0,y:0},distance:{x:n.x-((r=l.computedPosition)==null?void 0:r.x)||0,y:n.y-((s=l.computedPosition)==null?void 0:s.y)||0},from:l.computedPosition,extent:l.extent,parentNode:l.parentNode,dimensions:l.dimensions,expandParent:l.expandParent}));return a}function kn({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 tr(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 Ru(e,t,n){const[o,i,r,s]=typeof e!="string"?tr(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x!="undefined"&&typeof n.computedPosition.y!="undefined"&&typeof n.dimensions.width!="undefined"&&typeof n.dimensions.height!="undefined"?[[n.computedPosition.x+s,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Vu(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=Ru(i,e,o);r&&(i=r)}else t(new Ne(Se.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]=tr(i.padding),c=(o==null?void 0:o.computedPosition.x)||0,u=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+c+l,i.range[0][1]+u+r],[i.range[1][0]+c-s,i.range[1][1]+u-a]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Hu({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function so(e,t,n,o,i){const r=Hu(e.dimensions,Vu(e,n,o,i)),s=Gi(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 un(e,t,n=q.Left){var l,c,u;const o=((l=t==null?void 0:t.x)!=null?l:0)+e.computedPosition.x,i=((c=t==null?void 0:t.y)!=null?c:0)+e.computedPosition.y,{width:r,height:s}=t!=null?t:Yu(e);switch((u=t==null?void 0:t.position)!=null?u:n){case q.Top:return{x:o+r/2,y:i};case q.Right:return{x:o+r,y:i+s/2};case q.Bottom:return{x:o+r/2,y:i+s};case q.Left:return{x:o,y:i+s/2}}}function Go(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function Lu({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:s,height:a,viewport:l}){const c={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)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const u=Wi({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(u.x2,c.x2)-Math.max(u.x,c.x)),v=Math.max(0,Math.min(u.y2,c.y2)-Math.max(u.y,c.y));return Math.ceil(d*v)>0}function Fu(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 Se=(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))(Se||{});const Xo={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 Ne extends Error{constructor(t,...n){var o;super((o=Xo[t])==null?void 0:o.call(Xo,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function ao(e){return"clientX"in e}function qe(e,t){var a,l;var n,o;const i=ao(e),r=i?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,s=i?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((a=t==null?void 0:t.left)!=null?a:0),y:s-((l=t==null?void 0:t.top)!=null?l:0)}}const cn=()=>{var e;return typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Yu(e){var o,i,r,s;var t,n;return{width:(i=(o=(t=e.dimensions)==null?void 0:t.width)!=null?o:e.width)!=null?i:0,height:(s=(r=(n=e.dimensions)==null?void 0:n.height)!=null?r:e.height)!=null?s:0}}function nr(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function Pn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Uo(e,t,n,o){const i=[];for(const r of t[n]||[])if(`${e.id}-${r.id}-${n}`!==o){const{x:s,y:a}=un(e,r);i.push({id:r.id||null,type:n,nodeId:e.id,x:s,y:a})}return i}function Gu(e,t,n,o,i,r){const{x:s,y:a}=qe(e),c=t.elementsFromPoint(s,a).find(N=>N.classList.contains("vue-flow__handle"));if(c){const N=c.getAttribute("data-nodeid");if(N){const _=lo(void 0,c),w=c.getAttribute("data-handleid"),x=r({nodeId:N,id:w,type:_});if(x){const I=i.find(m=>m.nodeId===N&&m.type===_&&m.id===w);return{handle:{id:w,type:_,nodeId:N,x:(I==null?void 0:I.x)||n.x,y:(I==null?void 0:I.y)||n.y},validHandleResult:x}}}}let u=[],d=Number.POSITIVE_INFINITY;for(const N of i){const _=Math.sqrt(dt(N.x-n.x,2)+dt(N.y-n.y,2));if(_<=o){const w=r(N);_<=d&&(_<d?u=[{handle:N,validHandleResult:w}]:_===d&&u.push({handle:N,validHandleResult:w}),d=_)}}if(!u.length)return{handle:null,validHandleResult:nr()};if(u.length===1)return u[0];const v=u.some(({validHandleResult:N})=>N.isValid),p=u.some(({handle:N})=>N.type==="target");return u.find(({handle:N,validHandleResult:_})=>p?N.type==="target":v?_.isValid:!0)||u[0]}function Zo(e,t,n,o,i,r,s,a,l,c,u){const d=r==="target",v=a.querySelector(`.vue-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),{x:p,y:N}=qe(e),_=a.elementFromPoint(p,N),w=_!=null&&_.classList.contains("vue-flow__handle")?_:v,x=nr();if(w){x.handleDomNode=w;const I=lo(void 0,w),m=w.getAttribute("data-nodeid"),E=w.getAttribute("data-handleid"),R=w.classList.contains("connectable"),Y=w.classList.contains("connectableend"),G={source:d?m:o,sourceHandle:d?E:i,target:d?o:m,targetHandle:d?i:E};x.connection=G,R&&Y&&(n===lt.Strict?d&&I==="source"||!d&&I==="target":m!==o||E!==i)&&(x.isValid=s(G,{edges:l,nodes:c,sourceNode:u(G.source),targetNode:u(G.target)}),x.endHandle={nodeId:m,handleId:E,type:I,position:x.isValid?w.getAttribute("data-handlepos"):null})}return x}function Xu({nodes:e,nodeId:t,handleId:n,handleType:o}){const i=[];for(let r=0;r<e.length;r++){const s=e[r],{handleBounds:a}=s;let l=[],c=[];a&&(l=Uo(s,a,"source",`${t}-${n}-${o}`),c=Uo(s,a,"target",`${t}-${n}-${o}`)),i.push(...l,...c)}return i}function lo(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Uu(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}const Zu=["production","prod"];function Vt(e,...t){or()&&console.warn(`[Vue Flow]: ${e}`,...t)}function or(){return!Zu.includes("production")}function Ko(e,t,n,o){const i=t.querySelectorAll(`.vue-flow__handle${e}`);return Array.from(i).map(s=>{const a=s.getBoundingClientRect();return z({id:s.getAttribute("data-handleid"),position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o},mn(s))})}function Wn(e,t,n,o,i,r=!1,s){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),Fe(()=>{s.blur()})):n([e])}function Ee(e){return typeof ee(e)!="undefined"}function Ku(e,t,n,o){var r;if(!e||!e.source||!e.target)return n(new Ne(Se.EDGE_INVALID,(r=e==null?void 0:e.id)!=null?r:"[ID UNKNOWN]")),!1;let i;return Je(e)?i=e:i=ge(z({},e),{id:Zi(e)}),i=Xi(i,void 0,o),Du(i,t)?!1:i}function Wu(e,t,n,o,i,r){if(!t.source||!t.target)return r(new Ne(Se.EDGE_INVALID,e.id)),!1;const s=o(e.id);if(!s)return r(new Ne(Se.EDGE_NOT_FOUND,e.id)),!1;const u=e,{id:a}=u,l=ft(u,["id"]),c=ge(z({},l),{id:i?Zi(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle});return n.splice(n.indexOf(s),1,c),c}function Wo(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const s=e[r];if(!nt(s)){n(new Ne(Se.NODE_INVALID,s==null?void 0:s.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const a=Pu(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 Ne(Se.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 qo(e,t){e.clear();for(const n of t){const{id:o,source:i,target:r,sourceHandle:s=null,targetHandle:a=null}=n,l=`${i}-source-${s}`,c=`${r}-target-${a}`,u=e.get(l)||new Map,d=e.get(c)||new Map,v=gt({edgeId:o,source:i,target:r,sourceHandle:s,targetHandle:a});e.set(l,u.set(`${r}-${a}`,v)),e.set(c,d.set(`${i}-${s}`,v))}}function Jo(e,t,n){if(!n)return;const o=[];for(const i of e.keys())t.has(i)||o.push(e.get(i));o.length&&n(o)}function qu(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function Qo(e,t,n,o,i,r,s,a){const l=[];for(const c of e){const u=Je(c)?c:Ku(c,a,i,r);if(!u)continue;const d=n(u.source),v=n(u.target);if(!d||!v){i(new Ne(Se.EDGE_SOURCE_TARGET_MISSING,u.id,u.source,u.target));continue}if(!d){i(new Ne(Se.EDGE_SOURCE_MISSING,u.id,u.source));continue}if(!v){i(new Ne(Se.EDGE_TARGET_MISSING,u.id,u.target));continue}if(t&&!t(u,{edges:a,nodes:s,sourceNode:d,targetNode:v})){i(new Ne(Se.EDGE_INVALID,u.id));continue}const p=o(u.id);l.push(ge(z({},Xi(u,p,r)),{sourceNode:d,targetNode:v}))}return l}const jo=Symbol("vueFlow"),ir=Symbol("nodeId"),rr=Symbol("nodeRef"),Ju=Symbol("edgeId"),Qu=Symbol("edgeRef"),yn=Symbol("slots");function sr(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:s,nodeDragThreshold:a,viewport:l,autoPanOnNodeDrag:c,autoPanSpeed:u,nodesDraggable:d,panBy:v,findNode:p,multiSelectionActive:N,nodesSelectionActive:_,selectNodesOnDrag:w,removeSelectedElements:x,addSelectedNodes:I,updateNodePositions:m,emits:E}=we(),{onStart:R,onDrag:Y,onStop:G,onClick:X,el:U,disabled:$,id:B,selectable:S,dragHandle:ie}=e,y=pe(!1);let M=[],b,T=null,D={x:void 0,y:void 0},A={x:0,y:0},L=null,F=!1,j=0,V=!1;const O=tc(),W=({x:Z,y:J})=>{D={x:Z,y:J};let se=!1;if(M=M.map(g=>{const f={x:Z-g.distance.x,y:J-g.distance.y};n.value&&(f.x=o.value[0]*Math.round(f.x/o.value[0]),f.y=o.value[1]*Math.round(f.y/o.value[1]));const{computedPosition:h}=so(g,f,E.error,s.value,g.parentNode?p(g.parentNode):void 0);return se=se||g.position.x!==h.x||g.position.y!==h.y,g.position=h,g}),!!se&&(m(M,!0,!0),y.value=!0,L)){const[g,f]=kn({id:B,dragItems:M,findNode:p});Y({event:L,node:g,nodes:f})}},ce=()=>{var se,g;if(!T)return;const[Z,J]=er(A,T,u.value);if(Z!==0||J!==0){const f={x:((se=D.x)!=null?se:0)-Z/l.value.zoom,y:((g=D.y)!=null?g:0)-J/l.value.zoom};v({x:Z,y:J})&&W(f)}j=requestAnimationFrame(ce)},ae=(Z,J)=>{F=!0;const se=p(B);!w.value&&!N.value&&se&&(se.selected||x()),se&&ue(S)&&w.value&&Wn(se,N.value,I,x,_,!1,J);const g=O(Z);if(D=g,M=Bu(r.value,d.value,g,p,B),M.length){const[f,h]=kn({id:B,dragItems:M,findNode:p});R({event:Z.sourceEvent,node:f,nodes:h})}},he=(Z,J)=>{var se;Z.sourceEvent.type==="touchmove"&&Z.sourceEvent.touches.length>1||(a.value===0&&ae(Z,J),D=O(Z),T=((se=t.value)==null?void 0:se.getBoundingClientRect())||null,A=qe(Z.sourceEvent,T))},te=(Z,J)=>{var g,f;const se=O(Z);if(!V&&F&&c.value&&(V=!0,ce()),!F){const h=se.xSnapped-((g=D.x)!=null?g:0),C=se.ySnapped-((f=D.y)!=null?f:0);Math.sqrt(h*h+C*C)>a.value&&ae(Z,J)}(D.x!==se.xSnapped||D.y!==se.ySnapped)&&M.length&&F&&(L=Z.sourceEvent,A=qe(Z.sourceEvent,T),W(se))},re=Z=>{var J,se;if(!F&&!y.value&&!N.value){const g=O(Z),f=g.xSnapped-((J=D.x)!=null?J:0),h=g.ySnapped-((se=D.y)!=null?se:0),C=Math.sqrt(f*f+h*h);C!==0&&C<=a.value&&(X==null||X(Z.sourceEvent));return}if(y.value=!1,V=!1,F=!1,D={x:void 0,y:void 0},cancelAnimationFrame(j),M.length){m(M,!1,!1);const[g,f]=kn({id:B,dragItems:M,findNode:p});G({event:Z.sourceEvent,node:g,nodes:f})}};return ve([()=>ue($),U],([Z,J],se,g)=>{if(J){const f=Pe(J);Z||(b=Aa().on("start",h=>he(h,J)).on("drag",h=>te(h,J)).on("end",h=>re(h)).filter(h=>{const C=h.target,P=ue(ie);return!h.button&&(!i.value||!Yo(C,`.${i.value}`,J)&&(!P||Yo(C,P,J)))}),f.call(b)),g(()=>{f.on(".drag",null),b&&(b.on("start",null),b.on("drag",null),b.on("end",null))})}}),y}function ju(){return{doubleClick:H(),click:H(),mouseEnter:H(),mouseMove:H(),mouseLeave:H(),contextMenu:H(),updateStart:H(),update:H(),updateEnd:H()}}function ec(e,t){const n=ju();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 tc(){const{viewport:e,snapGrid:t,snapToGrid:n}=we();return({sourceEvent:o})=>{const i=o.touches?o.touches[0].clientX:o.clientX,r=o.touches?o.touches[0].clientY:o.clientY,s={x:(i-e.value.x)/e.value.zoom,y:(r-e.value.y)/e.value.zoom};return z({xSnapped:n.value?t.value[0]*Math.round(s.x/t.value[0]):s.x,ySnapped:n.value?t.value[1]*Math.round(s.y/t.value[1]):s.y},s)}}function Kt(){return!0}function ar({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:s}){const{vueFlowRef:a,connectionMode:l,connectionRadius:c,connectOnClick:u,connectionClickStartHandle:d,nodesConnectable:v,autoPanOnConnect:p,autoPanSpeed:N,findNode:_,panBy:w,startConnection:x,updateConnection:I,endConnection:m,emits:E,viewport:R,edges:Y,nodes:G,isValidConnection:X}=we();let U=null,$=!1,B=null,S=null;function ie(M){var b;const T=ue(n)==="target",D=ao(M),A=zo(M.target);if(D&&M.button===0||!D){let L=function(h){J=qe(h,re);const{handle:C,validHandleResult:P}=Gu(h,A,ln(J,R.value,!1,[1,1]),c.value,g,K=>Zo(h,K,l.value,ue(t),ue(e),T?"target":"source",V,A,Y.value,G.value,_));if(O=C,se||(f(),se=!0),U=P.connection,$=P.isValid,B=P.handleDomNode,!($&&O&&(S!=null&&S.endHandle)&&P.endHandle&&S.endHandle.type===P.endHandle.type&&S.endHandle.nodeId===P.endHandle.nodeId&&S.endHandle.handleId===P.endHandle.handleId)){if(I(O&&$?Ki({x:O.x,y:O.y},R.value):J,P.endHandle,Uu(!!O,$)),S=P,!O&&!$&&!B)return Pn(Z);U&&U.source!==U.target&&B&&(Pn(Z),Z=B,B.classList.add("connecting","vue-flow__handle-connecting"),B.classList.toggle("valid",$),B.classList.toggle("vue-flow__handle-valid",$))}},F=function(h){(O||B)&&U&&$&&(r?r(h,U):E.connect(U)),E.connectEnd(h),i&&(s==null||s(h)),Pn(Z),cancelAnimationFrame(W),m(h),se=!1,$=!1,U=null,B=null,A.removeEventListener("mousemove",L),A.removeEventListener("mouseup",F),A.removeEventListener("touchmove",L),A.removeEventListener("touchend",F)};const j=_(ue(t));let V=ue(o)||X.value||Kt;!V&&j&&(V=(T?j.isValidSourcePos:j.isValidTargetPos)||Kt);let O,W=0;const{x:ce,y:ae}=qe(M),he=A==null?void 0:A.elementFromPoint(ce,ae),te=lo(ue(i),he),re=(b=a.value)==null?void 0:b.getBoundingClientRect();if(!re||!te)return;let Z,J=qe(M,re),se=!1;const g=Xu({nodes:G.value,nodeId:ue(t),handleId:ue(e),handleType:te}),f=()=>{if(!p.value)return;const[h,C]=er(J,re,N.value);w({x:h,y:C}),W=requestAnimationFrame(f)};x({nodeId:ue(t),handleId:ue(e),type:te,position:(he==null?void 0:he.getAttribute("data-handlepos"))||q.Top},{x:ce-re.left,y:ae-re.top}),E.connectStart({event:M,nodeId:ue(t),handleId:ue(e),handleType:te}),A.addEventListener("mousemove",L),A.addEventListener("mouseup",F),A.addEventListener("touchmove",L),A.addEventListener("touchend",F)}}function y(M){if(!u.value)return;const b=ue(n)==="target";if(!d.value)E.clickConnectStart({event:M,nodeId:ue(t),handleId:ue(e)}),x({nodeId:ue(t),type:ue(n),handleId:ue(e)},void 0,!0);else{let T=ue(o)||X.value||Kt;const D=_(ue(t));if(!T&&D&&(T=(b?D.isValidSourcePos:D.isValidTargetPos)||Kt),D&&(typeof D.connectable=="undefined"?v.value:D.connectable)===!1)return;const A=zo(M.target),{connection:L,isValid:F}=Zo(M,{nodeId:ue(t),id:ue(e),type:ue(n)},l.value,d.value.nodeId,d.value.handleId||null,d.value.type,T,A,Y.value,G.value,_),j=L.source===L.target;F&&!j&&E.connect(L),E.clickConnectEnd(M),m(M,!0)}}return{handlePointerDown:ie,handleClick:y}}function lr(){return xt(ir,"")}function ur(e){var a;const t=(a=e!=null?e:lr())!=null?a:"",n=xt(rr,pe(null)),{findNode:o,edges:i,emits:r}=we(),s=o(t);return s||r.error(new Ne(Se.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:s,parentNode:oe(()=>o(s.parentNode)),connectedEdges:oe(()=>Qi([s],i.value))}}function nc(){return{doubleClick:H(),click:H(),mouseEnter:H(),mouseMove:H(),mouseLeave:H(),contextMenu:H(),dragStart:H(),drag:H(),dragStop:H()}}function oc(e,t){const n=nc();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 cr(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:s,emits:a}=we();return(l,c=!1)=>{const u=r.value?i.value[0]:5,d=r.value?i.value[1]:5,v=c?4:1,p=l.x*u*v,N=l.y*d*v,_=[];for(const w of e.value)if(w.draggable||s&&typeof w.draggable=="undefined"){const x={x:w.computedPosition.x+p,y:w.computedPosition.y+N},{computedPosition:I}=so(w,x,a.error,t.value,w.parentNode?o(w.parentNode):void 0);_.push({id:w.id,position:I,from:w.position,distance:{x:l.x,y:l.y},dimensions:w.dimensions})}n(_,!0,!1)}}const Tn=.1;function Ue(){return Vt("Viewport not initialized yet."),Promise.resolve(!1)}const ic={zoomIn:Ue,zoomOut:Ue,zoomTo:Ue,fitView:Ue,setCenter:Ue,fitBounds:Ue,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ue,setTransform:Ue,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function rc(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy($n(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,s){return new Promise(a=>{const{x:l,y:c}=Gi({x:-o,y:-i},e.translateExtent),u=bt.translate(-l,-c).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform($n(e.d3Selection,s,()=>{a(!0)}),u):a(!1)})}return oe(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i==null?void 0:i.duration),zoomOut:i=>t(1/1.2,i==null?void 0:i.duration),zoomTo:(i,r)=>new Promise(s=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo($n(e.d3Selection,r==null?void 0:r.duration,()=>{s(!0)}),i):s(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),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:Tn,includeHiddenNodes:!1,duration:0})=>{var v,p,N;var r,s;const a=[];for(const _ of e.nodes)_.dimensions.width&&_.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!_.hidden)&&(!((r=i.nodes)!=null&&r.length)||(s=i.nodes)!=null&&s.length&&i.nodes.includes(_.id))&&a.push(_);if(!a.length)return Promise.resolve(!1);const l=qi(a),{x:c,y:u,zoom:d}=Bo(l,e.dimensions.width,e.dimensions.height,(v=i.minZoom)!=null?v:e.minZoom,(p=i.maxZoom)!=null?p:e.maxZoom,(N=i.padding)!=null?N:Tn,i.offset);return n(c,u,d,i==null?void 0:i.duration)},setCenter:(i,r,s)=>{const a=typeof(s==null?void 0:s.zoom)!="undefined"?s.zoom:e.maxZoom,l=e.dimensions.width/2-i*a,c=e.dimensions.height/2-r*a;return n(l,c,a,s==null?void 0:s.duration)},fitBounds:(i,r={padding:Tn})=>{const{x:s,y:a,zoom:l}=Bo(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(s,a,l,r==null?void 0:r.duration)},project:i=>ln(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 ln(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 Ki(a,e.viewport)}return{x:0,y:0}}}:ic)}function $n(e,t=0,n){return e.transition().duration(t).on("end",n)}function sc(e,t,n){const o=ri(!0);return o.run(()=>{const i=()=>{o.run(()=>{let _,w,x=!!(n.nodes.value.length||n.edges.value.length);_=ht([e.modelValue,()=>{var I,m;return(m=(I=e.modelValue)==null?void 0:I.value)==null?void 0:m.length}],([I])=>{I&&Array.isArray(I)&&(w==null||w.pause(),n.setElements(I),!w&&!x&&I.length?x=!0:w==null||w.resume())}),w=ht([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([I,m])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...I,...m],Fe(()=>{_==null||_.resume()}))},{immediate:x}),qt(()=>{_==null||_.stop(),w==null||w.stop()})})},r=()=>{o.run(()=>{let _,w,x=!!n.nodes.value.length;_=ht([e.nodes,()=>{var I,m;return(m=(I=e.nodes)==null?void 0:I.value)==null?void 0:m.length}],([I])=>{I&&Array.isArray(I)&&(w==null||w.pause(),n.setNodes(I),!w&&!x&&I.length?x=!0:w==null||w.resume())}),w=ht([n.nodes,()=>n.nodes.value.length],([I])=>{var m;(m=e.nodes)!=null&&m.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...I],Fe(()=>{_==null||_.resume()}))},{immediate:x}),qt(()=>{_==null||_.stop(),w==null||w.stop()})})},s=()=>{o.run(()=>{let _,w,x=!!n.edges.value.length;_=ht([e.edges,()=>{var I,m;return(m=(I=e.edges)==null?void 0:I.value)==null?void 0:m.length}],([I])=>{I&&Array.isArray(I)&&(w==null||w.pause(),n.setEdges(I),!w&&!x&&I.length?x=!0:w==null||w.resume())}),w=ht([n.edges,()=>n.edges.value.length],([I])=>{var m;(m=e.edges)!=null&&m.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...I],Fe(()=>{_==null||_.resume()}))},{immediate:x}),qt(()=>{_==null||_.stop(),w==null||w.stop()})})},a=()=>{o.run(()=>{ve(()=>t.maxZoom,()=>{t.maxZoom&&Ee(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},l=()=>{o.run(()=>{ve(()=>t.minZoom,()=>{t.minZoom&&Ee(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{ve(()=>t.translateExtent,()=>{t.translateExtent&&Ee(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},u=()=>{o.run(()=>{ve(()=>t.nodeExtent,()=>{t.nodeExtent&&Ee(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},d=()=>{o.run(()=>{ve(()=>t.applyDefault,()=>{Ee(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},v=()=>{o.run(()=>{const _=w=>go(this,null,function*(){let x=w;typeof t.autoConnect=="function"&&(x=yield t.autoConnect(w)),x!==!1&&n.addEdges([x])});ve(()=>t.autoConnect,()=>{Ee(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),ve(n.autoConnect,(w,x,I)=>{w?n.onConnect(_):n.hooks.value.connect.off(_),I(()=>{n.hooks.value.connect.off(_)})},{immediate:!0})})},p=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const w of Object.keys(t)){const x=w;if(!_.includes(x)){const I=ye(()=>t[x]),m=n[x];Jn(m)&&o.run(()=>{ve(I,E=>{Ee(E)&&(m.value=E)},{immediate:!0})})}}};(()=>{i(),r(),s(),l(),a(),c(),u(),d(),v(),p()})()}),()=>o.stop()}function ac(){return{edgesChange:H(),nodesChange:H(),nodeDoubleClick:H(),nodeClick:H(),nodeMouseEnter:H(),nodeMouseMove:H(),nodeMouseLeave:H(),nodeContextMenu:H(),nodeDragStart:H(),nodeDrag:H(),nodeDragStop:H(),nodesInitialized:H(),miniMapNodeClick:H(),miniMapNodeDoubleClick:H(),miniMapNodeMouseEnter:H(),miniMapNodeMouseMove:H(),miniMapNodeMouseLeave:H(),connect:H(),connectStart:H(),connectEnd:H(),clickConnectStart:H(),clickConnectEnd:H(),paneReady:H(),init:H(),move:H(),moveStart:H(),moveEnd:H(),selectionDragStart:H(),selectionDrag:H(),selectionDragStop:H(),selectionContextMenu:H(),selectionStart:H(),selectionEnd:H(),viewportChangeStart:H(),viewportChange:H(),viewportChangeEnd:H(),paneScroll:H(),paneClick:H(),paneContextMenu:H(),paneMouseEnter:H(),paneMouseMove:H(),paneMouseLeave:H(),edgeContextMenu:H(),edgeMouseEnter:H(),edgeMouseMove:H(),edgeMouseLeave:H(),edgeDoubleClick:H(),edgeClick:H(),edgeUpdateStart:H(),edgeUpdate:H(),edgeUpdateEnd:H(),updateNodeInternals:H(),error:H(e=>Vt(e.message))}}function lc(e,t){kr(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),fn(()=>{o.off(i)})}})}function dr(){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:ro.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:It.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:Qe.Bezier,style:{}},connectionMode:lt.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:cn()?"Meta":"Control",zoomActivationKeyCode:cn()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:ac(),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 uc=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function cc(e,t,n){const o=rc(e),i=g=>{const f=g!=null?g:[];e.hooks.updateNodeInternals.trigger(f)},r=g=>$u(g,e.nodes,e.edges),s=g=>Tu(g,e.nodes,e.edges),a=g=>Qi(g,e.edges),l=({id:g,type:f,nodeId:h})=>{var P;var C;return Array.from((P=(C=e.connectionLookup.get(`${h}-${f}-${g!=null?g:null}`))==null?void 0:C.values())!=null?P:[])},c=g=>{if(g)return t.value.get(g)},u=g=>{if(g)return n.value.get(g)},d=(g,f,h)=>{var k,Q;var C,P;const K=[];for(const ne of g){const de={id:ne.id,type:"position",dragging:h,from:ne.from};if(f&&(de.position=ne.position,ne.parentNode)){const le=c(ne.parentNode);de.position={x:de.position.x-((k=(C=le==null?void 0:le.computedPosition)==null?void 0:C.x)!=null?k:0),y:de.position.y-((Q=(P=le==null?void 0:le.computedPosition)==null?void 0:P.y)!=null?Q:0)}}K.push(de)}K!=null&&K.length&&e.hooks.nodesChange.trigger(K)},v=g=>{if(!e.vueFlowRef)return;const f=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!f)return;const h=window.getComputedStyle(f),{m22:C}=new window.DOMMatrixReadOnly(h.transform),P=[];for(let K=0;K<g.length;++K){const k=g[K],Q=c(k.id);if(Q){const ne=mn(k.nodeElement);if(!!(ne.width&&ne.height&&(Q.dimensions.width!==ne.width||Q.dimensions.height!==ne.height||k.forceUpdate))){const le=k.nodeElement.getBoundingClientRect();Q.dimensions=ne,Q.handleBounds.source=Ko(".source",k.nodeElement,le,C),Q.handleBounds.target=Ko(".target",k.nodeElement,le,C),P.push({id:Q.id,type:"dimensions",dimensions:ne})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),P.length&&e.hooks.nodesChange.trigger(P)},p=(g,f)=>{const h=new Set,C=new Set;for(const k of g)nt(k)?h.add(k.id):Je(k)&&C.add(k.id);const P=We(t.value,h,!0),K=We(n.value,C);if(e.multiSelectionActive){for(const k of h)P.push(Ze(k,f));for(const k of C)K.push(Ze(k,f))}P.length&&e.hooks.nodesChange.trigger(P),K.length&&e.hooks.edgesChange.trigger(K)},N=g=>{if(e.multiSelectionActive){const f=g.map(h=>Ze(h.id,!0));e.hooks.nodesChange.trigger(f);return}e.hooks.nodesChange.trigger(We(t.value,new Set(g.map(f=>f.id)),!0)),e.hooks.edgesChange.trigger(We(n.value))},_=g=>{if(e.multiSelectionActive){const f=g.map(h=>Ze(h.id,!0));e.hooks.edgesChange.trigger(f);return}e.hooks.edgesChange.trigger(We(n.value,new Set(g.map(f=>f.id)))),e.hooks.nodesChange.trigger(We(t.value,new Set,!0))},w=g=>{p(g,!0)},x=g=>{const h=(g||e.nodes).map(C=>(C.selected=!1,Ze(C.id,!1)));e.hooks.nodesChange.trigger(h)},I=g=>{const h=(g||e.edges).map(C=>(C.selected=!1,Ze(C.id,!1)));e.hooks.edgesChange.trigger(h)},m=g=>{if(!g||!g.length)return p([],!1);const f=g.reduce((h,C)=>{const P=Ze(C.id,!1);return nt(C)?h.nodes.push(P):h.edges.push(P),h},{nodes:[],edges:[]});f.nodes.length&&e.hooks.nodesChange.trigger(f.nodes),f.edges.length&&e.hooks.edgesChange.trigger(f.edges)},E=g=>{var f;(f=e.d3Zoom)==null||f.scaleExtent([g,e.maxZoom]),e.minZoom=g},R=g=>{var f;(f=e.d3Zoom)==null||f.scaleExtent([e.minZoom,g]),e.maxZoom=g},Y=g=>{var f;(f=e.d3Zoom)==null||f.translateExtent(g),e.translateExtent=g},G=g=>{e.nodeExtent=g,i()},X=g=>{var f;(f=e.d3Zoom)==null||f.clickDistance(g)},U=g=>{e.nodesDraggable=g,e.nodesConnectable=g,e.elementsSelectable=g},$=g=>{const f=g instanceof Function?g(e.nodes):g;!e.initialized&&!f.length||(e.nodes=Wo(f,c,e.hooks.error.trigger))},B=g=>{const f=g instanceof Function?g(e.edges):g;if(!e.initialized&&!f.length)return;const h=Qo(f,e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);qo(e.connectionLookup,h),e.edges=h},S=g=>{const f=g instanceof Function?g([...e.nodes,...e.edges]):g;!e.initialized&&!f.length||($(f.filter(nt)),B(f.filter(Je)))},ie=g=>{let f=g instanceof Function?g(e.nodes):g;f=Array.isArray(f)?f:[f];const h=Wo(f,c,e.hooks.error.trigger),C=[];for(const P of h)C.push(Ho(P));C.length&&e.hooks.nodesChange.trigger(C)},y=g=>{let f=g instanceof Function?g(e.edges):g;f=Array.isArray(f)?f:[f];const h=Qo(f,e.isValidConnection,c,u,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),C=[];for(const P of h)C.push(Ho(P));C.length&&e.hooks.edgesChange.trigger(C)},M=(g,f=!0,h=!1)=>{const C=g instanceof Function?g(e.nodes):g,P=Array.isArray(C)?C:[C],K=[],k=[];function Q(de){const le=a(de);for(const be of le)(!Ee(be.deletable)||be.deletable)&&k.push(Fo(be.id,be.source,be.target,be.sourceHandle,be.targetHandle))}function ne(de){const le=[];for(const be of e.nodes)be.parentNode===de&&le.push(be);if(le.length){for(const be of le)K.push(Lo(be.id));f&&Q(le);for(const be of le)ne(be.id)}}for(const de of P){const le=typeof de=="string"?c(de):de;le&&(Ee(le.deletable)&&!le.deletable||(K.push(Lo(le.id)),f&&Q([le]),h&&ne(le.id)))}k.length&&e.hooks.edgesChange.trigger(k),K.length&&e.hooks.nodesChange.trigger(K)},b=g=>{const f=g instanceof Function?g(e.edges):g,h=Array.isArray(f)?f:[f],C=[];for(const P of h){const K=typeof P=="string"?u(P):P;K&&(Ee(K.deletable)&&!K.deletable||C.push(Fo(typeof P=="string"?P:P.id,K.source,K.target,K.sourceHandle,K.targetHandle)))}e.hooks.edgesChange.trigger(C)},T=(g,f,h=!0)=>Wu(g,f,e.edges,u,h,e.hooks.error.trigger),D=(g,f,h={replace:!1})=>{const C=u(g);if(!C)return;const P=typeof f=="function"?f(C):f;C.data=h.replace?P:z(z({},C.data),P)},A=g=>Vo(g,e.nodes),L=g=>{const f=Vo(g,e.edges);return qo(e.connectionLookup,f),f},F=(g,f,h={replace:!1})=>{const C=c(g);if(!C)return;const P=typeof f=="function"?f(C):f;h.replace?e.nodes.splice(e.nodes.indexOf(C),1,P):Object.assign(C,P)},j=(g,f,h={replace:!1})=>{const C=c(g);if(!C)return;const P=typeof f=="function"?f(C):f;C.data=h.replace?P:z(z({},C.data),P)},V=(g,f,h=!1)=>{h?e.connectionClickStartHandle=g:e.connectionStartHandle=g,e.connectionEndHandle=null,e.connectionStatus=null,f&&(e.connectionPosition=f)},O=(g,f=null,h=null)=>{e.connectionStartHandle&&(e.connectionPosition=g,e.connectionEndHandle=f,e.connectionStatus=h)},W=(g,f)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,f?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ce=g=>{const f=ku(g),h=f?null:Mt(g)?g:c(g.id);return!f&&!h?[null,null,f]:[f?g:Zn(h),h,f]},ae=(g,f=!0,h=e.nodes)=>{const[C,P,K]=ce(g);if(!C)return[];const k=[];for(const Q of h||e.nodes){if(!K&&(Q.id===P.id||!Q.computedPosition))continue;const ne=Zn(Q),de=Kn(ne,C);(f&&de>0||de>=Number(C.width)*Number(C.height))&&k.push(Q)}return k},he=(g,f,h=!0)=>{const[C]=ce(g);if(!C)return!1;const P=Kn(C,f);return h&&P>0||P>=Number(C.width)*Number(C.height)},te=g=>{const{viewport:f,dimensions:h,d3Zoom:C,d3Selection:P,translateExtent:K}=e;if(!C||!P||!g.x&&!g.y)return!1;const k=bt.translate(f.x+g.x,f.y+g.y).scale(f.zoom),Q=[[0,0],[h.width,h.height]],ne=C.constrain()(k,Q,K),de=e.viewport.x!==ne.x||e.viewport.y!==ne.y||e.viewport.zoom!==ne.k;return C.transform(P,ne),de},re=g=>{const f=g instanceof Function?g(e):g,h=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Ee(f.defaultEdgeOptions)&&(e.defaultEdgeOptions=f.defaultEdgeOptions);const C=f.modelValue||f.nodes||f.edges?[]:void 0;C&&(f.modelValue&&C.push(...f.modelValue),f.nodes&&C.push(...f.nodes),f.edges&&C.push(...f.edges),S(C));const P=()=>{Ee(f.maxZoom)&&R(f.maxZoom),Ee(f.minZoom)&&E(f.minZoom),Ee(f.translateExtent)&&Y(f.translateExtent)};for(const K of Object.keys(f)){const k=K,Q=f[k];![...uc,...h].includes(k)&&Ee(Q)&&(e[k]=Q)}zn(()=>e.d3Zoom).not.toBeNull().then(P),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:v,setElements:S,setNodes:$,setEdges:B,addNodes:ie,addEdges:y,removeNodes:M,removeEdges:b,findNode:c,findEdge:u,updateEdge:T,updateEdgeData:D,updateNode:F,updateNodeData:j,applyEdgeChanges:L,applyNodeChanges:A,addSelectedElements:w,addSelectedNodes:N,addSelectedEdges:_,setMinZoom:E,setMaxZoom:R,setTranslateExtent:Y,setNodeExtent:G,setPaneClickDistance:X,removeSelectedElements:m,removeSelectedNodes:x,removeSelectedEdges:I,startConnection:V,updateConnection:O,endConnection:W,setInteractive:U,setState:re,getIntersectingNodes:ae,getIncomers:r,getOutgoers:s,getConnectedEdges:a,getHandleConnections:l,isNodeIntersecting:he,panBy:te,fitView:g=>o.value.fitView(g),zoomIn:g=>o.value.zoomIn(g),zoomOut:g=>o.value.zoomOut(g),zoomTo:(g,f)=>o.value.zoomTo(g,f),setViewport:(g,f)=>o.value.setViewport(g,f),setTransform:(g,f)=>o.value.setTransform(g,f),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(g,f,h)=>o.value.setCenter(g,f,h),fitBounds:(g,f)=>o.value.fitBounds(g,f),project:g=>o.value.project(g),screenToFlowCoordinate:g=>o.value.screenToFlowCoordinate(g),flowToScreenCoordinate:g=>o.value.flowToScreenCoordinate(g),toObject:()=>{const g=[],f=[];for(const P of e.nodes){const h=P,{computedPosition:K,handleBounds:k,selected:Q,dimensions:ne,isParent:de,resizing:le,dragging:be,events:Me}=h,ke=ft(h,["computedPosition","handleBounds","selected","dimensions","isParent","resizing","dragging","events"]);g.push(ke)}for(const P of e.edges){const C=P,{selected:K,sourceNode:k,targetNode:Q,events:ne}=C,de=ft(C,["selected","sourceNode","targetNode","events"]);f.push(de)}return JSON.parse(JSON.stringify({nodes:g,edges:f,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:g=>new Promise(f=>{const{nodes:h,edges:C,position:P,zoom:K,viewport:k}=g;if(h&&$(h),C&&B(C),k!=null&&k.x&&(k!=null&&k.y)||P){const Q=(k==null?void 0:k.x)||P[0],ne=(k==null?void 0:k.y)||P[1],de=(k==null?void 0:k.zoom)||K||e.viewport.zoom;return zn(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:Q,y:ne,zoom:de}).then(()=>{f(!0)})})}else f(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{var f,h,C;const g=dr();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const P=bt.translate((f=g.defaultViewport.x)!=null?f:0,(h=g.defaultViewport.y)!=null?h:0).scale(ut((C=g.defaultViewport.zoom)!=null?C:1,g.minZoom,g.maxZoom)),K=e.viewportRef.getBoundingClientRect(),k=[[0,0],[K.width,K.height]],Q=e.d3Zoom.constrain()(P,k,g.translateExtent);e.d3Zoom.transform(e.d3Selection,Q)}re(g)},$destroy:()=>{}}}const dc=["data-id","data-handleid","data-nodeid","data-handlepos"],fc={name:"Handle",compatConfig:{MODE:3}},dn=xe(ge(z({},fc),{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=ai(e,["position","connectable","connectableStart","connectableEnd","id"]),o=ye(()=>{var $;return($=n.type)!=null?$:"source"}),i=ye(()=>{var $;return($=n.isValidConnection)!=null?$:null}),{connectionStartHandle:r,connectionClickStartHandle:s,connectionEndHandle:a,vueFlowRef:l,nodesConnectable:c,noDragClassName:u,noPanClassName:d}=we(),{id:v,node:p,nodeEl:N,connectedEdges:_}=ur(),w=pe(),x=ye(()=>typeof e.connectableStart!="undefined"?e.connectableStart:!0),I=ye(()=>typeof e.connectableEnd!="undefined"?e.connectableEnd:!0),m=ye(()=>{var $,B,S,ie,y,M;return(($=r.value)==null?void 0:$.nodeId)===v&&((B=r.value)==null?void 0:B.handleId)===e.id&&((S=r.value)==null?void 0:S.type)===o.value||((ie=a.value)==null?void 0:ie.nodeId)===v&&((y=a.value)==null?void 0:y.handleId)===e.id&&((M=a.value)==null?void 0:M.type)===o.value}),E=ye(()=>{var $,B,S;return(($=s.value)==null?void 0:$.nodeId)===v&&((B=s.value)==null?void 0:B.handleId)===e.id&&((S=s.value)==null?void 0:S.type)===o.value}),{handlePointerDown:R,handleClick:Y}=ar({nodeId:v,handleId:e.id,isValidConnection:i,type:o}),G=oe(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some($=>{const B=$[`${o.value}Handle`];return $[o.value]!==v?!1:B?B===e.id:!0}):typeof e.connectable=="number"?_.value.filter($=>{const B=$[`${o.value}Handle`];return $[o.value]!==v?!1:B?B===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,_.value):Ee(e.connectable)?e.connectable:c.value);Xe(()=>{var D;var $;if(!p.dimensions.width||!p.dimensions.height)return;const B=($=p.handleBounds[o.value])==null?void 0:$.find(A=>A.id===e.id);if(!l.value||B)return;const S=l.value.querySelector(".vue-flow__transformationpane");if(!N.value||!w.value||!S||!e.id)return;const ie=N.value.getBoundingClientRect(),y=w.value.getBoundingClientRect(),M=window.getComputedStyle(S),{m22:b}=new window.DOMMatrixReadOnly(M.transform),T=z({id:e.id,position:e.position,x:(y.left-ie.left)/b,y:(y.top-ie.top)/b},mn(w.value));p.handleBounds[o.value]=[...(D=p.handleBounds[o.value])!=null?D:[],T]}),li(()=>{const $=p.handleBounds[o.value];$&&(p.handleBounds[o.value]=$.filter(B=>B.id!==e.id))});function X($){const B=ao($);G.value&&x.value&&(B&&$.button===0||!B)&&R($)}function U($){!v||!s.value&&!x.value||G.value&&Y($)}return t({handleClick:Y,handlePointerDown:R,onClick:U,onPointerDown:X}),($,B)=>(fe(),_e("div",{ref_key:"handle",ref:w,"data-id":`${ee(v)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":ee(v),"data-handlepos":$.position,class:ot(["vue-flow__handle",[`vue-flow__handle-${$.position}`,`vue-flow__handle-${e.id}`,ee(u),ee(d),o.value,{connectable:G.value,connecting:E.value,connectablestart:x.value,connectableend:I.value,connectionindicator:G.value&&(x.value&&!m.value||I.value&&m.value)}]]),onMousedown:X,onTouchstartPassive:X,onClick:U},[Ye($.$slots,"default",{id:$.id})],42,dc))}})),_n=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[me(dn,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof a!="string"&&a?me(a):me("div",{innerHTML:a}),me(dn,{type:"source",position:e,connectable:o,isValidConnection:r})]};_n.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];_n.inheritAttrs=!1;_n.compatConfig={MODE:3};const hc=_n,wn=function({targetPosition:e=q.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[me(dn,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?me(r):me("div",{innerHTML:r})]};wn.props=["targetPosition","label","isValidTargetPos","connectable","data"];wn.inheritAttrs=!1;wn.compatConfig={MODE:3};const gc=wn,bn=function({sourcePosition:e=q.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?me(r):me("div",{innerHTML:r}),me(dn,{type:"source",position:e,connectable:n,isValidConnection:o})]};bn.props=["sourcePosition","label","isValidSourcePos","connectable","data"];bn.inheritAttrs=!1;bn.compatConfig={MODE:3};const vc=bn,pc=["transform"],mc=["width","height","x","y","rx","ry"],yc=["y"],_c={name:"EdgeText",compatConfig:{MODE:3}},wc=xe(ge(z({},_c),{props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=pe({x:0,y:0,width:0,height:0}),n=pe(null),o=oe(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);Xe(i),ve([()=>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)=>(fe(),_e("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(fe(),_e("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:Oe(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,mc)):ze("",!0),it("text",$r(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[Ye(r.$slots,"default",{},()=>[typeof r.label!="string"?(fe(),rt(Pr(r.label),{key:0})):(fe(),_e(st,{key:1},[Tr(An(r.label),1)],64))])],16,yc)],8,pc))}})),bc=["id","d","marker-end","marker-start"],xc=["d","stroke-width"],Ec={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},xn=xe(ge(z({},Ec),{props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},style:{},labelStyle:{},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=ai(e,["interactionWidth","labelShowBg"]),o=pe(null),i=pe(null),r=pe(null),s=Cr();return t({pathEl:o,interactionEl:i,labelEl:r}),(a,l)=>(fe(),_e(st,null,[it("path",{id:a.id,ref_key:"pathEl",ref:o,d:a.path,style:Oe(n.style),class:ot(["vue-flow__edge-path",ee(s).class]),"marker-end":a.markerEnd,"marker-start":a.markerStart},null,14,bc),a.interactionWidth?(fe(),_e("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:a.path,"stroke-width":a.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,xc)):ze("",!0),a.label&&a.labelX&&a.labelY?(fe(),rt(wc,{key:1,ref_key:"labelEl",ref:r,x:a.labelX,y:a.labelY,label:a.label,"label-show-bg":a.labelShowBg,"label-bg-style":a.labelBgStyle,"label-bg-padding":a.labelBgPadding,"label-bg-border-radius":a.labelBgBorderRadius,"label-style":a.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):ze("",!0)],64))}}));function fr({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 hr({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,c=t*.125+r*.375+a*.375+o*.125,u=Math.abs(l-e),d=Math.abs(c-t);return[l,c,u,d]}function Wt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function ei({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let s,a;switch(e){case q.Left:s=t-Wt(t-o,r),a=n;break;case q.Right:s=t+Wt(o-t,r),a=n;break;case q.Top:s=t,a=n-Wt(n-i,r);break;case q.Bottom:s=t,a=n+Wt(i-n,r);break}return[s,a]}function gr(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:s=q.Top,curvature:a=.25}=e,[l,c]=ei({pos:o,x1:t,y1:n,x2:i,y2:r,c:a}),[u,d]=ei({pos:s,x1:i,y1:r,x2:t,y2:n,c:a}),[v,p,N,_]=hr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${t},${n} C${l},${c} ${u},${d} ${i},${r}`,v,p,N,_]}function ti({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 vr(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:s=q.Top}=e,[a,l]=ti({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,u]=ti({pos:s,x1:i,y1:r,x2:t,y2:n}),[d,v,p,N]=hr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${t},${n} C${a},${l} ${c},${u} ${i},${r}`,d,v,p,N]}const ni={[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 Sc({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 oi(e,t){return Math.sqrt(dt(t.x-e.x,2)+dt(t.y-e.y,2))}function Nc({source:e,sourcePosition:t=q.Bottom,target:n,targetPosition:o=q.Top,center:i,offset:r}){var G,X;const s=ni[t],a=ni[o],l={x:e.x+s.x*r,y:e.y+s.y*r},c={x:n.x+a.x*r,y:n.y+a.y*r},u=Sc({source:l,sourcePosition:t,target:c}),d=u.x!==0?"x":"y",v=u[d];let p,N,_;const w={x:0,y:0},x={x:0,y:0},[I,m,E,R]=fr({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[d]*a[d]===-1){N=(G=i.x)!=null?G:I,_=(X=i.y)!=null?X:m;const U=[{x:N,y:l.y},{x:N,y:c.y}],$=[{x:l.x,y:_},{x:c.x,y:_}];s[d]===v?p=d==="x"?U:$:p=d==="x"?$:U}else{const U=[{x:l.x,y:c.y}],$=[{x:c.x,y:l.y}];if(d==="x"?p=s.x===v?$:U:p=s.y===v?U:$,t===o){const M=Math.abs(e[d]-n[d]);if(M<=r){const b=Math.min(r-1,r-M);s[d]===v?w[d]=(l[d]>e[d]?-1:1)*b:x[d]=(c[d]>n[d]?-1:1)*b}}if(t!==o){const M=d==="x"?"y":"x",b=s[d]===a[M],T=l[M]>c[M],D=l[M]<c[M];(s[d]===1&&(!b&&T||b&&D)||s[d]!==1&&(!b&&D||b&&T))&&(p=d==="x"?U:$)}const B={x:l.x+w.x,y:l.y+w.y},S={x:c.x+x.x,y:c.y+x.y},ie=Math.max(Math.abs(B.x-p[0].x),Math.abs(S.x-p[0].x)),y=Math.max(Math.abs(B.y-p[0].y),Math.abs(S.y-p[0].y));ie>=y?(N=(B.x+S.x)/2,_=p[0].y):(N=p[0].x,_=(B.y+S.y)/2)}return[[e,{x:l.x+w.x,y:l.y+w.y},...p,{x:c.x+x.x,y:c.y+x.y},n],N,_,E,R]}function Cc(e,t,n,o){const i=Math.min(oi(e,t)/2,oi(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 c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${r+i*c},${s}Q ${r},${s} ${r},${s+i*u}`}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 qn(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:s=q.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20}=e,[d,v,p,N,_]=Nc({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:s,center:{x:l,y:c},offset:u});return[d.reduce((x,I,m)=>{let E;return m>0&&m<d.length-1?E=Cc(d[m-1],I,d[m+1],a):E=`${m===0?"M":"L"}${I.x} ${I.y}`,x+=E,x},""),v,p,N,_]}function Mc(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,s,a,l]=fr({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,s,a,l]}const Ic=xe({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]=Mc(e);return me(xn,z(z({path:n,labelX:o,labelY:i},t),e))}}}),kc=Ic,Pc=xe({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()=>{var r,s;const[n,o,i]=qn(ge(z({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:q.Bottom,targetPosition:(s=e.targetPosition)!=null?s:q.Top}));return me(xn,z(z({path:n,labelX:o,labelY:i},t),e))}}}),pr=Pc,Tc=xe({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>me(pr,ge(z(z({},e),t),{borderRadius:0}))}}),$c=Tc,Dc=xe({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()=>{var r,s;const[n,o,i]=gr(ge(z({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:q.Bottom,targetPosition:(s=e.targetPosition)!=null?s:q.Top}));return me(xn,z(z({path:n,labelX:o,labelY:i},t),e))}}}),Ac=Dc,Oc=xe({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()=>{var r,s;const[n,o,i]=vr(ge(z({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:q.Bottom,targetPosition:(s=e.targetPosition)!=null?s:q.Top}));return me(xn,z(z({path:n,labelX:o,labelY:i},t),e))}}}),zc=Oc,Bc={input:vc,default:hc,output:gc},Rc={default:Ac,straight:kc,step:$c,smoothstep:pr,simplebezier:zc};function Vc(e,t,n){const o=oe(()=>_=>t.value.get(_)),i=oe(()=>_=>n.value.get(_)),r=oe(()=>{const _=z(z({},Rc),e.edgeTypes),w=Object.keys(_);for(const x of e.edges)x.type&&!w.includes(x.type)&&(_[x.type]=x.type);return _}),s=oe(()=>{const _=z(z({},Bc),e.nodeTypes),w=Object.keys(_);for(const x of e.nodes)x.type&&!w.includes(x.type)&&(_[x.type]=x.type);return _}),a=oe(()=>e.onlyRenderVisibleElements?Ji(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),l=oe(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const w of e.edges){const x=t.value.get(w.source),I=t.value.get(w.target);Lu({sourcePos:x.computedPosition||{x:0,y:0},targetPos:I.computedPosition||{x:0,y:0},sourceWidth:x.dimensions.width,sourceHeight:x.dimensions.height,targetWidth:I.dimensions.width,targetHeight:I.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(w)}return _}return e.edges}),c=oe(()=>[...a.value,...l.value]),u=oe(()=>{const _=[];for(const w of e.nodes)w.selected&&_.push(w);return _}),d=oe(()=>{const _=[];for(const w of e.edges)w.selected&&_.push(w);return _}),v=oe(()=>[...u.value,...d.value]),p=oe(()=>{const _=[];for(const w of e.nodes)w.dimensions.width&&w.dimensions.height&&w.handleBounds!==void 0&&_.push(w);return _}),N=oe(()=>a.value.length>0&&p.value.length===a.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:s,getEdges:l,getNodes:a,getSelectedElements:v,getSelectedNodes:u,getSelectedEdges:d,getNodesInitialized:p,areNodesInitialized:N}}class je{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var i;var t;const n=(t=zt())==null?void 0:t.appContext.app,o=(i=n==null?void 0:n.config.globalProperties.$vueFlowStorage)!=null?i:je.instance;return je.instance=o!=null?o:new je,n&&(n.config.globalProperties.$vueFlowStorage=je.instance),je.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=dr(),i=Er(o),r={};for(const[v,p]of Object.entries(i.hooks)){const N=`on${v.charAt(0).toUpperCase()+v.slice(1)}`;r[N]=p.on}const s={};for(const[v,p]of Object.entries(i.hooks))s[v]=p.trigger;const a=oe(()=>{const v=new Map;for(const p of i.nodes)v.set(p.id,p);return v}),l=oe(()=>{const v=new Map;for(const p of i.edges)v.set(p.id,p);return v}),c=Vc(i,a,l),u=cc(i,a,l);u.setState(z(z({},i),n));const d=ge(z(z(z(z({},r),c),u),Yr(i)),{nodeLookup:a,edgeLookup:l,emits:s,id:t,vueFlowVersion:"1.41.2",$destroy:()=>{this.remove(t)}});return this.set(t,d),d}getId(){return`vue-flow-${this.currentId++}`}}function we(e){const t=je.getInstance(),n=si(),o=typeof e=="object",i=o?e:{id:e},r=i.id,s=r!=null?r:n==null?void 0:n.vueFlowId;let a;if(n){const l=xt(jo,null);typeof l!="undefined"&&l!==null&&(!s||l.id===s)&&(a=l)}if(a||s&&(a=t.get(s)),!a||s&&a.id!==s){const l=r!=null?r:t.getId(),c=t.create(l,i);a=c,(n!=null?n:ri(!0)).run(()=>{ve(c.applyDefault,(d,v,p)=>{const N=w=>{c.applyNodeChanges(w)},_=w=>{c.applyEdgeChanges(w)};d?(c.onNodesChange(N),c.onEdgesChange(_)):(c.hooks.value.nodesChange.off(N),c.hooks.value.edgesChange.off(_)),p(()=>{c.hooks.value.nodesChange.off(N),c.hooks.value.edgesChange.off(_)})},{immediate:!0}),fn(()=>{if(a){const d=t.get(a.id);d?d.$destroy():Vt(`No store instance found for id ${a.id} in storage.`)}})})}else o&&a.setState(i);if(n&&(yt(jo,a),n.vueFlowId=a.id),o){const l=zt();(l==null?void 0:l.type.name)!=="VueFlow"&&a.emits.error(new Ne(Se.USEVUEFLOW_OPTIONS))}return a}function Hc(e){const{emits:t,dimensions:n}=we();let o;Xe(()=>{const i=e.value,r=()=>{if(!i)return;const s=mn(i);(s.width===0||s.height===0)&&t.error(new Ne(Se.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:s.width||500,height:s.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),ui(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const Lc={name:"UserSelection",compatConfig:{MODE:3}},Fc=xe(ge(z({},Lc),{props:{userSelectionRect:{}},setup(e){return(t,n)=>(fe(),_e("div",{class:"vue-flow__selection vue-flow__container",style:Oe({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}})),Yc=["tabIndex"],Gc={name:"NodesSelection",compatConfig:{MODE:3}},Xc=xe(ge(z({},Gc),{setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:s}=we(),a=cr(),l=pe(null),c=sr({el:l,onStart(N){t.selectionDragStart(N)},onDrag(N){t.selectionDrag(N)},onStop(N){t.selectionDragStop(N)}});Xe(()=>{var N;r.value||(N=l.value)==null||N.focus({preventScroll:!0})});const u=oe(()=>qi(o.value)),d=oe(()=>({width:`${u.value.width}px`,height:`${u.value.height}px`,top:`${u.value.y}px`,left:`${u.value.x}px`}));function v(N){t.selectionContextMenu({event:N,nodes:o.value})}function p(N){r||mt[N.key]&&a({x:mt[N.key].x,y:mt[N.key].y},N.shiftKey)}return(N,_)=>!ee(s)&&u.value.width&&u.value.height?(fe(),_e("div",{key:0,class:ot(["vue-flow__nodesselection vue-flow__container",ee(i)]),style:Oe({transform:`translate(${ee(n).x}px,${ee(n).y}px) scale(${ee(n).zoom})`})},[it("div",{ref_key:"el",ref:l,class:ot([{dragging:ee(c)},"vue-flow__nodesselection-rect"]),style:Oe(d.value),tabIndex:ee(r)?void 0:-1,onContextmenu:v,onKeydown:p},null,46,Yc)],6)):ze("",!0)}}));function Uc(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Zc={name:"Pane",compatConfig:{MODE:3}},Kc=xe(ge(z({},Zc),{props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:s,panOnDrag:a,userSelectionRect:l,elementsSelectable:c,nodesSelectionActive:u,getSelectedEdges:d,getSelectedNodes:v,removeNodes:p,removeEdges:N,selectionMode:_,deleteKeyCode:w,multiSelectionKeyCode:x,multiSelectionActive:I,edgeLookup:m,nodeLookup:E}=we(),R=pe(null),Y=pe(0),G=pe(0),X=pe(),U=pe(new Map),$=ye(()=>c.value&&(e.isSelecting||r.value));let B=!1,S=!1;const ie=kt(w,{actInsideInputWithModifier:!1}),y=kt(x);ve(ie,V=>{V&&(p(v.value),N(d.value),u.value=!1)}),ve(y,V=>{I.value=V});function M(V,O){return W=>{W.target===O&&(V==null||V(W))}}function b(){r.value=!1,l.value=null,Y.value=0,G.value=0}function T(V){if(B){B=!1;return}i.paneClick(V),s(),u.value=!1}function D(V){var O;if(Array.isArray(a.value)&&((O=a.value)!=null&&O.includes(2))){V.preventDefault();return}i.paneContextMenu(V)}function A(V){i.paneScroll(V)}function L(V){var O,W,ce,ae,he;if(X.value=(O=t.value)==null?void 0:O.getBoundingClientRect(),!c.value||!e.isSelecting||V.button!==0||V.target!==R.value||!X.value)return;(ce=(W=V.target)==null?void 0:W.setPointerCapture)==null||ce.call(W,V.pointerId);const{x:te,y:re}=Uc(V,X.value);S=!0,B=!1,U.value=new Map;for(const[Z,J]of m.value)U.value.set(J.source,((ae=U.value.get(J.source))==null?void 0:ae.add(Z))||new Set([Z])),U.value.set(J.target,((he=U.value.get(J.target))==null?void 0:he.add(Z))||new Set([Z]));s(),l.value={width:0,height:0,startX:te,startY:re,x:te,y:re},i.selectionStart(V)}function F(V){if(!X.value||!l.value)return;B=!0;const{x:O,y:W}=qe(V,X.value),{startX:ce=0,startY:ae=0}=l.value,he={startX:ce,startY:ae,x:O<ce?O:ce,y:W<ae?W:ae,width:Math.abs(O-ce),height:Math.abs(W-ae)},te=Ji(n.value,he,o.value,_.value===ro.Partial,!0),re=new Set,Z=new Set;for(const J of te){Z.add(J.id);const se=U.value.get(J.id);if(se)for(const g of se)re.add(g)}if(Y.value!==Z.size){Y.value=Z.size;const J=We(E.value,Z,!0);i.nodesChange(J)}if(G.value!==re.size){G.value=re.size;const J=We(m.value,re);i.edgesChange(J)}l.value=he,r.value=!0,u.value=!1}function j(V){var O;V.button!==0||!S||((O=V.target)==null||O.releasePointerCapture(V.pointerId),!r.value&&l.value&&V.target===R.value&&T(V),Y.value>0&&(u.value=!0),b(),i.selectionEnd(V),e.selectionKeyPressed&&(B=!1),S=!1)}return(V,O)=>(fe(),_e("div",{ref_key:"container",ref:R,class:ot(["vue-flow__pane vue-flow__container",{selection:V.isSelecting}]),onClick:O[0]||(O[0]=W=>$.value?void 0:M(T,R.value)(W)),onContextmenu:O[1]||(O[1]=W=>M(D,R.value)(W)),onWheelPassive:O[2]||(O[2]=W=>M(A,R.value)(W)),onPointerenter:O[3]||(O[3]=W=>$.value?void 0:ee(i).paneMouseEnter(W)),onPointerdown:O[4]||(O[4]=W=>$.value?L(W):ee(i).paneMouseMove(W)),onPointermove:O[5]||(O[5]=W=>$.value?F(W):ee(i).paneMouseMove(W)),onPointerup:O[6]||(O[6]=W=>$.value?j(W):void 0),onPointerleave:O[7]||(O[7]=W=>ee(i).paneMouseLeave(W))},[Ye(V.$slots,"default"),ee(r)&&ee(l)?(fe(),rt(Fc,{key:0,"user-selection-rect":ee(l)},null,8,["user-selection-rect"])):ze("",!0),ee(u)&&ee(v).length?(fe(),rt(Xc,{key:1})):ze("",!0)],34))}})),Wc={name:"Transform",compatConfig:{MODE:3}},qc=xe(ge(z({},Wc),{setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=we(),i=oe(()=>n.value?!o.value:!1),r=oe(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(s,a)=>(fe(),_e("div",{class:"vue-flow__transformationpane vue-flow__container",style:Oe({transform:r.value,opacity:i.value?0:void 0})},[Ye(s.$slots,"default")],4))}})),Jc={name:"Viewport",compatConfig:{MODE:3}},Qc=xe(ge(z({},Jc),{setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:s,panActivationKeyCode:a,panOnScroll:l,panOnScrollMode:c,panOnScrollSpeed:u,panOnDrag:d,zoomOnDoubleClick:v,zoomOnPinch:p,zoomOnScroll:N,preventScrolling:_,noWheelClassName:w,noPanClassName:x,emits:I,connectionStartHandle:m,userSelectionActive:E,paneDragging:R,d3Zoom:Y,d3Selection:G,d3ZoomHandler:X,viewport:U,viewportRef:$,paneClickDistance:B}=we();Hc($);const S=pe(!1),ie=pe(!1);let y=null,M=!1,b=0,T={x:0,y:0,zoom:0};const D=kt(a),A=kt(s),L=kt(r),F=ye(()=>!A.value&&(D.value||d.value)),j=ye(()=>D.value||l.value),V=ye(()=>A.value||s.value===!0&&F.value!==!0);Xe(()=>{var C,P,K;if(!$.value){Vt("Viewport element is missing");return}const te=$.value,re=te.getBoundingClientRect(),Z=Su().clickDistance(B.value).scaleExtent([t.value,n.value]).translateExtent(i.value),J=Pe(te).call(Z),se=J.on("wheel.zoom"),g=bt.translate((C=o.value.x)!=null?C:0,(P=o.value.y)!=null?P:0).scale(ut((K=o.value.zoom)!=null?K:1,t.value,n.value)),f=[[0,0],[re.width,re.height]],h=Z.constrain()(g,f,i.value);Z.transform(J,h),Z.wheelDelta(W),Y.value=Z,G.value=J,X.value=se,U.value={x:h.x,y:h.y,zoom:h.k},Z.on("start",k=>{var Q;if(!k.sourceEvent)return null;b=k.sourceEvent.button,S.value=!0;const ne=ae(k.transform);((Q=k.sourceEvent)==null?void 0:Q.type)==="mousedown"&&(R.value=!0),T=ne,I.viewportChangeStart(ne),I.moveStart({event:k,flowTransform:ne})}),Z.on("end",k=>{if(!k.sourceEvent)return null;if(S.value=!1,R.value=!1,O(F.value,b!=null?b:0)&&!M&&I.paneContextMenu(k.sourceEvent),M=!1,ce(T,k.transform)){const Q=ae(k.transform);T=Q,I.viewportChangeEnd(Q),I.moveEnd({event:k,flowTransform:Q})}}),Z.filter(k=>{var Q,ne,de;const le=L.value||N.value,be=p.value&&k.ctrlKey,Me=k.button;if((F.value===!0||Array.isArray(F.value)&&F.value.includes(1))&&Me===1&&k.type==="mousedown"&&((Q=k.target)!=null&&Q.closest(".vue-flow__node")||(ne=k.target)!=null&&ne.closest(".vue-flow__edge")))return!0;if(!F.value&&!le&&!j.value&&!v.value&&!p.value||E.value||!v.value&&k.type==="dblclick"||he(k,w.value)&&k.type==="wheel"||he(k,x.value)&&(k.type!=="wheel"||j.value&&k.type==="wheel"&&!L.value)||!p.value&&k.ctrlKey&&k.type==="wheel"||!le&&!j.value&&!be&&k.type==="wheel")return!1;if(!p&&k.type==="touchstart"&&((de=k.touches)==null?void 0:de.length)>1)return k.preventDefault(),!1;if(!F.value&&(k.type==="mousedown"||k.type==="touchstart")||Array.isArray(F.value)&&!F.value.includes(Me)&&(k.type==="mousedown"||k.type==="touchstart"))return!1;const ke=Array.isArray(F.value)&&F.value.includes(Me)||!Me||Me<=1;return(!k.ctrlKey||k.type==="wheel")&&ke}),ve([E,F],()=>{E.value&&!S.value?Z.on("zoom",null):E.value||Z.on("zoom",k=>{U.value={x:k.transform.x,y:k.transform.y,zoom:k.transform.k};const Q=ae(k.transform);M=O(F.value,b!=null?b:0),I.viewportChange(Q),I.move({event:k,flowTransform:Q})})},{immediate:!0}),ve([E,j,c,L,p,_,w],()=>{j.value&&!L.value&&!E.value?J.on("wheel.zoom",k=>{if(he(k,w.value))return!1;const Q=L.value||N.value,ne=p.value&&k.ctrlKey;if(!(!_.value||j.value||Q||ne))return!1;k.preventDefault(),k.stopImmediatePropagation();const le=J.property("__zoom").k||1,be=cn();if(k.ctrlKey&&p.value&&be){const mr=De(k),yr=W(k),_r=le*dt(2,yr);Z.scaleTo(J,_r,mr,k);return}const Me=k.deltaMode===1?20:1;let ke=c.value===It.Vertical?0:k.deltaX*Me,Ht=c.value===It.Horizontal?0:k.deltaY*Me;!be&&k.shiftKey&&c.value!==It.Vertical&&!ke&&Ht&&(ke=Ht,Ht=0),Z.translateBy(J,-(ke/le)*u.value,-(Ht/le)*u.value);const ct=ae(J.property("__zoom"));y&&clearTimeout(y),ie.value?(I.move({event:k,flowTransform:ct}),I.viewportChange(ct),y=setTimeout(()=>{I.moveEnd({event:k,flowTransform:ct}),I.viewportChangeEnd(ct),ie.value=!1},150)):(ie.value=!0,I.moveStart({event:k,flowTransform:ct}),I.viewportChangeStart(ct))},{passive:!1}):typeof se!="undefined"&&J.on("wheel.zoom",function(k,Q){const ne=!_.value&&k.type==="wheel"&&!k.ctrlKey,de=L.value||N.value,le=p.value&&k.ctrlKey;if(!de&&!l.value&&!le&&k.type==="wheel"||ne||he(k,w.value))return null;k.preventDefault(),se.call(this,k,Q)},{passive:!1})},{immediate:!0})});function O(te,re){return re===2&&Array.isArray(te)&&te.includes(2)}function W(te){const re=te.ctrlKey&&cn()?10:1;return-te.deltaY*(te.deltaMode===1?.05:te.deltaMode?1:.002)*re}function ce(te,re){return te.x!==re.x&&!Number.isNaN(re.x)||te.y!==re.y&&!Number.isNaN(re.y)||te.zoom!==re.k&&!Number.isNaN(re.k)}function ae(te){return{x:te.x,y:te.y,zoom:te.k}}function he(te,re){return te.target.closest(`.${re}`)}return(te,re)=>(fe(),_e("div",{ref_key:"viewportRef",ref:$,class:"vue-flow__viewport vue-flow__container"},[He(Kc,{"is-selecting":V.value,"selection-key-pressed":ee(A),class:ot({connecting:!!ee(m),dragging:ee(R),draggable:ee(d)===!0||Array.isArray(ee(d))&&ee(d).includes(0)})},{default:Dn(()=>[He(qc,null,{default:Dn(()=>[Ye(te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}})),jc=["id"],ed=["id"],td=["id"],nd={name:"A11yDescriptions",compatConfig:{MODE:3}},od=xe(ge(z({},nd),{setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=we();return(i,r)=>(fe(),_e(st,null,[it("div",{id:`${ee(Li)}-${ee(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+An(ee(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,jc),it("div",{id:`${ee(Fi)}-${ee(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,ed),ee(n)?ze("",!0):(fe(),_e("div",{key:0,id:`${ee(Iu)}-${ee(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%)"}},An(ee(o)),9,td))],64))}}));function id(){const e=we();ve(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function rd(e,t,n){return n===q.Left?e-t:n===q.Right?e+t:e}function sd(e,t,n){return n===q.Top?e-t:n===q.Bottom?e+t:e}const uo=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=q.Top,type:i}){return me("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:rd(t,e,o),cy:sd(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};uo.props=["radius","centerX","centerY","position","type"];uo.compatConfig={MODE:3};const ii=uo,ad=xe({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:c,findEdge:u,findNode:d,isValidConnection:v,multiSelectionActive:p,disableKeyboardA11y:N,elementsSelectable:_,edgesUpdatable:w,edgesFocusable:x,hooks:I}=we(),m=oe(()=>u(e.id)),{emit:E,on:R}=ec(m.value,r),Y=xt(yn),G=zt(),X=pe(!1),U=pe(!1),$=pe(""),B=pe(null),S=pe("source"),ie=pe(null),y=ye(()=>typeof m.value.selectable=="undefined"?_.value:m.value.selectable),M=ye(()=>typeof m.value.updatable=="undefined"?w.value:m.value.updatable),b=ye(()=>typeof m.value.focusable=="undefined"?x.value:m.value.focusable);yt(Ju,e.id),yt(Qu,ie);const T=oe(()=>m.value.class instanceof Function?m.value.class(m.value):m.value.class),D=oe(()=>m.value.style instanceof Function?m.value.style(m.value):m.value.style),A=oe(()=>{var P;const f=m.value.type||"default",h=Y==null?void 0:Y[`edge-${f}`];if(h)return h;let C=(P=m.value.template)!=null?P:l.value[f];if(typeof C=="string"&&G){const K=Object.keys(G.appContext.components);K&&K.includes(f)&&(C=ci(f,!1))}return C&&typeof C!="string"?C:(r.error(new Ne(Se.EDGE_TYPE_MISSING,C)),!1)}),{handlePointerDown:L}=ar({nodeId:$,handleId:B,type:S,isValidConnection:v,edgeUpdaterType:S,onEdgeUpdate:V,onEdgeUpdateEnd:O});return()=>{const f=d(m.value.source),h=d(m.value.target),C="pathOptions"in m.value?m.value.pathOptions:{};if(!f&&!h)return r.error(new Ne(Se.EDGE_SOURCE_TARGET_MISSING,m.value.id,m.value.source,m.value.target)),null;if(!f)return r.error(new Ne(Se.EDGE_SOURCE_MISSING,m.value.id,m.value.source)),null;if(!h)return r.error(new Ne(Se.EDGE_TARGET_MISSING,m.value.id,m.value.target)),null;if(!m.value||m.value.hidden||f.hidden||h.hidden)return null;let P;o.value===lt.Strict?P=f.handleBounds.source:P=[...f.handleBounds.source||[],...f.handleBounds.target||[]];const K=Go(P,m.value.sourceHandle);let k;o.value===lt.Strict?k=h.handleBounds.target:k=[...h.handleBounds.target||[],...h.handleBounds.source||[]];const Q=Go(k,m.value.targetHandle),ne=(K==null?void 0:K.position)||q.Bottom,de=(Q==null?void 0:Q.position)||q.Top,{x:le,y:be}=un(f,K,ne),{x:Me,y:ke}=un(h,Q,de);return m.value.sourceX=le,m.value.sourceY=be,m.value.targetX=Me,m.value.targetY=ke,me("g",{ref:ie,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${A.value===!1?"default":m.value.type||"default"}`,a.value,T.value,{updating:X.value,selected:m.value.selected,animated:m.value.animated,inactive:!y.value&&!I.value.edgeClick.hasListeners()}],onClick:ce,onContextmenu:ae,onDblclick:he,onMouseenter:te,onMousemove:re,onMouseleave:Z,onKeyDown:b.value?g:void 0,tabIndex:b.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":b.value?`${Fi}-${t}`:void 0,role:b.value?"button":"img"},[U.value?null:me(A.value===!1?l.value.default:A.value,z({id:e.id,sourceNode:f,targetNode:h,source:m.value.source,target:m.value.target,type:m.value.type,updatable:M.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:z(z({},m.value.events),R),style:D.value,markerStart:`url('#${Ot(m.value.markerStart,t)}')`,markerEnd:`url('#${Ot(m.value.markerEnd,t)}')`,sourcePosition:ne,targetPosition:de,sourceX:le,sourceY:be,targetX:Me,targetY:ke,sourceHandleId:m.value.sourceHandle,targetHandleId:m.value.targetHandle,interactionWidth:m.value.interactionWidth},C)),[M.value==="source"||M.value===!0?[me("g",{onMousedown:J,onMouseenter:F,onMouseout:j},me(ii,{position:ne,centerX:le,centerY:be,radius:i.value,type:"source","data-type":"source"}))]:null,M.value==="target"||M.value===!0?[me("g",{onMousedown:se,onMouseenter:F,onMouseout:j},me(ii,{position:de,centerX:Me,centerY:ke,radius:i.value,type:"target","data-type":"target"}))]:null]])};function F(){X.value=!0}function j(){X.value=!1}function V(f,h){E.update({event:f,edge:m.value,connection:h})}function O(f){E.updateEnd({event:f,edge:m.value}),U.value=!1}function W(f,h){var C;f.button===0&&(U.value=!0,$.value=h?m.value.target:m.value.source,B.value=(C=h?m.value.targetHandle:m.value.sourceHandle)!=null?C:"",S.value=h?"target":"source",E.updateStart({event:f,edge:m.value}),L(f))}function ce(f){var h;const C={event:f,edge:m.value};y.value&&(s.value=!1,m.value.selected&&p.value?(c([m.value]),(h=ie.value)==null||h.blur()):n([m.value])),E.click(C)}function ae(f){E.contextMenu({event:f,edge:m.value})}function he(f){E.doubleClick({event:f,edge:m.value})}function te(f){E.mouseEnter({event:f,edge:m.value})}function re(f){E.mouseMove({event:f,edge:m.value})}function Z(f){E.mouseLeave({event:f,edge:m.value})}function J(f){W(f,!0)}function se(f){W(f,!1)}function g(f){var h;!N.value&&Yi.includes(f.key)&&y.value&&(f.key==="Escape"?((h=ie.value)==null||h.blur(),c([u(e.id)])):n([u(e.id)]))}}}),ld=ad,ud={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top},cd=xe({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:c,viewport:u,findNode:d}=we(),v=(e=xt(yn))==null?void 0:e["connection-line"],p=oe(()=>{var I;return d((I=o.value)==null?void 0:I.nodeId)}),N=oe(()=>{var m;var I;return(m=d((I=i.value)==null?void 0:I.nodeId))!=null?m:null}),_=oe(()=>({x:(r.value.x-u.value.x)/u.value.zoom,y:(r.value.y-u.value.y)/u.value.zoom})),w=oe(()=>l.value.markerStart?`url(#${Ot(l.value.markerStart,t)})`:""),x=oe(()=>l.value.markerEnd?`url(#${Ot(l.value.markerEnd,t)})`:"");return()=>{var A,L,F,j;var I,m,E,R;if(!p.value||!o.value)return null;const Y=o.value.handleId,G=o.value.type,X=p.value.handleBounds;let U=X==null?void 0:X[G];if(n.value===lt.Loose&&(U=U||(X==null?void 0:X[G==="source"?"target":"source"])),!U)return null;const $=(A=Y?U.find(V=>V.id===Y):U[0])!=null?A:null,B=($==null?void 0:$.position)||q.Top,{x:S,y:ie}=un(p.value,$,B);let y=null;N.value&&((I=i.value)!=null&&I.handleId)&&(n.value===lt.Strict?y=((m=N.value.handleBounds[G==="source"?"target":"source"])==null?void 0:m.find(V=>{var O;return V.id===((O=i.value)==null?void 0:O.handleId)}))||null:y=((E=[...N.value.handleBounds.source||[],...N.value.handleBounds.target||[]])==null?void 0:E.find(V=>{var O;return V.id===((O=i.value)==null?void 0:O.handleId)}))||null);const M=(L=(R=i.value)==null?void 0:R.position)!=null?L:B?ud[B]:null;if(!B||!M)return null;const b=(j=(F=s.value)!=null?F:l.value.type)!=null?j:Qe.Bezier;let T="";const D={sourceX:S,sourceY:ie,sourcePosition:B,targetX:_.value.x,targetY:_.value.y,targetPosition:M};return b===Qe.Bezier?[T]=gr(D):b===Qe.Step?[T]=qn(ge(z({},D),{borderRadius:0})):b===Qe.SmoothStep?[T]=qn(D):b===Qe.SimpleBezier?[T]=vr(D):T=`M${S},${ie} ${_.value.x},${_.value.y}`,me("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},me("g",{class:"vue-flow__connection"},v?me(v,{sourceX:S,sourceY:ie,sourcePosition:B,targetX:_.value.x,targetY:_.value.y,targetPosition:M,sourceNode:p.value,sourceHandle:$,targetNode:N.value,targetHandle:y,markerEnd:x.value,markerStart:w.value,connectionStatus:c.value}):me("path",{d:T,class:[l.value.class,c,"vue-flow__connection-path"],style:z(z({},a.value),l.value.style),"marker-end":x.value,"marker-start":w.value})))}}}),dd=cd,fd=["id","markerWidth","markerHeight","markerUnits","orient"],hd={name:"MarkerType",compatConfig:{MODE:3}},gd=xe(ge(z({},hd),{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)=>(fe(),_e("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===ee(Xn).ArrowClosed?(fe(),_e("polyline",{key:0,style:Oe({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)):ze("",!0),t.type===ee(Xn).Arrow?(fe(),_e("polyline",{key:1,style:Oe({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):ze("",!0)],8,fd))}})),vd={class:"vue-flow__marker vue-flow__container"},pd={name:"MarkerDefinitions",compatConfig:{MODE:3}},md=xe(ge(z({},pd),{setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=we(),r=oe(()=>{const s=new Set,a=[],l=c=>{if(c){const u=Ot(c,t);s.has(u)||(typeof c=="object"?a.push(ge(z({},c),{id:u,color:c.color||i.value})):a.push({id:u,color:i.value,type:c}),s.add(u))}};for(const c of[o.value.markerEnd,o.value.markerStart])l(c);for(const c of n.value)for(const u of[c.markerStart,c.markerEnd])l(u);return a.sort((c,u)=>c.id.localeCompare(u.id))});return(s,a)=>(fe(),_e("svg",vd,[it("defs",null,[(fe(!0),_e(st,null,Qn(r.value,l=>(fe(),rt(gd,{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))])]))}})),yd={name:"Edges",compatConfig:{MODE:3}},_d=xe(ge(z({},yd),{setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=we();return(i,r)=>(fe(),_e(st,null,[He(md),(fe(!0),_e(st,null,Qn(ee(n),s=>(fe(),_e("svg",{key:s.id,class:"vue-flow__edges vue-flow__container",style:Oe({zIndex:ee(Fu)(s,ee(t),ee(o))})},[He(ee(ld),{id:s.id},null,8,["id"])],4))),128)),He(ee(dd))],64))}})),wd=xe({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:c,onUpdateNodeInternals:u,getNodeTypes:d,nodeExtent:v,elevateNodesOnSelect:p,disableKeyboardA11y:N,ariaLiveMessage:_,snapToGrid:w,snapGrid:x,nodeDragThreshold:I,nodesDraggable:m,elementsSelectable:E,nodesConnectable:R,nodesFocusable:Y,hooks:G}=we(),X=pe(null);yt(rr,X),yt(ir,e.id);const U=xt(yn),$=zt(),B=cr(),{node:S,parentNode:ie}=ur(e.id),{emit:y,on:M}=oc(S,s),b=ye(()=>typeof S.draggable=="undefined"?m.value:S.draggable),T=ye(()=>typeof S.selectable=="undefined"?E.value:S.selectable),D=ye(()=>typeof S.connectable=="undefined"?R.value:S.connectable),A=ye(()=>typeof S.focusable=="undefined"?Y.value:S.focusable),L=ye(()=>T.value||b.value||G.value.nodeClick.hasListeners()||G.value.nodeDoubleClick.hasListeners()||G.value.nodeMouseEnter.hasListeners()||G.value.nodeMouseMove.hasListeners()||G.value.nodeMouseLeave.hasListeners()),F=ye(()=>!!S.dimensions.width&&!!S.dimensions.height),j=oe(()=>{const h=S.type||"default",C=U==null?void 0:U[`node-${h}`];if(C)return C;let P=S.template||d.value[h];if(typeof P=="string"&&$){const K=Object.keys($.appContext.components);K&&K.includes(h)&&(P=ci(h,!1))}return P&&typeof P!="string"?P:(s.error(new Ne(Se.NODE_TYPE_MISSING,P)),!1)}),V=sr({id:e.id,el:X,disabled:()=>!b.value,selectable:T,dragHandle:()=>S.dragHandle,onStart(h){y.dragStart(h)},onDrag(h){y.drag(h)},onStop(h){y.dragStop(h)},onClick(h){g(h)}}),O=oe(()=>S.class instanceof Function?S.class(S):S.class),W=oe(()=>{const h=(S.style instanceof Function?S.style(S):S.style)||{},C=S.width instanceof Function?S.width(S):S.width,P=S.height instanceof Function?S.height(S):S.height;return!h.width&&C&&(h.width=typeof C=="string"?C:`${C}px`),!h.height&&P&&(h.height=typeof P=="string"?P:`${P}px`),h}),ce=ye(()=>{var h,C;return Number((C=(h=S.zIndex)!=null?h:W.value.zIndex)!=null?C:0)});return u(h=>{(h.includes(e.id)||!h.length)&&he()}),Xe(()=>{ve(()=>S.hidden,(h=!1,C,P)=>{!h&&X.value&&(e.resizeObserver.observe(X.value),P(()=>{X.value&&e.resizeObserver.unobserve(X.value)}))},{immediate:!0,flush:"post"})}),ve([()=>S.type,()=>S.sourcePosition,()=>S.targetPosition],()=>{Fe(()=>{c([{id:e.id,nodeElement:X.value,forceUpdate:!0}])})}),ve([()=>S.position.x,()=>S.position.y,()=>{var h;return(h=ie.value)==null?void 0:h.computedPosition.x},()=>{var h;return(h=ie.value)==null?void 0:h.computedPosition.y},()=>{var h;return(h=ie.value)==null?void 0:h.computedPosition.z},ce,()=>S.selected,()=>S.dimensions.height,()=>S.dimensions.width,()=>{var h;return(h=ie.value)==null?void 0:h.dimensions.height},()=>{var h;return(h=ie.value)==null?void 0:h.dimensions.width}],([h,C,P,K,k,Q])=>{const ne={x:h,y:C,z:Q+(p.value&&S.selected?1e3:0)};typeof P!="undefined"&&typeof K!="undefined"?S.computedPosition=zu({x:P,y:K,z:k},ne):S.computedPosition=ne},{flush:"post",immediate:!0}),ve([()=>S.extent,v],([h,C],[P,K])=>{(h!==P||C!==K)&&ae()}),S.extent==="parent"||typeof S.extent=="object"&&"range"in S.extent&&S.extent.range==="parent"?zn(()=>F).toBe(!0).then(ae):ae(),()=>{var h,C;return S.hidden?null:me("div",{ref:X,"data-id":S.id,class:["vue-flow__node",`vue-flow__node-${j.value===!1?"default":S.type||"default"}`,{[n.value]:b.value,dragging:V==null?void 0:V.value,draggable:b.value,selected:S.selected,selectable:T.value,parent:S.isParent},O.value],style:z({visibility:F.value?"visible":"hidden",zIndex:(h=S.computedPosition.z)!=null?h:ce.value,transform:`translate(${S.computedPosition.x}px,${S.computedPosition.y}px)`,pointerEvents:L.value?"all":"none"},W.value),tabIndex:A.value?0:void 0,role:A.value?"button":void 0,"aria-describedby":N.value?void 0:`${Li}-${t}`,"aria-label":S.ariaLabel,onMouseenter:te,onMousemove:re,onMouseleave:Z,onContextmenu:J,onClick:g,onDblclick:se,onKeydown:f},[me(j.value===!1?d.value.default:j.value,{id:S.id,type:S.type,data:S.data,events:z(z({},S.events),M),selected:S.selected,resizing:S.resizing,dragging:V.value,connectable:D.value,position:S.computedPosition,dimensions:S.dimensions,isValidTargetPos:S.isValidTargetPos,isValidSourcePos:S.isValidSourcePos,parent:S.parentNode,parentNodeId:S.parentNode,zIndex:(C=S.computedPosition.z)!=null?C:ce.value,targetPosition:S.targetPosition,sourcePosition:S.sourcePosition,label:S.label,dragHandle:S.dragHandle,onUpdateNodeInternals:he})])};function ae(){const h=S.computedPosition;w.value&&(h.x=x.value[0]*Math.round(h.x/x.value[0]),h.y=x.value[1]*Math.round(h.y/x.value[1]));const{computedPosition:C,position:P}=so(S,h,s.error,v.value,ie.value);(S.computedPosition.x!==C.x||S.computedPosition.y!==C.y)&&(S.computedPosition=z(z({},S.computedPosition),C)),(S.position.x!==P.x||S.position.y!==P.y)&&(S.position=P)}function he(){X.value&&c([{id:e.id,nodeElement:X.value,forceUpdate:!0}])}function te(h){V!=null&&V.value||y.mouseEnter({event:h,node:S})}function re(h){V!=null&&V.value||y.mouseMove({event:h,node:S})}function Z(h){V!=null&&V.value||y.mouseLeave({event:h,node:S})}function J(h){return y.contextMenu({event:h,node:S})}function se(h){return y.doubleClick({event:h,node:S})}function g(h){T.value&&(!o.value||!b.value||I.value>0)&&Wn(S,r.value,l,a,i,!1,X.value),y.click({event:h,node:S})}function f(h){if(!(Un(h)||N.value))if(Yi.includes(h.key)&&T.value){const C=h.key==="Escape";Wn(S,r.value,l,a,i,C,X.value)}else b.value&&S.selected&&mt[h.key]&&(_.value=`Moved selected node ${h.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~S.position.x}, y: ${~~S.position.y}`,B({x:mt[h.key].x,y:mt[h.key].y},h.shiftKey))}}}),bd=wd,xd={height:"0",width:"0"},Ed={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},Ad=xe(ge(z({},Ed),{setup(e){const{viewportRef:t}=we(),n=ye(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(fe(),_e("svg",null,[(fe(),_e("foreignObject",xd,[(fe(),rt(Mr,{to:n.value,disabled:!n.value},[Ye(o.$slots,"default")],8,["to","disabled"]))]))]))}}));function Sd(e={includeHiddenNodes:!1}){const{nodes:t}=we();return oe(()=>{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 Nd={class:"vue-flow__nodes vue-flow__container"},Cd={name:"Nodes",compatConfig:{MODE:3}},Md=xe(ge(z({},Cd),{setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=we(),i=Sd(),r=pe();return ve(i,s=>{s&&Fe(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),Xe(()=>{r.value=new ResizeObserver(s=>{const a=s.map(l=>({id:l.target.getAttribute("data-id"),nodeElement:l.target,forceUpdate:!0}));Fe(()=>n(a))})}),ui(()=>{var s;return(s=r.value)==null?void 0:s.disconnect()}),(s,a)=>(fe(),_e("div",Nd,[r.value?(fe(!0),_e(st,{key:0},Qn(ee(t),(l,c,u,d)=>{const v=[l.id];if(d&&d.key===l.id&&Dr(d,v))return d;const p=(fe(),rt(ee(bd),{id:l.id,key:l.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=v,p},a,0),128)):ze("",!0)]))}}));function Id(){const{emits:e}=we();Xe(()=>{if(or()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ne(Se.MISSING_STYLES))}})}const kd=it("div",{class:"vue-flow__edge-labels"},null,-1),Pd={name:"VueFlow",compatConfig:{MODE:3}},Od=xe(ge(z({},Pd),{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:{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=Ir(),r=En(o,"modelValue",n),s=En(o,"nodes",n),a=En(o,"edges",n),l=we(o),c=sc({modelValue:r,nodes:s,edges:a},o,l);return lc(n,l.hooks),id(),Id(),yt(yn,i),li(()=>{c()}),t(l),(u,d)=>(fe(),_e("div",{ref:ee(l).vueFlowRef,class:"vue-flow"},[He(Qc,null,{default:Dn(()=>[He(_d),kd,He(Md),Ye(u.$slots,"zoom-pane")]),_:3}),Ye(u.$slots,"default"),He(od)],512))}})),Td={name:"Panel",compatConfig:{MODE:3}},zd=xe(ge(z({},Td),{props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=we(),o=oe(()=>`${t.position}`.split("-"));return(i,r)=>(fe(),_e("div",{class:ot(["vue-flow__panel",o.value]),style:Oe({pointerEvents:ee(n)?"none":"all"})},[Ye(i.$slots,"default")],6))}}));function Bd(e){const{type:t,id:n,nodeId:o,onConnect:i,onDisconnect:r}=e,{connectionLookup:s}=we(),a=lr(),l=ye(()=>{var p;return(p=ue(o))!=null?p:a}),c=ye(()=>ue(t)),u=ye(()=>{var p;return(p=ue(n))!=null?p:null}),d=pe(null),v=pe();return ve(()=>s.value.get(`${l.value}-${c.value}-${u.value}`),p=>{qu(v.value,p)||(v.value=p)},{immediate:!0}),ve([v,()=>typeof i!="undefined",()=>typeof r!="undefined"],([p=new Map])=>{d.value&&d.value!==p&&(Jo(d.value,p,r),Jo(p,d.value,i)),d.value=p},{immediate:!0}),oe(()=>v.value?Array.from(v.value.values()):[])}function Rd(e){const{findNode:t}=we();return oe({get(){const n=ue(e);if(!Array.isArray(n)){const i=t(n);return i?{id:i.id,type:i.type,data:i.data}:null}const o=[];for(const i of n){const r=t(i);r&&o.push({id:r.id,type:r.type,data:r.data})}return o},set(){Vt("You are trying to set node data via useNodesData. This is not supported.")}})}export{q as P,zd as _,Od as a,Bd as b,dn as c,Rd as d,xn as e,Ad as f,qn as g,we as u};