@stonecrop/node-editor 0.2.35 → 0.2.37
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.
- package/dist/node-editor.js +3772 -3786
- package/dist/node-editor.js.map +1 -1
- package/dist/node-editor.umd.cjs +2 -2
- package/dist/node-editor.umd.cjs.map +1 -1
- package/dist/node_editor.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/node-editor.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(xe,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(xe=typeof globalThis<"u"?globalThis:xe||self,l(xe["@stonecrop/node-editor"]={},xe.Vue))})(this,function(xe,l){"use strict";function ct(e){return l.getCurrentScope()?(l.onScopeDispose(e),!0):!1}function Se(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,$i=e=>Ii.call(e)==="[object Object]",Ti=()=>{};function Pi(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 Pn(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,Pi(o,t),i)}function Le(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=Se(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 Ft(e,t=!1){function n(h,{flush:p="sync",deep:m=!1,timeout:b,throwOnTimeout:_}={}){let E=null;const g=[new Promise(k=>{E=l.watch(e,S=>{h(S)!==t&&(E==null||E(),k(S))},{flush:p,deep:m,immediate:!0})})];return b!=null&&g.push(Pn(b,_).then(()=>Se(e)).finally(()=>E==null?void 0:E())),Promise.race(g)}function o(h,p){if(!l.isRef(h))return n(S=>S===h,p);const{flush:m="sync",deep:b=!1,timeout:_,throwOnTimeout:E}=p??{};let N=null;const k=[new Promise(S=>{N=l.watch([e,h],([B,A])=>{t!==(B===A)&&(N==null||N(),S(B))},{flush:m,deep:b,immediate:!0})})];return _!=null&&k.push(Pn(_,E).then(()=>Se(e)).finally(()=>(N==null||N(),Se(e)))),Promise.race(k)}function i(h){return n(p=>!!p,h)}function r(h){return o(null,h)}function a(h){return o(void 0,h)}function s(h){return n(Number.isNaN,h)}function u(h,p){return n(m=>{const b=Array.from(m);return b.includes(h)||b.includes(Se(h))},p)}function c(h){return d(1,h)}function d(h=1,p){let m=-1;return n(()=>(m+=1,m>=h),p)}return Array.isArray(Se(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Ft(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:a,changed:c,changedTimes:d,get not(){return Ft(e,!t)}}}function dt(e){return Ft(e)}function Oi(e){var t;const n=Se(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Bn=ki?window:void 0;function Dn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Bn):[t,n,o,i]=e,!t)return Ti;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],a=()=>{r.forEach(d=>d()),r.length=0},s=(d,h,p,m)=>(d.addEventListener(h,p,m),()=>d.removeEventListener(h,p,m)),u=l.watch(()=>[Oi(t),Se(i)],([d,h])=>{if(a(),!d)return;const p=$i(h)?{...h}:h;r.push(...n.flatMap(m=>o.map(b=>s(d,m,b,p))))},{immediate:!0,flush:"post"}),c=()=>{u(),a()};return ct(c),c}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 Vn(...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=Bn,eventName:r="keydown",passive:a=!1,dedupe:s=!1}=o,u=Ai(t);return Dn(i,r,d=>{d.repeat&&Se(s)||u(d)&&n(d)},a)}function zi(e){return JSON.parse(JSON.stringify(e))}function Yt(e,t,n,o={}){var i,r,a;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:h,shouldEmit:p}=o,m=l.getCurrentInstance(),b=n||(m==null?void 0:m.emit)||((i=m==null?void 0:m.$emit)==null?void 0:i.bind(m))||((a=(r=m==null?void 0:m.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(m==null?void 0:m.proxy));let _=c;t||(t="modelValue"),_=_||`update:${t.toString()}`;const E=k=>s?typeof s=="function"?s(k):zi(k):k,N=()=>Mi(e[t])?E(e[t]):h,g=k=>{p?p(k)&&b(_,k):b(_,k)};if(u){const k=N(),S=l.ref(k);let B=!1;return l.watch(()=>e[t],A=>{B||(B=!0,S.value=E(A),l.nextTick(()=>B=!1))}),l.watch(S,A=>{!B&&(A!==e[t]||d)&&g(A)},{deep:d}),S}else return l.computed({get(){return N()},set(k){g(k)}})}var Ri={value:()=>{}};function ft(){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 ht(n)}function ht(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}})}ht.prototype=ft.prototype={constructor:ht,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]=On(n[i],e.name,t);else if(t==null)for(i in n)n[i]=On(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 ht(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 On(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 Gt="http://www.w3.org/1999/xhtml";const An={svg:"http://www.w3.org/2000/svg",xhtml:Gt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function gt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),An.hasOwnProperty(t)?{space:An[t],local:e}:e}function Fi(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Gt&&t.documentElement.namespaceURI===Gt?t.createElement(e):t.createElementNS(n,e)}}function Yi(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zn(e){var t=gt(e);return(t.local?Yi:Fi)(t)}function Gi(){}function Xt(e){return e==null?Gi:function(){return this.querySelector(e)}}function Xi(e){typeof e!="function"&&(e=Xt(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,c,d=0;d<a;++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 Ui(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Zi(){return[]}function Rn(e){return e==null?Zi:function(){return this.querySelectorAll(e)}}function Wi(e){return function(){return Ui(e.apply(this,arguments))}}function Ki(e){typeof e=="function"?e=Wi(e):e=Rn(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,c=0;c<s;++c)(u=a[c])&&(o.push(e.call(u,u.__data__,c,a)),i.push(u));return new me(o,i)}function Hn(e){return function(){return this.matches(e)}}function Ln(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:Ln(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:Ln(e)))}function ir(e){typeof e!="function"&&(e=Hn(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,c=0;c<a;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new me(o,this._parents)}function Fn(e){return new Array(e.length)}function rr(){return new me(this._enter||this._groups.map(Fn),this._parents)}function pt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}pt.prototype={constructor:pt,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,c=r.length;a<c;++a)(s=t[a])?(s.__data__=r[a],o[a]=s):n[a]=new pt(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,c=new Map,d=t.length,h=r.length,p=new Array(d),m;for(s=0;s<d;++s)(u=t[s])&&(p[s]=m=a.call(u,u.__data__,s,t)+"",c.has(m)?i[s]=u:c.set(m,u));for(s=0;s<h;++s)m=a.call(e,r[s],s,r)+"",(u=c.get(m))?(o[s]=u,u.__data__=r[s],c.delete(m)):n[s]=new pt(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(p[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),c=0;c<r;++c){var d=o[c],h=i[c],p=h.length,m=dr(e.call(d,d&&d.__data__,c,o)),b=m.length,_=s[c]=new Array(b),E=a[c]=new Array(b),N=u[c]=new Array(p);n(d,h,_,E,N,m,t);for(var g=0,k=0,S,B;g<b;++g)if(S=_[g]){for(g>=k&&(k=g+1);!(B=E[k])&&++k<b;);S._next=B||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(Fn),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 c=n[u],d=o[u],h=c.length,p=s[u]=new Array(h),m,b=0;b<h;++b)(m=c[b]||d[b])&&(p[b]=m);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(h,p){return h&&p?e(h.__data__,p.__data__):!h-!p}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),c,d=0;d<s;++d)(c=a[d])&&(u[d]=c);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 $r(e,t){var n=gt(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 Yn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Tr(e){return function(){this.style.removeProperty(e)}}function Pr(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?Tr:typeof t=="function"?Br:Pr)(e,t,n??"")):Fe(this.node(),e)}function Fe(e,t){return e.style.getPropertyValue(t)||Yn(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 Gn(e){return e.trim().split(/^|\s+/)}function Ut(e){return e.classList||new Xn(e)}function Xn(e){this._node=e,this._names=Gn(e.getAttribute("class")||"")}Xn.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 Un(e,t){for(var n=Ut(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function Zn(e,t){for(var n=Ut(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Rr(e){return function(){Un(this,e)}}function Hr(e){return function(){Zn(this,e)}}function Lr(e,t){return function(){(t.apply(this,arguments)?Un:Zn)(this,e)}}function Fr(e,t){var n=Gn(e+"");if(arguments.length<2){for(var o=Ut(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 Wr(e){return function(){this.innerHTML=e}}function Kr(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"?Kr:Wr)(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:zn(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:zn(e),o=t==null?nl:typeof t=="function"?t:Xt(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,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((a=o[i]).type===d.type&&a.name===d.name)return d.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=Yn(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 Kn=[null];function me(e,t){this._groups=e,this._parents=t}function qe(){return new me([[document.documentElement]],Kn)}function wl(){return this}me.prototype=qe.prototype={constructor:me,select:Xi,selectAll:Ki,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:$r,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]],Kn)}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 Zt(e){e.stopImmediatePropagation()}function Ye(e){e.preventDefault(),e.stopImmediatePropagation()}function qn(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Ye,Je);"onselectstart"in t?n.on("selectstart.drag",Ye,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",Ye,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 mt=e=>()=>e;function Wt(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:a,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:a,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}})}Wt.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=ft("start","drag","end"),a=0,s,u,c,d,h=0;function p(S){S.on("mousedown.drag",m).filter(o).on("touchstart.drag",E).on("touchmove.drag",N,bl).on("touchend.drag touchcancel.drag",g).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(S,B){if(!(d||!e.call(this,S,B))){var A=k(this,t.call(this,S,B),S,B,"mouse");A&&(ye(S.view).on("mousemove.drag",b,Je).on("mouseup.drag",_,Je),qn(S.view),Zt(S),c=!1,s=S.clientX,u=S.clientY,A("start",S))}}function b(S){if(Ye(S),!c){var B=S.clientX-s,A=S.clientY-u;c=B*B+A*A>h}i.mouse("drag",S)}function _(S){ye(S.view).on("mousemove.drag mouseup.drag",null),Jn(S.view,c),Ye(S),i.mouse("end",S)}function E(S,B){if(e.call(this,S,B)){var A=S.changedTouches,O=t.call(this,S,B),U=A.length,Z,D;for(Z=0;Z<U;++Z)(D=k(this,O,S,B,A[Z].identifier,A[Z]))&&(Zt(S),D("start",S,A[Z]))}}function N(S){var B=S.changedTouches,A=B.length,O,U;for(O=0;O<A;++O)(U=i[B[O].identifier])&&(Ye(S),U("drag",S,B[O]))}function g(S){var B=S.changedTouches,A=B.length,O,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),O=0;O<A;++O)(U=i[B[O].identifier])&&(Zt(S),U("end",S,B[O]))}function k(S,B,A,O,U,Z){var D=r.copy(),x=_e(Z||A,B),j,H,v;if((v=n.call(S,new Wt("beforestart",{sourceEvent:A,target:p,identifier:U,active:a,x:x[0],y:x[1],dx:0,dy:0,dispatch:D}),O))!=null)return j=v.x-x[0]||0,H=v.y-x[1]||0,function T(C,$,z){var M=x,P;switch(C){case"start":i[U]=T,P=a++;break;case"end":delete i[U],--a;case"drag":x=_e(z||$,B),P=a;break}D.call(C,S,new Wt(C,{sourceEvent:$,subject:v,target:p,identifier:U,active:P,x:x[0]+j,y:x[1]+H,dx:x[0]-M[0],dy:x[1]-M[1],dispatch:D}),O)}}return p.filter=function(S){return arguments.length?(e=typeof S=="function"?S:mt(!!S),p):e},p.container=function(S){return arguments.length?(t=typeof S=="function"?S:mt(S),p):t},p.subject=function(S){return arguments.length?(n=typeof S=="function"?S:mt(S),p):n},p.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:mt(!!S),p):o},p.on=function(){var S=r.on.apply(r,arguments);return S===r?p:S},p.clickDistance=function(S){return arguments.length?(h=(S=+S)*S,p):Math.sqrt(h)},p}function Kt(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function jn(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function je(){}var Qe=.7,yt=1/Qe,Ge="\\s*([+-]?\\d+)\\s*",et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kl=/^#([0-9a-f]{3,8})$/,Ml=new RegExp(`^rgb\\(${Ge},${Ge},${Ge}\\)$`),Il=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),$l=new RegExp(`^rgba\\(${Ge},${Ge},${Ge},${et}\\)$`),Tl=new RegExp(`^rgba\\(${be},${be},${be},${et}\\)$`),Pl=new RegExp(`^hsl\\(${et},${be},${be}\\)$`),Bl=new RegExp(`^hsla\\(${et},${be},${be},${et}\\)$`),Qn={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};Kt(je,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:eo,formatHex:eo,formatHex8:Dl,formatHsl:Vl,formatRgb:to,toString:to});function eo(){return this.rgb().formatHex()}function Dl(){return this.rgb().formatHex8()}function Vl(){return lo(this).formatHsl()}function to(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?no(t):n===3?new pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?vt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?vt(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=$l.exec(e))?vt(t[1],t[2],t[3],t[4]):(t=Tl.exec(e))?vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Pl.exec(e))?ro(t[1],t[2]/100,t[3]/100,1):(t=Bl.exec(e))?ro(t[1],t[2]/100,t[3]/100,t[4]):Qn.hasOwnProperty(e)?no(Qn[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function no(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function vt(e,t,n,o){return o<=0&&(e=t=n=NaN),new pe(e,t,n,o)}function Ol(e){return e instanceof je||(e=tt(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function qt(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}Kt(pe,qt,jn(je,{brighter(e){return e=e==null?yt:Math.pow(yt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qe:Math.pow(Qe,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(Pe(this.r),Pe(this.g),Pe(this.b),wt(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:oo,formatHex:oo,formatHex8:Al,formatRgb:io,toString:io}));function oo(){return`#${Be(this.r)}${Be(this.g)}${Be(this.b)}`}function Al(){return`#${Be(this.r)}${Be(this.g)}${Be(this.b)}${Be((isNaN(this.opacity)?1:this.opacity)*255)}`}function io(){const e=wt(this.opacity);return`${e===1?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${e===1?")":`, ${e})`}`}function wt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Be(e){return e=Pe(e),(e<16?"0":"")+e.toString(16)}function ro(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 lo(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof je||(e=tt(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?lo(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}Kt(ve,zl,jn(je,{brighter(e){return e=e==null?yt:Math.pow(yt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qe:Math.pow(Qe,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(Jt(e>=240?e-240:e+120,i,o),Jt(e,i,o),Jt(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ve(ao(this.h),_t(this.s),_t(this.l),wt(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=wt(this.opacity);return`${e===1?"hsl(":"hsla("}${ao(this.h)}, ${_t(this.s)*100}%, ${_t(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ao(e){return e=(e||0)%360,e<0?e+360:e}function _t(e){return Math.max(0,Math.min(1,e||0))}function Jt(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 so=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?uo:function(t,n){return n-t?Hl(t,n,e):so(isNaN(t)?n:t)}}function uo(e,t){var n=t-e;return n?Rl(e,n):so(isNaN(e)?t:e)}const co=function e(t){var n=Ll(t);function o(i,r){var a=n((i=qt(i)).r,(r=qt(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),c=uo(i.opacity,r.opacity);return function(d){return i.r=a(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 jt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qt=new RegExp(jt.source,"g");function Fl(e){return function(){return e}}function Yl(e){return function(t){return e(t)+""}}function Gl(e,t){var n=jt.lastIndex=Qt.lastIndex=0,o,i,r,a=-1,s=[],u=[];for(e=e+"",t=t+"";(o=jt.exec(e))&&(i=Qt.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=Qt.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(c){for(var d=0,h;d<t;++d)s[(h=u[d]).i]=h.x(c);return s.join("")})}var fo=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ho(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)*fo,skewX:Math.atan(u)*fo,scaleX:a,scaleY:s}}var bt;function Xl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?en:ho(t.a,t.b,t.c,t.d,t.e,t.f)}function Ul(e){return e==null||(bt||(bt=document.createElementNS("http://www.w3.org/2000/svg","g")),bt.setAttribute("transform",e),!(e=bt.transform.baseVal.consolidate()))?en:(e=e.matrix,ho(e.a,e.b,e.c,e.d,e.e,e.f))}function go(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,h,p,m,b){if(c!==h||d!==p){var _=m.push("translate(",null,t,null,n);b.push({i:_-4,x:Ie(c,h)},{i:_-2,x:Ie(d,p)})}else(h||p)&&m.push("translate("+h+t+p+n)}function a(c,d,h,p){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),p.push({i:h.push(i(h)+"rotate(",null,o)-2,x:Ie(c,d)})):d&&h.push(i(h)+"rotate("+d+o)}function s(c,d,h,p){c!==d?p.push({i:h.push(i(h)+"skewX(",null,o)-2,x:Ie(c,d)}):d&&h.push(i(h)+"skewX("+d+o)}function u(c,d,h,p,m,b){if(c!==h||d!==p){var _=m.push(i(m)+"scale(",null,",",null,")");b.push({i:_-4,x:Ie(c,h)},{i:_-2,x:Ie(d,p)})}else(h!==1||p!==1)&&m.push(i(m)+"scale("+h+","+p+")")}return function(c,d){var h=[],p=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,h,p),a(c.rotate,d.rotate,h,p),s(c.skewX,d.skewX,h,p),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,h,p),c=d=null,function(m){for(var b=-1,_=p.length,E;++b<_;)h[(E=p[b]).i]=E.x(m);return h.join("")}}}var Zl=go(Xl,"px, ","px)","deg)"),Wl=go(Ul,", ",")",")"),Kl=1e-12;function po(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],c=r[2],d=a[0],h=a[1],p=a[2],m=d-s,b=h-u,_=m*m+b*b,E,N;if(_<Kl)N=Math.log(p/c)/t,E=function(O){return[s+O*m,u+O*b,c*Math.exp(t*O*N)]};else{var g=Math.sqrt(_),k=(p*p-c*c+o*_)/(2*c*n*g),S=(p*p-c*c-o*_)/(2*p*n*g),B=Math.log(Math.sqrt(k*k+1)-k),A=Math.log(Math.sqrt(S*S+1)-S);N=(A-B)/t,E=function(O){var U=O*N,Z=po(B),D=c/(n*g)*(Z*Jl(t*U+B)-ql(B));return[s+D*m,u+D*b,c*Z/po(t*U+B)]}}return E.duration=N*1e3*t/Math.SQRT2,E}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 Xe=0,nt=0,ot=0,mo=1e3,Et,it,xt=0,De=0,St=0,rt=typeof performance=="object"&&performance.now?performance:Date,yo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tn(){return De||(yo(Ql),De=rt.now()+St)}function Ql(){De=0}function Nt(){this._call=this._time=this._next=null}Nt.prototype=vo.prototype={constructor:Nt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?tn():+n)+(t==null?0:+t),!this._next&&it!==this&&(it?it._next=this:Et=this,it=this),this._call=e,this._time=n,nn()},stop:function(){this._call&&(this._call=null,this._time=1/0,nn())}};function vo(e,t,n){var o=new Nt;return o.restart(e,t,n),o}function ea(){tn(),++Xe;for(var e=Et,t;e;)(t=De-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xe}function wo(){De=(xt=rt.now())+St,Xe=nt=0;try{ea()}finally{Xe=0,na(),De=0}}function ta(){var e=rt.now(),t=e-xt;t>mo&&(St-=t,xt=e)}function na(){for(var e,t=Et,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:Et=n);it=e,nn(o)}function nn(e){if(!Xe){nt&&(nt=clearTimeout(nt));var t=e-De;t>24?(e<1/0&&(nt=setTimeout(wo,e-rt.now()-St)),ot&&(ot=clearInterval(ot))):(ot||(xt=rt.now(),ot=setInterval(ta,mo)),Xe=1,yo(wo))}}function _o(e,t,n){var o=new Nt;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var oa=ft("start","end","cancel","interrupt"),ia=[],bo=0,Eo=1,on=2,Ct=3,xo=4,rn=5,kt=6;function Mt(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:bo})}function ln(e,t){var n=we(e,t);if(n.state>bo)throw new Error("too late; already scheduled");return n}function Ee(e,t){var n=we(e,t);if(n.state>Ct)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=vo(r,0,n.time);function r(c){n.state=Eo,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var d,h,p,m;if(n.state!==Eo)return u();for(d in o)if(m=o[d],m.name===n.name){if(m.state===Ct)return _o(a);m.state===xo?(m.state=kt,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete o[d]):+d<t&&(m.state=kt,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete o[d])}if(_o(function(){n.state===Ct&&(n.state=xo,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=Ct,i=new Array(p=n.tween.length),d=0,h=-1;d<p;++d)(m=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++h]=m);i.length=h+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=rn,1),h=-1,p=i.length;++h<p;)i[h].call(e,d);n.state===rn&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=kt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function It(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>on&&o.state<rn,o.state=kt,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(){It(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,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&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 an(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 So(e,t){var n;return(typeof t=="number"?Ie:t instanceof tt?co:(n=tt(t))?(t=n,co):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=gt(e),o=n==="transform"?Wl:So;return this.attrTween(e,typeof t=="function"?(n.local?pa:ga)(n,o,an(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=gt(e);return this.tween(n,(o.local?wa:_a)(o,t))}function Ea(e,t){return function(){ln(this,e).delay=+t.apply(this,arguments)}}function xa(e,t){return t=+t,function(){ln(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 $a(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ee(this,e).ease=n}}function Ta(e){if(typeof e!="function")throw new Error;return this.each($a(this._id,e))}function Pa(e){typeof e!="function"&&(e=Hn(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,c=0;c<a;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new Ne(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],c=n[s],d=u.length,h=a[s]=new Array(d),p,m=0;m<d;++m)(p=u[m]||c[m])&&(h[m]=p);for(;s<o;++s)a[s]=t[s];return new Ne(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)?ln: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=Xt(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,c=r[a]=new Array(u),d,h,p=0;p<u;++p)(d=s[p])&&(h=e.call(d,d.__data__,p,s))&&("__data__"in d&&(h.__data__=d.__data__),c[p]=h,Mt(c[p],t,n,p,c,we(d,n)));return new Ne(r,this._parents,t,n)}function Ha(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Rn(e));for(var o=this._groups,i=o.length,r=[],a=[],s=0;s<i;++s)for(var u=o[s],c=u.length,d,h=0;h<c;++h)if(d=u[h]){for(var p=e.call(d,d.__data__,h,u),m,b=we(d,n),_=0,E=p.length;_<E;++_)(m=p[_])&&Mt(m,t,n,_,p,b);r.push(p),a.push(d)}return new Ne(r,a,t,n)}var La=qe.prototype.constructor;function Fa(){return new La(this._groups,this._parents)}function Ya(e,t){var n,o,i;return function(){var r=Fe(this,e),a=(this.style.removeProperty(e),Fe(this,e));return r===a?null:r===n&&a===o?i:i=t(n=r,o=a)}}function No(e){return function(){this.style.removeProperty(e)}}function Ga(e,t,n){var o,i=n+"",r;return function(){var a=Fe(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=Fe(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Fe(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),c=u.on,d=u.value[r]==null?s||(s=No(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(a,i=d),u.on=o}}function Za(e,t,n){var o=(e+="")=="transform"?Zl:So;return t==null?this.styleTween(e,Ya(e,o)).on("end.style."+e,No(e)):typeof t=="function"?this.styleTween(e,Xa(e,o,an(this,"style."+e,t))).each(Ua(this._id,e)):this.styleTween(e,Ga(e,o,t),n).on("end.style."+e,null)}function Wa(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Ka(e,t,n){var o,i;function r(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&Wa(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,Ka(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(an(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=Co(),o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],s=a.length,u,c=0;c<s;++c)if(u=a[c]){var d=we(u,t);Mt(u,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ne(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 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 rs=0;function Ne(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Co(){return++rs}var Ce=qe.prototype;Ne.prototype={constructor:Ne,select:Ra,selectAll:Ha,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:Pa,merge:Ba,selection:Fa,transition:os,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.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:Ta,end:is,[Symbol.iterator]:Ce[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 Ne?(t=e._id,e=e._name):(t=Co(),(n=as).time=tn(),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,c=0;c<s;++c)(u=a[c])&&Mt(u,e,t,c,a,n||ss(u,t));return new Ne(o,this._parents,e,t)}qe.prototype.interrupt=la,qe.prototype.transition=us;const $t=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 ke(e,t,n){this.k=e,this.x=t,this.y=n}ke.prototype={constructor:ke,scale:function(e){return e===1?this:new ke(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ke(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 Ue=new ke(1,0,0);ke.prototype;function sn(e){e.stopImmediatePropagation()}function lt(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 ko(){return this.__zoom||Ue}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,c=ft("start","zoom","end"),d,h,p,m=500,b=150,_=0,E=10;function N(v){v.property("__zoom",ko).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",x).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(v,T,C,$){var z=v.selection?v.selection():v;z.property("__zoom",ko),v!==z?B(v,T,C,$):z.interrupt().each(function(){A(this,arguments).event($).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},N.scaleBy=function(v,T,C,$){N.scaleTo(v,function(){var z=this.__zoom.k,M=typeof T=="function"?T.apply(this,arguments):T;return z*M},C,$)},N.scaleTo=function(v,T,C,$){N.transform(v,function(){var z=t.apply(this,arguments),M=this.__zoom,P=C==null?S(z):typeof C=="function"?C.apply(this,arguments):C,L=M.invert(P),K=typeof T=="function"?T.apply(this,arguments):T;return n(k(g(M,K),P,L),z,a)},C,$)},N.translateBy=function(v,T,C,$){N.transform(v,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof C=="function"?C.apply(this,arguments):C),t.apply(this,arguments),a)},null,$)},N.translateTo=function(v,T,C,$,z){N.transform(v,function(){var M=t.apply(this,arguments),P=this.__zoom,L=$==null?S(M):typeof $=="function"?$.apply(this,arguments):$;return n(Ue.translate(L[0],L[1]).scale(P.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof C=="function"?-C.apply(this,arguments):-C),M,a)},$,z)};function g(v,T){return T=Math.max(r[0],Math.min(r[1],T)),T===v.k?v:new ke(T,v.x,v.y)}function k(v,T,C){var $=T[0]-C[0]*v.k,z=T[1]-C[1]*v.k;return $===v.x&&z===v.y?v:new ke(v.k,$,z)}function S(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function B(v,T,C,$){v.on("start.zoom",function(){A(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event($).end()}).tween("zoom",function(){var z=this,M=arguments,P=A(z,M).event($),L=t.apply(z,M),K=C==null?S(L):typeof C=="function"?C.apply(z,M):C,re=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),te=z.__zoom,oe=typeof T=="function"?T.apply(z,M):T,ue=u(te.invert(K).concat(re/te.k),oe.invert(K).concat(re/oe.k));return function(le){if(le===1)le=oe;else{var q=ue(le),W=re/q[2];le=new ke(W,K[0]-q[0]*W,K[1]-q[1]*W)}P.zoom(null,le)}})}function A(v,T,C){return!C&&v.__zooming||new O(v,T)}function O(v,T){this.that=v,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,T),this.taps=0}O.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,T){return this.mouse&&v!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&v!=="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(v){var T=ye(this.that).datum();c.call(v,this.that,new cs(v,{sourceEvent:this.sourceEvent,target:N,type:v,transform:this.that.__zoom,dispatch:c}),T)}};function U(v,...T){if(!e.apply(this,arguments))return;var C=A(this,T).event(v),$=this.__zoom,z=Math.max(r[0],Math.min(r[1],$.k*Math.pow(2,o.apply(this,arguments)))),M=_e(v);if(C.wheel)(C.mouse[0][0]!==M[0]||C.mouse[0][1]!==M[1])&&(C.mouse[1]=$.invert(C.mouse[0]=M)),clearTimeout(C.wheel);else{if($.k===z)return;C.mouse=[M,$.invert(M)],It(this),C.start()}lt(v),C.wheel=setTimeout(P,b),C.zoom("mouse",n(k(g($,z),C.mouse[0],C.mouse[1]),C.extent,a));function P(){C.wheel=null,C.end()}}function Z(v,...T){if(p||!e.apply(this,arguments))return;var C=v.currentTarget,$=A(this,T,!0).event(v),z=ye(v.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",re,!0),M=_e(v,C),P=v.clientX,L=v.clientY;qn(v.view),sn(v),$.mouse=[M,this.__zoom.invert(M)],It(this),$.start();function K(te){if(lt(te),!$.moved){var oe=te.clientX-P,ue=te.clientY-L;$.moved=oe*oe+ue*ue>_}$.event(te).zoom("mouse",n(k($.that.__zoom,$.mouse[0]=_e(te,C),$.mouse[1]),$.extent,a))}function re(te){z.on("mousemove.zoom mouseup.zoom",null),Jn(te.view,$.moved),lt(te),$.event(te).end()}}function D(v,...T){if(e.apply(this,arguments)){var C=this.__zoom,$=_e(v.changedTouches?v.changedTouches[0]:v,this),z=C.invert($),M=C.k*(v.shiftKey?.5:2),P=n(k(g(C,M),$,z),t.apply(this,T),a);lt(v),s>0?ye(this).transition().duration(s).call(B,P,$,v):ye(this).call(N.transform,P,$,v)}}function x(v,...T){if(e.apply(this,arguments)){var C=v.touches,$=C.length,z=A(this,T,v.changedTouches.length===$).event(v),M,P,L,K;for(sn(v),P=0;P<$;++P)L=C[P],K=_e(L,this),K=[K,this.__zoom.invert(K),L.identifier],z.touch0?!z.touch1&&z.touch0[2]!==K[2]&&(z.touch1=K,z.taps=0):(z.touch0=K,M=!0,z.taps=1+!!d);d&&(d=clearTimeout(d)),M&&(z.taps<2&&(h=K[0],d=setTimeout(function(){d=null},m)),It(this),z.start())}}function j(v,...T){if(this.__zooming){var C=A(this,T).event(v),$=v.changedTouches,z=$.length,M,P,L,K;for(lt(v),M=0;M<z;++M)P=$[M],L=_e(P,this),C.touch0&&C.touch0[2]===P.identifier?C.touch0[0]=L:C.touch1&&C.touch1[2]===P.identifier&&(C.touch1[0]=L);if(P=C.that.__zoom,C.touch1){var re=C.touch0[0],te=C.touch0[1],oe=C.touch1[0],ue=C.touch1[1],le=(le=oe[0]-re[0])*le+(le=oe[1]-re[1])*le,q=(q=ue[0]-te[0])*q+(q=ue[1]-te[1])*q;P=g(P,Math.sqrt(le/q)),L=[(re[0]+oe[0])/2,(re[1]+oe[1])/2],K=[(te[0]+ue[0])/2,(te[1]+ue[1])/2]}else if(C.touch0)L=C.touch0[0],K=C.touch0[1];else return;C.zoom("touch",n(k(P,L,K),C.extent,a))}}function H(v,...T){if(this.__zooming){var C=A(this,T).event(v),$=v.changedTouches,z=$.length,M,P;for(sn(v),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),M=0;M<z;++M)P=$[M],C.touch0&&C.touch0[2]===P.identifier?delete C.touch0:C.touch1&&C.touch1[2]===P.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(P=_e(P,this),Math.hypot(h[0]-P[0],h[1]-P[1])<E)){var L=ye(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return N.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:$t(+v),N):o},N.filter=function(v){return arguments.length?(e=typeof v=="function"?v:$t(!!v),N):e},N.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:$t(!!v),N):i},N.extent=function(v){return arguments.length?(t=typeof v=="function"?v:$t([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),N):t},N.scaleExtent=function(v){return arguments.length?(r[0]=+v[0],r[1]=+v[1],N):[r[0],r[1]]},N.translateExtent=function(v){return arguments.length?(a[0][0]=+v[0][0],a[1][0]=+v[1][0],a[0][1]=+v[0][1],a[1][1]=+v[1][1],N):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},N.constrain=function(v){return arguments.length?(n=v,N):n},N.duration=function(v){return arguments.length?(s=+v,N):s},N.interpolate=function(v){return arguments.length?(u=v,N):u},N.on=function(){var v=c.on.apply(c,arguments);return v===c?N:v},N.clickDistance=function(v){return arguments.length?(_=(v=+v)*v,N):Math.sqrt(_)},N.tapDistance=function(v){return arguments.length?(E=+v,N):E},N}var F=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(F||{}),un=(e=>(e.Partial="partial",e.Full="full",e))(un||{}),Ve=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Ve||{}),Oe=(e=>(e.Strict="strict",e.Loose="loose",e))(Oe||{}),cn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(cn||{}),at=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(at||{});function dn(){return typeof window<"u"?window:{chrome:!1,addEventListener(...e){}}}function fn(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 Mo(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=>Mo(n[o],i,t,n.type==="keyup")):Mo(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 st(e,t,n={actInsideInputWithModifier:!0}){const o=dn(),i=l.ref(l.toValue(e)===!0);let r=!1;const a=new Set;let s=c(l.toValue(e));return l.watch(i,(d,h)=>{d!==h&&(t==null||t(d))}),l.watch(()=>l.toValue(e),(d,h)=>{typeof h=="boolean"&&typeof d!="boolean"&&u(),s=c(d)},{immediate:!0}),Dn(o,"blur",()=>{l.toValue(e)!==!0&&(i.value=!1)}),Vn((...d)=>s(...d),d=>{r=ys(d),!((!r||r&&!n.actInsideInputWithModifier)&&fn(d))&&(d.preventDefault(),i.value=!0)},{eventName:"keydown"}),Vn((...d)=>s(...d),d=>{if(i.value){if((!r||r&&!n.actInsideInputWithModifier)&&fn(d))return;u()}},{eventName:"keyup"}),i;function u(){r=!1,a.clear(),i.value=!1}function c(d){return d===null?(u(),()=>!1):typeof d=="boolean"?(u(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?vs(d,a):d}}const Io="vue-flow__node-desc",$o="vue-flow__edge-desc",_s="vue-flow__aria-live",To=["Enter"," ","Escape"],Ze={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Po(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:a,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:c,nodesDraggable:d,panBy:h,findNode:p,multiSelectionActive:m,nodesSelectionActive:b,selectNodesOnDrag:_,removeSelectedElements:E,addSelectedNodes:N,updateNodePositions:g,emits:k}=de(),{onStart:S,onDrag:B,onStop:A,el:O,disabled:U,id:Z,selectable:D,dragHandle:x}=e,j=l.ref(!1);let H=[],v,T=null,C={x:void 0,y:void 0},$={x:0,y:0},z=null,M=!1,P=0,L=!1;const K=Ns(),re=({x:W,y:J})=>{C={x:W,y:J};let Q=!1;if(H=H.map(ie=>{const Y={x:W-ie.distance.x,y:J-ie.distance.y};n.value&&(Y.x=o.value[0]*Math.round(Y.x/o.value[0]),Y.y=o.value[1]*Math.round(Y.y/o.value[1]));const{computedPosition:f}=bn(ie,Y,k.error,a.value,ie.parentNode?p(ie.parentNode):void 0);return Q=Q||ie.position.x!==f.x||ie.position.y!==f.y,ie.position=f,ie}),!!Q&&(g(H,!0,!0),j.value=!0,z)){const[ie,Y]=_n({id:Z,dragItems:H,findNode:p});B({event:z,node:ie,nodes:Y})}},te=()=>{if(!T)return;const[W,J]=jo($,T);if(W!==0||J!==0){const Q={x:(C.x??0)-W/u.value.zoom,y:(C.y??0)-J/u.value.zoom};h({x:W,y:J})&&re(Q)}P=requestAnimationFrame(te)},oe=(W,J)=>{M=!0;const Q=p(Z);!_.value&&!m.value&&Q&&(Q.selected||E()),Q&&l.toValue(D)&&_.value&&Cn(Q,m.value,N,E,b,!1,J);const ie=K(W);if(C=ie,H=Hs(r.value,d.value,ie,p,Z),H.length){const[Y,f]=_n({id:Z,dragItems:H,findNode:p});S({event:W.sourceEvent,node:Y,nodes:f})}},ue=(W,J)=>{var Q;W.sourceEvent.type==="touchmove"&&W.sourceEvent.touches.length>1||(s.value===0&&oe(W,J),C=K(W),T=((Q=t.value)==null?void 0:Q.getBoundingClientRect())||null,$=Re(W.sourceEvent,T))},le=(W,J)=>{const Q=K(W);if(!L&&M&&c.value&&(L=!0,te()),!M){const ie=Q.xSnapped-(C.x??0),Y=Q.ySnapped-(C.y??0);Math.sqrt(ie*ie+Y*Y)>s.value&&oe(W,J)}(C.x!==Q.xSnapped||C.y!==Q.ySnapped)&&H.length&&M&&(z=W.sourceEvent,$=Re(W.sourceEvent,T),re(Q))},q=W=>{if(M&&(j.value=!1,L=!1,M=!1,cancelAnimationFrame(P),H.length)){g(H,!1,!1);const[J,Q]=_n({id:Z,dragItems:H,findNode:p});A({event:W.sourceEvent,node:J,nodes:Q})}};return l.watch([()=>l.toValue(U),O],([W,J],Q,ie)=>{if(J){const Y=ye(J);W||(v=Cl().on("start",f=>ue(f,J)).on("drag",f=>le(f,J)).on("end",f=>q(f)).filter(f=>{const y=f.target,w=l.toValue(x);return!f.button&&(!i.value||!oi(y,`.${i.value}`,J)&&(!w||oi(y,w,J)))}),Y.call(v)),ie(()=>{Y.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),j}const Bo=Symbol("vueFlow"),Do=Symbol("nodeId"),Vo=Symbol("nodeRef"),bs=Symbol("edgeId"),Es=Symbol("edgeRef"),Tt=Symbol("slots");function xs(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),updateStart:R(),update:R(),updateEnd:R()}}function Ss(e,t){const n=xs();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 Ns(){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 Pt(){return!0}function Oo({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:a}){const{vueFlowRef:s,connectionMode:u,connectionRadius:c,connectOnClick:d,connectionClickStartHandle:h,nodesConnectable:p,autoPanOnConnect:m,findNode:b,panBy:_,startConnection:E,updateConnection:N,endConnection:g,emits:k,viewport:S,edges:B,nodes:A,isValidConnection:O}=de();let U=null,Z=!1,D=null;function x(H){var v;const T=l.toValue(n)==="target",C=xn(H),$=Lo(H.target);if(C&&H.button===0||!C){let z=function(f){J=Re(f,q);const{handle:y,validHandleResult:w}=Zs(f,$,mn(J,S.value,!1,[1,1]),c.value,ie,I=>ui(f,I,u.value,l.toValue(t),l.toValue(e),T?"target":"source",L,$,B.value,A.value,b));if(K=y,Q||(Y(),Q=!0),U=w.connection,Z=w.isValid,D=w.handleDomNode,N(K&&Z?Xo({x:K.x,y:K.y},S.value):J,w.endHandle,Ks(!!K,Z)),!K&&!Z&&!D)return Sn(W);U&&U.source!==U.target&&D&&(Sn(W),W=D,D.classList.add("connecting","vue-flow__handle-connecting"),D.classList.toggle("valid",Z),D.classList.toggle("vue-flow__handle-valid",Z))},M=function(f){(K||D)&&U&&Z&&(r?r(f,U):k.connect(U)),k.connectEnd(f),i&&(a==null||a(f)),Sn(W),cancelAnimationFrame(re),g(f),Q=!1,Z=!1,U=null,D=null,$.removeEventListener("mousemove",z),$.removeEventListener("mouseup",M),$.removeEventListener("touchmove",z),$.removeEventListener("touchend",M)};const P=b(l.toValue(t));let L=l.toValue(o)||O.value||Pt;!L&&P&&(L=(T?P.isValidSourcePos:P.isValidTargetPos)||Pt);let K,re=0;const{x:te,y:oe}=Re(H),ue=$==null?void 0:$.elementFromPoint(te,oe),le=Nn(l.toValue(i),ue),q=(v=s.value)==null?void 0:v.getBoundingClientRect();if(!q||!le)return;let W,J=Re(H,q),Q=!1;const ie=Ws({nodes:A.value,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:le}),Y=()=>{if(!m.value)return;const[f,y]=jo(J,q);_({x:f,y}),re=requestAnimationFrame(Y)};E({nodeId:l.toValue(t),handleId:l.toValue(e),type:le},{x:te-q.left,y:oe-q.top}),k.connectStart({event:H,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:le}),$.addEventListener("mousemove",z),$.addEventListener("mouseup",M),$.addEventListener("touchmove",z),$.addEventListener("touchend",M)}}function j(H){if(!d.value)return;const v=l.toValue(n)==="target";if(!h.value)k.clickConnectStart({event:H,nodeId:l.toValue(t),handleId:l.toValue(e)}),E({nodeId:l.toValue(t),type:l.toValue(n),handleId:l.toValue(e)},void 0,!0);else{let T=l.toValue(o)||O.value||Pt;const C=b(l.toValue(t));if(!T&&C&&(T=(v?C.isValidSourcePos:C.isValidTargetPos)||Pt),C&&(typeof C.connectable>"u"?p.value:C.connectable)===!1)return;const $=Lo(H.target),{connection:z,isValid:M}=ui(H,{nodeId:l.toValue(t),id:l.toValue(e),type:l.toValue(n)},u.value,h.value.nodeId,h.value.handleId||null,h.value.type,T,$,B.value,A.value,b),P=z.source===z.target;M&&!P&&k.connect(z),k.clickConnectEnd(H),g(H,!0)}}return{handlePointerDown:x,handleClick:j}}function Cs(){return l.inject(Do,"")}function Ao(e){const t=e??Cs()??"",n=l.inject(Vo,l.ref(null)),{findNode:o,edges:i,emits:r}=de(),a=o(t);return a||r.error(new ge(he.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:a,parentNode:l.computed(()=>o(a.parentNode)),connectedEdges:l.computed(()=>yn([a],i.value))}}function ks(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),dragStart:R(),drag:R(),dragStop:R()}}function Ms(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 zo(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:a,emits:s}=de();return(u,c=!1)=>{const d=r.value?i.value[0]:5,h=r.value?i.value[1]:5,p=c?4:1,m=u.x*d*p,b=u.y*h*p,_=[];for(const E of e.value)if(E.draggable||a&&typeof E.draggable>"u"){const N={x:E.computedPosition.x+m,y:E.computedPosition.y+b},{computedPosition:g}=bn(E,N,s.error,t.value,E.parentNode?o(E.parentNode):void 0);_.push({id:E.id,position:g,from:E.position,distance:{x:u.x,y:u.y},dimensions:E.dimensions})}n(_,!0,!1)}}const hn=.1;function $e(){return Ot("Viewport not initialized yet."),Promise.resolve(!1)}const Is={zoomIn:$e,zoomOut:$e,zoomTo:$e,fitView:$e,setCenter:$e,fitBounds:$e,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:$e,setTransform:$e,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function $s(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(gn(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,a){return new Promise(s=>{const{x:u,y:c}=Ho({x:-o,y:-i},e.translateExtent),d=Ue.translate(-u,-c).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(gn(e.d3Selection,a,()=>{s(!0)}),d):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(gn(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:hn,includeHiddenNodes:!1,duration:0})=>{var r,a;const s=[];for(const p of e.nodes)p.dimensions.width&&p.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!p.hidden)&&(!((r=i.nodes)!=null&&r.length)||(a=i.nodes)!=null&&a.length&&i.nodes.includes(p.id))&&s.push(p);if(!s.length)return Promise.resolve(!1);const u=Zo(s),{x:c,y:d,zoom:h}=Ko(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??hn,i.offset);return n(c,d,h,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,c=e.dimensions.height/2-r*s;return n(u,c,s,a==null?void 0:a.duration)},fitBounds:(i,r={padding:hn})=>{const{x:a,y:s,zoom:u}=Ko(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=>mn(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 mn(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 Xo(s,e.viewport)}return{x:0,y:0}}}:Is)}function gn(e,t=0,n){return e.transition().duration(t).on("end",n)}function Ts(e,t,n){const o=l.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let _,E,N=!!(n.nodes.value.length||n.edges.value.length);_=Le([e.modelValue,()=>{var g,k;return(k=(g=e.modelValue)==null?void 0:g.value)==null?void 0:k.length}],([g])=>{g&&Array.isArray(g)&&(E==null||E.pause(),n.setElements(g),!E&&!N&&g.length?N=!0:E==null||E.resume())}),E=Le([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([g,k])=>{var S;(S=e.modelValue)!=null&&S.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...g,...k],l.nextTick(()=>{_==null||_.resume()}))},{immediate:N}),l.onScopeDispose(()=>{_==null||_.stop(),E==null||E.stop()})})},r=()=>{o.run(()=>{let _,E,N=!!n.nodes.value.length;_=Le([e.nodes,()=>{var g,k;return(k=(g=e.nodes)==null?void 0:g.value)==null?void 0:k.length}],([g])=>{g&&Array.isArray(g)&&(E==null||E.pause(),n.setNodes(g),!E&&!N&&g.length?N=!0:E==null||E.resume())}),E=Le([n.nodes,()=>n.nodes.value.length],([g])=>{var k;(k=e.nodes)!=null&&k.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...g],l.nextTick(()=>{_==null||_.resume()}))},{immediate:N}),l.onScopeDispose(()=>{_==null||_.stop(),E==null||E.stop()})})},a=()=>{o.run(()=>{let _,E,N=!!n.edges.value.length;_=Le([e.edges,()=>{var g,k;return(k=(g=e.edges)==null?void 0:g.value)==null?void 0:k.length}],([g])=>{g&&Array.isArray(g)&&(E==null||E.pause(),n.setEdges(g),!E&&!N&&g.length?N=!0:E==null||E.resume())}),E=Le([n.edges,()=>n.edges.value.length],([g])=>{var k;(k=e.edges)!=null&&k.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...g],l.nextTick(()=>{_==null||_.resume()}))},{immediate:N}),l.onScopeDispose(()=>{_==null||_.stop(),E==null||E.stop()})})},s=()=>{o.run(()=>{l.watch(()=>t.maxZoom,()=>{t.maxZoom&&fe(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{l.watch(()=>t.minZoom,()=>{t.minZoom&&fe(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{l.watch(()=>t.translateExtent,()=>{t.translateExtent&&fe(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{l.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&fe(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},h=()=>{o.run(()=>{l.watch(()=>t.applyDefault,()=>{fe(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},p=()=>{o.run(()=>{const _=async E=>{let N=E;typeof t.autoConnect=="function"&&(N=await t.autoConnect(E)),N!==!1&&n.addEdges([N])};l.watch(()=>t.autoConnect,()=>{fe(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),l.watch(n.autoConnect,(E,N,g)=>{E?n.onConnect(_):n.hooks.value.connect.off(_),g(()=>{n.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const E of Object.keys(t)){const N=E;if(!_.includes(N)){const g=l.toRef(()=>t[N]),k=n[N];l.isRef(k)&&o.run(()=>{l.watch(g,S=>{fe(S)&&(k.value=S)},{immediate:!0})})}}};(()=>{i(),r(),a(),u(),s(),c(),d(),h(),p(),m()})()}),()=>o.stop()}function Ro(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function pn(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 Ae(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ho(e,t){return{x:Ae(e.x,t[0][0],t[1][0]),y:Ae(e.y,t[0][1],t[1][1])}}function Lo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:dn().document}function Te(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function ze(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Te(e)}function We(e){return ze(e)&&"computedPosition"in e}function Dt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ps(e){return Dt(e.width)&&Dt(e.height)&&Dt(e.x)&&Dt(e.y)}function Bs(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:fe(e.data)?e.data:{},events:l.markRaw(fe(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Fo(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:fe(e.data)?e.data:{},events:l.markRaw(fe(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 Yo(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 Ds(...e){if(e.length===3){const[r,a,s]=e;return Yo(r,a,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(a=>ze(a)&&a.id===r.target))}function Vs(...e){if(e.length===3){const[r,a,s]=e;return Yo(r,a,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(a=>ze(a)&&a.id===r.source))}function Go({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Os(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 Xo({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function mn({x:e,y:t},{x:n,y:o,zoom:i},r,[a,s]){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 As(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 Uo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function zs({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Zo(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=As(t,Uo({...o.computedPosition,...o.dimensions}))}return zs(t)}function Wo(e,t,{x:n,y:o,zoom:i}={x:0,y:0,zoom:1},r=!1,a=!1){const s={x:(t.x-n)/i,y:(t.y-o)/i,width:t.width/i,height:t.height/i};return e.filter(u=>{const{computedPosition:c={x:0,y:0},dimensions:d={width:0,height:0},selectable:h}=u;if(a&&!h)return!1;const p={...c,width:d.width||0,height:d.height||0},m=pn(s,p),b=typeof d.width>"u"||typeof d.height>"u"||d.width===0||d.height===0,_=r&&m>0,E=d.width*d.height;return b||_||m>=E})}function yn(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 Ko(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)),c=Math.min(s,u),d=Ae(c,o,i),h=e.x+e.width/2,p=e.y+e.height/2,m=t/2-h*d+(a.x??0),b=n/2-p*d+(a.y??0);return{x:m,y:b,zoom:d}}function Rs(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function qo(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:qo(n,t):!1}function ut(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Jo(e,t,n){return e<t?Ae(Math.abs(e-t),1,50)/50:e>n?-Ae(Math.abs(e-n),1,50)/50:0}function jo(e,t){const n=Jo(e.x,35,t.width-35)*20,o=Jo(e.y,35,t.height-35)*20;return[n,o]}function vn(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 Qo(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(We(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&&We(u)&&vn(a,u)}break;case"dimensions":if(We(a)&&(typeof s.dimensions<"u"&&(a.dimensions=s.dimensions),typeof s.updateStyle<"u"&&(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&&We(u)&&(!!u.dimensions.width&&!!u.dimensions.height?vn(a,u):l.nextTick(()=>{vn(a,u)}))}break}return t}function Me(e,t){return{id:e,type:"select",selected:t}}function ei(e){return{item:e,type:"add"}}function ti(e){return{id:e,type:"remove"}}function ni(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function wn(e,t){return e.reduce((n,o)=>{let i=t.includes(o.id);fe(o.selectable)&&!o.selectable&&(i=!1);const r=We(o)?"changedNodes":"changedEdges";return!o.selected&&i?n[r].push(Me(o.id,!0)):o.selected&&!i&&n[r].push(Me(o.id,!1)),n},{changedNodes:[],changedEdges:[]})}function R(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 ct(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function oi(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 Hs(e,t,n,o,i){var r,a;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!qo(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 ii(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 Ls(e,t,n){const[o,i,r,a]=typeof e!="string"?ii(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 Fs(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=Ls(i,e,o);r&&(i=r)}else t(new ge(he.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]=ii(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-a,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Ys({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=Ys(e.dimensions,Fs(e,n,o,i)),a=Ho(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 En(e,t,n){const o=((n==null?void 0:n.x)??0)+t.x,i=((n==null?void 0:n.y)??0)+t.y,r=(n==null?void 0:n.width)??t.width,a=(n==null?void 0:n.height)??t.height;switch(e){case F.Top:return{x:o+r/2,y:i};case F.Right:return{x:o+r,y:i+a/2};case F.Bottom:return{x:o+r/2,y:i+a};case F.Left:return{x:o,y:i+a/2}}}function ri(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function Gs(e,t,n,o,i,r){const a=En(n,{...e.dimensions,...e.computedPosition},t),s=En(r,{...o.dimensions,...o.computedPosition},i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}}function Xs({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:a,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=Uo({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:a/u.zoom,height:s/u.zoom}),h=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),p=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(h*p)>0}function Us(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 he=(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))(he||{});const li={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,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]",Ti=()=>{};function $i(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 $n=e=>e();function Bi(e=$n){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=$n,...i}=n;return l.watch(e,$i(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:x,throwOnTimeout:b}={}){let S=null;const N=[new Promise(m=>{S=l.watch(e,E=>{f(E)!==t&&(S==null||S(),m(E))},{flush:h,deep:p,immediate:!0})})];return x!=null&&N.push(Bn(x,b).then(()=>Ne(e)).finally(()=>S==null?void 0:S())),Promise.race(N)}function o(f,h){if(!l.isRef(f))return n(E=>E===f,h);const{flush:p="sync",deep:x=!1,timeout:b,throwOnTimeout:S}=h??{};let C=null;const m=[new Promise(E=>{C=l.watch([e,f],([D,z])=>{t!==(D===z)&&(C==null||C(),E(D))},{flush:p,deep:x,immediate:!0})})];return b!=null&&m.push(Bn(b,S).then(()=>Ne(e)).finally(()=>(C==null||C(),Ne(e)))),Promise.race(m)}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 x=Array.from(p);return x.includes(f)||x.includes(Ne(f))},h)}function c(f){return d(1,f)}function d(f=1,h){let p=-1;return n(()=>(p+=1,p>=f),h)}return Array.isArray(Ne(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Ut(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:a,changed:c,changedTimes:d,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 Ti;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],a=()=>{r.forEach(d=>d()),r.length=0},s=(d,f,h,p)=>(d.addEventListener(f,h,p),()=>d.removeEventListener(f,h,p)),u=l.watch(()=>[Oi(t),Ne(i)],([d,f])=>{if(a(),!d)return;const h=Pi(f)?{...f}:f;r.push(...n.flatMap(p=>o.map(x=>s(d,p,x,h))))},{immediate:!0,flush:"post"}),c=()=>{u(),a()};return ht(c),c}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,d=>{d.repeat&&Ne(s)||u(d)&&n(d)},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:c,deep:d=!1,defaultValue:f,shouldEmit:h}=o,p=l.getCurrentInstance(),x=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=c;t||(t="modelValue"),b=b||`update:${t.toString()}`;const S=m=>s?typeof s=="function"?s(m):zi(m):m,C=()=>Mi(e[t])?S(e[t]):f,N=m=>{h?h(m)&&x(b,m):x(b,m)};if(u){const m=C(),E=l.ref(m);let D=!1;return l.watch(()=>e[t],z=>{D||(D=!0,E.value=S(z),l.nextTick(()=>D=!1))}),l.watch(E,z=>{!D&&(z!==e[t]||d)&&N(z)},{deep:d}),E}else return l.computed({get(){return C()},set(m){N(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,c,d=0;d<a;++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 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,c=0;c<s;++c)(u=a[c])&&(o.push(e.call(u,u.__data__,c,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,c=0;c<a;++c)(u=r[c])&&e.call(u,u.__data__,c,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,c=r.length;a<c;++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,c=new Map,d=t.length,f=r.length,h=new Array(d),p;for(s=0;s<d;++s)(u=t[s])&&(h[s]=p=a.call(u,u.__data__,s,t)+"",c.has(p)?i[s]=u:c.set(p,u));for(s=0;s<f;++s)p=a.call(e,r[s],s,r)+"",(u=c.get(p))?(o[s]=u,u.__data__=r[s],c.delete(p)):n[s]=new yt(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.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),c=0;c<r;++c){var d=o[c],f=i[c],h=f.length,p=dr(e.call(d,d&&d.__data__,c,o)),x=p.length,b=s[c]=new Array(x),S=a[c]=new Array(x),C=u[c]=new Array(h);n(d,f,b,S,C,p,t);for(var N=0,m=0,E,D;N<x;++N)if(E=b[N]){for(N>=m&&(m=N+1);!(D=S[m])&&++m<x;);E._next=D||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 c=n[u],d=o[u],f=c.length,h=s[u]=new Array(f),p,x=0;x<f;++x)(p=c[x]||d[x])&&(h[x]=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),c,d=0;d<s;++d)(c=a[d])&&(u[d]=c);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 Tr(e){return function(){this.style.removeProperty(e)}}function $r(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?Tr:typeof t=="function"?Br:$r)(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,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((a=o[i]).type===d.type&&a.name===d.name)return d.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: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:a,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}})}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,c,d,f=0;function h(E){E.on("mousedown.drag",p).filter(o).on("touchstart.drag",S).on("touchmove.drag",C,bl).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function p(E,D){if(!(d||!e.call(this,E,D))){var z=m(this,t.call(this,E,D),E,D,"mouse");z&&(ye(E.view).on("mousemove.drag",x,je).on("mouseup.drag",b,je),Jn(E.view),jt(E),c=!1,s=E.clientX,u=E.clientY,z("start",E))}}function x(E){if(Xe(E),!c){var D=E.clientX-s,z=E.clientY-u;c=D*D+z*z>f}i.mouse("drag",E)}function b(E){ye(E.view).on("mousemove.drag mouseup.drag",null),jn(E.view,c),Xe(E),i.mouse("end",E)}function S(E,D){if(e.call(this,E,D)){var z=E.changedTouches,F=t.call(this,E,D),Y=z.length,W,$;for(W=0;W<Y;++W)($=m(this,F,E,D,z[W].identifier,z[W]))&&(jt(E),$("start",E,z[W]))}}function C(E){var D=E.changedTouches,z=D.length,F,Y;for(F=0;F<z;++F)(Y=i[D[F].identifier])&&(Xe(E),Y("drag",E,D[F]))}function N(E){var D=E.changedTouches,z=D.length,F,Y;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),F=0;F<z;++F)(Y=i[D[F].identifier])&&(jt(E),Y("end",E,D[F]))}function m(E,D,z,F,Y,W){var $=r.copy(),O=_e(W||z,D),k,Q,_;if((_=n.call(E,new Qt("beforestart",{sourceEvent:z,target:h,identifier:Y,active:a,x:O[0],y:O[1],dx:0,dy:0,dispatch:$}),F))!=null)return k=_.x-O[0]||0,Q=_.y-O[1]||0,function I(M,T,B){var V=O,A;switch(M){case"start":i[Y]=I,A=a++;break;case"end":delete i[Y],--a;case"drag":O=_e(B||T,D),A=a;break}$.call(M,E,new Qt(M,{sourceEvent:T,subject:_,target:h,identifier:Y,active:A,x:O[0]+k,y:O[1]+Q,dx:O[0]-V[0],dy:O[1]-V[1],dispatch:$}),F)}}return h.filter=function(E){return arguments.length?(e=typeof E=="function"?E:vt(!!E),h):e},h.container=function(E){return arguments.length?(t=typeof E=="function"?E:vt(E),h):t},h.subject=function(E){return arguments.length?(n=typeof E=="function"?E:vt(E),h):n},h.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:vt(!!E),h):o},h.on=function(){var E=r.on.apply(r,arguments);return E===r?h:E},h.clickDistance=function(E){return arguments.length?(f=(E=+E)*E,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}\\)$`),Tl=new RegExp(`^rgba\\(${be},${be},${be},${tt}\\)$`),$l=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=Tl.exec(e))?_t(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=$l.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),c=co(i.opacity,r.opacity);return function(d){return i.r=a(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 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(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);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(c){return c.length?c.pop()+" ":""}function r(c,d,f,h,p,x){if(c!==f||d!==h){var b=p.push("translate(",null,t,null,n);x.push({i:b-4,x:Ie(c,f)},{i:b-2,x:Ie(d,h)})}else(f||h)&&p.push("translate("+f+t+h+n)}function a(c,d,f,h){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),h.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,h){c!==d?h.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,h,p,x){if(c!==f||d!==h){var b=p.push(i(p)+"scale(",null,",",null,")");x.push({i:b-4,x:Ie(c,f)},{i:b-2,x:Ie(d,h)})}else(f!==1||h!==1)&&p.push(i(p)+"scale("+f+","+h+")")}return function(c,d){var f=[],h=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,f,h),a(c.rotate,d.rotate,f,h),s(c.skewX,d.skewX,f,h),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,h),c=d=null,function(p){for(var x=-1,b=h.length,S;++x<b;)f[(S=h[x]).i]=S.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],c=r[2],d=a[0],f=a[1],h=a[2],p=d-s,x=f-u,b=p*p+x*x,S,C;if(b<Wl)C=Math.log(h/c)/t,S=function(F){return[s+F*p,u+F*x,c*Math.exp(t*F*C)]};else{var N=Math.sqrt(b),m=(h*h-c*c+o*b)/(2*c*n*N),E=(h*h-c*c-o*b)/(2*h*n*N),D=Math.log(Math.sqrt(m*m+1)-m),z=Math.log(Math.sqrt(E*E+1)-E);C=(z-D)/t,S=function(F){var Y=F*C,W=mo(D),$=c/(n*N)*(W*Jl(t*Y+D)-ql(D));return[s+$*p,u+$*x,c*W/mo(t*Y+D)]}}return S.duration=C*1e3*t/Math.SQRT2,S}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(c){n.state=xo,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var d,f,h,p;if(n.state!==xo)return u();for(d in o)if(p=o[d],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[d]):+d<t&&(p.state=It,p.timer.stop(),p.on.call("cancel",e,e.__data__,p.index,p.group),delete o[d])}if(bo(function(){n.state===Mt&&(n.state=So,n.timer.restart(s,n.delay,n.time),s(c))}),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),d=0,f=-1;d<h;++d)(p=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=p);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=cn,1),f=-1,h=i.length;++f<h;)i[f].call(e,d);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 c in o)return;delete e.__transition}}function Tt(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(){Tt(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,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&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 Ta(e){if(typeof e!="function")throw new Error;return this.each(Pa(this._id,e))}function $a(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,c=0;c<a;++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 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],c=n[s],d=u.length,f=a[s]=new Array(d),h,p=0;p<d;++p)(h=u[p]||c[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,c=r[a]=new Array(u),d,f,h=0;h<u;++h)(d=s[h])&&(f=e.call(d,d.__data__,h,s))&&("__data__"in d&&(f.__data__=d.__data__),c[h]=f,Pt(c[h],t,n,h,c,we(d,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],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var h=e.call(d,d.__data__,f,u),p,x=we(d,n),b=0,S=h.length;b<S;++b)(p=h[b])&&Pt(p,t,n,b,h,x);r.push(h),a.push(d)}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),c=u.on,d=u.value[r]==null?s||(s=Co(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(a,i=d),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,c=0;c<s;++c)if(u=a[c]){var d=we(u,t);Pt(u,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.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 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 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:$a,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:Ta,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,c=0;c<s;++c)(u=a[c])&&Pt(u,e,t,c,a,n||ss(u,t));return new Ce(o,this._parents,e,t)}Je.prototype.interrupt=la,Je.prototype.transition=us;const $t=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,c=gt("start","zoom","end"),d,f,h,p=500,x=150,b=0,S=10;function C(_){_.property("__zoom",Mo).on("wheel.zoom",Y,{passive:!1}).on("mousedown.zoom",W).on("dblclick.zoom",$).filter(i).on("touchstart.zoom",O).on("touchmove.zoom",k).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}C.transform=function(_,I,M,T){var B=_.selection?_.selection():_;B.property("__zoom",Mo),_!==B?D(_,I,M,T):B.interrupt().each(function(){z(this,arguments).event(T).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},C.scaleBy=function(_,I,M,T){C.scaleTo(_,function(){var B=this.__zoom.k,V=typeof I=="function"?I.apply(this,arguments):I;return B*V},M,T)},C.scaleTo=function(_,I,M,T){C.transform(_,function(){var B=t.apply(this,arguments),V=this.__zoom,A=M==null?E(B):typeof M=="function"?M.apply(this,arguments):M,X=V.invert(A),j=typeof I=="function"?I.apply(this,arguments):I;return n(m(N(V,j),A,X),B,a)},M,T)},C.translateBy=function(_,I,M,T){C.transform(_,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof M=="function"?M.apply(this,arguments):M),t.apply(this,arguments),a)},null,T)},C.translateTo=function(_,I,M,T,B){C.transform(_,function(){var V=t.apply(this,arguments),A=this.__zoom,X=T==null?E(V):typeof T=="function"?T.apply(this,arguments):T;return n(Ke.translate(X[0],X[1]).scale(A.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof M=="function"?-M.apply(this,arguments):-M),V,a)},T,B)};function N(_,I){return I=Math.max(r[0],Math.min(r[1],I)),I===_.k?_:new Me(I,_.x,_.y)}function m(_,I,M){var T=I[0]-M[0]*_.k,B=I[1]-M[1]*_.k;return T===_.x&&B===_.y?_:new Me(_.k,T,B)}function E(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function D(_,I,M,T){_.on("start.zoom",function(){z(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){z(this,arguments).event(T).end()}).tween("zoom",function(){var B=this,V=arguments,A=z(B,V).event(T),X=t.apply(B,V),j=M==null?E(X):typeof M=="function"?M.apply(B,V):M,G=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),R=B.__zoom,q=typeof I=="function"?I.apply(B,V):I,le=u(R.invert(j).concat(G/R.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)}A.zoom(null,ie)}})}function z(_,I,M){return!M&&_.__zooming||new F(_,I)}function F(_,I){this.that=_,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(_,I),this.taps=0}F.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,I){return this.mouse&&_!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&_!=="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(_){var I=ye(this.that).datum();c.call(_,this.that,new cs(_,{sourceEvent:this.sourceEvent,target:C,type:_,transform:this.that.__zoom,dispatch:c}),I)}};function Y(_,...I){if(!e.apply(this,arguments))return;var M=z(this,I).event(_),T=this.__zoom,B=Math.max(r[0],Math.min(r[1],T.k*Math.pow(2,o.apply(this,arguments)))),V=_e(_);if(M.wheel)(M.mouse[0][0]!==V[0]||M.mouse[0][1]!==V[1])&&(M.mouse[1]=T.invert(M.mouse[0]=V)),clearTimeout(M.wheel);else{if(T.k===B)return;M.mouse=[V,T.invert(V)],Tt(this),M.start()}at(_),M.wheel=setTimeout(A,x),M.zoom("mouse",n(m(N(T,B),M.mouse[0],M.mouse[1]),M.extent,a));function A(){M.wheel=null,M.end()}}function W(_,...I){if(h||!e.apply(this,arguments))return;var M=_.currentTarget,T=z(this,I,!0).event(_),B=ye(_.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",G,!0),V=_e(_,M),A=_.clientX,X=_.clientY;Jn(_.view),hn(_),T.mouse=[V,this.__zoom.invert(V)],Tt(this),T.start();function j(R){if(at(R),!T.moved){var q=R.clientX-A,le=R.clientY-X;T.moved=q*q+le*le>b}T.event(R).zoom("mouse",n(m(T.that.__zoom,T.mouse[0]=_e(R,M),T.mouse[1]),T.extent,a))}function G(R){B.on("mousemove.zoom mouseup.zoom",null),jn(R.view,T.moved),at(R),T.event(R).end()}}function $(_,...I){if(e.apply(this,arguments)){var M=this.__zoom,T=_e(_.changedTouches?_.changedTouches[0]:_,this),B=M.invert(T),V=M.k*(_.shiftKey?.5:2),A=n(m(N(M,V),T,B),t.apply(this,I),a);at(_),s>0?ye(this).transition().duration(s).call(D,A,T,_):ye(this).call(C.transform,A,T,_)}}function O(_,...I){if(e.apply(this,arguments)){var M=_.touches,T=M.length,B=z(this,I,_.changedTouches.length===T).event(_),V,A,X,j;for(hn(_),A=0;A<T;++A)X=M[A],j=_e(X,this),j=[j,this.__zoom.invert(j),X.identifier],B.touch0?!B.touch1&&B.touch0[2]!==j[2]&&(B.touch1=j,B.taps=0):(B.touch0=j,V=!0,B.taps=1+!!d);d&&(d=clearTimeout(d)),V&&(B.taps<2&&(f=j[0],d=setTimeout(function(){d=null},p)),Tt(this),B.start())}}function k(_,...I){if(this.__zooming){var M=z(this,I).event(_),T=_.changedTouches,B=T.length,V,A,X,j;for(at(_),V=0;V<B;++V)A=T[V],X=_e(A,this),M.touch0&&M.touch0[2]===A.identifier?M.touch0[0]=X:M.touch1&&M.touch1[2]===A.identifier&&(M.touch1[0]=X);if(A=M.that.__zoom,M.touch1){var G=M.touch0[0],R=M.touch0[1],q=M.touch1[0],le=M.touch1[1],ie=(ie=q[0]-G[0])*ie+(ie=q[1]-G[1])*ie,ae=(ae=le[0]-R[0])*ae+(ae=le[1]-R[1])*ae;A=N(A,Math.sqrt(ie/ae)),X=[(G[0]+q[0])/2,(G[1]+q[1])/2],j=[(R[0]+le[0])/2,(R[1]+le[1])/2]}else if(M.touch0)X=M.touch0[0],j=M.touch0[1];else return;M.zoom("touch",n(m(A,X,j),M.extent,a))}}function Q(_,...I){if(this.__zooming){var M=z(this,I).event(_),T=_.changedTouches,B=T.length,V,A;for(hn(_),h&&clearTimeout(h),h=setTimeout(function(){h=null},p),V=0;V<B;++V)A=T[V],M.touch0&&M.touch0[2]===A.identifier?delete M.touch0:M.touch1&&M.touch1[2]===A.identifier&&delete M.touch1;if(M.touch1&&!M.touch0&&(M.touch0=M.touch1,delete M.touch1),M.touch0)M.touch0[1]=this.__zoom.invert(M.touch0[0]);else if(M.end(),M.taps===2&&(A=_e(A,this),Math.hypot(f[0]-A[0],f[1]-A[1])<S)){var X=ye(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return C.wheelDelta=function(_){return arguments.length?(o=typeof _=="function"?_:$t(+_),C):o},C.filter=function(_){return arguments.length?(e=typeof _=="function"?_:$t(!!_),C):e},C.touchable=function(_){return arguments.length?(i=typeof _=="function"?_:$t(!!_),C):i},C.extent=function(_){return arguments.length?(t=typeof _=="function"?_:$t([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),C):t},C.scaleExtent=function(_){return arguments.length?(r[0]=+_[0],r[1]=+_[1],C):[r[0],r[1]]},C.translateExtent=function(_){return arguments.length?(a[0][0]=+_[0][0],a[1][0]=+_[1][0],a[0][1]=+_[0][1],a[1][1]=+_[1][1],C):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},C.constrain=function(_){return arguments.length?(n=_,C):n},C.duration=function(_){return arguments.length?(s=+_,C):s},C.interpolate=function(_){return arguments.length?(u=_,C):u},C.on=function(){var _=c.on.apply(c,arguments);return _===c?C:_},C.clickDistance=function(_){return arguments.length?(b=(_=+_)*_,C):Math.sqrt(b)},C.tapDistance=function(_){return arguments.length?(S=+_,C):S},C}var L=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(L||{}),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=c(l.toValue(e));l.watch(()=>l.toValue(e),(d,f)=>{typeof f=="boolean"&&typeof d!="boolean"&&u(),s=c(d)},{immediate:!0}),l.onMounted(()=>{Vn(window,["blur","contextmenu"],u)}),On((...d)=>s(...d),d=>{r=ys(d),!((!r||r&&!n.value)&&mn(d))&&(d.preventDefault(),i.value=!0)},{eventName:"keydown",target:o}),On((...d)=>s(...d),d=>{if(i.value){if((!r||r&&!n.value)&&mn(d))return;u()}},{eventName:"keyup",target:o});function u(){r=!1,a.clear(),i.value=!1}function c(d){return d===null?(u(),()=>!1):typeof d=="boolean"?(u(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?vs(d,a):d}return i}const Po="vue-flow__node-desc",To="vue-flow__edge-desc",_s="vue-flow__aria-live",$o=["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:c=!0,hidden:d=!1}=s,f=u.width??s.width??null,h=u.height??s.height??null;if(i&&!c||d)continue;const p=vn(r,yn(s)),x=f===null||h===null,b=o&&p>0,S=(f??0)*(h??0);(x||b||p>=S||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)),c=Math.min(s,u),d=He(c,o,i),f=e.x+e.width/2,h=e.y+e.height/2,p=t/2-f*d+(a.x??0),x=n/2-h*d+(a.y??0);return{x:p,y:x,zoom:d}}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 Te(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 $e(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(Te(r.id,a)))}return o}function H(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=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 Ts(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),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-a,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function $s({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=$s(e.dimensions,Ts(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=L.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 L.Top:return{x:o+r/2,y:i};case L.Right:return{x:o+r,y:i+a/2};case L.Bottom:return{x:o+r/2,y:i+a};case L.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 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=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(d.x2,c.x2)-Math.max(d.x,c.x)),h=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.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
|
|
2
2
|
Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
|
|
3
3
|
Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
|
|
4
4
|
Node: ${e}
|
|
@@ -18,5 +18,5 @@ Edge: ${e}
|
|
|
18
18
|
Source: ${t}
|
|
19
19
|
Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
|
|
20
20
|
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=li[t])==null?void 0:o.call(li,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function xn(e){return"clientX"in e}function Re(e,t){var n,o;const i=xn(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 Vt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ai(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function Sn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function si(e,t,n,o){return(t[n]||[]).reduce((i,r)=>{var a,s;return`${e.id}-${r.id}-${n}`!==o&&i.push({id:r.id||null,type:n,nodeId:e.id,x:(((a=e.computedPosition)==null?void 0:a.x)??0)+r.x+r.width/2,y:(((s=e.computedPosition)==null?void 0:s.y)??0)+r.y+r.height/2,width:r.width,height:r.height}),i},[])}function Zs(e,t,n,o,i,r){const{x:a,y:s}=Re(e),c=t.elementsFromPoint(a,s).find(b=>b.classList.contains("vue-flow__handle"));if(c){const b=c.getAttribute("data-nodeid");if(b){const _=Nn(void 0,c),E=c.getAttribute("data-handleid"),N=r({nodeId:b,id:E,type:_});if(N){const g=i.find(k=>k.nodeId===b&&k.type===_&&k.id===E);return{handle:{id:E,type:_,nodeId:b,x:(g==null?void 0:g.x)||n.x,y:(g==null?void 0:g.y)||n.y},validHandleResult:N}}}}let d=[],h=Number.POSITIVE_INFINITY;for(const b of i){const _=Math.sqrt((b.x-n.x)**2+(b.y-n.y)**2);if(_<=o){const E=r(b);_<=h&&(_<h?d=[{handle:b,validHandleResult:E}]:_===h&&d.push({handle:b,validHandleResult:E}),h=_)}}if(!d.length)return{handle:null,validHandleResult:ai()};if(d.length===1)return d[0];const p=d.some(({validHandleResult:b})=>b.isValid),m=d.some(({handle:b})=>b.type==="target");return d.find(({handle:b,validHandleResult:_})=>m?b.type==="target":p?_.isValid:!0)||d[0]}function ui(e,t,n,o,i,r,a,s,u,c,d){const h=r==="target",p=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:m,y:b}=Re(e),_=s.elementFromPoint(m,b),E=_!=null&&_.classList.contains("vue-flow__handle")?_:p,N=ai();if(E){N.handleDomNode=E;const g=Nn(void 0,E),k=E.getAttribute("data-nodeid"),S=E.getAttribute("data-handleid"),B=E.classList.contains("connectable"),A=E.classList.contains("connectableend"),O={source:h?k:o,sourceHandle:h?S:i,target:h?o:k,targetHandle:h?i:S};N.connection=O;const Z=B&&A&&(n===Oe.Strict?h&&g==="source"||!h&&g==="target":k!==o||S!==i);N.endHandle={nodeId:k,handleId:S,type:g},Z&&(N.isValid=a(O,{edges:u,nodes:c,sourceNode:d(O.source),targetNode:d(O.target)}))}return N}function Ws({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=[],c=[];s&&(u=si(a,s,"source",`${t}-${n}-${o}`),c=si(a,s,"target",`${t}-${n}-${o}`)),i.push(...u,...c)}return i}function Nn(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ks(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}const qs=["production","prod"];function Ot(e,...t){ci()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ci(){return!qs.includes(process.env.NODE_ENV||"")}function di(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 Cn(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 fe(e){return typeof l.unref(e)<"u"}function Js(e,t,n,o){if(!e||!e.source||!e.target)return n(new ge(he.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return Te(e)?i=e:i={...e,id:Go(e)},i=Fo(i,void 0,o),Os(i,t)?!1:i}function js(e,t,n,o,i,r){if(!t.source||!t.target)return r(new ge(he.EDGE_INVALID,e.id)),!1;const a=o(e.id);if(!a)return r(new ge(he.EDGE_NOT_FOUND,e.id)),!1;const{id:s,...u}=e,c={...u,id:i?Go(t):s,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.splice(n.indexOf(a),1,c),c}function fi(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const a=e[r];if(!ze(a)){n(new ge(he.NODE_INVALID,a==null?void 0:a.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=Bs(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(he.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 hi(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}`,c=`${r}-target-${s}`,d=e.get(u)||new Map,h=e.get(c)||new Map,p=l.markRaw({edgeId:o,source:i,target:r,sourceHandle:a,targetHandle:s});e.set(u,d.set(`${r}-${s}`,p)),e.set(c,h.set(`${i}-${a}`,p))}}function gi(e,t,n,o,i,r,a,s){const u=[];for(const c of e){const d=Te(c)?c:Js(c,s,i,r);if(!d)continue;const h=n(d.source),p=n(d.target);if(!h||!p){i(new ge(he.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!h){i(new ge(he.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!p){i(new ge(he.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:a,sourceNode:h,targetNode:p})){i(new ge(he.EDGE_INVALID,d.id));continue}const m=o(d.id);u.push({...Fo(d,m,r),sourceNode:h,targetNode:p})}return u}function Qs(){return{edgesChange:R(),nodesChange:R(),nodeDoubleClick:R(),nodeClick:R(),nodeMouseEnter:R(),nodeMouseMove:R(),nodeMouseLeave:R(),nodeContextMenu:R(),nodeDragStart:R(),nodeDrag:R(),nodeDragStop:R(),nodesInitialized:R(),miniMapNodeClick:R(),miniMapNodeDoubleClick:R(),miniMapNodeMouseEnter:R(),miniMapNodeMouseMove:R(),miniMapNodeMouseLeave:R(),connect:R(),connectStart:R(),connectEnd:R(),clickConnectStart:R(),clickConnectEnd:R(),paneReady:R(),init:R(),move:R(),moveStart:R(),moveEnd:R(),selectionDragStart:R(),selectionDrag:R(),selectionDragStop:R(),selectionContextMenu:R(),selectionStart:R(),selectionEnd:R(),viewportChangeStart:R(),viewportChange:R(),viewportChangeEnd:R(),paneScroll:R(),paneClick:R(),paneContextMenu:R(),paneMouseEnter:R(),paneMouseMove:R(),paneMouseLeave:R(),edgeContextMenu:R(),edgeMouseEnter:R(),edgeMouseMove:R(),edgeMouseLeave:R(),edgeDoubleClick:R(),edgeClick:R(),edgeUpdateStart:R(),edgeUpdate:R(),edgeUpdateEnd:R(),updateNodeInternals:R(),error:R(e=>Ot(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),ct(()=>{o.off(i)})}})}function pi(){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:un.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:at.Free,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:Ve.Bezier,style:{}},connectionMode:Oe.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:Vt()?"Meta":"Control",zoomActivationKeyCode:Vt()?"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,disableKeyboardA11y:!1,ariaLiveMessage:""}}const tu=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function nu(e,t,n){const o=$s(e),i=f=>{const y=f??[];e.hooks.updateNodeInternals.trigger(y)},r=f=>Vs(f,e.nodes,e.edges),a=f=>Ds(f,e.nodes,e.edges),s=f=>yn(f,e.edges),u=f=>{if(f)return t.value.get(f)},c=f=>{if(f)return n.value.get(f)},d=(f,y,w)=>{var I,V;const G=[];for(const X of f){const ee={id:X.id,type:"position",dragging:w,from:X.from};if(y&&(ee.position=X.position,X.parentNode)){const ne=u(X.parentNode);ee.position={x:ee.position.x-(((I=ne==null?void 0:ne.computedPosition)==null?void 0:I.x)??0),y:ee.position.y-(((V=ne==null?void 0:ne.computedPosition)==null?void 0:V.y)??0)}}G.push(ee)}G!=null&&G.length&&e.hooks.nodesChange.trigger(G)},h=f=>{if(!e.vueFlowRef)return;const y=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!y)return;const w=window.getComputedStyle(y),{m22:I}=new window.DOMMatrixReadOnly(w.transform),V=[];for(let G=0;G<f.length;++G){const X=f[G],ee=u(X.id);if(ee){const ne=Bt(X.nodeElement);if(!!(ne.width&&ne.height&&(ee.dimensions.width!==ne.width||ee.dimensions.height!==ne.height||X.forceUpdate))){const ae=X.nodeElement.getBoundingClientRect();ee.dimensions=ne,ee.handleBounds.source=di(".source",X.nodeElement,ae,I),ee.handleBounds.target=di(".target",X.nodeElement,ae,I),V[G]={id:ee.id,type:"dimensions",dimensions:ne}}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),V.length&&e.hooks.nodesChange.trigger(V)},p=(f,y)=>{const w=[];for(const G of f)w.push(G.id);let I=[],V=[];if(e.multiSelectionActive)for(const G of w)I.push(Me(G,y));else{const G=wn([...e.nodes,...e.edges],w);I=G.changedNodes,V=G.changedEdges}I.length&&e.hooks.nodesChange.trigger(I),V.length&&e.hooks.edgesChange.trigger(V)},m=(f,y)=>{const w=[];for(const G of f)w.push(G.id);let I=[],V=[];if(e.multiSelectionActive)for(const G of w)V.push(Me(G,y));else{const G=wn([...e.nodes,...e.edges],w);I=G.changedNodes,V=G.changedEdges}I.length&&e.hooks.nodesChange.trigger(I),V.length&&e.hooks.edgesChange.trigger(V)},b=(f,y)=>{const w=[],I=[];for(const X of f)ze(X)?w.push(X.id):Te(X)&&I.push(X.id);const{changedNodes:V,changedEdges:G}=wn([...e.nodes,...e.edges],[...w,...I]);if(e.multiSelectionActive){for(const X of w)V.push(Me(X,y));for(const X of I)G.push(Me(X,y))}V.length&&e.hooks.nodesChange.trigger(V),G.length&&e.hooks.edgesChange.trigger(G)},_=f=>{p(f,!0)},E=f=>{m(f,!0)},N=f=>{b(f,!0)},g=f=>{if(!f.length)return p(f,!1);const y=[];for(const w of f)y.push(Me(w.id,!1));y.length&&e.hooks.nodesChange.trigger(y)},k=f=>{if(!f.length)return m(f,!1);const y=[];for(const w of f)y.push(Me(w.id,!1));y.length&&e.hooks.edgesChange.trigger(y)},S=f=>{if(!f||!f.length)return b([],!1);const y=f.reduce((w,I)=>{const V=Me(I.id,!1);return ze(I)?w.nodes.push(V):w.edges.push(V),w},{nodes:[],edges:[]});y.nodes.length&&e.hooks.nodesChange.trigger(y.nodes),y.edges.length&&e.hooks.edgesChange.trigger(y.edges)},B=f=>{var y;(y=e.d3Zoom)==null||y.scaleExtent([f,e.maxZoom]),e.minZoom=f},A=f=>{var y;(y=e.d3Zoom)==null||y.scaleExtent([e.minZoom,f]),e.maxZoom=f},O=f=>{var y;(y=e.d3Zoom)==null||y.translateExtent(f),e.translateExtent=f},U=f=>{e.nodeExtent=f,i()},Z=f=>{e.nodesDraggable=f,e.nodesConnectable=f,e.elementsSelectable=f},D=f=>{const y=f instanceof Function?f(e.nodes):f;!e.initialized&&!y.length||(e.nodes=fi(y,u,e.hooks.error.trigger))},x=f=>{const y=f instanceof Function?f(e.edges):f;if(!e.initialized&&!y.length)return;const w=gi(y,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);hi(e.connectionLookup,w),e.edges=w},j=f=>{const y=f instanceof Function?f([...e.nodes,...e.edges]):f;!e.initialized&&!y.length||(D(y.filter(ze)),x(y.filter(Te)))},H=f=>{let y=f instanceof Function?f(e.nodes):f;y=Array.isArray(y)?y:[y];const w=fi(y,u,e.hooks.error.trigger),I=[];for(const V of w)I.push(ei(V));I.length&&e.hooks.nodesChange.trigger(I)},v=f=>{let y=f instanceof Function?f(e.edges):f;y=Array.isArray(y)?y:[y];const w=gi(y,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),I=[];for(const V of w)I.push(ei(V));I.length&&e.hooks.edgesChange.trigger(I)},T=(f,y=!0,w=!1)=>{const I=f instanceof Function?f(e.nodes):f,V=Array.isArray(I)?I:[I],G=[],X=[];function ee(ce){const ae=s(ce);for(const se of ae)(!fe(se.deletable)||se.deletable)&&X.push(ni(se.id,se.source,se.target,se.sourceHandle,se.targetHandle))}function ne(ce){const ae=[];for(const se of e.nodes)se.parentNode===ce&&ae.push(se);if(ae.length){for(const se of ae)G.push(ti(se.id));y&&ee(ae);for(const se of ae)ne(se.id)}}for(const ce of V){const ae=typeof ce=="string"?u(ce):ce;ae&&(fe(ae.deletable)&&!ae.deletable||(G.push(ti(ae.id)),y&&ee([ae]),w&&ne(ae.id)))}X.length&&e.hooks.edgesChange.trigger(X),G.length&&e.hooks.nodesChange.trigger(G)},C=f=>{const y=f instanceof Function?f(e.edges):f,w=Array.isArray(y)?y:[y],I=[];for(const V of w){const G=typeof V=="string"?c(V):V;G&&(fe(G.deletable)&&!G.deletable||I.push(ni(typeof V=="string"?V:V.id,G.source,G.target,G.sourceHandle,G.targetHandle)))}e.hooks.edgesChange.trigger(I)},$=(f,y,w=!0)=>js(f,y,e.edges,c,w,e.hooks.error.trigger),z=(f,y,w={replace:!1})=>{const I=c(f);if(!I)return;const V=typeof y=="function"?y(I):y;I.data=w.replace?V:{...I.data,...V}},M=f=>Qo(f,e.nodes),P=f=>{const y=Qo(f,e.edges);return hi(e.connectionLookup,y),y},L=(f,y,w={replace:!1})=>{const I=u(f);if(!I)return;const V=typeof y=="function"?y(I):y;w.replace?e.nodes.splice(e.nodes.indexOf(I),1,V):Object.assign(I,V)},K=(f,y,w={replace:!1})=>{const I=u(f);if(!I)return;const V=typeof y=="function"?y(I):y;I.data=w.replace?V:{...I.data,...V}},re=(f,y,w=!1)=>{w?e.connectionClickStartHandle=f:e.connectionStartHandle=f,e.connectionEndHandle=null,e.connectionStatus=null,y&&(e.connectionPosition=y)},te=(f,y=null,w=null)=>{e.connectionStartHandle&&(e.connectionPosition=f,e.connectionEndHandle=y,e.connectionStatus=w)},oe=(f,y)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,y?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ue=f=>{const y=Ps(f),w=y?null:We(f)?f:u(f.id);return!y&&!w?[null,null,y]:[y?f:Ro(w),w,y]},le=(f,y=!0,w=e.nodes)=>{const[I,V,G]=ue(f);if(!I)return[];const X=[];for(const ee of w||e.nodes){if(!G&&(ee.id===V.id||!ee.computedPosition))continue;const ne=Ro(ee),ce=pn(ne,I);(y&&ce>0||ce>=Number(I.width)*Number(I.height))&&X.push(ee)}return X},q=(f,y,w=!0)=>{const[I]=ue(f);if(!I)return!1;const V=pn(I,y);return w&&V>0||V>=Number(I.width)*Number(I.height)},W=f=>{const{viewport:y,dimensions:w,d3Zoom:I,d3Selection:V,translateExtent:G}=e;if(!I||!V||!f.x&&!f.y)return!1;const X=Ue.translate(y.x+f.x,y.y+f.y).scale(y.zoom),ee=[[0,0],[w.width,w.height]],ne=I.constrain()(X,ee,G),ce=e.viewport.x!==ne.x||e.viewport.y!==ne.y||e.viewport.zoom!==ne.k;return I.transform(V,ne),ce},J=f=>{const y=f instanceof Function?f(e):f,w=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];fe(y.defaultEdgeOptions)&&(e.defaultEdgeOptions=y.defaultEdgeOptions);const I=y.modelValue||y.nodes||y.edges?[]:void 0;I&&(y.modelValue&&I.push(...y.modelValue),y.nodes&&I.push(...y.nodes),y.edges&&I.push(...y.edges),j(I));const V=()=>{fe(y.maxZoom)&&A(y.maxZoom),fe(y.minZoom)&&B(y.minZoom),fe(y.translateExtent)&&O(y.translateExtent)};for(const G of Object.keys(y)){const X=G,ee=y[X];![...tu,...w].includes(X)&&fe(ee)&&(e[X]=ee)}dt(()=>e.d3Zoom).not.toBeNull().then(V),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:h,setElements:j,setNodes:D,setEdges:x,addNodes:H,addEdges:v,removeNodes:T,removeEdges:C,findNode:u,findEdge:c,updateEdge:$,updateEdgeData:z,updateNode:L,updateNodeData:K,applyEdgeChanges:P,applyNodeChanges:M,addSelectedElements:N,addSelectedNodes:_,addSelectedEdges:E,setMinZoom:B,setMaxZoom:A,setTranslateExtent:O,setNodeExtent:U,removeSelectedElements:S,removeSelectedNodes:g,removeSelectedEdges:k,startConnection:re,updateConnection:te,endConnection:oe,setInteractive:Z,setState:J,getIntersectingNodes:le,getIncomers:r,getOutgoers:a,getConnectedEdges:s,isNodeIntersecting:q,panBy:W,fitView:f=>o.value.fitView(f),zoomIn:f=>o.value.zoomIn(f),zoomOut:f=>o.value.zoomOut(f),zoomTo:(f,y)=>o.value.zoomTo(f,y),setViewport:(f,y)=>o.value.setViewport(f,y),setTransform:(f,y)=>o.value.setTransform(f,y),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(f,y,w)=>o.value.setCenter(f,y,w),fitBounds:(f,y)=>o.value.fitBounds(f,y),project:f=>o.value.project(f),screenToFlowCoordinate:f=>o.value.screenToFlowCoordinate(f),flowToScreenCoordinate:f=>o.value.flowToScreenCoordinate(f),toObject:()=>{const f=[],y=[];for(const w of e.nodes){const{computedPosition:I,handleBounds:V,selected:G,dimensions:X,isParent:ee,resizing:ne,dragging:ce,events:ae,...se}=w;f.push(se)}for(const w of e.edges){const{selected:I,sourceNode:V,targetNode:G,events:X,...ee}=w;y.push(ee)}return JSON.parse(JSON.stringify({nodes:f,edges:y,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:f=>new Promise(y=>{const{nodes:w,edges:I,position:V,zoom:G,viewport:X}=f;if(w&&D(w),I&&x(I),X!=null&&X.x&&(X!=null&&X.y)||V){const ee=(X==null?void 0:X.x)||V[0],ne=(X==null?void 0:X.y)||V[1],ce=(X==null?void 0:X.zoom)||G||e.viewport.zoom;return dt(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:ee,y:ne,zoom:ce}).then(()=>{y(!0)})})}else y(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const f=pi();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const y=Ue.translate(f.defaultViewport.x??0,f.defaultViewport.y??0).scale(Ae(f.defaultViewport.zoom??1,f.minZoom,f.maxZoom)),w=e.viewportRef.getBoundingClientRect(),I=[[0,0],[w.width,w.height]],V=e.d3Zoom.constrain()(y,I,f.translateExtent);e.d3Zoom.transform(e.d3Selection,V)}J(f)},$destroy:()=>{}}}const ou=["data-id","data-handleid","data-nodeid","data-handlepos"],iu={name:"Handle",compatConfig:{MODE:3}},Ke=l.defineComponent({...iu,props:{id:{default:null},type:{},position:{default:()=>F.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:c,noDragClassName:d,noPanClassName:h}=de(),{id:p,node:m,nodeEl:b,connectedEdges:_}=Ao(),E=l.ref(),N=l.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),g=l.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),k=l.toRef(()=>{var D,x,j,H,v,T;return((D=r.value)==null?void 0:D.nodeId)===p&&((x=r.value)==null?void 0:x.handleId)===e.id&&((j=r.value)==null?void 0:j.type)===o.value||((H=s.value)==null?void 0:H.nodeId)===p&&((v=s.value)==null?void 0:v.handleId)===e.id&&((T=s.value)==null?void 0:T.type)===o.value}),S=l.toRef(()=>{var D,x,j;return((D=a.value)==null?void 0:D.nodeId)===p&&((x=a.value)==null?void 0:x.handleId)===e.id&&((j=a.value)==null?void 0:j.type)===o.value}),{handlePointerDown:B,handleClick:A}=Oo({nodeId:p,handleId:e.id,isValidConnection:i,type:o}),O=l.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(D=>{const x=D[`${o.value}Handle`];return D[o.value]!==p?!1:x?x===e.id:!0}):typeof e.connectable=="number"?_.value.filter(D=>{const x=D[`${o.value}Handle`];return D[o.value]!==p?!1:x?x===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(m,_.value):fe(e.connectable)?e.connectable:c.value);dt(()=>!!m.dimensions.width&&!!m.dimensions.height).toBe(!0,{flush:"post"}).then(()=>{var D;const x=(D=m.handleBounds[o.value])==null?void 0:D.find(z=>z.id===e.id);if(!u.value||x)return;const j=u.value.querySelector(".vue-flow__transformationpane");if(!b.value||!E.value||!j||!e.id)return;const H=b.value.getBoundingClientRect(),v=E.value.getBoundingClientRect(),T=window.getComputedStyle(j),{m22:C}=new window.DOMMatrixReadOnly(T.transform),$={id:e.id,position:e.position,x:(v.left-H.left)/C,y:(v.top-H.top)/C,...Bt(E.value)};m.handleBounds[o.value]=[...m.handleBounds[o.value]??[],$]}),l.onUnmounted(()=>{const D=m.handleBounds[o.value];D&&(m.handleBounds[o.value]=D.filter(x=>x.id!==e.id))});function U(D){const x=xn(D);O.value&&N.value&&(x&&D.button===0||!x)&&B(D)}function Z(D){!p||!a.value&&!N.value||O.value&&A(D)}return t({handleClick:A,handlePointerDown:B,onClick:Z,onPointerDown:U}),(D,x)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"handle",ref:E,"data-id":`${l.unref(p)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":l.unref(p),"data-handlepos":D.position,class:l.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${D.position}`,`vue-flow__handle-${e.id}`,l.unref(d),l.unref(h),o.value,{connectable:O.value,connecting:S.value,connectablestart:N.value,connectableend:g.value,connectionindicator:O.value&&(N.value&&!k.value||g.value&&k.value)}]]),onMousedown:U,onTouchstartPassive:U,onClick:Z},[l.renderSlot(D.$slots,"default",{id:D.id})],42,ou))}}),At=function({sourcePosition:e=F.Bottom,targetPosition:t=F.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:a}){const s=a.label||n;return[l.h(Ke,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?l.h(s):l.h("div",{innerHTML:s}),l.h(Ke,{type:"source",position:e,connectable:o,isValidConnection:r})]};At.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],At.inheritAttrs=!1,At.compatConfig={MODE:3};const ru=At,zt=function({targetPosition:e=F.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[l.h(Ke,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?l.h(r):l.h("div",{innerHTML:r})]};zt.props=["targetPosition","label","isValidTargetPos","connectable","data"],zt.inheritAttrs=!1,zt.compatConfig={MODE:3};const lu=zt,Rt=function({sourcePosition:e=F.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(Ke,{type:"source",position:e,connectable:n,isValidConnection:o})]};Rt.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Rt.inheritAttrs=!1,Rt.compatConfig={MODE:3};const au=Rt,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}},Ht=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 mi({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 yi({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,c=t*.125+r*.375+s*.375+o*.125,d=Math.abs(u-e),h=Math.abs(c-t);return[u,c,d,h]}function Lt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vi({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let a,s;switch(e){case F.Left:a=t-Lt(t-o,r),s=n;break;case F.Right:a=t+Lt(o-t,r),s=n;break;case F.Top:a=t,s=n-Lt(n-i,r);break;case F.Bottom:a=t,s=n+Lt(i-n,r);break}return[a,s]}function kn(e){const{sourceX:t,sourceY:n,sourcePosition:o=F.Bottom,targetX:i,targetY:r,targetPosition:a=F.Top,curvature:s=.25}=e,[u,c]=vi({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,h]=vi({pos:a,x1:i,y1:r,x2:t,y2:n,c:s}),[p,m,b,_]=yi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${t},${n} C${u},${c} ${d},${h} ${i},${r}`,p,m,b,_]}function wi({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,a;switch(e){case F.Left:case F.Right:r=.5*(t+o),a=n;break;case F.Top:case F.Bottom:r=t,a=.5*(n+i);break}return[r,a]}function _i(e){const{sourceX:t,sourceY:n,sourcePosition:o=F.Bottom,targetX:i,targetY:r,targetPosition:a=F.Top}=e,[s,u]=wi({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=wi({pos:a,x1:i,y1:r,x2:t,y2:n}),[h,p,m,b]=yi({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}`,h,p,m,b]}const bi={[F.Left]:{x:-1,y:0},[F.Right]:{x:1,y:0},[F.Top]:{x:0,y:-1},[F.Bottom]:{x:0,y:1}};function mu({source:e,sourcePosition:t=F.Bottom,target:n}){return t===F.Left||t===F.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 Ei(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function yu({source:e,sourcePosition:t=F.Bottom,target:n,targetPosition:o=F.Top,center:i,offset:r}){const a=bi[t],s=bi[o],u={x:e.x+a.x*r,y:e.y+a.y*r},c={x:n.x+s.x*r,y:n.y+s.y*r},d=mu({source:u,sourcePosition:t,target:c}),h=d.x!==0?"x":"y",p=d[h];let m,b,_;const E={x:0,y:0},N={x:0,y:0},[g,k,S,B]=mi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[h]*s[h]===-1){b=i.x??g,_=i.y??k;const O=[{x:b,y:u.y},{x:b,y:c.y}],U=[{x:u.x,y:_},{x:c.x,y:_}];a[h]===p?m=h==="x"?O:U:m=h==="x"?U:O}else{const O=[{x:u.x,y:c.y}],U=[{x:c.x,y:u.y}];if(h==="x"?m=a.x===p?U:O:m=a.y===p?O:U,t===o){const H=Math.abs(e[h]-n[h]);if(H<=r){const v=Math.min(r-1,r-H);a[h]===p?E[h]=(u[h]>e[h]?-1:1)*v:N[h]=(c[h]>n[h]?-1:1)*v}}if(t!==o){const H=h==="x"?"y":"x",v=a[h]===s[H],T=u[H]>c[H],C=u[H]<c[H];(a[h]===1&&(!v&&T||v&&C)||a[h]!==1&&(!v&&C||v&&T))&&(m=h==="x"?O:U)}const Z={x:u.x+E.x,y:u.y+E.y},D={x:c.x+N.x,y:c.y+N.y},x=Math.max(Math.abs(Z.x-m[0].x),Math.abs(D.x-m[0].x)),j=Math.max(Math.abs(Z.y-m[0].y),Math.abs(D.y-m[0].y));x>=j?(b=(Z.x+D.x)/2,_=m[0].y):(b=m[0].x,_=(Z.y+D.y)/2)}return[[e,{x:u.x+E.x,y:u.y+E.y},...m,{x:c.x+N.x,y:c.y+N.y},n],b,_,S,B]}function vu(e,t,n,o){const i=Math.min(Ei(e,t)/2,Ei(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 c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${a}Q ${r},${a} ${r},${a+i*d}`}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 Mn(e){const{sourceX:t,sourceY:n,sourcePosition:o=F.Bottom,targetX:i,targetY:r,targetPosition:a=F.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[h,p,m,b,_]=yu({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:a,center:{x:u,y:c},offset:d});return[h.reduce((N,g,k)=>{let S;return k>0&&k<h.length-1?S=vu(h[k-1],g,h[k+1],s):S=`${k===0?"M":"L"}${g.x} ${g.y}`,N+=S,N},""),p,m,b,_]}function wu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,a,s,u]=mi({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(Ht,{path:n,labelX:o,labelY:i,...t,...e})}}}),xi=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]=Mn({...e,sourcePosition:e.sourcePosition??F.Bottom,targetPosition:e.targetPosition??F.Top});return l.h(Ht,{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(xi,{...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]=kn({...e,sourcePosition:e.sourcePosition??F.Bottom,targetPosition:e.targetPosition??F.Top});return l.h(Ht,{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]=_i({...e,sourcePosition:e.sourcePosition??F.Bottom,targetPosition:e.targetPosition??F.Top});return l.h(Ht,{path:n,labelX:o,labelY:i,...t,...e})}}}),Su={input:au,default:ru,output:lu},Nu={default:Eu,straight:_u,step:bu,smoothstep:xi,simplebezier:xu};function Cu(e,t,n){const o=l.computed(()=>_=>t.value.get(_)),i=l.computed(()=>_=>n.value.get(_)),r=l.computed(()=>{const _={...Nu,...e.edgeTypes},E=Object.keys(_);for(const N of e.edges)N.type&&!E.includes(N.type)&&(_[N.type]=N.type);return _}),a=l.computed(()=>{const _={...Su,...e.nodeTypes},E=Object.keys(_);for(const N of e.nodes)N.type&&!E.includes(N.type)&&(_[N.type]=N.type);return _}),s=l.computed(()=>e.onlyRenderVisibleElements?Wo(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 _=[];for(const E of e.edges){const N=t.value.get(E.source),g=t.value.get(E.target);Xs({sourcePos:N.computedPosition||{x:0,y:0},targetPos:g.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:g.dimensions.width,targetHeight:g.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(E)}return _}return e.edges}),c=l.computed(()=>[...s.value,...u.value]),d=l.computed(()=>{const _=[];for(const E of e.nodes)E.selected&&_.push(E);return _}),h=l.computed(()=>{const _=[];for(const E of e.edges)E.selected&&_.push(E);return _}),p=l.computed(()=>[...d.value,...h.value]),m=l.computed(()=>{const _=[];for(const E of e.nodes)E.dimensions.width&&E.dimensions.height&&E.handleBounds!==void 0&&_.push(E);return _}),b=l.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:s,getSelectedElements:p,getSelectedNodes:d,getSelectedEdges:h,getNodesInitialized:m,areNodesInitialized:b}}class He{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)??He.instance;return He.instance=o??new He,n&&(n.config.globalProperties.$vueFlowStorage=He.instance),He.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=pi(),i=l.reactive(o),r={};for(const[p,m]of Object.entries(i.hooks)){const b=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;r[b]=m.on}const a={};for(const[p,m]of Object.entries(i.hooks))a[p]=m.trigger;const s=l.computed(()=>{const p=new Map;for(const m of i.nodes)p.set(m.id,m);return p}),u=l.computed(()=>{const p=new Map;for(const m of i.edges)p.set(m.id,m);return p}),c=Cu(i,s,u),d=nu(i,s,u);d.setState({...i,...n});const h={...r,...c,...d,...Vi(i),emits:a,id:t,vueFlowVersion:"1.37.1",$destroy:()=>{this.remove(t)}};return this.set(t,h),h}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=He.getInstance(),n=l.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,a=(n==null?void 0:n.vueFlowId)||r;let s;if(n){const u=l.inject(Bo,null);typeof u<"u"&&u!==null&&(s=u)}if(s||a&&(s=t.get(a)),!s||s&&r&&r!==s.id){const u=r??t.getId(),c=t.create(u,i);s=c,(n??l.effectScope(!0)).run(()=>{l.watch(c.applyDefault,(h,p,m)=>{const b=E=>{c.applyNodeChanges(E)},_=E=>{c.applyEdgeChanges(E)};h?(c.onNodesChange(b),c.onEdgesChange(_)):(c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(_)),m(()=>{c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(_)})},{immediate:!0}),ct(()=>{if(s){const h=t.get(s.id);h?h.$destroy():Ot(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(l.provide(Bo,s),n.vueFlowId=s.id),o){const u=l.getCurrentInstance();(u==null?void 0:u.type.name)!=="VueFlow"&&s.emits.error(new ge(he.USEVUEFLOW_OPTIONS))}return s}function ku(e){const t=dn(),{emits:n,dimensions:o}=de();let i;l.onMounted(()=>{const r=e.value,a=()=>{if(!r)return;const s=Bt(r);(s.width===0||s.height===0)&&n.error(new ge(he.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),t.addEventListener("resize",a),r&&(i=new ResizeObserver(()=>a()),i.observe(r)),l.onBeforeUnmount(()=>{t.removeEventListener("resize",a),i&&r&&i.unobserve(r)})})}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))}}),$u=["tabIndex"],Tu={name:"NodesSelection",compatConfig:{MODE:3}},Pu=l.defineComponent({...Tu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:a}=de(),s=zo(),u=l.ref(null),c=Po({el:u,onStart(b){t.selectionDragStart(b)},onDrag(b){t.selectionDrag(b)},onStop(b){t.selectionDragStop(b)}});l.onMounted(()=>{var b;r.value||(b=u.value)==null||b.focus({preventScroll:!0})});const d=l.computed(()=>Zo(o.value)),h=l.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function p(b){t.selectionContextMenu({event:b,nodes:o.value})}function m(b){r||Ze[b.key]&&s({x:Ze[b.key].x,y:Ze[b.key].y},b.shiftKey)}return(b,_)=>!l.unref(a)&&d.value.width&&d.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(c)},"vue-flow__nodesselection-rect"]),style:l.normalizeStyle(h.value),tabIndex:l.unref(r)?void 0:-1,onContextmenu:p,onKeydown:m},null,46,$u)],6)):l.createCommentVNode("",!0)}});function Si(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Bu={name:"Pane",compatConfig:{MODE:3}},Du=l.defineComponent({...Bu,props:{isSelecting:{type:Boolean}},setup(e){const{vueFlowRef:t,getNodes:n,getEdges:o,viewport:i,emits:r,userSelectionActive:a,removeSelectedElements:s,panOnDrag:u,userSelectionRect:c,elementsSelectable:d,nodesSelectionActive:h,addSelectedElements:p,getSelectedEdges:m,getSelectedNodes:b,removeNodes:_,removeEdges:E,selectionMode:N,deleteKeyCode:g,multiSelectionKeyCode:k,multiSelectionActive:S}=de(),B=l.ref(null),A=l.ref(0),O=l.ref(0),U=l.ref(),Z=l.toRef(()=>d.value&&(e.isSelecting||a.value));st(g,M=>{if(!M)return;const P=[];for(const L of n.value)(!L.selected&&L.parentNode&&P.some(K=>K.id===L.parentNode)||L.selected)&&P.push(L);(P||m.value)&&(m.value.length>0&&E(m.value),P.length>0&&_(P),h.value=!1,s())},{actInsideInputWithModifier:!1}),st(k,M=>{S.value=M});function D(){a.value=!1,c.value=null,A.value=0,O.value=0}function x(M){M.target!==B.value||Z.value||(r.paneClick(M),s(),h.value=!1)}function j(M){var P;if(M.target===B.value){if(Array.isArray(u.value)&&((P=u.value)!=null&&P.includes(2))){M.preventDefault();return}r.paneContextMenu(M)}}function H(M){M.target===B.value&&r.paneScroll(M)}function v(M){if(U.value=t.value.getBoundingClientRect(),!Z.value||!d||!e.isSelecting||M.button!==0||M.target!==B.value||!U.value)return;const{x:P,y:L}=Si(M,U.value);s(),c.value={width:0,height:0,startX:P,startY:L,x:P,y:L},a.value=!0,r.selectionStart(M)}function T(M){if(!Z.value)return r.paneMouseMove(M);if(!e.isSelecting||!U.value||!c.value)return;a.value||(a.value=!0),h.value&&(h.value=!1);const P=Si(M,U.value),L=c.value.startX??0,K=c.value.startY??0,re={...c.value,x:P.x<L?P.x:L,y:P.y<K?P.y:K,width:Math.abs(P.x-L),height:Math.abs(P.y-K)},te=Wo(n.value,c.value,i.value,N.value===un.Partial),oe=yn(te,o.value);A.value=te.length,O.value=oe.length,c.value=re,p([...te,...oe])}function C(M){Z.value&&M.button===0&&(!a.value&&c.value&&M.target===B.value&&x(M),h.value=A.value>0,D(),r.selectionEnd(M))}function $(M){var P;if(!Z.value)return r.paneMouseLeave(M);a.value&&(h.value=A.value>0,(P=r.selectionEnd)==null||P.call(r,M)),D()}function z(M){Z.value||r.paneMouseEnter(M)}return(M,P)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"container",ref:B,class:l.normalizeClass(["vue-flow__pane vue-flow__container",{selection:M.isSelecting}]),onClick:x,onContextmenu:j,onWheelPassive:H,onMouseenter:z,onMousedown:v,onMousemove:T,onMouseup:C,onMouseleave:$},[l.renderSlot(M.$slots,"default"),l.unref(a)&&l.unref(c)?(l.openBlock(),l.createBlock(Iu,{key:0,"user-selection-rect":l.unref(c)},null,8,["user-selection-rect"])):l.createCommentVNode("",!0),l.unref(h)&&l.unref(b).length?(l.openBlock(),l.createBlock(Pu,{key:1})):l.createCommentVNode("",!0)],34))}}),Vu={name:"Transform",compatConfig:{MODE:3}},Ou=l.defineComponent({...Vu,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))}}),Au={name:"Viewport",compatConfig:{MODE:3}},zu=l.defineComponent({...Au,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:a,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:h,zoomOnDoubleClick:p,zoomOnPinch:m,zoomOnScroll:b,preventScrolling:_,noWheelClassName:E,noPanClassName:N,emits:g,connectionStartHandle:k,userSelectionActive:S,paneDragging:B,d3Zoom:A,d3Selection:O,d3ZoomHandler:U,viewport:Z,viewportRef:D}=de();ku(D);const x=l.ref(!1),j=l.ref(!1);let H=null,v=!1,T=0,C={x:0,y:0,zoom:0};const $=st(s),z=st(a),M=st(r),P=l.toRef(()=>$.value||h.value),L=l.toRef(()=>$.value||u.value),K=l.toRef(()=>z.value||a.value===!0&&P.value!==!0);l.onMounted(()=>{if(!D.value){Ot("Viewport element is missing");return}const q=D.value,W=q.getBoundingClientRect(),J=ms().scaleExtent([t.value,n.value]).translateExtent(i.value),Q=ye(q).call(J),ie=Q.on("wheel.zoom"),Y=Ue.translate(o.value.x??0,o.value.y??0).scale(Ae(o.value.zoom??1,t.value,n.value)),f=[[0,0],[W.width,W.height]],y=J.constrain()(Y,f,i.value);J.transform(Q,y),J.wheelDelta(te),A.value=J,O.value=Q,U.value=ie,Z.value={x:y.x,y:y.y,zoom:y.k},J.on("start",w=>{var I;if(!w.sourceEvent)return null;T=w.sourceEvent.button,x.value=!0;const V=ue(w.transform);((I=w.sourceEvent)==null?void 0:I.type)==="mousedown"&&(B.value=!0),C=V,g.viewportChangeStart(V),g.moveStart({event:w,flowTransform:V})}),J.on("end",w=>{if(!w.sourceEvent)return null;if(x.value=!1,B.value=!1,re(P.value,T??0)&&!v&&g.paneContextMenu(w.sourceEvent),v=!1,oe(C,w.transform)){const I=ue(w.transform);C=I,g.viewportChangeEnd(I),g.moveEnd({event:w,flowTransform:I})}}),J.filter(w=>{var I,V,G;const X=M.value||b.value,ee=m.value&&w.ctrlKey,ne=w.button;if((P.value===!0||Array.isArray(P.value)&&P.value.includes(1))&&ne===1&&w.type==="mousedown"&&((I=w.target)!=null&&I.closest(".vue-flow__node")||(V=w.target)!=null&&V.closest(".vue-flow__edge")))return!0;if(!P.value&&!X&&!L.value&&!p.value&&!m.value||S.value||!p.value&&w.type==="dblclick"||le(w,E.value)&&w.type==="wheel"||le(w,N.value)&&(w.type!=="wheel"||L.value&&w.type==="wheel"&&!M.value)||!m.value&&w.ctrlKey&&w.type==="wheel"||!X&&!L.value&&!ee&&w.type==="wheel")return!1;if(!m&&w.type==="touchstart"&&((G=w.touches)==null?void 0:G.length)>1)return w.preventDefault(),!1;if(!P.value&&(w.type==="mousedown"||w.type==="touchstart")||Array.isArray(P.value)&&!P.value.includes(ne)&&(w.type==="mousedown"||w.type==="touchstart"))return!1;const ce=Array.isArray(P.value)&&P.value.includes(ne)||!ne||ne<=1;return(!w.ctrlKey||w.type==="wheel")&&ce}),l.watch([S,P],()=>{S.value&&!x.value?J.on("zoom",null):S.value||J.on("zoom",w=>{Z.value={x:w.transform.x,y:w.transform.y,zoom:w.transform.k};const I=ue(w.transform);v=re(P.value,T??0),g.viewportChange(I),g.move({event:w,flowTransform:I})})},{immediate:!0}),l.watch([S,L,c,M,m,_,E],()=>{L.value&&!M.value&&!S.value?Q.on("wheel.zoom",w=>{if(le(w,E.value))return!1;const I=M.value||b.value,V=m.value&&w.ctrlKey;if(!(!_.value||L.value||I||V))return!1;w.preventDefault(),w.stopImmediatePropagation();const X=Q.property("__zoom").k||1,ee=Vt();if(w.ctrlKey&&m.value&&ee){const Ic=_e(w),$c=te(w),Tc=X*2**$c;J.scaleTo(Q,Tc,Ic,w);return}const ne=w.deltaMode===1?20:1;let ce=c.value===at.Vertical?0:w.deltaX*ne,ae=c.value===at.Horizontal?0:w.deltaY*ne;!ee&&w.shiftKey&&c.value!==at.Vertical&&!ce&&ae&&(ce=ae,ae=0),J.translateBy(Q,-(ce/X)*d.value,-(ae/X)*d.value);const se=ue(Q.property("__zoom"));H&&clearTimeout(H),j.value?(g.move({event:w,flowTransform:se}),g.viewportChange(se),H=setTimeout(()=>{g.moveEnd({event:w,flowTransform:se}),g.viewportChangeEnd(se),j.value=!1},150)):(j.value=!0,g.moveStart({event:w,flowTransform:se}),g.viewportChangeStart(se))},{passive:!1}):typeof ie<"u"&&Q.on("wheel.zoom",function(w,I){const V=!_.value&&w.type==="wheel"&&!w.ctrlKey,G=M.value||b.value,X=m.value&&w.ctrlKey;if(!G&&!u.value&&!X&&w.type==="wheel"||V||le(w,E.value))return null;w.preventDefault(),ie.call(this,w,I)},{passive:!1})},{immediate:!0})});function re(q,W){return W===2&&Array.isArray(q)&&q.includes(2)}function te(q){const W=q.ctrlKey&&Vt()?10:1;return-q.deltaY*(q.deltaMode===1?.05:q.deltaMode?1:.002)*W}function oe(q,W){return q.x!==W.x&&!Number.isNaN(W.x)||q.y!==W.y&&!Number.isNaN(W.y)||q.zoom!==W.k&&!Number.isNaN(W.k)}function ue(q){return{x:q.x,y:q.y,zoom:q.k}}function le(q,W){return q.target.closest(`.${W}`)}return(q,W)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"viewportRef",ref:D,class:"vue-flow__viewport vue-flow__container"},[l.createVNode(Du,{"is-selecting":K.value,class:l.normalizeClass({connecting:!!l.unref(k),dragging:l.unref(B),draggable:P.value})},{default:l.withCtx(()=>[l.createVNode(Ou,null,{default:l.withCtx(()=>[l.renderSlot(q.$slots,"default")]),_:3})]),_:3},8,["is-selecting","class"])],512))}}),Ru=["id"],Hu=["id"],Lu=["id"],Fu={name:"A11yDescriptions",compatConfig:{MODE:3}},Yu=l.defineComponent({...Fu,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(Io)}-${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,Ru),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,Hu),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,Lu))],64))}});function Gu(){const e=de();l.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Xu(e,t,n){return n===F.Left?e-t:n===F.Right?e+t:e}function Uu(e,t,n){return n===F.Top?e-t:n===F.Bottom?e+t:e}const In=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=F.Top,type:i}){return l.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Xu(t,e,o),cy:Uu(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};In.props=["radius","centerX","centerY","position","type"],In.compatConfig={MODE:3};const Ni=In,Zu=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:c,findEdge:d,findNode:h,isValidConnection:p,multiSelectionActive:m,disableKeyboardA11y:b,elementsSelectable:_,edgesUpdatable:E,edgesFocusable:N}=de(),g=l.computed(()=>d(e.id)),k=Ss(g.value,r),S=l.inject(Tt),B=l.getCurrentInstance(),A=l.ref(!1),O=l.ref(!1),U=l.ref(""),Z=l.ref(null),D=l.ref("source"),x=l.ref(null),j=l.toRef(()=>typeof g.value.selectable>"u"?_.value:g.value.selectable),H=l.toRef(()=>typeof g.value.updatable>"u"?E.value:g.value.updatable),v=l.toRef(()=>typeof g.value.focusable>"u"?N.value:g.value.focusable);l.provide(bs,e.id),l.provide(Es,x);const T=l.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),C=l.computed(()=>g.value.style instanceof Function?g.value.style(g.value):g.value.style),$=l.computed(()=>{const Y=g.value.type||"default",f=S==null?void 0:S[`edge-${Y}`];if(f)return f;let y=g.value.template??u.value[Y];if(typeof y=="string"&&B){const w=Object.keys(B.appContext.components);w&&w.includes(Y)&&(y=l.resolveComponent(Y,!1))}return y&&typeof y!="string"?y:(r.error(new ge(he.EDGE_TYPE_MISSING,y)),!1)}),{handlePointerDown:z}=Oo({nodeId:U,handleId:Z,type:D,isValidConnection:p,edgeUpdaterType:D,onEdgeUpdate:L,onEdgeUpdateEnd:K});return()=>{const Y=h(g.value.source),f=h(g.value.target),y="pathOptions"in g.value?g.value.pathOptions:{};if(!Y&&!f)return r.error(new ge(he.EDGE_SOURCE_TARGET_MISSING,g.value.id,g.value.source,g.value.target)),null;if(!Y)return r.error(new ge(he.EDGE_SOURCE_MISSING,g.value.id,g.value.source)),null;if(!f)return r.error(new ge(he.EDGE_TARGET_MISSING,g.value.id,g.value.target)),null;if(!g.value||g.value.hidden||Y.hidden||f.hidden)return null;let w;o.value===Oe.Strict?w=Y.handleBounds.source:w=[...Y.handleBounds.source||[],...Y.handleBounds.target||[]];const I=ri(w,g.value.sourceHandle);let V;o.value===Oe.Strict?V=f.handleBounds.target:V=[...f.handleBounds.target||[],...f.handleBounds.source||[]];const G=ri(V,g.value.targetHandle),X=I?I.position:F.Bottom,ee=G?G.position:F.Top,{sourceX:ne,sourceY:ce,targetY:ae,targetX:se}=Gs(Y,I,X,f,G,ee);return g.value.sourceX=ne,g.value.sourceY=ce,g.value.targetX=se,g.value.targetY=ae,l.h("g",{ref:x,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${$.value===!1?"default":g.value.type||"default"}`,s.value,T.value,{updating:A.value,selected:g.value.selected,animated:g.value.animated,inactive:!j.value}],onClick:te,onContextmenu:oe,onDblclick:ue,onMouseenter:le,onMousemove:q,onMouseleave:W,onKeyDown:v.value?ie:void 0,tabIndex:v.value?0:void 0,"aria-label":g.value.ariaLabel===null?void 0:g.value.ariaLabel||`Edge from ${g.value.source} to ${g.value.target}`,"aria-describedby":v.value?`${$o}-${t}`:void 0,role:v.value?"button":"img"},[O.value?null:l.h($.value===!1?u.value.default:$.value,{id:e.id,sourceNode:Y,targetNode:f,source:g.value.source,target:g.value.target,type:g.value.type,updatable:H.value,selected:g.value.selected,animated:g.value.animated,label:g.value.label,labelStyle:g.value.labelStyle,labelShowBg:g.value.labelShowBg,labelBgStyle:g.value.labelBgStyle,labelBgPadding:g.value.labelBgPadding,labelBgBorderRadius:g.value.labelBgBorderRadius,data:g.value.data,events:{...g.value.events,...k.on},style:C.value,markerStart:`url('#${ut(g.value.markerStart,t)}')`,markerEnd:`url('#${ut(g.value.markerEnd,t)}')`,sourcePosition:X,targetPosition:ee,sourceX:ne,sourceY:ce,targetX:se,targetY:ae,sourceHandleId:g.value.sourceHandle,targetHandleId:g.value.targetHandle,interactionWidth:g.value.interactionWidth,...y}),[H.value==="source"||H.value===!0?[l.h("g",{onMousedown:J,onMouseenter:M,onMouseout:P},l.h(Ni,{position:X,centerX:ne,centerY:ce,radius:i.value,type:"source","data-type":"source"}))]:null,H.value==="target"||H.value===!0?[l.h("g",{onMousedown:Q,onMouseenter:M,onMouseout:P},l.h(Ni,{position:ee,centerX:se,centerY:ae,radius:i.value,type:"target","data-type":"target"}))]:null]])};function M(){A.value=!0}function P(){A.value=!1}function L(Y,f){k.emit.update({event:Y,edge:g.value,connection:f})}function K(Y){k.emit.updateEnd({event:Y,edge:g.value}),O.value=!1}function re(Y,f){Y.button===0&&(O.value=!0,U.value=f?g.value.target:g.value.source,Z.value=(f?g.value.targetHandle:g.value.sourceHandle)??"",D.value=f?"target":"source",k.emit.updateStart({event:Y,edge:g.value}),z(Y))}function te(Y){var f;const y={event:Y,edge:g.value};j.value&&(a.value=!1,g.value.selected&&m.value?(c([g.value]),(f=x.value)==null||f.blur()):n([g.value])),k.emit.click(y)}function oe(Y){k.emit.contextMenu({event:Y,edge:g.value})}function ue(Y){k.emit.doubleClick({event:Y,edge:g.value})}function le(Y){k.emit.mouseEnter({event:Y,edge:g.value})}function q(Y){k.emit.mouseMove({event:Y,edge:g.value})}function W(Y){k.emit.mouseLeave({event:Y,edge:g.value})}function J(Y){re(Y,!0)}function Q(Y){re(Y,!1)}function ie(Y){var f;!b.value&&To.includes(Y.key)&&j.value&&(Y.key==="Escape"?((f=x.value)==null||f.blur(),c([d(e.id)])):n([d(e.id)]))}}}),Wu={[F.Left]:F.Right,[F.Right]:F.Left,[F.Top]:F.Bottom,[F.Bottom]:F.Top},Ku=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:c,viewport:d,findNode:h}=de(),p=(e=l.inject(Tt))==null?void 0:e["connection-line"],m=l.computed(()=>{var g;return h((g=o.value)==null?void 0:g.nodeId)}),b=l.computed(()=>{var g;return h((g=i.value)==null?void 0:g.nodeId)??null}),_=l.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),E=l.computed(()=>u.value.markerStart?`url(#${ut(u.value.markerStart,t)})`:""),N=l.computed(()=>u.value.markerEnd?`url(#${ut(u.value.markerEnd,t)})`:"");return()=>{var g,k,S;if(!m.value||!o.value)return null;const B=o.value.handleId,A=o.value.type,O=m.value.handleBounds;let U=O==null?void 0:O[A];if(n.value===Oe.Loose&&(U=U||(O==null?void 0:O[A==="source"?"target":"source"])),!U)return null;const Z=(B?U.find(z=>z.id===B):U[0])??null,D=(Z==null?void 0:Z.position)||F.Top,{x,y:j}=En(D,{...m.value.dimensions,...m.value.computedPosition},Z);let H=null;b.value&&((g=i.value)!=null&&g.handleId)&&(n.value===Oe.Strict?H=((k=b.value.handleBounds[A==="source"?"target":"source"])==null?void 0:k.find(z=>{var M;return z.id===((M=i.value)==null?void 0:M.handleId)}))||null:H=((S=[...b.value.handleBounds.source||[],...b.value.handleBounds.target||[]])==null?void 0:S.find(z=>{var M;return z.id===((M=i.value)==null?void 0:M.handleId)}))||null);const v=D?Wu[D]:null;if(!D||!v)return null;const T=a.value??u.value.type??Ve.Bezier;let C="";const $={sourceX:x,sourceY:j,sourcePosition:D,targetX:_.value.x,targetY:_.value.y,targetPosition:v};return T===Ve.Bezier?[C]=kn($):T===Ve.Step?[C]=Mn({...$,borderRadius:0}):T===Ve.SmoothStep?[C]=Mn($):T===Ve.SimpleBezier?[C]=_i($):C=`M${x},${j} ${_.value.x},${_.value.y}`,l.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},l.h("g",{class:"vue-flow__connection"},p?l.h(p,{sourceX:x,sourceY:j,sourcePosition:D,targetX:_.value.x,targetY:_.value.y,targetPosition:v,sourceNode:m.value,sourceHandle:Z,targetNode:b.value,targetHandle:H,markerEnd:N.value,markerStart:E.value,connectionStatus:c.value}):l.h("path",{d:C,class:[u.value.class,c,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":N.value,"marker-start":E.value})))}}}),qu=["id","markerWidth","markerHeight","markerUnits","orient"],Ju={name:"MarkerType",compatConfig:{MODE:3}},ju=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(cn).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(cn).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,qu))}}),Qu={class:"vue-flow__marker vue-flow__container"},ec={name:"MarkerDefinitions",compatConfig:{MODE:3}},tc=l.defineComponent({...ec,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=l.computed(()=>{const a=new Set,s=[],u=c=>{if(c){const d=ut(c,t);a.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),a.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(a,s)=>(l.openBlock(),l.createElementBlock("svg",Qu,[l.createElementVNode("defs",null,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,u=>(l.openBlock(),l.createBlock(ju,{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))])]))}}),nc={name:"Edges",compatConfig:{MODE:3}},oc=l.defineComponent({...nc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(tc),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n),(a,s,u,c)=>{const d=[a.id];if(c&&c.key===a.id&&l.isMemoSame(c,d))return c;const h=(l.openBlock(),l.createElementBlock("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:l.normalizeStyle({zIndex:l.unref(Us)(a,l.unref(t),l.unref(o))})},[l.createVNode(l.unref(Zu),{id:a.id},null,8,["id"])],4));return h.memo=d,h},r,0),128)),l.createVNode(l.unref(Ku))],64))}}),ic=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:c,onUpdateNodeInternals:d,getNodeTypes:h,nodeExtent:p,elevateNodesOnSelect:m,disableKeyboardA11y:b,ariaLiveMessage:_,snapToGrid:E,snapGrid:N,nodeDragThreshold:g,nodesDraggable:k,elementsSelectable:S,nodesConnectable:B,nodesFocusable:A}=de(),O=l.ref(null);l.provide(Vo,O),l.provide(Do,e.id);const U=l.inject(Tt),Z=l.getCurrentInstance(),D=zo(),{node:x,parentNode:j}=Ao(e.id),H=l.toRef(()=>typeof x.draggable>"u"?k.value:x.draggable),v=l.toRef(()=>typeof x.selectable>"u"?S.value:x.selectable),T=l.toRef(()=>typeof x.connectable>"u"?B.value:x.connectable),C=l.toRef(()=>typeof x.focusable>"u"?A.value:x.focusable),$=l.toRef(()=>!!x.dimensions.width&&!!x.dimensions.height),z=l.computed(()=>{const f=x.type||"default",y=U==null?void 0:U[`node-${f}`];if(y)return y;let w=x.template||h.value[f];if(typeof w=="string"&&Z){const I=Object.keys(Z.appContext.components);I&&I.includes(f)&&(w=l.resolveComponent(f,!1))}return w&&typeof w!="string"?w:(a.error(new ge(he.NODE_TYPE_MISSING,w)),!1)}),{emit:M,on:P}=Ms(x,a),L=Po({id:e.id,el:O,disabled:()=>!H.value,selectable:v,dragHandle:()=>x.dragHandle,onStart(f){M.dragStart(f)},onDrag(f){M.drag(f)},onStop(f){M.dragStop(f)}}),K=l.computed(()=>x.class instanceof Function?x.class(x):x.class),re=l.computed(()=>{const f=(x.style instanceof Function?x.style(x):x.style)||{},y=x.width instanceof Function?x.width(x):x.width,w=x.height instanceof Function?x.height(x):x.height;return y&&(f.width=typeof y=="string"?y:`${y}px`),w&&(f.height=typeof w=="string"?w:`${w}px`),f}),te=l.toRef(()=>Number(x.zIndex??re.value.zIndex??0));return d(f=>{(f.includes(e.id)||!f.length)&&ue()}),l.onMounted(()=>{l.watch(()=>x.hidden,(f=!1,y,w)=>{!f&&O.value&&(e.resizeObserver.observe(O.value),w(()=>{O.value&&e.resizeObserver.unobserve(O.value)}))},{immediate:!0,flush:"pre"})}),l.watch([()=>x.type,()=>x.sourcePosition,()=>x.targetPosition],()=>{l.nextTick(()=>{c([{id:e.id,nodeElement:O.value,forceUpdate:!0}])})}),l.watch([()=>x.position.x,()=>x.position.y,()=>{var f;return(f=j.value)==null?void 0:f.computedPosition.x},()=>{var f;return(f=j.value)==null?void 0:f.computedPosition.y},()=>{var f;return(f=j.value)==null?void 0:f.computedPosition.z},te,()=>x.selected,()=>x.dimensions.height,()=>x.dimensions.width,()=>{var f;return(f=j.value)==null?void 0:f.dimensions.height},()=>{var f;return(f=j.value)==null?void 0:f.dimensions.width}],([f,y,w,I,V,G])=>{const X={x:f,y,z:G+(m.value&&x.selected?1e3:0)};typeof w<"u"&&typeof I<"u"?x.computedPosition=Rs({x:w,y:I,z:V},X):x.computedPosition=X},{flush:"post",immediate:!0}),l.watch([()=>x.extent,p],([f,y],[w,I])=>{(f!==w||y!==I)&&oe()}),x.extent==="parent"||typeof x.extent=="object"&&"range"in x.extent&&x.extent.range==="parent"?dt(()=>$).toBe(!0).then(oe):oe(),()=>x.hidden?null:l.h("div",{ref:O,"data-id":x.id,class:["vue-flow__node",`vue-flow__node-${z.value===!1?"default":x.type||"default"}`,{[n.value]:H.value,dragging:L==null?void 0:L.value,draggable:H.value,selected:x.selected,selectable:v.value,parent:x.isParent},K.value],style:{visibility:$.value?"visible":"hidden",zIndex:x.computedPosition.z??te.value,transform:`translate(${x.computedPosition.x}px,${x.computedPosition.y}px)`,pointerEvents:v.value||H.value?"all":"none",...re.value},tabIndex:C.value?0:void 0,role:C.value?"button":void 0,"aria-describedby":b.value?void 0:`${Io}-${t}`,"aria-label":x.ariaLabel,onMouseenter:le,onMousemove:q,onMouseleave:W,onContextmenu:J,onClick:ie,onDblclick:Q,onKeydown:Y},[l.h(z.value===!1?h.value.default:z.value,{id:x.id,type:x.type,data:x.data,events:{...x.events,...P},selected:x.selected,resizing:x.resizing,dragging:L.value,connectable:T.value,position:x.computedPosition,dimensions:x.dimensions,isValidTargetPos:x.isValidTargetPos,isValidSourcePos:x.isValidSourcePos,parent:x.parentNode,parentNodeId:x.parentNode,zIndex:x.computedPosition.z??te.value,targetPosition:x.targetPosition,sourcePosition:x.sourcePosition,label:x.label,dragHandle:x.dragHandle,onUpdateNodeInternals:ue})]);function oe(){const f=x.computedPosition;E.value&&(f.x=N.value[0]*Math.round(f.x/N.value[0]),f.y=N.value[1]*Math.round(f.y/N.value[1]));const{computedPosition:y,position:w}=bn(x,f,a.error,p.value,j.value);(x.computedPosition.x!==y.x||x.computedPosition.y!==y.y)&&(x.computedPosition={...x.computedPosition,...y}),(x.position.x!==w.x||x.position.y!==w.y)&&(x.position=w)}function ue(){O.value&&c([{id:e.id,nodeElement:O.value,forceUpdate:!0}])}function le(f){L!=null&&L.value||M.mouseEnter({event:f,node:x})}function q(f){L!=null&&L.value||M.mouseMove({event:f,node:x})}function W(f){L!=null&&L.value||M.mouseLeave({event:f,node:x})}function J(f){return M.contextMenu({event:f,node:x})}function Q(f){return M.doubleClick({event:f,node:x})}function ie(f){v.value&&(!o.value||!H.value||g.value>0)&&Cn(x,r.value,u,s,i,!1,O.value),M.click({event:f,node:x})}function Y(f){if(!(fn(f)||b.value))if(To.includes(f.key)&&v.value){const y=f.key==="Escape";Cn(x,r.value,u,s,i,y,O.value)}else H.value&&x.selected&&Ze[f.key]&&(_.value=`Moved selected node ${f.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~x.position.x}, y: ${~~x.position.y}`,D({x:Ze[f.key].x,y:Ze[f.key].y},f.shiftKey))}}}),rc={height:"0",width:"0"},lc={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},ac=l.defineComponent({...lc,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",rc,[(l.openBlock(),l.createBlock(l.Teleport,{to:n.value,disabled:!n.value},[l.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function sc(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 uc={class:"vue-flow__nodes vue-flow__container"},cc={name:"Nodes",compatConfig:{MODE:3}},dc=l.defineComponent({...cc,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=sc(),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",uc,[r.value?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(t),(u,c,d,h)=>{const p=[u.id];if(h&&h.key===u.id&&l.isMemoSame(h,p))return h;const m=(l.openBlock(),l.createBlock(l.unref(ic),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return m.memo=p,m},s,0),128)):l.createCommentVNode("",!0)]))}});function fc(){const{emits:e}=de();l.onMounted(()=>{if(ci()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new ge(he.MISSING_STYLES))}})}const hc=l.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),gc={name:"VueFlow",compatConfig:{MODE:3}},pc=l.defineComponent({...gc,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:{},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}},emits:["nodesChange","edgesChange","nodesInitialized","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneReady","init","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","updateNodeInternals","error","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdate","edgeUpdateEnd","nodeDoubleClick","nodeClick","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeContextMenu","nodeDragStart","nodeDrag","nodeDragStop","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=l.useSlots(),r=Yt(o,"modelValue",n),a=Yt(o,"nodes",n),s=Yt(o,"edges",n),u=de(o),c=Ts({modelValue:r,nodes:a,edges:s},o,u);return eu(n,u.hooks),Gu(),fc(),l.provide(Tt,i),l.onUnmounted(()=>{c()}),t(u),(d,h)=>(l.openBlock(),l.createElementBlock("div",{ref:l.unref(u).vueFlowRef,class:"vue-flow"},[l.createVNode(zu,null,{default:l.withCtx(()=>[l.createVNode(oc),hc,l.createVNode(dc),l.renderSlot(d.$slots,"zoom-pane")]),_:3}),l.renderSlot(d.$slots,"default"),l.createVNode(Yu)],512))}}),mc=["id","d","marker-end"],yc={class:"vue-flow__edge-label"},vc={key:0,class:"label-input-wrapper"},wc={inheritAttrs:!1},_c=l.defineComponent({...wc,__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 p=Date.now();p-s<500&&!a.value&&await c(),s=p},c=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},d=()=>{a.value=!1,o("change",r.value)},h=l.computed(()=>kn(n));return(p,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("path",{id:p.id,style:l.normalizeStyle(p.style),class:"vue-flow__edge-path",d:h.value[0],"marker-end":p.markerEnd},null,12,mc),l.createVNode(l.unref(ac),null,{default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${h.value[1]}px,${h.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:m[2]||(m[2]=b=>u())},[l.createElementVNode("div",yc,l.toDisplayString(p.label),1),a.value?(l.openBlock(),l.createElementBlock("div",vc,[l.withDirectives(l.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":m[0]||(m[0]=b=>r.value=b),onBlur:m[1]||(m[1]=b=>a.value=!1),onKeypress:l.withKeys(d,["enter"])},null,544),[[l.vModelText,r.value]])])):l.createCommentVNode("",!0)],4)]),_:1})],64))}}),bc={key:0,class:"label-input-wrapper"},Ec=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 h=Date.now();h-s<500&&!a.value&&await c(),s=h},c=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},d=()=>{a.value=!1,o("change",r.value)};return(h,p)=>(l.openBlock(),l.createElementBlock("div",{onClick:p[2]||(p[2]=m=>u())},[l.createElementVNode("div",null,l.toDisplayString(h.label),1),a.value?(l.openBlock(),l.createElementBlock("div",bc,[l.withDirectives(l.createElementVNode("input",{ref:"labelInput",class:"label-input","onUpdate:modelValue":p[0]||(p[0]=m=>r.value=m),onBlur:p[1]||(p[1]=m=>a.value=!1),onKeypress:l.withKeys(d,["enter"])},null,544),[[l.vModelText,r.value]])])):l.createCommentVNode("",!0),h.data.hasInput?(l.openBlock(),l.createBlock(l.unref(Ke),{key:1,id:"a",type:"target",position:h.targetPosition},null,8,["position"])):l.createCommentVNode("",!0),h.data.hasOutput?(l.openBlock(),l.createBlock(l.unref(Ke),{key:2,id:"b",type:"source",position:h.sourcePosition},null,8,["position"])):l.createCommentVNode("",!0)]))}}),xc={class:"chart-controls"},Sc={class:"chart-controls-left"},Nc={class:"chart-controls-right"},Cc={key:0},kc={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((g,k)=>{if(g.id===a.value)return k}),-1)),u=l.computed({get:()=>{const g=e.modelValue;for(const k of g)k.data={},k.type==="input"?(k.data.hasInput=!1,k.data.hasOutput=!0):k.type==="output"?(k.data.hasInput=!0,k.data.hasOutput=!1):(k.data.hasInput=!0,k.data.hasOutput=!0),k.class="vue-flow__node-default",k.type="editable";for(const k of g)k.events={click:()=>{a.value=k.id}};return g},set:g=>{n("update:modelValue",JSON.parse(JSON.stringify(g)))}});l.onMounted(()=>{document.removeEventListener("keypress",b),document.addEventListener("keypress",b)}),l.onBeforeUnmount(()=>{document.removeEventListener("keypress",b)});const{onPaneReady:c}=de();c(g=>{r.value=g}),i.value=u.value;const d=g=>({[F.Top]:F.Right,[F.Right]:F.Bottom,[F.Bottom]:F.Left,[F.Left]:F.Top})[g],h=()=>{if(s.value>-1){const g=i.value[s.value];g.sourcePosition=d(g.sourcePosition)}},p=()=>{if(s.value>-1){const g=i.value[s.value];g.targetPosition=d(g.targetPosition)}},m=g=>{window.scrollBy(0,g.deltaY)},b=g=>{o.value&&g.ctrlKey==!0&&((g.key=="+"||g.key=="=")&&r.value.zoomIn(),g.key=="-"&&r.value.zoomOut())},_=async()=>{await r.value.fitView()},E=()=>{let g=!1,k={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const A=i.value[s.value];A.data.hasOutput&&(k={x:A.position.x+200,y:A.position.y+50},g=!0)}const S=i.value.length,B=`node-${S}`;if(i.value.push({id:B,label:"Node "+S,sourcePosition:F.Right,targetPosition:F.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{a.value=B}},position:k}),g){let A=`edge-${S+1}`;i.value.push({id:A,source:a.value,target:B,type:"editable",label:`EDGE ${S+1}`,animated:!0,events:{click:()=>{a.value=A}}})}},N=(g,k)=>{for(let S=0;S<i.value.length;S++)if(i.value[S].id==k){i.value[S].label=g;break}};return(g,k)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["node-editor-wrapper",g.nodeContainerClass]),onMouseover:k[1]||(k[1]=S=>o.value=!0),onMouseleave:k[2]||(k[2]=S=>o.value=!1)},[l.createElementVNode("div",xc,[l.createElementVNode("div",Sc,[l.createElementVNode("div",null,[k[3]||(k[3]=l.createElementVNode("b",null,"Selected Node:",-1)),l.createTextVNode(" "+l.toDisplayString(a.value?a.value:"none"),1)])]),l.createElementVNode("div",Nc,[l.createElementVNode("div",null,[l.createElementVNode("button",{class:"button-default",onClick:E},"Add Node")]),l.createElementVNode("div",null,[l.createElementVNode("button",{class:"button-default",onClick:_},"Center")]),s.value>-1?(l.openBlock(),l.createElementBlock("div",Cc,[l.createElementVNode("button",{class:"button-default",onClick:p},"Shift Input Position")])):l.createCommentVNode("",!0),s.value>-1?(l.openBlock(),l.createElementBlock("div",kc,[l.createElementVNode("button",{class:"button-default",onClick:h},"Shift Output Position")])):l.createCommentVNode("",!0)])]),i.value&&i.value.length?(l.openBlock(),l.createBlock(l.unref(pc),{key:0,class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,modelValue:i.value,"onUpdate:modelValue":k[0]||(k[0]=S=>i.value=S),onWheel:l.withModifiers(m,["prevent"])},{"node-editable":l.withCtx(S=>[l.createVNode(Ec,l.mergeProps(S,{onChange:B=>N(B,S.id)}),null,16,["onChange"])]),"edge-editable":l.withCtx(S=>[l.createVNode(_c,l.mergeProps(S,{onChange:B=>N(B,S.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 d,h,p;const a={},s=[],u={};let c=0;for(const[m,b]of Object.entries(o.value)){const _={id:m,label:m,position:((d=e.layout[m])==null?void 0:d.position)||{x:200*c,y:100},targetPosition:((h=e.layout[m])==null?void 0:h.targetPosition)||F.Left,sourcePosition:((p=e.layout[m])==null?void 0:p.sourcePosition)||F.Right};if(b.type==="final"&&(_.type="output",_.class="default-output-node"),u[m]=_,b.on){for(const[E,N]of Object.entries(b.on))if(Array.isArray(N))for(const g of N){const S=g.toJSON().target.toString();s.push({id:`${m}-${E}`,target:S,source:m,label:E,animated:!0}),a[S]=!0}}c++}for(const[m,b]of Object.entries(u))a[m]||(b.type="input",b.class="default-input-node"),s.push(b);return s},set:a=>{r(a)}}),r=a=>{const s={},u={},c={};for(const d of a){const h=d.label;d.type==="input"?c[h]={on:{}}:d.type==="output"?c[h]={type:"final"}:c[h]={on:{}},u[d.id]=h}for(const[d,h]of Object.entries(s)){const p=u[d];for(const[m,b]of Object.entries(h))c[p].on[m]=b}n("update:modelValue",c)};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 Mc(e){e.component("NodeEditor",$n),e.component("StateEditor",Ci)}xe.NodeEditor=$n,xe.StateEditor=Ci,xe.install=Mc,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
|
|
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),c=t.elementsFromPoint(a,s).find(x=>x.classList.contains("vue-flow__handle"));if(c){const x=c.getAttribute("data-nodeid");if(x){const b=Sn(void 0,c),S=c.getAttribute("data-handleid"),C=r({nodeId:x,id:S,type:b});if(C){const N=i.find(m=>m.nodeId===x&&m.type===b&&m.id===S);return{handle:{id:S,type:b,nodeId:x,x:(N==null?void 0:N.x)||n.x,y:(N==null?void 0:N.y)||n.y},validHandleResult:C}}}}let d=[],f=Number.POSITIVE_INFINITY;for(const x of i){const b=Math.sqrt((x.x-n.x)**2+(x.y-n.y)**2);if(b<=o){const S=r(x);b<=f&&(b<f?d=[{handle:x,validHandleResult:S}]:b===f&&d.push({handle:x,validHandleResult:S}),f=b)}}if(!d.length)return{handle:null,validHandleResult:ti()};if(d.length===1)return d[0];const h=d.some(({validHandleResult:x})=>x.isValid),p=d.some(({handle:x})=>x.type==="target");return d.find(({handle:x,validHandleResult:b})=>p?x.type==="target":h?b.isValid:!0)||d[0]}function oi(e,t,n,o,i,r,a,s,u,c,d){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:x}=Be(e),b=s.elementFromPoint(p,x),S=b!=null&&b.classList.contains("vue-flow__handle")?b:h,C=ti();if(S){C.handleDomNode=S;const N=Sn(void 0,S),m=S.getAttribute("data-nodeid"),E=S.getAttribute("data-handleid"),D=S.classList.contains("connectable"),z=S.classList.contains("connectableend"),F={source:f?m:o,sourceHandle:f?E:i,target:f?o:m,targetHandle:f?i:E};C.connection=F,D&&z&&(n===Re.Strict?f&&N==="source"||!f&&N==="target":m!==o||E!==i)&&(C.isValid=a(F,{edges:u,nodes:c,sourceNode:d(F.source),targetNode:d(F.target)}),C.endHandle={nodeId:m,handleId:E,type:N,position:C.isValid?S.getAttribute("data-handlepos"):null})}return C}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=[],c=[];s&&(u=ni(a,s,"source",`${t}-${n}-${o}`),c=ni(a,s,"target",`${t}-${n}-${o}`)),i.push(...u,...c)}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,c={...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,c),c}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}`,c=`${r}-target-${s}`,d=e.get(u)||new Map,f=e.get(c)||new Map,h=l.markRaw({edgeId:o,source:i,target:r,sourceHandle:a,targetHandle:s});e.set(u,d.set(`${r}-${s}`,h)),e.set(c,f.set(`${i}-${a}`,h))}}function si(e,t,n,o,i,r,a,s){const u=[];for(const c of e){const d=Pe(c)?c:Hs(c,s,i,r);if(!d)continue;const f=n(d.source),h=n(d.target);if(!f||!h){i(new ge(fe.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!f){i(new ge(fe.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!h){i(new ge(fe.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:a,sourceNode:f,targetNode:h})){i(new ge(fe.EDGE_INVALID,d.id));continue}const p=o(d.id);u.push({...Vo(d,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:c,autoPanSpeed:d,nodesDraggable:f,panBy:h,findNode:p,multiSelectionActive:x,nodesSelectionActive:b,selectNodesOnDrag:S,removeSelectedElements:C,addSelectedNodes:N,updateNodePositions:m,emits:E}=de(),{onStart:D,onDrag:z,onStop:F,onClick:Y,el:W,disabled:$,id:O,selectable:k,dragHandle:Q}=e,_=l.ref(!1);let I=[],M,T=null,B={x:void 0,y:void 0},V={x:0,y:0},A=null,X=!1,j=0,G=!1;const R=Us(),q=({x:Z,y:J})=>{B={x:Z,y:J};let ne=!1;if(I=I.map(v=>{const g={x:Z-v.distance.x,y:J-v.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:y}=bn(v,g,E.error,a.value,v.parentNode?p(v.parentNode):void 0);return ne=ne||v.position.x!==y.x||v.position.y!==y.y,v.position=y,v}),!!ne&&(m(I,!0,!0),_.value=!0,A)){const[v,g]=_n({id:O,dragItems:I,findNode:p});z({event:A,node:v,nodes:g})}},le=()=>{if(!T)return;const[Z,J]=Uo(V,T,d.value);if(Z!==0||J!==0){const ne={x:(B.x??0)-Z/u.value.zoom,y:(B.y??0)-J/u.value.zoom};h({x:Z,y:J})&&q(ne)}j=requestAnimationFrame(le)},ie=(Z,J)=>{X=!0;const ne=p(O);!S.value&&!x.value&&ne&&(ne.selected||C()),ne&&l.toValue(k)&&S.value&&Nn(ne,x.value,N,C,b,!1,J);const v=R(Z);if(B=v,I=Is(r.value,f.value,v,p,O),I.length){const[g,y]=_n({id:O,dragItems:I,findNode:p});D({event:Z.sourceEvent,node:g,nodes:y})}},ae=(Z,J)=>{var ne;Z.sourceEvent.type==="touchmove"&&Z.sourceEvent.touches.length>1||(s.value===0&&ie(Z,J),B=R(Z),T=((ne=t.value)==null?void 0:ne.getBoundingClientRect())||null,V=Be(Z.sourceEvent,T))},te=(Z,J)=>{const ne=R(Z);if(!G&&X&&c.value&&(G=!0,le()),!X){const v=ne.xSnapped-(B.x??0),g=ne.ySnapped-(B.y??0);Math.sqrt(v*v+g*g)>s.value&&ie(Z,J)}(B.x!==ne.xSnapped||B.y!==ne.ySnapped)&&I.length&&X&&(A=Z.sourceEvent,V=Be(Z.sourceEvent,T),q(ne))},oe=Z=>{if(!X&&!_.value&&!x.value){const J=R(Z),ne=J.xSnapped-(B.x??0),v=J.ySnapped-(B.y??0),g=Math.sqrt(ne*ne+v*v);g!==0&&g<=s.value&&(Y==null||Y(Z.sourceEvent));return}if(_.value=!1,G=!1,X=!1,B={x:void 0,y:void 0},cancelAnimationFrame(j),I.length){m(I,!1,!1);const[J,ne]=_n({id:O,dragItems:I,findNode:p});F({event:Z.sourceEvent,node:J,nodes:ne})}};return l.watch([()=>l.toValue($),W],([Z,J],ne,v)=>{if(J){const g=ye(J);Z||(M=Cl().on("start",y=>ae(y,J)).on("drag",y=>te(y,J)).on("end",y=>oe(y)).filter(y=>{const w=y.target,P=l.toValue(Q);return!y.button&&(!i.value||!Jo(w,`.${i.value}`,J)&&(!P||Jo(w,P,J)))}),g.call(M)),v(()=>{g.on(".drag",null),M&&(M.on("start",null),M.on("drag",null),M.on("end",null))})}}),_}function Gs(){return{doubleClick:H(),click:H(),mouseEnter:H(),mouseMove:H(),mouseLeave:H(),contextMenu:H(),updateStart:H(),update:H(),updateEnd:H()}}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:c,connectOnClick:d,connectionClickStartHandle:f,nodesConnectable:h,autoPanOnConnect:p,autoPanSpeed:x,findNode:b,panBy:S,startConnection:C,updateConnection:N,endConnection:m,emits:E,viewport:D,edges:z,nodes:F,isValidConnection:Y}=de();let W=null,$=!1,O=null,k=null;function Q(I){var M;const T=l.toValue(n)==="target",B=En(I),V=Do(I.target);if(B&&I.button===0||!B){let A=function(y){J=Be(y,oe);const{handle:w,validHandleResult:P}=Os(y,V,Vt(J,D.value,!1,[1,1]),c.value,v,U=>oi(y,U,u.value,l.toValue(t),l.toValue(e),T?"target":"source",G,V,z.value,F.value,b));if(R=w,ne||(g(),ne=!0),W=P.connection,$=P.isValid,O=P.handleDomNode,!($&&R&&(k!=null&&k.endHandle)&&P.endHandle&&k.endHandle.type===P.endHandle.type&&k.endHandle.nodeId===P.endHandle.nodeId&&k.endHandle.handleId===P.endHandle.handleId)){if(N(R&&$?zo({x:R.x,y:R.y},D.value):J,P.endHandle,zs(!!R,$)),k=P,!R&&!$&&!O)return xn(Z);W&&W.source!==W.target&&O&&(xn(Z),Z=O,O.classList.add("connecting","vue-flow__handle-connecting"),O.classList.toggle("valid",$),O.classList.toggle("vue-flow__handle-valid",$))}},X=function(y){(R||O)&&W&&$&&(r?r(y,W):E.connect(W)),E.connectEnd(y),i&&(a==null||a(y)),xn(Z),cancelAnimationFrame(q),m(y),ne=!1,$=!1,W=null,O=null,V.removeEventListener("mousemove",A),V.removeEventListener("mouseup",X),V.removeEventListener("touchmove",A),V.removeEventListener("touchend",X)};const j=b(l.toValue(t));let G=l.toValue(o)||Y.value||Ht;!G&&j&&(G=(T?j.isValidSourcePos:j.isValidTargetPos)||Ht);let R,q=0;const{x:le,y:ie}=Be(I),ae=V==null?void 0:V.elementFromPoint(le,ie),te=Sn(l.toValue(i),ae),oe=(M=s.value)==null?void 0:M.getBoundingClientRect();if(!oe||!te)return;let Z,J=Be(I,oe),ne=!1;const v=As({nodes:F.value,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:te}),g=()=>{if(!p.value)return;const[y,w]=Uo(J,oe,x.value);S({x:y,y:w}),q=requestAnimationFrame(g)};C({nodeId:l.toValue(t),handleId:l.toValue(e),type:te,position:(ae==null?void 0:ae.getAttribute("data-handlepos"))||L.Top},{x:le-oe.left,y:ie-oe.top}),E.connectStart({event:I,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:te}),V.addEventListener("mousemove",A),V.addEventListener("mouseup",X),V.addEventListener("touchmove",A),V.addEventListener("touchend",X)}}function _(I){if(!d.value)return;const M=l.toValue(n)==="target";if(!f.value)E.clickConnectStart({event:I,nodeId:l.toValue(t),handleId:l.toValue(e)}),C({nodeId:l.toValue(t),type:l.toValue(n),handleId:l.toValue(e)},void 0,!0);else{let T=l.toValue(o)||Y.value||Ht;const B=b(l.toValue(t));if(!T&&B&&(T=(M?B.isValidSourcePos:B.isValidTargetPos)||Ht),B&&(typeof B.connectable>"u"?h.value:B.connectable)===!1)return;const V=Do(I.target),{connection:A,isValid:X}=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,T,V,z.value,F.value,b),j=A.source===A.target;X&&!j&&E.connect(A),E.clickConnectEnd(I),m(I,!0)}}return{handlePointerDown:Q,handleClick:_}}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:H(),click:H(),mouseEnter:H(),mouseMove:H(),mouseLeave:H(),contextMenu:H(),dragStart:H(),drag:H(),dragStop:H()}}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,c=!1)=>{const d=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=c?4:1,p=u.x*d*h,x=u.y*f*h,b=[];for(const S of e.value)if(S.draggable||a&&typeof S.draggable>"u"){const C={x:S.computedPosition.x+p,y:S.computedPosition.y+x},{computedPosition:N}=bn(S,C,s.error,t.value,S.parentNode?o(S.parentNode):void 0);b.push({id:S.id,position:N,from:S.position,distance:{x:u.x,y:u.y},dimensions:S.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:c}=Bo({x:-o,y:-i},e.translateExtent),d=Ke.translate(-u,-c).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(kn(e.d3Selection,a,()=>{s(!0)}),d):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:c,y:d,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(c,d,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,c=e.dimensions.height/2-r*s;return n(u,c,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,S,C=!!(n.nodes.value.length||n.edges.value.length);b=Ye([e.modelValue,()=>{var N,m;return(m=(N=e.modelValue)==null?void 0:N.value)==null?void 0:m.length}],([N])=>{N&&Array.isArray(N)&&(S==null||S.pause(),n.setElements(N),!S&&!C&&N.length?C=!0:S==null||S.resume())}),S=Ye([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([N,m])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(b==null||b.pause(),e.modelValue.value=[...N,...m],l.nextTick(()=>{b==null||b.resume()}))},{immediate:C}),l.onScopeDispose(()=>{b==null||b.stop(),S==null||S.stop()})})},r=()=>{o.run(()=>{let b,S,C=!!n.nodes.value.length;b=Ye([e.nodes,()=>{var N,m;return(m=(N=e.nodes)==null?void 0:N.value)==null?void 0:m.length}],([N])=>{N&&Array.isArray(N)&&(S==null||S.pause(),n.setNodes(N),!S&&!C&&N.length?C=!0:S==null||S.resume())}),S=Ye([n.nodes,()=>n.nodes.value.length],([N])=>{var m;(m=e.nodes)!=null&&m.value&&Array.isArray(e.nodes.value)&&(b==null||b.pause(),e.nodes.value=[...N],l.nextTick(()=>{b==null||b.resume()}))},{immediate:C}),l.onScopeDispose(()=>{b==null||b.stop(),S==null||S.stop()})})},a=()=>{o.run(()=>{let b,S,C=!!n.edges.value.length;b=Ye([e.edges,()=>{var N,m;return(m=(N=e.edges)==null?void 0:N.value)==null?void 0:m.length}],([N])=>{N&&Array.isArray(N)&&(S==null||S.pause(),n.setEdges(N),!S&&!C&&N.length?C=!0:S==null||S.resume())}),S=Ye([n.edges,()=>n.edges.value.length],([N])=>{var m;(m=e.edges)!=null&&m.value&&Array.isArray(e.edges.value)&&(b==null||b.pause(),e.edges.value=[...N],l.nextTick(()=>{b==null||b.resume()}))},{immediate:C}),l.onScopeDispose(()=>{b==null||b.stop(),S==null||S.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})})},c=()=>{o.run(()=>{l.watch(()=>t.translateExtent,()=>{t.translateExtent&&he(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{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 S=>{let C=S;typeof t.autoConnect=="function"&&(C=await t.autoConnect(S)),C!==!1&&n.addEdges([C])};l.watch(()=>t.autoConnect,()=>{he(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),l.watch(n.autoConnect,(S,C,N)=>{S?n.onConnect(b):n.hooks.value.connect.off(b),N(()=>{n.hooks.value.connect.off(b)})},{immediate:!0})})},p=()=>{const b=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const S of Object.keys(t)){const C=S;if(!b.includes(C)){const N=l.toRef(()=>t[C]),m=n[C];l.isRef(m)&&o.run(()=>{l.watch(N,E=>{he(E)&&(m.value=E)},{immediate:!0})})}}};(()=>{i(),r(),a(),u(),s(),c(),d(),f(),h(),p()})()}),()=>o.stop()}function Qs(){return{edgesChange:H(),nodesChange:H(),nodeDoubleClick:H(),nodeClick:H(),nodeMouseEnter:H(),nodeMouseMove:H(),nodeMouseLeave:H(),nodeContextMenu:H(),nodeDragStart:H(),nodeDrag:H(),nodeDragStop:H(),nodesInitialized:H(),miniMapNodeClick:H(),miniMapNodeDoubleClick:H(),miniMapNodeMouseEnter:H(),miniMapNodeMouseMove:H(),miniMapNodeMouseLeave:H(),connect:H(),connectStart:H(),connectEnd:H(),clickConnectStart:H(),clickConnectEnd:H(),paneReady:H(),init:H(),move:H(),moveStart:H(),moveEnd:H(),selectionDragStart:H(),selectionDrag:H(),selectionDragStop:H(),selectionContextMenu:H(),selectionStart:H(),selectionEnd:H(),viewportChangeStart:H(),viewportChange:H(),viewportChangeEnd:H(),paneScroll:H(),paneClick:H(),paneContextMenu:H(),paneMouseEnter:H(),paneMouseMove:H(),paneMouseLeave:H(),edgeContextMenu:H(),edgeMouseEnter:H(),edgeMouseMove:H(),edgeMouseLeave:H(),edgeDoubleClick:H(),edgeClick:H(),edgeUpdateStart:H(),edgeUpdate:H(),edgeUpdateEnd:H(),updateNodeInternals:H(),error:H(e=>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=v=>{const g=v??[];e.hooks.updateNodeInternals.trigger(g)},r=v=>Ss(v,e.nodes,e.edges),a=v=>xs(v,e.nodes,e.edges),s=v=>Fo(v,e.edges),u=({id:v,type:g,nodeId:y})=>{var w;return Array.from(((w=e.connectionLookup.get(`${y}-${g}-${v??null}`))==null?void 0:w.values())??[])},c=v=>{if(v)return t.value.get(v)},d=v=>{if(v)return n.value.get(v)},f=(v,g,y)=>{var w,P;const U=[];for(const K of v){const ee={id:K.id,type:"position",dragging:y,from:K.from};if(g&&(ee.position=K.position,K.parentNode)){const re=c(K.parentNode);ee.position={x:ee.position.x-(((w=re==null?void 0:re.computedPosition)==null?void 0:w.x)??0),y:ee.position.y-(((P=re==null?void 0:re.computedPosition)==null?void 0:P.y)??0)}}U.push(ee)}U!=null&&U.length&&e.hooks.nodesChange.trigger(U)},h=v=>{if(!e.vueFlowRef)return;const g=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!g)return;const y=window.getComputedStyle(g),{m22:w}=new window.DOMMatrixReadOnly(y.transform),P=[];for(let U=0;U<v.length;++U){const K=v[U],ee=c(K.id);if(ee){const re=Bt(K.nodeElement);if(!!(re.width&&re.height&&(ee.dimensions.width!==re.width||ee.dimensions.height!==re.height||K.forceUpdate))){const ue=K.nodeElement.getBoundingClientRect();ee.dimensions=re,ee.handleBounds.source=ri(".source",K.nodeElement,ue,w),ee.handleBounds.target=ri(".target",K.nodeElement,ue,w),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=(v,g)=>{const y=new Set,w=new Set;for(const K of v)Le(K)?y.add(K.id):Pe(K)&&w.add(K.id);const P=$e(t.value,y,!0),U=$e(n.value,w);if(e.multiSelectionActive){for(const K of y)P.push(Te(K,g));for(const K of w)U.push(Te(K,g))}P.length&&e.hooks.nodesChange.trigger(P),U.length&&e.hooks.edgesChange.trigger(U)},x=v=>{if(e.multiSelectionActive){const g=v.map(y=>Te(y.id,!0));e.hooks.nodesChange.trigger(g);return}e.hooks.nodesChange.trigger($e(t.value,new Set(v.map(g=>g.id)),!0)),e.hooks.edgesChange.trigger($e(n.value))},b=v=>{if(e.multiSelectionActive){const g=v.map(y=>Te(y.id,!0));e.hooks.edgesChange.trigger(g);return}e.hooks.edgesChange.trigger($e(n.value,new Set(v.map(g=>g.id)))),e.hooks.nodesChange.trigger($e(t.value,new Set,!0))},S=v=>{p(v,!0)},C=v=>{const y=(v||e.nodes).map(w=>(w.selected=!1,Te(w.id,!1)));e.hooks.nodesChange.trigger(y)},N=v=>{const y=(v||e.edges).map(w=>(w.selected=!1,Te(w.id,!1)));e.hooks.edgesChange.trigger(y)},m=v=>{if(!v||!v.length)return p([],!1);const g=v.reduce((y,w)=>{const P=Te(w.id,!1);return Le(w)?y.nodes.push(P):y.edges.push(P),y},{nodes:[],edges:[]});g.nodes.length&&e.hooks.nodesChange.trigger(g.nodes),g.edges.length&&e.hooks.edgesChange.trigger(g.edges)},E=v=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([v,e.maxZoom]),e.minZoom=v},D=v=>{var g;(g=e.d3Zoom)==null||g.scaleExtent([e.minZoom,v]),e.maxZoom=v},z=v=>{var g;(g=e.d3Zoom)==null||g.translateExtent(v),e.translateExtent=v},F=v=>{e.nodeExtent=v,i()},Y=v=>{var g;(g=e.d3Zoom)==null||g.clickDistance(v)},W=v=>{e.nodesDraggable=v,e.nodesConnectable=v,e.elementsSelectable=v},$=v=>{const g=v instanceof Function?v(e.nodes):v;!e.initialized&&!g.length||(e.nodes=li(g,c,e.hooks.error.trigger))},O=v=>{const g=v instanceof Function?v(e.edges):v;if(!e.initialized&&!g.length)return;const y=si(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);ai(e.connectionLookup,y),e.edges=y},k=v=>{const g=v instanceof Function?v([...e.nodes,...e.edges]):v;!e.initialized&&!g.length||($(g.filter(Le)),O(g.filter(Pe)))},Q=v=>{let g=v instanceof Function?v(e.nodes):v;g=Array.isArray(g)?g:[g];const y=li(g,c,e.hooks.error.trigger),w=[];for(const P of y)w.push(Ko(P));w.length&&e.hooks.nodesChange.trigger(w)},_=v=>{let g=v instanceof Function?v(e.edges):v;g=Array.isArray(g)?g:[g];const y=si(g,e.isValidConnection,c,d,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),w=[];for(const P of y)w.push(Ko(P));w.length&&e.hooks.edgesChange.trigger(w)},I=(v,g=!0,y=!1)=>{const w=v instanceof Function?v(e.nodes):v,P=Array.isArray(w)?w:[w],U=[],K=[];function ee(se){const ue=s(se);for(const ce of ue)(!he(ce.deletable)||ce.deletable)&&K.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)U.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"?c(se):se;ue&&(he(ue.deletable)&&!ue.deletable||(U.push(Wo(ue.id)),g&&ee([ue]),y&&re(ue.id)))}K.length&&e.hooks.edgesChange.trigger(K),U.length&&e.hooks.nodesChange.trigger(U)},M=v=>{const g=v instanceof Function?v(e.edges):v,y=Array.isArray(g)?g:[g],w=[];for(const P of y){const U=typeof P=="string"?d(P):P;U&&(he(U.deletable)&&!U.deletable||w.push(qo(typeof P=="string"?P:P.id,U.source,U.target,U.sourceHandle,U.targetHandle)))}e.hooks.edgesChange.trigger(w)},T=(v,g,y=!0)=>Ls(v,g,e.edges,d,y,e.hooks.error.trigger),B=(v,g,y={replace:!1})=>{const w=d(v);if(!w)return;const P=typeof g=="function"?g(w):g;w.data=y.replace?P:{...w.data,...P}},V=v=>Zo(v,e.nodes),A=v=>{const g=Zo(v,e.edges);return ai(e.connectionLookup,g),g},X=(v,g,y={replace:!1})=>{const w=c(v);if(!w)return;const P=typeof g=="function"?g(w):g;y.replace?e.nodes.splice(e.nodes.indexOf(w),1,P):Object.assign(w,P)},j=(v,g,y={replace:!1})=>{const w=c(v);if(!w)return;const P=typeof g=="function"?g(w):g;w.data=y.replace?P:{...w.data,...P}},G=(v,g,y=!1)=>{y?e.connectionClickStartHandle=v:e.connectionStartHandle=v,e.connectionEndHandle=null,e.connectionStatus=null,g&&(e.connectionPosition=g)},R=(v,g=null,y=null)=>{e.connectionStartHandle&&(e.connectionPosition=v,e.connectionEndHandle=g,e.connectionStatus=y)},q=(v,g)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,g?e.connectionClickStartHandle=null:e.connectionStartHandle=null},le=v=>{const g=bs(v),y=g?null:ct(v)?v:c(v.id);return!g&&!y?[null,null,g]:[g?v:yn(y),y,g]},ie=(v,g=!0,y=e.nodes)=>{const[w,P,U]=le(v);if(!w)return[];const K=[];for(const ee of y||e.nodes){if(!U&&(ee.id===P.id||!ee.computedPosition))continue;const re=yn(ee),se=vn(re,w);(g&&se>0||se>=Number(w.width)*Number(w.height))&&K.push(ee)}return K},ae=(v,g,y=!0)=>{const[w]=le(v);if(!w)return!1;const P=vn(w,g);return y&&P>0||P>=Number(w.width)*Number(w.height)},te=v=>{const{viewport:g,dimensions:y,d3Zoom:w,d3Selection:P,translateExtent:U}=e;if(!w||!P||!v.x&&!v.y)return!1;const K=Ke.translate(g.x+v.x,g.y+v.y).scale(g.zoom),ee=[[0,0],[y.width,y.height]],re=w.constrain()(K,ee,U),se=e.viewport.x!==re.x||e.viewport.y!==re.y||e.viewport.zoom!==re.k;return w.transform(P,re),se},oe=v=>{const g=v instanceof Function?v(e):v,y=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];he(g.defaultEdgeOptions)&&(e.defaultEdgeOptions=g.defaultEdgeOptions);const w=g.modelValue||g.nodes||g.edges?[]:void 0;w&&(g.modelValue&&w.push(...g.modelValue),g.nodes&&w.push(...g.nodes),g.edges&&w.push(...g.edges),k(w));const P=()=>{he(g.maxZoom)&&D(g.maxZoom),he(g.minZoom)&&E(g.minZoom),he(g.translateExtent)&&z(g.translateExtent)};for(const U of Object.keys(g)){const K=U,ee=g[K];![...tu,...y].includes(K)&&he(ee)&&(e[K]=ee)}Zt(()=>e.d3Zoom).not.toBeNull().then(P),e.initialized||(e.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:k,setNodes:$,setEdges:O,addNodes:Q,addEdges:_,removeNodes:I,removeEdges:M,findNode:c,findEdge:d,updateEdge:T,updateEdgeData:B,updateNode:X,updateNodeData:j,applyEdgeChanges:A,applyNodeChanges:V,addSelectedElements:S,addSelectedNodes:x,addSelectedEdges:b,setMinZoom:E,setMaxZoom:D,setTranslateExtent:z,setNodeExtent:F,setPaneClickDistance:Y,removeSelectedElements:m,removeSelectedNodes:C,removeSelectedEdges:N,startConnection:G,updateConnection:R,endConnection:q,setInteractive:W,setState:oe,getIntersectingNodes:ie,getIncomers:r,getOutgoers:a,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:ae,panBy:te,fitView:v=>o.value.fitView(v),zoomIn:v=>o.value.zoomIn(v),zoomOut:v=>o.value.zoomOut(v),zoomTo:(v,g)=>o.value.zoomTo(v,g),setViewport:(v,g)=>o.value.setViewport(v,g),setTransform:(v,g)=>o.value.setTransform(v,g),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(v,g,y)=>o.value.setCenter(v,g,y),fitBounds:(v,g)=>o.value.fitBounds(v,g),project:v=>o.value.project(v),screenToFlowCoordinate:v=>o.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>o.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],g=[];for(const y of e.nodes){const{computedPosition:w,handleBounds:P,selected:U,dimensions:K,isParent:ee,resizing:re,dragging:se,events:ue,...ce}=y;v.push(ce)}for(const y of e.edges){const{selected:w,sourceNode:P,targetNode:U,events:K,...ee}=y;g.push(ee)}return JSON.parse(JSON.stringify({nodes:v,edges:g,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:v=>new Promise(g=>{const{nodes:y,edges:w,position:P,zoom:U,viewport:K}=v;if(y&&$(y),w&&O(w),K!=null&&K.x&&(K!=null&&K.y)||P){const ee=(K==null?void 0:K.x)||P[0],re=(K==null?void 0:K.y)||P[1],se=(K==null?void 0:K.zoom)||U||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 v=mi();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const g=Ke.translate(v.defaultViewport.x??0,v.defaultViewport.y??0).scale(He(v.defaultViewport.zoom??1,v.minZoom,v.maxZoom)),y=e.viewportRef.getBoundingClientRect(),w=[[0,0],[y.width,y.height]],P=e.d3Zoom.constrain()(g,w,v.translateExtent);e.d3Zoom.transform(e.d3Selection,P)}oe(v)},$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:()=>L.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:c,noDragClassName:d,noPanClassName:f}=de(),{id:h,node:p,nodeEl:x,connectedEdges:b}=gi(),S=l.ref(),C=l.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),N=l.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),m=l.toRef(()=>{var $,O,k,Q,_,I;return(($=r.value)==null?void 0:$.nodeId)===h&&((O=r.value)==null?void 0:O.handleId)===e.id&&((k=r.value)==null?void 0:k.type)===o.value||((Q=s.value)==null?void 0:Q.nodeId)===h&&((_=s.value)==null?void 0:_.handleId)===e.id&&((I=s.value)==null?void 0:I.type)===o.value}),E=l.toRef(()=>{var $,O,k;return(($=a.value)==null?void 0:$.nodeId)===h&&((O=a.value)==null?void 0:O.handleId)===e.id&&((k=a.value)==null?void 0:k.type)===o.value}),{handlePointerDown:D,handleClick:z}=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:c.value);l.onMounted(()=>{var $;if(!p.dimensions.width||!p.dimensions.height)return;const O=($=p.handleBounds[o.value])==null?void 0:$.find(B=>B.id===e.id);if(!u.value||O)return;const k=u.value.querySelector(".vue-flow__transformationpane");if(!x.value||!S.value||!k||!e.id)return;const Q=x.value.getBoundingClientRect(),_=S.value.getBoundingClientRect(),I=window.getComputedStyle(k),{m22:M}=new window.DOMMatrixReadOnly(I.transform),T={id:e.id,position:e.position,x:(_.left-Q.left)/M,y:(_.top-Q.top)/M,...Bt(S.value)};p.handleBounds[o.value]=[...p.handleBounds[o.value]??[],T]}),l.onUnmounted(()=>{const $=p.handleBounds[o.value];$&&(p.handleBounds[o.value]=$.filter(O=>O.id!==e.id))});function Y($){const O=En($);F.value&&C.value&&(O&&$.button===0||!O)&&D($)}function W($){!h||!a.value&&!C.value||F.value&&z($)}return t({handleClick:z,handlePointerDown:D,onClick:W,onPointerDown:Y}),($,O)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"handle",ref:S,"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(d),l.unref(f),o.value,{connectable:F.value,connecting:E.value,connectablestart:C.value,connectableend:N.value,connectionindicator:F.value&&(C.value&&!m.value||N.value&&m.value)}]]),onMousedown:Y,onTouchstartPassive:Y,onClick:W},[l.renderSlot($.$slots,"default",{id:$.id})],42,ou))}}),Lt=function({sourcePosition:e=L.Bottom,targetPosition:t=L.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=L.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=L.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,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 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 L.Left:a=t-Xt(t-o,r),s=n;break;case L.Right:a=t+Xt(o-t,r),s=n;break;case L.Top:a=t,s=n-Xt(n-i,r);break;case L.Bottom:a=t,s=n+Xt(i-n,r);break}return[a,s]}function Mn(e){const{sourceX:t,sourceY:n,sourcePosition:o=L.Bottom,targetX:i,targetY:r,targetPosition:a=L.Top,curvature:s=.25}=e,[u,c]=wi({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,f]=wi({pos:a,x1:i,y1:r,x2:t,y2:n,c:s}),[h,p,x,b]=vi({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}`,h,p,x,b]}function _i({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,a;switch(e){case L.Left:case L.Right:r=.5*(t+o),a=n;break;case L.Top:case L.Bottom:r=t,a=.5*(n+i);break}return[r,a]}function bi(e){const{sourceX:t,sourceY:n,sourcePosition:o=L.Bottom,targetX:i,targetY:r,targetPosition:a=L.Top}=e,[s,u]=_i({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=_i({pos:a,x1:i,y1:r,x2:t,y2:n}),[f,h,p,x]=vi({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,h,p,x]}const Ei={[L.Left]:{x:-1,y:0},[L.Right]:{x:1,y:0},[L.Top]:{x:0,y:-1},[L.Bottom]:{x:0,y:1}};function mu({source:e,sourcePosition:t=L.Bottom,target:n}){return t===L.Left||t===L.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=L.Bottom,target:n,targetPosition:o=L.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},c={x:n.x+s.x*r,y:n.y+s.y*r},d=mu({source:u,sourcePosition:t,target:c}),f=d.x!==0?"x":"y",h=d[f];let p,x,b;const S={x:0,y:0},C={x:0,y:0},[N,m,E,D]=yi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*s[f]===-1){x=i.x??N,b=i.y??m;const F=[{x,y:u.y},{x,y:c.y}],Y=[{x:u.x,y:b},{x:c.x,y:b}];a[f]===h?p=f==="x"?F:Y:p=f==="x"?Y:F}else{const F=[{x:u.x,y:c.y}],Y=[{x:c.x,y:u.y}];if(f==="x"?p=a.x===h?Y:F:p=a.y===h?F:Y,t===o){const Q=Math.abs(e[f]-n[f]);if(Q<=r){const _=Math.min(r-1,r-Q);a[f]===h?S[f]=(u[f]>e[f]?-1:1)*_:C[f]=(c[f]>n[f]?-1:1)*_}}if(t!==o){const Q=f==="x"?"y":"x",_=a[f]===s[Q],I=u[Q]>c[Q],M=u[Q]<c[Q];(a[f]===1&&(!_&&I||_&&M)||a[f]!==1&&(!_&&M||_&&I))&&(p=f==="x"?F:Y)}const W={x:u.x+S.x,y:u.y+S.y},$={x:c.x+C.x,y:c.y+C.y},O=Math.max(Math.abs(W.x-p[0].x),Math.abs($.x-p[0].x)),k=Math.max(Math.abs(W.y-p[0].y),Math.abs($.y-p[0].y));O>=k?(x=(W.x+$.x)/2,b=p[0].y):(x=p[0].x,b=(W.y+$.y)/2)}return[[e,{x:u.x+S.x,y:u.y+S.y},...p,{x:c.x+C.x,y:c.y+C.y},n],x,b,E,D]}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 c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${a}Q ${r},${a} ${r},${a+i*d}`}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=L.Bottom,targetX:i,targetY:r,targetPosition:a=L.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[f,h,p,x,b]=yu({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:a,center:{x:u,y:c},offset:d});return[f.reduce((C,N,m)=>{let E;return m>0&&m<f.length-1?E=vu(f[m-1],N,f[m+1],s):E=`${m===0?"M":"L"}${N.x} ${N.y}`,C+=E,C},""),h,p,x,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??L.Bottom,targetPosition:e.targetPosition??L.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??L.Bottom,targetPosition:e.targetPosition??L.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??L.Bottom,targetPosition:e.targetPosition??L.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},S=Object.keys(b);for(const C of e.edges)C.type&&!S.includes(C.type)&&(b[C.type]=C.type);return b}),a=l.computed(()=>{const b={...Su,...e.nodeTypes},S=Object.keys(b);for(const C of e.nodes)C.type&&!S.includes(C.type)&&(b[C.type]=C.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 S of e.edges){const C=t.value.get(S.source),N=t.value.get(S.target);Bs({sourcePos:C.computedPosition||{x:0,y:0},targetPos:N.computedPosition||{x:0,y:0},sourceWidth:C.dimensions.width,sourceHeight:C.dimensions.height,targetWidth:N.dimensions.width,targetHeight:N.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&b.push(S)}return b}return e.edges}),c=l.computed(()=>[...s.value,...u.value]),d=l.computed(()=>{const b=[];for(const S of e.nodes)S.selected&&b.push(S);return b}),f=l.computed(()=>{const b=[];for(const S of e.edges)S.selected&&b.push(S);return b}),h=l.computed(()=>[...d.value,...f.value]),p=l.computed(()=>{const b=[];for(const S of e.nodes)S.dimensions.width&&S.dimensions.height&&S.handleBounds!==void 0&&b.push(S);return b}),x=l.computed(()=>s.value.length>0&&p.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:s,getSelectedElements:h,getSelectedNodes:d,getSelectedEdges:f,getNodesInitialized:p,areNodesInitialized:x}}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 x=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[x]=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}),c=Cu(i,s,u),d=nu(i,s,u);d.setState({...i,...n});const f={...r,...c,...d,...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(),c=t.create(u,i);s=c,(n??l.effectScope(!0)).run(()=>{l.watch(c.applyDefault,(f,h,p)=>{const x=S=>{c.applyNodeChanges(S)},b=S=>{c.applyEdgeChanges(S)};f?(c.onNodesChange(x),c.onEdgesChange(b)):(c.hooks.value.nodesChange.off(x),c.hooks.value.edgesChange.off(b)),p(()=>{c.hooks.value.nodesChange.off(x),c.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"],Tu={name:"NodesSelection",compatConfig:{MODE:3}},$u=l.defineComponent({...Tu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:a}=de(),s=pi(),u=l.ref(null),c=fi({el:u,onStart(x){t.selectionDragStart(x)},onDrag(x){t.selectionDrag(x)},onStop(x){t.selectionDragStop(x)}});l.onMounted(()=>{var x;r.value||(x=u.value)==null||x.focus({preventScroll:!0})});const d=l.computed(()=>Ho(o.value)),f=l.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function h(x){t.selectionContextMenu({event:x,nodes:o.value})}function p(x){r||We[x.key]&&s({x:We[x.key].x,y:We[x.key].y},x.shiftKey)}return(x,b)=>!l.unref(a)&&d.value.width&&d.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(c)},"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:c,nodesSelectionActive:d,getSelectedEdges:f,getSelectedNodes:h,removeNodes:p,removeEdges:x,selectionMode:b,deleteKeyCode:S,multiSelectionKeyCode:C,multiSelectionActive:N,edgeLookup:m,nodeLookup:E}=de(),D=l.ref(null),z=l.ref(0),F=l.ref(0),Y=l.ref(),W=l.ref(new Map),$=l.toRef(()=>c.value&&(e.isSelecting||r.value));let O=!1,k=!1;const Q=ut(S,{actInsideInputWithModifier:!1}),_=ut(C);l.watch(Q,G=>{G&&(p(h.value),x(f.value),d.value=!1)}),l.watch(_,G=>{N.value=G});function I(G,R){return q=>{q.target===R&&(G==null||G(q))}}function M(){r.value=!1,u.value=null,z.value=0,F.value=0}function T(G){if(O){O=!1;return}i.paneClick(G),a(),d.value=!1}function B(G){var R;if(Array.isArray(s.value)&&((R=s.value)!=null&&R.includes(2))){G.preventDefault();return}i.paneContextMenu(G)}function V(G){i.paneScroll(G)}function A(G){var R,q,le,ie,ae;if(Y.value=(R=t.value)==null?void 0:R.getBoundingClientRect(),!c.value||!e.isSelecting||G.button!==0||G.target!==D.value||!Y.value)return;(le=(q=G.target)==null?void 0:q.setPointerCapture)==null||le.call(q,G.pointerId);const{x:te,y:oe}=Bu(G,Y.value);k=!0,O=!1,W.value=new Map;for(const[Z,J]of m.value)W.value.set(J.source,((ie=W.value.get(J.source))==null?void 0:ie.add(Z))||new Set([Z])),W.value.set(J.target,((ae=W.value.get(J.target))==null?void 0:ae.add(Z))||new Set([Z]));a(),u.value={width:0,height:0,startX:te,startY:oe,x:te,y:oe},i.selectionStart(G)}function X(G){if(!Y.value||!u.value)return;O=!0;const{x:R,y:q}=Be(G,Y.value),{startX:le=0,startY:ie=0}=u.value,ae={startX:le,startY:ie,x:R<le?R:le,y:q<ie?q:ie,width:Math.abs(R-le),height:Math.abs(q-ie)},te=Lo(n.value,ae,o.value,b.value===gn.Partial,!0),oe=new Set,Z=new Set;for(const J of te){Z.add(J.id);const ne=W.value.get(J.id);if(ne)for(const v of ne)oe.add(v)}if(z.value!==Z.size){z.value=Z.size;const J=$e(E.value,Z,!0);i.nodesChange(J)}if(F.value!==oe.size){F.value=oe.size;const J=$e(m.value,oe);i.edgesChange(J)}u.value=ae,r.value=!0,d.value=!1}function j(G){var R;G.button!==0||!k||((R=G.target)==null||R.releasePointerCapture(G.pointerId),!r.value&&u.value&&G.target===D.value&&T(G),z.value>0&&(d.value=!0),M(),i.selectionEnd(G),e.selectionKeyPressed&&(O=!1),k=!1)}return(G,R)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"container",ref:D,class:l.normalizeClass(["vue-flow__pane vue-flow__container",{selection:G.isSelecting}]),onClick:R[0]||(R[0]=q=>$.value?void 0:I(T,D.value)(q)),onContextmenu:R[1]||(R[1]=q=>I(B,D.value)(q)),onWheelPassive:R[2]||(R[2]=q=>I(V,D.value)(q)),onPointerenter:R[3]||(R[3]=q=>$.value?void 0:l.unref(i).paneMouseEnter(q)),onPointerdown:R[4]||(R[4]=q=>$.value?A(q):l.unref(i).paneMouseMove(q)),onPointermove:R[5]||(R[5]=q=>$.value?X(q):l.unref(i).paneMouseMove(q)),onPointerup:R[6]||(R[6]=q=>$.value?j(q):void 0),onPointerleave:R[7]||(R[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(d)&&l.unref(h).length?(l.openBlock(),l.createBlock($u,{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:c,panOnScrollSpeed:d,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:p,zoomOnScroll:x,preventScrolling:b,noWheelClassName:S,noPanClassName:C,emits:N,connectionStartHandle:m,userSelectionActive:E,paneDragging:D,d3Zoom:z,d3Selection:F,d3ZoomHandler:Y,viewport:W,viewportRef:$,paneClickDistance:O}=de();ku($);const k=l.ref(!1),Q=l.ref(!1);let _=null,I=!1,M=0,T={x:0,y:0,zoom:0};const B=ut(s),V=ut(a),A=ut(r),X=l.toRef(()=>!V.value&&(B.value||f.value)),j=l.toRef(()=>B.value||u.value),G=l.toRef(()=>V.value||a.value===!0&&X.value!==!0);l.onMounted(()=>{if(!$.value){zt("Viewport element is missing");return}const te=$.value,oe=te.getBoundingClientRect(),Z=ms().clickDistance(O.value).scaleExtent([t.value,n.value]).translateExtent(i.value),J=ye(te).call(Z),ne=J.on("wheel.zoom"),v=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]],y=Z.constrain()(v,g,i.value);Z.transform(J,y),Z.wheelDelta(q),z.value=Z,F.value=J,Y.value=ne,W.value={x:y.x,y:y.y,zoom:y.k},Z.on("start",w=>{var P;if(!w.sourceEvent)return null;M=w.sourceEvent.button,k.value=!0;const U=ie(w.transform);((P=w.sourceEvent)==null?void 0:P.type)==="mousedown"&&(D.value=!0),T=U,N.viewportChangeStart(U),N.moveStart({event:w,flowTransform:U})}),Z.on("end",w=>{if(!w.sourceEvent)return null;if(k.value=!1,D.value=!1,R(X.value,M??0)&&!I&&N.paneContextMenu(w.sourceEvent),I=!1,le(T,w.transform)){const P=ie(w.transform);T=P,N.viewportChangeEnd(P),N.moveEnd({event:w,flowTransform:P})}}),Z.filter(w=>{var P,U,K;const ee=A.value||x.value,re=p.value&&w.ctrlKey,se=w.button;if((X.value===!0||Array.isArray(X.value)&&X.value.includes(1))&&se===1&&w.type==="mousedown"&&((P=w.target)!=null&&P.closest(".vue-flow__node")||(U=w.target)!=null&&U.closest(".vue-flow__edge")))return!0;if(!X.value&&!ee&&!j.value&&!h.value&&!p.value||E.value||!h.value&&w.type==="dblclick"||ae(w,S.value)&&w.type==="wheel"||ae(w,C.value)&&(w.type!=="wheel"||j.value&&w.type==="wheel"&&!A.value)||!p.value&&w.ctrlKey&&w.type==="wheel"||!ee&&!j.value&&!re&&w.type==="wheel")return!1;if(!p&&w.type==="touchstart"&&((K=w.touches)==null?void 0:K.length)>1)return w.preventDefault(),!1;if(!X.value&&(w.type==="mousedown"||w.type==="touchstart")||Array.isArray(X.value)&&!X.value.includes(se)&&(w.type==="mousedown"||w.type==="touchstart"))return!1;const ue=Array.isArray(X.value)&&X.value.includes(se)||!se||se<=1;return(!w.ctrlKey||w.type==="wheel")&&ue}),l.watch([E,X],()=>{E.value&&!k.value?Z.on("zoom",null):E.value||Z.on("zoom",w=>{W.value={x:w.transform.x,y:w.transform.y,zoom:w.transform.k};const P=ie(w.transform);I=R(X.value,M??0),N.viewportChange(P),N.move({event:w,flowTransform:P})})},{immediate:!0}),l.watch([E,j,c,A,p,b,S],()=>{j.value&&!A.value&&!E.value?J.on("wheel.zoom",w=>{if(ae(w,S.value))return!1;const P=A.value||x.value,U=p.value&&w.ctrlKey;if(!(!b.value||j.value||P||U))return!1;w.preventDefault(),w.stopImmediatePropagation();const ee=J.property("__zoom").k||1,re=At();if(w.ctrlKey&&p.value&&re){const ft=_e(w),Pc=q(w),Tc=ee*2**Pc;Z.scaleTo(J,Tc,ft,w);return}const se=w.deltaMode===1?20:1;let ue=c.value===st.Vertical?0:w.deltaX*se,ce=c.value===st.Horizontal?0:w.deltaY*se;!re&&w.shiftKey&&c.value!==st.Vertical&&!ue&&ce&&(ue=ce,ce=0),Z.translateBy(J,-(ue/ee)*d.value,-(ce/ee)*d.value);const xe=ie(J.property("__zoom"));_&&clearTimeout(_),Q.value?(N.move({event:w,flowTransform:xe}),N.viewportChange(xe),_=setTimeout(()=>{N.moveEnd({event:w,flowTransform:xe}),N.viewportChangeEnd(xe),Q.value=!1},150)):(Q.value=!0,N.moveStart({event:w,flowTransform:xe}),N.viewportChangeStart(xe))},{passive:!1}):typeof ne<"u"&&J.on("wheel.zoom",function(w,P){const U=!b.value&&w.type==="wheel"&&!w.ctrlKey,K=A.value||x.value,ee=p.value&&w.ctrlKey;if(!K&&!u.value&&!ee&&w.type==="wheel"||U||ae(w,S.value))return null;w.preventDefault(),ne.call(this,w,P)},{passive:!1})},{immediate:!0})});function R(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(V),class:l.normalizeClass({connecting:!!l.unref(m),dragging:l.unref(D),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(To)}-${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===L.Left?e-t:n===L.Right?e+t:e}function Zu(e,t,n){return n===L.Top?e-t:n===L.Bottom?e+t:e}const Pn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=L.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:c,findEdge:d,findNode:f,isValidConnection:h,multiSelectionActive:p,disableKeyboardA11y:x,elementsSelectable:b,edgesUpdatable:S,edgesFocusable:C,hooks:N}=de(),m=l.computed(()=>d(e.id)),{emit:E,on:D}=Xs(m.value,r),z=l.inject(Rt),F=l.getCurrentInstance(),Y=l.ref(!1),W=l.ref(!1),$=l.ref(""),O=l.ref(null),k=l.ref("source"),Q=l.ref(null),_=l.toRef(()=>typeof m.value.selectable>"u"?b.value:m.value.selectable),I=l.toRef(()=>typeof m.value.updatable>"u"?S.value:m.value.updatable),M=l.toRef(()=>typeof m.value.focusable>"u"?C.value:m.value.focusable);l.provide(Fs,e.id),l.provide(Ys,Q);const T=l.computed(()=>m.value.class instanceof Function?m.value.class(m.value):m.value.class),B=l.computed(()=>m.value.style instanceof Function?m.value.style(m.value):m.value.style),V=l.computed(()=>{const g=m.value.type||"default",y=z==null?void 0:z[`edge-${g}`];if(y)return y;let w=m.value.template??u.value[g];if(typeof w=="string"&&F){const P=Object.keys(F.appContext.components);P&&P.includes(g)&&(w=l.resolveComponent(g,!1))}return w&&typeof w!="string"?w:(r.error(new ge(fe.EDGE_TYPE_MISSING,w)),!1)}),{handlePointerDown:A}=hi({nodeId:$,handleId:O,type:k,isValidConnection:h,edgeUpdaterType:k,onEdgeUpdate:G,onEdgeUpdateEnd:R});return()=>{const g=f(m.value.source),y=f(m.value.target),w="pathOptions"in m.value?m.value.pathOptions:{};if(!g&&!y)return r.error(new ge(fe.EDGE_SOURCE_TARGET_MISSING,m.value.id,m.value.source,m.value.target)),null;if(!g)return r.error(new ge(fe.EDGE_SOURCE_MISSING,m.value.id,m.value.source)),null;if(!y)return r.error(new ge(fe.EDGE_TARGET_MISSING,m.value.id,m.value.target)),null;if(!m.value||m.value.hidden||g.hidden||y.hidden)return null;let P;o.value===Re.Strict?P=g.handleBounds.source:P=[...g.handleBounds.source||[],...g.handleBounds.target||[]];const U=Qo(P,m.value.sourceHandle);let K;o.value===Re.Strict?K=y.handleBounds.target:K=[...y.handleBounds.target||[],...y.handleBounds.source||[]];const ee=Qo(K,m.value.targetHandle),re=(U==null?void 0:U.position)||L.Bottom,se=(ee==null?void 0:ee.position)||L.Top,{x:ue,y:ce}=Ot(g,U,re),{x:xe,y:ft}=Ot(y,ee,se);return m.value.sourceX=ue,m.value.sourceY=ce,m.value.targetX=xe,m.value.targetY=ft,l.h("g",{ref:Q,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${V.value===!1?"default":m.value.type||"default"}`,s.value,T.value,{updating:Y.value,selected:m.value.selected,animated:m.value.animated,inactive:!_.value&&!N.value.edgeClick.hasListeners()}],onClick:le,onContextmenu:ie,onDblclick:ae,onMouseenter:te,onMousemove:oe,onMouseleave:Z,onKeyDown:M.value?v:void 0,tabIndex:M.value?0:void 0,"aria-label":m.value.ariaLabel===null?void 0:m.value.ariaLabel||`Edge from ${m.value.source} to ${m.value.target}`,"aria-describedby":M.value?`${To}-${t}`:void 0,role:M.value?"button":"img"},[W.value?null:l.h(V.value===!1?u.value.default:V.value,{id:e.id,sourceNode:g,targetNode:y,source:m.value.source,target:m.value.target,type:m.value.type,updatable:I.value,selected:m.value.selected,animated:m.value.animated,label:m.value.label,labelStyle:m.value.labelStyle,labelShowBg:m.value.labelShowBg,labelBgStyle:m.value.labelBgStyle,labelBgPadding:m.value.labelBgPadding,labelBgBorderRadius:m.value.labelBgBorderRadius,data:m.value.data,events:{...m.value.events,...D},style:B.value,markerStart:`url('#${dt(m.value.markerStart,t)}')`,markerEnd:`url('#${dt(m.value.markerEnd,t)}')`,sourcePosition:re,targetPosition:se,sourceX:ue,sourceY:ce,targetX:xe,targetY:ft,sourceHandleId:m.value.sourceHandle,targetHandleId:m.value.targetHandle,interactionWidth:m.value.interactionWidth,...w}),[I.value==="source"||I.value===!0?[l.h("g",{onMousedown:J,onMouseenter:X,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:X,onMouseout:j},l.h(Ni,{position:se,centerX:xe,centerY:ft,radius:i.value,type:"target","data-type":"target"}))]:null]])};function X(){Y.value=!0}function j(){Y.value=!1}function G(g,y){E.update({event:g,edge:m.value,connection:y})}function R(g){E.updateEnd({event:g,edge:m.value}),W.value=!1}function q(g,y){g.button===0&&(W.value=!0,$.value=y?m.value.target:m.value.source,O.value=(y?m.value.targetHandle:m.value.sourceHandle)??"",k.value=y?"target":"source",E.updateStart({event:g,edge:m.value}),A(g))}function le(g){var y;const w={event:g,edge:m.value};_.value&&(a.value=!1,m.value.selected&&p.value?(c([m.value]),(y=Q.value)==null||y.blur()):n([m.value])),E.click(w)}function ie(g){E.contextMenu({event:g,edge:m.value})}function ae(g){E.doubleClick({event:g,edge:m.value})}function te(g){E.mouseEnter({event:g,edge:m.value})}function oe(g){E.mouseMove({event:g,edge:m.value})}function Z(g){E.mouseLeave({event:g,edge:m.value})}function J(g){q(g,!0)}function ne(g){q(g,!1)}function v(g){var y;!x.value&&$o.includes(g.key)&&_.value&&(g.key==="Escape"?((y=Q.value)==null||y.blur(),c([d(e.id)])):n([d(e.id)]))}}}),Wu={[L.Left]:L.Right,[L.Right]:L.Left,[L.Top]:L.Bottom,[L.Bottom]:L.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:c,viewport:d,findNode:f}=de(),h=(e=l.inject(Rt))==null?void 0:e["connection-line"],p=l.computed(()=>{var N;return f((N=o.value)==null?void 0:N.nodeId)}),x=l.computed(()=>{var N;return f((N=i.value)==null?void 0:N.nodeId)??null}),b=l.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),S=l.computed(()=>u.value.markerStart?`url(#${dt(u.value.markerStart,t)})`:""),C=l.computed(()=>u.value.markerEnd?`url(#${dt(u.value.markerEnd,t)})`:"");return()=>{var N,m,E,D;if(!p.value||!o.value)return null;const z=o.value.handleId,F=o.value.type,Y=p.value.handleBounds;let W=Y==null?void 0:Y[F];if(n.value===Re.Loose&&(W=W||(Y==null?void 0:Y[F==="source"?"target":"source"])),!W)return null;const $=(z?W.find(V=>V.id===z):W[0])??null,O=($==null?void 0:$.position)||L.Top,{x:k,y:Q}=Ot(p.value,$,O);let _=null;x.value&&((N=i.value)!=null&&N.handleId)&&(n.value===Re.Strict?_=((m=x.value.handleBounds[F==="source"?"target":"source"])==null?void 0:m.find(V=>{var A;return V.id===((A=i.value)==null?void 0:A.handleId)}))||null:_=((E=[...x.value.handleBounds.source||[],...x.value.handleBounds.target||[]])==null?void 0:E.find(V=>{var A;return V.id===((A=i.value)==null?void 0:A.handleId)}))||null);const I=((D=i.value)==null?void 0:D.position)??(O?Wu[O]:null);if(!O||!I)return null;const M=a.value??u.value.type??ze.Bezier;let T="";const B={sourceX:k,sourceY:Q,sourcePosition:O,targetX:b.value.x,targetY:b.value.y,targetPosition:I};return M===ze.Bezier?[T]=Mn(B):M===ze.Step?[T]=In({...B,borderRadius:0}):M===ze.SmoothStep?[T]=In(B):M===ze.SimpleBezier?[T]=bi(B):T=`M${k},${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:k,sourceY:Q,sourcePosition:O,targetX:b.value.x,targetY:b.value.y,targetPosition:I,sourceNode:p.value,sourceHandle:$,targetNode:x.value,targetHandle:_,markerEnd:C.value,markerStart:S.value,connectionStatus:c.value}):l.h("path",{d:T,class:[u.value.class,c,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":C.value,"marker-start":S.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=c=>{if(c){const d=dt(c,t);a.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),a.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(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:c,onUpdateNodeInternals:d,getNodeTypes:f,nodeExtent:h,elevateNodesOnSelect:p,disableKeyboardA11y:x,ariaLiveMessage:b,snapToGrid:S,snapGrid:C,nodeDragThreshold:N,nodesDraggable:m,elementsSelectable:E,nodesConnectable:D,nodesFocusable:z,hooks:F}=de(),Y=l.ref(null);l.provide(di,Y),l.provide(ci,e.id);const W=l.inject(Rt),$=l.getCurrentInstance(),O=pi(),{node:k,parentNode:Q}=gi(e.id),{emit:_,on:I}=Ws(k,a),M=l.toRef(()=>typeof k.draggable>"u"?m.value:k.draggable),T=l.toRef(()=>typeof k.selectable>"u"?E.value:k.selectable),B=l.toRef(()=>typeof k.connectable>"u"?D.value:k.connectable),V=l.toRef(()=>typeof k.focusable>"u"?z.value:k.focusable),A=l.toRef(()=>T.value||M.value||F.value.nodeClick.hasListeners()||F.value.nodeDoubleClick.hasListeners()||F.value.nodeMouseEnter.hasListeners()||F.value.nodeMouseMove.hasListeners()||F.value.nodeMouseLeave.hasListeners()),X=l.toRef(()=>!!k.dimensions.width&&!!k.dimensions.height),j=l.computed(()=>{const y=k.type||"default",w=W==null?void 0:W[`node-${y}`];if(w)return w;let P=k.template||f.value[y];if(typeof P=="string"&&$){const U=Object.keys($.appContext.components);U&&U.includes(y)&&(P=l.resolveComponent(y,!1))}return P&&typeof P!="string"?P:(a.error(new ge(fe.NODE_TYPE_MISSING,P)),!1)}),G=fi({id:e.id,el:Y,disabled:()=>!M.value,selectable:T,dragHandle:()=>k.dragHandle,onStart(y){_.dragStart(y)},onDrag(y){_.drag(y)},onStop(y){_.dragStop(y)},onClick(y){v(y)}}),R=l.computed(()=>k.class instanceof Function?k.class(k):k.class),q=l.computed(()=>{const y=(k.style instanceof Function?k.style(k):k.style)||{},w=k.width instanceof Function?k.width(k):k.width,P=k.height instanceof Function?k.height(k):k.height;return!y.width&&w&&(y.width=typeof w=="string"?w:`${w}px`),!y.height&&P&&(y.height=typeof P=="string"?P:`${P}px`),y}),le=l.toRef(()=>Number(k.zIndex??q.value.zIndex??0));return d(y=>{(y.includes(e.id)||!y.length)&&ae()}),l.onMounted(()=>{l.watch(()=>k.hidden,(y=!1,w,P)=>{!y&&Y.value&&(e.resizeObserver.observe(Y.value),P(()=>{Y.value&&e.resizeObserver.unobserve(Y.value)}))},{immediate:!0,flush:"post"})}),l.watch([()=>k.type,()=>k.sourcePosition,()=>k.targetPosition],()=>{l.nextTick(()=>{c([{id:e.id,nodeElement:Y.value,forceUpdate:!0}])})}),l.watch([()=>k.position.x,()=>k.position.y,()=>{var y;return(y=Q.value)==null?void 0:y.computedPosition.x},()=>{var y;return(y=Q.value)==null?void 0:y.computedPosition.y},()=>{var y;return(y=Q.value)==null?void 0:y.computedPosition.z},le,()=>k.selected,()=>k.dimensions.height,()=>k.dimensions.width,()=>{var y;return(y=Q.value)==null?void 0:y.dimensions.height},()=>{var y;return(y=Q.value)==null?void 0:y.dimensions.width}],([y,w,P,U,K,ee])=>{const re={x:y,y:w,z:ee+(p.value&&k.selected?1e3:0)};typeof P<"u"&&typeof U<"u"?k.computedPosition=Ms({x:P,y:U,z:K},re):k.computedPosition=re},{flush:"post",immediate:!0}),l.watch([()=>k.extent,h],([y,w],[P,U])=>{(y!==P||w!==U)&&ie()}),k.extent==="parent"||typeof k.extent=="object"&&"range"in k.extent&&k.extent.range==="parent"?Zt(()=>X).toBe(!0).then(ie):ie(),()=>k.hidden?null:l.h("div",{ref:Y,"data-id":k.id,class:["vue-flow__node",`vue-flow__node-${j.value===!1?"default":k.type||"default"}`,{[n.value]:M.value,dragging:G==null?void 0:G.value,draggable:M.value,selected:k.selected,selectable:T.value,parent:k.isParent},R.value],style:{visibility:X.value?"visible":"hidden",zIndex:k.computedPosition.z??le.value,transform:`translate(${k.computedPosition.x}px,${k.computedPosition.y}px)`,pointerEvents:A.value?"all":"none",...q.value},tabIndex:V.value?0:void 0,role:V.value?"button":void 0,"aria-describedby":x.value?void 0:`${Po}-${t}`,"aria-label":k.ariaLabel,onMouseenter:te,onMousemove:oe,onMouseleave:Z,onContextmenu:J,onClick:v,onDblclick:ne,onKeydown:g},[l.h(j.value===!1?f.value.default:j.value,{id:k.id,type:k.type,data:k.data,events:{...k.events,...I},selected:k.selected,resizing:k.resizing,dragging:G.value,connectable:B.value,position:k.computedPosition,dimensions:k.dimensions,isValidTargetPos:k.isValidTargetPos,isValidSourcePos:k.isValidSourcePos,parent:k.parentNode,parentNodeId:k.parentNode,zIndex:k.computedPosition.z??le.value,targetPosition:k.targetPosition,sourcePosition:k.sourcePosition,label:k.label,dragHandle:k.dragHandle,onUpdateNodeInternals:ae})]);function ie(){const y=k.computedPosition;S.value&&(y.x=C.value[0]*Math.round(y.x/C.value[0]),y.y=C.value[1]*Math.round(y.y/C.value[1]));const{computedPosition:w,position:P}=bn(k,y,a.error,h.value,Q.value);(k.computedPosition.x!==w.x||k.computedPosition.y!==w.y)&&(k.computedPosition={...k.computedPosition,...w}),(k.position.x!==P.x||k.position.y!==P.y)&&(k.position=P)}function ae(){Y.value&&c([{id:e.id,nodeElement:Y.value,forceUpdate:!0}])}function te(y){G!=null&&G.value||_.mouseEnter({event:y,node:k})}function oe(y){G!=null&&G.value||_.mouseMove({event:y,node:k})}function Z(y){G!=null&&G.value||_.mouseLeave({event:y,node:k})}function J(y){return _.contextMenu({event:y,node:k})}function ne(y){return _.doubleClick({event:y,node:k})}function v(y){T.value&&(!o.value||!M.value||N.value>0)&&Nn(k,r.value,u,s,i,!1,Y.value),_.click({event:y,node:k})}function g(y){if(!(mn(y)||x.value))if($o.includes(y.key)&&T.value){const w=y.key==="Escape";Nn(k,r.value,u,s,i,w,Y.value)}else M.value&&k.selected&&We[y.key]&&(b.value=`Moved selected node ${y.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~k.position.x}, y: ${~~k.position.y}`,O({x:We[y.key].x,y:We[y.key].y},y.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,c,d,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),c=js({modelValue:r,nodes:a,edges:s},o,u);return eu(n,u.hooks),Xu(),hc(),l.provide(Rt,i),l.onUnmounted(()=>{c()}),t(u),(d,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(d.$slots,"zoom-pane")]),_:3}),l.renderSlot(d.$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 c(),s=h},c=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},d=()=>{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]=x=>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]=x=>r.value=x),onBlur:p[1]||(p[1]=x=>a.value=!1),onKeypress:l.withKeys(d,["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 c(),s=f},c=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},d=()=>{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(d,["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},Tn=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((N,m)=>{if(N.id===a.value)return m}),-1)),u=l.computed({get:()=>{const N=e.modelValue;for(const m of N)m.data={},m.type==="input"?(m.data.hasInput=!1,m.data.hasOutput=!0):m.type==="output"?(m.data.hasInput=!0,m.data.hasOutput=!1):(m.data.hasInput=!0,m.data.hasOutput=!0),m.class="vue-flow__node-default",m.type="editable";for(const m of N)m.events={click:()=>{a.value=m.id}};return N},set:N=>{n("update:modelValue",JSON.parse(JSON.stringify(N)))}});l.onMounted(()=>{document.removeEventListener("keypress",x),document.addEventListener("keypress",x)}),l.onBeforeUnmount(()=>{document.removeEventListener("keypress",x)});const{onPaneReady:c}=de();c(N=>{r.value=N}),i.value=u.value;const d=N=>({[L.Top]:L.Right,[L.Right]:L.Bottom,[L.Bottom]:L.Left,[L.Left]:L.Top})[N],f=()=>{if(s.value>-1){const N=i.value[s.value];N.sourcePosition=d(N.sourcePosition)}},h=()=>{if(s.value>-1){const N=i.value[s.value];N.targetPosition=d(N.targetPosition)}},p=N=>{window.scrollBy(0,N.deltaY)},x=N=>{o.value&&N.ctrlKey==!0&&((N.key=="+"||N.key=="=")&&r.value.zoomIn(),N.key=="-"&&r.value.zoomOut())},b=async()=>{await r.value.fitView()},S=()=>{let N=!1,m={x:Math.random()*200,y:Math.random()*200};if(s.value>-1){const z=i.value[s.value];z.data.hasOutput&&(m={x:z.position.x+200,y:z.position.y+50},N=!0)}const E=i.value.length,D=`node-${E}`;if(i.value.push({id:D,label:"Node "+E,sourcePosition:L.Right,targetPosition:L.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{a.value=D}},position:m}),N){let z=`edge-${E+1}`;i.value.push({id:z,source:a.value,target:D,type:"editable",label:`EDGE ${E+1}`,animated:!0,events:{click:()=>{a.value=z}}})}},C=(N,m)=>{for(let E=0;E<i.value.length;E++)if(i.value[E].id==m){i.value[E].label=N;break}};return(N,m)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["node-editor-wrapper",N.nodeContainerClass]),onMouseover:m[1]||(m[1]=E=>o.value=!0),onMouseleave:m[2]||(m[2]=E=>o.value=!1)},[l.createElementVNode("div",Sc,[l.createElementVNode("div",Nc,[l.createElementVNode("div",null,[m[3]||(m[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:S},"Add Node")]),l.createElementVNode("div",null,[l.createElementVNode("button",{class:"button-default",onClick:b},"Center")]),s.value>-1?(l.openBlock(),l.createElementBlock("div",kc,[l.createElementVNode("button",{class:"button-default",onClick:h},"Shift Input Position")])):l.createCommentVNode("",!0),s.value>-1?(l.openBlock(),l.createElementBlock("div",Mc,[l.createElementVNode("button",{class:"button-default",onClick:f},"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":m[0]||(m[0]=E=>i.value=E),onWheel:l.withModifiers(p,["prevent"])},{"node-editable":l.withCtx(E=>[l.createVNode(xc,l.mergeProps(E,{onChange:D=>C(D,E.id)}),null,16,["onChange"])]),"edge-editable":l.withCtx(E=>[l.createVNode(bc,l.mergeProps(E,{onChange:D=>C(D,E.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 d,f,h;const a={},s=[],u={};let c=0;for(const[p,x]of Object.entries(o.value)){const b={id:p,label:p,position:((d=e.layout[p])==null?void 0:d.position)||{x:200*c,y:100},targetPosition:((f=e.layout[p])==null?void 0:f.targetPosition)||L.Left,sourcePosition:((h=e.layout[p])==null?void 0:h.sourcePosition)||L.Right};if(x.type==="final"&&(b.type="output",b.class="default-output-node"),u[p]=b,x.on){for(const[S,C]of Object.entries(x.on))if(Array.isArray(C))for(const N of C){const E=N.toJSON().target.toString();s.push({id:`${p}-${S}`,target:E,source:p,label:S,animated:!0}),a[E]=!0}}c++}for(const[p,x]of Object.entries(u))a[p]||(x.type="input",x.class="default-input-node"),s.push(x);return s},set:a=>{r(a)}}),r=a=>{const s={},u={},c={};for(const d of a){const f=d.label;d.type==="input"?c[f]={on:{}}:d.type==="output"?c[f]={type:"final"}:c[f]={on:{}},u[d.id]=f}for(const[d,f]of Object.entries(s)){const h=u[d];for(const[p,x]of Object.entries(f))c[h].on[p]=x}n("update:modelValue",c)};return(a,s)=>(l.openBlock(),l.createElementBlock("div",null,[l.createVNode(Tn,{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",Tn),e.component("StateEditor",Ci)}Se.NodeEditor=Tn,Se.StateEditor=Ci,Se.install=Ic,Object.defineProperty(Se,Symbol.toStringTag,{value:"Module"})});
|
|
22
22
|
//# sourceMappingURL=node-editor.umd.cjs.map
|