var wr=Object.defineProperty,br=Object.defineProperties;var xr=Object.getOwnPropertyDescriptors;var Vt=Object.getOwnPropertySymbols;var ho=Object.prototype.hasOwnProperty,go=Object.prototype.propertyIsEnumerable;var ut=Math.pow,fo=(e,t,n)=>t in e?wr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))ho.call(t,n)&&fo(e,n,t[n]);if(Vt)for(var n of Vt(t))go.call(t,n)&&fo(e,n,t[n]);return e},re=(e,t)=>br(e,xr(t));var We=(e,t)=>{var n={};for(var o in e)ho.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Vt)for(var o of Vt(e))t.indexOf(o)<0&&go.call(e,o)&&(n[o]=e[o]);return n};var vo=(e,t,n)=>new Promise((o,i)=>{var r=s=>{try{a(n.next(s))}catch(u){i(u)}},l=s=>{try{a(n.throw(s))}catch(u){i(u)}},a=s=>s.done?o(s.value):Promise.resolve(s.value).then(r,l);a((n=n.apply(e,t)).next())});import{fU as si,n as he,Z as un,r as Er,p as ce,aX as bt,aV as pt,Q as ue,d8 as ui,d9 as Wt,aF as Kn,b1 as Sr,fV as Nr,d as we,fW as ci,R as Ne,a as ge,o as di,f as se,k as pe,S as Ge,u as ne,v as nt,fm as Mr,g as mt,s as Oe,j as Te,b as ot,F as it,T as Cr,d1 as Ir,i as He,w as kn,y as Pe,a0 as $r,m as st,W as Tr,h as kr,t as Dn,a5 as Dr,l as qn,z as Jn,dc as ft,N as ve,e as fi,fX as Pr}from"./index-C7bB6t7w.js";function cn(e){return ui()?(Wt(e),!0):!1}function Ve(e){return typeof e=="function"?e():ne(e)}const Ar=typeof window!="undefined"&&typeof document!="undefined",Or=e=>typeof e!="undefined",zr=Object.prototype.toString,Br=e=>zr.call(e)==="[object Object]",Rr=()=>{};function Vr(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 hi=e=>e();function Hr(e=hi){const t=ge(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:Pr(t),pause:n,resume:o,eventFilter:i}}function po(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Lr(e,t,n={}){const r=n,{eventFilter:o=hi}=r,i=We(r,["eventFilter"]);return he(e,Vr(o,t),i)}function ct(e,t,n={}){const c=n,{eventFilter:o}=c,i=We(c,["eventFilter"]),{eventFilter:r,pause:l,resume:a,isActive:s}=Hr(o);return{stop:Lr(e,t,re(A({},i),{eventFilter:r})),pause:l,resume:a,isActive:s}}function Gr(e,t={}){if(!Kn(e))return Sr(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=Nr(()=>({get(){return e.value[o]},set(i){var r;if((r=Ve(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const a=[...e.value];a[o]=i,e.value=a}else{const a=re(A({},e.value),{[o]:i});Object.setPrototypeOf(a,Object.getPrototypeOf(e.value)),e.value=a}else e.value[o]=i}}));return n}function Pn(e,t=!1){function n(f,{flush:h="sync",deep:g=!1,timeout:w,throwOnTimeout:x}={}){let d=null;const _=[new Promise(N=>{d=he(e,E=>{f(E)!==t&&(d==null||d(),N(E))},{flush:h,deep:g,immediate:!0})})];return w!=null&&_.push(po(w,x).then(()=>Ve(e)).finally(()=>d==null?void 0:d())),Promise.race(_)}function o(f,h){if(!Kn(f))return n(E=>E===f,h);const{flush:g="sync",deep:w=!1,timeout:x,throwOnTimeout:d}=h!=null?h:{};let p=null;const N=[new Promise(E=>{p=he([e,f],([T,R])=>{t!==(T===R)&&(p==null||p(),E(T))},{flush:g,deep:w,immediate:!0})})];return x!=null&&N.push(po(x,d).then(()=>Ve(e)).finally(()=>(p==null||p(),Ve(e)))),Promise.race(N)}function i(f){return n(h=>!!h,f)}function r(f){return o(null,f)}function l(f){return o(void 0,f)}function a(f){return n(Number.isNaN,f)}function s(f,h){return n(g=>{const w=Array.from(g);return w.includes(f)||w.includes(Ve(f))},h)}function u(f){return c(1,f)}function c(f=1,h){let g=-1;return n(()=>(g+=1,g>=f),h)}return Array.isArray(Ve(e))?{toMatch:n,toContains:s,changed:u,changedTimes:c,get not(){return Pn(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:a,toBeUndefined:l,changed:u,changedTimes:c,get not(){return Pn(e,!t)}}}function jt(e){return Pn(e)}function Fr(e){var t;const n=Ve(e);return(t=n==null?void 0:n.$el)!=null?t:n}const gi=Ar?window:void 0;function vi(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=gi):[t,n,o,i]=e,!t)return Rr;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],l=()=>{r.forEach(c=>c()),r.length=0},a=(c,f,h,g)=>(c.addEventListener(f,h,g),()=>c.removeEventListener(f,h,g)),s=he(()=>[Fr(t),Ve(i)],([c,f])=>{if(l(),!c)return;const h=Br(f)?A({},f):f;r.push(...n.flatMap(g=>o.map(w=>a(c,g,w,h))))},{immediate:!0,flush:"post"}),u=()=>{s(),l()};return cn(u),u}function Yr(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function mo(...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=gi,eventName:r="keydown",passive:l=!1,dedupe:a=!1}=o,s=Yr(t);return vi(i,r,c=>{c.repeat&&Ve(a)||s(c)&&n(c)},l)}function Xr(e){return JSON.parse(JSON.stringify(e))}function Ct(e,t,n,o={}){var i,r,l;const{clone:a=!1,passive:s=!1,eventName:u,deep:c=!1,defaultValue:f,shouldEmit:h}=o,g=un(),w=n||(g==null?void 0:g.emit)||((i=g==null?void 0:g.$emit)==null?void 0:i.bind(g))||((l=(r=g==null?void 0:g.proxy)==null?void 0:r.$emit)==null?void 0:l.bind(g==null?void 0:g.proxy));let x=u;t||(t="modelValue"),x=x||`update:${t.toString()}`;const d=N=>a?typeof a=="function"?a(N):Xr(N):N,p=()=>Or(e[t])?d(e[t]):f,_=N=>{h?h(N)&&w(x,N):w(x,N)};if(s){const N=p(),E=ge(N);let T=!1;return he(()=>e[t],R=>{T||(T=!0,E.value=d(R),Pe(()=>T=!1))}),he(E,R=>{!T&&(R!==e[t]||c)&&_(R)},{deep:c}),E}else return ce({get(){return p()},set(N){_(N)}})}var Zr={value:()=>{}};function dn(){for(var e=0,t=arguments.length,n={},o;e=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}})}Kt.prototype=dn.prototype={constructor:Kt,on:function(e,t){var n=this._,o=Ur(e+"",n),i,r=-1,l=o.length;if(arguments.length<2){for(;++r0)for(var n=new Array(i),o=0,i,r;o=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),_o.hasOwnProperty(t)?{space:_o[t],local:e}:e}function Kr(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===An&&t.documentElement.namespaceURI===An?t.createElement(e):t.createElementNS(n,e)}}function qr(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function pi(e){var t=fn(e);return(t.local?qr:Kr)(t)}function Jr(){}function Qn(e){return e==null?Jr:function(){return this.querySelector(e)}}function Qr(e){typeof e!="function"&&(e=Qn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i=N&&(N=_+1);!(T=d[N])&&++N=0;)(l=o[i])&&(r&&l.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(l,r),r=l);return this}function El(e){e||(e=Sl);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;rt?1:e>=t?0:NaN}function Nl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ml(){return Array.from(this)}function Cl(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Rl:typeof t=="function"?Hl:Vl)(e,t,n==null?"":n)):yt(this.node(),e)}function yt(e,t){return e.style.getPropertyValue(t)||bi(e).getComputedStyle(e,null).getPropertyValue(t)}function Gl(e){return function(){delete this[e]}}function Fl(e,t){return function(){this[e]=t}}function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Xl(e,t){return arguments.length>1?this.each((t==null?Gl:typeof t=="function"?Yl:Fl)(e,t)):this.node()[e]}function xi(e){return e.trim().split(/^|\s+/)}function jn(e){return e.classList||new Ei(e)}function Ei(e){this._node=e,this._names=xi(e.getAttribute("class")||"")}Ei.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 Si(e,t){for(var n=jn(e),o=-1,i=t.length;++o=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function _a(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,r;n()=>e;function On(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:l,y:a,dx:s,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:s,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}On.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function $a(e){return!e.ctrlKey&&!e.button}function Ta(){return this.parentNode}function ka(e,t){return t==null?{x:e.x,y:e.y}:t}function Da(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pa(){var e=$a,t=Ta,n=ka,o=Da,i={},r=dn("start","drag","end"),l=0,a,s,u,c,f=0;function h(E){E.on("mousedown.drag",g).filter(o).on("touchstart.drag",d).on("touchmove.drag",p,Ia).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(E,T){if(!(c||!e.call(this,E,T))){var R=N(this,t.call(this,E,T),E,T,"mouse");R&&(Ie(E.view).on("mousemove.drag",w,Tt).on("mouseup.drag",x,Tt),Ii(E.view),bn(E),u=!1,a=E.clientX,s=E.clientY,R("start",E))}}function w(E){if(ht(E),!u){var T=E.clientX-a,R=E.clientY-s;u=T*T+R*R>f}i.mouse("drag",E)}function x(E){Ie(E.view).on("mousemove.drag mouseup.drag",null),$i(E.view,u),ht(E),i.mouse("end",E)}function d(E,T){if(e.call(this,E,T)){var R=E.changedTouches,b=t.call(this,E,T),F=R.length,L,Z;for(L=0;L>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Lt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Lt(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=Oa.exec(e))?new Me(t[1],t[2],t[3],1):(t=za.exec(e))?new Me(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Ba.exec(e))?Lt(t[1],t[2],t[3],t[4]):(t=Ra.exec(e))?Lt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Va.exec(e))?Mo(t[1],t[2]/100,t[3]/100,1):(t=Ha.exec(e))?Mo(t[1],t[2]/100,t[3]/100,t[4]):wo.hasOwnProperty(e)?Eo(wo[e]):e==="transparent"?new Me(NaN,NaN,NaN,0):null}function Eo(e){return new Me(e>>16&255,e>>8&255,e&255,1)}function Lt(e,t,n,o){return o<=0&&(e=t=n=NaN),new Me(e,t,n,o)}function Fa(e){return e instanceof zt||(e=Pt(e)),e?(e=e.rgb(),new Me(e.r,e.g,e.b,e.opacity)):new Me}function zn(e,t,n,o){return arguments.length===1?Fa(e):new Me(e,t,n,o==null?1:o)}function Me(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}eo(Me,zn,Ti(zt,{brighter(e){return e=e==null?tn:Math.pow(tn,e),new Me(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kt:Math.pow(kt,e),new Me(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Me(je(this.r),je(this.g),je(this.b),nn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:So,formatHex:So,formatHex8:Ya,formatRgb:No,toString:No}));function So(){return`#${Je(this.r)}${Je(this.g)}${Je(this.b)}`}function Ya(){return`#${Je(this.r)}${Je(this.g)}${Je(this.b)}${Je((isNaN(this.opacity)?1:this.opacity)*255)}`}function No(){const e=nn(this.opacity);return`${e===1?"rgb(":"rgba("}${je(this.r)}, ${je(this.g)}, ${je(this.b)}${e===1?")":`, ${e})`}`}function nn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function je(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Je(e){return e=je(e),(e<16?"0":"")+e.toString(16)}function Mo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $e(e,t,n,o)}function ki(e){if(e instanceof $e)return new $e(e.h,e.s,e.l,e.opacity);if(e instanceof zt||(e=Pt(e)),!e)return new $e;if(e instanceof $e)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),l=NaN,a=r-i,s=(r+i)/2;return a?(t===r?l=(n-o)/a+(n0&&s<1?0:l,new $e(l,a,s,e.opacity)}function Xa(e,t,n,o){return arguments.length===1?ki(e):new $e(e,t,n,o==null?1:o)}function $e(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}eo($e,Xa,Ti(zt,{brighter(e){return e=e==null?tn:Math.pow(tn,e),new $e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kt:Math.pow(kt,e),new $e(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 Me(xn(e>=240?e-240:e+120,i,o),xn(e,i,o),xn(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new $e(Co(this.h),Gt(this.s),Gt(this.l),nn(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=nn(this.opacity);return`${e===1?"hsl(":"hsla("}${Co(this.h)}, ${Gt(this.s)*100}%, ${Gt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Co(e){return e=(e||0)%360,e<0?e+360:e}function Gt(e){return Math.max(0,Math.min(1,e||0))}function xn(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 Di=e=>()=>e;function Za(e,t){return function(n){return e+n*t}}function Ua(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function Wa(e){return(e=+e)==1?Pi:function(t,n){return n-t?Ua(t,n,e):Di(isNaN(t)?n:t)}}function Pi(e,t){var n=t-e;return n?Za(e,n):Di(isNaN(e)?t:e)}const Io=function e(t){var n=Wa(t);function o(i,r){var l=n((i=zn(i)).r,(r=zn(r)).r),a=n(i.g,r.g),s=n(i.b,r.b),u=Pi(i.opacity,r.opacity);return function(c){return i.r=l(c),i.g=a(c),i.b=s(c),i.opacity=u(c),i+""}}return o.gamma=e,o}(1);function Ze(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Bn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,En=new RegExp(Bn.source,"g");function Ka(e){return function(){return e}}function qa(e){return function(t){return e(t)+""}}function Ja(e,t){var n=Bn.lastIndex=En.lastIndex=0,o,i,r,l=-1,a=[],s=[];for(e=e+"",t=t+"";(o=Bn.exec(e))&&(i=En.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),a[l]?a[l]+=r:a[++l]=r),(o=o[0])===(i=i[0])?a[l]?a[l]+=i:a[++l]=i:(a[++l]=null,s.push({i:l,x:Ze(o,i)})),n=En.lastIndex;return n180?c+=360:c-u>180&&(u+=360),h.push({i:f.push(i(f)+"rotate(",null,o)-2,x:Ze(u,c)})):c&&f.push(i(f)+"rotate("+c+o)}function a(u,c,f,h){u!==c?h.push({i:f.push(i(f)+"skewX(",null,o)-2,x:Ze(u,c)}):c&&f.push(i(f)+"skewX("+c+o)}function s(u,c,f,h,g,w){if(u!==f||c!==h){var x=g.push(i(g)+"scale(",null,",",null,")");w.push({i:x-4,x:Ze(u,f)},{i:x-2,x:Ze(c,h)})}else(f!==1||h!==1)&&g.push(i(g)+"scale("+f+","+h+")")}return function(u,c){var f=[],h=[];return u=e(u),c=e(c),r(u.translateX,u.translateY,c.translateX,c.translateY,f,h),l(u.rotate,c.rotate,f,h),a(u.skewX,c.skewX,f,h),s(u.scaleX,u.scaleY,c.scaleX,c.scaleY,f,h),u=c=null,function(g){for(var w=-1,x=h.length,d;++w=0&&e._call.call(void 0,t),e=e._next;--_t}function ko(){rt=(rn=At.now())+hn,_t=Nt=0;try{as()}finally{_t=0,us(),rt=0}}function ss(){var e=At.now(),t=e-rn;t>zi&&(hn-=t,rn=e)}function us(){for(var e,t=on,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:on=n);Mt=e,Vn(o)}function Vn(e){if(!_t){Nt&&(Nt=clearTimeout(Nt));var t=e-rt;t>24?(e<1/0&&(Nt=setTimeout(ko,e-At.now()-hn)),Et&&(Et=clearInterval(Et))):(Et||(rn=At.now(),Et=setInterval(ss,zi)),_t=1,Bi(ko))}}function Do(e,t,n){var o=new ln;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var cs=dn("start","end","cancel","interrupt"),ds=[],Vi=0,Po=1,Hn=2,qt=3,Ao=4,Ln=5,Jt=6;function gn(e,t,n,o,i,r){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;fs(e,n,{name:t,index:o,group:i,on:cs,tween:ds,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:Vi})}function no(e,t){var n=ke(e,t);if(n.state>Vi)throw new Error("too late; already scheduled");return n}function ze(e,t){var n=ke(e,t);if(n.state>qt)throw new Error("too late; already running");return n}function ke(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function fs(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=Ri(r,0,n.time);function r(u){n.state=Po,n.timer.restart(l,n.delay,n.time),n.delay<=u&&l(u-n.delay)}function l(u){var c,f,h,g;if(n.state!==Po)return s();for(c in o)if(g=o[c],g.name===n.name){if(g.state===qt)return Do(l);g.state===Ao?(g.state=Jt,g.timer.stop(),g.on.call("interrupt",e,e.__data__,g.index,g.group),delete o[c]):+cHn&&o.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Gs(e,t,n){var o,i,r=Ls(t)?no:ze;return function(){var l=r(this,e),a=l.on;a!==o&&(i=(o=a).copy()).on(t,n),l.on=i}}function Fs(e,t){var n=this._id;return arguments.length<2?ke(this.node(),n).on.on(e):this.each(Gs(n,e,t))}function Ys(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xs(){return this.on("end.remove",Ys(this._id))}function Zs(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Qn(e));for(var o=this._groups,i=o.length,r=new Array(i),l=0;l()=>e;function mu(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function Le(e,t,n){this.k=e,this.x=t,this.y=n}Le.prototype={constructor:Le,scale:function(e){return e===1?this:new Le(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Le(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var wt=new Le(1,0,0);Le.prototype;function Sn(e){e.stopImmediatePropagation()}function St(e){e.preventDefault(),e.stopImmediatePropagation()}function yu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function _u(){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 Oo(){return this.__zoom||wt}function wu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bu(){return navigator.maxTouchPoints||"ontouchstart"in this}function xu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),l>r?(r+l)/2:Math.min(0,r)||Math.max(0,l))}function Eu(){var e=yu,t=_u,n=xu,o=wu,i=bu,r=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],a=250,s=rs,u=dn("start","zoom","end"),c,f,h,g=500,w=150,x=0,d=10;function p(m){m.property("__zoom",Oo).on("wheel.zoom",F,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",Z).filter(i).on("touchstart.zoom",P).on("touchmove.zoom",Q).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(m,I,S,$){var B=m.selection?m.selection():m;B.property("__zoom",Oo),m!==B?T(m,I,S,$):B.interrupt().each(function(){R(this,arguments).event($).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},p.scaleBy=function(m,I,S,$){p.scaleTo(m,function(){var B=this.__zoom.k,C=typeof I=="function"?I.apply(this,arguments):I;return B*C},S,$)},p.scaleTo=function(m,I,S,$){p.transform(m,function(){var B=t.apply(this,arguments),C=this.__zoom,D=S==null?E(B):typeof S=="function"?S.apply(this,arguments):S,Y=C.invert(D),q=typeof I=="function"?I.apply(this,arguments):I;return n(N(_(C,q),D,Y),B,l)},S,$)},p.translateBy=function(m,I,S,$){p.transform(m,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,$)},p.translateTo=function(m,I,S,$,B){p.transform(m,function(){var C=t.apply(this,arguments),D=this.__zoom,Y=$==null?E(C):typeof $=="function"?$.apply(this,arguments):$;return n(wt.translate(Y[0],Y[1]).scale(D.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof S=="function"?-S.apply(this,arguments):-S),C,l)},$,B)};function _(m,I){return I=Math.max(r[0],Math.min(r[1],I)),I===m.k?m:new Le(I,m.x,m.y)}function N(m,I,S){var $=I[0]-S[0]*m.k,B=I[1]-S[1]*m.k;return $===m.x&&B===m.y?m:new Le(m.k,$,B)}function E(m){return[(+m[0][0]+ +m[1][0])/2,(+m[0][1]+ +m[1][1])/2]}function T(m,I,S,$){m.on("start.zoom",function(){R(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){R(this,arguments).event($).end()}).tween("zoom",function(){var B=this,C=arguments,D=R(B,C).event($),Y=t.apply(B,C),q=S==null?E(Y):typeof S=="function"?S.apply(B,C):S,ae=Math.max(Y[1][0]-Y[0][0],Y[1][1]-Y[0][1]),H=B.__zoom,te=typeof I=="function"?I.apply(B,C):I,k=s(H.invert(q).concat(ae/H.k),te.invert(q).concat(ae/te.k));return function(j){if(j===1)j=te;else{var W=k(j),K=ae/W[2];j=new Le(K,q[0]-W[0]*K,q[1]-W[1]*K)}D.zoom(null,j)}})}function R(m,I,S){return!S&&m.__zooming||new b(m,I)}function b(m,I){this.that=m,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(m,I),this.taps=0}b.prototype={event:function(m){return m&&(this.sourceEvent=m),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(m,I){return this.mouse&&m!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&m!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&m!=="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(m){var I=Ie(this.that).datum();u.call(m,this.that,new mu(m,{sourceEvent:this.sourceEvent,target:p,type:m,transform:this.that.__zoom,dispatch:u}),I)}};function F(m,...I){if(!e.apply(this,arguments))return;var S=R(this,I).event(m),$=this.__zoom,B=Math.max(r[0],Math.min(r[1],$.k*Math.pow(2,o.apply(this,arguments)))),C=De(m);if(S.wheel)(S.mouse[0][0]!==C[0]||S.mouse[0][1]!==C[1])&&(S.mouse[1]=$.invert(S.mouse[0]=C)),clearTimeout(S.wheel);else{if($.k===B)return;S.mouse=[C,$.invert(C)],Qt(this),S.start()}St(m),S.wheel=setTimeout(D,w),S.zoom("mouse",n(N(_($,B),S.mouse[0],S.mouse[1]),S.extent,l));function D(){S.wheel=null,S.end()}}function L(m,...I){if(h||!e.apply(this,arguments))return;var S=m.currentTarget,$=R(this,I,!0).event(m),B=Ie(m.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",ae,!0),C=De(m,S),D=m.clientX,Y=m.clientY;Ii(m.view),Sn(m),$.mouse=[C,this.__zoom.invert(C)],Qt(this),$.start();function q(H){if(St(H),!$.moved){var te=H.clientX-D,k=H.clientY-Y;$.moved=te*te+k*k>x}$.event(H).zoom("mouse",n(N($.that.__zoom,$.mouse[0]=De(H,S),$.mouse[1]),$.extent,l))}function ae(H){B.on("mousemove.zoom mouseup.zoom",null),$i(H.view,$.moved),St(H),$.event(H).end()}}function Z(m,...I){if(e.apply(this,arguments)){var S=this.__zoom,$=De(m.changedTouches?m.changedTouches[0]:m,this),B=S.invert($),C=S.k*(m.shiftKey?.5:2),D=n(N(_(S,C),$,B),t.apply(this,I),l);St(m),a>0?Ie(this).transition().duration(a).call(T,D,$,m):Ie(this).call(p.transform,D,$,m)}}function P(m,...I){if(e.apply(this,arguments)){var S=m.touches,$=S.length,B=R(this,I,m.changedTouches.length===$).event(m),C,D,Y,q;for(Sn(m),D=0;D<$;++D)Y=S[D],q=De(Y,this),q=[q,this.__zoom.invert(q),Y.identifier],B.touch0?!B.touch1&&B.touch0[2]!==q[2]&&(B.touch1=q,B.taps=0):(B.touch0=q,C=!0,B.taps=1+!!c);c&&(c=clearTimeout(c)),C&&(B.taps<2&&(f=q[0],c=setTimeout(function(){c=null},g)),Qt(this),B.start())}}function Q(m,...I){if(this.__zooming){var S=R(this,I).event(m),$=m.changedTouches,B=$.length,C,D,Y,q;for(St(m),C=0;C(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(J||{}),io=(e=>(e.Partial="partial",e.Full="full",e))(io||{}),Ke=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Ke||{}),lt=(e=>(e.Strict="strict",e.Loose="loose",e))(lt||{}),Gn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(Gn||{}),It=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(It||{});function ro(){return typeof window!="undefined"?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 Su(e){return e.ctrlKey||e.metaKey||e.shiftKey}function zo(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,l)=>n.has(r)&&Array.from(n.values())[l]===i[l]))}function Nu(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Mu(n.code,e);return Array.isArray(e)?e.some(i=>zo(n[o],i,t,n.type==="keyup")):zo(n[o],e,t,n.type==="keyup")}}function Mu(e,t){return typeof t=="string"?e===t?"code":"key":t.includes(e)?"code":"key"}function $t(e,t,n={actInsideInputWithModifier:!0}){const o=ro(),i=ge(ue(e)===!0);let r=!1;const l=new Set;let a=u(ue(e));return he(i,(c,f)=>{c!==f&&(t==null||t(c))}),he(()=>ue(e),(c,f)=>{typeof f=="boolean"&&typeof c!="boolean"&&s(),a=u(c)},{immediate:!0}),vi(o,"blur",()=>{ue(e)!==!0&&(i.value=!1)}),mo((...c)=>a(...c),c=>{r=Su(c),!((!r||r&&!n.actInsideInputWithModifier)&&Fn(c))&&(c.preventDefault(),i.value=!0)},{eventName:"keydown"}),mo((...c)=>a(...c),c=>{if(i.value){if((!r||r&&!n.actInsideInputWithModifier)&&Fn(c))return;s()}},{eventName:"keyup"}),i;function s(){r=!1,l.clear(),i.value=!1}function u(c){return c===null?(s(),()=>!1):typeof c=="boolean"?(s(),i.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Nu(c,l):c}}const Fi="vue-flow__node-desc",Yi="vue-flow__edge-desc",Cu="vue-flow__aria-live",Xi=["Enter"," ","Escape"],vt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Zi(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:l,nodeDragThreshold:a,viewport:s,autoPanOnNodeDrag:u,nodesDraggable:c,panBy:f,findNode:h,multiSelectionActive:g,nodesSelectionActive:w,selectNodesOnDrag:x,removeSelectedElements:d,addSelectedNodes:p,updateNodePositions:_,emits:N}=_e(),{onStart:E,onDrag:T,onStop:R,el:b,disabled:F,id:L,selectable:Z,dragHandle:P}=e,Q=ge(!1);let G=[],m,I=null,S={x:void 0,y:void 0},$={x:0,y:0},B=null,C=!1,D=0,Y=!1;const q=Du(),ae=({x:K,y:ee})=>{S={x:K,y:ee};let oe=!1;if(G=G.map(le=>{const me={x:K-le.distance.x,y:ee-le.distance.y};n.value&&(me.x=o.value[0]*Math.round(me.x/o.value[0]),me.y=o.value[1]*Math.round(me.y/o.value[1]));const{computedPosition:v}=ao(le,me,N.error,l.value,le.parentNode?h(le.parentNode):void 0);return oe=oe||le.position.x!==v.x||le.position.y!==v.y,le.position=v,le}),!!oe&&(_(G,!0,!0),Q.value=!0,B)){const[le,me]=$n({id:L,dragItems:G,findNode:h});T({event:B,node:le,nodes:me})}},H=()=>{var oe,le;if(!I)return;const[K,ee]=ar($,I);if(K!==0||ee!==0){const me={x:((oe=S.x)!=null?oe:0)-K/s.value.zoom,y:((le=S.y)!=null?le:0)-ee/s.value.zoom};f({x:K,y:ee})&&ae(me)}D=requestAnimationFrame(H)},te=(K,ee)=>{C=!0;const oe=h(L);!x.value&&!g.value&&oe&&(oe.selected||d()),oe&&ue(Z)&&x.value&&Un(oe,g.value,p,d,w,!1,ee);const le=q(K);if(S=le,G=Uu(r.value,c.value,le,h,L),G.length){const[me,v]=$n({id:L,dragItems:G,findNode:h});E({event:K.sourceEvent,node:me,nodes:v})}},k=(K,ee)=>{var oe;a.value===0&&te(K,ee),S=q(K),I=((oe=t.value)==null?void 0:oe.getBoundingClientRect())||null,$=tt(K.sourceEvent,I)},j=(K,ee)=>{var le,me;const oe=q(K);if(!Y&&C&&u.value&&(Y=!0,H()),!C){const v=oe.xSnapped-((le=S.x)!=null?le:0),y=oe.ySnapped-((me=S.y)!=null?me:0);Math.sqrt(v*v+y*y)>a.value&&te(K,ee)}(S.x!==oe.xSnapped||S.y!==oe.ySnapped)&&G.length&&C&&(B=K.sourceEvent,$=tt(K.sourceEvent,I),ae(oe))},W=K=>{if(C&&(Q.value=!1,Y=!1,C=!1,cancelAnimationFrame(D),G.length)){_(G,!1,!1);const[ee,oe]=$n({id:L,dragItems:G,findNode:h});R({event:K.sourceEvent,node:ee,nodes:oe})}};return he([()=>ue(F),b],([K,ee],oe,le)=>{if(ee){const me=Ie(ee);K||(m=Pa().on("start",v=>k(v,ee)).on("drag",v=>j(v,ee)).on("end",v=>W(v)).filter(v=>{const y=v.target,O=ue(P);return!v.button&&(!i.value||!Zo(y,`.${i.value}`,ee)&&(!O||Zo(y,O,ee)))}),me.call(m)),le(()=>{me.on(".drag",null),m&&(m.on("start",null),m.on("drag",null),m.on("end",null))})}}),Q}const Bo=Symbol("vueFlow"),Ui=Symbol("nodeId"),Wi=Symbol("nodeRef"),Iu=Symbol("edgeId"),$u=Symbol("edgeRef"),vn=Symbol("slots");function Tu(){return{doubleClick:V(),click:V(),mouseEnter:V(),mouseMove:V(),mouseLeave:V(),contextMenu:V(),updateStart:V(),update:V(),updateEnd:V()}}function ku(e,t){const n=Tu();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 Du(){const{viewport:e,snapGrid:t,snapToGrid:n}=_e();return({sourceEvent:o})=>{const i=o.touches?o.touches[0].clientX:o.clientX,r=o.touches?o.touches[0].clientY:o.clientY,l={x:(i-e.value.x)/e.value.zoom,y:(r-e.value.y)/e.value.zoom};return A({xSnapped:n.value?t.value[0]*Math.round(l.x/t.value[0]):l.x,ySnapped:n.value?t.value[1]*Math.round(l.y/t.value[1]):l.y},l)}}function Xt(){return!0}function Ki({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:l}){const{vueFlowRef:a,connectionMode:s,connectionRadius:u,connectOnClick:c,connectionClickStartHandle:f,nodesConnectable:h,autoPanOnConnect:g,findNode:w,panBy:x,startConnection:d,updateConnection:p,endConnection:_,emits:N,viewport:E,edges:T,nodes:R,isValidConnection:b}=_e();let F=null,L=!1,Z=null;function P(G){var m;const I=ue(n)==="target",S=so(G),$=Vo(G.target);if(S&&G.button===0||!S){let B=function(v){ee=tt(v,W);const{handle:y,validHandleResult:O}=ec(v,$,Xn(ee,E.value,!1,[1,1]),u.value,le,z=>qo(v,z,s.value,ue(t),ue(e),I?"target":"source",Y,$,T.value,R.value,w));if(q=y,oe||(me(),oe=!0),F=O.connection,L=O.isValid,Z=O.handleDomNode,p(q&&L?nr({x:q.x,y:q.y},E.value):ee,O.endHandle,nc(!!q,L)),!q&&!L&&!Z)return Tn(K);F&&F.source!==F.target&&Z&&(Tn(K),K=Z,Z.classList.add("connecting","vue-flow__handle-connecting"),Z.classList.toggle("valid",L),Z.classList.toggle("vue-flow__handle-valid",L))},C=function(v){(q||Z)&&F&&L&&(r?r(v,F):N.connect(F)),N.connectEnd(v),i&&(l==null||l(v)),Tn(K),cancelAnimationFrame(ae),_(v),oe=!1,L=!1,F=null,Z=null,$.removeEventListener("mousemove",B),$.removeEventListener("mouseup",C),$.removeEventListener("touchmove",B),$.removeEventListener("touchend",C)};const D=w(ue(t));let Y=ue(o)||b.value||Xt;!Y&&D&&(Y=(I?D.isValidSourcePos:D.isValidTargetPos)||Xt);let q,ae=0;const{x:H,y:te}=tt(G),k=$==null?void 0:$.elementFromPoint(H,te),j=uo(ue(i),k),W=(m=a.value)==null?void 0:m.getBoundingClientRect();if(!W||!j)return;let K,ee=tt(G,W),oe=!1;const le=tc({nodes:R.value,nodeId:ue(t),handleId:ue(e),handleType:j}),me=()=>{if(!g.value)return;const[v,y]=ar(ee,W);x({x:v,y}),ae=requestAnimationFrame(me)};d({nodeId:ue(t),handleId:ue(e),type:j},{x:H-W.left,y:te-W.top},G),N.connectStart({event:G,nodeId:ue(t),handleId:ue(e),handleType:j}),$.addEventListener("mousemove",B),$.addEventListener("mouseup",C),$.addEventListener("touchmove",B),$.addEventListener("touchend",C)}}function Q(G){if(!c.value)return;const m=ue(n)==="target";if(!f.value)N.clickConnectStart({event:G,nodeId:ue(t),handleId:ue(e)}),d({nodeId:ue(t),type:ue(n),handleId:ue(e)},void 0,G,!0);else{let I=ue(o)||b.value||Xt;const S=w(ue(t));if(!I&&S&&(I=(m?S.isValidSourcePos:S.isValidTargetPos)||Xt),S&&(typeof S.connectable=="undefined"?h.value:S.connectable)===!1)return;const $=Vo(G.target),{connection:B,isValid:C}=qo(G,{nodeId:ue(t),id:ue(e),type:ue(n)},s.value,f.value.nodeId,f.value.handleId||null,f.value.type,I,$,T.value,R.value,w),D=B.source===B.target;C&&!D&&N.connect(B),N.clickConnectEnd(G),_(G,!0)}}return{handlePointerDown:P,handleClick:Q}}function qi(){return bt(Ui,"")}function Pu(e){var a;const t=(a=qi())!=null?a:"",n=bt(Wi,ge(null)),{findNode:o,edges:i,emits:r}=_e(),l=o(t);return l||r.error(new Ee(xe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:l,parentNode:ce(()=>o(l.parentNode)),connectedEdges:ce(()=>lo([l],i.value))}}function Au(){return{doubleClick:V(),click:V(),mouseEnter:V(),mouseMove:V(),mouseLeave:V(),contextMenu:V(),dragStart:V(),drag:V(),dragStop:V()}}function Ou(e,t){const n=Au();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 Ji(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:l,emits:a}=_e();return(s,u=!1)=>{const c=r.value?i.value[0]:5,f=r.value?i.value[1]:5,h=u?4:1,g=s.x*c*h,w=s.y*f*h,x=[];for(const d of e.value)if(d.draggable||l&&typeof d.draggable=="undefined"){const p={x:d.computedPosition.x+g,y:d.computedPosition.y+w},{computedPosition:_}=ao(d,p,a.error,t.value,d.parentNode?o(d.parentNode):void 0);x.push({id:d.id,position:_,from:d.position,distance:{x:s.x,y:s.y},dimensions:d.dimensions})}n(x,!0,!1)}}const Nn=.1;function Xe(){return Bt("Viewport not initialized yet."),Promise.resolve(!1)}const zu={zoomIn:Xe,zoomOut:Xe,zoomTo:Xe,fitView:Xe,setCenter:Xe,fitBounds:Xe,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Xe,setTransform:Xe,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Bu(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(Mn(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,l){return new Promise(a=>{const{x:s,y:u}=Qi({x:-o,y:-i},e.translateExtent),c=wt.translate(-s,-u).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(Mn(e.d3Selection,l,()=>{a(!0)}),c):a(!1)})}return ce(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i==null?void 0:i.duration),zoomOut:i=>t(1/1.2,i==null?void 0:i.duration),zoomTo:(i,r)=>new Promise(l=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(Mn(e.d3Selection,r==null?void 0:r.duration,()=>{l(!0)}),i):l(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:Nn,includeHiddenNodes:!1,duration:0})=>{var h,g,w;var r,l;const a=[];for(const x of e.nodes)x.dimensions.width&&x.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!x.hidden)&&(!((r=i.nodes)!=null&&r.length)||(l=i.nodes)!=null&&l.length&&i.nodes.includes(x.id))&&a.push(x);if(!a.length)return Promise.resolve(!1);const s=ir(a),{x:u,y:c,zoom:f}=Ho(s,e.dimensions.width,e.dimensions.height,(h=i.minZoom)!=null?h:e.minZoom,(g=i.maxZoom)!=null?g:e.maxZoom,(w=i.padding)!=null?w:Nn,i.offset);return n(u,c,f,i==null?void 0:i.duration)},setCenter:(i,r,l)=>{const a=typeof(l==null?void 0:l.zoom)!="undefined"?l.zoom:e.maxZoom,s=e.dimensions.width/2-i*a,u=e.dimensions.height/2-r*a;return n(s,u,a,l==null?void 0:l.duration)},fitBounds:(i,r={padding:Nn})=>{const{x:l,y:a,zoom:s}=Ho(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(l,a,s,r==null?void 0:r.duration)},project:i=>Xn(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),a={x:i.x-r,y:i.y-l};return Xn(a,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:l}=e.vueFlowRef.getBoundingClientRect(),a={x:i.x+r,y:i.y+l};return nr(a,e.viewport)}return{x:0,y:0}}}:zu)}function Mn(e,t=0,n){return e.transition().duration(t).on("end",n)}function Ru(e,t,n){const o=si(!0);return o.run(()=>{const i=()=>{o.run(()=>{let x,d,p=!!(n.nodes.value.length||n.edges.value.length);x=ct([e.modelValue,()=>{var _,N;return(N=(_=e.modelValue)==null?void 0:_.value)==null?void 0:N.length}],([_])=>{_&&Array.isArray(_)&&(d==null||d.pause(),n.setElements(_),!d&&!p&&_.length?p=!0:d==null||d.resume())}),d=ct([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([_,N])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(x==null||x.pause(),e.modelValue.value=[..._,...N],Pe(()=>{x==null||x.resume()}))},{immediate:p}),Wt(()=>{x==null||x.stop(),d==null||d.stop()})})},r=()=>{o.run(()=>{let x,d,p=!!n.nodes.value.length;x=ct([e.nodes,()=>{var _,N;return(N=(_=e.nodes)==null?void 0:_.value)==null?void 0:N.length}],([_])=>{_&&Array.isArray(_)&&(d==null||d.pause(),n.setNodes(_),!d&&!p&&_.length?p=!0:d==null||d.resume())}),d=ct([n.nodes,()=>n.nodes.value.length],([_])=>{var N;(N=e.nodes)!=null&&N.value&&Array.isArray(e.nodes.value)&&(x==null||x.pause(),e.nodes.value=[..._],Pe(()=>{x==null||x.resume()}))},{immediate:p}),Wt(()=>{x==null||x.stop(),d==null||d.stop()})})},l=()=>{o.run(()=>{let x,d,p=!!n.edges.value.length;x=ct([e.edges,()=>{var _,N;return(N=(_=e.edges)==null?void 0:_.value)==null?void 0:N.length}],([_])=>{_&&Array.isArray(_)&&(d==null||d.pause(),n.setEdges(_),!d&&!p&&_.length?p=!0:d==null||d.resume())}),d=ct([n.edges,()=>n.edges.value.length],([_])=>{var N;(N=e.edges)!=null&&N.value&&Array.isArray(e.edges.value)&&(x==null||x.pause(),e.edges.value=[..._],Pe(()=>{x==null||x.resume()}))},{immediate:p}),Wt(()=>{x==null||x.stop(),d==null||d.stop()})})},a=()=>{o.run(()=>{he(()=>t.maxZoom,()=>{t.maxZoom&&be(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},s=()=>{o.run(()=>{he(()=>t.minZoom,()=>{t.minZoom&&be(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},u=()=>{o.run(()=>{he(()=>t.translateExtent,()=>{t.translateExtent&&be(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{he(()=>t.nodeExtent,()=>{t.nodeExtent&&be(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},f=()=>{o.run(()=>{he(()=>t.applyDefault,()=>{be(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},h=()=>{o.run(()=>{const x=d=>vo(this,null,function*(){let p=d;typeof t.autoConnect=="function"&&(p=yield t.autoConnect(d)),p!==!1&&n.addEdges([p])});he(()=>t.autoConnect,()=>{be(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),he(n.autoConnect,(d,p,_)=>{d?n.onConnect(x):n.hooks.value.connect.off(x),_(()=>{n.hooks.value.connect.off(x)})},{immediate:!0})})},g=()=>{const x=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const d of Object.keys(t)){const p=d;if(!x.includes(p)){const _=Ne(()=>t[p]),N=n[p];Kn(N)&&o.run(()=>{he(_,E=>{be(E)&&(N.value=E)},{immediate:!0,flush:"pre"})})}}};(()=>{i(),r(),l(),s(),a(),u(),c(),f(),h(),g()})()}),()=>o.stop()}function Ro(e){return re(A({},e.computedPosition||{x:0,y:0}),{width:e.dimensions.width||0,height:e.dimensions.height||0})}function Yn(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 pn(e){return{width:e.offsetWidth,height:e.offsetHeight}}function at(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Qi(e,t){return{x:at(e.x,t[0][0],t[1][0]),y:at(e.y,t[0][1],t[1][1])}}function Vo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:ro().document}function Ue(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function et(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Ue(e)}function dt(e){return et(e)&&"computedPosition"in e}function Zt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Vu(e){return Zt(e.width)&&Zt(e.height)&&Zt(e.x)&&Zt(e.y)}function Hu(e,t,n){var i;const o={id:e.id.toString(),type:(i=e.type)!=null?i:"default",dimensions:ft({width:0,height:0}),handleBounds:{source:[],target:[]},computedPosition:ft(A({z:0},e.position)),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:be(e.data)?e.data:{},events:ft(be(e.events)?e.events:{})};return Object.assign(t!=null?t:o,e,{id:e.id.toString(),parentNode:n})}function ji(e,t,n){var l,a,s,u,c,f,h;var o,i;const r=A({id:e.id.toString(),type:(a=(l=e.type)!=null?l:t==null?void 0:t.type)!=null?a:"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:(s=e.updatable)!=null?s:n==null?void 0:n.updatable,selectable:(u=e.selectable)!=null?u:n==null?void 0:n.selectable,focusable:(c=e.focusable)!=null?c:n==null?void 0:n.focusable,data:be(e.data)?e.data:{},events:ft(be(e.events)?e.events:{}),label:(f=e.label)!=null?f:"",interactionWidth:(h=e.interactionWidth)!=null?h:n==null?void 0:n.interactionWidth},n!=null?n:{});return Object.assign(t!=null?t:r,e,{id:e.id.toString()})}function er(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,l=o==="source"?"target":"source";for(const a of n)a[l]===i&&r.add(a[o]);return t.filter(a=>r.has(a.id))}function Lu(...e){if(e.length===3){const[r,l,a]=e;return er(r,l,a,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Ue(r)&&r.source===o).map(r=>n.find(l=>et(l)&&l.id===r.target))}function Gu(...e){if(e.length===3){const[r,l,a]=e;return er(r,l,a,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Ue(r)&&r.target===o).map(r=>n.find(l=>et(l)&&l.id===r.source))}function tr({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t!=null?t:""}-${n}${o!=null?o:""}`}function Fu(e,t){return t.some(n=>Ue(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 nr({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function Xn({x:e,y:t},{x:n,y:o,zoom:i},r,[l,a]){const s={x:(e-n)/i,y:(t-o)/i};return r?{x:l*Math.round(s.x/l),y:a*Math.round(s.y/a)}:s}function Yu(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 or({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Xu({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function ir(e){const t=e.reduce((n,{computedPosition:o={x:0,y:0},dimensions:i={width:0,height:0}}={})=>Yu(n,or(A(A({},o),i))),{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY});return Xu(t)}function rr(e,t,{x:n,y:o,zoom:i}={x:0,y:0,zoom:1},r=!1,l=!1){const a={x:(t.x-n)/i,y:(t.y-o)/i,width:t.width/i,height:t.height/i};return e.filter(s=>{const{computedPosition:u={x:0,y:0},dimensions:c={width:0,height:0},selectable:f}=s;if(l&&!f)return!1;const h=re(A({},u),{width:c.width||0,height:c.height||0}),g=Yn(a,h),w=typeof c.width=="undefined"||typeof c.height=="undefined"||c.width===0||c.height===0,x=r&&g>0,d=c.width*c.height;return w||x||g>=d})}function lo(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 Ho(e,t,n,o,i,r=.1,l={x:0,y:0}){var x,d;const a=t/(e.width*(1+r)),s=n/(e.height*(1+r)),u=Math.min(a,s),c=at(u,o,i),f=e.x+e.width/2,h=e.y+e.height/2,g=t/2-f*c+((x=l.x)!=null?x:0),w=n/2-h*c+((d=l.y)!=null?d:0);return{x:g,y:w,zoom:c}}function Zu(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function lr(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:lr(n,t):!1}function Qe(e,t){return typeof e=="undefined"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Lo(e,t,n){return en?-at(Math.abs(e-n),1,50)/50:0}function ar(e,t){const n=Lo(e.x,35,t.width-35)*20,o=Lo(e.y,35,t.height-35)*20;return[n,o]}function Cn(e,t){var n,o;if(t){const i=e.position.x+e.dimensions.width-t.dimensions.width,r=e.position.y+e.dimensions.height-t.dimensions.height;if(i>0||r>0||e.position.x<0||e.position.y<0){let l={};if(typeof t.style=="function"?l=A({},t.style(t)):t.style&&(l=A({},t.style)),l.width=(n=l.width)!=null?n:`${t.dimensions.width}px`,l.height=(o=l.height)!=null?o:`${t.dimensions.height}px`,i>0)if(typeof l.width=="string"){const a=Number(l.width.replace("px",""));l.width=`${a+i}px`}else l.width+=i;if(r>0)if(typeof l.height=="string"){const a=Number(l.height.replace("px",""));l.height=`${a+r}px`}else l.height+=r;if(e.position.x<0){const a=Math.abs(e.position.x);if(t.position.x=t.position.x-a,typeof l.width=="string"){const s=Number(l.width.replace("px",""));l.width=`${s+a}px`}else l.width+=a;e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);if(t.position.y=t.position.y-a,typeof l.height=="string"){const s=Number(l.height.replace("px",""));l.height=`${s+a}px`}else l.height+=a;e.position.y=0}t.dimensions.width=Number(l.width.toString().replace("px","")),t.dimensions.height=Number(l.height.toString().replace("px","")),typeof t.style=="function"?t.style=a=>{const s=t.style;return A(A({},s(a)),l)}:t.style=A(A({},t.style),l)}}}function Go(e,t){var n,o;const i=e.filter(l=>l.type==="add"||l.type==="remove");for(const l of i)if(l.type==="add")t.findIndex(s=>s.id===l.item.id)===-1&&t.push(l.item);else if(l.type==="remove"){const a=t.findIndex(s=>s.id===l.id);a!==-1&&t.splice(a,1)}const r=t.map(l=>l.id);for(const l of t)for(const a of e)if(a.id===l.id)switch(a.type){case"select":l.selected=a.selected;break;case"position":if(dt(l)&&(typeof a.position!="undefined"&&(l.position=a.position),typeof a.dragging!="undefined"&&(l.dragging=a.dragging),l.expandParent&&l.parentNode)){const s=t[r.indexOf(l.parentNode)];s&&dt(s)&&Cn(l,s)}break;case"dimensions":if(dt(l)){if(typeof a.dimensions!="undefined"&&(l.dimensions=a.dimensions),typeof a.updateStyle!="undefined"&&(l.style=re(A({},l.style||{}),{width:`${(n=a.dimensions)==null?void 0:n.width}px`,height:`${(o=a.dimensions)==null?void 0:o.height}px`})),typeof a.resizing!="undefined"&&(l.resizing=a.resizing),l.expandParent&&l.parentNode){const s=t[r.indexOf(l.parentNode)];s&&dt(s)&&(s.initialized?Cn(l,s):Pe(()=>{Cn(l,s)}))}l.initialized||(l.initialized=!0)}break}return t}function Re(e,t){return{id:e,type:"select",selected:t}}function Fo(e){return{item:e,type:"add"}}function Yo(e){return{id:e,type:"remove"}}function Xo(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function In(e,t){return e.reduce((n,o)=>{let i=t.includes(o.id);be(o.selectable)&&!o.selectable&&(i=!1);const r=dt(o)?"changedNodes":"changedEdges";return!o.selected&&i?n[r].push(Re(o.id,!0)):o.selected&&!i&&n[r].push(Re(o.id,!1)),n},{changedNodes:[],changedEdges:[]})}function V(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=a=>{t.delete(a)};return{on:a=>{e&&n&&t.delete(e),t.add(a);const s=()=>{i(a),e&&n&&t.add(e)};return cn(s),{off:s}},off:i,trigger:a=>Promise.all(Array.from(t).map(s=>s(a))),hasListeners:o,fns:t}}function Zo(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 Uu(e,t,n,o,i){var r,l;const a=[];for(const s of e)(s.selected||s.id===i)&&(!s.parentNode||!lr(s,o))&&(s.draggable||t&&typeof s.draggable=="undefined")&&a.push(ft({id:s.id,position:s.position||{x:0,y:0},distance:{x:n.x-((r=s.computedPosition)==null?void 0:r.x)||0,y:n.y-((l=s.computedPosition)==null?void 0:l.y)||0},from:s.computedPosition,extent:s.extent,parentNode:s.parentNode,dimensions:s.dimensions,expandParent:s.expandParent}));return a}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 sr(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 Wu(e,t,n){const[o,i,r,l]=typeof e!="string"?sr(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x!="undefined"&&typeof n.computedPosition.y!="undefined"&&typeof n.dimensions.width!="undefined"&&typeof n.dimensions.height!="undefined"?[[n.computedPosition.x+l,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Ku(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=Wu(i,e,o);r&&(i=r)}else t(new Ee(xe.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,l=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+l],[i[1][0]+r,i[1][1]+l]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,l,a,s]=sr(i.padding),u=(o==null?void 0:o.computedPosition.x)||0,c=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+u+s,i.range[0][1]+c+r],[i.range[1][0]+u-l,i.range[1][1]+c-a]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function qu({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function ao(e,t,n,o,i){const r=qu(e.dimensions,Ku(e,n,o,i)),l=Qi(t,r);return{position:{x:l.x-((i==null?void 0:i.computedPosition.x)||0),y:l.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:l}}function Zn(e,t,n){var a,s,u,c;const o=((a=n==null?void 0:n.x)!=null?a:0)+t.x,i=((s=n==null?void 0:n.y)!=null?s:0)+t.y,r=(u=n==null?void 0:n.width)!=null?u:t.width,l=(c=n==null?void 0:n.height)!=null?c:t.height;switch(e){case J.Top:return{x:o+r/2,y:i};case J.Right:return{x:o+r,y:i+l/2};case J.Bottom:return{x:o+r/2,y:i+l};case J.Left:return{x:o,y:i+l/2}}}function Uo(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function Ju(e,t,n,o,i,r){const l=Zn(n,A(A({},e.dimensions),e.computedPosition),t),a=Zn(r,A(A({},o.dimensions),o.computedPosition),i);return{sourceX:l.x,sourceY:l.y,targetX:a.x,targetY:a.y}}function Qu({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:l,height:a,viewport:s}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=or({x:(0-s.x)/s.zoom,y:(0-s.y)/s.zoom,width:l/s.zoom,height:a/s.zoom}),f=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),h=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(f*h)>0}function ju(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),l=t(e.target);return!r||!l?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,l.computedPosition.z||0)),i)}var xe=(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))(xe||{});const Wo={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent Node: ${e} Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing Edge: ${e} Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing Edge: ${e} Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same Edge: ${e} Source: ${t} Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing Edge: ${e} Source: ${t} Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found Edge: ${e}`};class Ee extends Error{constructor(t,...n){var o;super((o=Wo[t])==null?void 0:o.call(Wo,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function so(e){return"clientX"in e}function tt(e,t){var a,s;var n,o;const i=so(e),r=i?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,l=i?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((a=t==null?void 0:t.left)!=null?a:0),y:l-((s=t==null?void 0:t.top)!=null?s:0)}}const an=()=>{var e;return typeof navigator!="undefined"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ur(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function Tn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function Ko(e,t,n,o){return(t[n]||[]).reduce((i,r)=>{var s,u;var l,a;return`${e.id}-${r.id}-${n}`!==o&&i.push({id:r.id||null,type:n,nodeId:e.id,x:((s=(l=e.computedPosition)==null?void 0:l.x)!=null?s:0)+r.x+r.width/2,y:((u=(a=e.computedPosition)==null?void 0:a.y)!=null?u:0)+r.y+r.height/2,width:r.width,height:r.height}),i},[])}function ec(e,t,n,o,i,r){const{x:l,y:a}=tt(e),u=t.elementsFromPoint(l,a).find(w=>w.classList.contains("vue-flow__handle"));if(u){const w=u.getAttribute("data-nodeid");if(w){const x=uo(void 0,u),d=u.getAttribute("data-handleid"),p=r({nodeId:w,id:d,type:x});if(p){const _=i.find(N=>N.nodeId===w&&N.type===x&&N.id===d);return{handle:{id:d,type:x,nodeId:w,x:(_==null?void 0:_.x)||n.x,y:(_==null?void 0:_.y)||n.y},validHandleResult:p}}}}let c=[],f=Number.POSITIVE_INFINITY;for(const w of i){const x=Math.sqrt(ut(w.x-n.x,2)+ut(w.y-n.y,2));if(x<=o){const d=r(w);x<=f&&(xw.isValid),g=c.some(({handle:w})=>w.type==="target");return c.find(({handle:w,validHandleResult:x})=>g?w.type==="target":h?x.isValid:!0)||c[0]}function qo(e,t,n,o,i,r,l,a,s,u,c){const f=r==="target",h=a.querySelector(`.vue-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),{x:g,y:w}=tt(e),x=a.elementFromPoint(g,w),d=x!=null&&x.classList.contains("vue-flow__handle")?x:h,p=ur();if(d){p.handleDomNode=d;const _=uo(void 0,d),N=d.getAttribute("data-nodeid"),E=d.getAttribute("data-handleid"),T=d.classList.contains("connectable"),R=d.classList.contains("connectableend"),b={source:f?N:o,sourceHandle:f?E:i,target:f?o:N,targetHandle:f?i:E};p.connection=b;const L=T&&R&&(n===lt.Strict?f&&_==="source"||!f&&_==="target":N!==o||E!==i);p.endHandle={nodeId:N,handleId:E,type:_},L&&(p.isValid=l(b,{edges:s,nodes:u,sourceNode:c(b.source),targetNode:c(b.target)}))}return p}function tc({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce((i,r)=>{const{handleBounds:l}=r;let a=[],s=[];return l&&(a=Ko(r,l,"source",`${t}-${n}-${o}`),s=Ko(r,l,"target",`${t}-${n}-${o}`)),i.push(...a,...s),i},[])}function uo(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function nc(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}const oc=["production","prod"];function Bt(e,...t){cr()&&console.warn(`[Vue Flow]: ${e}`,...t)}function cr(){return!oc.includes("production")}function Jo(e,t,n){const o=t.querySelectorAll(`.vue-flow__handle${e}`);if(!o||!o.length)return;const i=Array.from(o),r=t.getBoundingClientRect();return i.map(l=>{const a=l.getBoundingClientRect();return A({id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(a.left-r.left)/n,y:(a.top-r.top)/n},pn(l))})}function Un(e,t,n,o,i,r=!1,l){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),Pe(()=>{l.blur()})):n([e])}function be(e){return typeof ne(e)!="undefined"}function ic(e,t,n,o){var r;if(!e||!e.source||!e.target)return n(new Ee(xe.EDGE_INVALID,(r=e==null?void 0:e.id)!=null?r:"[ID UNKNOWN]")),!1;let i;return Ue(e)?i=e:i=re(A({},e),{id:tr(e)}),i=ji(i,void 0,o),Fu(i,t)?!1:i}function rc(e,t,n,o,i,r){if(!t.source||!t.target)return r(new Ee(xe.EDGE_INVALID,e.id)),!1;const l=o(e.id);if(!l)return r(new Ee(xe.EDGE_NOT_FOUND,e.id)),!1;const c=e,{id:a}=c,s=We(c,["id"]),u=re(A({},s),{id:i?tr(t):a,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle});return n.splice(n.indexOf(l),1,u),u}function Qo(e,t,n,o){const i={},r=e.reduce((a,s,u)=>{if(!et(s))return o(new Ee(xe.NODE_INVALID,s==null?void 0:s.id)||`[ID UNKNOWN|INDEX ${u}]`),a;const c=Hu(s,n(s.id),s.parentNode);return s.parentNode&&(i[s.parentNode]=!0),a.concat(c)},[]),l=[...r,...t];for(const a of r){const s=l.find(u=>u.id===a.parentNode);a.parentNode&&!s&&o(new Ee(xe.NODE_MISSING_PARENT,a.id,a.parentNode)),(a.parentNode||i[a.id])&&(i[a.id]&&(a.isParent=!0),s&&(s.isParent=!0))}return r}function jo(e,t){e.clear();for(const n of t){const{id:o,source:i,target:r,sourceHandle:l=null,targetHandle:a=null}=n,s=`${i}-source-${l}`,u=`${r}-target-${a}`,c=e.get(s)||new Map,f=e.get(u)||new Map,h=ft({edgeId:o,source:i,target:r,sourceHandle:l,targetHandle:a});e.set(s,c.set(`${r}-${a}`,h)),e.set(u,f.set(`${i}-${l}`,h))}}function ei(e,t,n){if(!n)return;const o=[];for(const i of e.keys())t.has(i)||o.push(e.get(i));o.length&&n(o)}function lc(e,t){if(!e&&!t)return!0;if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function ti(e,t,n,o,i,r,l,a){const s=[];for(const u of e){const c=Ue(u)?u:ic(u,a,i,r);if(!c)continue;const f=n(c.source),h=n(c.target);if(!f||!h){i(new Ee(xe.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!f){i(new Ee(xe.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!h){i(new Ee(xe.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:a,nodes:l,sourceNode:f,targetNode:h})){i(new Ee(xe.EDGE_INVALID,c.id));continue}const g=o(c.id);s.push(re(A({},ji(c,g,r)),{sourceNode:f,targetNode:h}))}return s}function ac(){return{edgesChange:V(),nodesChange:V(),nodeDoubleClick:V(),nodeClick:V(),nodeMouseEnter:V(),nodeMouseMove:V(),nodeMouseLeave:V(),nodeContextMenu:V(),nodeDragStart:V(),nodeDrag:V(),nodeDragStop:V(),nodesInitialized:V(),miniMapNodeClick:V(),miniMapNodeDoubleClick:V(),miniMapNodeMouseEnter:V(),miniMapNodeMouseMove:V(),miniMapNodeMouseLeave:V(),connect:V(),connectStart:V(),connectEnd:V(),clickConnectStart:V(),clickConnectEnd:V(),paneReady:V(),init:V(),move:V(),moveStart:V(),moveEnd:V(),selectionDragStart:V(),selectionDrag:V(),selectionDragStop:V(),selectionContextMenu:V(),selectionStart:V(),selectionEnd:V(),viewportChangeStart:V(),viewportChange:V(),viewportChangeEnd:V(),paneScroll:V(),paneClick:V(),paneContextMenu:V(),paneMouseEnter:V(),paneMouseMove:V(),paneMouseLeave:V(),edgeContextMenu:V(),edgeMouseEnter:V(),edgeMouseMove:V(),edgeMouseLeave:V(),edgeDoubleClick:V(),edgeClick:V(),edgeUpdateStart:V(),edgeUpdate:V(),edgeUpdateEnd:V(),updateNodeInternals:V(),error:V(e=>Bt(e.message))}}function sc(e,t){$r(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),cn(()=>{o.off(i)})}})}function dr(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:io.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:It.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:Ke.Bezier,style:{}},connectionMode:lt.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:an()?"Meta":"Control",zoomActivationKeyCode:an()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:ac(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,disableKeyboardA11y:!1,ariaLiveMessage:""}}const uc=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function cc(e,t,n,o){const i=Bu(t),r=v=>{var O;const y=(O=v!=null?v:n.value)!=null?O:[];t.hooks.updateNodeInternals.trigger(y)},l=v=>Gu(v,t.nodes,t.edges),a=v=>Lu(v,t.nodes,t.edges),s=v=>lo(v,t.edges),u=v=>{if(v)return t.nodes&&!n.value.length?t.nodes.find(y=>y.id===v):t.nodes[n.value.indexOf(v)]},c=v=>{if(v)return t.edges&&!o.value.length?t.edges.find(y=>y.id===v):t.edges[o.value.indexOf(v)]},f=(v,y,O)=>{var U,ie;var z,X;const M=[];for(const de of v){const fe={id:de.id,type:"position",dragging:O,from:de.from};if(y&&(fe.position=de.position,de.parentNode)){const ye=u(de.parentNode);fe.position={x:fe.position.x-((U=(z=ye==null?void 0:ye.computedPosition)==null?void 0:z.x)!=null?U:0),y:fe.position.y-((ie=(X=ye==null?void 0:ye.computedPosition)==null?void 0:X.y)!=null?ie:0)}}M.push(fe)}M!=null&&M.length&&t.hooks.nodesChange.trigger(M)},h=v=>{if(!t.vueFlowRef)return;const y=t.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!y)return;const O=window.getComputedStyle(y),{m22:z}=new window.DOMMatrixReadOnly(O.transform),X=v.reduce((M,U)=>{const ie=u(U.id);if(ie){const de=pn(U.nodeElement);!!(de.width&&de.height&&(ie.dimensions.width!==de.width||ie.dimensions.height!==de.height||U.forceUpdate))&&(ie.handleBounds.source=Jo(".source",U.nodeElement,z),ie.handleBounds.target=Jo(".target",U.nodeElement,z),ie.dimensions=de,ie.initialized=!0,M.push({id:ie.id,type:"dimensions",dimensions:de}))}return M},[]);!t.fitViewOnInitDone&&t.fitViewOnInit&&Pe(()=>{i.value.fitView(),t.fitViewOnInitDone=!0}),X.length&&t.hooks.nodesChange.trigger(X)},g=(v,y)=>{const O=[];for(const M of v)O.push(M.id);let z=[],X=[];if(t.multiSelectionActive)for(const M of O)z.push(Re(M,y));else{const M=In([...t.nodes,...t.edges],O);z=M.changedNodes,X=M.changedEdges}z.length&&t.hooks.nodesChange.trigger(z),X.length&&t.hooks.edgesChange.trigger(X)},w=(v,y)=>{const O=[];for(const M of v)O.push(M.id);let z=[],X=[];if(t.multiSelectionActive)for(const M of O)X.push(Re(M,y));else{const M=In([...t.nodes,...t.edges],O);z=M.changedNodes,X=M.changedEdges}z.length&&t.hooks.nodesChange.trigger(z),X.length&&t.hooks.edgesChange.trigger(X)},x=(v,y)=>{const O=[],z=[];for(const U of v)et(U)?O.push(U.id):Ue(U)&&z.push(U.id);const{changedNodes:X,changedEdges:M}=In([...t.nodes,...t.edges],[...O,...z]);if(t.multiSelectionActive){for(const U of O)X.push(Re(U,y));for(const U of z)M.push(Re(U,y))}X.length&&t.hooks.nodesChange.trigger(X),M.length&&t.hooks.edgesChange.trigger(M)},d=v=>{g(v,!0)},p=v=>{w(v,!0)},_=v=>{x(v,!0)},N=v=>{if(!v.length)return g(v,!1);const y=[];for(const O of v)y.push(Re(O.id,!1));y.length&&t.hooks.nodesChange.trigger(y)},E=v=>{if(!v.length)return w(v,!1);const y=[];for(const O of v)y.push(Re(O.id,!1));y.length&&t.hooks.edgesChange.trigger(y)},T=v=>{if(!v||!v.length)return x([],!1);const y=v.reduce((O,z)=>{const X=Re(z.id,!1);return et(z)?O.nodes.push(X):O.edges.push(X),O},{nodes:[],edges:[]});y.nodes.length&&t.hooks.nodesChange.trigger(y.nodes),y.edges.length&&t.hooks.edgesChange.trigger(y.edges)},R=v=>{var y;(y=t.d3Zoom)==null||y.scaleExtent([v,t.maxZoom]),t.minZoom=v},b=v=>{var y;(y=t.d3Zoom)==null||y.scaleExtent([t.minZoom,v]),t.maxZoom=v},F=v=>{var y;(y=t.d3Zoom)==null||y.translateExtent(v),t.translateExtent=v},L=v=>{t.nodeExtent=v,r(n.value)},Z=v=>{t.nodesDraggable=v,t.nodesConnectable=v,t.elementsSelectable=v},P=v=>{const y=v instanceof Function?v(t.nodes):v;!t.initialized&&!y.length||(t.nodes=Qo(y,t.nodes,u,t.hooks.error.trigger))},Q=v=>{const y=v instanceof Function?v(t.edges):v;if(!t.initialized&&!y.length)return;const O=ti(y,t.isValidConnection,u,c,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges);jo(t.connectionLookup,O),t.edges=O},G=v=>{const y=v instanceof Function?v([...t.nodes,...t.edges]):v;!t.initialized&&!y.length||(P(y.filter(et)),Q(y.filter(Ue)))},m=v=>{let y=v instanceof Function?v(t.nodes):v;y=Array.isArray(y)?y:[y];const O=Qo(y,t.nodes,u,t.hooks.error.trigger),z=[];for(const X of O)z.push(Fo(X));z.length&&t.hooks.nodesChange.trigger(z)},I=v=>{let y=v instanceof Function?v(t.edges):v;y=Array.isArray(y)?y:[y];const O=ti(y,t.isValidConnection,u,c,t.hooks.error.trigger,t.defaultEdgeOptions,t.nodes,t.edges),z=[];for(const X of O)z.push(Fo(X));z.length&&t.hooks.edgesChange.trigger(z)},S=(v,y=!0,O=!1)=>{const z=v instanceof Function?v(t.nodes):v,X=Array.isArray(z)?z:[z],M=[],U=[];function ie(fe){const ye=s(fe);for(const Se of ye)(!be(Se.deletable)||Se.deletable)&&U.push(Xo(Se.id,Se.source,Se.target,Se.sourceHandle,Se.targetHandle))}function de(fe){const ye=[];for(const Se of t.nodes)Se.parentNode===fe&&ye.push(Se);if(ye.length){for(const Se of ye)M.push(Yo(Se.id));y&&ie(ye);for(const Se of ye)de(Se.id)}}for(const fe of X){const ye=typeof fe=="string"?u(fe):fe;ye&&(be(ye.deletable)&&!ye.deletable||(M.push(Yo(ye.id)),y&&ie([ye]),O&&de(ye.id)))}U.length&&t.hooks.edgesChange.trigger(U),M.length&&t.hooks.nodesChange.trigger(M)},$=v=>{const y=v instanceof Function?v(t.edges):v,O=Array.isArray(y)?y:[y],z=[];for(const X of O){const M=typeof X=="string"?c(X):X;M&&(be(M.deletable)&&!M.deletable||z.push(Xo(typeof X=="string"?X:X.id,M.source,M.target,M.sourceHandle,M.targetHandle)))}t.hooks.edgesChange.trigger(z)},B=(v,y,O=!0)=>rc(v,y,t.edges,c,O,t.hooks.error.trigger),C=v=>Go(v,t.nodes),D=v=>{const y=Go(v,t.edges);return jo(t.connectionLookup,y),y},Y=(v,y,O={replace:!1})=>{const z=u(v);if(!z)return;const X=typeof y=="function"?y(z):y;O.replace?t.nodes.splice(t.nodes.indexOf(z),1,X):Object.assign(z,X)},q=(v,y,O={replace:!1})=>{Y(v,z=>{const X=typeof y=="function"?y(z):y;return O.replace?re(A({},z),{data:X}):re(A({},z),{data:A(A({},z.data),X)})},O)},ae=(v,y,O,z=!1)=>{z?t.connectionClickStartHandle=v:t.connectionStartHandle=v,t.connectionEndHandle=null,t.connectionStatus=null,y&&(t.connectionPosition=y)},H=(v,y=null,O=null)=>{t.connectionStartHandle&&(t.connectionPosition=v,t.connectionEndHandle=y,t.connectionStatus=O)},te=(v,y)=>{t.connectionPosition={x:Number.NaN,y:Number.NaN},t.connectionEndHandle=null,t.connectionStatus=null,y?t.connectionClickStartHandle=null:t.connectionStartHandle=null},k=v=>{const y=Vu(v),O=y?null:dt(v)?v:u(v.id);return!y&&!O?[null,null,y]:[y?v:Ro(O),O,y]},j=(v,y=!0,O=t.nodes)=>{const[z,X,M]=k(v);if(!z)return[];const U=[];for(const ie of O||t.nodes){if(!M&&(ie.id===X.id||!ie.computedPosition))continue;const de=Ro(ie),fe=Yn(de,z);(y&&fe>0||fe>=Number(z.width)*Number(z.height))&&U.push(ie)}return U},W=(v,y,O=!0)=>{const[z]=k(v);if(!z)return!1;const X=Yn(z,y);return O&&X>0||X>=Number(z.width)*Number(z.height)},K=v=>{const{viewport:y,dimensions:O,d3Zoom:z,d3Selection:X,translateExtent:M}=t;if(!z||!X||!v.x&&!v.y)return!1;const U=wt.translate(y.x+v.x,y.y+v.y).scale(y.zoom),ie=[[0,0],[O.width,O.height]],de=z.constrain()(U,ie,M),fe=t.viewport.x!==de.x||t.viewport.y!==de.y||t.viewport.zoom!==de.k;return z.transform(X,de),fe},ee=v=>{const y=v instanceof Function?v(t):v,O=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];be(y.defaultEdgeOptions)&&(t.defaultEdgeOptions=y.defaultEdgeOptions);const z=y.modelValue||y.nodes||y.edges?[]:void 0;z&&(y.modelValue&&z.push(...y.modelValue),y.nodes&&z.push(...y.nodes),y.edges&&z.push(...y.edges),G(z));const X=()=>{be(y.maxZoom)&&b(y.maxZoom),be(y.minZoom)&&R(y.minZoom),be(y.translateExtent)&&F(y.translateExtent)};for(const M of Object.keys(y)){const U=M,ie=y[U];![...uc,...O].includes(U)&&be(ie)&&(t[U]=ie)}jt(()=>t.d3Zoom).not.toBeNull().then(X),t.initialized||(t.initialized=!0)};return{updateNodePositions:f,updateNodeDimensions:h,setElements:G,setNodes:P,setEdges:Q,addNodes:m,addEdges:I,removeNodes:S,removeEdges:$,findNode:u,findEdge:c,updateEdge:B,updateNode:Y,updateNodeData:q,applyEdgeChanges:D,applyNodeChanges:C,addSelectedElements:_,addSelectedNodes:d,addSelectedEdges:p,setMinZoom:R,setMaxZoom:b,setTranslateExtent:F,setNodeExtent:L,removeSelectedElements:T,removeSelectedNodes:N,removeSelectedEdges:E,startConnection:ae,updateConnection:H,endConnection:te,setInteractive:Z,setState:ee,getIntersectingNodes:j,getIncomers:l,getOutgoers:a,getConnectedEdges:s,isNodeIntersecting:W,panBy:K,fitView:v=>i.value.fitView(v),zoomIn:v=>i.value.zoomIn(v),zoomOut:v=>i.value.zoomOut(v),zoomTo:(v,y)=>i.value.zoomTo(v,y),setViewport:(v,y)=>i.value.setViewport(v,y),setTransform:(v,y)=>i.value.setTransform(v,y),getViewport:()=>i.value.getViewport(),getTransform:()=>i.value.getTransform(),setCenter:(v,y,O)=>i.value.setCenter(v,y,O),fitBounds:(v,y)=>i.value.fitBounds(v,y),project:v=>i.value.project(v),screenToFlowCoordinate:v=>i.value.screenToFlowCoordinate(v),flowToScreenCoordinate:v=>i.value.flowToScreenCoordinate(v),toObject:()=>{const v=[],y=[];for(const X of t.nodes){const O=X,{computedPosition:M,handleBounds:U,selected:ie,dimensions:de,isParent:fe,resizing:ye,dragging:Se,initialized:Rt,events:xt}=O,Ye=We(O,["computedPosition","handleBounds","selected","dimensions","isParent","resizing","dragging","initialized","events"]);v.push(Ye)}for(const X of t.edges){const z=X,{selected:M,sourceNode:U,targetNode:ie,events:de}=z,fe=We(z,["selected","sourceNode","targetNode","events"]);y.push(fe)}return JSON.parse(JSON.stringify({nodes:v,edges:y,position:[t.viewport.x,t.viewport.y],zoom:t.viewport.zoom,viewport:t.viewport}))},fromObject:v=>new Promise(y=>{const{nodes:O,edges:z,position:X,zoom:M,viewport:U}=v;if(O&&P(O),z&&Q(z),U!=null&&U.x&&(U!=null&&U.y)||X){const ie=(U==null?void 0:U.x)||X[0],de=(U==null?void 0:U.y)||X[1],fe=(U==null?void 0:U.zoom)||M||t.viewport.zoom;return jt(()=>i.value.viewportInitialized).toBe(!0).then(()=>{i.value.setViewport({x:ie,y:de,zoom:fe}).then(()=>{y(!0)})})}else y(!0)}),updateNodeInternals:r,viewportHelper:i,$reset:()=>{var y,O,z;const v=dr();if(t.edges=[],t.nodes=[],t.d3Zoom&&t.d3Selection){const X=wt.translate((y=v.defaultViewport.x)!=null?y:0,(O=v.defaultViewport.y)!=null?O:0).scale(at((z=v.defaultViewport.zoom)!=null?z:1,v.minZoom,v.maxZoom)),M=t.viewportRef.getBoundingClientRect(),U=[[0,0],[M.width,M.height]],ie=t.d3Zoom.constrain()(X,U,v.translateExtent);t.d3Zoom.transform(t.d3Selection,ie)}ee(v)},$destroy:()=>{}}}const dc=["data-id","data-handleid","data-nodeid","data-handlepos"],fc={name:"Handle",compatConfig:{MODE:3}},sn=we(re(A({},fc),{props:{id:{},type:{},position:{default:()=>J.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=ci(e,["position","connectable","connectableStart","connectableEnd","id"]),o=Ne(()=>{var P;return(P=n.type)!=null?P:"source"}),i=Ne(()=>{var P;return(P=n.isValidConnection)!=null?P:null}),{connectionStartHandle:r,connectionClickStartHandle:l,connectionEndHandle:a,vueFlowRef:s,nodesConnectable:u,noDragClassName:c,noPanClassName:f}=_e(),{id:h,node:g,nodeEl:w,connectedEdges:x}=Pu(),d=ge(),p=Ne(()=>{var P;return(P=e.id)!=null?P:`${h}__handle-${e.position}`}),_=Ne(()=>typeof e.connectableStart!="undefined"?e.connectableStart:!0),N=Ne(()=>typeof e.connectableEnd!="undefined"?e.connectableEnd:!0),E=Ne(()=>{var P,Q,G,m,I,S;return((P=r.value)==null?void 0:P.nodeId)===h&&((Q=r.value)==null?void 0:Q.handleId)===p.value&&((G=r.value)==null?void 0:G.type)===o.value||((m=a.value)==null?void 0:m.nodeId)===h&&((I=a.value)==null?void 0:I.handleId)===p.value&&((S=a.value)==null?void 0:S.type)===o.value}),T=Ne(()=>{var P,Q,G;return((P=l.value)==null?void 0:P.nodeId)===h&&((Q=l.value)==null?void 0:Q.handleId)===p.value&&((G=l.value)==null?void 0:G.type)===o.value}),{handlePointerDown:R,handleClick:b}=Ki({nodeId:h,handleId:p,isValidConnection:i,type:o}),F=ce(()=>typeof e.connectable=="string"&&e.connectable==="single"?!x.value.some(P=>{const Q=P[`${o.value}Handle`];return P[o.value]!==h?!1:Q?Q===p.value:!0}):typeof e.connectable=="number"?x.value.filter(P=>{const Q=P[`${o.value}Handle`];return P[o.value]!==h?!1:Q?Q===p.value:!0}).lengthg.initialized).toBe(!0,{flush:"post"}).then(()=>{var C;var P;const Q=(P=g.handleBounds[o.value])==null?void 0:P.find(D=>D.id===p.value);if(!s.value||Q)return;const G=s.value.querySelector(".vue-flow__transformationpane");if(!w.value||!d.value||!G||!p.value)return;const m=w.value.getBoundingClientRect(),I=d.value.getBoundingClientRect(),S=window.getComputedStyle(G),{m22:$}=new window.DOMMatrixReadOnly(S.transform),B=A({id:p.value,position:e.position,x:(I.left-m.left)/$,y:(I.top-m.top)/$},pn(d.value));g.handleBounds[o.value]=[...(C=g.handleBounds[o.value])!=null?C:[],B]}),di(()=>{const P=g.handleBounds[o.value];P&&(g.handleBounds[o.value]=P.filter(Q=>Q.id!==p.value))});function L(P){const Q=so(P);F.value&&_.value&&(Q&&P.button===0||!Q)&&R(P)}function Z(P){!h||!l.value&&!_.value||F.value&&b(P)}return t({handleClick:b,handlePointerDown:R,onClick:Z,onPointerDown:L}),(P,Q)=>(se(),pe("div",{ref_key:"handle",ref:d,"data-id":`${ne(h)}-${p.value}-${o.value}`,"data-handleid":p.value,"data-nodeid":ne(h),"data-handlepos":P.position,class:nt(["vue-flow__handle",[`vue-flow__handle-${P.position}`,`vue-flow__handle-${p.value}`,ne(c),ne(f),o.value,{connectable:F.value,connecting:T.value,connectablestart:_.value,connectableend:N.value,connectionindicator:F.value&&(_.value&&!E.value||N.value&&E.value)}]]),onMousedown:L,onTouchstartPassive:L,onClick:Z},[Ge(P.$slots,"default",{id:P.id})],42,dc))}})),mn=function({sourcePosition:e=J.Bottom,targetPosition:t=J.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:l}){const a=l.label||n;return[ve(sn,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof a!="string"&&a?ve(a):ve("div",{innerHTML:a}),ve(sn,{type:"source",position:e,connectable:o,isValidConnection:r})]};mn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];mn.inheritAttrs=!1;mn.compatConfig={MODE:3};const hc=mn,yn=function({targetPosition:e=J.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[ve(sn,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?ve(r):ve("div",{innerHTML:r})]};yn.props=["targetPosition","label","isValidTargetPos","connectable","data"];yn.inheritAttrs=!1;yn.compatConfig={MODE:3};const gc=yn,_n=function({sourcePosition:e=J.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?ve(r):ve("div",{innerHTML:r}),ve(sn,{type:"source",position:e,connectable:n,isValidConnection:o})]};_n.props=["sourcePosition","label","isValidSourcePos","connectable","data"];_n.inheritAttrs=!1;_n.compatConfig={MODE:3};const vc=_n,pc=["transform"],mc=["width","height","x","y","rx","ry"],yc=["y"],_c={name:"EdgeText",compatConfig:{MODE:3}},wc=we(re(A({},_c),{props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=ge({x:0,y:0,width:0,height:0}),n=ge(null),o=ce(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);st(i),he([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,l)=>(se(),pe("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(se(),pe("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:Oe(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,mc)):Te("",!0),mt("text",Dr(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[Ge(r.$slots,"default",{},()=>[typeof r.label!="string"?(se(),ot(Tr(r.label),{key:0})):(se(),pe(it,{key:1},[kr(Dn(r.label),1)],64))])],16,yc)],8,pc))}})),bc=["id","d","marker-end","marker-start"],xc=["d","stroke-width"],Ec={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},wn=we(re(A({},Ec),{props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},style:{},labelStyle:{},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=ci(e,["interactionWidth","labelShowBg"]),o=ge(null),i=ge(null),r=ge(null),l=Mr();return t({pathEl:o,interactionEl:i,labelEl:r}),(a,s)=>(se(),pe(it,null,[mt("path",{id:a.id,ref_key:"pathEl",ref:o,d:a.path,style:Oe(n.style),class:nt(["vue-flow__edge-path",ne(l).class]),"marker-end":a.markerEnd,"marker-start":a.markerStart},null,14,bc),a.interactionWidth?(se(),pe("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:a.path,"stroke-width":a.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,xc)):Te("",!0),a.label&&a.labelX&&a.labelY?(se(),ot(wc,{key:1,ref_key:"labelEl",ref:r,x:a.labelX,y:a.labelY,label:a.label,"label-show-bg":a.labelShowBg,"label-bg-style":a.labelBgStyle,"label-bg-padding":a.labelBgPadding,"label-bg-border-radius":a.labelBgBorderRadius,"label-style":a.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):Te("",!0)],64))}}));function fr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n=0?.5*e:t*25*Math.sqrt(-e)}function ni({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let l,a;switch(e){case J.Left:l=t-Ut(t-o,r),a=n;break;case J.Right:l=t+Ut(o-t,r),a=n;break;case J.Top:l=t,a=n-Ut(n-i,r);break;case J.Bottom:l=t,a=n+Ut(i-n,r);break}return[l,a]}function gr({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:o,targetY:i,targetPosition:r=J.Top,curvature:l=.25}){const[a,s]=ni({pos:n,x1:e,y1:t,x2:o,y2:i,c:l}),[u,c]=ni({pos:r,x1:o,y1:i,x2:e,y2:t,c:l}),[f,h,g,w]=hr({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:a,sourceControlY:s,targetControlX:u,targetControlY:c});return[`M${e},${t} C${a},${s} ${u},${c} ${o},${i}`,f,h,g,w]}function oi({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,l;switch(e){case J.Left:case J.Right:r=.5*(t+o),l=n;break;case J.Top:case J.Bottom:r=t,l=.5*(n+i);break}return[r,l]}function vr({sourceX:e,sourceY:t,sourcePosition:n=J.Bottom,targetX:o,targetY:i,targetPosition:r=J.Top}){const[l,a]=oi({pos:n,x1:e,y1:t,x2:o,y2:i}),[s,u]=oi({pos:r,x1:o,y1:i,x2:e,y2:t}),[c,f,h,g]=hr({sourceX:e,sourceY:t,targetX:o,targetY:i,sourceControlX:l,sourceControlY:a,targetControlX:s,targetControlY:u});return[`M${e},${t} C${l},${a} ${s},${u} ${o},${i}`,c,f,h,g]}const ii={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}};function Sc({source:e,sourcePosition:t=J.Bottom,target:n}){return t===J.Left||t===J.Right?e.xe[f]?-1:1)*S:p[f]=(u[f]>n[f]?-1:1)*S}}if(t!==o){const I=f==="x"?"y":"x",S=l[f]===a[I],$=s[I]>u[I],B=s[I]=m?(w=(P.x+Q.x)/2,x=g[0].y):(w=g[0].x,x=(P.y+Q.y)/2)}return[[e,{x:s.x+d.x,y:s.y+d.y},...g,{x:u.x+p.x,y:u.y+p.y},n],w,x,E,T]}function Mc(e,t,n,o){const i=Math.min(ri(e,t)/2,ri(t,n)/2,o),{x:r,y:l}=t;if(e.x===r&&r===n.x||e.y===l&&l===n.y)return`L${r} ${l}`;if(e.y===l){const u=e.x{let N;return _>0&&_{const[n,o,i]=Cc(e);return ve(wn,A(A({path:n,labelX:o,labelY:i},t),e))}}}),$c=Ic,Tc=we({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{var r,l;const[n,o,i]=Wn(re(A({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:J.Bottom,targetPosition:(l=e.targetPosition)!=null?l:J.Top}));return ve(wn,A(A({path:n,labelX:o,labelY:i},t),e))}}}),pr=Tc,kc=we({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>ve(pr,re(A(A({},e),t),{borderRadius:0}))}}),Dc=kc,Pc=we({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{var r,l;const[n,o,i]=gr(re(A({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:J.Bottom,targetPosition:(l=e.targetPosition)!=null?l:J.Top}));return ve(wn,A(A({path:n,labelX:o,labelY:i},t),e))}}}),Ac=Pc,Oc=we({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{var r,l;const[n,o,i]=vr(re(A({},e),{sourcePosition:(r=e.sourcePosition)!=null?r:J.Bottom,targetPosition:(l=e.targetPosition)!=null?l:J.Top}));return ve(wn,A(A({path:n,labelX:o,labelY:i},t),e))}}}),zc=Oc,Bc={input:vc,default:hc,output:gc},Rc={default:Ac,straight:$c,step:Dc,smoothstep:pr,simplebezier:zc};function Vc(e,t,n){const o=ce(()=>d=>e.nodes&&!t.value.length?e.nodes.find(p=>p.id===d):e.nodes[t.value.indexOf(d)]),i=ce(()=>d=>e.edges&&!n.value.length?e.edges.find(p=>p.id===d):e.edges[n.value.indexOf(d)]),r=ce(()=>{const d=A(A({},Rc),e.edgeTypes),p=Object.keys(d);for(const _ of e.edges)_.type&&!p.includes(_.type)&&(d[_.type]=_.type);return d}),l=ce(()=>{const d=A(A({},Bc),e.nodeTypes),p=Object.keys(d);for(const _ of e.nodes)_.type&&!p.includes(_.type)&&(d[_.type]=_.type);return d}),a=ce(()=>{const d=[];for(const p of e.nodes)p.hidden||d.push(p);return e.onlyRenderVisibleElements?rr(d,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):d}),s=(d,p,_)=>{if(p=p!=null?p:o.value(d.source),_=_!=null?_:o.value(d.target),!p||!_){e.hooks.error.trigger(new Ee(xe.EDGE_ORPHANED,d.id));return}return!d.hidden&&!_.hidden&&!p.hidden},u=ce(()=>{const d=[];for(const p of e.edges)s(p)&&d.push(p);if(e.onlyRenderVisibleElements){const p=[];for(const _ of d){const N=o.value(_.source),E=o.value(_.target);Qu({sourcePos:N.computedPosition||{x:0,y:0},targetPos:E.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:E.dimensions.width,targetHeight:E.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&p.push(_)}return p}return d}),c=ce(()=>[...a.value,...u.value]),f=ce(()=>{const d=[];for(const p of e.nodes)p.selected&&d.push(p);return d}),h=ce(()=>{const d=[];for(const p of e.edges)p.selected&&d.push(p);return d}),g=ce(()=>[...f.value,...h.value]),w=ce(()=>{const d=[];for(const p of e.nodes)p.initialized&&p.handleBounds!==void 0&&d.push(p);return d}),x=ce(()=>a.value.length>0&&w.value.length===a.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:l,getEdges:u,getNodes:a,getSelectedElements:g,getSelectedNodes:f,getSelectedEdges:h,getNodesInitialized:w,areNodesInitialized:x}}class qe{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var i;var t;const n=(t=un())==null?void 0:t.appContext.app,o=(i=n==null?void 0:n.config.globalProperties.$vueFlowStorage)!=null?i:qe.instance;return qe.instance=o!=null?o:new qe,n&&(n.config.globalProperties.$vueFlowStorage=qe.instance),qe.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=dr(),i=Er(o),r={};for(const[h,g]of Object.entries(i.hooks)){const w=`on${h.charAt(0).toUpperCase()+h.slice(1)}`;r[w]=g.on}const l={};for(const[h,g]of Object.entries(i.hooks))l[h]=g.trigger;const a=ce(()=>{const h=[];for(const g of i.nodes)h.push(g.id);return h}),s=ce(()=>{const h=[];for(const g of i.edges)h.push(g.id);return h}),u=Vc(i,a,s),c=cc(t,i,a,s);c.setState(A(A({},i),n));const f=re(A(A(A(A({},r),u),c),Gr(i)),{emits:l,id:t,vueFlowVersion:"1.34.1",$destroy:()=>{this.remove(t)}});return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}function _e(e){const t=qe.getInstance(),n=ui(),o=e==null?void 0:e.id,i=(n==null?void 0:n.vueFlowId)||o;let r;if(n){const l=bt(Bo,null);typeof l!="undefined"&&l!==null&&(r=l)}if(r||i&&(r=t.get(i)),!r||r&&o&&o!==r.id){const l=o!=null?o:t.getId(),a=t.create(l,e);r=a,(n!=null?n:si(!0)).run(()=>{he(a.applyDefault,(u,c,f)=>{const h=w=>{a.applyNodeChanges(w)},g=w=>{a.applyEdgeChanges(w)};u?(a.onNodesChange(h),a.onEdgesChange(g)):(a.hooks.value.nodesChange.off(h),a.hooks.value.edgesChange.off(g)),f(()=>{a.hooks.value.nodesChange.off(h),a.hooks.value.edgesChange.off(g)})},{immediate:!0}),cn(()=>{if(r){const u=t.get(r.id);u?u.$destroy():Bt(`No store instance found for id ${r.id} in storage.`)}})})}else e&&r.setState(e);return n&&(pt(Bo,r),n.vueFlowId=r.id),r}function Hc(e){const t=ro(),{emits:n,dimensions:o}=_e();let i;st(()=>{const r=e.value,l=()=>{if(!r)return;const a=pn(r);(a.width===0||a.height===0)&&n.error(new Ee(xe.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:a.width||500,height:a.height||500}};l(),t.addEventListener("resize",l),r&&(i=new ResizeObserver(()=>l()),i.observe(r)),Jn(()=>{t.removeEventListener("resize",l),i&&r&&i.unobserve(r)})})}const Lc={name:"UserSelection",compatConfig:{MODE:3}},Gc=we(re(A({},Lc),{props:{userSelectionRect:{}},setup(e){return(t,n)=>(se(),pe("div",{class:"vue-flow__selection vue-flow__container",style:Oe({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}})),Fc=["tabIndex"],Yc={name:"NodesSelection",compatConfig:{MODE:3}},Xc=we(re(A({},Yc),{setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:l}=_e(),a=Ji(),s=ge(null),u=Zi({el:s,onStart(w){t.selectionDragStart(w)},onDrag(w){t.selectionDrag(w)},onStop(w){t.selectionDragStop(w)}});st(()=>{var w;r.value||(w=s.value)==null||w.focus({preventScroll:!0})});const c=ce(()=>ir(o.value)),f=ce(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function h(w){t.selectionContextMenu({event:w,nodes:o.value})}function g(w){r||vt[w.key]&&a({x:vt[w.key].x,y:vt[w.key].y},w.shiftKey)}return(w,x)=>!ne(l)&&c.value.width&&c.value.height?(se(),pe("div",{key:0,class:nt(["vue-flow__nodesselection vue-flow__container",ne(i)]),style:Oe({transform:`translate(${ne(n).x}px,${ne(n).y}px) scale(${ne(n).zoom})`})},[mt("div",{ref_key:"el",ref:s,class:nt([{dragging:ne(u)},"vue-flow__nodesselection-rect"]),style:Oe(f.value),tabIndex:ne(r)?void 0:-1,onContextmenu:h,onKeydown:g},null,46,Fc)],6)):Te("",!0)}}));function li(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Zc={name:"Pane",compatConfig:{MODE:3}},Uc=we(re(A({},Zc),{props:{isSelecting:{type:Boolean}},setup(e){const{vueFlowRef:t,getNodes:n,getEdges:o,viewport:i,emits:r,userSelectionActive:l,removeSelectedElements:a,panOnDrag:s,userSelectionRect:u,elementsSelectable:c,nodesSelectionActive:f,addSelectedElements:h,getSelectedEdges:g,getSelectedNodes:w,removeNodes:x,removeEdges:d,selectionMode:p,deleteKeyCode:_,multiSelectionKeyCode:N,multiSelectionActive:E}=_e(),T=ge(null),R=ge(0),b=ge(0),F=ge(),L=Ne(()=>c.value&&(e.isSelecting||l.value));$t(_,C=>{if(!C)return;const D=n.value.reduce((Y,q)=>((!q.selected&&q.parentNode&&Y.find(ae=>ae.id===q.parentNode)||q.selected)&&Y.push(q),Y),[]);(D||g.value)&&(g.value.length>0&&d(g.value),D.length>0&&x(D),f.value=!1,a())},{actInsideInputWithModifier:!1}),$t(N,C=>{E.value=C});function Z(){l.value=!1,u.value=null,R.value=0,b.value=0}function P(C){C.target!==T.value||L.value||(r.paneClick(C),a(),f.value=!1)}function Q(C){var D;if(C.target===T.value){if(Array.isArray(s.value)&&((D=s.value)!=null&&D.includes(2))){C.preventDefault();return}r.paneContextMenu(C)}}function G(C){C.target===T.value&&r.paneScroll(C)}function m(C){if(F.value=t.value.getBoundingClientRect(),!L.value||!c||!e.isSelecting||C.button!==0||C.target!==T.value||!F.value)return;const{x:D,y:Y}=li(C,F.value);a(),u.value={width:0,height:0,startX:D,startY:Y,x:D,y:Y},l.value=!0,r.selectionStart(C)}function I(C){var k,j;if(!L.value)return r.paneMouseMove(C);if(!e.isSelecting||!F.value||!u.value)return;l.value||(l.value=!0),f.value&&(f.value=!1);const D=li(C,F.value),Y=(k=u.value.startX)!=null?k:0,q=(j=u.value.startY)!=null?j:0,ae=re(A({},u.value),{x:D.x0,Z(),r.selectionEnd(C))}function $(C){var D;if(!L.value)return r.paneMouseLeave(C);l.value&&(f.value=R.value>0,(D=r.selectionEnd)==null||D.call(r,C)),Z()}function B(C){L.value||r.paneMouseEnter(C)}return(C,D)=>(se(),pe("div",{ref_key:"container",ref:T,class:nt(["vue-flow__pane vue-flow__container",{selection:C.isSelecting}]),onClick:P,onContextmenu:Q,onWheelPassive:G,onMouseenter:B,onMousedown:m,onMousemove:I,onMouseup:S,onMouseleave:$},[Ge(C.$slots,"default"),ne(l)&&ne(u)?(se(),ot(Gc,{key:0,"user-selection-rect":ne(u)},null,8,["user-selection-rect"])):Te("",!0),ne(f)&&ne(w).length?(se(),ot(Xc,{key:1})):Te("",!0)],34))}})),Wc={name:"Transform",compatConfig:{MODE:3}},Kc=we(re(A({},Wc),{setup(e){const{viewport:t}=_e();return(n,o)=>(se(),pe("div",{class:"vue-flow__transformationpane vue-flow__container",style:Oe({transform:`translate(${ne(t).x}px,${ne(t).y}px) scale(${ne(t).zoom})`})},[Ge(n.$slots,"default")],4))}})),qc={name:"Viewport",compatConfig:{MODE:3}},Jc=we(re(A({},qc),{setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:l,panActivationKeyCode:a,panOnScroll:s,panOnScrollMode:u,panOnScrollSpeed:c,panOnDrag:f,zoomOnDoubleClick:h,zoomOnPinch:g,zoomOnScroll:w,preventScrolling:x,noWheelClassName:d,noPanClassName:p,emits:_,connectionStartHandle:N,userSelectionActive:E,paneDragging:T,d3Zoom:R,d3Selection:b,d3ZoomHandler:F,viewport:L,viewportRef:Z}=_e();Hc(Z);const P=ge(!1),Q=ge(!1);let G=null,m=!1,I=0,S={x:0,y:0,zoom:0};const $=$t(a),B=$t(l),C=$t(r),D=Ne(()=>$.value||f.value),Y=Ne(()=>$.value||s.value),q=Ne(()=>B.value||l.value===!0&&D.value!==!0);st(()=>{var O,z,X;if(!Z.value){Bt("Viewport element is missing");return}const W=Z.value,K=W.getBoundingClientRect(),ee=Eu().scaleExtent([t.value,n.value]).translateExtent(i.value),oe=Ie(W).call(ee),le=oe.on("wheel.zoom"),me=wt.translate((O=o.value.x)!=null?O:0,(z=o.value.y)!=null?z:0).scale(at((X=o.value.zoom)!=null?X:1,t.value,n.value)),v=[[0,0],[K.width,K.height]],y=ee.constrain()(me,v,i.value);ee.transform(oe,y),ee.wheelDelta(H),R.value=ee,b.value=oe,F.value=le,L.value={x:y.x,y:y.y,zoom:y.k},ee.on("start",M=>{var U;if(!M.sourceEvent)return null;I=M.sourceEvent.button,P.value=!0;const ie=k(M.transform);((U=M.sourceEvent)==null?void 0:U.type)==="mousedown"&&(T.value=!0),S=ie,_.viewportChangeStart(ie),_.moveStart({event:M,flowTransform:ie})}),ee.on("end",M=>{if(!M.sourceEvent)return null;if(P.value=!1,T.value=!1,ae(D.value,I!=null?I:0)&&!m&&_.paneContextMenu(M.sourceEvent),m=!1,te(S,M.transform)){const U=k(M.transform);S=U,_.viewportChangeEnd(U),_.moveEnd({event:M,flowTransform:U})}}),ee.filter(M=>{var U,ie;const de=C.value||w.value,fe=g.value&&M.ctrlKey;if((D.value===!0||Array.isArray(D.value)&&D.value.includes(1))&&M.button===1&&M.type==="mousedown"&&((U=M.target)!=null&&U.closest(".vue-flow__node")||(ie=M.target)!=null&&ie.closest(".vue-flow__edge")))return!0;if(!D.value&&!de&&!Y.value&&!h.value&&!g.value||E.value||!h.value&&M.type==="dblclick"||j(M,d.value)&&M.type==="wheel"||j(M,p.value)&&(M.type!=="wheel"||Y.value&&M.type==="wheel"&&!C.value)||!g.value&&M.ctrlKey&&M.type==="wheel"||!de&&!Y.value&&!fe&&M.type==="wheel"||!D.value&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(D.value)&&!D.value.includes(M.button)&&(M.type==="mousedown"||M.type==="touchstart"))return!1;const ye=Array.isArray(D.value)&&D.value.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&ye}),he([E,D],()=>{E.value&&!P.value?ee.on("zoom",null):E.value||ee.on("zoom",M=>{L.value={x:M.transform.x,y:M.transform.y,zoom:M.transform.k};const U=k(M.transform);m=ae(D.value,I!=null?I:0),_.viewportChange(U),_.move({event:M,flowTransform:U})})},{immediate:!0}),he([E,Y,u,C,g,x,d],()=>{Y.value&&!C.value&&!E.value?oe.on("wheel.zoom",M=>{if(j(M,d.value))return!1;const U=C.value||w.value,ie=g.value&&M.ctrlKey;if(!(!x.value||Y.value||U||ie))return!1;M.preventDefault(),M.stopImmediatePropagation();const fe=oe.property("__zoom").k||1,ye=an();if(M.ctrlKey&&g.value&&ye){const mr=De(M),yr=H(M),_r=fe*ut(2,yr);ee.scaleTo(oe,_r,mr,M);return}const Se=M.deltaMode===1?20:1;let Rt=u.value===It.Vertical?0:M.deltaX*Se,xt=u.value===It.Horizontal?0:M.deltaY*Se;!ye&&M.shiftKey&&u.value!==It.Vertical&&!Rt&&xt&&(Rt=xt,xt=0),ee.translateBy(oe,-(Rt/fe)*c.value,-(xt/fe)*c.value);const Ye=k(oe.property("__zoom"));G&&clearTimeout(G),Q.value?(_.move({event:M,flowTransform:Ye}),_.viewportChange(Ye),G=setTimeout(()=>{_.moveEnd({event:M,flowTransform:Ye}),_.viewportChangeEnd(Ye),Q.value=!1},150)):(Q.value=!0,_.moveStart({event:M,flowTransform:Ye}),_.viewportChangeStart(Ye))},{passive:!1}):typeof le!="undefined"&&oe.on("wheel.zoom",function(M,U){const ie=!x.value&&M.type==="wheel"&&!M.ctrlKey,de=C.value||w.value,fe=g.value&&M.ctrlKey;if(!de&&!s.value&&!fe&&M.type==="wheel"||ie||j(M,d.value))return null;M.preventDefault(),le.call(this,M,U)},{passive:!1})},{immediate:!0})});function ae(W,K){return K===2&&Array.isArray(W)&&W.includes(2)}function H(W){const K=W.ctrlKey&&an()?10:1;return-W.deltaY*(W.deltaMode===1?.05:W.deltaMode?1:.002)*K}function te(W,K){return W.x!==K.x&&!Number.isNaN(K.x)||W.y!==K.y&&!Number.isNaN(K.y)||W.zoom!==K.k&&!Number.isNaN(K.k)}function k(W){return{x:W.x,y:W.y,zoom:W.k}}function j(W,K){return W.target.closest(`.${K}`)}return(W,K)=>(se(),pe("div",{ref_key:"viewportRef",ref:Z,class:"vue-flow__viewport vue-flow__container"},[He(Uc,{"is-selecting":q.value,class:nt({connecting:!!ne(N),dragging:ne(T),draggable:D.value})},{default:kn(()=>[He(Kc,null,{default:kn(()=>[Ge(W.$slots,"default")]),_:3})]),_:3},8,["is-selecting","class"])],512))}})),Qc=["id"],jc=["id"],ed=["id"],td={name:"A11yDescriptions",compatConfig:{MODE:3}},nd=we(re(A({},td),{setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=_e();return(i,r)=>(se(),pe(it,null,[mt("div",{id:`${ne(Fi)}-${ne(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+Dn(ne(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,Qc),mt("div",{id:`${ne(Yi)}-${ne(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,jc),ne(n)?Te("",!0):(se(),pe("div",{key:0,id:`${ne(Cu)}-${ne(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%)"}},Dn(ne(o)),9,ed))],64))}}));function od(){const e=_e();he(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function id(e,t,n){return n===J.Left?e-t:n===J.Right?e+t:e}function rd(e,t,n){return n===J.Top?e-t:n===J.Bottom?e+t:e}const co=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=J.Top,type:i}){return ve("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:id(t,e,o),cy:rd(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};co.props=["radius","centerX","centerY","position","type"];co.compatConfig={MODE:3};const ai=co,ld=we({name:"Edge",compatConfig:{MODE:3},props:["name","type","id","updatable","selectable","focusable","edge"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:l,noPanClassName:a,getEdgeTypes:s,removeSelectedEdges:u,findEdge:c,findNode:f,isValidConnection:h,multiSelectionActive:g,disableKeyboardA11y:w}=_e(),x=ku(e.edge,r),d=Ct(e,"edge"),p=ge(!1),_=ge(!1),N=ge(""),E=ge(null),T=ge("source"),R=ge(null);pt(Iu,e.id),pt($u,R);const b=ce(()=>d.value.class instanceof Function?d.value.class(d.value):d.value.class),F=ce(()=>d.value.style instanceof Function?d.value.style(d.value):d.value.style),{handlePointerDown:L}=Ki({nodeId:N,handleId:E,type:T,isValidConnection:h,edgeUpdaterType:T,onEdgeUpdate:Q,onEdgeUpdateEnd:G});return()=>{const H=f(d.value.source),te=f(d.value.target),k="pathOptions"in d.value?d.value.pathOptions:{};if(!H&&!te)return r.error(new Ee(xe.EDGE_SOURCE_TARGET_MISSING,d.value.id,d.value.source,d.value.target)),null;if(!H)return r.error(new Ee(xe.EDGE_SOURCE_MISSING,d.value.id,d.value.source)),null;if(!te)return r.error(new Ee(xe.EDGE_TARGET_MISSING,d.value.id,d.value.target)),null;if(!d||H.hidden||te.hidden)return null;let j;o.value===lt.Strict?j=H.handleBounds.source:j=[...H.handleBounds.source||[],...H.handleBounds.target||[]];const W=Uo(j,d.value.sourceHandle);let K;o.value===lt.Strict?K=te.handleBounds.target:K=[...te.handleBounds.target||[],...te.handleBounds.source||[]];const ee=Uo(K,d.value.targetHandle),oe=W?W.position:J.Bottom,le=ee?ee.position:J.Top,{sourceX:me,sourceY:v,targetY:y,targetX:O}=Ju(H,W,oe,te,ee,le);return d.value.sourceX=me,d.value.sourceY=v,d.value.targetX=O,d.value.targetY=y,ve("g",{ref:R,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${e.type===!1?"default":e.name}`,a.value,b.value,{updating:p.value,selected:d.value.selected,animated:d.value.animated,inactive:!e.selectable}],onClick:I,onContextmenu:S,onDblclick:$,onMouseenter:B,onMousemove:C,onMouseleave:D,onKeyDown:e.focusable?ae:void 0,tabIndex:e.focusable?0:void 0,"aria-label":d.value.ariaLabel===null?void 0:d.value.ariaLabel||`Edge from ${d.value.source} to ${d.value.target}`,"aria-describedby":e.focusable?`${Yi}-${t}`:void 0,role:e.focusable?"button":"img"},[_.value?null:ve(e.type===!1?s.value.default:e.type,A({id:e.id,sourceNode:H,targetNode:te,source:d.value.source,target:d.value.target,type:d.value.type,updatable:e.updatable,selected:d.value.selected,animated:d.value.animated,label:d.value.label,labelStyle:d.value.labelStyle,labelShowBg:d.value.labelShowBg,labelBgStyle:d.value.labelBgStyle,labelBgPadding:d.value.labelBgPadding,labelBgBorderRadius:d.value.labelBgBorderRadius,data:d.value.data,events:A(A({},d.value.events),x.on),style:F.value,markerStart:`url('#${Qe(d.value.markerStart,t)}')`,markerEnd:`url('#${Qe(d.value.markerEnd,t)}')`,sourcePosition:oe,targetPosition:le,sourceX:me,sourceY:v,targetX:O,targetY:y,sourceHandleId:d.value.sourceHandle,targetHandleId:d.value.targetHandle,interactionWidth:d.value.interactionWidth},k)),[e.updatable==="source"||e.updatable===!0?[ve("g",{onMousedown:Y,onMouseenter:Z,onMouseout:P},ve(ai,{position:oe,centerX:me,centerY:v,radius:i.value,type:"source","data-type":"source"}))]:null,e.updatable==="target"||e.updatable===!0?[ve("g",{onMousedown:q,onMouseenter:Z,onMouseout:P},ve(ai,{position:le,centerX:O,centerY:y,radius:i.value,type:"target","data-type":"target"}))]:null]])};function Z(){p.value=!0}function P(){p.value=!1}function Q(H,te){x.emit.update({event:H,edge:d.value,connection:te})}function G(H){x.emit.updateEnd({event:H,edge:d.value}),_.value=!1}function m(H,te){var k;H.button===0&&(_.value=!0,N.value=te?d.value.target:d.value.source,E.value=(k=te?d.value.targetHandle:d.value.sourceHandle)!=null?k:"",T.value=te?"target":"source",x.emit.updateStart({event:H,edge:d.value}),L(H))}function I(H){var te;const k={event:H,edge:d.value};e.selectable&&(l.value=!1,d.value.selected&&g.value?(u([d.value]),(te=R.value)==null||te.blur()):n([d.value])),x.emit.click(k)}function S(H){x.emit.contextMenu({event:H,edge:d.value})}function $(H){x.emit.doubleClick({event:H,edge:d.value})}function B(H){x.emit.mouseEnter({event:H,edge:d.value})}function C(H){x.emit.mouseMove({event:H,edge:d.value})}function D(H){x.emit.mouseLeave({event:H,edge:d.value})}function Y(H){m(H,!0)}function q(H){m(H,!1)}function ae(H){var te;!w.value&&Xi.includes(H.key)&&e.selectable&&(H.key==="Escape"?((te=R.value)==null||te.blur(),u([c(e.id)])):n([c(e.id)]))}}}),ad=ld,sd={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top},ud=we({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:l,connectionLineStyle:a,connectionLineOptions:s,connectionStatus:u,viewport:c,findNode:f}=_e(),h=(e=bt(vn))==null?void 0:e["connection-line"];return()=>{var C,D,Y;var g,w,x,d,p;if(!o.value)return null;const _=f(o.value.nodeId);if(!_)return null;const N=o.value.handleId,E=o.value.type,T=((g=i.value)==null?void 0:g.handleId)&&f(i.value.nodeId)||null,R=(r.value.x-c.value.x)/c.value.zoom,b=(r.value.y-c.value.y)/c.value.zoom,F=_.handleBounds;let L=F==null?void 0:F[E];if(n.value===lt.Loose&&(L=L||(F==null?void 0:F[E==="source"?"target":"source"])),!L)return null;const Z=(C=N?L.find(q=>q.id===N):L[0])!=null?C:null,P=(Z==null?void 0:Z.position)||J.Top,{x:Q,y:G}=Zn(P,A(A({},_.dimensions),_.computedPosition),Z),m=T&&((w=i.value)==null?void 0:w.handleId)&&((n.value===lt.Strict?(x=T.handleBounds[E==="source"?"target":"source"])==null?void 0:x.find(q=>{var ae;return q.id===((ae=i.value)==null?void 0:ae.handleId)}):(d=[...T.handleBounds.source||[],...T.handleBounds.target||[]])==null?void 0:d.find(q=>{var ae;return q.id===((ae=i.value)==null?void 0:ae.handleId)}))||((p=T.handleBounds[E!=null?E:"target"])==null?void 0:p[0]))||null,I=P?sd[P]:null;if(!P||!I)return null;const S=(Y=(D=l.value)!=null?D:s.value.type)!=null?Y:Ke.Bezier;let $="";const B={sourceX:Q,sourceY:G,sourcePosition:P,targetX:R,targetY:b,targetPosition:I};return S===Ke.Bezier?[$]=gr(B):S===Ke.Step?[$]=Wn(re(A({},B),{borderRadius:0})):S===Ke.SmoothStep?[$]=Wn(B):S===Ke.SimpleBezier?[$]=vr(B):$=`M${Q},${G} ${R},${b}`,ve("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},ve("g",{class:"vue-flow__connection"},h?ve(h,{sourceX:Q,sourceY:G,sourcePosition:P,targetX:R,targetY:b,targetPosition:I,sourceNode:_,sourceHandle:Z,targetNode:T,targetHandle:m,markerEnd:`url(#${Qe(s.value.markerEnd,t)})`,markerStart:`url(#${Qe(s.value.markerStart,t)})`,connectionStatus:u.value}):ve("path",{d:$,class:[s.value.class,u,"vue-flow__connection-path"],style:A(A({},a.value),s.value.style),"marker-end":`url(#${Qe(s.value.markerEnd,t)})`,"marker-start":`url(#${Qe(s.value.markerStart,t)})`})))}}}),cd=ud,dd=["id","markerWidth","markerHeight","markerUnits","orient"],fd={name:"MarkerType",compatConfig:{MODE:3}},hd=we(re(A({},fd),{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)=>(se(),pe("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===ne(Gn).ArrowClosed?(se(),pe("polyline",{key:0,style:Oe({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):Te("",!0),t.type===ne(Gn).Arrow?(se(),pe("polyline",{key:1,style:Oe({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):Te("",!0)],8,dd))}})),gd={name:"MarkerDefinitions",compatConfig:{MODE:3}},vd=we(re(A({},gd),{setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=_e(),r=ce(()=>{const l=[],a=[],s=u=>{if(u){const c=Qe(u,t);l.includes(c)||(typeof u=="object"?a.push(re(A({},u),{id:c,color:u.color||i.value})):a.push({id:c,color:i.value,type:u}),l.push(c))}};for(const u of[o.value.markerEnd,o.value.markerStart])s(u);return n.value.reduce((u,c)=>{for(const f of[c.markerStart,c.markerEnd])s(f);return u.sort((f,h)=>f.id.localeCompare(h.id))},a),a});return(l,a)=>(se(),pe("defs",null,[(se(!0),pe(it,null,qn(r.value,s=>(se(),ot(hd,{id:s.id,key:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,"stroke-width":s.strokeWidth,orient:s.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))]))}})),pd={class:"vue-flow__edges vue-flow__container"},md={name:"Edges",compatConfig:{MODE:3}},yd=we(re(A({},md),{setup(e){const t=bt(vn),{edgesUpdatable:n,edgesFocusable:o,elementsSelectable:i,findNode:r,getEdges:l,getEdgeTypes:a,elevateEdgesOnSelect:s,dimensions:u,emits:c}=_e(),f=un();function h(d){return typeof d=="undefined"?i.value:d}function g(d){return typeof d=="undefined"?n.value:d}function w(d){return typeof d=="undefined"?o.value:d}function x(d,p){const _=d||"default",N=t==null?void 0:t[`edge-${_}`];if(N)return N;let E=p!=null?p:a.value[_];if(typeof E=="string"&&f){const T=Object.keys(f.appContext.components);T&&T.includes(_)&&(E=fi(_,!1))}return E&&typeof E!="string"?E:(c.error(new Ee(xe.EDGE_TYPE_MISSING,E)),!1)}return(d,p)=>ne(u).width&&ne(u).height?(se(),pe(it,{key:0},[(se(),pe("svg",pd,[He(vd)])),(se(!0),pe(it,null,qn(ne(l),_=>(se(),pe("svg",{key:_.id,class:"vue-flow__edges vue-flow__container",style:Oe({zIndex:ne(ju)(_,ne(r),ne(s))})},[He(ne(ad),{id:_.id,edge:_,type:x(_.type,_.template),name:_.type||"default",selectable:h(_.selectable),updatable:g(_.updatable),focusable:w(_.focusable)},null,8,["id","edge","type","name","selectable","updatable","focusable"])],4))),128)),He(ne(cd))],64)):Te("",!0)}})),_d=we({name:"Node",compatConfig:{MODE:3},props:["name","type","id","draggable","selectable","focusable","connectable","node","resizeObserver"],setup(e){pt(Ui,e.id);const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:l,findNode:a,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:f,getIntersectingNodes:h,getNodeTypes:g,nodeExtent:w,elevateNodesOnSelect:x,disableKeyboardA11y:d,ariaLiveMessage:p,snapToGrid:_,snapGrid:N,nodeDragThreshold:E,getConnectedEdges:T}=_e(),R=Ji(),b=Ct(e,"node"),F=ce(()=>{var k;return a((k=b.value)==null?void 0:k.parentNode)}),L=ce(()=>T(b.value?[b.value]:[])),Z=ge(null);pt(Wi,Z);const{emit:P,on:Q}=Ou(b.value,l),G=Zi({id:e.id,el:Z,disabled:()=>!e.draggable,selectable:()=>e.selectable,dragHandle:()=>b.value.dragHandle,onStart(k){P.dragStart(re(A({},k),{intersections:h(b.value)}))},onDrag(k){P.drag(re(A({},k),{intersections:h(b.value)}))},onStop(k){P.dragStop(re(A({},k),{intersections:h(b.value)}))}}),m=ce(()=>b.value.class instanceof Function?b.value.class(b.value):b.value.class),I=ce(()=>{const k=(b.value.style instanceof Function?b.value.style(b.value):b.value.style)||{},j=b.value.width instanceof Function?b.value.width(b.value):b.value.width,W=b.value.height instanceof Function?b.value.height(b.value):b.value.height;return j&&(k.width=typeof j=="string"?j:`${j}px`),W&&(k.height=typeof W=="string"?W:`${W}px`),k}),S=Ne(()=>{var k,j;return Number((j=(k=b.value.zIndex)!=null?k:I.value.zIndex)!=null?j:0)});return f(k=>{k.includes(e.id)&&B()}),st(()=>{e.resizeObserver.observe(Z.value)}),Jn(()=>{e.resizeObserver.unobserve(Z.value)}),he([()=>b.value.type,()=>b.value.sourcePosition,()=>b.value.targetPosition],()=>{Pe(()=>{c([{id:e.id,nodeElement:Z.value,forceUpdate:!0}])})}),he([()=>b.value.position.x,()=>b.value.position.y,()=>{var k;return(k=F.value)==null?void 0:k.computedPosition.x},()=>{var k;return(k=F.value)==null?void 0:k.computedPosition.y},()=>{var k;return(k=F.value)==null?void 0:k.computedPosition.z},S,()=>b.value.selected,()=>b.value.dimensions.height,()=>b.value.dimensions.width,()=>{var k;return(k=F.value)==null?void 0:k.dimensions.height},()=>{var k;return(k=F.value)==null?void 0:k.dimensions.width}],([k,j,W,K,ee,oe])=>{const le={x:k,y:j,z:oe+(x.value&&b.value.selected?1e3:0)};typeof W!="undefined"&&typeof K!="undefined"?b.value.computedPosition=Zu({x:W,y:K,z:ee},le):b.value.computedPosition=le},{flush:"post",immediate:!0}),he([()=>b.value.extent,w],([k,j],[W,K])=>{(k!==W||j!==K)&&$()}),b.value.extent==="parent"||typeof b.value.extent=="object"&&"range"in b.value.extent&&b.value.extent.range==="parent"?jt(()=>b.value.initialized).toBe(!0).then($):$(),()=>{var k,j;return ve("div",{ref:Z,"data-id":b.value.id,class:["vue-flow__node",`vue-flow__node-${e.type===!1?"default":e.name}`,{[n.value]:e.draggable,dragging:G==null?void 0:G.value,draggable:e.draggable,selected:b.value.selected,selectable:e.selectable,parent:b.value.isParent},m.value],style:A({visibility:b.value.initialized?"visible":"hidden",zIndex:(k=b.value.computedPosition.z)!=null?k:S.value,transform:`translate(${b.value.computedPosition.x}px,${b.value.computedPosition.y}px)`,pointerEvents:e.selectable||e.draggable?"all":"none"},I.value),tabIndex:e.focusable?0:void 0,role:e.focusable?"button":void 0,"aria-describedby":d.value?void 0:`${Fi}-${t}`,"aria-label":b.value.ariaLabel,onMouseenter:C,onMousemove:D,onMouseleave:Y,onContextmenu:q,onClick:H,onDblclick:ae,onKeydown:te},[ve(e.type===!1?g.value.default:e.type,{id:b.value.id,type:b.value.type,data:b.value.data,events:A(A({},b.value.events),Q),selected:b.value.selected,resizing:b.value.resizing,dragging:G.value,connectable:e.connectable,position:b.value.computedPosition,dimensions:b.value.dimensions,isValidTargetPos:b.value.isValidTargetPos,isValidSourcePos:b.value.isValidSourcePos,parent:b.value.parentNode,parentNodeId:b.value.parentNode,zIndex:(j=b.value.computedPosition.z)!=null?j:S.value,targetPosition:b.value.targetPosition,sourcePosition:b.value.sourcePosition,label:b.value.label,dragHandle:b.value.dragHandle,onUpdateNodeInternals:B})])};function $(){const k=b.value.computedPosition;_.value&&(k.x=N.value[0]*Math.round(k.x/N.value[0]),k.y=N.value[1]*Math.round(k.y/N.value[1]));const{computedPosition:j,position:W}=ao(b.value,k,l.error,w.value,F.value);(b.value.computedPosition.x!==j.x||b.value.computedPosition.y!==j.y)&&(b.value.computedPosition=A(A({},b.value.computedPosition),j)),(b.value.position.x!==W.x||b.value.position.y!==W.y)&&(b.value.position=W)}function B(){Z.value&&c([{id:e.id,nodeElement:Z.value,forceUpdate:!0}])}function C(k){G!=null&&G.value||P.mouseEnter({event:k,node:b.value,connectedEdges:L.value})}function D(k){G!=null&&G.value||P.mouseMove({event:k,node:b.value,connectedEdges:L.value})}function Y(k){G!=null&&G.value||P.mouseLeave({event:k,node:b.value,connectedEdges:L.value})}function q(k){return P.contextMenu({event:k,node:b.value,connectedEdges:L.value})}function ae(k){return P.doubleClick({event:k,node:b.value,connectedEdges:L.value})}function H(k){e.selectable&&(!o.value||!e.draggable||E.value>0)&&Un(b.value,r.value,u,s,i,!1,Z.value),P.click({event:k,node:b.value,connectedEdges:L.value})}function te(k){if(!(Fn(k)||d.value))if(Xi.includes(k.key)&&e.selectable){const j=k.key==="Escape";Un(b.value,r.value,u,s,i,j,Z.value)}else e.draggable&&b.value.selected&&vt[k.key]&&(p.value=`Moved selected node ${k.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~b.value.position.x}, y: ${~~b.value.position.y}`,R({x:vt[k.key].x,y:vt[k.key].y},k.shiftKey))}}}),wd=_d,bd={height:"0",width:"0"},xd={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},Pd=we(re(A({},xd),{setup(e){const{viewportRef:t}=_e(),n=Ne(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(se(),pe("svg",null,[(se(),pe("foreignObject",bd,[(se(),ot(Cr,{to:n.value,disabled:!n.value},[Ge(o.$slots,"default")],8,["to","disabled"]))]))]))}}));function Ed(e={includeHiddenNodes:!1}){const{nodes:t}=_e();return ce(()=>{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 Sd={class:"vue-flow__nodes vue-flow__container"},Nd={name:"Nodes",compatConfig:{MODE:3}},Md=we(re(A({},Nd),{setup(e){const{nodes:t,nodesDraggable:n,nodesFocusable:o,elementsSelectable:i,nodesConnectable:r,getNodes:l,getNodeTypes:a,updateNodeDimensions:s,emits:u}=_e(),c=Ed(),f=bt(vn),h=ge(),g=un();he(c,N=>{N&&Pe(()=>{u.nodesInitialized(t.value)})},{immediate:!0}),st(()=>{h.value=new ResizeObserver(N=>{const E=N.map(T=>({id:T.target.getAttribute("data-id"),nodeElement:T.target,forceUpdate:!0}));Pe(()=>s(E))})}),Jn(()=>{var N;return(N=h.value)==null?void 0:N.disconnect()});function w(N){return typeof N=="undefined"?n.value:N}function x(N){return typeof N=="undefined"?i.value:N}function d(N){return typeof N=="undefined"?r.value:N}function p(N){return typeof N=="undefined"?o.value:N}function _(N,E){const T=N||"default",R=f==null?void 0:f[`node-${T}`];if(R)return R;let b=E!=null?E:a.value[T];if(typeof b=="string"&&g){const F=Object.keys(g.appContext.components);F&&F.includes(T)&&(b=fi(T,!1))}return b&&typeof b!="string"?b:(u.error(new Ee(xe.NODE_TYPE_MISSING,b)),!1)}return(N,E)=>(se(),pe("div",Sd,[h.value?(se(!0),pe(it,{key:0},qn(ne(l),T=>(se(),ot(ne(wd),{id:T.id,key:T.id,"resize-observer":h.value,type:_(T.type,T.template),name:T.type||"default",draggable:w(T.draggable),selectable:x(T.selectable),connectable:d(T.connectable),focusable:p(T.focusable),node:T},null,8,["id","resize-observer","type","name","draggable","selectable","connectable","focusable","node"]))),128)):Te("",!0)]))}}));function Cd(){const{emits:e}=_e();st(()=>{if(cr()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Ee(xe.MISSING_STYLES))}})}const Id=mt("div",{class:"vue-flow__edge-labels"},null,-1),$d={name:"VueFlow",compatConfig:{MODE:3}},Ad=we(re(A({},$d),{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=Ir(),r=Ct(o,"modelValue",n),l=Ct(o,"nodes",n),a=Ct(o,"edges",n),w=_e(o),{vueFlowRef:s,hooks:u,getNodeTypes:c,getEdgeTypes:f}=w,h=We(w,["vueFlowRef","hooks","getNodeTypes","getEdgeTypes"]),g=Ru({modelValue:r,nodes:l,edges:a},o,A({vueFlowRef:s,hooks:u,getNodeTypes:c,getEdgeTypes:f},h));return sc(n,u),od(),Cd(),pt(vn,i),di(()=>{g()}),t(A({vueFlowRef:s,hooks:u,getNodeTypes:c,getEdgeTypes:f},h)),(x,d)=>(se(),pe("div",{ref_key:"vueFlowRef",ref:s,class:"vue-flow"},[He(Jc,null,{default:kn(()=>[He(yd),Id,He(Md),Ge(x.$slots,"zoom-pane")]),_:3}),Ge(x.$slots,"default"),He(nd)],512))}})),Td={name:"Panel",compatConfig:{MODE:3}},Od=we(re(A({},Td),{props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=_e(),o=ce(()=>`${t.position}`.split("-"));return(i,r)=>(se(),pe("div",{class:nt(["vue-flow__panel",o.value]),style:Oe({pointerEvents:ne(n)?"none":"all"})},[Ge(i.$slots,"default")],6))}}));function zd(e){const{type:t,id:n,nodeId:o,onConnect:i,onDisconnect:r}=e,{connectionLookup:l}=_e(),a=qi(),s=Ne(()=>{var g;return(g=ue(o))!=null?g:a}),u=Ne(()=>ue(t)),c=Ne(()=>{var g;return(g=ue(n))!=null?g:null}),f=ge(null),h=ge();return he(()=>l.value.get(`${s.value}-${u.value}-${c.value}`),g=>{lc(h.value,g)||(h.value=g)},{immediate:!0}),he([h,()=>typeof i!="undefined",()=>typeof r!="undefined"],([g])=>{if(f.value&&f.value!==g){const w=g!=null?g:new Map;ei(f.value,w,r),ei(w,f.value,i)}f.value=g!=null?g:new Map},{immediate:!0}),ce(()=>{var w;var g;return Array.from((w=(g=h.value)==null?void 0:g.values())!=null?w:[])})}function Bd(e){const{findNode:t}=_e();return ce({get(){var i,r;const n=ue(e);if(!Array.isArray(n)){const l=t(n);return l?{id:l.id,type:l.type,data:(i=l.data)!=null?i:null}:null}const o=[];for(const l of n){const a=t(l);a&&o.push({id:a.id,type:a.type,data:(r=a.data)!=null?r:null})}return o},set(){Bt("You are trying to set node data via useNodesData. This is not supported.")}})}export{J as P,Od as _,Ad as a,zd as b,sn as c,Bd as d,wn as e,Pd as f,Wn as g,_e as u};