@stonecrop/node-editor 0.4.6 → 0.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,9 @@
1
- (function(Se,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(Se=typeof globalThis<"u"?globalThis:Se||self,l(Se["@stonecrop/node-editor"]={},Se.Vue))})(this,function(Se,l){"use strict";function ht(e){return l.getCurrentScope()?(l.onScopeDispose(e),!0):!1}function Ne(e){return typeof e=="function"?e():l.unref(e)}const ki=typeof window<"u"&&typeof document<"u",Mi=e=>typeof e<"u",Ii=Object.prototype.toString,Pi=e=>Ii.call(e)==="[object Object]",$i=()=>{};function Ti(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 Tn=e=>e();function Bi(e=Tn){const t=l.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:l.readonly(t),pause:n,resume:o,eventFilter:i}}function Bn(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Di(e,t,n={}){const{eventFilter:o=Tn,...i}=n;return l.watch(e,Ti(o,t),i)}function Ye(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:a,resume:s,isActive:u}=Bi(o);return{stop:Di(e,t,{...i,eventFilter:r}),pause:a,resume:s,isActive:u}}function Vi(e,t={}){if(!l.isRef(e))return l.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=l.customRef(()=>({get(){return e.value[o]},set(i){var r;if((r=Ne(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[o]=i,e.value=s}else{const s={...e.value,[o]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[o]=i}}));return n}function Ut(e,t=!1){function n(f,{flush:h="sync",deep:p=!1,timeout:E,throwOnTimeout:b}={}){let x=null;const M=[new Promise(_=>{x=l.watch(e,C=>{f(C)!==t&&(x==null||x(),_(C))},{flush:h,deep:p,immediate:!0})})];return E!=null&&M.push(Bn(E,b).then(()=>Ne(e)).finally(()=>x==null?void 0:x())),Promise.race(M)}function o(f,h){if(!l.isRef(f))return n(C=>C===f,h);const{flush:p="sync",deep:E=!1,timeout:b,throwOnTimeout:x}=h??{};let S=null;const _=[new Promise(C=>{S=l.watch([e,f],([z,X])=>{t!==(z===X)&&(S==null||S(),C(z))},{flush:p,deep:E,immediate:!0})})];return b!=null&&_.push(Bn(b,x).then(()=>Ne(e)).finally(()=>(S==null||S(),Ne(e)))),Promise.race(_)}function i(f){return n(h=>!!h,f)}function r(f){return o(null,f)}function a(f){return o(void 0,f)}function s(f){return n(Number.isNaN,f)}function u(f,h){return n(p=>{const E=Array.from(p);return E.includes(f)||E.includes(Ne(f))},h)}function d(f){return c(1,f)}function c(f=1,h){let p=-1;return n(()=>(p+=1,p>=f),h)}return Array.isArray(Ne(e))?{toMatch:n,toContains:u,changed:d,changedTimes:c,get not(){return Ut(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:a,changed:d,changedTimes:c,get not(){return Ut(e,!t)}}}function Zt(e){return Ut(e)}function Oi(e){var t;const n=Ne(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Dn=ki?window:void 0;function Vn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Dn):[t,n,o,i]=e,!t)return $i;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],a=()=>{r.forEach(c=>c()),r.length=0},s=(c,f,h,p)=>(c.addEventListener(f,h,p),()=>c.removeEventListener(f,h,p)),u=l.watch(()=>[Oi(t),Ne(i)],([c,f])=>{if(a(),!c)return;const h=Pi(f)?{...f}:f;r.push(...n.flatMap(p=>o.map(E=>s(c,p,E,h))))},{immediate:!0,flush:"post"}),d=()=>{u(),a()};return ht(d),d}function Ai(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function On(...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=Dn,eventName:r="keydown",passive:a=!1,dedupe:s=!1}=o,u=Ai(t);return Vn(i,r,c=>{c.repeat&&Ne(s)||u(c)&&n(c)},a)}function zi(e){return JSON.parse(JSON.stringify(e))}function Kt(e,t,n,o={}){var i,r,a;const{clone:s=!1,passive:u=!1,eventName:d,deep:c=!1,defaultValue:f,shouldEmit:h}=o,p=l.getCurrentInstance(),E=n||(p==null?void 0:p.emit)||((i=p==null?void 0:p.$emit)==null?void 0:i.bind(p))||((a=(r=p==null?void 0:p.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(p==null?void 0:p.proxy));let b=d;t||(t="modelValue"),b=b||`update:${t.toString()}`;const x=_=>s?typeof s=="function"?s(_):zi(_):_,S=()=>Mi(e[t])?x(e[t]):f,M=_=>{h?h(_)&&E(b,_):E(b,_)};if(u){const _=S(),C=l.ref(_);let z=!1;return l.watch(()=>e[t],X=>{z||(z=!0,C.value=x(X),l.nextTick(()=>z=!1))}),l.watch(C,X=>{!z&&(X!==e[t]||c)&&M(X)},{deep:c}),C}else return l.computed({get(){return S()},set(_){M(_)}})}var Ri={value:()=>{}};function gt(){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 pt(n)}function pt(e){this._=e}function Hi(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}})}pt.prototype=gt.prototype={constructor:pt,on:function(e,t){var n=this._,o=Hi(e+"",n),i,r=-1,a=o.length;if(arguments.length<2){for(;++r<a;)if((i=(e=o[r]).type)&&(i=Li(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<a;)if(i=(e=o[r]).type)n[i]=An(n[i],e.name,t);else if(t==null)for(i in n)n[i]=An(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 pt(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 Li(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function An(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Ri,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wt="http://www.w3.org/1999/xhtml";const zn={svg:"http://www.w3.org/2000/svg",xhtml:Wt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function mt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zn.hasOwnProperty(t)?{space:zn[t],local:e}:e}function Fi(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Wt&&t.documentElement.namespaceURI===Wt?t.createElement(e):t.createElementNS(n,e)}}function Yi(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Rn(e){var t=mt(e);return(t.local?Yi:Fi)(t)}function Gi(){}function qt(e){return e==null?Gi:function(){return this.querySelector(e)}}function Xi(e){typeof e!="function"&&(e=qt(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=new Array(a),u,d,c=0;c<a;++c)(u=r[c])&&(d=e.call(u,u.__data__,c,r))&&("__data__"in u&&(d.__data__=u.__data__),s[c]=d);return new me(o,this._parents)}function Ui(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Zi(){return[]}function Hn(e){return e==null?Zi:function(){return this.querySelectorAll(e)}}function Ki(e){return function(){return Ui(e.apply(this,arguments))}}function Wi(e){typeof e=="function"?e=Ki(e):e=Hn(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var a=t[r],s=a.length,u,d=0;d<s;++d)(u=a[d])&&(o.push(e.call(u,u.__data__,d,a)),i.push(u));return new me(o,i)}function Ln(e){return function(){return this.matches(e)}}function Fn(e){return function(t){return t.matches(e)}}var qi=Array.prototype.find;function Ji(e){return function(){return qi.call(this.children,e)}}function ji(){return this.firstElementChild}function Qi(e){return this.select(e==null?ji:Ji(typeof e=="function"?e:Fn(e)))}var er=Array.prototype.filter;function tr(){return Array.from(this.children)}function nr(e){return function(){return er.call(this.children,e)}}function or(e){return this.selectAll(e==null?tr:nr(typeof e=="function"?e:Fn(e)))}function ir(e){typeof e!="function"&&(e=Ln(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=[],u,d=0;d<a;++d)(u=r[d])&&e.call(u,u.__data__,d,r)&&s.push(u);return new me(o,this._parents)}function Yn(e){return new Array(e.length)}function rr(){return new me(this._enter||this._groups.map(Yn),this._parents)}function yt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}yt.prototype={constructor:yt,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 lr(e){return function(){return e}}function ar(e,t,n,o,i,r){for(var a=0,s,u=t.length,d=r.length;a<d;++a)(s=t[a])?(s.__data__=r[a],o[a]=s):n[a]=new yt(e,r[a]);for(;a<u;++a)(s=t[a])&&(i[a]=s)}function sr(e,t,n,o,i,r,a){var s,u,d=new Map,c=t.length,f=r.length,h=new Array(c),p;for(s=0;s<c;++s)(u=t[s])&&(h[s]=p=a.call(u,u.__data__,s,t)+"",d.has(p)?i[s]=u:d.set(p,u));for(s=0;s<f;++s)p=a.call(e,r[s],s,r)+"",(u=d.get(p))?(o[s]=u,u.__data__=r[s],d.delete(p)):n[s]=new yt(e,r[s]);for(s=0;s<c;++s)(u=t[s])&&d.get(h[s])===u&&(i[s]=u)}function ur(e){return e.__data__}function cr(e,t){if(!arguments.length)return Array.from(this,ur);var n=t?sr:ar,o=this._parents,i=this._groups;typeof e!="function"&&(e=lr(e));for(var r=i.length,a=new Array(r),s=new Array(r),u=new Array(r),d=0;d<r;++d){var c=o[d],f=i[d],h=f.length,p=dr(e.call(c,c&&c.__data__,d,o)),E=p.length,b=s[d]=new Array(E),x=a[d]=new Array(E),S=u[d]=new Array(h);n(c,f,b,x,S,p,t);for(var M=0,_=0,C,z;M<E;++M)if(C=b[M]){for(M>=_&&(_=M+1);!(z=x[_])&&++_<E;);C._next=z||null}}return a=new me(a,o),a._enter=s,a._exit=u,a}function dr(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fr(){return new me(this._exit||this._groups.map(Yn),this._parents)}function hr(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 gr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,a=Math.min(i,r),s=new Array(i),u=0;u<a;++u)for(var d=n[u],c=o[u],f=d.length,h=s[u]=new Array(f),p,E=0;E<f;++E)(p=d[E]||c[E])&&(h[E]=p);for(;u<i;++u)s[u]=n[u];return new me(s,this._parents)}function pr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],a;--i>=0;)(a=o[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function mr(e){e||(e=yr);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var a=n[r],s=a.length,u=i[r]=new Array(s),d,c=0;c<s;++c)(d=a[c])&&(u[c]=d);u.sort(t)}return new me(i,this._parents).order()}function yr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function vr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function wr(){return Array.from(this)}function _r(){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 a=o[i];if(a)return a}return null}function br(){let e=0;for(const t of this)++e;return e}function Er(){return!this.node()}function xr(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,a=i.length,s;r<a;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function Sr(e){return function(){this.removeAttribute(e)}}function Nr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Cr(e,t){return function(){this.setAttribute(e,t)}}function kr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Mr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ir(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 Pr(e,t){var n=mt(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?Nr:Sr:typeof t=="function"?n.local?Ir:Mr:n.local?kr:Cr)(n,t))}function Gn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function $r(e){return function(){this.style.removeProperty(e)}}function Tr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Br(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Dr(e,t,n){return arguments.length>1?this.each((t==null?$r:typeof t=="function"?Br:Tr)(e,t,n??"")):Ge(this.node(),e)}function Ge(e,t){return e.style.getPropertyValue(t)||Gn(e).getComputedStyle(e,null).getPropertyValue(t)}function Vr(e){return function(){delete this[e]}}function Or(e,t){return function(){this[e]=t}}function Ar(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function zr(e,t){return arguments.length>1?this.each((t==null?Vr:typeof t=="function"?Ar:Or)(e,t)):this.node()[e]}function Xn(e){return e.trim().split(/^|\s+/)}function Jt(e){return e.classList||new Un(e)}function Un(e){this._node=e,this._names=Xn(e.getAttribute("class")||"")}Un.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 Zn(e,t){for(var n=Jt(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function Kn(e,t){for(var n=Jt(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Rr(e){return function(){Zn(this,e)}}function Hr(e){return function(){Kn(this,e)}}function Lr(e,t){return function(){(t.apply(this,arguments)?Zn:Kn)(this,e)}}function Fr(e,t){var n=Xn(e+"");if(arguments.length<2){for(var o=Jt(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Lr:t?Rr:Hr)(n,t))}function Yr(){this.textContent=""}function Gr(e){return function(){this.textContent=e}}function Xr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ur(e){return arguments.length?this.each(e==null?Yr:(typeof e=="function"?Xr:Gr)(e)):this.node().textContent}function Zr(){this.innerHTML=""}function Kr(e){return function(){this.innerHTML=e}}function Wr(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function qr(e){return arguments.length?this.each(e==null?Zr:(typeof e=="function"?Wr:Kr)(e)):this.node().innerHTML}function Jr(){this.nextSibling&&this.parentNode.appendChild(this)}function jr(){return this.each(Jr)}function Qr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function el(){return this.each(Qr)}function tl(e){var t=typeof e=="function"?e:Rn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function nl(){return null}function ol(e,t){var n=typeof e=="function"?e:Rn(e),o=t==null?nl:typeof t=="function"?t:qt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function il(){var e=this.parentNode;e&&e.removeChild(this)}function rl(){return this.each(il)}function ll(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function al(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sl(e){return this.select(e?al:ll)}function ul(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cl(e){return function(t){e.call(this,t,this.__data__)}}function dl(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 fl(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 hl(e,t,n){return function(){var o=this.__on,i,r=cl(t);if(o){for(var a=0,s=o.length;a<s;++a)if((i=o[a]).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 gl(e,t,n){var o=dl(e+""),i,r=o.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,d=s.length,c;u<d;++u)for(i=0,c=s[u];i<r;++i)if((a=o[i]).type===c.type&&a.name===c.name)return c.value}return}for(s=t?hl:fl,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function Wn(e,t,n){var o=Gn(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 pl(e,t){return function(){return Wn(this,e,t)}}function ml(e,t){return function(){return Wn(this,e,t.apply(this,arguments))}}function yl(e,t){return this.each((typeof t=="function"?ml:pl)(e,t))}function*vl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,a;i<r;++i)(a=o[i])&&(yield a)}var qn=[null];function me(e,t){this._groups=e,this._parents=t}function Je(){return new me([[document.documentElement]],qn)}function wl(){return this}me.prototype=Je.prototype={constructor:me,select:Xi,selectAll:Wi,selectChild:Qi,selectChildren:or,filter:ir,data:cr,enter:rr,exit:fr,join:hr,merge:gr,selection:wl,order:pr,sort:mr,call:vr,nodes:wr,node:_r,size:br,empty:Er,each:xr,attr:Pr,style:Dr,property:zr,classed:Fr,text:Ur,html:qr,raise:jr,lower:el,append:tl,insert:ol,remove:rl,clone:sl,datum:ul,on:gl,dispatch:yl,[Symbol.iterator]:vl};function ye(e){return typeof e=="string"?new me([[document.querySelector(e)]],[document.documentElement]):new me([[e]],qn)}function _l(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=_l(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 bl={passive:!1},je={capture:!0,passive:!1};function jt(e){e.stopImmediatePropagation()}function Xe(e){e.preventDefault(),e.stopImmediatePropagation()}function Jn(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Xe,je);"onselectstart"in t?n.on("selectstart.drag",Xe,je):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function jn(e,t){var n=e.document.documentElement,o=ye(e).on("dragstart.drag",null);t&&(o.on("click.drag",Xe,je),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 vt=e=>()=>e;function Qt(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:a,y:s,dx:u,dy:d,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:c}})}Qt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function El(e){return!e.ctrlKey&&!e.button}function xl(){return this.parentNode}function Sl(e,t){return t??{x:e.x,y:e.y}}function Nl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cl(){var e=El,t=xl,n=Sl,o=Nl,i={},r=gt("start","drag","end"),a=0,s,u,d,c,f=0;function h(C){C.on("mousedown.drag",p).filter(o).on("touchstart.drag",x).on("touchmove.drag",S,bl).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(C,z){if(!(c||!e.call(this,C,z))){var X=_(this,t.call(this,C,z),C,z,"mouse");X&&(ye(C.view).on("mousemove.drag",E,je).on("mouseup.drag",b,je),Jn(C.view),jt(C),d=!1,s=C.clientX,u=C.clientY,X("start",C))}}function E(C){if(Xe(C),!d){var z=C.clientX-s,X=C.clientY-u;d=z*z+X*X>f}i.mouse("drag",C)}function b(C){ye(C.view).on("mousemove.drag mouseup.drag",null),jn(C.view,d),Xe(C),i.mouse("end",C)}function x(C,z){if(e.call(this,C,z)){var X=C.changedTouches,F=t.call(this,C,z),T=X.length,D,$;for(D=0;D<T;++D)($=_(this,F,C,z,X[D].identifier,X[D]))&&(jt(C),$("start",C,X[D]))}}function S(C){var z=C.changedTouches,X=z.length,F,T;for(F=0;F<X;++F)(T=i[z[F].identifier])&&(Xe(C),T("drag",C,z[F]))}function M(C){var z=C.changedTouches,X=z.length,F,T;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),F=0;F<X;++F)(T=i[z[F].identifier])&&(jt(C),T("end",C,z[F]))}function _(C,z,X,F,T,D){var $=r.copy(),O=_e(D||X,z),N,Q,w;if((w=n.call(C,new Qt("beforestart",{sourceEvent:X,target:h,identifier:T,active:a,x:O[0],y:O[1],dx:0,dy:0,dispatch:$}),F))!=null)return N=w.x-O[0]||0,Q=w.y-O[1]||0,function I(k,B,V){var A=O,R;switch(k){case"start":i[T]=I,R=a++;break;case"end":delete i[T],--a;case"drag":O=_e(V||B,z),R=a;break}$.call(k,C,new Qt(k,{sourceEvent:B,subject:w,target:h,identifier:T,active:R,x:O[0]+N,y:O[1]+Q,dx:O[0]-A[0],dy:O[1]-A[1],dispatch:$}),F)}}return h.filter=function(C){return arguments.length?(e=typeof C=="function"?C:vt(!!C),h):e},h.container=function(C){return arguments.length?(t=typeof C=="function"?C:vt(C),h):t},h.subject=function(C){return arguments.length?(n=typeof C=="function"?C:vt(C),h):n},h.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:vt(!!C),h):o},h.on=function(){var C=r.on.apply(r,arguments);return C===r?h:C},h.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,h):Math.sqrt(f)},h}function en(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Qn(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Qe(){}var et=.7,wt=1/et,Ue="\\s*([+-]?\\d+)\\s*",tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kl=/^#([0-9a-f]{3,8})$/,Ml=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),Il=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Pl=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${tt}\\)$`),$l=new RegExp(`^rgba\\(${be},${be},${be},${tt}\\)$`),Tl=new RegExp(`^hsl\\(${tt},${be},${be}\\)$`),Bl=new RegExp(`^hsla\\(${tt},${be},${be},${tt}\\)$`),eo={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};en(Qe,nt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:to,formatHex:to,formatHex8:Dl,formatHsl:Vl,formatRgb:no,toString:no});function to(){return this.rgb().formatHex()}function Dl(){return this.rgb().formatHex8()}function Vl(){return ao(this).formatHsl()}function no(){return this.rgb().formatRgb()}function nt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?oo(t):n===3?new pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?_t(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?_t(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=Ml.exec(e))?new pe(t[1],t[2],t[3],1):(t=Il.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Pl.exec(e))?_t(t[1],t[2],t[3],t[4]):(t=$l.exec(e))?_t(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Tl.exec(e))?lo(t[1],t[2]/100,t[3]/100,1):(t=Bl.exec(e))?lo(t[1],t[2]/100,t[3]/100,t[4]):eo.hasOwnProperty(e)?oo(eo[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function oo(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function _t(e,t,n,o){return o<=0&&(e=t=n=NaN),new pe(e,t,n,o)}function Ol(e){return e instanceof Qe||(e=nt(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function tn(e,t,n,o){return arguments.length===1?Ol(e):new pe(e,t,n,o??1)}function pe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}en(pe,tn,Qn(Qe,{brighter(e){return e=e==null?wt:Math.pow(wt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?et:Math.pow(et,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(Ve(this.r),Ve(this.g),Ve(this.b),bt(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:io,formatHex:io,formatHex8:Al,formatRgb:ro,toString:ro}));function io(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}`}function Al(){return`#${Oe(this.r)}${Oe(this.g)}${Oe(this.b)}${Oe((isNaN(this.opacity)?1:this.opacity)*255)}`}function ro(){const e=bt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oe(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function lo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ve(e,t,n,o)}function ao(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof Qe||(e=nt(e)),!e)return new ve;if(e instanceof ve)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),a=NaN,s=r-i,u=(r+i)/2;return s?(t===r?a=(n-o)/s+(n<o)*6:n===r?a=(o-t)/s+2:a=(t-n)/s+4,s/=u<.5?r+i:2-r-i,a*=60):s=u>0&&u<1?0:a,new ve(a,s,u,e.opacity)}function zl(e,t,n,o){return arguments.length===1?ao(e):new ve(e,t,n,o??1)}function ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}en(ve,zl,Qn(Qe,{brighter(e){return e=e==null?wt:Math.pow(wt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?et:Math.pow(et,e),new ve(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 pe(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 ve(so(this.h),Et(this.s),Et(this.l),bt(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=bt(this.opacity);return`${e===1?"hsl(":"hsla("}${so(this.h)}, ${Et(this.s)*100}%, ${Et(this.l)*100}%${e===1?")":`, ${e})`}`}}));function so(e){return e=(e||0)%360,e<0?e+360:e}function Et(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 uo=e=>()=>e;function Rl(e,t){return function(n){return e+n*t}}function Hl(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 Ll(e){return(e=+e)==1?co:function(t,n){return n-t?Hl(t,n,e):uo(isNaN(t)?n:t)}}function co(e,t){var n=t-e;return n?Rl(e,n):uo(isNaN(e)?t:e)}const fo=function e(t){var n=Ll(t);function o(i,r){var a=n((i=tn(i)).r,(r=tn(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),d=co(i.opacity,r.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=u(c),i.opacity=d(c),i+""}}return o.gamma=e,o}(1);function Ie(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var on=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rn=new RegExp(on.source,"g");function Fl(e){return function(){return e}}function Yl(e){return function(t){return e(t)+""}}function Gl(e,t){var n=on.lastIndex=rn.lastIndex=0,o,i,r,a=-1,s=[],u=[];for(e=e+"",t=t+"";(o=on.exec(e))&&(i=rn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[a]?s[a]+=r:s[++a]=r),(o=o[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:Ie(o,i)})),n=rn.lastIndex;return n<t.length&&(r=t.slice(n),s[a]?s[a]+=r:s[++a]=r),s.length<2?u[0]?Yl(u[0].x):Fl(t):(t=u.length,function(d){for(var c=0,f;c<t;++c)s[(f=u[c]).i]=f.x(d);return s.join("")})}var ho=180/Math.PI,ln={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function go(e,t,n,o,i,r){var a,s,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*ho,skewX:Math.atan(u)*ho,scaleX:a,scaleY:s}}var xt;function Xl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ln:go(t.a,t.b,t.c,t.d,t.e,t.f)}function Ul(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,go(e.a,e.b,e.c,e.d,e.e,e.f))}function po(e,t,n,o){function i(d){return d.length?d.pop()+" ":""}function r(d,c,f,h,p,E){if(d!==f||c!==h){var b=p.push("translate(",null,t,null,n);E.push({i:b-4,x:Ie(d,f)},{i:b-2,x:Ie(c,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function a(d,c,f,h){d!==c?(d-c>180?c+=360:c-d>180&&(d+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:Ie(d,c)})):c&&f.push(i(f)+"rotate("+c+o)}function s(d,c,f,h){d!==c?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:Ie(d,c)}):c&&f.push(i(f)+"skewX("+c+o)}function u(d,c,f,h,p,E){if(d!==f||c!==h){var b=p.push(i(p)+"scale(",null,",",null,")");E.push({i:b-4,x:Ie(d,f)},{i:b-2,x:Ie(c,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(d,c){var f=[],h=[];return d=e(d),c=e(c),r(d.translateX,d.translateY,c.translateX,c.translateY,f,h),a(d.rotate,c.rotate,f,h),s(d.skewX,c.skewX,f,h),u(d.scaleX,d.scaleY,c.scaleX,c.scaleY,f,h),d=c=null,function(p){for(var E=-1,b=h.length,x;++E<b;)f[(x=h[E]).i]=x.x(p);return f.join("")}}}var Zl=po(Xl,"px, ","px)","deg)"),Kl=po(Ul,", ",")",")"),Wl=1e-12;function mo(e){return((e=Math.exp(e))+1/e)/2}function ql(e){return((e=Math.exp(e))-1/e)/2}function Jl(e){return((e=Math.exp(2*e))-1)/(e+1)}const jl=function e(t,n,o){function i(r,a){var s=r[0],u=r[1],d=r[2],c=a[0],f=a[1],h=a[2],p=c-s,E=f-u,b=p*p+E*E,x,S;if(b<Wl)S=Math.log(h/d)/t,x=function(F){return[s+F*p,u+F*E,d*Math.exp(t*F*S)]};else{var M=Math.sqrt(b),_=(h*h-d*d+o*b)/(2*d*n*M),C=(h*h-d*d-o*b)/(2*h*n*M),z=Math.log(Math.sqrt(_*_+1)-_),X=Math.log(Math.sqrt(C*C+1)-C);S=(X-z)/t,x=function(F){var T=F*S,D=mo(z),$=d/(n*M)*(D*Jl(t*T+z)-ql(z));return[s+$*p,u+$*E,d*D/mo(t*T+z)]}}return x.duration=S*1e3*t/Math.SQRT2,x}return i.rho=function(r){var a=Math.max(.001,+r),s=a*a,u=s*s;return e(a,s,u)},i}(Math.SQRT2,2,4);var Ze=0,ot=0,it=0,yo=1e3,St,rt,Nt=0,Ae=0,Ct=0,lt=typeof performance=="object"&&performance.now?performance:Date,vo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function an(){return Ae||(vo(Ql),Ae=lt.now()+Ct)}function Ql(){Ae=0}function kt(){this._call=this._time=this._next=null}kt.prototype=wo.prototype={constructor:kt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?an():+n)+(t==null?0:+t),!this._next&&rt!==this&&(rt?rt._next=this:St=this,rt=this),this._call=e,this._time=n,sn()},stop:function(){this._call&&(this._call=null,this._time=1/0,sn())}};function wo(e,t,n){var o=new kt;return o.restart(e,t,n),o}function ea(){an(),++Ze;for(var e=St,t;e;)(t=Ae-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ze}function _o(){Ae=(Nt=lt.now())+Ct,Ze=ot=0;try{ea()}finally{Ze=0,na(),Ae=0}}function ta(){var e=lt.now(),t=e-Nt;t>yo&&(Ct-=t,Nt=e)}function na(){for(var e,t=St,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:St=n);rt=e,sn(o)}function sn(e){if(!Ze){ot&&(ot=clearTimeout(ot));var t=e-Ae;t>24?(e<1/0&&(ot=setTimeout(_o,e-lt.now()-Ct)),it&&(it=clearInterval(it))):(it||(Nt=lt.now(),it=setInterval(ta,yo)),Ze=1,vo(_o))}}function bo(e,t,n){var o=new kt;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var oa=gt("start","end","cancel","interrupt"),ia=[],Eo=0,xo=1,un=2,Mt=3,So=4,cn=5,It=6;function Pt(e,t,n,o,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;ra(e,n,{name:t,index:o,group:i,on:oa,tween:ia,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Eo})}function dn(e,t){var n=we(e,t);if(n.state>Eo)throw new Error("too late; already scheduled");return n}function Ee(e,t){var n=we(e,t);if(n.state>Mt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ra(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=wo(r,0,n.time);function r(d){n.state=xo,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var c,f,h,p;if(n.state!==xo)return u();for(c in o)if(p=o[c],p.name===n.name){if(p.state===Mt)return bo(a);p.state===So?(p.state=It,p.timer.stop(),p.on.call("interrupt",e,e.__data__,p.index,p.group),delete o[c]):+c<t&&(p.state=It,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[c])}if(bo(function(){n.state===Mt&&(n.state=So,n.timer.restart(s,n.delay,n.time),s(d))}),n.state=un,n.on.call("start",e,e.__data__,n.index,n.group),n.state===un){for(n.state=Mt,i=new Array(h=n.tween.length),c=0,f=-1;c<h;++c)(p=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);i.length=f+1}}function s(d){for(var c=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(u),n.state=cn,1),f=-1,h=i.length;++f<h;)i[f].call(e,c);n.state===cn&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=It,n.timer.stop(),delete o[t];for(var d in o)return;delete e.__transition}}function $t(e,t){var n=e.__transition,o,i,r=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((o=n[a]).name!==t){r=!1;continue}i=o.state>un&&o.state<cn,o.state=It,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[a]}r&&delete e.__transition}}function la(e){return this.each(function(){$t(this,e)})}function aa(e,t){var n,o;return function(){var i=Ee(this,e),r=i.tween;if(r!==n){o=n=r;for(var a=0,s=o.length;a<s;++a)if(o[a].name===t){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function sa(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=Ee(this,e),a=r.tween;if(a!==o){i=(o=a).slice();for(var s={name:t,value:n},u=0,d=i.length;u<d;++u)if(i[u].name===t){i[u]=s;break}u===d&&i.push(s)}r.tween=i}}function ua(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,i=0,r=o.length,a;i<r;++i)if((a=o[i]).name===e)return a.value;return null}return this.each((t==null?aa:sa)(n,e,t))}function fn(e,t,n){var o=e._id;return e.each(function(){var i=Ee(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,o).value[t]}}function No(e,t){var n;return(typeof t=="number"?Ie:t instanceof nt?fo:(n=nt(t))?(t=n,fo):Gl)(e,t)}function ca(e){return function(){this.removeAttribute(e)}}function da(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fa(e,t,n){var o,i=n+"",r;return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function ha(e,t,n){var o,i=n+"",r;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function ga(e,t,n){var o,i,r;return function(){var a,s=n(this),u;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=s+"",a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s)))}}function pa(e,t,n){var o,i,r;return function(){var a,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=s+"",a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s)))}}function ma(e,t){var n=mt(e),o=n==="transform"?Kl:No;return this.attrTween(e,typeof t=="function"?(n.local?pa:ga)(n,o,fn(this,"attr."+e,t)):t==null?(n.local?da:ca)(n):(n.local?ha:fa)(n,o,t))}function ya(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function va(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function wa(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&va(e,r)),n}return i._value=t,i}function _a(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&ya(e,r)),n}return i._value=t,i}function ba(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=mt(e);return this.tween(n,(o.local?wa:_a)(o,t))}function Ea(e,t){return function(){dn(this,e).delay=+t.apply(this,arguments)}}function xa(e,t){return t=+t,function(){dn(this,e).delay=t}}function Sa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ea:xa)(t,e)):we(this.node(),t).delay}function Na(e,t){return function(){Ee(this,e).duration=+t.apply(this,arguments)}}function Ca(e,t){return t=+t,function(){Ee(this,e).duration=t}}function ka(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Na:Ca)(t,e)):we(this.node(),t).duration}function Ma(e,t){if(typeof t!="function")throw new Error;return function(){Ee(this,e).ease=t}}function Ia(e){var t=this._id;return arguments.length?this.each(Ma(t,e)):we(this.node(),t).ease}function Pa(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ee(this,e).ease=n}}function $a(e){if(typeof e!="function")throw new Error;return this.each(Pa(this._id,e))}function Ta(e){typeof e!="function"&&(e=Ln(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=[],u,d=0;d<a;++d)(u=r[d])&&e.call(u,u.__data__,d,r)&&s.push(u);return new Ce(o,this._parents,this._name,this._id)}function Ba(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),a=new Array(o),s=0;s<r;++s)for(var u=t[s],d=n[s],c=u.length,f=a[s]=new Array(c),h,p=0;p<c;++p)(h=u[p]||d[p])&&(f[p]=h);for(;s<o;++s)a[s]=t[s];return new Ce(a,this._parents,this._name,this._id)}function Da(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 Va(e,t,n){var o,i,r=Da(t)?dn:Ee;return function(){var a=r(this,e),s=a.on;s!==o&&(i=(o=s).copy()).on(t,n),a.on=i}}function Oa(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Va(n,e,t))}function Aa(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function za(){return this.on("end.remove",Aa(this._id))}function Ra(e){var t=this._name,n=this._id;typeof e!="function"&&(e=qt(e));for(var o=this._groups,i=o.length,r=new Array(i),a=0;a<i;++a)for(var s=o[a],u=s.length,d=r[a]=new Array(u),c,f,h=0;h<u;++h)(c=s[h])&&(f=e.call(c,c.__data__,h,s))&&("__data__"in c&&(f.__data__=c.__data__),d[h]=f,Pt(d[h],t,n,h,d,we(c,n)));return new Ce(r,this._parents,t,n)}function Ha(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Hn(e));for(var o=this._groups,i=o.length,r=[],a=[],s=0;s<i;++s)for(var u=o[s],d=u.length,c,f=0;f<d;++f)if(c=u[f]){for(var h=e.call(c,c.__data__,f,u),p,E=we(c,n),b=0,x=h.length;b<x;++b)(p=h[b])&&Pt(p,t,n,b,h,E);r.push(h),a.push(c)}return new Ce(r,a,t,n)}var La=Je.prototype.constructor;function Fa(){return new La(this._groups,this._parents)}function Ya(e,t){var n,o,i;return function(){var r=Ge(this,e),a=(this.style.removeProperty(e),Ge(this,e));return r===a?null:r===n&&a===o?i:i=t(n=r,o=a)}}function Co(e){return function(){this.style.removeProperty(e)}}function Ga(e,t,n){var o,i=n+"",r;return function(){var a=Ge(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}function Xa(e,t,n){var o,i,r;return function(){var a=Ge(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Ge(this,e))),a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s))}}function Ua(e,t){var n,o,i,r="style."+t,a="end."+r,s;return function(){var u=Ee(this,e),d=u.on,c=u.value[r]==null?s||(s=Co(t)):void 0;(d!==n||i!==c)&&(o=(n=d).copy()).on(a,i=c),u.on=o}}function Za(e,t,n){var o=(e+="")=="transform"?Zl:No;return t==null?this.styleTween(e,Ya(e,o)).on("end.style."+e,Co(e)):typeof t=="function"?this.styleTween(e,Xa(e,o,fn(this,"style."+e,t))).each(Ua(this._id,e)):this.styleTween(e,Ga(e,o,t),n).on("end.style."+e,null)}function Ka(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Wa(e,t,n){var o,i;function r(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&Ka(e,a,n)),o}return r._value=t,r}function qa(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,Wa(e,t,n??""))}function Ja(e){return function(){this.textContent=e}}function ja(e){return function(){var t=e(this);this.textContent=t??""}}function Qa(e){return this.tween("text",typeof e=="function"?ja(fn(this,"text",e)):Ja(e==null?"":e+""))}function es(e){return function(t){this.textContent=e.call(this,t)}}function ts(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&es(i)),t}return o._value=e,o}function ns(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,ts(e))}function os(){for(var e=this._name,t=this._id,n=ko(),o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],s=a.length,u,d=0;d<s;++d)if(u=a[d]){var c=we(u,t);Pt(u,e,n,d,a,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Ce(o,this._parents,e,n)}function is(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,a){var s={value:a},u={value:function(){--i===0&&r()}};n.each(function(){var d=Ee(this,o),c=d.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),d.on=t}),i===0&&r()})}var rs=0;function Ce(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function ko(){return++rs}var ke=Je.prototype;Ce.prototype={constructor:Ce,select:Ra,selectAll:Ha,selectChild:ke.selectChild,selectChildren:ke.selectChildren,filter:Ta,merge:Ba,selection:Fa,transition:os,call:ke.call,nodes:ke.nodes,node:ke.node,size:ke.size,empty:ke.empty,each:ke.each,on:Oa,attr:ma,attrTween:ba,style:Za,styleTween:qa,text:Qa,textTween:ns,remove:za,tween:ua,delay:Sa,duration:ka,ease:Ia,easeVarying:$a,end:is,[Symbol.iterator]:ke[Symbol.iterator]};function ls(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var as={time:null,delay:0,duration:250,ease:ls};function ss(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 us(e){var t,n;e instanceof Ce?(t=e._id,e=e._name):(t=ko(),(n=as).time=an(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],s=a.length,u,d=0;d<s;++d)(u=a[d])&&Pt(u,e,t,d,a,n||ss(u,t));return new Ce(o,this._parents,e,t)}Je.prototype.interrupt=la,Je.prototype.transition=us;const Tt=e=>()=>e;function cs(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 Me(e,t,n){this.k=e,this.x=t,this.y=n}Me.prototype={constructor:Me,scale:function(e){return e===1?this:new Me(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Me(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 Ke=new Me(1,0,0);Me.prototype;function hn(e){e.stopImmediatePropagation()}function at(e){e.preventDefault(),e.stopImmediatePropagation()}function ds(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fs(){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 Mo(){return this.__zoom||Ke}function hs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gs(){return navigator.maxTouchPoints||"ontouchstart"in this}function ps(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],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function ms(){var e=ds,t=fs,n=ps,o=hs,i=gs,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=jl,d=gt("start","zoom","end"),c,f,h,p=500,E=150,b=0,x=10;function S(w){w.property("__zoom",Mo).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",$).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(w,I,k,B){var V=w.selection?w.selection():w;V.property("__zoom",Mo),w!==V?z(w,I,k,B):V.interrupt().each(function(){X(this,arguments).event(B).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},S.scaleBy=function(w,I,k,B){S.scaleTo(w,function(){var V=this.__zoom.k,A=typeof I=="function"?I.apply(this,arguments):I;return V*A},k,B)},S.scaleTo=function(w,I,k,B){S.transform(w,function(){var V=t.apply(this,arguments),A=this.__zoom,R=k==null?C(V):typeof k=="function"?k.apply(this,arguments):k,U=A.invert(R),j=typeof I=="function"?I.apply(this,arguments):I;return n(_(M(A,j),R,U),V,a)},k,B)},S.translateBy=function(w,I,k,B){S.transform(w,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),a)},null,B)},S.translateTo=function(w,I,k,B,V){S.transform(w,function(){var A=t.apply(this,arguments),R=this.__zoom,U=B==null?C(A):typeof B=="function"?B.apply(this,arguments):B;return n(Ke.translate(U[0],U[1]).scale(R.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof k=="function"?-k.apply(this,arguments):-k),A,a)},B,V)};function M(w,I){return I=Math.max(r[0],Math.min(r[1],I)),I===w.k?w:new Me(I,w.x,w.y)}function _(w,I,k){var B=I[0]-k[0]*w.k,V=I[1]-k[1]*w.k;return B===w.x&&V===w.y?w:new Me(w.k,B,V)}function C(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function z(w,I,k,B){w.on("start.zoom",function(){X(this,arguments).event(B).start()}).on("interrupt.zoom end.zoom",function(){X(this,arguments).event(B).end()}).tween("zoom",function(){var V=this,A=arguments,R=X(V,A).event(B),U=t.apply(V,A),j=k==null?C(U):typeof k=="function"?k.apply(V,A):k,G=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),H=V.__zoom,q=typeof I=="function"?I.apply(V,A):I,le=u(H.invert(j).concat(G/H.k),q.invert(j).concat(G/q.k));return function(ie){if(ie===1)ie=q;else{var ae=le(ie),te=G/ae[2];ie=new Me(te,j[0]-ae[0]*te,j[1]-ae[1]*te)}R.zoom(null,ie)}})}function X(w,I,k){return!k&&w.__zooming||new F(w,I)}function F(w,I){this.that=w,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,I),this.taps=0}F.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,I){return this.mouse&&w!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var I=ye(this.that).datum();d.call(w,this.that,new cs(w,{sourceEvent:this.sourceEvent,target:S,type:w,transform:this.that.__zoom,dispatch:d}),I)}};function T(w,...I){if(!e.apply(this,arguments))return;var k=X(this,I).event(w),B=this.__zoom,V=Math.max(r[0],Math.min(r[1],B.k*Math.pow(2,o.apply(this,arguments)))),A=_e(w);if(k.wheel)(k.mouse[0][0]!==A[0]||k.mouse[0][1]!==A[1])&&(k.mouse[1]=B.invert(k.mouse[0]=A)),clearTimeout(k.wheel);else{if(B.k===V)return;k.mouse=[A,B.invert(A)],$t(this),k.start()}at(w),k.wheel=setTimeout(R,E),k.zoom("mouse",n(_(M(B,V),k.mouse[0],k.mouse[1]),k.extent,a));function R(){k.wheel=null,k.end()}}function D(w,...I){if(h||!e.apply(this,arguments))return;var k=w.currentTarget,B=X(this,I,!0).event(w),V=ye(w.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",G,!0),A=_e(w,k),R=w.clientX,U=w.clientY;Jn(w.view),hn(w),B.mouse=[A,this.__zoom.invert(A)],$t(this),B.start();function j(H){if(at(H),!B.moved){var q=H.clientX-R,le=H.clientY-U;B.moved=q*q+le*le>b}B.event(H).zoom("mouse",n(_(B.that.__zoom,B.mouse[0]=_e(H,k),B.mouse[1]),B.extent,a))}function G(H){V.on("mousemove.zoom mouseup.zoom",null),jn(H.view,B.moved),at(H),B.event(H).end()}}function $(w,...I){if(e.apply(this,arguments)){var k=this.__zoom,B=_e(w.changedTouches?w.changedTouches[0]:w,this),V=k.invert(B),A=k.k*(w.shiftKey?.5:2),R=n(_(M(k,A),B,V),t.apply(this,I),a);at(w),s>0?ye(this).transition().duration(s).call(z,R,B,w):ye(this).call(S.transform,R,B,w)}}function O(w,...I){if(e.apply(this,arguments)){var k=w.touches,B=k.length,V=X(this,I,w.changedTouches.length===B).event(w),A,R,U,j;for(hn(w),R=0;R<B;++R)U=k[R],j=_e(U,this),j=[j,this.__zoom.invert(j),U.identifier],V.touch0?!V.touch1&&V.touch0[2]!==j[2]&&(V.touch1=j,V.taps=0):(V.touch0=j,A=!0,V.taps=1+!!c);c&&(c=clearTimeout(c)),A&&(V.taps<2&&(f=j[0],c=setTimeout(function(){c=null},p)),$t(this),V.start())}}function N(w,...I){if(this.__zooming){var k=X(this,I).event(w),B=w.changedTouches,V=B.length,A,R,U,j;for(at(w),A=0;A<V;++A)R=B[A],U=_e(R,this),k.touch0&&k.touch0[2]===R.identifier?k.touch0[0]=U:k.touch1&&k.touch1[2]===R.identifier&&(k.touch1[0]=U);if(R=k.that.__zoom,k.touch1){var G=k.touch0[0],H=k.touch0[1],q=k.touch1[0],le=k.touch1[1],ie=(ie=q[0]-G[0])*ie+(ie=q[1]-G[1])*ie,ae=(ae=le[0]-H[0])*ae+(ae=le[1]-H[1])*ae;R=M(R,Math.sqrt(ie/ae)),U=[(G[0]+q[0])/2,(G[1]+q[1])/2],j=[(H[0]+le[0])/2,(H[1]+le[1])/2]}else if(k.touch0)U=k.touch0[0],j=k.touch0[1];else return;k.zoom("touch",n(_(R,U,j),k.extent,a))}}function Q(w,...I){if(this.__zooming){var k=X(this,I).event(w),B=w.changedTouches,V=B.length,A,R;for(hn(w),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),A=0;A<V;++A)R=B[A],k.touch0&&k.touch0[2]===R.identifier?delete k.touch0:k.touch1&&k.touch1[2]===R.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(R=_e(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<x)){var U=ye(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return S.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:Tt(+w),S):o},S.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Tt(!!w),S):e},S.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Tt(!!w),S):i},S.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Tt([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),S):t},S.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],S):[r[0],r[1]]},S.translateExtent=function(w){return arguments.length?(a[0][0]=+w[0][0],a[1][0]=+w[1][0],a[0][1]=+w[0][1],a[1][1]=+w[1][1],S):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},S.constrain=function(w){return arguments.length?(n=w,S):n},S.duration=function(w){return arguments.length?(s=+w,S):s},S.interpolate=function(w){return arguments.length?(u=w,S):u},S.on=function(){var w=d.on.apply(d,arguments);return w===d?S:w},S.clickDistance=function(w){return arguments.length?(b=(w=+w)*w,S):Math.sqrt(b)},S.tapDistance=function(w){return arguments.length?(x=+w,S):x},S}var Y=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(Y||{}),gn=(e=>(e.Partial="partial",e.Full="full",e))(gn||{}),ze=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ze||{}),Re=(e=>(e.Strict="strict",e.Loose="loose",e))(Re||{}),pn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(pn||{}),st=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(st||{});function mn(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 ys(e){return e.ctrlKey||e.metaKey||e.shiftKey}function Io(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,a)=>n.has(r)&&Array.from(n.values())[a]===i[a]))}function vs(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=ws(n.code,e);return Array.isArray(e)?e.some(i=>Io(n[o],i,t,n.type==="keyup")):Io(n[o],e,t,n.type==="keyup")}}function ws(e,t){return typeof t=="string"?e===t?"code":"key":t.includes(e)?"code":"key"}function ut(e,t){const n=l.toRef(()=>l.toValue(t==null?void 0:t.actInsideInputWithModifier)??!1),o=l.toRef(()=>l.toValue(t==null?void 0:t.target)??window),i=l.ref(l.toValue(e)===!0);let r=!1;const a=new Set;let s=d(l.toValue(e));l.watch(()=>l.toValue(e),(c,f)=>{typeof f=="boolean"&&typeof c!="boolean"&&u(),s=d(c)},{immediate:!0}),l.onMounted(()=>{Vn(window,["blur","contextmenu"],u)}),On((...c)=>s(...c),c=>{r=ys(c),!((!r||r&&!n.value)&&mn(c))&&(c.preventDefault(),i.value=!0)},{eventName:"keydown",target:o}),On((...c)=>s(...c),c=>{if(i.value){if((!r||r&&!n.value)&&mn(c))return;u()}},{eventName:"keyup",target:o});function u(){r=!1,a.clear(),i.value=!1}function d(c){return c===null?(u(),()=>!1):typeof c=="boolean"?(u(),i.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?vs(c,a):c}return i}const Po="vue-flow__node-desc",$o="vue-flow__edge-desc",_s="vue-flow__aria-live",To=["Enter"," ","Escape"],We={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function yn(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function vn(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 Bt(e){return{width:e.offsetWidth,height:e.offsetHeight}}function He(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Bo(e,t){return{x:He(e.x,t[0][0],t[1][0]),y:He(e.y,t[0][1],t[1][1])}}function Do(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Pe(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Le(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Pe(e)}function ct(e){return Le(e)&&"computedPosition"in e}function Dt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function bs(e){return Dt(e.width)&&Dt(e.height)&&Dt(e.x)&&Dt(e.y)}function Es(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:l.markRaw({width:0,height:0}),computedPosition:l.markRaw({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:he(e.data)?e.data:{},events:l.markRaw(he(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Vo(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??(n==null?void 0:n.updatable),selectable:e.selectable??(n==null?void 0:n.selectable),focusable:e.focusable??(n==null?void 0:n.focusable),data:he(e.data)?e.data:{},events:l.markRaw(he(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(n==null?void 0:n.interactionWidth),...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Oo(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,a=o==="source"?"target":"source";for(const s of n)s[a]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function xs(...e){if(e.length===3){const[r,a,s]=e;return Oo(r,a,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Pe(r)&&r.source===o).map(r=>n.find(a=>Le(a)&&a.id===r.target))}function Ss(...e){if(e.length===3){const[r,a,s]=e;return Oo(r,a,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Pe(r)&&r.target===o).map(r=>n.find(a=>Le(a)&&a.id===r.source))}function Ao({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Ns(e,t){return t.some(n=>Pe(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 zo({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function Vt({x:e,y:t},{x:n,y:o,zoom:i},r=!1,[a,s]=[1,1]){const u={x:(e-n)/i,y:(t-o)/i};return r?{x:a*Math.round(u.x/a),y:s*Math.round(u.y/s)}:u}function Cs(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 Ro({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function ks({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Ho(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=Cs(t,Ro({...o.computedPosition,...o.dimensions}))}return ks(t)}function Lo(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...Vt(t,n),width:t.width/n.zoom,height:t.height/n.zoom},a=[];for(const s of e){const{dimensions:u,selectable:d=!0,hidden:c=!1}=s,f=u.width??s.width??null,h=u.height??s.height??null;if(i&&!d||c)continue;const p=vn(r,yn(s)),E=f===null||h===null,b=o&&p>0,x=(f??0)*(h??0);(E||b||p>=x||s.dragging)&&a.push(s)}return a}function Fo(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 Yo(e,t,n,o,i,r=.1,a={x:0,y:0}){const s=t/(e.width*(1+r)),u=n/(e.height*(1+r)),d=Math.min(s,u),c=He(d,o,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*c+(a.x??0),E=n/2-h*c+(a.y??0);return{x:p,y:E,zoom:c}}function Ms(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Go(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:Go(n,t):!1}function dt(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Xo(e,t,n){return e<t?He(Math.abs(e-t),1,t)/t:e>n?-He(Math.abs(e-n),1,t)/t:0}function Uo(e,t,n=15,o=40){const i=Xo(e.x,o,t.width-o)*n,r=Xo(e.y,o,t.height-o)*n;return[i,r]}function wn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const a=Number(i.width.replace("px",""));i.width=`${a+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const a=t.style;return{...a(r),...i}}:t.style={...t.style,...i}}}}function Zo(e,t){var n,o;const i=e.filter(a=>a.type==="add"||a.type==="remove");for(const a of i)if(a.type==="add")t.findIndex(u=>u.id===a.item.id)===-1&&t.push(a.item);else if(a.type==="remove"){const s=t.findIndex(u=>u.id===a.id);s!==-1&&t.splice(s,1)}const r=t.map(a=>a.id);for(const a of t)for(const s of e)if(s.id===a.id)switch(s.type){case"select":a.selected=s.selected;break;case"position":if(ct(a)&&(typeof s.position<"u"&&(a.position=s.position),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&a.parentNode)){const u=t[r.indexOf(a.parentNode)];u&&ct(u)&&wn(a,u)}break;case"dimensions":if(ct(a)&&(typeof s.dimensions<"u"&&(a.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(a.style={...a.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(a.resizing=s.resizing),a.expandParent&&a.parentNode)){const u=t[r.indexOf(a.parentNode)];u&&ct(u)&&(!!u.dimensions.width&&!!u.dimensions.height?wn(a,u):l.nextTick(()=>{wn(a,u)}))}break}return t}function $e(e,t){return{id:e,type:"select",selected:t}}function Ko(e){return{item:e,type:"add"}}function Wo(e){return{id:e,type:"remove"}}function qo(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function Te(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const a=t.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),o.push($e(r.id,a)))}return o}function L(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=s=>{t.delete(s)};return{on:s=>{e&&n&&t.delete(e),t.add(s);const u=()=>{i(s),e&&n&&t.add(e)};return ht(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function Jo(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 Is(e,t,n,o,i){var r,a;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!Go(u,o))&&(u.draggable||t&&typeof u.draggable>"u")&&s.push(l.markRaw({id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((r=u.computedPosition)==null?void 0:r.x)||0,y:n.y-((a=u.computedPosition)==null?void 0:a.y)||0},from:u.computedPosition,extent:u.extent,parentNode:u.parentNode,dimensions:u.dimensions,expandParent:u.expandParent}));return s}function _n({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 jo(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 Ps(e,t,n){const[o,i,r,a]=typeof e!="string"?jo(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+a,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function $s(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=Ps(i,e,o);r&&(i=r)}else t(new ge(fe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,a=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+a],[i[1][0]+r,i[1][1]+a]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,a,s,u]=jo(i.padding),d=(o==null?void 0:o.computedPosition.x)||0,c=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+d+u,i.range[0][1]+c+r],[i.range[1][0]+d-a,i.range[1][1]+c-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Ts({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function bn(e,t,n,o,i){const r=Ts(e.dimensions,$s(e,n,o,i)),a=Bo(t,r);return{position:{x:a.x-((i==null?void 0:i.computedPosition.x)||0),y:a.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:a}}function Ot(e,t,n=Y.Left){const o=((t==null?void 0:t.x)??0)+e.computedPosition.x,i=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:a}=t??Vs(e);switch((t==null?void 0:t.position)??n){case Y.Top:return{x:o+r/2,y:i};case Y.Right:return{x:o+r,y:i+a/2};case Y.Bottom:return{x:o+r/2,y:i+a};case Y.Left:return{x:o,y:i+a/2}}}function Qo(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function Bs({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:a,height:s,viewport:u}){const d={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)};d.x===d.x2&&(d.x2+=1),d.y===d.y2&&(d.y2+=1);const c=Ro({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:a/u.zoom,height:s/u.zoom}),f=Math.max(0,Math.min(c.x2,d.x2)-Math.max(c.x,d.x)),h=Math.max(0,Math.min(c.y2,d.y2)-Math.max(c.y,d.y));return Math.ceil(f*h)>0}function Ds(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),a=t(e.target);return!r||!a?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,a.computedPosition.z||0)),i)}var fe=(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))(fe||{});const ei={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
1
+ (function(Se,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(Se=typeof globalThis<"u"?globalThis:Se||self,a(Se["@stonecrop/node-editor"]={},Se.Vue))})(this,function(Se,a){"use strict";function gt(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function Ne(e){return typeof e=="function"?e():a.unref(e)}const Pi=typeof window<"u"&&typeof document<"u",Ti=e=>typeof e<"u",$i=Object.prototype.toString,Bi=e=>$i.call(e)==="[object Object]",Di=()=>{};function Vi(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 On=e=>e();function Oi(e=On){const t=a.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:a.readonly(t),pause:n,resume:o,eventFilter:i}}function An(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Ai(e,t,n={}){const{eventFilter:o=On,...i}=n;return a.watch(e,Vi(o,t),i)}function Ye(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:l,resume:s,isActive:u}=Oi(o);return{stop:Ai(e,t,{...i,eventFilter:r}),pause:l,resume:s,isActive:u}}function zi(e,t={}){if(!a.isRef(e))return a.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=a.customRef(()=>({get(){return e.value[o]},set(i){var r;if((r=Ne(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[o]=i,e.value=s}else{const s={...e.value,[o]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[o]=i}}));return n}function Kt(e,t=!1){function n(f,{flush:g="sync",deep:h=!1,timeout:x,throwOnTimeout:S}={}){let N=null;const M=[new Promise(_=>{N=a.watch(e,C=>{f(C)!==t&&(N==null||N(),_(C))},{flush:g,deep:h,immediate:!0})})];return x!=null&&M.push(An(x,S).then(()=>Ne(e)).finally(()=>N==null?void 0:N())),Promise.race(M)}function o(f,g){if(!a.isRef(f))return n(C=>C===f,g);const{flush:h="sync",deep:x=!1,timeout:S,throwOnTimeout:N}=g??{};let k=null;const _=[new Promise(C=>{k=a.watch([e,f],([z,L])=>{t!==(z===L)&&(k==null||k(),C(z))},{flush:h,deep:x,immediate:!0})})];return S!=null&&_.push(An(S,N).then(()=>Ne(e)).finally(()=>(k==null||k(),Ne(e)))),Promise.race(_)}function i(f){return n(g=>!!g,f)}function r(f){return o(null,f)}function l(f){return o(void 0,f)}function s(f){return n(Number.isNaN,f)}function u(f,g){return n(h=>{const x=Array.from(h);return x.includes(f)||x.includes(Ne(f))},g)}function c(f){return d(1,f)}function d(f=1,g){let h=-1;return n(()=>(h+=1,h>=f),g)}return Array.isArray(Ne(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Kt(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:l,changed:c,changedTimes:d,get not(){return Kt(e,!t)}}}function qt(e){return Kt(e)}function Ri(e){var t;const n=Ne(e);return(t=n==null?void 0:n.$el)!=null?t:n}const zn=Pi?window:void 0;function Rn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=zn):[t,n,o,i]=e,!t)return Di;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(d=>d()),r.length=0},s=(d,f,g,h)=>(d.addEventListener(f,g,h),()=>d.removeEventListener(f,g,h)),u=a.watch(()=>[Ri(t),Ne(i)],([d,f])=>{if(l(),!d)return;const g=Bi(f)?{...f}:f;r.push(...n.flatMap(h=>o.map(x=>s(d,h,x,g))))},{immediate:!0,flush:"post"}),c=()=>{u(),l()};return gt(c),c}function Hi(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Hn(...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=zn,eventName:r="keydown",passive:l=!1,dedupe:s=!1}=o,u=Hi(t);return Rn(i,r,d=>{d.repeat&&Ne(s)||u(d)&&n(d)},l)}function Li(e){return JSON.parse(JSON.stringify(e))}function Jt(e,t,n,o={}){var i,r,l;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f,shouldEmit:g}=o,h=a.getCurrentInstance(),x=n||(h==null?void 0:h.emit)||((i=h==null?void 0:h.$emit)==null?void 0:i.bind(h))||((l=(r=h==null?void 0:h.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(h==null?void 0:h.proxy));let S=c;t||(t="modelValue"),S=S||`update:${t.toString()}`;const N=_=>s?typeof s=="function"?s(_):Li(_):_,k=()=>Ti(e[t])?N(e[t]):f,M=_=>{g?g(_)&&x(S,_):x(S,_)};if(u){const _=k(),C=a.ref(_);let z=!1;return a.watch(()=>e[t],L=>{z||(z=!0,C.value=N(L),a.nextTick(()=>z=!1))}),a.watch(C,L=>{!z&&(L!==e[t]||d)&&M(L)},{deep:d}),C}else return a.computed({get(){return k()},set(_){M(_)}})}var Fi={value:()=>{}};function mt(){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 yt(n)}function yt(e){this._=e}function Yi(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}})}yt.prototype=mt.prototype={constructor:yt,on:function(e,t){var n=this._,o=Yi(e+"",n),i,r=-1,l=o.length;if(arguments.length<2){for(;++r<l;)if((i=(e=o[r]).type)&&(i=Gi(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<l;)if(i=(e=o[r]).type)n[i]=Ln(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Ln(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 yt(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 Gi(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function Ln(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Fi,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var jt="http://www.w3.org/1999/xhtml";const Fn={svg:"http://www.w3.org/2000/svg",xhtml:jt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Fn.hasOwnProperty(t)?{space:Fn[t],local:e}:e}function Xi(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===jt&&t.documentElement.namespaceURI===jt?t.createElement(e):t.createElementNS(n,e)}}function Ui(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Yn(e){var t=vt(e);return(t.local?Ui:Xi)(t)}function Zi(){}function Qt(e){return e==null?Zi:function(){return this.querySelector(e)}}function Wi(e){typeof e!="function"&&(e=Qt(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=new Array(l),u,c,d=0;d<l;++d)(u=r[d])&&(c=e.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),s[d]=c);return new me(o,this._parents)}function Ki(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function qi(){return[]}function Gn(e){return e==null?qi:function(){return this.querySelectorAll(e)}}function Ji(e){return function(){return Ki(e.apply(this,arguments))}}function ji(e){typeof e=="function"?e=Ji(e):e=Gn(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var l=t[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&(o.push(e.call(u,u.__data__,c,l)),i.push(u));return new me(o,i)}function Xn(e){return function(){return this.matches(e)}}function Un(e){return function(t){return t.matches(e)}}var Qi=Array.prototype.find;function er(e){return function(){return Qi.call(this.children,e)}}function tr(){return this.firstElementChild}function nr(e){return this.select(e==null?tr:er(typeof e=="function"?e:Un(e)))}var or=Array.prototype.filter;function ir(){return Array.from(this.children)}function rr(e){return function(){return or.call(this.children,e)}}function lr(e){return this.selectAll(e==null?ir:rr(typeof e=="function"?e:Un(e)))}function ar(e){typeof e!="function"&&(e=Xn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new me(o,this._parents)}function Zn(e){return new Array(e.length)}function sr(){return new me(this._enter||this._groups.map(Zn),this._parents)}function wt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}wt.prototype={constructor:wt,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 ur(e){return function(){return e}}function cr(e,t,n,o,i,r){for(var l=0,s,u=t.length,c=r.length;l<c;++l)(s=t[l])?(s.__data__=r[l],o[l]=s):n[l]=new wt(e,r[l]);for(;l<u;++l)(s=t[l])&&(i[l]=s)}function dr(e,t,n,o,i,r,l){var s,u,c=new Map,d=t.length,f=r.length,g=new Array(d),h;for(s=0;s<d;++s)(u=t[s])&&(g[s]=h=l.call(u,u.__data__,s,t)+"",c.has(h)?i[s]=u:c.set(h,u));for(s=0;s<f;++s)h=l.call(e,r[s],s,r)+"",(u=c.get(h))?(o[s]=u,u.__data__=r[s],c.delete(h)):n[s]=new wt(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(g[s])===u&&(i[s]=u)}function fr(e){return e.__data__}function hr(e,t){if(!arguments.length)return Array.from(this,fr);var n=t?dr:cr,o=this._parents,i=this._groups;typeof e!="function"&&(e=ur(e));for(var r=i.length,l=new Array(r),s=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],f=i[c],g=f.length,h=pr(e.call(d,d&&d.__data__,c,o)),x=h.length,S=s[c]=new Array(x),N=l[c]=new Array(x),k=u[c]=new Array(g);n(d,f,S,N,k,h,t);for(var M=0,_=0,C,z;M<x;++M)if(C=S[M]){for(M>=_&&(_=M+1);!(z=N[_])&&++_<x;);C._next=z||null}}return l=new me(l,o),l._enter=s,l._exit=u,l}function pr(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function gr(){return new me(this._exit||this._groups.map(Zn),this._parents)}function mr(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 yr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,l=Math.min(i,r),s=new Array(i),u=0;u<l;++u)for(var c=n[u],d=o[u],f=c.length,g=s[u]=new Array(f),h,x=0;x<f;++x)(h=c[x]||d[x])&&(g[x]=h);for(;u<i;++u)s[u]=n[u];return new me(s,this._parents)}function vr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],l;--i>=0;)(l=o[i])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function wr(e){e||(e=_r);function t(f,g){return f&&g?e(f.__data__,g.__data__):!f-!g}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var l=n[r],s=l.length,u=i[r]=new Array(s),c,d=0;d<s;++d)(c=l[d])&&(u[d]=c);u.sort(t)}return new me(i,this._parents).order()}function _r(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function br(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Er(){return Array.from(this)}function xr(){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 l=o[i];if(l)return l}return null}function Sr(){let e=0;for(const t of this)++e;return e}function Nr(){return!this.node()}function Cr(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,l=i.length,s;r<l;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function kr(e){return function(){this.removeAttribute(e)}}function Mr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ir(e,t){return function(){this.setAttribute(e,t)}}function Pr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Tr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function $r(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 Br(e,t){var n=vt(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?Mr:kr:typeof t=="function"?n.local?$r:Tr:n.local?Pr:Ir)(n,t))}function Wn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Dr(e){return function(){this.style.removeProperty(e)}}function Vr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Or(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Ar(e,t,n){return arguments.length>1?this.each((t==null?Dr:typeof t=="function"?Or:Vr)(e,t,n??"")):Ge(this.node(),e)}function Ge(e,t){return e.style.getPropertyValue(t)||Wn(e).getComputedStyle(e,null).getPropertyValue(t)}function zr(e){return function(){delete this[e]}}function Rr(e,t){return function(){this[e]=t}}function Hr(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Lr(e,t){return arguments.length>1?this.each((t==null?zr:typeof t=="function"?Hr:Rr)(e,t)):this.node()[e]}function Kn(e){return e.trim().split(/^|\s+/)}function en(e){return e.classList||new qn(e)}function qn(e){this._node=e,this._names=Kn(e.getAttribute("class")||"")}qn.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 Jn(e,t){for(var n=en(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function jn(e,t){for(var n=en(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Fr(e){return function(){Jn(this,e)}}function Yr(e){return function(){jn(this,e)}}function Gr(e,t){return function(){(t.apply(this,arguments)?Jn:jn)(this,e)}}function Xr(e,t){var n=Kn(e+"");if(arguments.length<2){for(var o=en(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Gr:t?Fr:Yr)(n,t))}function Ur(){this.textContent=""}function Zr(e){return function(){this.textContent=e}}function Wr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Kr(e){return arguments.length?this.each(e==null?Ur:(typeof e=="function"?Wr:Zr)(e)):this.node().textContent}function qr(){this.innerHTML=""}function Jr(e){return function(){this.innerHTML=e}}function jr(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Qr(e){return arguments.length?this.each(e==null?qr:(typeof e=="function"?jr:Jr)(e)):this.node().innerHTML}function el(){this.nextSibling&&this.parentNode.appendChild(this)}function tl(){return this.each(el)}function nl(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ol(){return this.each(nl)}function il(e){var t=typeof e=="function"?e:Yn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function rl(){return null}function ll(e,t){var n=typeof e=="function"?e:Yn(e),o=t==null?rl:typeof t=="function"?t:Qt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function al(){var e=this.parentNode;e&&e.removeChild(this)}function sl(){return this.each(al)}function ul(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function dl(e){return this.select(e?cl:ul)}function fl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function hl(e){return function(t){e.call(this,t,this.__data__)}}function pl(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 gl(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 ml(e,t,n){return function(){var o=this.__on,i,r=hl(t);if(o){for(var l=0,s=o.length;l<s;++l)if((i=o[l]).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 yl(e,t,n){var o=pl(e+""),i,r=o.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((l=o[i]).type===d.type&&l.name===d.name)return d.value}return}for(s=t?ml:gl,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function Qn(e,t,n){var o=Wn(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 vl(e,t){return function(){return Qn(this,e,t)}}function wl(e,t){return function(){return Qn(this,e,t.apply(this,arguments))}}function _l(e,t){return this.each((typeof t=="function"?wl:vl)(e,t))}function*bl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,l;i<r;++i)(l=o[i])&&(yield l)}var eo=[null];function me(e,t){this._groups=e,this._parents=t}function je(){return new me([[document.documentElement]],eo)}function El(){return this}me.prototype=je.prototype={constructor:me,select:Wi,selectAll:ji,selectChild:nr,selectChildren:lr,filter:ar,data:hr,enter:sr,exit:gr,join:mr,merge:yr,selection:El,order:vr,sort:wr,call:br,nodes:Er,node:xr,size:Sr,empty:Nr,each:Cr,attr:Br,style:Ar,property:Lr,classed:Xr,text:Kr,html:Qr,raise:tl,lower:ol,append:il,insert:ll,remove:sl,clone:dl,datum:fl,on:yl,dispatch:_l,[Symbol.iterator]:bl};function ye(e){return typeof e=="string"?new me([[document.querySelector(e)]],[document.documentElement]):new me([[e]],eo)}function xl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=xl(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 Sl={passive:!1},Qe={capture:!0,passive:!1};function tn(e){e.stopImmediatePropagation()}function Xe(e){e.preventDefault(),e.stopImmediatePropagation()}function to(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Xe,Qe);"onselectstart"in t?n.on("selectstart.drag",Xe,Qe):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function no(e,t){var n=e.document.documentElement,o=ye(e).on("dragstart.drag",null);t&&(o.on("click.drag",Xe,Qe),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 _t=e=>()=>e;function nn(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:l,y:s,dx:u,dy:c,dispatch:d}){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:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}nn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Nl(e){return!e.ctrlKey&&!e.button}function Cl(){return this.parentNode}function kl(e,t){return t??{x:e.x,y:e.y}}function Ml(){return navigator.maxTouchPoints||"ontouchstart"in this}function Il(){var e=Nl,t=Cl,n=kl,o=Ml,i={},r=mt("start","drag","end"),l=0,s,u,c,d,f=0;function g(C){C.on("mousedown.drag",h).filter(o).on("touchstart.drag",N).on("touchmove.drag",k,Sl).on("touchend.drag touchcancel.drag",M).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(C,z){if(!(d||!e.call(this,C,z))){var L=_(this,t.call(this,C,z),C,z,"mouse");L&&(ye(C.view).on("mousemove.drag",x,Qe).on("mouseup.drag",S,Qe),to(C.view),tn(C),c=!1,s=C.clientX,u=C.clientY,L("start",C))}}function x(C){if(Xe(C),!c){var z=C.clientX-s,L=C.clientY-u;c=z*z+L*L>f}i.mouse("drag",C)}function S(C){ye(C.view).on("mousemove.drag mouseup.drag",null),no(C.view,c),Xe(C),i.mouse("end",C)}function N(C,z){if(e.call(this,C,z)){var L=C.changedTouches,G=t.call(this,C,z),P=L.length,D,A;for(D=0;D<P;++D)(A=_(this,G,C,z,L[D].identifier,L[D]))&&(tn(C),A("start",C,L[D]))}}function k(C){var z=C.changedTouches,L=z.length,G,P;for(G=0;G<L;++G)(P=i[z[G].identifier])&&(Xe(C),P("drag",C,z[G]))}function M(C){var z=C.changedTouches,L=z.length,G,P;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),G=0;G<L;++G)(P=i[z[G].identifier])&&(tn(C),P("end",C,z[G]))}function _(C,z,L,G,P,D){var A=r.copy(),B=_e(D||L,z),b,J,w;if((w=n.call(C,new nn("beforestart",{sourceEvent:L,target:g,identifier:P,active:l,x:B[0],y:B[1],dx:0,dy:0,dispatch:A}),G))!=null)return b=w.x-B[0]||0,J=w.y-B[1]||0,function T(E,$,V){var F=B,R;switch(E){case"start":i[P]=T,R=l++;break;case"end":delete i[P],--l;case"drag":B=_e(V||$,z),R=l;break}A.call(E,C,new nn(E,{sourceEvent:$,subject:w,target:g,identifier:P,active:R,x:B[0]+b,y:B[1]+J,dx:B[0]-F[0],dy:B[1]-F[1],dispatch:A}),G)}}return g.filter=function(C){return arguments.length?(e=typeof C=="function"?C:_t(!!C),g):e},g.container=function(C){return arguments.length?(t=typeof C=="function"?C:_t(C),g):t},g.subject=function(C){return arguments.length?(n=typeof C=="function"?C:_t(C),g):n},g.touchable=function(C){return arguments.length?(o=typeof C=="function"?C:_t(!!C),g):o},g.on=function(){var C=r.on.apply(r,arguments);return C===r?g:C},g.clickDistance=function(C){return arguments.length?(f=(C=+C)*C,g):Math.sqrt(f)},g}function on(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function oo(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function et(){}var tt=.7,bt=1/tt,Ue="\\s*([+-]?\\d+)\\s*",nt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Pl=/^#([0-9a-f]{3,8})$/,Tl=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),$l=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),Bl=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${nt}\\)$`),Dl=new RegExp(`^rgba\\(${be},${be},${be},${nt}\\)$`),Vl=new RegExp(`^hsl\\(${nt},${be},${be}\\)$`),Ol=new RegExp(`^hsla\\(${nt},${be},${be},${nt}\\)$`),io={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};on(et,ot,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ro,formatHex:ro,formatHex8:Al,formatHsl:zl,formatRgb:lo,toString:lo});function ro(){return this.rgb().formatHex()}function Al(){return this.rgb().formatHex8()}function zl(){return fo(this).formatHsl()}function lo(){return this.rgb().formatRgb()}function ot(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Pl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ao(t):n===3?new ge(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Et(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Et(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=Tl.exec(e))?new ge(t[1],t[2],t[3],1):(t=$l.exec(e))?new ge(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Bl.exec(e))?Et(t[1],t[2],t[3],t[4]):(t=Dl.exec(e))?Et(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Vl.exec(e))?co(t[1],t[2]/100,t[3]/100,1):(t=Ol.exec(e))?co(t[1],t[2]/100,t[3]/100,t[4]):io.hasOwnProperty(e)?ao(io[e]):e==="transparent"?new ge(NaN,NaN,NaN,0):null}function ao(e){return new ge(e>>16&255,e>>8&255,e&255,1)}function Et(e,t,n,o){return o<=0&&(e=t=n=NaN),new ge(e,t,n,o)}function Rl(e){return e instanceof et||(e=ot(e)),e?(e=e.rgb(),new ge(e.r,e.g,e.b,e.opacity)):new ge}function rn(e,t,n,o){return arguments.length===1?Rl(e):new ge(e,t,n,o??1)}function ge(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}on(ge,rn,oo(et,{brighter(e){return e=e==null?bt:Math.pow(bt,e),new ge(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?tt:Math.pow(tt,e),new ge(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ge(Oe(this.r),Oe(this.g),Oe(this.b),xt(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:so,formatHex:so,formatHex8:Hl,formatRgb:uo,toString:uo}));function so(){return`#${Ae(this.r)}${Ae(this.g)}${Ae(this.b)}`}function Hl(){return`#${Ae(this.r)}${Ae(this.g)}${Ae(this.b)}${Ae((isNaN(this.opacity)?1:this.opacity)*255)}`}function uo(){const e=xt(this.opacity);return`${e===1?"rgb(":"rgba("}${Oe(this.r)}, ${Oe(this.g)}, ${Oe(this.b)}${e===1?")":`, ${e})`}`}function xt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Oe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ae(e){return e=Oe(e),(e<16?"0":"")+e.toString(16)}function co(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ve(e,t,n,o)}function fo(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof et||(e=ot(e)),!e)return new ve;if(e instanceof ve)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),l=NaN,s=r-i,u=(r+i)/2;return s?(t===r?l=(n-o)/s+(n<o)*6:n===r?l=(o-t)/s+2:l=(t-n)/s+4,s/=u<.5?r+i:2-r-i,l*=60):s=u>0&&u<1?0:l,new ve(l,s,u,e.opacity)}function Ll(e,t,n,o){return arguments.length===1?fo(e):new ve(e,t,n,o??1)}function ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}on(ve,Ll,oo(et,{brighter(e){return e=e==null?bt:Math.pow(bt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?tt:Math.pow(tt,e),new ve(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 ge(ln(e>=240?e-240:e+120,i,o),ln(e,i,o),ln(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ve(ho(this.h),St(this.s),St(this.l),xt(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=xt(this.opacity);return`${e===1?"hsl(":"hsla("}${ho(this.h)}, ${St(this.s)*100}%, ${St(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ho(e){return e=(e||0)%360,e<0?e+360:e}function St(e){return Math.max(0,Math.min(1,e||0))}function ln(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 po=e=>()=>e;function Fl(e,t){return function(n){return e+n*t}}function Yl(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 Gl(e){return(e=+e)==1?go:function(t,n){return n-t?Yl(t,n,e):po(isNaN(t)?n:t)}}function go(e,t){var n=t-e;return n?Fl(e,n):po(isNaN(e)?t:e)}const mo=function e(t){var n=Gl(t);function o(i,r){var l=n((i=rn(i)).r,(r=rn(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),c=go(i.opacity,r.opacity);return function(d){return i.r=l(d),i.g=s(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=e,o}(1);function Ie(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var an=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sn=new RegExp(an.source,"g");function Xl(e){return function(){return e}}function Ul(e){return function(t){return e(t)+""}}function Zl(e,t){var n=an.lastIndex=sn.lastIndex=0,o,i,r,l=-1,s=[],u=[];for(e=e+"",t=t+"";(o=an.exec(e))&&(i=sn.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[l]?s[l]+=r:s[++l]=r),(o=o[0])===(i=i[0])?s[l]?s[l]+=i:s[++l]=i:(s[++l]=null,u.push({i:l,x:Ie(o,i)})),n=sn.lastIndex;return n<t.length&&(r=t.slice(n),s[l]?s[l]+=r:s[++l]=r),s.length<2?u[0]?Ul(u[0].x):Xl(t):(t=u.length,function(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);return s.join("")})}var yo=180/Math.PI,un={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vo(e,t,n,o,i,r){var l,s,u;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,l=-l),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*yo,skewX:Math.atan(u)*yo,scaleX:l,scaleY:s}}var Nt;function Wl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?un:vo(t.a,t.b,t.c,t.d,t.e,t.f)}function Kl(e){return e==null||(Nt||(Nt=document.createElementNS("http://www.w3.org/2000/svg","g")),Nt.setAttribute("transform",e),!(e=Nt.transform.baseVal.consolidate()))?un:(e=e.matrix,vo(e.a,e.b,e.c,e.d,e.e,e.f))}function wo(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,f,g,h,x){if(c!==f||d!==g){var S=h.push("translate(",null,t,null,n);x.push({i:S-4,x:Ie(c,f)},{i:S-2,x:Ie(d,g)})}else(f||g)&&h.push("translate("+f+t+g+n)}function l(c,d,f,g){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),g.push({i:f.push(i(f)+"rotate(",null,o)-2,x:Ie(c,d)})):d&&f.push(i(f)+"rotate("+d+o)}function s(c,d,f,g){c!==d?g.push({i:f.push(i(f)+"skewX(",null,o)-2,x:Ie(c,d)}):d&&f.push(i(f)+"skewX("+d+o)}function u(c,d,f,g,h,x){if(c!==f||d!==g){var S=h.push(i(h)+"scale(",null,",",null,")");x.push({i:S-4,x:Ie(c,f)},{i:S-2,x:Ie(d,g)})}else(f!==1||g!==1)&&h.push(i(h)+"scale("+f+","+g+")")}return function(c,d){var f=[],g=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,g),l(c.rotate,d.rotate,f,g),s(c.skewX,d.skewX,f,g),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,g),c=d=null,function(h){for(var x=-1,S=g.length,N;++x<S;)f[(N=g[x]).i]=N.x(h);return f.join("")}}}var ql=wo(Wl,"px, ","px)","deg)"),Jl=wo(Kl,", ",")",")"),jl=1e-12;function _o(e){return((e=Math.exp(e))+1/e)/2}function Ql(e){return((e=Math.exp(e))-1/e)/2}function ea(e){return((e=Math.exp(2*e))-1)/(e+1)}const ta=function e(t,n,o){function i(r,l){var s=r[0],u=r[1],c=r[2],d=l[0],f=l[1],g=l[2],h=d-s,x=f-u,S=h*h+x*x,N,k;if(S<jl)k=Math.log(g/c)/t,N=function(G){return[s+G*h,u+G*x,c*Math.exp(t*G*k)]};else{var M=Math.sqrt(S),_=(g*g-c*c+o*S)/(2*c*n*M),C=(g*g-c*c-o*S)/(2*g*n*M),z=Math.log(Math.sqrt(_*_+1)-_),L=Math.log(Math.sqrt(C*C+1)-C);k=(L-z)/t,N=function(G){var P=G*k,D=_o(z),A=c/(n*M)*(D*ea(t*P+z)-Ql(z));return[s+A*h,u+A*x,c*D/_o(t*P+z)]}}return N.duration=k*1e3*t/Math.SQRT2,N}return i.rho=function(r){var l=Math.max(.001,+r),s=l*l,u=s*s;return e(l,s,u)},i}(Math.SQRT2,2,4);var Ze=0,it=0,rt=0,bo=1e3,Ct,lt,kt=0,ze=0,Mt=0,at=typeof performance=="object"&&performance.now?performance:Date,Eo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cn(){return ze||(Eo(na),ze=at.now()+Mt)}function na(){ze=0}function It(){this._call=this._time=this._next=null}It.prototype=xo.prototype={constructor:It,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?cn():+n)+(t==null?0:+t),!this._next&&lt!==this&&(lt?lt._next=this:Ct=this,lt=this),this._call=e,this._time=n,dn()},stop:function(){this._call&&(this._call=null,this._time=1/0,dn())}};function xo(e,t,n){var o=new It;return o.restart(e,t,n),o}function oa(){cn(),++Ze;for(var e=Ct,t;e;)(t=ze-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ze}function So(){ze=(kt=at.now())+Mt,Ze=it=0;try{oa()}finally{Ze=0,ra(),ze=0}}function ia(){var e=at.now(),t=e-kt;t>bo&&(Mt-=t,kt=e)}function ra(){for(var e,t=Ct,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:Ct=n);lt=e,dn(o)}function dn(e){if(!Ze){it&&(it=clearTimeout(it));var t=e-ze;t>24?(e<1/0&&(it=setTimeout(So,e-at.now()-Mt)),rt&&(rt=clearInterval(rt))):(rt||(kt=at.now(),rt=setInterval(ia,bo)),Ze=1,Eo(So))}}function No(e,t,n){var o=new It;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var la=mt("start","end","cancel","interrupt"),aa=[],Co=0,ko=1,fn=2,Pt=3,Mo=4,hn=5,Tt=6;function $t(e,t,n,o,i,r){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;sa(e,n,{name:t,index:o,group:i,on:la,tween:aa,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Co})}function pn(e,t){var n=we(e,t);if(n.state>Co)throw new Error("too late; already scheduled");return n}function Ee(e,t){var n=we(e,t);if(n.state>Pt)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function sa(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=xo(r,0,n.time);function r(c){n.state=ko,n.timer.restart(l,n.delay,n.time),n.delay<=c&&l(c-n.delay)}function l(c){var d,f,g,h;if(n.state!==ko)return u();for(d in o)if(h=o[d],h.name===n.name){if(h.state===Pt)return No(l);h.state===Mo?(h.state=Tt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[d]):+d<t&&(h.state=Tt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[d])}if(No(function(){n.state===Pt&&(n.state=Mo,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=fn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===fn){for(n.state=Pt,i=new Array(g=n.tween.length),d=0,f=-1;d<g;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=hn,1),f=-1,g=i.length;++f<g;)i[f].call(e,d);n.state===hn&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Tt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Bt(e,t){var n=e.__transition,o,i,r=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((o=n[l]).name!==t){r=!1;continue}i=o.state>fn&&o.state<hn,o.state=Tt,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[l]}r&&delete e.__transition}}function ua(e){return this.each(function(){Bt(this,e)})}function ca(e,t){var n,o;return function(){var i=Ee(this,e),r=i.tween;if(r!==n){o=n=r;for(var l=0,s=o.length;l<s;++l)if(o[l].name===t){o=o.slice(),o.splice(l,1);break}}i.tween=o}}function da(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=Ee(this,e),l=r.tween;if(l!==o){i=(o=l).slice();for(var s={name:t,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}r.tween=i}}function fa(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,i=0,r=o.length,l;i<r;++i)if((l=o[i]).name===e)return l.value;return null}return this.each((t==null?ca:da)(n,e,t))}function gn(e,t,n){var o=e._id;return e.each(function(){var i=Ee(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,o).value[t]}}function Io(e,t){var n;return(typeof t=="number"?Ie:t instanceof ot?mo:(n=ot(t))?(t=n,mo):Zl)(e,t)}function ha(e){return function(){this.removeAttribute(e)}}function pa(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ga(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttribute(e);return l===i?null:l===o?r:r=t(o=l,n)}}function ma(e,t,n){var o,i=n+"",r;return function(){var l=this.getAttributeNS(e.space,e.local);return l===i?null:l===o?r:r=t(o=l,n)}}function ya(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function va(e,t,n){var o,i,r;return function(){var l,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),u=s+"",l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s)))}}function wa(e,t){var n=vt(e),o=n==="transform"?Jl:Io;return this.attrTween(e,typeof t=="function"?(n.local?va:ya)(n,o,gn(this,"attr."+e,t)):t==null?(n.local?pa:ha)(n):(n.local?ma:ga)(n,o,t))}function _a(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ba(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ea(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&ba(e,r)),n}return i._value=t,i}function xa(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&_a(e,r)),n}return i._value=t,i}function Sa(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=vt(e);return this.tween(n,(o.local?Ea:xa)(o,t))}function Na(e,t){return function(){pn(this,e).delay=+t.apply(this,arguments)}}function Ca(e,t){return t=+t,function(){pn(this,e).delay=t}}function ka(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Na:Ca)(t,e)):we(this.node(),t).delay}function Ma(e,t){return function(){Ee(this,e).duration=+t.apply(this,arguments)}}function Ia(e,t){return t=+t,function(){Ee(this,e).duration=t}}function Pa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ma:Ia)(t,e)):we(this.node(),t).duration}function Ta(e,t){if(typeof t!="function")throw new Error;return function(){Ee(this,e).ease=t}}function $a(e){var t=this._id;return arguments.length?this.each(Ta(t,e)):we(this.node(),t).ease}function Ba(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ee(this,e).ease=n}}function Da(e){if(typeof e!="function")throw new Error;return this.each(Ba(this._id,e))}function Va(e){typeof e!="function"&&(e=Xn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],l=r.length,s=o[i]=[],u,c=0;c<l;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new Ce(o,this._parents,this._name,this._id)}function Oa(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),l=new Array(o),s=0;s<r;++s)for(var u=t[s],c=n[s],d=u.length,f=l[s]=new Array(d),g,h=0;h<d;++h)(g=u[h]||c[h])&&(f[h]=g);for(;s<o;++s)l[s]=t[s];return new Ce(l,this._parents,this._name,this._id)}function Aa(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 za(e,t,n){var o,i,r=Aa(t)?pn:Ee;return function(){var l=r(this,e),s=l.on;s!==o&&(i=(o=s).copy()).on(t,n),l.on=i}}function Ra(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(za(n,e,t))}function Ha(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function La(){return this.on("end.remove",Ha(this._id))}function Fa(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qt(e));for(var o=this._groups,i=o.length,r=new Array(i),l=0;l<i;++l)for(var s=o[l],u=s.length,c=r[l]=new Array(u),d,f,g=0;g<u;++g)(d=s[g])&&(f=e.call(d,d.__data__,g,s))&&("__data__"in d&&(f.__data__=d.__data__),c[g]=f,$t(c[g],t,n,g,c,we(d,n)));return new Ce(r,this._parents,t,n)}function Ya(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gn(e));for(var o=this._groups,i=o.length,r=[],l=[],s=0;s<i;++s)for(var u=o[s],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var g=e.call(d,d.__data__,f,u),h,x=we(d,n),S=0,N=g.length;S<N;++S)(h=g[S])&&$t(h,t,n,S,g,x);r.push(g),l.push(d)}return new Ce(r,l,t,n)}var Ga=je.prototype.constructor;function Xa(){return new Ga(this._groups,this._parents)}function Ua(e,t){var n,o,i;return function(){var r=Ge(this,e),l=(this.style.removeProperty(e),Ge(this,e));return r===l?null:r===n&&l===o?i:i=t(n=r,o=l)}}function Po(e){return function(){this.style.removeProperty(e)}}function Za(e,t,n){var o,i=n+"",r;return function(){var l=Ge(this,e);return l===i?null:l===o?r:r=t(o=l,n)}}function Wa(e,t,n){var o,i,r;return function(){var l=Ge(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Ge(this,e))),l===u?null:l===o&&u===i?r:(i=u,r=t(o=l,s))}}function Ka(e,t){var n,o,i,r="style."+t,l="end."+r,s;return function(){var u=Ee(this,e),c=u.on,d=u.value[r]==null?s||(s=Po(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(l,i=d),u.on=o}}function qa(e,t,n){var o=(e+="")=="transform"?ql:Io;return t==null?this.styleTween(e,Ua(e,o)).on("end.style."+e,Po(e)):typeof t=="function"?this.styleTween(e,Wa(e,o,gn(this,"style."+e,t))).each(Ka(this._id,e)):this.styleTween(e,Za(e,o,t),n).on("end.style."+e,null)}function Ja(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ja(e,t,n){var o,i;function r(){var l=t.apply(this,arguments);return l!==i&&(o=(i=l)&&Ja(e,l,n)),o}return r._value=t,r}function Qa(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,ja(e,t,n??""))}function es(e){return function(){this.textContent=e}}function ts(e){return function(){var t=e(this);this.textContent=t??""}}function ns(e){return this.tween("text",typeof e=="function"?ts(gn(this,"text",e)):es(e==null?"":e+""))}function os(e){return function(t){this.textContent=e.call(this,t)}}function is(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&os(i)),t}return o._value=e,o}function rs(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,is(e))}function ls(){for(var e=this._name,t=this._id,n=To(),o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)if(u=l[c]){var d=we(u,t);$t(u,e,n,c,l,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ce(o,this._parents,e,n)}function as(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,l){var s={value:l},u={value:function(){--i===0&&r()}};n.each(function(){var c=Ee(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),i===0&&r()})}var ss=0;function Ce(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function To(){return++ss}var ke=je.prototype;Ce.prototype={constructor:Ce,select:Fa,selectAll:Ya,selectChild:ke.selectChild,selectChildren:ke.selectChildren,filter:Va,merge:Oa,selection:Xa,transition:ls,call:ke.call,nodes:ke.nodes,node:ke.node,size:ke.size,empty:ke.empty,each:ke.each,on:Ra,attr:wa,attrTween:Sa,style:qa,styleTween:Qa,text:ns,textTween:rs,remove:La,tween:fa,delay:ka,duration:Pa,ease:$a,easeVarying:Da,end:as,[Symbol.iterator]:ke[Symbol.iterator]};function us(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cs={time:null,delay:0,duration:250,ease:us};function ds(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 fs(e){var t,n;e instanceof Ce?(t=e._id,e=e._name):(t=To(),(n=cs).time=cn(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var l=o[r],s=l.length,u,c=0;c<s;++c)(u=l[c])&&$t(u,e,t,c,l,n||ds(u,t));return new Ce(o,this._parents,e,t)}je.prototype.interrupt=ua,je.prototype.transition=fs;const Dt=e=>()=>e;function hs(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 Me(e,t,n){this.k=e,this.x=t,this.y=n}Me.prototype={constructor:Me,scale:function(e){return e===1?this:new Me(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Me(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 We=new Me(1,0,0);Me.prototype;function mn(e){e.stopImmediatePropagation()}function st(e){e.preventDefault(),e.stopImmediatePropagation()}function ps(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function gs(){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 $o(){return this.__zoom||We}function ms(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ys(){return navigator.maxTouchPoints||"ontouchstart"in this}function vs(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],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function ws(){var e=ps,t=gs,n=vs,o=ms,i=ys,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,u=ta,c=mt("start","zoom","end"),d,f,g,h=500,x=150,S=0,N=10;function k(w){w.property("__zoom",$o).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",B).on("touchmove.zoom",b).on("touchend.zoom touchcancel.zoom",J).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(w,T,E,$){var V=w.selection?w.selection():w;V.property("__zoom",$o),w!==V?z(w,T,E,$):V.interrupt().each(function(){L(this,arguments).event($).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},k.scaleBy=function(w,T,E,$){k.scaleTo(w,function(){var V=this.__zoom.k,F=typeof T=="function"?T.apply(this,arguments):T;return V*F},E,$)},k.scaleTo=function(w,T,E,$){k.transform(w,function(){var V=t.apply(this,arguments),F=this.__zoom,R=E==null?C(V):typeof E=="function"?E.apply(this,arguments):E,W=F.invert(R),O=typeof T=="function"?T.apply(this,arguments):T;return n(_(M(F,O),R,W),V,l)},E,$)},k.translateBy=function(w,T,E,$){k.transform(w,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),l)},null,$)},k.translateTo=function(w,T,E,$,V){k.transform(w,function(){var F=t.apply(this,arguments),R=this.__zoom,W=$==null?C(F):typeof $=="function"?$.apply(this,arguments):$;return n(We.translate(W[0],W[1]).scale(R.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof E=="function"?-E.apply(this,arguments):-E),F,l)},$,V)};function M(w,T){return T=Math.max(r[0],Math.min(r[1],T)),T===w.k?w:new Me(T,w.x,w.y)}function _(w,T,E){var $=T[0]-E[0]*w.k,V=T[1]-E[1]*w.k;return $===w.x&&V===w.y?w:new Me(w.k,$,V)}function C(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function z(w,T,E,$){w.on("start.zoom",function(){L(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){L(this,arguments).event($).end()}).tween("zoom",function(){var V=this,F=arguments,R=L(V,F).event($),W=t.apply(V,F),O=E==null?C(W):typeof E=="function"?E.apply(V,F):E,X=Math.max(W[1][0]-W[0][0],W[1][1]-W[0][1]),U=V.__zoom,te=typeof T=="function"?T.apply(V,F):T,ae=u(U.invert(O).concat(X/U.k),te.invert(O).concat(X/te.k));return function(ie){if(ie===1)ie=te;else{var ue=ae(ie),oe=X/ue[2];ie=new Me(oe,O[0]-ue[0]*oe,O[1]-ue[1]*oe)}R.zoom(null,ie)}})}function L(w,T,E){return!E&&w.__zooming||new G(w,T)}function G(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}G.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=ye(this.that).datum();c.call(w,this.that,new hs(w,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:c}),T)}};function P(w,...T){if(!e.apply(this,arguments))return;var E=L(this,T).event(w),$=this.__zoom,V=Math.max(r[0],Math.min(r[1],$.k*Math.pow(2,o.apply(this,arguments)))),F=_e(w);if(E.wheel)(E.mouse[0][0]!==F[0]||E.mouse[0][1]!==F[1])&&(E.mouse[1]=$.invert(E.mouse[0]=F)),clearTimeout(E.wheel);else{if($.k===V)return;E.mouse=[F,$.invert(F)],Bt(this),E.start()}st(w),E.wheel=setTimeout(R,x),E.zoom("mouse",n(_(M($,V),E.mouse[0],E.mouse[1]),E.extent,l));function R(){E.wheel=null,E.end()}}function D(w,...T){if(g||!e.apply(this,arguments))return;var E=w.currentTarget,$=L(this,T,!0).event(w),V=ye(w.view).on("mousemove.zoom",O,!0).on("mouseup.zoom",X,!0),F=_e(w,E),R=w.clientX,W=w.clientY;to(w.view),mn(w),$.mouse=[F,this.__zoom.invert(F)],Bt(this),$.start();function O(U){if(st(U),!$.moved){var te=U.clientX-R,ae=U.clientY-W;$.moved=te*te+ae*ae>S}$.event(U).zoom("mouse",n(_($.that.__zoom,$.mouse[0]=_e(U,E),$.mouse[1]),$.extent,l))}function X(U){V.on("mousemove.zoom mouseup.zoom",null),no(U.view,$.moved),st(U),$.event(U).end()}}function A(w,...T){if(e.apply(this,arguments)){var E=this.__zoom,$=_e(w.changedTouches?w.changedTouches[0]:w,this),V=E.invert($),F=E.k*(w.shiftKey?.5:2),R=n(_(M(E,F),$,V),t.apply(this,T),l);st(w),s>0?ye(this).transition().duration(s).call(z,R,$,w):ye(this).call(k.transform,R,$,w)}}function B(w,...T){if(e.apply(this,arguments)){var E=w.touches,$=E.length,V=L(this,T,w.changedTouches.length===$).event(w),F,R,W,O;for(mn(w),R=0;R<$;++R)W=E[R],O=_e(W,this),O=[O,this.__zoom.invert(O),W.identifier],V.touch0?!V.touch1&&V.touch0[2]!==O[2]&&(V.touch1=O,V.taps=0):(V.touch0=O,F=!0,V.taps=1+!!d);d&&(d=clearTimeout(d)),F&&(V.taps<2&&(f=O[0],d=setTimeout(function(){d=null},h)),Bt(this),V.start())}}function b(w,...T){if(this.__zooming){var E=L(this,T).event(w),$=w.changedTouches,V=$.length,F,R,W,O;for(st(w),F=0;F<V;++F)R=$[F],W=_e(R,this),E.touch0&&E.touch0[2]===R.identifier?E.touch0[0]=W:E.touch1&&E.touch1[2]===R.identifier&&(E.touch1[0]=W);if(R=E.that.__zoom,E.touch1){var X=E.touch0[0],U=E.touch0[1],te=E.touch1[0],ae=E.touch1[1],ie=(ie=te[0]-X[0])*ie+(ie=te[1]-X[1])*ie,ue=(ue=ae[0]-U[0])*ue+(ue=ae[1]-U[1])*ue;R=M(R,Math.sqrt(ie/ue)),W=[(X[0]+te[0])/2,(X[1]+te[1])/2],O=[(U[0]+ae[0])/2,(U[1]+ae[1])/2]}else if(E.touch0)W=E.touch0[0],O=E.touch0[1];else return;E.zoom("touch",n(_(R,W,O),E.extent,l))}}function J(w,...T){if(this.__zooming){var E=L(this,T).event(w),$=w.changedTouches,V=$.length,F,R;for(mn(w),g&&clearTimeout(g),g=setTimeout(function(){g=null},h),F=0;F<V;++F)R=$[F],E.touch0&&E.touch0[2]===R.identifier?delete E.touch0:E.touch1&&E.touch1[2]===R.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(R=_e(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<N)){var W=ye(this).on("dblclick.zoom");W&&W.apply(this,arguments)}}}return k.wheelDelta=function(w){return arguments.length?(o=typeof w=="function"?w:Dt(+w),k):o},k.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Dt(!!w),k):e},k.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Dt(!!w),k):i},k.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Dt([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),k):t},k.scaleExtent=function(w){return arguments.length?(r[0]=+w[0],r[1]=+w[1],k):[r[0],r[1]]},k.translateExtent=function(w){return arguments.length?(l[0][0]=+w[0][0],l[1][0]=+w[1][0],l[0][1]=+w[0][1],l[1][1]=+w[1][1],k):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},k.constrain=function(w){return arguments.length?(n=w,k):n},k.duration=function(w){return arguments.length?(s=+w,k):s},k.interpolate=function(w){return arguments.length?(u=w,k):u},k.on=function(){var w=c.on.apply(c,arguments);return w===c?k:w},k.clickDistance=function(w){return arguments.length?(S=(w=+w)*w,k):Math.sqrt(S)},k.tapDistance=function(w){return arguments.length?(N=+w,k):N},k}var H=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(H||{}),yn=(e=>(e.Partial="partial",e.Full="full",e))(yn||{}),Re=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Re||{}),Pe=(e=>(e.Strict="strict",e.Loose="loose",e))(Pe||{}),vn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(vn||{}),ut=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ut||{});function wn(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 _s(e){return e.ctrlKey||e.metaKey||e.shiftKey}function Bo(e,t,n,o){const i=t.replace("+",`
2
+ `).replace(`
3
+
4
+ `,`
5
+ +`).split(`
6
+ `).map(l=>l.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((l,s)=>n.has(l)&&Array.from(n.values())[s]===i[s]);return o&&n.delete(e.toLowerCase()),r}function bs(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Es(n.code,e);return Array.isArray(e)?e.some(i=>Bo(n[o],i,t,n.type==="keyup")):Bo(n[o],e,t,n.type==="keyup")}}function Es(e,t){return t.includes(e)?"code":"key"}function ct(e,t){const n=a.toRef(()=>a.toValue(t==null?void 0:t.actInsideInputWithModifier)??!1),o=a.toRef(()=>a.toValue(t==null?void 0:t.target)??window),i=a.ref(a.toValue(e)===!0);let r=!1;const l=new Set;let s=c(a.toValue(e));a.watch(()=>a.toValue(e),(d,f)=>{typeof f=="boolean"&&typeof d!="boolean"&&u(),s=c(d)},{immediate:!0}),Rn(["blur","contextmenu"],u),Hn((...d)=>s(...d),d=>{r=_s(d),!((!r||r&&!n.value)&&wn(d))&&(d.preventDefault(),i.value=!0)},{eventName:"keydown",target:o}),Hn((...d)=>s(...d),d=>{if(i.value){if((!r||r&&!n.value)&&wn(d))return;r=!1,i.value=!1}},{eventName:"keyup",target:o});function u(){r=!1,l.clear(),i.value=a.toValue(e)===!0}function c(d){return d===null?(u(),()=>!1):typeof d=="boolean"?(u(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?bs(d,l):d}return i}const Do="vue-flow__node-desc",Vo="vue-flow__edge-desc",xs="vue-flow__aria-live",Oo=["Enter"," ","Escape"],Ke={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Vt(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Ot(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 At(e){return{width:e.offsetWidth,height:e.offsetHeight}}function He(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ao(e,t){return{x:He(e.x,t[0][0],t[1][0]),y:He(e.y,t[0][1],t[1][1])}}function zo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function Te(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function Le(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Te(e)}function dt(e){return Le(e)&&"computedPosition"in e}function zt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ss(e){return zt(e.width)&&zt(e.height)&&zt(e.x)&&zt(e.y)}function Ns(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:a.markRaw({width:0,height:0}),computedPosition:a.markRaw({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:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Ro(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??(n==null?void 0:n.updatable),selectable:e.selectable??(n==null?void 0:n.selectable),focusable:e.focusable??(n==null?void 0:n.focusable),data:he(e.data)?e.data:{},events:a.markRaw(he(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(n==null?void 0:n.interactionWidth),...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Ho(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,l=o==="source"?"target":"source";for(const s of n)s[l]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function Cs(...e){if(e.length===3){const[r,l,s]=e;return Ho(r,l,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Te(r)&&r.source===o).map(r=>n.find(l=>Le(l)&&l.id===r.target))}function ks(...e){if(e.length===3){const[r,l,s]=e;return Ho(r,l,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Te(r)&&r.target===o).map(r=>n.find(l=>Le(l)&&l.id===r.source))}function Lo({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Ms(e,t){return t.some(n=>Te(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 _n({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function ft({x:e,y:t},{x:n,y:o,zoom:i},r=!1,l=[1,1]){const s={x:(e-n)/i,y:(t-o)/i};return r?Ht(s,l):s}function Is(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 Fo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Ps({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Yo(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=Is(t,Fo({...o.computedPosition,...o.dimensions}))}return Ps(t)}function Go(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...ft(t,n),width:t.width/n.zoom,height:t.height/n.zoom},l=[];for(const s of e){const{dimensions:u,selectable:c=!0,hidden:d=!1}=s,f=u.width??s.width??null,g=u.height??s.height??null;if(i&&!c||d)continue;const h=Ot(r,Vt(s)),x=f===null||g===null,S=o&&h>0,N=(f??0)*(g??0);(x||S||h>=N||s.dragging)&&l.push(s)}return l}function Xo(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 Uo(e,t,n,o,i,r=.1,l={x:0,y:0}){const s=t/(e.width*(1+r)),u=n/(e.height*(1+r)),c=Math.min(s,u),d=He(c,o,i),f=e.x+e.width/2,g=e.y+e.height/2,h=t/2-f*d+(l.x??0),x=n/2-g*d+(l.y??0);return{x:h,y:x,zoom:d}}function Ts(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Zo(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:Zo(n,t):!1}function ht(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Wo(e,t,n){return e<t?He(Math.abs(e-t),1,t)/t:e>n?-He(Math.abs(e-n),1,t)/t:0}function Ko(e,t,n=15,o=40){const i=Wo(e.x,o,t.width-o)*n,r=Wo(e.y,o,t.height-o)*n;return[i,r]}function bn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const l=Number(i.width.replace("px",""));i.width=`${l+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const l=Number(i.height.replace("px",""));i.height=`${l+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const l=t.style;return{...l(r),...i}}:t.style={...t.style,...i}}}}function qo(e,t){var n,o;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")t.findIndex(u=>u.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const s=t.findIndex(u=>u.id===l.id);s!==-1&&t.splice(s,1)}const r=t.map(l=>l.id);for(const l of t)for(const s of e)if(s.id===l.id)switch(s.type){case"select":l.selected=s.selected;break;case"position":if(dt(l)&&(typeof s.position<"u"&&(l.position=s.position),typeof s.dragging<"u"&&(l.dragging=s.dragging),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&dt(u)&&bn(l,u)}break;case"dimensions":if(dt(l)&&(typeof s.dimensions<"u"&&(l.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(l.style={...l.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(l.resizing=s.resizing),l.expandParent&&l.parentNode)){const u=t[r.indexOf(l.parentNode)];u&&dt(u)&&(!!u.dimensions.width&&!!u.dimensions.height?bn(l,u):a.nextTick(()=>{bn(l,u)}))}break}return t}function $e(e,t){return{id:e,type:"select",selected:t}}function Jo(e){return{item:e,type:"add"}}function jo(e){return{id:e,type:"remove"}}function Qo(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function Be(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const l=t.has(i);!(r.selected===void 0&&!l)&&r.selected!==l&&(n&&(r.selected=l),o.push($e(r.id,l)))}return o}function Y(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=s=>{t.delete(s)};return{on:s=>{e&&n&&t.delete(e),t.add(s);const u=()=>{i(s),e&&n&&t.add(e)};return gt(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function ei(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 $s(e,t,n,o,i){var r,l;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!Zo(u,o))&&(u.draggable||t&&typeof u.draggable>"u")&&s.push(a.markRaw({id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((r=u.computedPosition)==null?void 0:r.x)||0,y:n.y-((l=u.computedPosition)==null?void 0:l.y)||0},from:u.computedPosition,extent:u.extent,parentNode:u.parentNode,dimensions:u.dimensions,expandParent:u.expandParent}));return s}function En({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 ti(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 Bs(e,t,n){const[o,i,r,l]=typeof e!="string"?ti(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+l,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Ds(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=Bs(i,e,o);r&&(i=r)}else t(new pe(fe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,l=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+l],[i[1][0]+r,i[1][1]+l]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,l,s,u]=ti(i.padding),c=(o==null?void 0:o.computedPosition.x)||0,d=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-l,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Vs({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function xn(e,t,n,o,i){const r=Vs(e.dimensions,Ds(e,n,o,i)),l=Ao(t,r);return{position:{x:l.x-((i==null?void 0:i.computedPosition.x)||0),y:l.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:l}}function qe(e,t,n=H.Left,o=!1){const i=((t==null?void 0:t.x)??0)+e.computedPosition.x,r=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:l,height:s}=t??zs(e);if(o)return{x:i+l/2,y:r+s/2};switch((t==null?void 0:t.position)??n){case H.Top:return{x:i+l/2,y:r};case H.Right:return{x:i+l,y:r+s/2};case H.Bottom:return{x:i+l/2,y:r+s};case H.Left:return{x:i,y:r+s/2}}}function ni(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Os({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:l,height:s,viewport:u}){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 d=Fo({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:l/u.zoom,height:s/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),g=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*g)>0}function As(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),i)}var fe=(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))(fe||{});const oi={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
2
7
  Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
3
8
  Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
4
9
  Node: ${e}
@@ -18,5 +23,5 @@ Edge: ${e}
18
23
  Source: ${t}
19
24
  Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
20
25
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
21
- 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 ge extends Error{constructor(t,...n){var o;super((o=ei[t])==null?void 0:o.call(ei,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function En(e){return"clientX"in e}function Be(e,t){var n,o;const i=En(e),r=i?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,a=i?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const At=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Vs(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function ti(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function xn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function ni(e,t,n,o){const i=[];for(const r of t[n]||[])if(`${e.id}-${r.id}-${n}`!==o){const{x:a,y:s}=Ot(e,r);i.push({id:r.id||null,type:n,nodeId:e.id,x:a,y:s})}return i}function Os(e,t,n,o,i,r){const{x:a,y:s}=Be(e),d=t.elementsFromPoint(a,s).find(E=>E.classList.contains("vue-flow__handle"));if(d){const E=d.getAttribute("data-nodeid");if(E){const b=Sn(void 0,d),x=d.getAttribute("data-handleid"),S=r({nodeId:E,id:x,type:b});if(S){const M=i.find(_=>_.nodeId===E&&_.type===b&&_.id===x);return{handle:{id:x,type:b,nodeId:E,x:(M==null?void 0:M.x)||n.x,y:(M==null?void 0:M.y)||n.y},validHandleResult:S}}}}let c=[],f=Number.POSITIVE_INFINITY;for(const E of i){const b=Math.sqrt((E.x-n.x)**2+(E.y-n.y)**2);if(b<=o){const x=r(E);b<=f&&(b<f?c=[{handle:E,validHandleResult:x}]:b===f&&c.push({handle:E,validHandleResult:x}),f=b)}}if(!c.length)return{handle:null,validHandleResult:ti()};if(c.length===1)return c[0];const h=c.some(({validHandleResult:E})=>E.isValid),p=c.some(({handle:E})=>E.type==="target");return c.find(({handle:E,validHandleResult:b})=>p?E.type==="target":h?b.isValid:!0)||c[0]}function oi(e,t,n,o,i,r,a,s,u,d,c){const f=r==="target",h=s.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:E}=Be(e),b=s.elementFromPoint(p,E),x=b!=null&&b.classList.contains("vue-flow__handle")?b:h,S=ti();if(x){S.handleDomNode=x;const M=Sn(void 0,x),_=x.getAttribute("data-nodeid"),C=x.getAttribute("data-handleid"),z=x.classList.contains("connectable"),X=x.classList.contains("connectableend"),F={source:f?_:o,sourceHandle:f?C:i,target:f?o:_,targetHandle:f?i:C};S.connection=F,z&&X&&(n===Re.Strict?f&&M==="source"||!f&&M==="target":_!==o||C!==i)&&(S.isValid=a(F,{edges:u,nodes:d,sourceNode:c(F.source),targetNode:c(F.target)}),S.endHandle={nodeId:_,handleId:C,type:M,position:S.isValid?x.getAttribute("data-handlepos"):null})}return S}function As({nodes:e,nodeId:t,handleId:n,handleType:o}){const i=[];for(let r=0;r<e.length;r++){const a=e[r],{handleBounds:s}=a;let u=[],d=[];s&&(u=ni(a,s,"source",`${t}-${n}-${o}`),d=ni(a,s,"target",`${t}-${n}-${o}`)),i.push(...u,...d)}return i}function Sn(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function zs(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}const Rs=["production","prod"];function zt(e,...t){ii()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ii(){return!Rs.includes(process.env.NODE_ENV||"")}function ri(e,t,n,o){const i=t.querySelectorAll(`.vue-flow__handle${e}`);return Array.from(i).map(a=>{const s=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(s.left-n.left)/o,y:(s.top-n.top)/o,...Bt(a)}})}function Nn(e,t,n,o,i,r=!1,a){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),l.nextTick(()=>{a.blur()})):n([e])}function he(e){return typeof l.unref(e)<"u"}function Hs(e,t,n,o){if(!e||!e.source||!e.target)return n(new ge(fe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return Pe(e)?i=e:i={...e,id:Ao(e)},i=Vo(i,void 0,o),Ns(i,t)?!1:i}function Ls(e,t,n,o,i,r){if(!t.source||!t.target)return r(new ge(fe.EDGE_INVALID,e.id)),!1;const a=o(e.id);if(!a)return r(new ge(fe.EDGE_NOT_FOUND,e.id)),!1;const{id:s,...u}=e,d={...u,id:i?Ao(t):s,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.splice(n.indexOf(a),1,d),d}function li(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const a=e[r];if(!Le(a)){n(new ge(fe.NODE_INVALID,a==null?void 0:a.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=Es(a,t(a.id),a.parentNode);a.parentNode&&(o[a.parentNode]=!0),i[r]=s}for(const r of i){const a=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!a&&n(new ge(fe.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),a&&(a.isParent=!0))}return i}function ai(e,t){e.clear();for(const n of t){const{id:o,source:i,target:r,sourceHandle:a=null,targetHandle:s=null}=n,u=`${i}-source-${a}`,d=`${r}-target-${s}`,c=e.get(u)||new Map,f=e.get(d)||new Map,h=l.markRaw({edgeId:o,source:i,target:r,sourceHandle:a,targetHandle:s});e.set(u,c.set(`${r}-${s}`,h)),e.set(d,f.set(`${i}-${a}`,h))}}function si(e,t,n,o,i,r,a,s){const u=[];for(const d of e){const c=Pe(d)?d:Hs(d,s,i,r);if(!c)continue;const f=n(c.source),h=n(c.target);if(!f||!h){i(new ge(fe.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!f){i(new ge(fe.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!h){i(new ge(fe.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:s,nodes:a,sourceNode:f,targetNode:h})){i(new ge(fe.EDGE_INVALID,c.id));continue}const p=o(c.id);u.push({...Vo(c,p,r),sourceNode:f,targetNode:h})}return u}const ui=Symbol("vueFlow"),ci=Symbol("nodeId"),di=Symbol("nodeRef"),Fs=Symbol("edgeId"),Ys=Symbol("edgeRef"),Rt=Symbol("slots");function fi(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:a,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:d,autoPanSpeed:c,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:E,nodesSelectionActive:b,selectNodesOnDrag:x,removeSelectedElements:S,addSelectedNodes:M,updateNodePositions:_,emits:C}=de(),{onStart:z,onDrag:X,onStop:F,onClick:T,el:D,disabled:$,id:O,selectable:N,dragHandle:Q}=e,w=l.ref(!1);let I=[],k,B=null,V={x:void 0,y:void 0},A={x:0,y:0},R=null,U=!1,j=0,G=!1;const H=Us(),q=({x:K,y:J})=>{V={x:K,y:J};let ne=!1;if(I=I.map(y=>{const g={x:K-y.distance.x,y:J-y.distance.y};n.value&&(g.x=o.value[0]*Math.round(g.x/o.value[0]),g.y=o.value[1]*Math.round(g.y/o.value[1]));const{computedPosition:m}=bn(y,g,C.error,a.value,y.parentNode?p(y.parentNode):void 0);return ne=ne||y.position.x!==m.x||y.position.y!==m.y,y.position=m,y}),!!ne&&(_(I,!0,!0),w.value=!0,R)){const[y,g]=_n({id:O,dragItems:I,findNode:p});X({event:R,node:y,nodes:g})}},le=()=>{if(!B)return;const[K,J]=Uo(A,B,c.value);if(K!==0||J!==0){const ne={x:(V.x??0)-K/u.value.zoom,y:(V.y??0)-J/u.value.zoom};h({x:K,y:J})&&q(ne)}j=requestAnimationFrame(le)},ie=(K,J)=>{U=!0;const ne=p(O);!x.value&&!E.value&&ne&&(ne.selected||S()),ne&&l.toValue(N)&&x.value&&Nn(ne,E.value,M,S,b,!1,J);const y=H(K);if(V=y,I=Is(r.value,f.value,y,p,O),I.length){const[g,m]=_n({id:O,dragItems:I,findNode:p});z({event:K.sourceEvent,node:g,nodes:m})}},ae=(K,J)=>{var ne;K.sourceEvent.type==="touchmove"&&K.sourceEvent.touches.length>1||(s.value===0&&ie(K,J),V=H(K),B=((ne=t.value)==null?void 0:ne.getBoundingClientRect())||null,A=Be(K.sourceEvent,B))},te=(K,J)=>{const ne=H(K);if(!G&&U&&d.value&&(G=!0,le()),!U){const y=ne.xSnapped-(V.x??0),g=ne.ySnapped-(V.y??0);Math.sqrt(y*y+g*g)>s.value&&ie(K,J)}(V.x!==ne.xSnapped||V.y!==ne.ySnapped)&&I.length&&U&&(R=K.sourceEvent,A=Be(K.sourceEvent,B),q(ne))},oe=K=>{if(!U&&!w.value&&!E.value){const J=H(K),ne=J.xSnapped-(V.x??0),y=J.ySnapped-(V.y??0),g=Math.sqrt(ne*ne+y*y);g!==0&&g<=s.value&&(T==null||T(K.sourceEvent));return}if(w.value=!1,G=!1,U=!1,V={x:void 0,y:void 0},cancelAnimationFrame(j),I.length){_(I,!1,!1);const[J,ne]=_n({id:O,dragItems:I,findNode:p});F({event:K.sourceEvent,node:J,nodes:ne})}};return l.watch([()=>l.toValue($),D],([K,J],ne,y)=>{if(J){const g=ye(J);K||(k=Cl().on("start",m=>ae(m,J)).on("drag",m=>te(m,J)).on("end",m=>oe(m)).filter(m=>{const v=m.target,P=l.toValue(Q);return!m.button&&(!i.value||!Jo(v,`.${i.value}`,J)&&(!P||Jo(v,P,J)))}),g.call(k)),y(()=>{g.on(".drag",null),k&&(k.on("start",null),k.on("drag",null),k.on("end",null))})}}),w}function Gs(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),updateStart:L(),update:L(),updateEnd:L()}}function Xs(e,t){const n=Gs();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 Us(){const{viewport:e,snapGrid:t,snapToGrid:n}=de();return({sourceEvent:o})=>{const i=o.touches?o.touches[0].clientX:o.clientX,r=o.touches?o.touches[0].clientY:o.clientY,a={x:(i-e.value.x)/e.value.zoom,y:(r-e.value.y)/e.value.zoom};return{xSnapped:n.value?t.value[0]*Math.round(a.x/t.value[0]):a.x,ySnapped:n.value?t.value[1]*Math.round(a.y/t.value[1]):a.y,...a}}}function Ht(){return!0}function hi({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:a}){const{vueFlowRef:s,connectionMode:u,connectionRadius:d,connectOnClick:c,connectionClickStartHandle:f,nodesConnectable:h,autoPanOnConnect:p,autoPanSpeed:E,findNode:b,panBy:x,startConnection:S,updateConnection:M,endConnection:_,emits:C,viewport:z,edges:X,nodes:F,isValidConnection:T}=de();let D=null,$=!1,O=null,N=null;function Q(I){var k;const B=l.toValue(n)==="target",V=En(I),A=Do(I.target);if(V&&I.button===0||!V){let R=function(m){J=Be(m,oe);const{handle:v,validHandleResult:P}=Os(m,A,Vt(J,z.value,!1,[1,1]),d.value,y,Z=>oi(m,Z,u.value,l.toValue(t),l.toValue(e),B?"target":"source",G,A,X.value,F.value,b));if(H=v,ne||(g(),ne=!0),D=P.connection,$=P.isValid,O=P.handleDomNode,!($&&H&&(N!=null&&N.endHandle)&&P.endHandle&&N.endHandle.type===P.endHandle.type&&N.endHandle.nodeId===P.endHandle.nodeId&&N.endHandle.handleId===P.endHandle.handleId)){if(M(H&&$?zo({x:H.x,y:H.y},z.value):J,P.endHandle,zs(!!H,$)),N=P,!H&&!$&&!O)return xn(K);D&&D.source!==D.target&&O&&(xn(K),K=O,O.classList.add("connecting","vue-flow__handle-connecting"),O.classList.toggle("valid",$),O.classList.toggle("vue-flow__handle-valid",$))}},U=function(m){(H||O)&&D&&$&&(r?r(m,D):C.connect(D)),C.connectEnd(m),i&&(a==null||a(m)),xn(K),cancelAnimationFrame(q),_(m),ne=!1,$=!1,D=null,O=null,A.removeEventListener("mousemove",R),A.removeEventListener("mouseup",U),A.removeEventListener("touchmove",R),A.removeEventListener("touchend",U)};const j=b(l.toValue(t));let G=l.toValue(o)||T.value||Ht;!G&&j&&(G=(B?j.isValidSourcePos:j.isValidTargetPos)||Ht);let H,q=0;const{x:le,y:ie}=Be(I),ae=A==null?void 0:A.elementFromPoint(le,ie),te=Sn(l.toValue(i),ae),oe=(k=s.value)==null?void 0:k.getBoundingClientRect();if(!oe||!te)return;let K,J=Be(I,oe),ne=!1;const y=As({nodes:F.value,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:te}),g=()=>{if(!p.value)return;const[m,v]=Uo(J,oe,E.value);x({x:m,y:v}),q=requestAnimationFrame(g)};S({nodeId:l.toValue(t),handleId:l.toValue(e),type:te,position:(ae==null?void 0:ae.getAttribute("data-handlepos"))||Y.Top},{x:le-oe.left,y:ie-oe.top}),C.connectStart({event:I,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:te}),A.addEventListener("mousemove",R),A.addEventListener("mouseup",U),A.addEventListener("touchmove",R),A.addEventListener("touchend",U)}}function w(I){if(!c.value)return;const k=l.toValue(n)==="target";if(!f.value)C.clickConnectStart({event:I,nodeId:l.toValue(t),handleId:l.toValue(e)}),S({nodeId:l.toValue(t),type:l.toValue(n),handleId:l.toValue(e)},void 0,!0);else{let B=l.toValue(o)||T.value||Ht;const V=b(l.toValue(t));if(!B&&V&&(B=(k?V.isValidSourcePos:V.isValidTargetPos)||Ht),V&&(typeof V.connectable>"u"?h.value:V.connectable)===!1)return;const A=Do(I.target),{connection:R,isValid:U}=oi(I,{nodeId:l.toValue(t),id:l.toValue(e),type:l.toValue(n)},u.value,f.value.nodeId,f.value.handleId||null,f.value.type,B,A,X.value,F.value,b),j=R.source===R.target;U&&!j&&C.connect(R),C.clickConnectEnd(I),_(I,!0)}}return{handlePointerDown:Q,handleClick:w}}function Zs(){return l.inject(ci,"")}function gi(e){const t=e??Zs()??"",n=l.inject(di,l.ref(null)),{findNode:o,edges:i,emits:r}=de(),a=o(t);return a||r.error(new ge(fe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:a,parentNode:l.computed(()=>o(a.parentNode)),connectedEdges:l.computed(()=>Fo([a],i.value))}}function Ks(){return{doubleClick:L(),click:L(),mouseEnter:L(),mouseMove:L(),mouseLeave:L(),contextMenu:L(),dragStart:L(),drag:L(),dragStop:L()}}function Ws(e,t){const n=Ks();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 pi(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:a,emits:s}=de();return(u,d=!1)=>{const c=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=d?4:1,p=u.x*c*h,E=u.y*f*h,b=[];for(const x of e.value)if(x.draggable||a&&typeof x.draggable>"u"){const S={x:x.computedPosition.x+p,y:x.computedPosition.y+E},{computedPosition:M}=bn(x,S,s.error,t.value,x.parentNode?o(x.parentNode):void 0);b.push({id:x.id,position:M,from:x.position,distance:{x:u.x,y:u.y},dimensions:x.dimensions})}n(b,!0,!1)}}const Cn=.1;function De(){return zt("Viewport not initialized yet."),Promise.resolve(!1)}const qs={zoomIn:De,zoomOut:De,zoomTo:De,fitView:De,setCenter:De,fitBounds:De,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:De,setTransform:De,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Js(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(kn(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,a){return new Promise(s=>{const{x:u,y:d}=Bo({x:-o,y:-i},e.translateExtent),c=Ke.translate(-u,-d).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(kn(e.d3Selection,a,()=>{s(!0)}),c):s(!1)})}return l.computed(()=>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(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(kn(e.d3Selection,r==null?void 0:r.duration,()=>{a(!0)}),i):a(!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:Cn,includeHiddenNodes:!1,duration:0})=>{var r,a;const s=[];for(const h of e.nodes)h.dimensions.width&&h.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!h.hidden)&&(!((r=i.nodes)!=null&&r.length)||(a=i.nodes)!=null&&a.length&&i.nodes.includes(h.id))&&s.push(h);if(!s.length)return Promise.resolve(!1);const u=Ho(s),{x:d,y:c,zoom:f}=Yo(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??Cn,i.offset);return n(d,c,f,i==null?void 0:i.duration)},setCenter:(i,r,a)=>{const s=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,d=e.dimensions.height/2-r*s;return n(u,d,s,a==null?void 0:a.duration)},fitBounds:(i,r={padding:Cn})=>{const{x:a,y:s,zoom:u}=Yo(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(a,s,u,r==null?void 0:r.duration)},project:i=>Vt(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-a};return Vt(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+a};return zo(s,e.viewport)}return{x:0,y:0}}}:qs)}function kn(e,t=0,n){return e.transition().duration(t).on("end",n)}function js(e,t,n){const o=l.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let b,x,S=!!(n.nodes.value.length||n.edges.value.length);b=Ye([e.modelValue,()=>{var M,_;return(_=(M=e.modelValue)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(x==null||x.pause(),n.setElements(M),!x&&!S&&M.length?S=!0:x==null||x.resume())}),x=Ye([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,_])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...M,..._],l.nextTick(()=>{b==null||b.resume()}))},{immediate:S}),l.onScopeDispose(()=>{b==null||b.stop(),x==null||x.stop()})})},r=()=>{o.run(()=>{let b,x,S=!!n.nodes.value.length;b=Ye([e.nodes,()=>{var M,_;return(_=(M=e.nodes)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(x==null||x.pause(),n.setNodes(M),!x&&!S&&M.length?S=!0:x==null||x.resume())}),x=Ye([n.nodes,()=>n.nodes.value.length],([M])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...M],l.nextTick(()=>{b==null||b.resume()}))},{immediate:S}),l.onScopeDispose(()=>{b==null||b.stop(),x==null||x.stop()})})},a=()=>{o.run(()=>{let b,x,S=!!n.edges.value.length;b=Ye([e.edges,()=>{var M,_;return(_=(M=e.edges)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(x==null||x.pause(),n.setEdges(M),!x&&!S&&M.length?S=!0:x==null||x.resume())}),x=Ye([n.edges,()=>n.edges.value.length],([M])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...M],l.nextTick(()=>{b==null||b.resume()}))},{immediate:S}),l.onScopeDispose(()=>{b==null||b.stop(),x==null||x.stop()})})},s=()=>{o.run(()=>{l.watch(()=>t.maxZoom,()=>{t.maxZoom&&he(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{l.watch(()=>t.minZoom,()=>{t.minZoom&&he(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},d=()=>{o.run(()=>{l.watch(()=>t.translateExtent,()=>{t.translateExtent&&he(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{l.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&he(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{l.watch(()=>t.applyDefault,()=>{he(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const b=async x=>{let S=x;typeof t.autoConnect=="function"&&(S=await t.autoConnect(x)),S!==!1&&n.addEdges([S])};l.watch(()=>t.autoConnect,()=>{he(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),l.watch(n.autoConnect,(x,S,M)=>{x?n.onConnect(b):n.hooks.value.connect.off(b),M(()=>{n.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const x of Object.keys(t)){const S=x;if(!b.includes(S)){const M=l.toRef(()=>t[S]),_=n[S];l.isRef(_)&&o.run(()=>{l.watch(M,C=>{he(C)&&(_.value=C)},{immediate:!0})})}}};(()=>{i(),r(),a(),u(),s(),d(),c(),f(),h(),p()})()}),()=>o.stop()}function Qs(){return{edgesChange:L(),nodesChange:L(),nodeDoubleClick:L(),nodeClick:L(),nodeMouseEnter:L(),nodeMouseMove:L(),nodeMouseLeave:L(),nodeContextMenu:L(),nodeDragStart:L(),nodeDrag:L(),nodeDragStop:L(),nodesInitialized:L(),miniMapNodeClick:L(),miniMapNodeDoubleClick:L(),miniMapNodeMouseEnter:L(),miniMapNodeMouseMove:L(),miniMapNodeMouseLeave:L(),connect:L(),connectStart:L(),connectEnd:L(),clickConnectStart:L(),clickConnectEnd:L(),paneReady:L(),init:L(),move:L(),moveStart:L(),moveEnd:L(),selectionDragStart:L(),selectionDrag:L(),selectionDragStop:L(),selectionContextMenu:L(),selectionStart:L(),selectionEnd:L(),viewportChangeStart:L(),viewportChange:L(),viewportChangeEnd:L(),paneScroll:L(),paneClick:L(),paneContextMenu:L(),paneMouseEnter:L(),paneMouseMove:L(),paneMouseLeave:L(),edgeContextMenu:L(),edgeMouseEnter:L(),edgeMouseMove:L(),edgeMouseLeave:L(),edgeDoubleClick:L(),edgeClick:L(),edgeUpdateStart:L(),edgeUpdate:L(),edgeUpdateEnd:L(),updateNodeInternals:L(),error:L(e=>zt(e.message))}}function eu(e,t){l.onBeforeMount(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),ht(()=>{o.off(i)})}})}function mi(){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:gn.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:st.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:ze.Bezier,style:{}},connectionMode:Re.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:At()?"Meta":"Control",zoomActivationKeyCode:At()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Qs(),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 tu=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function nu(e,t,n){const o=Js(e),i=y=>{const g=y??[];e.hooks.updateNodeInternals.trigger(g)},r=y=>Ss(y,e.nodes,e.edges),a=y=>xs(y,e.nodes,e.edges),s=y=>Fo(y,e.edges),u=({id:y,type:g,nodeId:m})=>{var v;return Array.from(((v=e.connectionLookup.get(`${m}-${g}-${y??null}`))==null?void 0:v.values())??[])},d=y=>{if(y)return t.value.get(y)},c=y=>{if(y)return n.value.get(y)},f=(y,g,m)=>{var v,P;const Z=[];for(const W of y){const ee={id:W.id,type:"position",dragging:m,from:W.from};if(g&&(ee.position=W.position,W.parentNode)){const re=d(W.parentNode);ee.position={x:ee.position.x-(((v=re==null?void 0:re.computedPosition)==null?void 0:v.x)??0),y:ee.position.y-(((P=re==null?void 0:re.computedPosition)==null?void 0:P.y)??0)}}Z.push(ee)}Z!=null&&Z.length&&e.hooks.nodesChange.trigger(Z)},h=y=>{if(!e.vueFlowRef)return;const g=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!g)return;const m=window.getComputedStyle(g),{m22:v}=new window.DOMMatrixReadOnly(m.transform),P=[];for(let Z=0;Z<y.length;++Z){const W=y[Z],ee=d(W.id);if(ee){const re=Bt(W.nodeElement);if(!!(re.width&&re.height&&(ee.dimensions.width!==re.width||ee.dimensions.height!==re.height||W.forceUpdate))){const ue=W.nodeElement.getBoundingClientRect();ee.dimensions=re,ee.handleBounds.source=ri(".source",W.nodeElement,ue,v),ee.handleBounds.target=ri(".target",W.nodeElement,ue,v),P.push({id:ee.id,type:"dimensions",dimensions:re})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),P.length&&e.hooks.nodesChange.trigger(P)},p=(y,g)=>{const m=new Set,v=new Set;for(const W of y)Le(W)?m.add(W.id):Pe(W)&&v.add(W.id);const P=Te(t.value,m,!0),Z=Te(n.value,v);if(e.multiSelectionActive){for(const W of m)P.push($e(W,g));for(const W of v)Z.push($e(W,g))}P.length&&e.hooks.nodesChange.trigger(P),Z.length&&e.hooks.edgesChange.trigger(Z)},E=y=>{if(e.multiSelectionActive){const g=y.map(m=>$e(m.id,!0));e.hooks.nodesChange.trigger(g);return}e.hooks.nodesChange.trigger(Te(t.value,new Set(y.map(g=>g.id)),!0)),e.hooks.edgesChange.trigger(Te(n.value))},b=y=>{if(e.multiSelectionActive){const g=y.map(m=>$e(m.id,!0));e.hooks.edgesChange.trigger(g);return}e.hooks.edgesChange.trigger(Te(n.value,new Set(y.map(g=>g.id)))),e.hooks.nodesChange.trigger(Te(t.value,new Set,!0))},x=y=>{p(y,!0)},S=y=>{const m=(y||e.nodes).map(v=>(v.selected=!1,$e(v.id,!1)));e.hooks.nodesChange.trigger(m)},M=y=>{const m=(y||e.edges).map(v=>(v.selected=!1,$e(v.id,!1)));e.hooks.edgesChange.trigger(m)},_=y=>{if(!y||!y.length)return p([],!1);const g=y.reduce((m,v)=>{const P=$e(v.id,!1);return Le(v)?m.nodes.push(P):m.edges.push(P),m},{nodes:[],edges:[]});g.nodes.length&&e.hooks.nodesChange.trigger(g.nodes),g.edges.length&&e.hooks.edgesChange.trigger(g.edges)},C=y=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([y,e.maxZoom]),e.minZoom=y},z=y=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([e.minZoom,y]),e.maxZoom=y},X=y=>{var g;(g=e.d3Zoom)==null||g.translateExtent(y),e.translateExtent=y},F=y=>{e.nodeExtent=y,i()},T=y=>{var g;(g=e.d3Zoom)==null||g.clickDistance(y)},D=y=>{e.nodesDraggable=y,e.nodesConnectable=y,e.elementsSelectable=y},$=y=>{const g=y instanceof Function?y(e.nodes):y;!e.initialized&&!g.length||(e.nodes=li(g,d,e.hooks.error.trigger))},O=y=>{const g=y instanceof Function?y(e.edges):y;if(!e.initialized&&!g.length)return;const m=si(g,e.isValidConnection,d,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ai(e.connectionLookup,m),e.edges=m},N=y=>{const g=y instanceof Function?y([...e.nodes,...e.edges]):y;!e.initialized&&!g.length||($(g.filter(Le)),O(g.filter(Pe)))},Q=y=>{let g=y instanceof Function?y(e.nodes):y;g=Array.isArray(g)?g:[g];const m=li(g,d,e.hooks.error.trigger),v=[];for(const P of m)v.push(Ko(P));v.length&&e.hooks.nodesChange.trigger(v)},w=y=>{let g=y instanceof Function?y(e.edges):y;g=Array.isArray(g)?g:[g];const m=si(g,e.isValidConnection,d,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),v=[];for(const P of m)v.push(Ko(P));v.length&&e.hooks.edgesChange.trigger(v)},I=(y,g=!0,m=!1)=>{const v=y instanceof Function?y(e.nodes):y,P=Array.isArray(v)?v:[v],Z=[],W=[];function ee(se){const ue=s(se);for(const ce of ue)(!he(ce.deletable)||ce.deletable)&&W.push(qo(ce.id,ce.source,ce.target,ce.sourceHandle,ce.targetHandle))}function re(se){const ue=[];for(const ce of e.nodes)ce.parentNode===se&&ue.push(ce);if(ue.length){for(const ce of ue)Z.push(Wo(ce.id));g&&ee(ue);for(const ce of ue)re(ce.id)}}for(const se of P){const ue=typeof se=="string"?d(se):se;ue&&(he(ue.deletable)&&!ue.deletable||(Z.push(Wo(ue.id)),g&&ee([ue]),m&&re(ue.id)))}W.length&&e.hooks.edgesChange.trigger(W),Z.length&&e.hooks.nodesChange.trigger(Z)},k=y=>{const g=y instanceof Function?y(e.edges):y,m=Array.isArray(g)?g:[g],v=[];for(const P of m){const Z=typeof P=="string"?c(P):P;Z&&(he(Z.deletable)&&!Z.deletable||v.push(qo(typeof P=="string"?P:P.id,Z.source,Z.target,Z.sourceHandle,Z.targetHandle)))}e.hooks.edgesChange.trigger(v)},B=(y,g,m=!0)=>Ls(y,g,e.edges,c,m,e.hooks.error.trigger),V=(y,g,m={replace:!1})=>{const v=c(y);if(!v)return;const P=typeof g=="function"?g(v):g;v.data=m.replace?P:{...v.data,...P}},A=y=>Zo(y,e.nodes),R=y=>{const g=Zo(y,e.edges);return ai(e.connectionLookup,g),g},U=(y,g,m={replace:!1})=>{const v=d(y);if(!v)return;const P=typeof g=="function"?g(v):g;m.replace?e.nodes.splice(e.nodes.indexOf(v),1,P):Object.assign(v,P)},j=(y,g,m={replace:!1})=>{const v=d(y);if(!v)return;const P=typeof g=="function"?g(v):g;v.data=m.replace?P:{...v.data,...P}},G=(y,g,m=!1)=>{m?e.connectionClickStartHandle=y:e.connectionStartHandle=y,e.connectionEndHandle=null,e.connectionStatus=null,g&&(e.connectionPosition=g)},H=(y,g=null,m=null)=>{e.connectionStartHandle&&(e.connectionPosition=y,e.connectionEndHandle=g,e.connectionStatus=m)},q=(y,g)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,g?e.connectionClickStartHandle=null:e.connectionStartHandle=null},le=y=>{const g=bs(y),m=g?null:ct(y)?y:d(y.id);return!g&&!m?[null,null,g]:[g?y:yn(m),m,g]},ie=(y,g=!0,m=e.nodes)=>{const[v,P,Z]=le(y);if(!v)return[];const W=[];for(const ee of m||e.nodes){if(!Z&&(ee.id===P.id||!ee.computedPosition))continue;const re=yn(ee),se=vn(re,v);(g&&se>0||se>=Number(v.width)*Number(v.height))&&W.push(ee)}return W},ae=(y,g,m=!0)=>{const[v]=le(y);if(!v)return!1;const P=vn(v,g);return m&&P>0||P>=Number(v.width)*Number(v.height)},te=y=>{const{viewport:g,dimensions:m,d3Zoom:v,d3Selection:P,translateExtent:Z}=e;if(!v||!P||!y.x&&!y.y)return!1;const W=Ke.translate(g.x+y.x,g.y+y.y).scale(g.zoom),ee=[[0,0],[m.width,m.height]],re=v.constrain()(W,ee,Z),se=e.viewport.x!==re.x||e.viewport.y!==re.y||e.viewport.zoom!==re.k;return v.transform(P,re),se},oe=y=>{const g=y instanceof Function?y(e):y,m=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];he(g.defaultEdgeOptions)&&(e.defaultEdgeOptions=g.defaultEdgeOptions);const v=g.modelValue||g.nodes||g.edges?[]:void 0;v&&(g.modelValue&&v.push(...g.modelValue),g.nodes&&v.push(...g.nodes),g.edges&&v.push(...g.edges),N(v));const P=()=>{he(g.maxZoom)&&z(g.maxZoom),he(g.minZoom)&&C(g.minZoom),he(g.translateExtent)&&X(g.translateExtent)};for(const Z of Object.keys(g)){const W=Z,ee=g[W];![...tu,...m].includes(W)&&he(ee)&&(e[W]=ee)}Zt(()=>e.d3Zoom).not.toBeNull().then(P),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:N,setNodes:$,setEdges:O,addNodes:Q,addEdges:w,removeNodes:I,removeEdges:k,findNode:d,findEdge:c,updateEdge:B,updateEdgeData:V,updateNode:U,updateNodeData:j,applyEdgeChanges:R,applyNodeChanges:A,addSelectedElements:x,addSelectedNodes:E,addSelectedEdges:b,setMinZoom:C,setMaxZoom:z,setTranslateExtent:X,setNodeExtent:F,setPaneClickDistance:T,removeSelectedElements:_,removeSelectedNodes:S,removeSelectedEdges:M,startConnection:G,updateConnection:H,endConnection:q,setInteractive:D,setState:oe,getIntersectingNodes:ie,getIncomers:r,getOutgoers:a,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:ae,panBy:te,fitView:y=>o.value.fitView(y),zoomIn:y=>o.value.zoomIn(y),zoomOut:y=>o.value.zoomOut(y),zoomTo:(y,g)=>o.value.zoomTo(y,g),setViewport:(y,g)=>o.value.setViewport(y,g),setTransform:(y,g)=>o.value.setTransform(y,g),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(y,g,m)=>o.value.setCenter(y,g,m),fitBounds:(y,g)=>o.value.fitBounds(y,g),project:y=>o.value.project(y),screenToFlowCoordinate:y=>o.value.screenToFlowCoordinate(y),flowToScreenCoordinate:y=>o.value.flowToScreenCoordinate(y),toObject:()=>{const y=[],g=[];for(const m of e.nodes){const{computedPosition:v,handleBounds:P,selected:Z,dimensions:W,isParent:ee,resizing:re,dragging:se,events:ue,...ce}=m;y.push(ce)}for(const m of e.edges){const{selected:v,sourceNode:P,targetNode:Z,events:W,...ee}=m;g.push(ee)}return JSON.parse(JSON.stringify({nodes:y,edges:g,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:y=>new Promise(g=>{const{nodes:m,edges:v,position:P,zoom:Z,viewport:W}=y;if(m&&$(m),v&&O(v),W!=null&&W.x&&(W!=null&&W.y)||P){const ee=(W==null?void 0:W.x)||P[0],re=(W==null?void 0:W.y)||P[1],se=(W==null?void 0:W.zoom)||Z||e.viewport.zoom;return Zt(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:ee,y:re,zoom:se}).then(()=>{g(!0)})})}else g(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const y=mi();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const g=Ke.translate(y.defaultViewport.x??0,y.defaultViewport.y??0).scale(He(y.defaultViewport.zoom??1,y.minZoom,y.maxZoom)),m=e.viewportRef.getBoundingClientRect(),v=[[0,0],[m.width,m.height]],P=e.d3Zoom.constrain()(g,v,y.translateExtent);e.d3Zoom.transform(e.d3Selection,P)}oe(y)},$destroy:()=>{}}}const ou=["data-id","data-handleid","data-nodeid","data-handlepos"],iu={name:"Handle",compatConfig:{MODE:3}},qe=l.defineComponent({...iu,props:{id:{default:null},type:{},position:{default:()=>Y.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=l.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),o=l.toRef(()=>n.type??"source"),i=l.toRef(()=>n.isValidConnection??null),{connectionStartHandle:r,connectionClickStartHandle:a,connectionEndHandle:s,vueFlowRef:u,nodesConnectable:d,noDragClassName:c,noPanClassName:f}=de(),{id:h,node:p,nodeEl:E,connectedEdges:b}=gi(),x=l.ref(),S=l.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),M=l.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),_=l.toRef(()=>{var $,O,N,Q,w,I;return(($=r.value)==null?void 0:$.nodeId)===h&&((O=r.value)==null?void 0:O.handleId)===e.id&&((N=r.value)==null?void 0:N.type)===o.value||((Q=s.value)==null?void 0:Q.nodeId)===h&&((w=s.value)==null?void 0:w.handleId)===e.id&&((I=s.value)==null?void 0:I.type)===o.value}),C=l.toRef(()=>{var $,O,N;return(($=a.value)==null?void 0:$.nodeId)===h&&((O=a.value)==null?void 0:O.handleId)===e.id&&((N=a.value)==null?void 0:N.type)===o.value}),{handlePointerDown:z,handleClick:X}=hi({nodeId:h,handleId:e.id,isValidConnection:i,type:o}),F=l.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!b.value.some($=>{const O=$[`${o.value}Handle`];return $[o.value]!==h?!1:O?O===e.id:!0}):typeof e.connectable=="number"?b.value.filter($=>{const O=$[`${o.value}Handle`];return $[o.value]!==h?!1:O?O===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(p,b.value):he(e.connectable)?e.connectable:d.value);l.onMounted(()=>{var $;if(!p.dimensions.width||!p.dimensions.height)return;const O=($=p.handleBounds[o.value])==null?void 0:$.find(V=>V.id===e.id);if(!u.value||O)return;const N=u.value.querySelector(".vue-flow__transformationpane");if(!E.value||!x.value||!N||!e.id)return;const Q=E.value.getBoundingClientRect(),w=x.value.getBoundingClientRect(),I=window.getComputedStyle(N),{m22:k}=new window.DOMMatrixReadOnly(I.transform),B={id:e.id,position:e.position,x:(w.left-Q.left)/k,y:(w.top-Q.top)/k,...Bt(x.value)};p.handleBounds[o.value]=[...p.handleBounds[o.value]??[],B]}),l.onUnmounted(()=>{const $=p.handleBounds[o.value];$&&(p.handleBounds[o.value]=$.filter(O=>O.id!==e.id))});function T($){const O=En($);F.value&&S.value&&(O&&$.button===0||!O)&&z($)}function D($){!h||!a.value&&!S.value||F.value&&X($)}return t({handleClick:X,handlePointerDown:z,onClick:D,onPointerDown:T}),($,O)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"handle",ref:x,"data-id":`${l.unref(h)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":l.unref(h),"data-handlepos":$.position,class:l.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${$.position}`,`vue-flow__handle-${e.id}`,l.unref(c),l.unref(f),o.value,{connectable:F.value,connecting:C.value,connectablestart:S.value,connectableend:M.value,connectionindicator:F.value&&(S.value&&!_.value||M.value&&_.value)}]]),onMousedown:T,onTouchstartPassive:T,onClick:D},[l.renderSlot($.$slots,"default",{id:$.id})],42,ou))}}),Lt=function({sourcePosition:e=Y.Bottom,targetPosition:t=Y.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:a}){const s=a.label||n;return[l.h(qe,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?l.h(s):l.h("div",{innerHTML:s}),l.h(qe,{type:"source",position:e,connectable:o,isValidConnection:r})]};Lt.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Lt.inheritAttrs=!1,Lt.compatConfig={MODE:3};const ru=Lt,Ft=function({targetPosition:e=Y.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[l.h(qe,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?l.h(r):l.h("div",{innerHTML:r})]};Ft.props=["targetPosition","label","isValidTargetPos","connectable","data"],Ft.inheritAttrs=!1,Ft.compatConfig={MODE:3};const lu=Ft,Yt=function({sourcePosition:e=Y.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?l.h(r):l.h("div",{innerHTML:r}),l.h(qe,{type:"source",position:e,connectable:n,isValidConnection:o})]};Yt.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Yt.inheritAttrs=!1,Yt.compatConfig={MODE:3};const au=Yt,su=["transform"],uu=["width","height","x","y","rx","ry"],cu=["y"],du={name:"EdgeText",compatConfig:{MODE:3}},fu=l.defineComponent({...du,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=l.ref({x:0,y:0,width:0,height:0}),n=l.ref(null),o=l.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);l.onMounted(i),l.watch([()=>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,a)=>(l.openBlock(),l.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(l.openBlock(),l.createElementBlock("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:l.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,uu)):l.createCommentVNode("",!0),l.createElementVNode("text",l.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[l.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.label),{key:0})):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(r.label),1)],64))])],16,cu)],8,su))}}),hu=["id","d","marker-end","marker-start"],gu=["d","stroke-width"],pu={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Gt=l.defineComponent({...pu,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=l.createPropsRestProxy(e,["interactionWidth","labelShowBg"]),o=l.ref(null),i=l.ref(null),r=l.ref(null),a=l.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:r}),(s,u)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("path",{id:s.id,ref_key:"pathEl",ref:o,d:s.path,style:l.normalizeStyle(n.style),class:l.normalizeClass(["vue-flow__edge-path",l.unref(a).class]),"marker-end":s.markerEnd,"marker-start":s.markerStart},null,14,hu),s.interactionWidth?(l.openBlock(),l.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:s.path,"stroke-width":s.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,gu)):l.createCommentVNode("",!0),s.label&&s.labelX&&s.labelY?(l.openBlock(),l.createBlock(fu,{key:1,ref_key:"labelEl",ref:r,x:s.labelX,y:s.labelY,label:s.label,"label-show-bg":s.labelShowBg,"label-bg-style":s.labelBgStyle,"label-bg-padding":s.labelBgPadding,"label-bg-border-radius":s.labelBgBorderRadius,"label-style":s.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):l.createCommentVNode("",!0)],64))}});function yi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,a=Math.abs(o-t)/2,s=o<t?o+a:o-a;return[r,s,i,a]}function vi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:s}){const u=e*.125+i*.375+a*.375+n*.125,d=t*.125+r*.375+s*.375+o*.125,c=Math.abs(u-e),f=Math.abs(d-t);return[u,d,c,f]}function Xt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function wi({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let a,s;switch(e){case Y.Left:a=t-Xt(t-o,r),s=n;break;case Y.Right:a=t+Xt(o-t,r),s=n;break;case Y.Top:a=t,s=n-Xt(n-i,r);break;case Y.Bottom:a=t,s=n+Xt(i-n,r);break}return[a,s]}function Mn(e){const{sourceX:t,sourceY:n,sourcePosition:o=Y.Bottom,targetX:i,targetY:r,targetPosition:a=Y.Top,curvature:s=.25}=e,[u,d]=wi({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[c,f]=wi({pos:a,x1:i,y1:r,x2:t,y2:n,c:s}),[h,p,E,b]=vi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:d,targetControlX:c,targetControlY:f});return[`M${t},${n} C${u},${d} ${c},${f} ${i},${r}`,h,p,E,b]}function _i({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,a;switch(e){case Y.Left:case Y.Right:r=.5*(t+o),a=n;break;case Y.Top:case Y.Bottom:r=t,a=.5*(n+i);break}return[r,a]}function bi(e){const{sourceX:t,sourceY:n,sourcePosition:o=Y.Bottom,targetX:i,targetY:r,targetPosition:a=Y.Top}=e,[s,u]=_i({pos:o,x1:t,y1:n,x2:i,y2:r}),[d,c]=_i({pos:a,x1:i,y1:r,x2:t,y2:n}),[f,h,p,E]=vi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:d,targetControlY:c});return[`M${t},${n} C${s},${u} ${d},${c} ${i},${r}`,f,h,p,E]}const Ei={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}};function mu({source:e,sourcePosition:t=Y.Bottom,target:n}){return t===Y.Left||t===Y.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 xi(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function yu({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:i,offset:r}){const a=Ei[t],s=Ei[o],u={x:e.x+a.x*r,y:e.y+a.y*r},d={x:n.x+s.x*r,y:n.y+s.y*r},c=mu({source:u,sourcePosition:t,target:d}),f=c.x!==0?"x":"y",h=c[f];let p,E,b;const x={x:0,y:0},S={x:0,y:0},[M,_,C,z]=yi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*s[f]===-1){E=i.x??M,b=i.y??_;const F=[{x:E,y:u.y},{x:E,y:d.y}],T=[{x:u.x,y:b},{x:d.x,y:b}];a[f]===h?p=f==="x"?F:T:p=f==="x"?T:F}else{const F=[{x:u.x,y:d.y}],T=[{x:d.x,y:u.y}];if(f==="x"?p=a.x===h?T:F:p=a.y===h?F:T,t===o){const Q=Math.abs(e[f]-n[f]);if(Q<=r){const w=Math.min(r-1,r-Q);a[f]===h?x[f]=(u[f]>e[f]?-1:1)*w:S[f]=(d[f]>n[f]?-1:1)*w}}if(t!==o){const Q=f==="x"?"y":"x",w=a[f]===s[Q],I=u[Q]>d[Q],k=u[Q]<d[Q];(a[f]===1&&(!w&&I||w&&k)||a[f]!==1&&(!w&&k||w&&I))&&(p=f==="x"?F:T)}const D={x:u.x+x.x,y:u.y+x.y},$={x:d.x+S.x,y:d.y+S.y},O=Math.max(Math.abs(D.x-p[0].x),Math.abs($.x-p[0].x)),N=Math.max(Math.abs(D.y-p[0].y),Math.abs($.y-p[0].y));O>=N?(E=(D.x+$.x)/2,b=p[0].y):(E=p[0].x,b=(D.y+$.y)/2)}return[[e,{x:u.x+x.x,y:u.y+x.y},...p,{x:d.x+S.x,y:d.y+S.y},n],E,b,C,z]}function vu(e,t,n,o){const i=Math.min(xi(e,t)/2,xi(t,n)/2,o),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a){const d=e.x<n.x?-1:1,c=e.y<n.y?1:-1;return`L ${r+i*d},${a}Q ${r},${a} ${r},${a+i*c}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${a+i*u}Q ${r},${a} ${r+i*s},${a}`}function In(e){const{sourceX:t,sourceY:n,sourcePosition:o=Y.Bottom,targetX:i,targetY:r,targetPosition:a=Y.Top,borderRadius:s=5,centerX:u,centerY:d,offset:c=20}=e,[f,h,p,E,b]=yu({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:a,center:{x:u,y:d},offset:c});return[f.reduce((S,M,_)=>{let C;return _>0&&_<f.length-1?C=vu(f[_-1],M,f[_+1],s):C=`${_===0?"M":"L"}${M.x} ${M.y}`,S+=C,S},""),h,p,E,b]}function wu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,a,s,u]=yi({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,a,s,u]}const _u=l.defineComponent({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]=wu(e);return l.h(Gt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Si=l.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=In({...e,sourcePosition:e.sourcePosition??Y.Bottom,targetPosition:e.targetPosition??Y.Top});return l.h(Gt,{path:n,labelX:o,labelY:i,...t,...e})}}}),bu=l.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>l.h(Si,{...e,...t,borderRadius:0})}}),Eu=l.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Mn({...e,sourcePosition:e.sourcePosition??Y.Bottom,targetPosition:e.targetPosition??Y.Top});return l.h(Gt,{path:n,labelX:o,labelY:i,...t,...e})}}}),xu=l.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=bi({...e,sourcePosition:e.sourcePosition??Y.Bottom,targetPosition:e.targetPosition??Y.Top});return l.h(Gt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Su={input:au,default:ru,output:lu},Nu={default:Eu,straight:_u,step:bu,smoothstep:Si,simplebezier:xu};function Cu(e,t,n){const o=l.computed(()=>b=>t.value.get(b)),i=l.computed(()=>b=>n.value.get(b)),r=l.computed(()=>{const b={...Nu,...e.edgeTypes},x=Object.keys(b);for(const S of e.edges)S.type&&!x.includes(S.type)&&(b[S.type]=S.type);return b}),a=l.computed(()=>{const b={...Su,...e.nodeTypes},x=Object.keys(b);for(const S of e.nodes)S.type&&!x.includes(S.type)&&(b[S.type]=S.type);return b}),s=l.computed(()=>e.onlyRenderVisibleElements?Lo(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=l.computed(()=>{if(e.onlyRenderVisibleElements){const b=[];for(const x of e.edges){const S=t.value.get(x.source),M=t.value.get(x.target);Bs({sourcePos:S.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:S.dimensions.width,sourceHeight:S.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(x)}return b}return e.edges}),d=l.computed(()=>[...s.value,...u.value]),c=l.computed(()=>{const b=[];for(const x of e.nodes)x.selected&&b.push(x);return b}),f=l.computed(()=>{const b=[];for(const x of e.edges)x.selected&&b.push(x);return b}),h=l.computed(()=>[...c.value,...f.value]),p=l.computed(()=>{const b=[];for(const x of e.nodes)x.dimensions.width&&x.dimensions.height&&x.handleBounds!==void 0&&b.push(x);return b}),E=l.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:d,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:s,getSelectedElements:h,getSelectedNodes:c,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:E}}class Fe{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=l.getCurrentInstance())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??Fe.instance;return Fe.instance=o??new Fe,n&&(n.config.globalProperties.$vueFlowStorage=Fe.instance),Fe.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=mi(),i=l.reactive(o),r={};for(const[h,p]of Object.entries(i.hooks)){const E=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[E]=p.on}const a={};for(const[h,p]of Object.entries(i.hooks))a[h]=p.trigger;const s=l.computed(()=>{const h=new Map;for(const p of i.nodes)h.set(p.id,p);return h}),u=l.computed(()=>{const h=new Map;for(const p of i.edges)h.set(p.id,p);return h}),d=Cu(i,s,u),c=nu(i,s,u);c.setState({...i,...n});const f={...r,...d,...c,...Vi(i),nodeLookup:s,edgeLookup:u,emits:a,id:t,vueFlowVersion:"1.41.2",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=Fe.getInstance(),n=l.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,a=r??(n==null?void 0:n.vueFlowId);let s;if(n){const u=l.inject(ui,null);typeof u<"u"&&u!==null&&(!a||u.id===a)&&(s=u)}if(s||a&&(s=t.get(a)),!s||a&&s.id!==a){const u=r??t.getId(),d=t.create(u,i);s=d,(n??l.effectScope(!0)).run(()=>{l.watch(d.applyDefault,(f,h,p)=>{const E=x=>{d.applyNodeChanges(x)},b=x=>{d.applyEdgeChanges(x)};f?(d.onNodesChange(E),d.onEdgesChange(b)):(d.hooks.value.nodesChange.off(E),d.hooks.value.edgesChange.off(b)),p(()=>{d.hooks.value.nodesChange.off(E),d.hooks.value.edgesChange.off(b)})},{immediate:!0}),ht(()=>{if(s){const f=t.get(s.id);f?f.$destroy():zt(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(l.provide(ui,s),n.vueFlowId=s.id),o){const u=l.getCurrentInstance();(u==null?void 0:u.type.name)!=="VueFlow"&&s.emits.error(new ge(fe.USEVUEFLOW_OPTIONS))}return s}function ku(e){const{emits:t,dimensions:n}=de();let o;l.onMounted(()=>{const i=e.value,r=()=>{if(!i)return;const a=Bt(i);(a.width===0||a.height===0)&&t.error(new ge(fe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:a.width||500,height:a.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),l.onBeforeUnmount(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const Mu={name:"UserSelection",compatConfig:{MODE:3}},Iu=l.defineComponent({...Mu,props:{userSelectionRect:{}},setup(e){return(t,n)=>(l.openBlock(),l.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:l.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Pu=["tabIndex"],$u={name:"NodesSelection",compatConfig:{MODE:3}},Tu=l.defineComponent({...$u,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:a}=de(),s=pi(),u=l.ref(null),d=fi({el:u,onStart(E){t.selectionDragStart(E)},onDrag(E){t.selectionDrag(E)},onStop(E){t.selectionDragStop(E)}});l.onMounted(()=>{var E;r.value||(E=u.value)==null||E.focus({preventScroll:!0})});const c=l.computed(()=>Ho(o.value)),f=l.computed(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function h(E){t.selectionContextMenu({event:E,nodes:o.value})}function p(E){r||We[E.key]&&s({x:We[E.key].x,y:We[E.key].y},E.shiftKey)}return(E,b)=>!l.unref(a)&&c.value.width&&c.value.height?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["vue-flow__nodesselection vue-flow__container",l.unref(i)]),style:l.normalizeStyle({transform:`translate(${l.unref(n).x}px,${l.unref(n).y}px) scale(${l.unref(n).zoom})`})},[l.createElementVNode("div",{ref_key:"el",ref:u,class:l.normalizeClass([{dragging:l.unref(d)},"vue-flow__nodesselection-rect"]),style:l.normalizeStyle(f.value),tabIndex:l.unref(r)?void 0:-1,onContextmenu:h,onKeydown:p},null,46,Pu)],6)):l.createCommentVNode("",!0)}});function Bu(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Du={name:"Pane",compatConfig:{MODE:3}},Vu=l.defineComponent({...Du,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:a,panOnDrag:s,userSelectionRect:u,elementsSelectable:d,nodesSelectionActive:c,getSelectedEdges:f,getSelectedNodes:h,removeNodes:p,removeEdges:E,selectionMode:b,deleteKeyCode:x,multiSelectionKeyCode:S,multiSelectionActive:M,edgeLookup:_,nodeLookup:C}=de(),z=l.ref(null),X=l.ref(0),F=l.ref(0),T=l.ref(),D=l.ref(new Map),$=l.toRef(()=>d.value&&(e.isSelecting||r.value));let O=!1,N=!1;const Q=ut(x,{actInsideInputWithModifier:!1}),w=ut(S);l.watch(Q,G=>{G&&(p(h.value),E(f.value),c.value=!1)}),l.watch(w,G=>{M.value=G});function I(G,H){return q=>{q.target===H&&(G==null||G(q))}}function k(){r.value=!1,u.value=null,X.value=0,F.value=0}function B(G){if(O){O=!1;return}i.paneClick(G),a(),c.value=!1}function V(G){var H;if(Array.isArray(s.value)&&((H=s.value)!=null&&H.includes(2))){G.preventDefault();return}i.paneContextMenu(G)}function A(G){i.paneScroll(G)}function R(G){var H,q,le,ie,ae;if(T.value=(H=t.value)==null?void 0:H.getBoundingClientRect(),!d.value||!e.isSelecting||G.button!==0||G.target!==z.value||!T.value)return;(le=(q=G.target)==null?void 0:q.setPointerCapture)==null||le.call(q,G.pointerId);const{x:te,y:oe}=Bu(G,T.value);N=!0,O=!1,D.value=new Map;for(const[K,J]of _.value)D.value.set(J.source,((ie=D.value.get(J.source))==null?void 0:ie.add(K))||new Set([K])),D.value.set(J.target,((ae=D.value.get(J.target))==null?void 0:ae.add(K))||new Set([K]));a(),u.value={width:0,height:0,startX:te,startY:oe,x:te,y:oe},i.selectionStart(G)}function U(G){if(!T.value||!u.value)return;O=!0;const{x:H,y:q}=Be(G,T.value),{startX:le=0,startY:ie=0}=u.value,ae={startX:le,startY:ie,x:H<le?H:le,y:q<ie?q:ie,width:Math.abs(H-le),height:Math.abs(q-ie)},te=Lo(n.value,ae,o.value,b.value===gn.Partial,!0),oe=new Set,K=new Set;for(const J of te){K.add(J.id);const ne=D.value.get(J.id);if(ne)for(const y of ne)oe.add(y)}if(X.value!==K.size){X.value=K.size;const J=Te(C.value,K,!0);i.nodesChange(J)}if(F.value!==oe.size){F.value=oe.size;const J=Te(_.value,oe);i.edgesChange(J)}u.value=ae,r.value=!0,c.value=!1}function j(G){var H;G.button!==0||!N||((H=G.target)==null||H.releasePointerCapture(G.pointerId),!r.value&&u.value&&G.target===z.value&&B(G),X.value>0&&(c.value=!0),k(),i.selectionEnd(G),e.selectionKeyPressed&&(O=!1),N=!1)}return(G,H)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"container",ref:z,class:l.normalizeClass(["vue-flow__pane vue-flow__container",{selection:G.isSelecting}]),onClick:H[0]||(H[0]=q=>$.value?void 0:I(B,z.value)(q)),onContextmenu:H[1]||(H[1]=q=>I(V,z.value)(q)),onWheelPassive:H[2]||(H[2]=q=>I(A,z.value)(q)),onPointerenter:H[3]||(H[3]=q=>$.value?void 0:l.unref(i).paneMouseEnter(q)),onPointerdown:H[4]||(H[4]=q=>$.value?R(q):l.unref(i).paneMouseMove(q)),onPointermove:H[5]||(H[5]=q=>$.value?U(q):l.unref(i).paneMouseMove(q)),onPointerup:H[6]||(H[6]=q=>$.value?j(q):void 0),onPointerleave:H[7]||(H[7]=q=>l.unref(i).paneMouseLeave(q))},[l.renderSlot(G.$slots,"default"),l.unref(r)&&l.unref(u)?(l.openBlock(),l.createBlock(Iu,{key:0,"user-selection-rect":l.unref(u)},null,8,["user-selection-rect"])):l.createCommentVNode("",!0),l.unref(c)&&l.unref(h).length?(l.openBlock(),l.createBlock(Tu,{key:1})):l.createCommentVNode("",!0)],34))}}),Ou={name:"Transform",compatConfig:{MODE:3}},Au=l.defineComponent({...Ou,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=de(),i=l.computed(()=>n.value?!o.value:!1),r=l.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(a,s)=>(l.openBlock(),l.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:l.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[l.renderSlot(a.$slots,"default")],4))}}),zu={name:"Viewport",compatConfig:{MODE:3}},Ru=l.defineComponent({...zu,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:a,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:d,panOnScrollSpeed:c,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:E,preventScrolling:b,noWheelClassName:x,noPanClassName:S,emits:M,connectionStartHandle:_,userSelectionActive:C,paneDragging:z,d3Zoom:X,d3Selection:F,d3ZoomHandler:T,viewport:D,viewportRef:$,paneClickDistance:O}=de();ku($);const N=l.ref(!1),Q=l.ref(!1);let w=null,I=!1,k=0,B={x:0,y:0,zoom:0};const V=ut(s),A=ut(a),R=ut(r),U=l.toRef(()=>!A.value&&(V.value||f.value)),j=l.toRef(()=>V.value||u.value),G=l.toRef(()=>A.value||a.value===!0&&U.value!==!0);l.onMounted(()=>{if(!$.value){zt("Viewport element is missing");return}const te=$.value,oe=te.getBoundingClientRect(),K=ms().clickDistance(O.value).scaleExtent([t.value,n.value]).translateExtent(i.value),J=ye(te).call(K),ne=J.on("wheel.zoom"),y=Ke.translate(o.value.x??0,o.value.y??0).scale(He(o.value.zoom??1,t.value,n.value)),g=[[0,0],[oe.width,oe.height]],m=K.constrain()(y,g,i.value);K.transform(J,m),K.wheelDelta(q),X.value=K,F.value=J,T.value=ne,D.value={x:m.x,y:m.y,zoom:m.k},K.on("start",v=>{var P;if(!v.sourceEvent)return null;k=v.sourceEvent.button,N.value=!0;const Z=ie(v.transform);((P=v.sourceEvent)==null?void 0:P.type)==="mousedown"&&(z.value=!0),B=Z,M.viewportChangeStart(Z),M.moveStart({event:v,flowTransform:Z})}),K.on("end",v=>{if(!v.sourceEvent)return null;if(N.value=!1,z.value=!1,H(U.value,k??0)&&!I&&M.paneContextMenu(v.sourceEvent),I=!1,le(B,v.transform)){const P=ie(v.transform);B=P,M.viewportChangeEnd(P),M.moveEnd({event:v,flowTransform:P})}}),K.filter(v=>{var P,Z,W;const ee=R.value||E.value,re=p.value&&v.ctrlKey,se=v.button;if((U.value===!0||Array.isArray(U.value)&&U.value.includes(1))&&se===1&&v.type==="mousedown"&&((P=v.target)!=null&&P.closest(".vue-flow__node")||(Z=v.target)!=null&&Z.closest(".vue-flow__edge")))return!0;if(!U.value&&!ee&&!j.value&&!h.value&&!p.value||C.value||!h.value&&v.type==="dblclick"||ae(v,x.value)&&v.type==="wheel"||ae(v,S.value)&&(v.type!=="wheel"||j.value&&v.type==="wheel"&&!R.value)||!p.value&&v.ctrlKey&&v.type==="wheel"||!ee&&!j.value&&!re&&v.type==="wheel")return!1;if(!p&&v.type==="touchstart"&&((W=v.touches)==null?void 0:W.length)>1)return v.preventDefault(),!1;if(!U.value&&(v.type==="mousedown"||v.type==="touchstart")||Array.isArray(U.value)&&!U.value.includes(se)&&(v.type==="mousedown"||v.type==="touchstart"))return!1;const ue=Array.isArray(U.value)&&U.value.includes(se)||!se||se<=1;return(!v.ctrlKey||v.type==="wheel")&&ue}),l.watch([C,U],()=>{C.value&&!N.value?K.on("zoom",null):C.value||K.on("zoom",v=>{D.value={x:v.transform.x,y:v.transform.y,zoom:v.transform.k};const P=ie(v.transform);I=H(U.value,k??0),M.viewportChange(P),M.move({event:v,flowTransform:P})})},{immediate:!0}),l.watch([C,j,d,R,p,b,x],()=>{j.value&&!R.value&&!C.value?J.on("wheel.zoom",v=>{if(ae(v,x.value))return!1;const P=R.value||E.value,Z=p.value&&v.ctrlKey;if(!(!b.value||j.value||P||Z))return!1;v.preventDefault(),v.stopImmediatePropagation();const ee=J.property("__zoom").k||1,re=At();if(v.ctrlKey&&p.value&&re){const ft=_e(v),Pc=q(v),$c=ee*2**Pc;K.scaleTo(J,$c,ft,v);return}const se=v.deltaMode===1?20:1;let ue=d.value===st.Vertical?0:v.deltaX*se,ce=d.value===st.Horizontal?0:v.deltaY*se;!re&&v.shiftKey&&d.value!==st.Vertical&&!ue&&ce&&(ue=ce,ce=0),K.translateBy(J,-(ue/ee)*c.value,-(ce/ee)*c.value);const xe=ie(J.property("__zoom"));w&&clearTimeout(w),Q.value?(M.move({event:v,flowTransform:xe}),M.viewportChange(xe),w=setTimeout(()=>{M.moveEnd({event:v,flowTransform:xe}),M.viewportChangeEnd(xe),Q.value=!1},150)):(Q.value=!0,M.moveStart({event:v,flowTransform:xe}),M.viewportChangeStart(xe))},{passive:!1}):typeof ne<"u"&&J.on("wheel.zoom",function(v,P){const Z=!b.value&&v.type==="wheel"&&!v.ctrlKey,W=R.value||E.value,ee=p.value&&v.ctrlKey;if(!W&&!u.value&&!ee&&v.type==="wheel"||Z||ae(v,x.value))return null;v.preventDefault(),ne.call(this,v,P)},{passive:!1})},{immediate:!0})});function H(te,oe){return oe===2&&Array.isArray(te)&&te.includes(2)}function q(te){const oe=te.ctrlKey&&At()?10:1;return-te.deltaY*(te.deltaMode===1?.05:te.deltaMode?1:.002)*oe}function le(te,oe){return te.x!==oe.x&&!Number.isNaN(oe.x)||te.y!==oe.y&&!Number.isNaN(oe.y)||te.zoom!==oe.k&&!Number.isNaN(oe.k)}function ie(te){return{x:te.x,y:te.y,zoom:te.k}}function ae(te,oe){return te.target.closest(`.${oe}`)}return(te,oe)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"viewportRef",ref:$,class:"vue-flow__viewport vue-flow__container"},[l.createVNode(Vu,{"is-selecting":G.value,"selection-key-pressed":l.unref(A),class:l.normalizeClass({connecting:!!l.unref(_),dragging:l.unref(z),draggable:l.unref(f)===!0||Array.isArray(l.unref(f))&&l.unref(f).includes(0)})},{default:l.withCtx(()=>[l.createVNode(Au,null,{default:l.withCtx(()=>[l.renderSlot(te.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Hu=["id"],Lu=["id"],Fu=["id"],Yu={name:"A11yDescriptions",compatConfig:{MODE:3}},Gu=l.defineComponent({...Yu,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=de();return(i,r)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",{id:`${l.unref(Po)}-${l.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+l.toDisplayString(l.unref(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,Hu),l.createElementVNode("div",{id:`${l.unref($o)}-${l.unref(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,Lu),l.unref(n)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",{key:0,id:`${l.unref(_s)}-${l.unref(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%)"}},l.toDisplayString(l.unref(o)),9,Fu))],64))}});function Xu(){const e=de();l.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Uu(e,t,n){return n===Y.Left?e-t:n===Y.Right?e+t:e}function Zu(e,t,n){return n===Y.Top?e-t:n===Y.Bottom?e+t:e}const Pn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=Y.Top,type:i}){return l.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Uu(t,e,o),cy:Zu(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Pn.props=["radius","centerX","centerY","position","type"],Pn.compatConfig={MODE:3};const Ni=Pn,Ku=l.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:a,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:d,findEdge:c,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:E,elementsSelectable:b,edgesUpdatable:x,edgesFocusable:S,hooks:M}=de(),_=l.computed(()=>c(e.id)),{emit:C,on:z}=Xs(_.value,r),X=l.inject(Rt),F=l.getCurrentInstance(),T=l.ref(!1),D=l.ref(!1),$=l.ref(""),O=l.ref(null),N=l.ref("source"),Q=l.ref(null),w=l.toRef(()=>typeof _.value.selectable>"u"?b.value:_.value.selectable),I=l.toRef(()=>typeof _.value.updatable>"u"?x.value:_.value.updatable),k=l.toRef(()=>typeof _.value.focusable>"u"?S.value:_.value.focusable);l.provide(Fs,e.id),l.provide(Ys,Q);const B=l.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),V=l.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),A=l.computed(()=>{const g=_.value.type||"default",m=X==null?void 0:X[`edge-${g}`];if(m)return m;let v=_.value.template??u.value[g];if(typeof v=="string"&&F){const P=Object.keys(F.appContext.components);P&&P.includes(g)&&(v=l.resolveComponent(g,!1))}return v&&typeof v!="string"?v:(r.error(new ge(fe.EDGE_TYPE_MISSING,v)),!1)}),{handlePointerDown:R}=hi({nodeId:$,handleId:O,type:N,isValidConnection:h,edgeUpdaterType:N,onEdgeUpdate:G,onEdgeUpdateEnd:H});return()=>{const g=f(_.value.source),m=f(_.value.target),v="pathOptions"in _.value?_.value.pathOptions:{};if(!g&&!m)return r.error(new ge(fe.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!g)return r.error(new ge(fe.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!m)return r.error(new ge(fe.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||g.hidden||m.hidden)return null;let P;o.value===Re.Strict?P=g.handleBounds.source:P=[...g.handleBounds.source||[],...g.handleBounds.target||[]];const Z=Qo(P,_.value.sourceHandle);let W;o.value===Re.Strict?W=m.handleBounds.target:W=[...m.handleBounds.target||[],...m.handleBounds.source||[]];const ee=Qo(W,_.value.targetHandle),re=(Z==null?void 0:Z.position)||Y.Bottom,se=(ee==null?void 0:ee.position)||Y.Top,{x:ue,y:ce}=Ot(g,Z,re),{x:xe,y:ft}=Ot(m,ee,se);return _.value.sourceX=ue,_.value.sourceY=ce,_.value.targetX=xe,_.value.targetY=ft,l.h("g",{ref:Q,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${A.value===!1?"default":_.value.type||"default"}`,s.value,B.value,{updating:T.value,selected:_.value.selected,animated:_.value.animated,inactive:!w.value&&!M.value.edgeClick.hasListeners()}],onClick:le,onContextmenu:ie,onDblclick:ae,onMouseenter:te,onMousemove:oe,onMouseleave:K,onKeyDown:k.value?y:void 0,tabIndex:k.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel||`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":k.value?`${$o}-${t}`:void 0,role:k.value?"button":"img"},[D.value?null:l.h(A.value===!1?u.value.default:A.value,{id:e.id,sourceNode:g,targetNode:m,source:_.value.source,target:_.value.target,type:_.value.type,updatable:I.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...z},style:V.value,markerStart:`url('#${dt(_.value.markerStart,t)}')`,markerEnd:`url('#${dt(_.value.markerEnd,t)}')`,sourcePosition:re,targetPosition:se,sourceX:ue,sourceY:ce,targetX:xe,targetY:ft,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...v}),[I.value==="source"||I.value===!0?[l.h("g",{onMousedown:J,onMouseenter:U,onMouseout:j},l.h(Ni,{position:re,centerX:ue,centerY:ce,radius:i.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[l.h("g",{onMousedown:ne,onMouseenter:U,onMouseout:j},l.h(Ni,{position:se,centerX:xe,centerY:ft,radius:i.value,type:"target","data-type":"target"}))]:null]])};function U(){T.value=!0}function j(){T.value=!1}function G(g,m){C.update({event:g,edge:_.value,connection:m})}function H(g){C.updateEnd({event:g,edge:_.value}),D.value=!1}function q(g,m){g.button===0&&(D.value=!0,$.value=m?_.value.target:_.value.source,O.value=(m?_.value.targetHandle:_.value.sourceHandle)??"",N.value=m?"target":"source",C.updateStart({event:g,edge:_.value}),R(g))}function le(g){var m;const v={event:g,edge:_.value};w.value&&(a.value=!1,_.value.selected&&p.value?(d([_.value]),(m=Q.value)==null||m.blur()):n([_.value])),C.click(v)}function ie(g){C.contextMenu({event:g,edge:_.value})}function ae(g){C.doubleClick({event:g,edge:_.value})}function te(g){C.mouseEnter({event:g,edge:_.value})}function oe(g){C.mouseMove({event:g,edge:_.value})}function K(g){C.mouseLeave({event:g,edge:_.value})}function J(g){q(g,!0)}function ne(g){q(g,!1)}function y(g){var m;!E.value&&To.includes(g.key)&&w.value&&(g.key==="Escape"?((m=Q.value)==null||m.blur(),d([c(e.id)])):n([c(e.id)]))}}}),Wu={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top},qu=l.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:a,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:d,viewport:c,findNode:f}=de(),h=(e=l.inject(Rt))==null?void 0:e["connection-line"],p=l.computed(()=>{var M;return f((M=o.value)==null?void 0:M.nodeId)}),E=l.computed(()=>{var M;return f((M=i.value)==null?void 0:M.nodeId)??null}),b=l.computed(()=>({x:(r.value.x-c.value.x)/c.value.zoom,y:(r.value.y-c.value.y)/c.value.zoom})),x=l.computed(()=>u.value.markerStart?`url(#${dt(u.value.markerStart,t)})`:""),S=l.computed(()=>u.value.markerEnd?`url(#${dt(u.value.markerEnd,t)})`:"");return()=>{var M,_,C,z;if(!p.value||!o.value)return null;const X=o.value.handleId,F=o.value.type,T=p.value.handleBounds;let D=T==null?void 0:T[F];if(n.value===Re.Loose&&(D=D||(T==null?void 0:T[F==="source"?"target":"source"])),!D)return null;const $=(X?D.find(A=>A.id===X):D[0])??null,O=($==null?void 0:$.position)||Y.Top,{x:N,y:Q}=Ot(p.value,$,O);let w=null;E.value&&((M=i.value)!=null&&M.handleId)&&(n.value===Re.Strict?w=((_=E.value.handleBounds[F==="source"?"target":"source"])==null?void 0:_.find(A=>{var R;return A.id===((R=i.value)==null?void 0:R.handleId)}))||null:w=((C=[...E.value.handleBounds.source||[],...E.value.handleBounds.target||[]])==null?void 0:C.find(A=>{var R;return A.id===((R=i.value)==null?void 0:R.handleId)}))||null);const I=((z=i.value)==null?void 0:z.position)??(O?Wu[O]:null);if(!O||!I)return null;const k=a.value??u.value.type??ze.Bezier;let B="";const V={sourceX:N,sourceY:Q,sourcePosition:O,targetX:b.value.x,targetY:b.value.y,targetPosition:I};return k===ze.Bezier?[B]=Mn(V):k===ze.Step?[B]=In({...V,borderRadius:0}):k===ze.SmoothStep?[B]=In(V):k===ze.SimpleBezier?[B]=bi(V):B=`M${N},${Q} ${b.value.x},${b.value.y}`,l.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},l.h("g",{class:"vue-flow__connection"},h?l.h(h,{sourceX:N,sourceY:Q,sourcePosition:O,targetX:b.value.x,targetY:b.value.y,targetPosition:I,sourceNode:p.value,sourceHandle:$,targetNode:E.value,targetHandle:w,markerEnd:S.value,markerStart:x.value,connectionStatus:d.value}):l.h("path",{d:B,class:[u.value.class,d,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":S.value,"marker-start":x.value})))}}}),Ju=["id","markerWidth","markerHeight","markerUnits","orient"],ju={name:"MarkerType",compatConfig:{MODE:3}},Qu=l.defineComponent({...ju,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(l.openBlock(),l.createElementBlock("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===l.unref(pn).ArrowClosed?(l.openBlock(),l.createElementBlock("polyline",{key:0,style:l.normalizeStyle({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)):l.createCommentVNode("",!0),t.type===l.unref(pn).Arrow?(l.openBlock(),l.createElementBlock("polyline",{key:1,style:l.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):l.createCommentVNode("",!0)],8,Ju))}}),ec={class:"vue-flow__marker vue-flow__container"},tc={name:"MarkerDefinitions",compatConfig:{MODE:3}},nc=l.defineComponent({...tc,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=l.computed(()=>{const a=new Set,s=[],u=d=>{if(d){const c=dt(d,t);a.has(c)||(typeof d=="object"?s.push({...d,id:c,color:d.color||i.value}):s.push({id:c,color:i.value,type:d}),a.add(c))}};for(const d of[o.value.markerEnd,o.value.markerStart])u(d);for(const d of n.value)for(const c of[d.markerStart,d.markerEnd])u(c);return s.sort((d,c)=>d.id.localeCompare(c.id))});return(a,s)=>(l.openBlock(),l.createElementBlock("svg",ec,[l.createElementVNode("defs",null,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,u=>(l.openBlock(),l.createBlock(Qu,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),oc={name:"Edges",compatConfig:{MODE:3}},ic=l.defineComponent({...oc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(nc),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n),a=>(l.openBlock(),l.createElementBlock("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:l.normalizeStyle({zIndex:l.unref(Ds)(a,l.unref(t),l.unref(o))})},[l.createVNode(l.unref(Ku),{id:a.id},null,8,["id"])],4))),128)),l.createVNode(l.unref(qu))],64))}}),rc=l.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:a,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:d,onUpdateNodeInternals:c,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:E,ariaLiveMessage:b,snapToGrid:x,snapGrid:S,nodeDragThreshold:M,nodesDraggable:_,elementsSelectable:C,nodesConnectable:z,nodesFocusable:X,hooks:F}=de(),T=l.ref(null);l.provide(di,T),l.provide(ci,e.id);const D=l.inject(Rt),$=l.getCurrentInstance(),O=pi(),{node:N,parentNode:Q}=gi(e.id),{emit:w,on:I}=Ws(N,a),k=l.toRef(()=>typeof N.draggable>"u"?_.value:N.draggable),B=l.toRef(()=>typeof N.selectable>"u"?C.value:N.selectable),V=l.toRef(()=>typeof N.connectable>"u"?z.value:N.connectable),A=l.toRef(()=>typeof N.focusable>"u"?X.value:N.focusable),R=l.toRef(()=>B.value||k.value||F.value.nodeClick.hasListeners()||F.value.nodeDoubleClick.hasListeners()||F.value.nodeMouseEnter.hasListeners()||F.value.nodeMouseMove.hasListeners()||F.value.nodeMouseLeave.hasListeners()),U=l.toRef(()=>!!N.dimensions.width&&!!N.dimensions.height),j=l.computed(()=>{const m=N.type||"default",v=D==null?void 0:D[`node-${m}`];if(v)return v;let P=N.template||f.value[m];if(typeof P=="string"&&$){const Z=Object.keys($.appContext.components);Z&&Z.includes(m)&&(P=l.resolveComponent(m,!1))}return P&&typeof P!="string"?P:(a.error(new ge(fe.NODE_TYPE_MISSING,P)),!1)}),G=fi({id:e.id,el:T,disabled:()=>!k.value,selectable:B,dragHandle:()=>N.dragHandle,onStart(m){w.dragStart(m)},onDrag(m){w.drag(m)},onStop(m){w.dragStop(m)},onClick(m){y(m)}}),H=l.computed(()=>N.class instanceof Function?N.class(N):N.class),q=l.computed(()=>{const m=(N.style instanceof Function?N.style(N):N.style)||{},v=N.width instanceof Function?N.width(N):N.width,P=N.height instanceof Function?N.height(N):N.height;return!m.width&&v&&(m.width=typeof v=="string"?v:`${v}px`),!m.height&&P&&(m.height=typeof P=="string"?P:`${P}px`),m}),le=l.toRef(()=>Number(N.zIndex??q.value.zIndex??0));return c(m=>{(m.includes(e.id)||!m.length)&&ae()}),l.onMounted(()=>{l.watch(()=>N.hidden,(m=!1,v,P)=>{!m&&T.value&&(e.resizeObserver.observe(T.value),P(()=>{T.value&&e.resizeObserver.unobserve(T.value)}))},{immediate:!0,flush:"post"})}),l.watch([()=>N.type,()=>N.sourcePosition,()=>N.targetPosition],()=>{l.nextTick(()=>{d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])})}),l.watch([()=>N.position.x,()=>N.position.y,()=>{var m;return(m=Q.value)==null?void 0:m.computedPosition.x},()=>{var m;return(m=Q.value)==null?void 0:m.computedPosition.y},()=>{var m;return(m=Q.value)==null?void 0:m.computedPosition.z},le,()=>N.selected,()=>N.dimensions.height,()=>N.dimensions.width,()=>{var m;return(m=Q.value)==null?void 0:m.dimensions.height},()=>{var m;return(m=Q.value)==null?void 0:m.dimensions.width}],([m,v,P,Z,W,ee])=>{const re={x:m,y:v,z:ee+(p.value&&N.selected?1e3:0)};typeof P<"u"&&typeof Z<"u"?N.computedPosition=Ms({x:P,y:Z,z:W},re):N.computedPosition=re},{flush:"post",immediate:!0}),l.watch([()=>N.extent,h],([m,v],[P,Z])=>{(m!==P||v!==Z)&&ie()}),N.extent==="parent"||typeof N.extent=="object"&&"range"in N.extent&&N.extent.range==="parent"?Zt(()=>U).toBe(!0).then(ie):ie(),()=>N.hidden?null:l.h("div",{ref:T,"data-id":N.id,class:["vue-flow__node",`vue-flow__node-${j.value===!1?"default":N.type||"default"}`,{[n.value]:k.value,dragging:G==null?void 0:G.value,draggable:k.value,selected:N.selected,selectable:B.value,parent:N.isParent},H.value],style:{visibility:U.value?"visible":"hidden",zIndex:N.computedPosition.z??le.value,transform:`translate(${N.computedPosition.x}px,${N.computedPosition.y}px)`,pointerEvents:R.value?"all":"none",...q.value},tabIndex:A.value?0:void 0,role:A.value?"button":void 0,"aria-describedby":E.value?void 0:`${Po}-${t}`,"aria-label":N.ariaLabel,onMouseenter:te,onMousemove:oe,onMouseleave:K,onContextmenu:J,onClick:y,onDblclick:ne,onKeydown:g},[l.h(j.value===!1?f.value.default:j.value,{id:N.id,type:N.type,data:N.data,events:{...N.events,...I},selected:N.selected,resizing:N.resizing,dragging:G.value,connectable:V.value,position:N.computedPosition,dimensions:N.dimensions,isValidTargetPos:N.isValidTargetPos,isValidSourcePos:N.isValidSourcePos,parent:N.parentNode,parentNodeId:N.parentNode,zIndex:N.computedPosition.z??le.value,targetPosition:N.targetPosition,sourcePosition:N.sourcePosition,label:N.label,dragHandle:N.dragHandle,onUpdateNodeInternals:ae})]);function ie(){const m=N.computedPosition;x.value&&(m.x=S.value[0]*Math.round(m.x/S.value[0]),m.y=S.value[1]*Math.round(m.y/S.value[1]));const{computedPosition:v,position:P}=bn(N,m,a.error,h.value,Q.value);(N.computedPosition.x!==v.x||N.computedPosition.y!==v.y)&&(N.computedPosition={...N.computedPosition,...v}),(N.position.x!==P.x||N.position.y!==P.y)&&(N.position=P)}function ae(){T.value&&d([{id:e.id,nodeElement:T.value,forceUpdate:!0}])}function te(m){G!=null&&G.value||w.mouseEnter({event:m,node:N})}function oe(m){G!=null&&G.value||w.mouseMove({event:m,node:N})}function K(m){G!=null&&G.value||w.mouseLeave({event:m,node:N})}function J(m){return w.contextMenu({event:m,node:N})}function ne(m){return w.doubleClick({event:m,node:N})}function y(m){B.value&&(!o.value||!k.value||M.value>0)&&Nn(N,r.value,u,s,i,!1,T.value),w.click({event:m,node:N})}function g(m){if(!(mn(m)||E.value))if(To.includes(m.key)&&B.value){const v=m.key==="Escape";Nn(N,r.value,u,s,i,v,T.value)}else k.value&&N.selected&&We[m.key]&&(b.value=`Moved selected node ${m.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~N.position.x}, y: ${~~N.position.y}`,O({x:We[m.key].x,y:We[m.key].y},m.shiftKey))}}}),lc={height:"0",width:"0"},ac={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},sc=l.defineComponent({...ac,setup(e){const{viewportRef:t}=de(),n=l.toRef(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(l.openBlock(),l.createElementBlock("svg",null,[(l.openBlock(),l.createElementBlock("foreignObject",lc,[(l.openBlock(),l.createBlock(l.Teleport,{to:n.value,disabled:!n.value},[l.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function uc(e={includeHiddenNodes:!1}){const{nodes:t}=de();return l.computed(()=>{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 cc={class:"vue-flow__nodes vue-flow__container"},dc={name:"Nodes",compatConfig:{MODE:3}},fc=l.defineComponent({...dc,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=uc(),r=l.ref();return l.watch(i,a=>{a&&l.nextTick(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),l.onMounted(()=>{r.value=new ResizeObserver(a=>{const s=a.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));l.nextTick(()=>n(s))})}),l.onBeforeUnmount(()=>{var a;return(a=r.value)==null?void 0:a.disconnect()}),(a,s)=>(l.openBlock(),l.createElementBlock("div",cc,[r.value?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(t),(u,d,c,f)=>{const h=[u.id];if(f&&f.key===u.id&&l.isMemoSame(f,h))return f;const p=(l.openBlock(),l.createBlock(l.unref(rc),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return p.memo=h,p},s,0),128)):l.createCommentVNode("",!0)]))}});function hc(){const{emits:e}=de();l.onMounted(()=>{if(ii()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new ge(fe.MISSING_STYLES))}})}const gc=l.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),pc={name:"VueFlow",compatConfig:{MODE:3}},mc=l.defineComponent({...pc,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=l.useSlots(),r=Kt(o,"modelValue",n),a=Kt(o,"nodes",n),s=Kt(o,"edges",n),u=de(o),d=js({modelValue:r,nodes:a,edges:s},o,u);return eu(n,u.hooks),Xu(),hc(),l.provide(Rt,i),l.onUnmounted(()=>{d()}),t(u),(c,f)=>(l.openBlock(),l.createElementBlock("div",{ref:l.unref(u).vueFlowRef,class:"vue-flow"},[l.createVNode(Ru,null,{default:l.withCtx(()=>[l.createVNode(ic),gc,l.createVNode(fc),l.renderSlot(c.$slots,"zoom-pane")]),_:3}),l.renderSlot(c.$slots,"default"),l.createVNode(Gu)],512))}}),yc=["id","d","marker-end"],vc={class:"vue-flow__edge-label"},wc={key:0,class:"label-input-wrapper"},_c={inheritAttrs:!1},bc=l.defineComponent({..._c,__name:"EditableEdge",props:{id:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},label:{},style:{},selected:{type:Boolean},sourcePosition:{},targetPosition:{},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},markerEnd:{},curvature:{},interactionWidth:{},data:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{},sourceX:{},sourceY:{},targetX:{},targetY:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=l.useTemplateRef("labelInput"),r=l.ref(""),a=l.ref(!1);let s=0;const u=async()=>{let h=Date.now();h-s<500&&!a.value&&await d(),s=h},d=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},c=()=>{a.value=!1,o("change",r.value)},f=l.computed(()=>Mn(n));return(h,p)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("path",{id:h.id,style:l.normalizeStyle(h.style),class:"vue-flow__edge-path",d:f.value[0],"marker-end":h.markerEnd},null,12,yc),l.createVNode(l.unref(sc),null,{default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${f.value[1]}px,${f.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:p[2]||(p[2]=E=>u())},[l.createElementVNode("div",vc,l.toDisplayString(h.label),1),a.value?(l.openBlock(),l.createElementBlock("div",wc,[l.withDirectives(l.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":p[0]||(p[0]=E=>r.value=E),onBlur:p[1]||(p[1]=E=>a.value=!1),onKeypress:l.withKeys(c,["enter"])},null,544),[[l.vModelText,r.value]])])):l.createCommentVNode("",!0)],4)]),_:1})],64))}}),Ec={key:0,class:"label-input-wrapper"},xc=l.defineComponent({__name:"EditableNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=l.useTemplateRef("labelInput"),r=l.ref(""),a=l.ref(!1);let s=0;const u=async()=>{let f=Date.now();f-s<500&&!a.value&&await d(),s=f},d=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},c=()=>{a.value=!1,o("change",r.value)};return(f,h)=>(l.openBlock(),l.createElementBlock("div",{onClick:h[2]||(h[2]=p=>u())},[l.createElementVNode("div",null,l.toDisplayString(f.label),1),a.value?(l.openBlock(),l.createElementBlock("div",Ec,[l.withDirectives(l.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":h[0]||(h[0]=p=>r.value=p),onBlur:h[1]||(h[1]=p=>a.value=!1),onKeypress:l.withKeys(c,["enter"])},null,544),[[l.vModelText,r.value]])])):l.createCommentVNode("",!0),f.data.hasInput?(l.openBlock(),l.createBlock(l.unref(qe),{key:1,id:"a",type:"target",position:f.targetPosition},null,8,["position"])):l.createCommentVNode("",!0),f.data.hasOutput?(l.openBlock(),l.createBlock(l.unref(qe),{key:2,id:"b",type:"source",position:f.sourcePosition},null,8,["position"])):l.createCommentVNode("",!0)]))}}),Sc={class:"chart-controls"},Nc={class:"chart-controls-left"},Cc={class:"chart-controls-right"},kc={key:0},Mc={key:1},$n=l.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,o=l.ref(!1),i=l.ref([]),r=l.ref(),a=l.ref(""),s=l.computed(()=>(i.value.forEach((T,D)=>{if(T.id===a.value)return D}),-1)),u=l.computed({get:()=>{const T=e.modelValue;for(const D of T)D.data={},D.type==="input"?(D.data.hasInput=!1,D.data.hasOutput=!0):D.type==="output"?(D.data.hasInput=!0,D.data.hasOutput=!1):(D.data.hasInput=!0,D.data.hasOutput=!0),D.class="vue-flow__node-default",D.type="editable";for(const D of T)D.events={click:()=>{a.value=D.id}};return T},set:T=>{n("update:modelValue",JSON.parse(JSON.stringify(T)))}}),{onConnect:d,addEdges:c,onEdgeContextMenu:f,onPaneReady:h,removeEdges:p}=de();l.onMounted(()=>{document.removeEventListener("keypress",M),document.addEventListener("keypress",M)}),l.onBeforeUnmount(()=>{document.removeEventListener("keypress",M)}),h(T=>{r.value=T}),i.value=u.value;const E=T=>({[Y.Top]:Y.Right,[Y.Right]:Y.Bottom,[Y.Bottom]:Y.Left,[Y.Left]:Y.Top})[T],b=()=>{if(s.value>-1){const T=i.value[s.value];T.sourcePosition=E(T.sourcePosition)}},x=()=>{if(s.value>-1){const T=i.value[s.value];T.targetPosition=E(T.targetPosition)}},S=T=>{window.scrollBy(0,T.deltaY)},M=T=>{o.value&&T.ctrlKey==!0&&((T.key=="+"||T.key=="=")&&r.value.zoomIn(),T.key=="-"&&r.value.zoomOut())},_=async()=>{await r.value.fitView()},C=()=>{let T=!1,D={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const N=i.value[s.value];N.data.hasOutput&&(D={x:N.position.x+200,y:N.position.y+50},T=!0)}const $=i.value.length,O=`node-${$}`;if(i.value.push({id:O,label:"Node "+$,sourcePosition:Y.Right,targetPosition:Y.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{a.value=O}},position:D}),T){let N=`edge-${$+1}`;i.value.push({id:N,source:a.value,target:O,type:"editable",label:`EDGE ${$+1}`,animated:!0,events:{click:()=>{a.value=N}}})}},z=(T,D)=>{for(let $=0;$<i.value.length;$++)if(i.value[$].id==D){i.value[$].label=T;break}};d(T=>{const $={id:`edge-${i.value.length}`,source:T.source,target:T.target,type:"editable",label:"New Edge",interactionWidth:400,animated:!0,events:{click:()=>{a.value=$.id}}};c([$])});const F=T=>{p(T)};return f(({event:T,edge:D})=>{F(D.id)}),(T,D)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["node-editor-wrapper",T.nodeContainerClass]),onMouseover:D[1]||(D[1]=$=>o.value=!0),onMouseleave:D[2]||(D[2]=$=>o.value=!1)},[l.createElementVNode("div",Sc,[l.createElementVNode("div",Nc,[l.createElementVNode("div",null,[D[3]||(D[3]=l.createElementVNode("b",null,"Selected Node:",-1)),l.createTextVNode(" "+l.toDisplayString(a.value?a.value:"none"),1)])]),l.createElementVNode("div",Cc,[l.createElementVNode("div",null,[l.createElementVNode("button",{class:"button-default",onClick:C},"Add Node")]),l.createElementVNode("div",null,[l.createElementVNode("button",{class:"button-default",onClick:_},"Center")]),s.value>-1?(l.openBlock(),l.createElementBlock("div",kc,[l.createElementVNode("button",{class:"button-default",onClick:x},"Shift Input Position")])):l.createCommentVNode("",!0),s.value>-1?(l.openBlock(),l.createElementBlock("div",Mc,[l.createElementVNode("button",{class:"button-default",onClick:b},"Shift Output Position")])):l.createCommentVNode("",!0)])]),i.value&&i.value.length?(l.openBlock(),l.createBlock(l.unref(mc),{key:0,class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,modelValue:i.value,"onUpdate:modelValue":D[0]||(D[0]=$=>i.value=$),onWheel:l.withModifiers(S,["prevent"])},{"node-editable":l.withCtx($=>[l.createVNode(xc,l.mergeProps($,{onChange:O=>z(O,$.id)}),null,16,["onChange"])]),"edge-editable":l.withCtx($=>[l.createVNode(bc,l.mergeProps($,{onChange:O=>z(O,$.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):l.createCommentVNode("",!0)],34))}}),Ci=l.defineComponent({__name:"StateEditor",props:l.mergeModels({layout:{},nodeContainerClass:{}},{modelValue:{},modelModifiers:{}}),emits:l.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:t}){const n=t,o=l.useModel(e,"modelValue"),i=l.computed({get:()=>{var c,f,h;const a={},s=[],u={};let d=0;for(const[p,E]of Object.entries(o.value)){const b={id:p,label:p,position:((c=e.layout[p])==null?void 0:c.position)||{x:200*d,y:100},targetPosition:((f=e.layout[p])==null?void 0:f.targetPosition)||Y.Left,sourcePosition:((h=e.layout[p])==null?void 0:h.sourcePosition)||Y.Right};E.type==="final"&&(b.type="output",b.class="default-output-node"),u[p]=b}for(const[p,E]of Object.entries(o.value)){if(E.on)for(const[b,x]of Object.entries(E.on)){const S=x.target||x;s.push({id:`${p}-${S}`,source:p,target:S,label:b,animated:!0}),a[S]=!0}d++}for(const[p,E]of Object.entries(u))a[p]||(E.type="input",E.class="default-input-node"),s.push(E);return s},set:a=>{r(a)}}),r=a=>{const s={},u={},d={};for(const c of a){const f=c.label;c.type==="input"?d[f]={on:{}}:c.type==="output"?d[f]={type:"final"}:c.source&&c.target?(s[c.source]=s[c.source]||{},s[c.source][f]={target:c.target}):d[f]={on:{}},u[c.id]=f}for(const[c,f]of Object.entries(s)){const h=u[c];for(const[p,E]of Object.entries(f))d[h].on[p]=E}n("update:modelValue",d)};return(a,s)=>(l.openBlock(),l.createElementBlock("div",null,[l.createVNode($n,{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=u=>i.value=u),"node-container-class":a.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function Ic(e){e.component("NodeEditor",$n),e.component("StateEditor",Ci)}Se.NodeEditor=$n,Se.StateEditor=Ci,Se.install=Ic,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
26
+ 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 pe extends Error{constructor(t,...n){var o;super((o=oi[t])==null?void 0:o.call(oi,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function Sn(e){return"clientX"in e}function ii(e){return"sourceEvent"in e}function De(e,t){var n,o;const i=Sn(e),r=i?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,l=i?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:l-((t==null?void 0:t.top)??0)}}const Rt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function zs(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function Ht(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const Rs=()=>!0;function Nn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Hs(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const r of t.values())Ot(i,Vt(r))>0&&o.push(r);return o}const Ls=250;function Fs(e,t,n,o){var i,r;let l=[],s=Number.POSITIVE_INFINITY;const u=Hs(e,n,t+Ls);for(const c of u){const d=[...((i=c.handleBounds)==null?void 0:i.source)??[],...((r=c.handleBounds)==null?void 0:r.target)??[]];for(const f of d){if(o.nodeId===f.nodeId&&o.type===f.type&&o.id===f.id)continue;const{x:g,y:h}=qe(c,f,f.position,!0),x=Math.sqrt((g-e.x)**2+(h-e.y)**2);x>t||(x<s?(l=[{...f,x:g,y:h}],s=x):x===s&&l.push({...f,x:g,y:h}))}}if(!l.length)return null;if(l.length>1){const c=o.type==="source"?"target":"source";return l.find(d=>d.type===c)??l[0]}return l[0]}function ri(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:l,lib:s,flowId:u,isValidConnection:c=Rs},d,f,g){const h=r==="target",x=t?l.querySelector(`.${s}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:S,y:N}=De(e),k=l.elementFromPoint(S,N),M=k!=null&&k.classList.contains(`${s}-flow__handle`)?k:x,_={handleDomNode:M,isValid:!1,connection:null,toHandle:null};if(M){const C=li(void 0,M),z=M.getAttribute("data-nodeid"),L=M.getAttribute("data-handleid"),G=M.classList.contains("connectable"),P=M.classList.contains("connectableend");if(!z||!C)return _;const D={source:h?z:o,sourceHandle:h?L:i,target:h?o:z,targetHandle:h?i:L};_.connection=D;const B=G&&P&&(n===Pe.Strict?h&&C==="source"||!h&&C==="target":z!==o||L!==i);_.isValid=B&&c(D,{nodes:f,edges:d,sourceNode:g(o),targetNode:g(z)}),_.toHandle=t}return _}function li(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ys(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function Gs(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}function Xs(e,t,n,o,i,r=!1){var l,s,u;const c=o.get(e);if(!c)return null;const d=i===Pe.Strict?(l=c.handleBounds)==null?void 0:l[t]:[...((s=c.handleBounds)==null?void 0:s.source)??[],...((u=c.handleBounds)==null?void 0:u.target)??[]],f=(n?d==null?void 0:d.find(g=>g.id===n):d==null?void 0:d[0])??null;return f&&r?{...f,...qe(c,f,f.position,!0)}:f}const Cn={[H.Left]:H.Right,[H.Right]:H.Left,[H.Top]:H.Bottom,[H.Bottom]:H.Top},Us=["production","prod"];function Lt(e,...t){ai()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ai(){return!Us.includes(process.env.NODE_ENV||"")}function si(e,t,n,o){const i=t.querySelectorAll(`.vue-flow__handle.${e}`);return Array.from(i).map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),nodeId:l.getAttribute("data-nodeid"),type:e,x:(s.left-n.left)/o,y:(s.top-n.top)/o,...At(l)}})}function kn(e,t,n,o,i,r=!1,l){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),a.nextTick(()=>{l.blur()})):n([e])}function he(e){return typeof a.unref(e)<"u"}function Zs(e,t,n,o){if(!e||!e.source||!e.target)return n(new pe(fe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return Te(e)?i=e:i={...e,id:Lo(e)},i=Ro(i,void 0,o),Ms(i,t)?!1:i}function Ws(e,t,n,o,i){if(!t.source||!t.target)return i(new pe(fe.EDGE_INVALID,e.id)),!1;if(!n)return i(new pe(fe.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...l}=e;return{...l,id:o?Lo(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}function ui(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const l=e[r];if(!Le(l)){n(new pe(fe.NODE_INVALID,l==null?void 0:l.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=Ns(l,t(l.id),l.parentNode);l.parentNode&&(o[l.parentNode]=!0),i[r]=s}for(const r of i){const l=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!l&&n(new pe(fe.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),l&&(l.isParent=!0))}return i}function ci(e,t,n,o,i,r){let l=i;const s=o.get(l)||new Map;o.set(l,s.set(n,t)),l=`${i}-${e}`;const u=o.get(l)||new Map;if(o.set(l,u.set(n,t)),r){l=`${i}-${e}-${r}`;const c=o.get(l)||new Map;o.set(l,c.set(n,t))}}function Mn(e,t,n){e.clear(),t.clear();for(const o of n){const{source:i,target:r,sourceHandle:l=null,targetHandle:s=null}=o,u={edgeId:o.id,source:i,target:r,sourceHandle:l,targetHandle:s},c=`${i}-${l}--${r}-${s}`,d=`${r}-${s}--${i}-${l}`;ci("source",u,d,e,i,l),ci("target",u,c,e,r,s),t.set(o.id,o)}}function di(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function In(e,t,n,o,i,r,l,s){const u=[];for(const c of e){const d=Te(c)?c:Zs(c,s,i,r);if(!d)continue;const f=n(d.source),g=n(d.target);if(!f||!g){i(new pe(fe.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new pe(fe.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!g){i(new pe(fe.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:l,sourceNode:f,targetNode:g})){i(new pe(fe.EDGE_INVALID,d.id));continue}const h=o(d.id);u.push({...Ro(d,h,r),sourceNode:f,targetNode:g})}return u}const fi=Symbol("vueFlow"),hi=Symbol("nodeId"),pi=Symbol("nodeRef"),Ks=Symbol("edgeId"),qs=Symbol("edgeRef"),Ft=Symbol("slots");function gi(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:l,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:f,panBy:g,findNode:h,multiSelectionActive:x,nodesSelectionActive:S,selectNodesOnDrag:N,removeSelectedElements:k,addSelectedNodes:M,updateNodePositions:_,emits:C}=de(),{onStart:z,onDrag:L,onStop:G,onClick:P,el:D,disabled:A,id:B,selectable:b,dragHandle:J}=e,w=a.ref(!1);let T=[],E,$=null,V={x:void 0,y:void 0},F={x:0,y:0},R=null,W=!1,O=0,X=!1;const U=Qs(),te=({x:j,y:Q})=>{V={x:j,y:Q};let ne=!1;if(T=T.map(m=>{const p={x:j-m.distance.x,y:Q-m.distance.y},{computedPosition:v}=xn(m,n.value?Ht(p,o.value):p,C.error,l.value,m.parentNode?h(m.parentNode):void 0);return ne=ne||m.position.x!==v.x||m.position.y!==v.y,m.position=v,m}),!!ne&&(_(T,!0,!0),w.value=!0,R)){const[m,p]=En({id:B,dragItems:T,findNode:h});L({event:R,node:m,nodes:p})}},ae=()=>{if(!$)return;const[j,Q]=Ko(F,$,d.value);if(j!==0||Q!==0){const ne={x:(V.x??0)-j/u.value.zoom,y:(V.y??0)-Q/u.value.zoom};g({x:j,y:Q})&&te(ne)}O=requestAnimationFrame(ae)},ie=(j,Q)=>{W=!0;const ne=h(B);!N.value&&!x.value&&ne&&(ne.selected||k()),ne&&a.toValue(b)&&N.value&&kn(ne,x.value,M,k,S,!1,Q);const m=U(j.sourceEvent);if(V=m,T=$s(r.value,f.value,m,h,B),T.length){const[p,v]=En({id:B,dragItems:T,findNode:h});z({event:j.sourceEvent,node:p,nodes:v})}},ue=(j,Q)=>{var ne;j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||(s.value===0&&ie(j,Q),V=U(j.sourceEvent),$=((ne=t.value)==null?void 0:ne.getBoundingClientRect())||null,F=De(j.sourceEvent,$))},oe=(j,Q)=>{const ne=U(j.sourceEvent);if(!X&&W&&c.value&&(X=!0,ae()),!W){const m=ne.xSnapped-(V.x??0),p=ne.ySnapped-(V.y??0);Math.sqrt(m*m+p*p)>s.value&&ie(j,Q)}(V.x!==ne.xSnapped||V.y!==ne.ySnapped)&&T.length&&W&&(R=j.sourceEvent,F=De(j.sourceEvent,$),te(ne))},se=j=>{if(!ii(j)&&!W&&!w.value&&!x.value){const Q=j,ne=U(Q),m=ne.xSnapped-(V.x??0),p=ne.ySnapped-(V.y??0),v=Math.sqrt(m*m+p*p);v!==0&&v<=s.value&&(P==null||P(Q));return}if(w.value=!1,X=!1,W=!1,V={x:void 0,y:void 0},cancelAnimationFrame(O),T.length){_(T,!1,!1);const[Q,ne]=En({id:B,dragItems:T,findNode:h});G({event:j.sourceEvent,node:Q,nodes:ne})}};return a.watch([()=>a.toValue(A),D],([j,Q],ne,m)=>{if(Q){const p=ye(Q);j||(E=Il().on("start",v=>ue(v,Q)).on("drag",v=>oe(v,Q)).on("end",v=>se(v)).filter(v=>{const y=v.target,I=a.toValue(J);return!v.button&&(!i.value||!ei(y,`.${i.value}`,Q)&&(!I||ei(y,I,Q)))}),p.call(E)),m(()=>{p.on(".drag",null),E&&(E.on("start",null),E.on("drag",null),E.on("end",null))})}}),w}function Js(){return{doubleClick:Y(),click:Y(),mouseEnter:Y(),mouseMove:Y(),mouseLeave:Y(),contextMenu:Y(),updateStart:Y(),update:Y(),updateEnd:Y()}}function js(e,t){const n=Js();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 Qs(){const{viewport:e,snapGrid:t,snapToGrid:n}=de();return o=>{const i=ii(o)?o.sourceEvent:o,{x:r,y:l}=De(i),s=ft({x:r,y:l},e.value),{x:u,y:c}=n.value?Ht(s,t.value):s;return{xSnapped:u,ySnapped:c,...s}}}function Yt(){return!0}function mi({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{id:s,vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:g,nodesConnectable:h,autoPanOnConnect:x,autoPanSpeed:S,findNode:N,panBy:k,startConnection:M,updateConnection:_,endConnection:C,emits:z,viewport:L,edges:G,nodes:P,isValidConnection:D,nodeLookup:A}=de();let B=null,b=!1,J=null;function w(E){var $;const V=a.toValue(n)==="target",F=Sn(E),R=zo(E.target);if(F&&E.button===0||!F){let W=function(ee){m=De(ee,j),te=Fs(ft(m,L.value,!1,[1,1]),d.value,A.value,y),p||(v(),p=!0);const re=ri(ee,{handle:te,connectionMode:c.value,fromNodeId:a.toValue(t),fromHandleId:a.toValue(e),fromType:V?"target":"source",isValidConnection:U,doc:R,lib:"vue",flowId:s,nodeLookup:A.value},G.value,P.value,N);J=re.handleDomNode,B=re.connection,b=Gs(!!te,re.isValid);const le={...q,isValid:b,to:te&&b?_n({x:te.x,y:te.y},L.value):m,toHandle:re.toHandle,toPosition:b&&re.toHandle?re.toHandle.position:Cn[y.position],toNode:re.toHandle?A.value.get(re.toHandle.nodeId):null};if(!(b&&te&&(q!=null&&q.toHandle)&&le.toHandle&&q.toHandle.type===le.toHandle.type&&q.toHandle.nodeId===le.toHandle.nodeId&&q.toHandle.id===le.toHandle.id&&q.to.x===le.to.x&&q.to.y===le.to.y)){if(_(te&&b?_n({x:te.x,y:te.y},L.value):m,re.toHandle,Ys(!!te,b)),q=le,!te&&!b&&!J)return Nn(ne);B&&B.source!==B.target&&J&&(Nn(ne),ne=J,J.classList.add("connecting","vue-flow__handle-connecting"),J.classList.toggle("valid",!!b),J.classList.toggle("vue-flow__handle-valid",!!b))}},O=function(ee){(te||J)&&B&&b&&(r?r(ee,B):z.connect(B)),z.connectEnd(ee),i&&(l==null||l(ee)),Nn(ne),cancelAnimationFrame(ae),C(ee),p=!1,b=!1,B=null,J=null,R.removeEventListener("mousemove",W),R.removeEventListener("mouseup",O),R.removeEventListener("touchmove",W),R.removeEventListener("touchend",O)};const X=N(a.toValue(t));let U=a.toValue(o)||D.value||Yt;!U&&X&&(U=(V?X.isValidSourcePos:X.isValidTargetPos)||Yt);let te,ae=0;const{x:ie,y:ue}=De(E),oe=R==null?void 0:R.elementFromPoint(ie,ue),se=li(a.toValue(i),oe),j=($=u.value)==null?void 0:$.getBoundingClientRect();if(!j||!se)return;const Q=Xs(a.toValue(t),se,a.toValue(e),A.value,c.value);if(!Q)return;let ne,m=De(E,j),p=!1;const v=()=>{if(!x.value)return;const[ee,re]=Ko(m,j,S.value);k({x:ee,y:re}),ae=requestAnimationFrame(v)},y={...Q,nodeId:a.toValue(t),type:se,position:Q.position},I=A.value.get(a.toValue(t)),K={inProgress:!0,isValid:null,from:qe(I,y,H.Left,!0),fromHandle:y,fromPosition:y.position,fromNode:I,to:m,toHandle:null,toPosition:Cn[y.position],toNode:null};M({nodeId:a.toValue(t),id:a.toValue(e),type:se,position:(oe==null?void 0:oe.getAttribute("data-handlepos"))||H.Top},{x:ie-j.left,y:ue-j.top}),z.connectStart({event:E,nodeId:a.toValue(t),handleId:a.toValue(e),handleType:se});let q=K;R.addEventListener("mousemove",W),R.addEventListener("mouseup",O),R.addEventListener("touchmove",W),R.addEventListener("touchend",O)}}function T(E){var $,V;if(!f.value)return;const F=a.toValue(n)==="target";if(!g.value){z.clickConnectStart({event:E,nodeId:a.toValue(t),handleId:a.toValue(e)}),M({nodeId:a.toValue(t),type:a.toValue(n),id:a.toValue(e),position:H.Top},void 0,!0);return}let R=a.toValue(o)||D.value||Yt;const W=N(a.toValue(t));if(!R&&W&&(R=(F?W.isValidSourcePos:W.isValidTargetPos)||Yt),W&&(typeof W.connectable>"u"?h.value:W.connectable)===!1)return;const O=zo(E.target),X=ri(E,{handle:{nodeId:a.toValue(t),id:a.toValue(e),type:a.toValue(n),position:H.Top},connectionMode:c.value,fromNodeId:g.value.nodeId,fromHandleId:g.value.id||null,fromType:g.value.type,isValidConnection:R,doc:O,lib:"vue",flowId:s,nodeLookup:A.value},G.value,P.value,N),U=(($=X.connection)==null?void 0:$.source)===((V=X.connection)==null?void 0:V.target);X.isValid&&X.connection&&!U&&z.connect(X.connection),z.clickConnectEnd(E),C(E,!0)}return{handlePointerDown:w,handleClick:T}}function eu(){return a.inject(hi,"")}function yi(e){const t=e??eu()??"",n=a.inject(pi,a.ref(null)),{findNode:o,edges:i,emits:r}=de(),l=o(t);return l||r.error(new pe(fe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:l,parentNode:a.computed(()=>o(l.parentNode)),connectedEdges:a.computed(()=>Xo([l],i.value))}}function tu(){return{doubleClick:Y(),click:Y(),mouseEnter:Y(),mouseMove:Y(),mouseLeave:Y(),contextMenu:Y(),dragStart:Y(),drag:Y(),dragStop:Y()}}function nu(e,t){const n=tu();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 vi(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:l,emits:s}=de();return(u,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,g=c?4:1,h=u.x*d*g,x=u.y*f*g,S=[];for(const N of e.value)if(N.draggable||l&&typeof N.draggable>"u"){const k={x:N.computedPosition.x+h,y:N.computedPosition.y+x},{computedPosition:M}=xn(N,k,s.error,t.value,N.parentNode?o(N.parentNode):void 0);S.push({id:N.id,position:M,from:N.position,distance:{x:u.x,y:u.y},dimensions:N.dimensions})}n(S,!0,!1)}}const Pn=.1;function Ve(){return Lt("Viewport not initialized yet."),Promise.resolve(!1)}const ou={zoomIn:Ve,zoomOut:Ve,zoomTo:Ve,fitView:Ve,setCenter:Ve,fitBounds:Ve,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Ve,setTransform:Ve,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function iu(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(Tn(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,l){return new Promise(s=>{const{x:u,y:c}=Ao({x:-o,y:-i},e.translateExtent),d=We.translate(-u,-c).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(Tn(e.d3Selection,l,()=>{s(!0)}),d):s(!1)})}return a.computed(()=>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(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(Tn(e.d3Selection,r==null?void 0:r.duration,()=>{l(!0)}),i):l(!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:Pn,includeHiddenNodes:!1,duration:0})=>{var r,l;const s=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!g.hidden)&&(!((r=i.nodes)!=null&&r.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(g.id))&&s.push(g);if(!s.length)return Promise.resolve(!1);const u=Yo(s),{x:c,y:d,zoom:f}=Uo(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??Pn,i.offset);return n(c,d,f,i==null?void 0:i.duration)},setCenter:(i,r,l)=>{const s=typeof(l==null?void 0:l.zoom)<"u"?l.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,c=e.dimensions.height/2-r*s;return n(u,c,s,l==null?void 0:l.duration)},fitBounds:(i,r={padding:Pn})=>{const{x:l,y:s,zoom:u}=Uo(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(l,s,u,r==null?void 0:r.duration)},project:i=>ft(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-l};return ft(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+l};return _n(s,e.viewport)}return{x:0,y:0}}}:ou)}function Tn(e,t=0,n){return e.transition().duration(t).on("end",n)}function ru(e,t,n){const o=a.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let S,N,k=!!(n.nodes.value.length||n.edges.value.length);S=Ye([e.modelValue,()=>{var M,_;return(_=(M=e.modelValue)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N==null||N.pause(),n.setElements(M),!N&&!k&&M.length?k=!0:N==null||N.resume())}),N=Ye([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([M,_])=>{var C;(C=e.modelValue)!=null&&C.value&&Array.isArray(e.modelValue.value)&&(S==null||S.pause(),e.modelValue.value=[...M,..._],a.nextTick(()=>{S==null||S.resume()}))},{immediate:k}),a.onScopeDispose(()=>{S==null||S.stop(),N==null||N.stop()})})},r=()=>{o.run(()=>{let S,N,k=!!n.nodes.value.length;S=Ye([e.nodes,()=>{var M,_;return(_=(M=e.nodes)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N==null||N.pause(),n.setNodes(M),!N&&!k&&M.length?k=!0:N==null||N.resume())}),N=Ye([n.nodes,()=>n.nodes.value.length],([M])=>{var _;(_=e.nodes)!=null&&_.value&&Array.isArray(e.nodes.value)&&(S==null||S.pause(),e.nodes.value=[...M],a.nextTick(()=>{S==null||S.resume()}))},{immediate:k}),a.onScopeDispose(()=>{S==null||S.stop(),N==null||N.stop()})})},l=()=>{o.run(()=>{let S,N,k=!!n.edges.value.length;S=Ye([e.edges,()=>{var M,_;return(_=(M=e.edges)==null?void 0:M.value)==null?void 0:_.length}],([M])=>{M&&Array.isArray(M)&&(N==null||N.pause(),n.setEdges(M),!N&&!k&&M.length?k=!0:N==null||N.resume())}),N=Ye([n.edges,()=>n.edges.value.length],([M])=>{var _;(_=e.edges)!=null&&_.value&&Array.isArray(e.edges.value)&&(S==null||S.pause(),e.edges.value=[...M],a.nextTick(()=>{S==null||S.resume()}))},{immediate:k}),a.onScopeDispose(()=>{S==null||S.stop(),N==null||N.stop()})})},s=()=>{o.run(()=>{a.watch(()=>t.maxZoom,()=>{t.maxZoom&&he(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{a.watch(()=>t.minZoom,()=>{t.minZoom&&he(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{a.watch(()=>t.translateExtent,()=>{t.translateExtent&&he(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{a.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&he(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{a.watch(()=>t.applyDefault,()=>{he(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},g=()=>{o.run(()=>{const S=async N=>{let k=N;typeof t.autoConnect=="function"&&(k=await t.autoConnect(N)),k!==!1&&n.addEdges([k])};a.watch(()=>t.autoConnect,()=>{he(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),a.watch(n.autoConnect,(N,k,M)=>{N?n.onConnect(S):n.hooks.value.connect.off(S),M(()=>{n.hooks.value.connect.off(S)})},{immediate:!0})})},h=()=>{const S=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const N of Object.keys(t)){const k=N;if(!S.includes(k)){const M=a.toRef(()=>t[k]),_=n[k];a.isRef(_)&&o.run(()=>{a.watch(M,C=>{he(C)&&(_.value=C)},{immediate:!0})})}}};(()=>{i(),r(),l(),u(),s(),c(),d(),f(),g(),h()})()}),()=>o.stop()}function lu(){return{edgesChange:Y(),nodesChange:Y(),nodeDoubleClick:Y(),nodeClick:Y(),nodeMouseEnter:Y(),nodeMouseMove:Y(),nodeMouseLeave:Y(),nodeContextMenu:Y(),nodeDragStart:Y(),nodeDrag:Y(),nodeDragStop:Y(),nodesInitialized:Y(),miniMapNodeClick:Y(),miniMapNodeDoubleClick:Y(),miniMapNodeMouseEnter:Y(),miniMapNodeMouseMove:Y(),miniMapNodeMouseLeave:Y(),connect:Y(),connectStart:Y(),connectEnd:Y(),clickConnectStart:Y(),clickConnectEnd:Y(),paneReady:Y(),init:Y(),move:Y(),moveStart:Y(),moveEnd:Y(),selectionDragStart:Y(),selectionDrag:Y(),selectionDragStop:Y(),selectionContextMenu:Y(),selectionStart:Y(),selectionEnd:Y(),viewportChangeStart:Y(),viewportChange:Y(),viewportChangeEnd:Y(),paneScroll:Y(),paneClick:Y(),paneContextMenu:Y(),paneMouseEnter:Y(),paneMouseMove:Y(),paneMouseLeave:Y(),edgeContextMenu:Y(),edgeMouseEnter:Y(),edgeMouseMove:Y(),edgeMouseLeave:Y(),edgeDoubleClick:Y(),edgeClick:Y(),edgeUpdateStart:Y(),edgeUpdate:Y(),edgeUpdateEnd:Y(),updateNodeInternals:Y(),error:Y(e=>Lt(e.message))}}function au(e,t){a.onBeforeMount(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),gt(()=>{o.off(i)})}})}function wi(){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:yn.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ut.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:Re.Bezier,style:{}},connectionMode:Pe.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:Rt()?"Meta":"Control",zoomActivationKeyCode:Rt()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:lu(),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 su=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function uu(e,t,n){const o=iu(e),i=m=>{const p=m??[];e.hooks.updateNodeInternals.trigger(p)},r=m=>ks(m,e.nodes,e.edges),l=m=>Cs(m,e.nodes,e.edges),s=m=>Xo(m,e.edges),u=({id:m,type:p,nodeId:v})=>{var y;return Array.from(((y=e.connectionLookup.get(`${v}-${p}-${m??null}`))==null?void 0:y.values())??[])},c=m=>{if(m)return t.value.get(m)},d=m=>{if(m)return n.value.get(m)},f=(m,p,v)=>{var y,I;const Z=[];for(const K of m){const q={id:K.id,type:"position",dragging:v,from:K.from};if(p&&(q.position=K.position,K.parentNode)){const ee=c(K.parentNode);q.position={x:q.position.x-(((y=ee==null?void 0:ee.computedPosition)==null?void 0:y.x)??0),y:q.position.y-(((I=ee==null?void 0:ee.computedPosition)==null?void 0:I.y)??0)}}Z.push(q)}Z!=null&&Z.length&&e.hooks.nodesChange.trigger(Z)},g=m=>{if(!e.vueFlowRef)return;const p=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!p)return;const v=window.getComputedStyle(p),{m22:y}=new window.DOMMatrixReadOnly(v.transform),I=[];for(let Z=0;Z<m.length;++Z){const K=m[Z],q=c(K.id);if(q){const ee=At(K.nodeElement);if(!!(ee.width&&ee.height&&(q.dimensions.width!==ee.width||q.dimensions.height!==ee.height||K.forceUpdate))){const le=K.nodeElement.getBoundingClientRect();q.dimensions=ee,q.handleBounds.source=si("source",K.nodeElement,le,y),q.handleBounds.target=si("target",K.nodeElement,le,y),I.push({id:q.id,type:"dimensions",dimensions:ee})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),I.length&&e.hooks.nodesChange.trigger(I)},h=(m,p)=>{const v=new Set,y=new Set;for(const K of m)Le(K)?v.add(K.id):Te(K)&&y.add(K.id);const I=Be(t.value,v,!0),Z=Be(n.value,y);if(e.multiSelectionActive){for(const K of v)I.push($e(K,p));for(const K of y)Z.push($e(K,p))}I.length&&e.hooks.nodesChange.trigger(I),Z.length&&e.hooks.edgesChange.trigger(Z)},x=m=>{if(e.multiSelectionActive){const p=m.map(v=>$e(v.id,!0));e.hooks.nodesChange.trigger(p);return}e.hooks.nodesChange.trigger(Be(t.value,new Set(m.map(p=>p.id)),!0)),e.hooks.edgesChange.trigger(Be(n.value))},S=m=>{if(e.multiSelectionActive){const p=m.map(v=>$e(v.id,!0));e.hooks.edgesChange.trigger(p);return}e.hooks.edgesChange.trigger(Be(n.value,new Set(m.map(p=>p.id)))),e.hooks.nodesChange.trigger(Be(t.value,new Set,!0))},N=m=>{h(m,!0)},k=m=>{const v=(m||e.nodes).map(y=>(y.selected=!1,$e(y.id,!1)));e.hooks.nodesChange.trigger(v)},M=m=>{const v=(m||e.edges).map(y=>(y.selected=!1,$e(y.id,!1)));e.hooks.edgesChange.trigger(v)},_=m=>{if(!m||!m.length)return h([],!1);const p=m.reduce((v,y)=>{const I=$e(y.id,!1);return Le(y)?v.nodes.push(I):v.edges.push(I),v},{nodes:[],edges:[]});p.nodes.length&&e.hooks.nodesChange.trigger(p.nodes),p.edges.length&&e.hooks.edgesChange.trigger(p.edges)},C=m=>{var p;(p=e.d3Zoom)==null||p.scaleExtent([m,e.maxZoom]),e.minZoom=m},z=m=>{var p;(p=e.d3Zoom)==null||p.scaleExtent([e.minZoom,m]),e.maxZoom=m},L=m=>{var p;(p=e.d3Zoom)==null||p.translateExtent(m),e.translateExtent=m},G=m=>{e.nodeExtent=m,i()},P=m=>{var p;(p=e.d3Zoom)==null||p.clickDistance(m)},D=m=>{e.nodesDraggable=m,e.nodesConnectable=m,e.elementsSelectable=m},A=m=>{const p=m instanceof Function?m(e.nodes):m;!e.initialized&&!p.length||(e.nodes=ui(p,c,e.hooks.error.trigger))},B=m=>{const p=m instanceof Function?m(e.edges):m;if(!e.initialized&&!p.length)return;const v=In(p,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Mn(e.connectionLookup,n.value,v),e.edges=v},b=m=>{const p=m instanceof Function?m([...e.nodes,...e.edges]):m;!e.initialized&&!p.length||(A(p.filter(Le)),B(p.filter(Te)))},J=m=>{let p=m instanceof Function?m(e.nodes):m;p=Array.isArray(p)?p:[p];const v=ui(p,c,e.hooks.error.trigger),y=[];for(const I of v)y.push(Jo(I));y.length&&e.hooks.nodesChange.trigger(y)},w=m=>{let p=m instanceof Function?m(e.edges):m;p=Array.isArray(p)?p:[p];const v=In(p,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),y=[];for(const I of v)y.push(Jo(I));y.length&&e.hooks.edgesChange.trigger(y)},T=(m,p=!0,v=!1)=>{const y=m instanceof Function?m(e.nodes):m,I=Array.isArray(y)?y:[y],Z=[],K=[];function q(re){const le=s(re);for(const ce of le)(!he(ce.deletable)||ce.deletable)&&K.push(Qo(ce.id,ce.source,ce.target,ce.sourceHandle,ce.targetHandle))}function ee(re){const le=[];for(const ce of e.nodes)ce.parentNode===re&&le.push(ce);if(le.length){for(const ce of le)Z.push(jo(ce.id));p&&q(le);for(const ce of le)ee(ce.id)}}for(const re of I){const le=typeof re=="string"?c(re):re;le&&(he(le.deletable)&&!le.deletable||(Z.push(jo(le.id)),p&&q([le]),v&&ee(le.id)))}K.length&&e.hooks.edgesChange.trigger(K),Z.length&&e.hooks.nodesChange.trigger(Z)},E=m=>{const p=m instanceof Function?m(e.edges):m,v=Array.isArray(p)?p:[p],y=[];for(const I of v){const Z=typeof I=="string"?d(I):I;Z&&(he(Z.deletable)&&!Z.deletable||y.push(Qo(typeof I=="string"?I:I.id,Z.source,Z.target,Z.sourceHandle,Z.targetHandle)))}e.hooks.edgesChange.trigger(y)},$=(m,p,v=!0)=>{const y=d(m.id),I=Ws(m,p,y,v,e.hooks.error.trigger);if(I){const[Z]=In([I],e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges.splice(e.edges.indexOf(y),1,Z),Mn(e.connectionLookup,n.value,[Z]),Z}return!1},V=(m,p,v={replace:!1})=>{const y=d(m);if(!y)return;const I=typeof p=="function"?p(y):p;y.data=v.replace?I:{...y.data,...I}},F=m=>qo(m,e.nodes),R=m=>{const p=qo(m,e.edges);return Mn(e.connectionLookup,n.value,p),p},W=(m,p,v={replace:!1})=>{const y=c(m);if(!y)return;const I=typeof p=="function"?p(y):p;v.replace?e.nodes.splice(e.nodes.indexOf(y),1,I):Object.assign(y,I)},O=(m,p,v={replace:!1})=>{const y=c(m);if(!y)return;const I=typeof p=="function"?p(y):p;y.data=v.replace?I:{...y.data,...I}},X=(m,p,v=!1)=>{v?e.connectionClickStartHandle=m:e.connectionStartHandle=m,e.connectionEndHandle=null,e.connectionStatus=null,p&&(e.connectionPosition=p)},U=(m,p=null,v=null)=>{e.connectionStartHandle&&(e.connectionPosition=m,e.connectionEndHandle=p,e.connectionStatus=v)},te=(m,p)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,p?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ae=m=>{const p=Ss(m),v=p?null:dt(m)?m:c(m.id);return!p&&!v?[null,null,p]:[p?m:Vt(v),v,p]},ie=(m,p=!0,v=e.nodes)=>{const[y,I,Z]=ae(m);if(!y)return[];const K=[];for(const q of v||e.nodes){if(!Z&&(q.id===I.id||!q.computedPosition))continue;const ee=Vt(q),re=Ot(ee,y);(p&&re>0||re>=Number(y.width)*Number(y.height))&&K.push(q)}return K},ue=(m,p,v=!0)=>{const[y]=ae(m);if(!y)return!1;const I=Ot(y,p);return v&&I>0||I>=Number(y.width)*Number(y.height)},oe=m=>{const{viewport:p,dimensions:v,d3Zoom:y,d3Selection:I,translateExtent:Z}=e;if(!y||!I||!m.x&&!m.y)return!1;const K=We.translate(p.x+m.x,p.y+m.y).scale(p.zoom),q=[[0,0],[v.width,v.height]],ee=y.constrain()(K,q,Z),re=e.viewport.x!==ee.x||e.viewport.y!==ee.y||e.viewport.zoom!==ee.k;return y.transform(I,ee),re},se=m=>{const p=m instanceof Function?m(e):m,v=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];he(p.defaultEdgeOptions)&&(e.defaultEdgeOptions=p.defaultEdgeOptions);const y=p.modelValue||p.nodes||p.edges?[]:void 0;y&&(p.modelValue&&y.push(...p.modelValue),p.nodes&&y.push(...p.nodes),p.edges&&y.push(...p.edges),b(y));const I=()=>{he(p.maxZoom)&&z(p.maxZoom),he(p.minZoom)&&C(p.minZoom),he(p.translateExtent)&&L(p.translateExtent)};for(const Z of Object.keys(p)){const K=Z,q=p[K];![...su,...v].includes(K)&&he(q)&&(e[K]=q)}qt(()=>e.d3Zoom).not.toBeNull().then(I),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:g,setElements:b,setNodes:A,setEdges:B,addNodes:J,addEdges:w,removeNodes:T,removeEdges:E,findNode:c,findEdge:d,updateEdge:$,updateEdgeData:V,updateNode:W,updateNodeData:O,applyEdgeChanges:R,applyNodeChanges:F,addSelectedElements:N,addSelectedNodes:x,addSelectedEdges:S,setMinZoom:C,setMaxZoom:z,setTranslateExtent:L,setNodeExtent:G,setPaneClickDistance:P,removeSelectedElements:_,removeSelectedNodes:k,removeSelectedEdges:M,startConnection:X,updateConnection:U,endConnection:te,setInteractive:D,setState:se,getIntersectingNodes:ie,getIncomers:r,getOutgoers:l,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:ue,panBy:oe,fitView:m=>o.value.fitView(m),zoomIn:m=>o.value.zoomIn(m),zoomOut:m=>o.value.zoomOut(m),zoomTo:(m,p)=>o.value.zoomTo(m,p),setViewport:(m,p)=>o.value.setViewport(m,p),setTransform:(m,p)=>o.value.setTransform(m,p),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(m,p,v)=>o.value.setCenter(m,p,v),fitBounds:(m,p)=>o.value.fitBounds(m,p),project:m=>o.value.project(m),screenToFlowCoordinate:m=>o.value.screenToFlowCoordinate(m),flowToScreenCoordinate:m=>o.value.flowToScreenCoordinate(m),toObject:()=>{const m=[],p=[];for(const v of e.nodes){const{computedPosition:y,handleBounds:I,selected:Z,dimensions:K,isParent:q,resizing:ee,dragging:re,events:le,...ce}=v;m.push(ce)}for(const v of e.edges){const{selected:y,sourceNode:I,targetNode:Z,events:K,...q}=v;p.push(q)}return JSON.parse(JSON.stringify({nodes:m,edges:p,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:m=>new Promise(p=>{const{nodes:v,edges:y,position:I,zoom:Z,viewport:K}=m;if(v&&A(v),y&&B(y),K!=null&&K.x&&(K!=null&&K.y)||I){const q=(K==null?void 0:K.x)||I[0],ee=(K==null?void 0:K.y)||I[1],re=(K==null?void 0:K.zoom)||Z||e.viewport.zoom;return qt(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:q,y:ee,zoom:re}).then(()=>{p(!0)})})}else p(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const m=wi();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const p=We.translate(m.defaultViewport.x??0,m.defaultViewport.y??0).scale(He(m.defaultViewport.zoom??1,m.minZoom,m.maxZoom)),v=e.viewportRef.getBoundingClientRect(),y=[[0,0],[v.width,v.height]],I=e.d3Zoom.constrain()(p,y,m.translateExtent);e.d3Zoom.transform(e.d3Selection,I)}se(m)},$destroy:()=>{}}}const cu=["data-id","data-handleid","data-nodeid","data-handlepos"],du={name:"Handle",compatConfig:{MODE:3}},Je=a.defineComponent({...du,props:{id:{default:null},type:{},position:{default:()=>H.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=a.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),o=a.toRef(()=>n.type??"source"),i=a.toRef(()=>n.isValidConnection??null),{id:r,connectionStartHandle:l,connectionClickStartHandle:s,connectionEndHandle:u,vueFlowRef:c,nodesConnectable:d,noDragClassName:f,noPanClassName:g}=de(),{id:h,node:x,nodeEl:S,connectedEdges:N}=yi(),k=a.ref(),M=a.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),_=a.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=a.toRef(()=>{var B,b,J,w,T,E;return((B=l.value)==null?void 0:B.nodeId)===h&&((b=l.value)==null?void 0:b.id)===e.id&&((J=l.value)==null?void 0:J.type)===o.value||((w=u.value)==null?void 0:w.nodeId)===h&&((T=u.value)==null?void 0:T.id)===e.id&&((E=u.value)==null?void 0:E.type)===o.value}),z=a.toRef(()=>{var B,b,J;return((B=s.value)==null?void 0:B.nodeId)===h&&((b=s.value)==null?void 0:b.id)===e.id&&((J=s.value)==null?void 0:J.type)===o.value}),{handlePointerDown:L,handleClick:G}=mi({nodeId:h,handleId:e.id,isValidConnection:i,type:o}),P=a.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!N.value.some(B=>{const b=B[`${o.value}Handle`];return B[o.value]!==h?!1:b?b===e.id:!0}):typeof e.connectable=="number"?N.value.filter(B=>{const b=B[`${o.value}Handle`];return B[o.value]!==h?!1:b?b===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(x,N.value):he(e.connectable)?e.connectable:d.value);a.onMounted(()=>{var B;if(!x.dimensions.width||!x.dimensions.height)return;const b=(B=x.handleBounds[o.value])==null?void 0:B.find(F=>F.id===e.id);if(!c.value||b)return;const J=c.value.querySelector(".vue-flow__transformationpane");if(!S.value||!k.value||!J||!e.id)return;const w=S.value.getBoundingClientRect(),T=k.value.getBoundingClientRect(),E=window.getComputedStyle(J),{m22:$}=new window.DOMMatrixReadOnly(E.transform),V={id:e.id,position:e.position,x:(T.left-w.left)/$,y:(T.top-w.top)/$,type:o.value,nodeId:h,...At(k.value)};x.handleBounds[o.value]=[...x.handleBounds[o.value]??[],V]}),a.onUnmounted(()=>{const B=x.handleBounds[o.value];B&&(x.handleBounds[o.value]=B.filter(b=>b.id!==e.id))});function D(B){const b=Sn(B);P.value&&M.value&&(b&&B.button===0||!b)&&L(B)}function A(B){!h||!s.value&&!M.value||P.value&&G(B)}return t({handleClick:G,handlePointerDown:L,onClick:A,onPointerDown:D}),(B,b)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"handle",ref:k,"data-id":`${a.unref(r)}-${a.unref(h)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":a.unref(h),"data-handlepos":B.position,class:a.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${B.position}`,`vue-flow__handle-${e.id}`,a.unref(f),a.unref(g),o.value,{connectable:P.value,connecting:z.value,connectablestart:M.value,connectableend:_.value,connectionindicator:P.value&&(M.value&&!C.value||_.value&&C.value)}]]),onMousedown:D,onTouchstartPassive:D,onClick:A},[a.renderSlot(B.$slots,"default",{id:B.id})],42,cu))}}),Gt=function({sourcePosition:e=H.Bottom,targetPosition:t=H.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:l}){const s=l.label||n;return[a.h(Je,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?a.h(s):a.h(a.Fragment,[s]),a.h(Je,{type:"source",position:e,connectable:o,isValidConnection:r})]};Gt.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],Gt.inheritAttrs=!1,Gt.compatConfig={MODE:3};const fu=Gt,Xt=function({targetPosition:e=H.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[a.h(Je,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r])]};Xt.props=["targetPosition","label","isValidTargetPos","connectable","data"],Xt.inheritAttrs=!1,Xt.compatConfig={MODE:3};const hu=Xt,Ut=function({sourcePosition:e=H.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?a.h(r):a.h(a.Fragment,[r]),a.h(Je,{type:"source",position:e,connectable:n,isValidConnection:o})]};Ut.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Ut.inheritAttrs=!1,Ut.compatConfig={MODE:3};const pu=Ut,gu=["transform"],mu=["width","height","x","y","rx","ry"],yu=["y"],vu={name:"EdgeText",compatConfig:{MODE:3}},wu=a.defineComponent({...vu,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=a.ref({x:0,y:0,width:0,height:0}),n=a.ref(null),o=a.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);a.onMounted(i),a.watch([()=>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,l)=>(a.openBlock(),a.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(a.openBlock(),a.createElementBlock("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:a.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,mu)):a.createCommentVNode("",!0),a.createElementVNode("text",a.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[a.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(r.label),{key:0})):(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(r.label),1)],64))])],16,yu)],8,gu))}}),_u=["id","d","marker-end","marker-start"],bu=["d","stroke-width"],Eu={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Zt=a.defineComponent({...Eu,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=a.ref(null),o=a.ref(null),i=a.ref(null),r=a.useAttrs();return t({pathEl:n,interactionEl:o,labelEl:i}),(l,s)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",a.mergeProps(a.unref(r),{id:l.id,ref_key:"pathEl",ref:n,d:l.path,class:"vue-flow__edge-path","marker-end":l.markerEnd,"marker-start":l.markerStart}),null,16,_u),l.interactionWidth?(a.openBlock(),a.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:l.path,"stroke-width":l.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,bu)):a.createCommentVNode("",!0),l.label&&l.labelX&&l.labelY?(a.openBlock(),a.createBlock(wu,{key:1,ref_key:"labelEl",ref:i,x:l.labelX,y:l.labelY,label:l.label,"label-show-bg":l.labelShowBg,"label-bg-style":l.labelBgStyle,"label-bg-padding":l.labelBgPadding,"label-bg-border-radius":l.labelBgBorderRadius,"label-style":l.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):a.createCommentVNode("",!0)],64))}});function _i({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,l=Math.abs(o-t)/2,s=o<t?o+l:o-l;return[r,s,i,l]}function bi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:l,targetControlY:s}){const u=e*.125+i*.375+l*.375+n*.125,c=t*.125+r*.375+s*.375+o*.125,d=Math.abs(u-e),f=Math.abs(c-t);return[u,c,d,f]}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 l,s;switch(e){case H.Left:l=t-Wt(t-o,r),s=n;break;case H.Right:l=t+Wt(o-t,r),s=n;break;case H.Top:l=t,s=n-Wt(n-i,r);break;case H.Bottom:l=t,s=n+Wt(i-n,r);break}return[l,s]}function $n(e){const{sourceX:t,sourceY:n,sourcePosition:o=H.Bottom,targetX:i,targetY:r,targetPosition:l=H.Top,curvature:s=.25}=e,[u,c]=Ei({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,f]=Ei({pos:l,x1:i,y1:r,x2:t,y2:n,c:s}),[g,h,x,S]=bi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${t},${n} C${u},${c} ${d},${f} ${i},${r}`,g,h,x,S]}function xi({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,l;switch(e){case H.Left:case H.Right:r=.5*(t+o),l=n;break;case H.Top:case H.Bottom:r=t,l=.5*(n+i);break}return[r,l]}function Si(e){const{sourceX:t,sourceY:n,sourcePosition:o=H.Bottom,targetX:i,targetY:r,targetPosition:l=H.Top}=e,[s,u]=xi({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=xi({pos:l,x1:i,y1:r,x2:t,y2:n}),[f,g,h,x]=bi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${s},${u} ${c},${d} ${i},${r}`,f,g,h,x]}const Ni={[H.Left]:{x:-1,y:0},[H.Right]:{x:1,y:0},[H.Top]:{x:0,y:-1},[H.Bottom]:{x:0,y:1}};function xu({source:e,sourcePosition:t=H.Bottom,target:n}){return t===H.Left||t===H.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 Ci(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Su({source:e,sourcePosition:t=H.Bottom,target:n,targetPosition:o=H.Top,center:i,offset:r}){const l=Ni[t],s=Ni[o],u={x:e.x+l.x*r,y:e.y+l.y*r},c={x:n.x+s.x*r,y:n.y+s.y*r},d=xu({source:u,sourcePosition:t,target:c}),f=d.x!==0?"x":"y",g=d[f];let h,x,S;const N={x:0,y:0},k={x:0,y:0},[M,_,C,z]=_i({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*s[f]===-1){x=i.x??M,S=i.y??_;const G=[{x,y:u.y},{x,y:c.y}],P=[{x:u.x,y:S},{x:c.x,y:S}];l[f]===g?h=f==="x"?G:P:h=f==="x"?P:G}else{const G=[{x:u.x,y:c.y}],P=[{x:c.x,y:u.y}];if(f==="x"?h=l.x===g?P:G:h=l.y===g?G:P,t===o){const J=Math.abs(e[f]-n[f]);if(J<=r){const w=Math.min(r-1,r-J);l[f]===g?N[f]=(u[f]>e[f]?-1:1)*w:k[f]=(c[f]>n[f]?-1:1)*w}}if(t!==o){const J=f==="x"?"y":"x",w=l[f]===s[J],T=u[J]>c[J],E=u[J]<c[J];(l[f]===1&&(!w&&T||w&&E)||l[f]!==1&&(!w&&E||w&&T))&&(h=f==="x"?G:P)}const D={x:u.x+N.x,y:u.y+N.y},A={x:c.x+k.x,y:c.y+k.y},B=Math.max(Math.abs(D.x-h[0].x),Math.abs(A.x-h[0].x)),b=Math.max(Math.abs(D.y-h[0].y),Math.abs(A.y-h[0].y));B>=b?(x=(D.x+A.x)/2,S=h[0].y):(x=h[0].x,S=(D.y+A.y)/2)}return[[e,{x:u.x+N.x,y:u.y+N.y},...h,{x:c.x+k.x,y:c.y+k.y},n],x,S,C,z]}function Nu(e,t,n,o){const i=Math.min(Ci(e,t)/2,Ci(t,n)/2,o),{x:r,y:l}=t;if(e.x===r&&r===n.x||e.y===l&&l===n.y)return`L${r} ${l}`;if(e.y===l){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${l}Q ${r},${l} ${r},${l+i*d}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${l+i*u}Q ${r},${l} ${r+i*s},${l}`}function Bn(e){const{sourceX:t,sourceY:n,sourcePosition:o=H.Bottom,targetX:i,targetY:r,targetPosition:l=H.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[f,g,h,x,S]=Su({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:l,center:{x:u,y:c},offset:d});return[f.reduce((k,M,_)=>{let C;return _>0&&_<f.length-1?C=Nu(f[_-1],M,f[_+1],s):C=`${_===0?"M":"L"}${M.x} ${M.y}`,k+=C,k},""),g,h,x,S]}function Cu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,l,s,u]=_i({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,l,s,u]}const ku=a.defineComponent({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]=Cu(e);return a.h(Zt,{path:n,labelX:o,labelY:i,...t,...e})}}}),ki=a.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Bn({...e,sourcePosition:e.sourcePosition??H.Bottom,targetPosition:e.targetPosition??H.Top});return a.h(Zt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Mu=a.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>a.h(ki,{...e,...t,borderRadius:0})}}),Iu=a.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=$n({...e,sourcePosition:e.sourcePosition??H.Bottom,targetPosition:e.targetPosition??H.Top});return a.h(Zt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Pu=a.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Si({...e,sourcePosition:e.sourcePosition??H.Bottom,targetPosition:e.targetPosition??H.Top});return a.h(Zt,{path:n,labelX:o,labelY:i,...t,...e})}}}),Tu={input:pu,default:fu,output:hu},$u={default:Iu,straight:ku,step:Mu,smoothstep:ki,simplebezier:Pu};function Bu(e,t,n){const o=a.computed(()=>S=>t.value.get(S)),i=a.computed(()=>S=>n.value.get(S)),r=a.computed(()=>{const S={...$u,...e.edgeTypes},N=Object.keys(S);for(const k of e.edges)k.type&&!N.includes(k.type)&&(S[k.type]=k.type);return S}),l=a.computed(()=>{const S={...Tu,...e.nodeTypes},N=Object.keys(S);for(const k of e.nodes)k.type&&!N.includes(k.type)&&(S[k.type]=k.type);return S}),s=a.computed(()=>e.onlyRenderVisibleElements?Go(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=a.computed(()=>{if(e.onlyRenderVisibleElements){const S=[];for(const N of e.edges){const k=t.value.get(N.source),M=t.value.get(N.target);Os({sourcePos:k.computedPosition||{x:0,y:0},targetPos:M.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:M.dimensions.width,targetHeight:M.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&S.push(N)}return S}return e.edges}),c=a.computed(()=>[...s.value,...u.value]),d=a.computed(()=>{const S=[];for(const N of e.nodes)N.selected&&S.push(N);return S}),f=a.computed(()=>{const S=[];for(const N of e.edges)N.selected&&S.push(N);return S}),g=a.computed(()=>[...d.value,...f.value]),h=a.computed(()=>{const S=[];for(const N of e.nodes)N.dimensions.width&&N.dimensions.height&&N.handleBounds!==void 0&&S.push(N);return S}),x=a.computed(()=>s.value.length>0&&h.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:l,getEdges:u,getNodes:s,getSelectedElements:g,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:h,areNodesInitialized:x}}class Fe{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=a.getCurrentInstance())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??Fe.instance;return Fe.instance=o??new Fe,n&&(n.config.globalProperties.$vueFlowStorage=Fe.instance),Fe.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=wi(),i=a.reactive(o),r={};for(const[g,h]of Object.entries(i.hooks)){const x=`on${g.charAt(0).toUpperCase()+g.slice(1)}`;r[x]=h.on}const l={};for(const[g,h]of Object.entries(i.hooks))l[g]=h.trigger;const s=a.computed(()=>{const g=new Map;for(const h of i.nodes)g.set(h.id,h);return g}),u=a.computed(()=>{const g=new Map;for(const h of i.edges)g.set(h.id,h);return g}),c=Bu(i,s,u),d=uu(i,s,u);d.setState({...i,...n});const f={...r,...c,...d,...zi(i),nodeLookup:s,edgeLookup:u,emits:l,id:t,vueFlowVersion:"1.42.1",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=Fe.getInstance(),n=a.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,l=r??(n==null?void 0:n.vueFlowId);let s;if(n){const u=a.inject(fi,null);typeof u<"u"&&u!==null&&(!l||u.id===l)&&(s=u)}if(s||l&&(s=t.get(l)),!s||l&&s.id!==l){const u=r??t.getId(),c=t.create(u,i);s=c,(n??a.effectScope(!0)).run(()=>{a.watch(c.applyDefault,(f,g,h)=>{const x=N=>{c.applyNodeChanges(N)},S=N=>{c.applyEdgeChanges(N)};f?(c.onNodesChange(x),c.onEdgesChange(S)):(c.hooks.value.nodesChange.off(x),c.hooks.value.edgesChange.off(S)),h(()=>{c.hooks.value.nodesChange.off(x),c.hooks.value.edgesChange.off(S)})},{immediate:!0}),gt(()=>{if(s){const f=t.get(s.id);f?f.$destroy():Lt(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(a.provide(fi,s),n.vueFlowId=s.id),o){const u=a.getCurrentInstance();(u==null?void 0:u.type.name)!=="VueFlow"&&s.emits.error(new pe(fe.USEVUEFLOW_OPTIONS))}return s}function Du(e){const{emits:t,dimensions:n}=de();let o;a.onMounted(()=>{const i=e.value,r=()=>{if(!i)return;const l=At(i);(l.width===0||l.height===0)&&t.error(new pe(fe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:l.width||500,height:l.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),a.onBeforeUnmount(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const Vu={name:"UserSelection",compatConfig:{MODE:3}},Ou=a.defineComponent({...Vu,props:{userSelectionRect:{}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:a.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Au=["tabIndex"],zu={name:"NodesSelection",compatConfig:{MODE:3}},Ru=a.defineComponent({...zu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:l}=de(),s=vi(),u=a.ref(null),c=gi({el:u,onStart(x){t.selectionDragStart(x)},onDrag(x){t.selectionDrag(x)},onStop(x){t.selectionDragStop(x)}});a.onMounted(()=>{var x;r.value||(x=u.value)==null||x.focus({preventScroll:!0})});const d=a.computed(()=>Yo(o.value)),f=a.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function g(x){t.selectionContextMenu({event:x,nodes:o.value})}function h(x){r||Ke[x.key]&&(x.preventDefault(),s({x:Ke[x.key].x,y:Ke[x.key].y},x.shiftKey))}return(x,S)=>!a.unref(l)&&d.value.width&&d.value.height?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["vue-flow__nodesselection vue-flow__container",a.unref(i)]),style:a.normalizeStyle({transform:`translate(${a.unref(n).x}px,${a.unref(n).y}px) scale(${a.unref(n).zoom})`})},[a.createElementVNode("div",{ref_key:"el",ref:u,class:a.normalizeClass([{dragging:a.unref(c)},"vue-flow__nodesselection-rect"]),style:a.normalizeStyle(f.value),tabIndex:a.unref(r)?void 0:-1,onContextmenu:g,onKeydown:h},null,46,Au)],6)):a.createCommentVNode("",!0)}});function Hu(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Lu={name:"Pane",compatConfig:{MODE:3}},Fu=a.defineComponent({...Lu,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:l,userSelectionRect:s,elementsSelectable:u,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:g,removeEdges:h,selectionMode:x,deleteKeyCode:S,multiSelectionKeyCode:N,multiSelectionActive:k,edgeLookup:M,nodeLookup:_,connectionLookup:C,defaultEdgeOptions:z}=de(),L=a.ref(null),G=a.ref(new Set),P=a.ref(new Set),D=a.ref(),A=a.toRef(()=>u.value&&(e.isSelecting||r.value));let B=!1,b=!1;const J=ct(S,{actInsideInputWithModifier:!1}),w=ct(N);a.watch(J,O=>{O&&(g(f.value),h(d.value),c.value=!1)}),a.watch(w,O=>{k.value=O});function T(O,X){return U=>{U.target===X&&(O==null||O(U))}}function E(O){if(B){B=!1;return}i.paneClick(O),l(),c.value=!1}function $(O){O.preventDefault(),O.stopPropagation(),i.paneContextMenu(O)}function V(O){i.paneScroll(O)}function F(O){var X,U,te;if(D.value=(X=t.value)==null?void 0:X.getBoundingClientRect(),!u.value||!e.isSelecting||O.button!==0||O.target!==L.value||!D.value)return;(te=(U=O.target)==null?void 0:U.setPointerCapture)==null||te.call(U,O.pointerId);const{x:ae,y:ie}=Hu(O,D.value);b=!0,B=!1,l(),s.value={width:0,height:0,startX:ae,startY:ie,x:ae,y:ie},i.selectionStart(O)}function R(O){var X;if(!D.value||!s.value)return;B=!0;const{x:U,y:te}=De(O,D.value),{startX:ae=0,startY:ie=0}=s.value,ue={startX:ae,startY:ie,x:U<ae?U:ae,y:te<ie?te:ie,width:Math.abs(U-ae),height:Math.abs(te-ie)},oe=G.value,se=P.value;G.value=new Set(Go(n.value,ue,o.value,x.value===yn.Partial,!0).map(Q=>Q.id)),P.value=new Set;const j=((X=z.value)==null?void 0:X.selectable)??!0;for(const Q of G.value){const ne=C.value.get(Q);if(ne)for(const{edgeId:m}of ne.values()){const p=M.value.get(m);p&&(p.selectable??j)&&P.value.add(m)}}if(!di(oe,G.value)){const Q=Be(_.value,G.value,!0);i.nodesChange(Q)}if(!di(se,P.value)){const Q=Be(M.value,P.value);i.edgesChange(Q)}s.value=ue,r.value=!0,c.value=!1}function W(O){var X;O.button!==0||!b||((X=O.target)==null||X.releasePointerCapture(O.pointerId),!r.value&&s.value&&O.target===L.value&&E(O),r.value=!1,s.value=null,c.value=G.value.size>0,i.selectionEnd(O),e.selectionKeyPressed&&(B=!1),b=!1)}return(O,X)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"container",ref:L,class:a.normalizeClass(["vue-flow__pane vue-flow__container",{selection:O.isSelecting}]),onClick:X[0]||(X[0]=U=>A.value?void 0:T(E,L.value)(U)),onContextmenu:X[1]||(X[1]=U=>T($,L.value)(U)),onWheelPassive:X[2]||(X[2]=U=>T(V,L.value)(U)),onPointerenter:X[3]||(X[3]=U=>A.value?void 0:a.unref(i).paneMouseEnter(U)),onPointerdown:X[4]||(X[4]=U=>A.value?F(U):a.unref(i).paneMouseMove(U)),onPointermove:X[5]||(X[5]=U=>A.value?R(U):a.unref(i).paneMouseMove(U)),onPointerup:X[6]||(X[6]=U=>A.value?W(U):void 0),onPointerleave:X[7]||(X[7]=U=>a.unref(i).paneMouseLeave(U))},[a.renderSlot(O.$slots,"default"),a.unref(r)&&a.unref(s)?(a.openBlock(),a.createBlock(Ou,{key:0,"user-selection-rect":a.unref(s)},null,8,["user-selection-rect"])):a.createCommentVNode("",!0),a.unref(c)&&a.unref(f).length?(a.openBlock(),a.createBlock(Ru,{key:1})):a.createCommentVNode("",!0)],34))}}),Yu={name:"Transform",compatConfig:{MODE:3}},Gu=a.defineComponent({...Yu,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=de(),i=a.computed(()=>n.value?!o.value:!1),r=a.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(l,s)=>(a.openBlock(),a.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:a.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[a.renderSlot(l.$slots,"default")],4))}}),Xu={name:"Viewport",compatConfig:{MODE:3}},Uu=a.defineComponent({...Xu,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:g,zoomOnPinch:h,zoomOnScroll:x,preventScrolling:S,noWheelClassName:N,noPanClassName:k,emits:M,connectionStartHandle:_,userSelectionActive:C,paneDragging:z,d3Zoom:L,d3Selection:G,d3ZoomHandler:P,viewport:D,viewportRef:A,paneClickDistance:B}=de();Du(A);const b=a.ref(!1),J=a.ref(!1);let w=null,T=!1,E=0,$={x:0,y:0,zoom:0};const V=ct(s),F=ct(l),R=ct(r),W=a.toRef(()=>(!F.value||F.value&&l.value===!0)&&(V.value||f.value)),O=a.toRef(()=>V.value||u.value),X=a.toRef(()=>F.value||l.value===!0&&W.value!==!0);a.onMounted(()=>{if(!A.value){Lt("Viewport element is missing");return}const oe=A.value,se=oe.getBoundingClientRect(),j=ws().clickDistance(B.value).scaleExtent([t.value,n.value]).translateExtent(i.value),Q=ye(oe).call(j),ne=Q.on("wheel.zoom"),m=We.translate(o.value.x??0,o.value.y??0).scale(He(o.value.zoom??1,t.value,n.value)),p=[[0,0],[se.width,se.height]],v=j.constrain()(m,p,i.value);j.transform(Q,v),j.wheelDelta(te),L.value=j,G.value=Q,P.value=ne,D.value={x:v.x,y:v.y,zoom:v.k},j.on("start",y=>{var I;if(!y.sourceEvent)return null;E=y.sourceEvent.button,b.value=!0;const Z=ie(y.transform);((I=y.sourceEvent)==null?void 0:I.type)==="mousedown"&&(z.value=!0),$=Z,M.viewportChangeStart(Z),M.moveStart({event:y,flowTransform:Z})}),j.on("end",y=>{if(!y.sourceEvent)return null;if(b.value=!1,z.value=!1,U(W.value,E??0)&&!T&&M.paneContextMenu(y.sourceEvent),T=!1,ae($,y.transform)){const I=ie(y.transform);$=I,M.viewportChangeEnd(I),M.moveEnd({event:y,flowTransform:I})}}),j.filter(y=>{var I;const Z=R.value||x.value,K=h.value&&y.ctrlKey,q=y.button;if(q===1&&y.type==="mousedown"&&(ue(y,"vue-flow__node")||ue(y,"vue-flow__edge")))return!0;if(!W.value&&!Z&&!O.value&&!g.value&&!h.value||C.value||!g.value&&y.type==="dblclick"||ue(y,N.value)&&y.type==="wheel"||ue(y,k.value)&&(y.type!=="wheel"||O.value&&y.type==="wheel"&&!R.value)||!h.value&&y.ctrlKey&&y.type==="wheel"||!Z&&!O.value&&!K&&y.type==="wheel")return!1;if(!h&&y.type==="touchstart"&&((I=y.touches)==null?void 0:I.length)>1)return y.preventDefault(),!1;if(!W.value&&(y.type==="mousedown"||y.type==="touchstart")||l.value===!0&&Array.isArray(f.value)&&f.value.includes(0)&&q===0||Array.isArray(f.value)&&!f.value.includes(q)&&(y.type==="mousedown"||y.type==="touchstart"))return!1;const ee=Array.isArray(f.value)&&f.value.includes(q)||l.value===!0&&Array.isArray(f.value)&&!f.value.includes(0)||!q||q<=1;return(!y.ctrlKey||V.value||y.type==="wheel")&&ee}),a.watch([C,W],()=>{C.value&&!b.value?j.on("zoom",null):C.value||j.on("zoom",y=>{D.value={x:y.transform.x,y:y.transform.y,zoom:y.transform.k};const I=ie(y.transform);T=U(W.value,E??0),M.viewportChange(I),M.move({event:y,flowTransform:I})})},{immediate:!0}),a.watch([C,O,c,R,h,S,N],()=>{O.value&&!R.value&&!C.value?Q.on("wheel.zoom",y=>{if(ue(y,N.value))return!1;const I=R.value||x.value,Z=h.value&&y.ctrlKey;if(!(!S.value||O.value||I||Z))return!1;y.preventDefault(),y.stopImmediatePropagation();const q=Q.property("__zoom").k||1,ee=Rt();if(!V.value&&y.ctrlKey&&h.value&&ee){const pt=_e(y),Oc=te(y),Ac=q*2**Oc;j.scaleTo(Q,Ac,pt,y);return}const re=y.deltaMode===1?20:1;let le=c.value===ut.Vertical?0:y.deltaX*re,ce=c.value===ut.Horizontal?0:y.deltaY*re;!ee&&y.shiftKey&&c.value!==ut.Vertical&&!le&&ce&&(le=ce,ce=0),j.translateBy(Q,-(le/q)*d.value,-(ce/q)*d.value);const xe=ie(Q.property("__zoom"));w&&clearTimeout(w),J.value?(M.move({event:y,flowTransform:xe}),M.viewportChange(xe),w=setTimeout(()=>{M.moveEnd({event:y,flowTransform:xe}),M.viewportChangeEnd(xe),J.value=!1},150)):(J.value=!0,M.moveStart({event:y,flowTransform:xe}),M.viewportChangeStart(xe))},{passive:!1}):typeof ne<"u"&&Q.on("wheel.zoom",function(y,I){const Z=!S.value&&y.type==="wheel"&&!y.ctrlKey,K=R.value||x.value,q=h.value&&y.ctrlKey;if(!K&&!u.value&&!q&&y.type==="wheel"||Z||ue(y,N.value))return null;y.preventDefault(),ne.call(this,y,I)},{passive:!1})},{immediate:!0})});function U(oe,se){return se===2&&Array.isArray(oe)&&oe.includes(2)}function te(oe){const se=oe.ctrlKey&&Rt()?10:1;return-oe.deltaY*(oe.deltaMode===1?.05:oe.deltaMode?1:.002)*se}function ae(oe,se){return oe.x!==se.x&&!Number.isNaN(se.x)||oe.y!==se.y&&!Number.isNaN(se.y)||oe.zoom!==se.k&&!Number.isNaN(se.k)}function ie(oe){return{x:oe.x,y:oe.y,zoom:oe.k}}function ue(oe,se){return oe.target.closest(`.${se}`)}return(oe,se)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"viewportRef",ref:A,class:"vue-flow__viewport vue-flow__container"},[a.createVNode(Fu,{"is-selecting":X.value,"selection-key-pressed":a.unref(F),class:a.normalizeClass({connecting:!!a.unref(_),dragging:a.unref(z),draggable:a.unref(f)===!0||Array.isArray(a.unref(f))&&a.unref(f).includes(0)})},{default:a.withCtx(()=>[a.createVNode(Gu,null,{default:a.withCtx(()=>[a.renderSlot(oe.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Zu=["id"],Wu=["id"],Ku=["id"],qu={name:"A11yDescriptions",compatConfig:{MODE:3}},Ju=a.defineComponent({...qu,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{id:`${a.unref(Do)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+a.toDisplayString(a.unref(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,Zu),a.createElementVNode("div",{id:`${a.unref(Vo)}-${a.unref(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,Wu),a.unref(n)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,id:`${a.unref(xs)}-${a.unref(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%)"}},a.toDisplayString(a.unref(o)),9,Ku))],64))}});function ju(){const e=de();a.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Qu(e,t,n){return n===H.Left?e-t:n===H.Right?e+t:e}function ec(e,t,n){return n===H.Top?e-t:n===H.Bottom?e+t:e}const Dn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=H.Top,type:i}){return a.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Qu(t,e,o),cy:ec(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Dn.props=["radius","centerX","centerY","position","type"],Dn.compatConfig={MODE:3};const Mi=Dn,tc=a.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:g,multiSelectionActive:h,disableKeyboardA11y:x,elementsSelectable:S,edgesUpdatable:N,edgesFocusable:k,hooks:M}=de(),_=a.computed(()=>d(e.id)),{emit:C,on:z}=js(_.value,r),L=a.inject(Ft),G=a.getCurrentInstance(),P=a.ref(!1),D=a.ref(!1),A=a.ref(""),B=a.ref(null),b=a.ref("source"),J=a.ref(null),w=a.toRef(()=>typeof _.value.selectable>"u"?S.value:_.value.selectable),T=a.toRef(()=>typeof _.value.updatable>"u"?N.value:_.value.updatable),E=a.toRef(()=>typeof _.value.focusable>"u"?k.value:_.value.focusable);a.provide(Ks,e.id),a.provide(qs,J);const $=a.computed(()=>_.value.class instanceof Function?_.value.class(_.value):_.value.class),V=a.computed(()=>_.value.style instanceof Function?_.value.style(_.value):_.value.style),F=a.computed(()=>{const p=_.value.type||"default",v=L==null?void 0:L[`edge-${p}`];if(v)return v;let y=_.value.template??u.value[p];if(typeof y=="string"&&G){const I=Object.keys(G.appContext.components);I&&I.includes(p)&&(y=a.resolveComponent(p,!1))}return y&&typeof y!="string"?y:(r.error(new pe(fe.EDGE_TYPE_MISSING,y)),!1)}),{handlePointerDown:R}=mi({nodeId:A,handleId:B,type:b,isValidConnection:g,edgeUpdaterType:b,onEdgeUpdate:X,onEdgeUpdateEnd:U});return()=>{const p=f(_.value.source),v=f(_.value.target),y="pathOptions"in _.value?_.value.pathOptions:{};if(!p&&!v)return r.error(new pe(fe.EDGE_SOURCE_TARGET_MISSING,_.value.id,_.value.source,_.value.target)),null;if(!p)return r.error(new pe(fe.EDGE_SOURCE_MISSING,_.value.id,_.value.source)),null;if(!v)return r.error(new pe(fe.EDGE_TARGET_MISSING,_.value.id,_.value.target)),null;if(!_.value||_.value.hidden||p.hidden||v.hidden)return null;let I;o.value===Pe.Strict?I=p.handleBounds.source:I=[...p.handleBounds.source||[],...p.handleBounds.target||[]];const Z=ni(I,_.value.sourceHandle);let K;o.value===Pe.Strict?K=v.handleBounds.target:K=[...v.handleBounds.target||[],...v.handleBounds.source||[]];const q=ni(K,_.value.targetHandle),ee=(Z==null?void 0:Z.position)||H.Bottom,re=(q==null?void 0:q.position)||H.Top,{x:le,y:ce}=qe(p,Z,ee),{x:xe,y:pt}=qe(v,q,re);return _.value.sourceX=le,_.value.sourceY=ce,_.value.targetX=xe,_.value.targetY=pt,a.h("g",{ref:J,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${F.value===!1?"default":_.value.type||"default"}`,s.value,$.value,{updating:P.value,selected:_.value.selected,animated:_.value.animated,inactive:!w.value&&!M.value.edgeClick.hasListeners()}],onClick:ae,onContextmenu:ie,onDblclick:ue,onMouseenter:oe,onMousemove:se,onMouseleave:j,onKeyDown:E.value?m:void 0,tabIndex:E.value?0:void 0,"aria-label":_.value.ariaLabel===null?void 0:_.value.ariaLabel||`Edge from ${_.value.source} to ${_.value.target}`,"aria-describedby":E.value?`${Vo}-${t}`:void 0,role:E.value?"button":"img"},[D.value?null:a.h(F.value===!1?u.value.default:F.value,{id:e.id,sourceNode:p,targetNode:v,source:_.value.source,target:_.value.target,type:_.value.type,updatable:T.value,selected:_.value.selected,animated:_.value.animated,label:_.value.label,labelStyle:_.value.labelStyle,labelShowBg:_.value.labelShowBg,labelBgStyle:_.value.labelBgStyle,labelBgPadding:_.value.labelBgPadding,labelBgBorderRadius:_.value.labelBgBorderRadius,data:_.value.data,events:{..._.value.events,...z},style:V.value,markerStart:`url('#${ht(_.value.markerStart,t)}')`,markerEnd:`url('#${ht(_.value.markerEnd,t)}')`,sourcePosition:ee,targetPosition:re,sourceX:le,sourceY:ce,targetX:xe,targetY:pt,sourceHandleId:_.value.sourceHandle,targetHandleId:_.value.targetHandle,interactionWidth:_.value.interactionWidth,...y}),[T.value==="source"||T.value===!0?[a.h("g",{onMousedown:Q,onMouseenter:W,onMouseout:O},a.h(Mi,{position:ee,centerX:le,centerY:ce,radius:i.value,type:"source","data-type":"source"}))]:null,T.value==="target"||T.value===!0?[a.h("g",{onMousedown:ne,onMouseenter:W,onMouseout:O},a.h(Mi,{position:re,centerX:xe,centerY:pt,radius:i.value,type:"target","data-type":"target"}))]:null]])};function W(){P.value=!0}function O(){P.value=!1}function X(p,v){C.update({event:p,edge:_.value,connection:v})}function U(p){C.updateEnd({event:p,edge:_.value}),D.value=!1}function te(p,v){p.button===0&&(D.value=!0,A.value=v?_.value.target:_.value.source,B.value=(v?_.value.targetHandle:_.value.sourceHandle)??"",b.value=v?"target":"source",C.updateStart({event:p,edge:_.value}),R(p))}function ae(p){var v;const y={event:p,edge:_.value};w.value&&(l.value=!1,_.value.selected&&h.value?(c([_.value]),(v=J.value)==null||v.blur()):n([_.value])),C.click(y)}function ie(p){C.contextMenu({event:p,edge:_.value})}function ue(p){C.doubleClick({event:p,edge:_.value})}function oe(p){C.mouseEnter({event:p,edge:_.value})}function se(p){C.mouseMove({event:p,edge:_.value})}function j(p){C.mouseLeave({event:p,edge:_.value})}function Q(p){te(p,!0)}function ne(p){te(p,!1)}function m(p){var v;!x.value&&Oo.includes(p.key)&&w.value&&(p.key==="Escape"?((v=J.value)==null||v.blur(),c([d(e.id)])):n([d(e.id)]))}}}),nc=a.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:l,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:f}=de(),g=(e=a.inject(Ft))==null?void 0:e["connection-line"],h=a.computed(()=>{var M;return f((M=o.value)==null?void 0:M.nodeId)}),x=a.computed(()=>{var M;return f((M=i.value)==null?void 0:M.nodeId)??null}),S=a.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),N=a.computed(()=>u.value.markerStart?`url(#${ht(u.value.markerStart,t)})`:""),k=a.computed(()=>u.value.markerEnd?`url(#${ht(u.value.markerEnd,t)})`:"");return()=>{var M,_,C;if(!h.value||!o.value)return null;const z=o.value.id,L=o.value.type,G=h.value.handleBounds;let P=(G==null?void 0:G[L])||[];if(n.value===Pe.Loose){const V=(G==null?void 0:G[L==="source"?"target":"source"])||[];P=[...P,...V]}if(!P)return null;const D=(z?P.find(V=>V.id===z):P[0])??null,A=(D==null?void 0:D.position)||H.Top,{x:B,y:b}=qe(h.value,D,A);let J=null;x.value&&(n.value===Pe.Strict?J=((M=x.value.handleBounds[L==="source"?"target":"source"])==null?void 0:M.find(V=>{var F;return V.id===((F=i.value)==null?void 0:F.id)}))||null:J=((_=[...x.value.handleBounds.source||[],...x.value.handleBounds.target||[]])==null?void 0:_.find(V=>{var F;return V.id===((F=i.value)==null?void 0:F.id)}))||null);const w=((C=i.value)==null?void 0:C.position)??(A?Cn[A]:null);if(!A||!w)return null;const T=l.value??u.value.type??Re.Bezier;let E="";const $={sourceX:B,sourceY:b,sourcePosition:A,targetX:S.value.x,targetY:S.value.y,targetPosition:w};return T===Re.Bezier?[E]=$n($):T===Re.Step?[E]=Bn({...$,borderRadius:0}):T===Re.SmoothStep?[E]=Bn($):T===Re.SimpleBezier?[E]=Si($):E=`M${B},${b} ${S.value.x},${S.value.y}`,a.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},a.h("g",{class:"vue-flow__connection"},g?a.h(g,{sourceX:B,sourceY:b,sourcePosition:A,targetX:S.value.x,targetY:S.value.y,targetPosition:w,sourceNode:h.value,sourceHandle:D,targetNode:x.value,targetHandle:J,markerEnd:k.value,markerStart:N.value,connectionStatus:c.value}):a.h("path",{d:E,class:[u.value.class,c,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":k.value,"marker-start":N.value})))}}}),oc=["id","markerWidth","markerHeight","markerUnits","orient"],ic={name:"MarkerType",compatConfig:{MODE:3}},rc=a.defineComponent({...ic,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)=>(a.openBlock(),a.createElementBlock("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===a.unref(vn).ArrowClosed?(a.openBlock(),a.createElementBlock("polyline",{key:0,style:a.normalizeStyle({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)):a.createCommentVNode("",!0),t.type===a.unref(vn).Arrow?(a.openBlock(),a.createElementBlock("polyline",{key:1,style:a.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):a.createCommentVNode("",!0)],8,oc))}}),lc={class:"vue-flow__marker vue-flow__container"},ac={name:"MarkerDefinitions",compatConfig:{MODE:3}},sc=a.defineComponent({...ac,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=a.computed(()=>{const l=new Set,s=[],u=c=>{if(c){const d=ht(c,t);l.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),l.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return s.sort((c,d)=>c.id.localeCompare(d.id))});return(l,s)=>(a.openBlock(),a.createElementBlock("svg",lc,[a.createElementVNode("defs",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,u=>(a.openBlock(),a.createBlock(rc,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),uc={name:"Edges",compatConfig:{MODE:3}},cc=a.defineComponent({...uc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createVNode(sc),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(n),l=>(a.openBlock(),a.createElementBlock("svg",{key:l.id,class:"vue-flow__edges vue-flow__container",style:a.normalizeStyle({zIndex:a.unref(As)(l,a.unref(t),a.unref(o))})},[a.createVNode(a.unref(tc),{id:l.id},null,8,["id"])],4))),128)),a.createVNode(a.unref(nc))],64))}}),dc=a.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:l,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:g,elevateNodesOnSelect:h,disableKeyboardA11y:x,ariaLiveMessage:S,snapToGrid:N,snapGrid:k,nodeDragThreshold:M,nodesDraggable:_,elementsSelectable:C,nodesConnectable:z,nodesFocusable:L,hooks:G}=de(),P=a.ref(null);a.provide(pi,P),a.provide(hi,e.id);const D=a.inject(Ft),A=a.getCurrentInstance(),B=vi(),{node:b,parentNode:J}=yi(e.id),{emit:w,on:T}=nu(b,l),E=a.toRef(()=>typeof b.draggable>"u"?_.value:b.draggable),$=a.toRef(()=>typeof b.selectable>"u"?C.value:b.selectable),V=a.toRef(()=>typeof b.connectable>"u"?z.value:b.connectable),F=a.toRef(()=>typeof b.focusable>"u"?L.value:b.focusable),R=a.toRef(()=>$.value||E.value||G.value.nodeClick.hasListeners()||G.value.nodeDoubleClick.hasListeners()||G.value.nodeMouseEnter.hasListeners()||G.value.nodeMouseMove.hasListeners()||G.value.nodeMouseLeave.hasListeners()),W=a.toRef(()=>!!b.dimensions.width&&!!b.dimensions.height),O=a.computed(()=>{const v=b.type||"default",y=D==null?void 0:D[`node-${v}`];if(y)return y;let I=b.template||f.value[v];if(typeof I=="string"&&A){const Z=Object.keys(A.appContext.components);Z&&Z.includes(v)&&(I=a.resolveComponent(v,!1))}return I&&typeof I!="string"?I:(l.error(new pe(fe.NODE_TYPE_MISSING,I)),!1)}),X=gi({id:e.id,el:P,disabled:()=>!E.value,selectable:$,dragHandle:()=>b.dragHandle,onStart(v){w.dragStart(v)},onDrag(v){w.drag(v)},onStop(v){w.dragStop(v)},onClick(v){m(v)}}),U=a.computed(()=>b.class instanceof Function?b.class(b):b.class),te=a.computed(()=>{const v=(b.style instanceof Function?b.style(b):b.style)||{},y=b.width instanceof Function?b.width(b):b.width,I=b.height instanceof Function?b.height(b):b.height;return!v.width&&y&&(v.width=typeof y=="string"?y:`${y}px`),!v.height&&I&&(v.height=typeof I=="string"?I:`${I}px`),v}),ae=a.toRef(()=>Number(b.zIndex??te.value.zIndex??0));return d(v=>{(v.includes(e.id)||!v.length)&&ue()}),a.onMounted(()=>{a.watch(()=>b.hidden,(v=!1,y,I)=>{!v&&P.value&&(e.resizeObserver.observe(P.value),I(()=>{P.value&&e.resizeObserver.unobserve(P.value)}))},{immediate:!0,flush:"post"})}),a.watch([()=>b.type,()=>b.sourcePosition,()=>b.targetPosition],()=>{a.nextTick(()=>{c([{id:e.id,nodeElement:P.value,forceUpdate:!0}])})}),a.watch([()=>b.position.x,()=>b.position.y,()=>{var v;return(v=J.value)==null?void 0:v.computedPosition.x},()=>{var v;return(v=J.value)==null?void 0:v.computedPosition.y},()=>{var v;return(v=J.value)==null?void 0:v.computedPosition.z},ae,()=>b.selected,()=>b.dimensions.height,()=>b.dimensions.width,()=>{var v;return(v=J.value)==null?void 0:v.dimensions.height},()=>{var v;return(v=J.value)==null?void 0:v.dimensions.width}],([v,y,I,Z,K,q])=>{const ee={x:v,y,z:q+(h.value&&b.selected?1e3:0)};typeof I<"u"&&typeof Z<"u"?b.computedPosition=Ts({x:I,y:Z,z:K},ee):b.computedPosition=ee},{flush:"post",immediate:!0}),a.watch([()=>b.extent,g],([v,y],[I,Z])=>{(v!==I||y!==Z)&&ie()}),b.extent==="parent"||typeof b.extent=="object"&&"range"in b.extent&&b.extent.range==="parent"?qt(()=>W).toBe(!0).then(ie):ie(),()=>b.hidden?null:a.h("div",{ref:P,"data-id":b.id,class:["vue-flow__node",`vue-flow__node-${O.value===!1?"default":b.type||"default"}`,{[n.value]:E.value,dragging:X==null?void 0:X.value,draggable:E.value,selected:b.selected,selectable:$.value,parent:b.isParent},U.value],style:{visibility:W.value?"visible":"hidden",zIndex:b.computedPosition.z??ae.value,transform:`translate(${b.computedPosition.x}px,${b.computedPosition.y}px)`,pointerEvents:R.value?"all":"none",...te.value},tabIndex:F.value?0:void 0,role:F.value?"button":void 0,"aria-describedby":x.value?void 0:`${Do}-${t}`,"aria-label":b.ariaLabel,onMouseenter:oe,onMousemove:se,onMouseleave:j,onContextmenu:Q,onClick:m,onDblclick:ne,onKeydown:p},[a.h(O.value===!1?f.value.default:O.value,{id:b.id,type:b.type,data:b.data,events:{...b.events,...T},selected:b.selected,resizing:b.resizing,dragging:X.value,connectable:V.value,position:b.computedPosition,dimensions:b.dimensions,isValidTargetPos:b.isValidTargetPos,isValidSourcePos:b.isValidSourcePos,parent:b.parentNode,parentNodeId:b.parentNode,zIndex:b.computedPosition.z??ae.value,targetPosition:b.targetPosition,sourcePosition:b.sourcePosition,label:b.label,dragHandle:b.dragHandle,onUpdateNodeInternals:ue})]);function ie(){const v=b.computedPosition,{computedPosition:y,position:I}=xn(b,N.value?Ht(v,k.value):v,l.error,g.value,J.value);(b.computedPosition.x!==y.x||b.computedPosition.y!==y.y)&&(b.computedPosition={...b.computedPosition,...y}),(b.position.x!==I.x||b.position.y!==I.y)&&(b.position=I)}function ue(){P.value&&c([{id:e.id,nodeElement:P.value,forceUpdate:!0}])}function oe(v){X!=null&&X.value||w.mouseEnter({event:v,node:b})}function se(v){X!=null&&X.value||w.mouseMove({event:v,node:b})}function j(v){X!=null&&X.value||w.mouseLeave({event:v,node:b})}function Q(v){return w.contextMenu({event:v,node:b})}function ne(v){return w.doubleClick({event:v,node:b})}function m(v){$.value&&(!o.value||!E.value||M.value>0)&&kn(b,r.value,u,s,i,!1,P.value),w.click({event:v,node:b})}function p(v){if(!(wn(v)||x.value))if(Oo.includes(v.key)&&$.value){const y=v.key==="Escape";kn(b,r.value,u,s,i,y,P.value)}else E.value&&b.selected&&Ke[v.key]&&(v.preventDefault(),S.value=`Moved selected node ${v.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~b.position.x}, y: ${~~b.position.y}`,B({x:Ke[v.key].x,y:Ke[v.key].y},v.shiftKey))}}}),fc={height:"0",width:"0"},hc={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},pc=a.defineComponent({...hc,setup(e){const{viewportRef:t}=de(),n=a.toRef(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(a.openBlock(),a.createElementBlock("svg",null,[(a.openBlock(),a.createElementBlock("foreignObject",fc,[(a.openBlock(),a.createBlock(a.Teleport,{to:n.value,disabled:!n.value},[a.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function gc(e={includeHiddenNodes:!1}){const{nodes:t}=de();return a.computed(()=>{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 mc={class:"vue-flow__nodes vue-flow__container"},yc={name:"Nodes",compatConfig:{MODE:3}},vc=a.defineComponent({...yc,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=gc(),r=a.ref();return a.watch(i,l=>{l&&a.nextTick(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),a.onMounted(()=>{r.value=new ResizeObserver(l=>{const s=l.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));a.nextTick(()=>n(s))})}),a.onBeforeUnmount(()=>{var l;return(l=r.value)==null?void 0:l.disconnect()}),(l,s)=>(a.openBlock(),a.createElementBlock("div",mc,[r.value?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(t),(u,c,d,f)=>{const g=[u.id];if(f&&f.key===u.id&&a.isMemoSame(f,g))return f;const h=(a.openBlock(),a.createBlock(a.unref(dc),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return h.memo=g,h},s,0),128)):a.createCommentVNode("",!0)]))}});function wc(){const{emits:e}=de();a.onMounted(()=>{if(ai()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new pe(fe.MISSING_STYLES))}})}const _c=a.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),bc={name:"VueFlow",compatConfig:{MODE:3}},Ec=a.defineComponent({...bc,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=a.useSlots(),r=Jt(o,"modelValue",n),l=Jt(o,"nodes",n),s=Jt(o,"edges",n),u=de(o),c=ru({modelValue:r,nodes:l,edges:s},o,u);return au(n,u.hooks),ju(),wc(),a.provide(Ft,i),a.onUnmounted(()=>{c()}),t(u),(d,f)=>(a.openBlock(),a.createElementBlock("div",{ref:a.unref(u).vueFlowRef,class:"vue-flow"},[a.createVNode(Uu,null,{default:a.withCtx(()=>[a.createVNode(cc),_c,a.createVNode(vc),a.renderSlot(d.$slots,"zoom-pane")]),_:3}),a.renderSlot(d.$slots,"default"),a.createVNode(Ju)],512))}}),xc=["id","d","marker-end"],Sc={class:"vue-flow__edge-label"},Nc={key:0,class:"label-input-wrapper"},Cc={inheritAttrs:!1},kc=a.defineComponent({...Cc,__name:"EditableEdge",props:{id:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},label:{},style:{},selected:{type:Boolean},sourcePosition:{},targetPosition:{},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},markerEnd:{},curvature:{},interactionWidth:{},data:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{},sourceX:{},sourceY:{},targetX:{},targetY:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let g=Date.now();g-s<500&&!l.value&&await c(),s=g},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)},f=a.computed(()=>$n(n));return(g,h)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",{id:g.id,style:a.normalizeStyle(g.style),class:"vue-flow__edge-path",d:f.value[0],"marker-end":g.markerEnd},null,12,xc),a.createVNode(a.unref(pc),null,{default:a.withCtx(()=>[a.createElementVNode("div",{style:a.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${f.value[1]}px,${f.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:h[2]||(h[2]=x=>u())},[a.createElementVNode("div",Sc,a.toDisplayString(g.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Nc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":h[0]||(h[0]=x=>r.value=x),onBlur:h[1]||(h[1]=x=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0)],4)]),_:1})],64))}}),Mc={key:0,class:"label-input-wrapper"},Ic=a.defineComponent({__name:"EditableNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=a.useTemplateRef("labelInput"),r=a.ref(""),l=a.ref(!1);let s=0;const u=async()=>{let f=Date.now();f-s<500&&!l.value&&await c(),s=f},c=async()=>{r.value=n.label,l.value=!0,await a.nextTick(),i.value.focus()},d=()=>{l.value=!1,o("change",r.value)};return(f,g)=>(a.openBlock(),a.createElementBlock("div",{onClick:g[2]||(g[2]=h=>u())},[a.createElementVNode("div",null,a.toDisplayString(f.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Mc,[a.withDirectives(a.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":g[0]||(g[0]=h=>r.value=h),onBlur:g[1]||(g[1]=h=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,r.value]])])):a.createCommentVNode("",!0),f.data.hasInput?(a.openBlock(),a.createBlock(a.unref(Je),{key:1,id:"a",type:"target",position:f.targetPosition},null,8,["position"])):a.createCommentVNode("",!0),f.data.hasOutput?(a.openBlock(),a.createBlock(a.unref(Je),{key:2,id:"b",type:"source",position:f.sourcePosition},null,8,["position"])):a.createCommentVNode("",!0)]))}}),Pc={class:"chart-controls"},Tc={class:"chart-controls-left"},$c={class:"chart-controls-right"},Bc={key:0},Dc={key:1},Vn=a.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,o=a.ref(!1),i=a.ref([]),r=a.ref(),l=a.ref(""),s=a.computed(()=>(i.value.forEach((P,D)=>{if(P.id===l.value)return D}),-1)),u=a.computed({get:()=>{const P=e.modelValue;for(const D of P)D.data={},D.type==="input"?(D.data.hasInput=!1,D.data.hasOutput=!0):D.type==="output"?(D.data.hasInput=!0,D.data.hasOutput=!1):(D.data.hasInput=!0,D.data.hasOutput=!0),D.class="vue-flow__node-default",D.type="editable";for(const D of P)D.events={click:()=>{l.value=D.id}};return P},set:P=>{n("update:modelValue",JSON.parse(JSON.stringify(P)))}}),{onConnect:c,addEdges:d,onEdgeContextMenu:f,onPaneReady:g,removeEdges:h}=de();a.onMounted(()=>{document.removeEventListener("keypress",M),document.addEventListener("keypress",M)}),a.onBeforeUnmount(()=>{document.removeEventListener("keypress",M)}),g(P=>{r.value=P}),i.value=u.value;const x=P=>({[H.Top]:H.Right,[H.Right]:H.Bottom,[H.Bottom]:H.Left,[H.Left]:H.Top})[P],S=()=>{if(s.value>-1){const P=i.value[s.value];P.sourcePosition=x(P.sourcePosition)}},N=()=>{if(s.value>-1){const P=i.value[s.value];P.targetPosition=x(P.targetPosition)}},k=P=>{window.scrollBy(0,P.deltaY)},M=P=>{o.value&&P.ctrlKey==!0&&((P.key=="+"||P.key=="=")&&r.value.zoomIn(),P.key=="-"&&r.value.zoomOut())},_=async()=>{await r.value.fitView()},C=()=>{let P=!1,D={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const b=i.value[s.value];b.data.hasOutput&&(D={x:b.position.x+200,y:b.position.y+50},P=!0)}const A=i.value.length,B=`node-${A}`;if(i.value.push({id:B,label:"Node "+A,sourcePosition:H.Right,targetPosition:H.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{l.value=B}},position:D}),P){let b=`edge-${A+1}`;i.value.push({id:b,source:l.value,target:B,type:"editable",label:`EDGE ${A+1}`,animated:!0,events:{click:()=>{l.value=b}}})}},z=(P,D)=>{for(let A=0;A<i.value.length;A++)if(i.value[A].id==D){i.value[A].label=P;break}};c(P=>{const A={id:`edge-${i.value.length}`,source:P.source,target:P.target,type:"editable",label:"New Edge",interactionWidth:400,animated:!0,events:{click:()=>{l.value=A.id}}};d([A])});const G=P=>{h(P)};return f(({event:P,edge:D})=>{G(D.id)}),(P,D)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["node-editor-wrapper",P.nodeContainerClass]),onMouseover:D[1]||(D[1]=A=>o.value=!0),onMouseleave:D[2]||(D[2]=A=>o.value=!1)},[a.createElementVNode("div",Pc,[a.createElementVNode("div",Tc,[a.createElementVNode("div",null,[D[3]||(D[3]=a.createElementVNode("b",null,"Selected Node:",-1)),a.createTextVNode(" "+a.toDisplayString(l.value?l.value:"none"),1)])]),a.createElementVNode("div",$c,[a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:C},"Add Node")]),a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:_},"Center")]),s.value>-1?(a.openBlock(),a.createElementBlock("div",Bc,[a.createElementVNode("button",{class:"button-default",onClick:N},"Shift Input Position")])):a.createCommentVNode("",!0),s.value>-1?(a.openBlock(),a.createElementBlock("div",Dc,[a.createElementVNode("button",{class:"button-default",onClick:S},"Shift Output Position")])):a.createCommentVNode("",!0)])]),i.value&&i.value.length?(a.openBlock(),a.createBlock(a.unref(Ec),{key:0,class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,modelValue:i.value,"onUpdate:modelValue":D[0]||(D[0]=A=>i.value=A),onWheel:a.withModifiers(k,["prevent"])},{"node-editable":a.withCtx(A=>[a.createVNode(Ic,a.mergeProps(A,{onChange:B=>z(B,A.id)}),null,16,["onChange"])]),"edge-editable":a.withCtx(A=>[a.createVNode(kc,a.mergeProps(A,{onChange:B=>z(B,A.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0)],34))}}),Ii=a.defineComponent({__name:"StateEditor",props:a.mergeModels({layout:{},nodeContainerClass:{}},{modelValue:{},modelModifiers:{}}),emits:a.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:t}){const n=t,o=a.useModel(e,"modelValue"),i=a.computed({get:()=>{var d,f,g;const l={},s=[],u={};let c=0;for(const[h,x]of Object.entries(o.value)){const S={id:h,label:h,position:((d=e.layout[h])==null?void 0:d.position)||{x:200*c,y:100},targetPosition:((f=e.layout[h])==null?void 0:f.targetPosition)||H.Left,sourcePosition:((g=e.layout[h])==null?void 0:g.sourcePosition)||H.Right};x.type==="final"&&(S.type="output",S.class="default-output-node"),u[h]=S}for(const[h,x]of Object.entries(o.value)){if(x.on)for(const[S,N]of Object.entries(x.on)){const k=N.target||N;s.push({id:`${h}-${k}`,source:h,target:k,label:S,animated:!0}),l[k]=!0}c++}for(const[h,x]of Object.entries(u))l[h]||(x.type="input",x.class="default-input-node"),s.push(x);return s},set:l=>{r(l)}}),r=l=>{const s={},u={},c={};for(const d of l){const f=d.label;d.type==="input"?c[f]={on:{}}:d.type==="output"?c[f]={type:"final"}:d.source&&d.target?(s[d.source]=s[d.source]||{},s[d.source][f]={target:d.target}):c[f]={on:{}},u[d.id]=f}for(const[d,f]of Object.entries(s)){const g=u[d];for(const[h,x]of Object.entries(f))c[g].on[h]=x}n("update:modelValue",c)};return(l,s)=>(a.openBlock(),a.createElementBlock("div",null,[a.createVNode(Vn,{modelValue:i.value,"onUpdate:modelValue":s[0]||(s[0]=u=>i.value=u),"node-container-class":l.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function Vc(e){e.component("NodeEditor",Vn),e.component("StateEditor",Ii)}Se.NodeEditor=Vn,Se.StateEditor=Ii,Se.install=Vc,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
22
27
  //# sourceMappingURL=node-editor.umd.cjs.map