@stonecrop/node-editor 0.2.24 → 0.2.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,5 @@
1
- (function(ye,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],a):(ye=typeof globalThis<"u"?globalThis:ye||self,a(ye["@stonecrop/node-editor"]={},ye.Vue))})(this,function(ye,a){"use strict";var Dn;const jt=typeof window<"u",zr=e=>typeof e<"u",Ar=e=>typeof e=="boolean",ve=e=>typeof e=="function",we=e=>typeof e=="number",be=e=>typeof e=="string",Vr=()=>{};jt&&(Dn=window==null?void 0:window.navigator)!=null&&Dn.userAgent&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function ne(e){return typeof e=="function"?e():a.unref(e)}function Lr(e,t){function n(...o){return new Promise((r,i)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(r).catch(i)})}return n}const zn=e=>e();function Yr(e=zn){const t=a.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const r=(...i)=>{t.value&&e(...i)};return{isActive:a.readonly(t),pause:n,resume:o,eventFilter:r}}function An(e,t=!1,n="Timeout"){return new Promise((o,r)=>{setTimeout(t?()=>r(n):o,e)})}function Xr(e){return e}function Zt(e,t){let n,o,r;const i=a.ref(!0),l=()=>{i.value=!0,r()};a.watch(e,l,{flush:"sync"});const s=ve(t)?t:t.get,u=ve(t)?void 0:t.set,c=a.customRef((d,f)=>(o=d,r=f,{get(){return i.value&&(n=s(),i.value=!1),o(),n},set(p){u==null||u(p)}}));return Object.isExtensible(c)&&(c.trigger=l),c}function je(e){return a.getCurrentScope()?(a.onScopeDispose(e),!0):!1}function Gr(e,t=!0){a.getCurrentInstance()?a.onMounted(e):t?e():a.nextTick(e)}function Kt(e,t=!1){function n(f,{flush:p="sync",deep:b=!1,timeout:v,throwOnTimeout:x}={}){let k=null;const E=[new Promise(B=>{k=a.watch(e,G=>{f(G)!==t&&(k==null||k(),B(G))},{flush:p,deep:b,immediate:!0})})];return v!=null&&E.push(An(v,x).then(()=>ne(e)).finally(()=>k==null?void 0:k())),Promise.race(E)}function o(f,p){if(!a.isRef(f))return n(G=>G===f,p);const{flush:b="sync",deep:v=!1,timeout:x,throwOnTimeout:k}=p??{};let E=null;const B=[new Promise(G=>{E=a.watch([e,f],([w,P])=>{t!==(w===P)&&(E==null||E(),G(w))},{flush:b,deep:v,immediate:!0})})];return x!=null&&B.push(An(x,k).then(()=>ne(e)).finally(()=>(E==null||E(),ne(e)))),Promise.race(B)}function r(f){return n(p=>!!p,f)}function i(f){return o(null,f)}function l(f){return o(void 0,f)}function s(f){return n(Number.isNaN,f)}function u(f,p){return n(b=>{const v=Array.from(b);return v.includes(f)||v.includes(ne(f))},p)}function c(f){return d(1,f)}function d(f=1,p){let b=-1;return n(()=>(b+=1,b>=f),p)}return Array.isArray(ne(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Kt(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:r,toBeNull:i,toBeNaN:s,toBeUndefined:l,changed:c,changedTimes:d,get not(){return Kt(e,!t)}}}function ue(e){return Kt(e)}var Vn=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,Hr=Object.prototype.propertyIsEnumerable,Ur=(e,t)=>{var n={};for(var o in e)Fr.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&Vn)for(var o of Vn(e))t.indexOf(o)<0&&Hr.call(e,o)&&(n[o]=e[o]);return n};function jr(e,t,n={}){const o=n,{eventFilter:r=zn}=o,i=Ur(o,["eventFilter"]);return a.watch(e,Lr(r,t),i)}var Zr=Object.defineProperty,Kr=Object.defineProperties,Wr=Object.getOwnPropertyDescriptors,lt=Object.getOwnPropertySymbols,Ln=Object.prototype.hasOwnProperty,Yn=Object.prototype.propertyIsEnumerable,Xn=(e,t,n)=>t in e?Zr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qr=(e,t)=>{for(var n in t||(t={}))Ln.call(t,n)&&Xn(e,n,t[n]);if(lt)for(var n of lt(t))Yn.call(t,n)&&Xn(e,n,t[n]);return e},Qr=(e,t)=>Kr(e,Wr(t)),Jr=(e,t)=>{var n={};for(var o in e)Ln.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&lt)for(var o of lt(e))t.indexOf(o)<0&&Yn.call(e,o)&&(n[o]=e[o]);return n};function Oe(e,t,n={}){const o=n,{eventFilter:r}=o,i=Jr(o,["eventFilter"]),{eventFilter:l,pause:s,resume:u,isActive:c}=Yr(r);return{stop:jr(e,t,Qr(qr({},i),{eventFilter:l})),pause:s,resume:u,isActive:c}}function Gn(e){var t;const n=ne(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Wt=jt?window:void 0;function qt(...e){let t,n,o,r;if(be(e[0])||Array.isArray(e[0])?([n,o,r]=e,t=Wt):[t,n,o,r]=e,!t)return Vr;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const i=[],l=()=>{i.forEach(d=>d()),i.length=0},s=(d,f,p,b)=>(d.addEventListener(f,p,b),()=>d.removeEventListener(f,p,b)),u=a.watch(()=>[Gn(t),ne(r)],([d,f])=>{l(),d&&i.push(...n.flatMap(p=>o.map(b=>s(d,p,b,f))))},{immediate:!0,flush:"post"}),c=()=>{u(),l()};return je(c),c}const ea=e=>typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0;function Fn(...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:r=Wt,eventName:i="keydown",passive:l=!1}=o,s=ea(t);return qt(r,i,u=>{s(u)&&n(u)},l)}function ta(e,t=!1){const n=a.ref(),o=()=>n.value=!!e();return o(),Gr(o,t),n}function na(e){return JSON.parse(JSON.stringify(e))}const Hn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Un="__vueuse_ssr_handlers__";Hn[Un]=Hn[Un]||{};var jn=Object.getOwnPropertySymbols,oa=Object.prototype.hasOwnProperty,ra=Object.prototype.propertyIsEnumerable,aa=(e,t)=>{var n={};for(var o in e)oa.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(e!=null&&jn)for(var o of jn(e))t.indexOf(o)<0&&ra.call(e,o)&&(n[o]=e[o]);return n};function ia(e,t,n={}){const o=n,{window:r=Wt}=o,i=aa(o,["window"]);let l;const s=ta(()=>r&&"ResizeObserver"in r),u=()=>{l&&(l.disconnect(),l=void 0)},c=a.watch(()=>Gn(e),f=>{u(),s.value&&r&&f&&(l=new ResizeObserver(t),l.observe(f,i))},{immediate:!0,flush:"post"}),d=()=>{u(),c()};return je(d),{isSupported:s,stop:d}}var Zn;(function(e){e.UP="UP",e.RIGHT="RIGHT",e.DOWN="DOWN",e.LEFT="LEFT",e.NONE="NONE"})(Zn||(Zn={}));var la=Object.defineProperty,Kn=Object.getOwnPropertySymbols,sa=Object.prototype.hasOwnProperty,ua=Object.prototype.propertyIsEnumerable,Wn=(e,t,n)=>t in e?la(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ca=(e,t)=>{for(var n in t||(t={}))sa.call(t,n)&&Wn(e,n,t[n]);if(Kn)for(var n of Kn(t))ua.call(t,n)&&Wn(e,n,t[n]);return e};ca({linear:Xr},{easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]});function Ze(e,t,n,o={}){var r,i,l;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:f}=o,p=a.getCurrentInstance(),b=n||(p==null?void 0:p.emit)||((r=p==null?void 0:p.$emit)==null?void 0:r.bind(p))||((l=(i=p==null?void 0:p.proxy)==null?void 0:i.$emit)==null?void 0:l.bind(p==null?void 0:p.proxy));let v=c;t||(t="modelValue"),v=c||v||`update:${t.toString()}`;const x=E=>s?ve(s)?s(E):na(E):E,k=()=>zr(e[t])?x(e[t]):f;if(u){const E=k(),B=a.ref(E);return a.watch(()=>e[t],G=>B.value=x(G)),a.watch(B,G=>{(G!==e[t]||d)&&b(v,G)},{deep:d}),B}else return a.computed({get(){return k()},set(E){b(v,E)}})}function X(e=()=>{}){const t=a.ref(new Set);e&&t.value.add(e);const n=o=>{t.value.delete(o)};return{on:o=>{t.value.has(e)&&t.value.delete(e),t.value.add(o);const r=()=>n(o);return je(r),{off:r}},off:n,trigger:o=>Promise.all(Array.from(t.value).map(r=>r(o))),fns:t}}const da=["production","prod"];function qn(e,...t){da.includes(process.env.NODE_ENV||"")||console.warn(`[Vue Flow]: ${e}`,...t)}function fa(){return{edgesChange:X(),nodesChange:X(),nodeDoubleClick:X(),nodeClick:X(),nodeMouseEnter:X(),nodeMouseMove:X(),nodeMouseLeave:X(),nodeContextMenu:X(),nodeDragStart:X(),nodeDrag:X(),nodeDragStop:X(),nodesInitialized:X(),miniMapNodeClick:X(),miniMapNodeDoubleClick:X(),miniMapNodeMouseEnter:X(),miniMapNodeMouseMove:X(),miniMapNodeMouseLeave:X(),connect:X(),connectStart:X(),connectEnd:X(),clickConnectStart:X(),clickConnectEnd:X(),paneReady:X(),move:X(),moveStart:X(),moveEnd:X(),selectionDragStart:X(),selectionDrag:X(),selectionDragStop:X(),selectionContextMenu:X(),selectionStart:X(),selectionEnd:X(),viewportChangeStart:X(),viewportChange:X(),viewportChangeEnd:X(),paneScroll:X(),paneClick:X(),paneContextMenu:X(),paneMouseEnter:X(),paneMouseMove:X(),paneMouseLeave:X(),edgeContextMenu:X(),edgeMouseEnter:X(),edgeMouseMove:X(),edgeMouseLeave:X(),edgeDoubleClick:X(),edgeClick:X(),edgeUpdateStart:X(),edgeUpdate:X(),edgeUpdateEnd:X(),updateNodeInternals:X(),error:X(e=>qn(e.message))}}function ha(e,t){a.onBeforeMount(()=>{for(const[n,o]of Object.entries(t.value)){const r=i=>{e(n,i)};o.on(r),je(()=>{o.off(r)})}})}var ie=(e=>(e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",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))(ie||{});const Qn={MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_NOT_FOUND:e=>`Node not found
1
+ (function(xe,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],l):(xe=typeof globalThis<"u"?globalThis:xe||self,l(xe["@stonecrop/node-editor"]={},xe.Vue))})(this,function(xe,l){"use strict";function ct(e){return l.getCurrentScope()?(l.onScopeDispose(e),!0):!1}function Se(e){return typeof e=="function"?e():l.unref(e)}const ki=typeof window<"u"&&typeof document<"u",Mi=e=>typeof e<"u",Ii=Object.prototype.toString,$i=e=>Ii.call(e)==="[object Object]",Ti=()=>{};function Pi(e,t){function n(...o){return new Promise((i,r)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(r)})}return n}const Tn=e=>e();function Bi(e=Tn){const t=l.ref(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:l.readonly(t),pause:n,resume:o,eventFilter:i}}function Pn(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Di(e,t,n={}){const{eventFilter:o=Tn,...i}=n;return l.watch(e,Pi(o,t),i)}function Le(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:a,resume:s,isActive:u}=Bi(o);return{stop:Di(e,t,{...i,eventFilter:r}),pause:a,resume:s,isActive:u}}function Vi(e,t={}){if(!l.isRef(e))return l.toRefs(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=l.customRef(()=>({get(){return e.value[o]},set(i){var r;if((r=Se(t.replaceRef))!=null?r:!0)if(Array.isArray(e.value)){const s=[...e.value];s[o]=i,e.value=s}else{const s={...e.value,[o]:i};Object.setPrototypeOf(s,Object.getPrototypeOf(e.value)),e.value=s}else e.value[o]=i}}));return n}function Ft(e,t=!1){function n(h,{flush:g="sync",deep:m=!1,timeout:b,throwOnTimeout:_}={}){let x=null;const p=[new Promise(C=>{x=l.watch(e,E=>{h(E)!==t&&(x==null||x(),C(E))},{flush:g,deep:m,immediate:!0})})];return b!=null&&p.push(Pn(b,_).then(()=>Se(e)).finally(()=>x==null?void 0:x())),Promise.race(p)}function o(h,g){if(!l.isRef(h))return n(E=>E===h,g);const{flush:m="sync",deep:b=!1,timeout:_,throwOnTimeout:x}=g??{};let N=null;const C=[new Promise(E=>{N=l.watch([e,h],([$,A])=>{t!==($===A)&&(N==null||N(),E($))},{flush:m,deep:b,immediate:!0})})];return _!=null&&C.push(Pn(_,x).then(()=>Se(e)).finally(()=>(N==null||N(),Se(e)))),Promise.race(C)}function i(h){return n(g=>!!g,h)}function r(h){return o(null,h)}function a(h){return o(void 0,h)}function s(h){return n(Number.isNaN,h)}function u(h,g){return n(m=>{const b=Array.from(m);return b.includes(h)||b.includes(Se(h))},g)}function c(h){return d(1,h)}function d(h=1,g){let m=-1;return n(()=>(m+=1,m>=h),g)}return Array.isArray(Se(e))?{toMatch:n,toContains:u,changed:c,changedTimes:d,get not(){return Ft(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:a,changed:c,changedTimes:d,get not(){return Ft(e,!t)}}}function dt(e){return Ft(e)}function Oi(e){var t;const n=Se(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Bn=ki?window:void 0;function Dn(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Bn):[t,n,o,i]=e,!t)return Ti;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],a=()=>{r.forEach(d=>d()),r.length=0},s=(d,h,g,m)=>(d.addEventListener(h,g,m),()=>d.removeEventListener(h,g,m)),u=l.watch(()=>[Oi(t),Se(i)],([d,h])=>{if(a(),!d)return;const g=$i(h)?{...h}:h;r.push(...n.flatMap(m=>o.map(b=>s(d,m,b,g))))},{immediate:!0,flush:"post"}),c=()=>{u(),a()};return ct(c),c}function Ai(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Vn(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=Bn,eventName:r="keydown",passive:a=!1,dedupe:s=!1}=o,u=Ai(t);return Dn(i,r,d=>{d.repeat&&Se(s)||u(d)&&n(d)},a)}function zi(e){return JSON.parse(JSON.stringify(e))}function Yt(e,t,n,o={}){var i,r,a;const{clone:s=!1,passive:u=!1,eventName:c,deep:d=!1,defaultValue:h,shouldEmit:g}=o,m=l.getCurrentInstance(),b=n||(m==null?void 0:m.emit)||((i=m==null?void 0:m.$emit)==null?void 0:i.bind(m))||((a=(r=m==null?void 0:m.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(m==null?void 0:m.proxy));let _=c;t||(t="modelValue"),_=_||`update:${t.toString()}`;const x=C=>s?typeof s=="function"?s(C):zi(C):C,N=()=>Mi(e[t])?x(e[t]):h,p=C=>{g?g(C)&&b(_,C):b(_,C)};if(u){const C=N(),E=l.ref(C);let $=!1;return l.watch(()=>e[t],A=>{$||($=!0,E.value=x(A),l.nextTick(()=>$=!1))}),l.watch(E,A=>{!$&&(A!==e[t]||d)&&p(A)},{deep:d}),E}else return l.computed({get(){return N()},set(C){p(C)}})}var Ri={value:()=>{}};function ft(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new ht(n)}function ht(e){this._=e}function Hi(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",i=n.indexOf(".");if(i>=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}ht.prototype=ft.prototype={constructor:ht,on:function(e,t){var n=this._,o=Hi(e+"",n),i,r=-1,a=o.length;if(arguments.length<2){for(;++r<a;)if((i=(e=o[r]).type)&&(i=Li(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++r<a;)if(i=(e=o[r]).type)n[i]=On(n[i],e.name,t);else if(t==null)for(i in n)n[i]=On(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ht(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),o=0,i,r;o<i;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)}};function Li(e,t){for(var n=0,o=e.length,i;n<o;++n)if((i=e[n]).name===t)return i.value}function On(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=Ri,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Gt="http://www.w3.org/1999/xhtml";const An={svg:"http://www.w3.org/2000/svg",xhtml:Gt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function gt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),An.hasOwnProperty(t)?{space:An[t],local:e}:e}function Fi(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Gt&&t.documentElement.namespaceURI===Gt?t.createElement(e):t.createElementNS(n,e)}}function Yi(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zn(e){var t=gt(e);return(t.local?Yi:Fi)(t)}function Gi(){}function Xt(e){return e==null?Gi:function(){return this.querySelector(e)}}function Xi(e){typeof e!="function"&&(e=Xt(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=new Array(a),u,c,d=0;d<a;++d)(u=r[d])&&(c=e.call(u,u.__data__,d,r))&&("__data__"in u&&(c.__data__=u.__data__),s[d]=c);return new me(o,this._parents)}function Ui(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Zi(){return[]}function Rn(e){return e==null?Zi:function(){return this.querySelectorAll(e)}}function Wi(e){return function(){return Ui(e.apply(this,arguments))}}function Ki(e){typeof e=="function"?e=Wi(e):e=Rn(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var a=t[r],s=a.length,u,c=0;c<s;++c)(u=a[c])&&(o.push(e.call(u,u.__data__,c,a)),i.push(u));return new me(o,i)}function Hn(e){return function(){return this.matches(e)}}function Ln(e){return function(t){return t.matches(e)}}var qi=Array.prototype.find;function Ji(e){return function(){return qi.call(this.children,e)}}function ji(){return this.firstElementChild}function Qi(e){return this.select(e==null?ji:Ji(typeof e=="function"?e:Ln(e)))}var er=Array.prototype.filter;function tr(){return Array.from(this.children)}function nr(e){return function(){return er.call(this.children,e)}}function or(e){return this.selectAll(e==null?tr:nr(typeof e=="function"?e:Ln(e)))}function ir(e){typeof e!="function"&&(e=Hn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=[],u,c=0;c<a;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new me(o,this._parents)}function Fn(e){return new Array(e.length)}function rr(){return new me(this._enter||this._groups.map(Fn),this._parents)}function pt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}pt.prototype={constructor:pt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function lr(e){return function(){return e}}function ar(e,t,n,o,i,r){for(var a=0,s,u=t.length,c=r.length;a<c;++a)(s=t[a])?(s.__data__=r[a],o[a]=s):n[a]=new pt(e,r[a]);for(;a<u;++a)(s=t[a])&&(i[a]=s)}function sr(e,t,n,o,i,r,a){var s,u,c=new Map,d=t.length,h=r.length,g=new Array(d),m;for(s=0;s<d;++s)(u=t[s])&&(g[s]=m=a.call(u,u.__data__,s,t)+"",c.has(m)?i[s]=u:c.set(m,u));for(s=0;s<h;++s)m=a.call(e,r[s],s,r)+"",(u=c.get(m))?(o[s]=u,u.__data__=r[s],c.delete(m)):n[s]=new pt(e,r[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(g[s])===u&&(i[s]=u)}function ur(e){return e.__data__}function cr(e,t){if(!arguments.length)return Array.from(this,ur);var n=t?sr:ar,o=this._parents,i=this._groups;typeof e!="function"&&(e=lr(e));for(var r=i.length,a=new Array(r),s=new Array(r),u=new Array(r),c=0;c<r;++c){var d=o[c],h=i[c],g=h.length,m=dr(e.call(d,d&&d.__data__,c,o)),b=m.length,_=s[c]=new Array(b),x=a[c]=new Array(b),N=u[c]=new Array(g);n(d,h,_,x,N,m,t);for(var p=0,C=0,E,$;p<b;++p)if(E=_[p]){for(p>=C&&(C=p+1);!($=x[C])&&++C<b;);E._next=$||null}}return a=new me(a,o),a._enter=s,a._exit=u,a}function dr(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function fr(){return new me(this._exit||this._groups.map(Fn),this._parents)}function hr(e,t,n){var o=this.enter(),i=this,r=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?r.remove():n(r),o&&i?o.merge(i).order():i}function gr(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,a=Math.min(i,r),s=new Array(i),u=0;u<a;++u)for(var c=n[u],d=o[u],h=c.length,g=s[u]=new Array(h),m,b=0;b<h;++b)(m=c[b]||d[b])&&(g[b]=m);for(;u<i;++u)s[u]=n[u];return new me(s,this._parents)}function pr(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],i=o.length-1,r=o[i],a;--i>=0;)(a=o[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function mr(e){e||(e=yr);function t(h,g){return h&&g?e(h.__data__,g.__data__):!h-!g}for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var a=n[r],s=a.length,u=i[r]=new Array(s),c,d=0;d<s;++d)(c=a[d])&&(u[d]=c);u.sort(t)}return new me(i,this._parents).order()}function yr(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function vr(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function wr(){return Array.from(this)}function _r(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var a=o[i];if(a)return a}return null}function br(){let e=0;for(const t of this)++e;return e}function Er(){return!this.node()}function xr(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i=t[n],r=0,a=i.length,s;r<a;++r)(s=i[r])&&e.call(s,s.__data__,r,i);return this}function Sr(e){return function(){this.removeAttribute(e)}}function Nr(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Cr(e,t){return function(){this.setAttribute(e,t)}}function kr(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Mr(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Ir(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function $r(e,t){var n=gt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Nr:Sr:typeof t=="function"?n.local?Ir:Mr:n.local?kr:Cr)(n,t))}function Yn(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Tr(e){return function(){this.style.removeProperty(e)}}function Pr(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Br(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Dr(e,t,n){return arguments.length>1?this.each((t==null?Tr:typeof t=="function"?Br:Pr)(e,t,n??"")):Fe(this.node(),e)}function Fe(e,t){return e.style.getPropertyValue(t)||Yn(e).getComputedStyle(e,null).getPropertyValue(t)}function Vr(e){return function(){delete this[e]}}function Or(e,t){return function(){this[e]=t}}function Ar(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function zr(e,t){return arguments.length>1?this.each((t==null?Vr:typeof t=="function"?Ar:Or)(e,t)):this.node()[e]}function Gn(e){return e.trim().split(/^|\s+/)}function Ut(e){return e.classList||new Xn(e)}function Xn(e){this._node=e,this._names=Gn(e.getAttribute("class")||"")}Xn.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Un(e,t){for(var n=Ut(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function Zn(e,t){for(var n=Ut(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function Rr(e){return function(){Un(this,e)}}function Hr(e){return function(){Zn(this,e)}}function Lr(e,t){return function(){(t.apply(this,arguments)?Un:Zn)(this,e)}}function Fr(e,t){var n=Gn(e+"");if(arguments.length<2){for(var o=Ut(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?Lr:t?Rr:Hr)(n,t))}function Yr(){this.textContent=""}function Gr(e){return function(){this.textContent=e}}function Xr(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ur(e){return arguments.length?this.each(e==null?Yr:(typeof e=="function"?Xr:Gr)(e)):this.node().textContent}function Zr(){this.innerHTML=""}function Wr(e){return function(){this.innerHTML=e}}function Kr(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function qr(e){return arguments.length?this.each(e==null?Zr:(typeof e=="function"?Kr:Wr)(e)):this.node().innerHTML}function Jr(){this.nextSibling&&this.parentNode.appendChild(this)}function jr(){return this.each(Jr)}function Qr(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function el(){return this.each(Qr)}function tl(e){var t=typeof e=="function"?e:zn(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function nl(){return null}function ol(e,t){var n=typeof e=="function"?e:zn(e),o=t==null?nl:typeof t=="function"?t:Xt(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function il(){var e=this.parentNode;e&&e.removeChild(this)}function rl(){return this.each(il)}function ll(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function al(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function sl(e){return this.select(e?al:ll)}function ul(e){return arguments.length?this.property("__data__",e):this.node().__data__}function cl(e){return function(t){e.call(this,t,this.__data__)}}function dl(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function fl(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,r;n<i;++n)r=t[n],(!e.type||r.type===e.type)&&r.name===e.name?this.removeEventListener(r.type,r.listener,r.options):t[++o]=r;++o?t.length=o:delete this.__on}}}function hl(e,t,n){return function(){var o=this.__on,i,r=cl(t);if(o){for(var a=0,s=o.length;a<s;++a)if((i=o[a]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=r,i.options=n),i.value=t;return}}this.addEventListener(e.type,r,n),i={type:e.type,name:e.name,value:t,listener:r,options:n},o?o.push(i):this.__on=[i]}}function gl(e,t,n){var o=dl(e+""),i,r=o.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,d;u<c;++u)for(i=0,d=s[u];i<r;++i)if((a=o[i]).type===d.type&&a.name===d.name)return d.value}return}for(s=t?hl:fl,i=0;i<r;++i)this.each(s(o[i],t,n));return this}function Wn(e,t,n){var o=Yn(e),i=o.CustomEvent;typeof i=="function"?i=new i(t,n):(i=o.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function pl(e,t){return function(){return Wn(this,e,t)}}function ml(e,t){return function(){return Wn(this,e,t.apply(this,arguments))}}function yl(e,t){return this.each((typeof t=="function"?ml:pl)(e,t))}function*vl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length,a;i<r;++i)(a=o[i])&&(yield a)}var Kn=[null];function me(e,t){this._groups=e,this._parents=t}function qe(){return new me([[document.documentElement]],Kn)}function wl(){return this}me.prototype=qe.prototype={constructor:me,select:Xi,selectAll:Ki,selectChild:Qi,selectChildren:or,filter:ir,data:cr,enter:rr,exit:fr,join:hr,merge:gr,selection:wl,order:pr,sort:mr,call:vr,nodes:wr,node:_r,size:br,empty:Er,each:xr,attr:$r,style:Dr,property:zr,classed:Fr,text:Ur,html:qr,raise:jr,lower:el,append:tl,insert:ol,remove:rl,clone:sl,datum:ul,on:gl,dispatch:yl,[Symbol.iterator]:vl};function ye(e){return typeof e=="string"?new me([[document.querySelector(e)]],[document.documentElement]):new me([[e]],Kn)}function _l(e){let t;for(;t=e.sourceEvent;)e=t;return e}function _e(e,t){if(e=_l(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const bl={passive:!1},Je={capture:!0,passive:!1};function Zt(e){e.stopImmediatePropagation()}function Ye(e){e.preventDefault(),e.stopImmediatePropagation()}function qn(e){var t=e.document.documentElement,n=ye(e).on("dragstart.drag",Ye,Je);"onselectstart"in t?n.on("selectstart.drag",Ye,Je):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Jn(e,t){var n=e.document.documentElement,o=ye(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ye,Je),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const mt=e=>()=>e;function Wt(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:a,y:s,dx:u,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}Wt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function El(e){return!e.ctrlKey&&!e.button}function xl(){return this.parentNode}function Sl(e,t){return t??{x:e.x,y:e.y}}function Nl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cl(){var e=El,t=xl,n=Sl,o=Nl,i={},r=ft("start","drag","end"),a=0,s,u,c,d,h=0;function g(E){E.on("mousedown.drag",m).filter(o).on("touchstart.drag",x).on("touchmove.drag",N,bl).on("touchend.drag touchcancel.drag",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(E,$){if(!(d||!e.call(this,E,$))){var A=C(this,t.call(this,E,$),E,$,"mouse");A&&(ye(E.view).on("mousemove.drag",b,Je).on("mouseup.drag",_,Je),qn(E.view),Zt(E),c=!1,s=E.clientX,u=E.clientY,A("start",E))}}function b(E){if(Ye(E),!c){var $=E.clientX-s,A=E.clientY-u;c=$*$+A*A>h}i.mouse("drag",E)}function _(E){ye(E.view).on("mousemove.drag mouseup.drag",null),Jn(E.view,c),Ye(E),i.mouse("end",E)}function x(E,$){if(e.call(this,E,$)){var A=E.changedTouches,D=t.call(this,E,$),U=A.length,Z,V;for(Z=0;Z<U;++Z)(V=C(this,D,E,$,A[Z].identifier,A[Z]))&&(Zt(E),V("start",E,A[Z]))}}function N(E){var $=E.changedTouches,A=$.length,D,U;for(D=0;D<A;++D)(U=i[$[D].identifier])&&(Ye(E),U("drag",E,$[D]))}function p(E){var $=E.changedTouches,A=$.length,D,U;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),D=0;D<A;++D)(U=i[$[D].identifier])&&(Zt(E),U("end",E,$[D]))}function C(E,$,A,D,U,Z){var V=r.copy(),S=_e(Z||A,$),j,H,v;if((v=n.call(E,new Wt("beforestart",{sourceEvent:A,target:g,identifier:U,active:a,x:S[0],y:S[1],dx:0,dy:0,dispatch:V}),D))!=null)return j=v.x-S[0]||0,H=v.y-S[1]||0,function P(k,T,z){var M=S,B;switch(k){case"start":i[U]=P,B=a++;break;case"end":delete i[U],--a;case"drag":S=_e(z||T,$),B=a;break}V.call(k,E,new Wt(k,{sourceEvent:T,subject:v,target:g,identifier:U,active:B,x:S[0]+j,y:S[1]+H,dx:S[0]-M[0],dy:S[1]-M[1],dispatch:V}),D)}}return g.filter=function(E){return arguments.length?(e=typeof E=="function"?E:mt(!!E),g):e},g.container=function(E){return arguments.length?(t=typeof E=="function"?E:mt(E),g):t},g.subject=function(E){return arguments.length?(n=typeof E=="function"?E:mt(E),g):n},g.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:mt(!!E),g):o},g.on=function(){var E=r.on.apply(r,arguments);return E===r?g:E},g.clickDistance=function(E){return arguments.length?(h=(E=+E)*E,g):Math.sqrt(h)},g}function Kt(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function jn(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function je(){}var Qe=.7,yt=1/Qe,Ge="\\s*([+-]?\\d+)\\s*",et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",be="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",kl=/^#([0-9a-f]{3,8})$/,Ml=new RegExp(`^rgb\\(${Ge},${Ge},${Ge}\\)$`),Il=new RegExp(`^rgb\\(${be},${be},${be}\\)$`),$l=new RegExp(`^rgba\\(${Ge},${Ge},${Ge},${et}\\)$`),Tl=new RegExp(`^rgba\\(${be},${be},${be},${et}\\)$`),Pl=new RegExp(`^hsl\\(${et},${be},${be}\\)$`),Bl=new RegExp(`^hsla\\(${et},${be},${be},${et}\\)$`),Qn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Kt(je,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:eo,formatHex:eo,formatHex8:Dl,formatHsl:Vl,formatRgb:to,toString:to});function eo(){return this.rgb().formatHex()}function Dl(){return this.rgb().formatHex8()}function Vl(){return lo(this).formatHsl()}function to(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=kl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?no(t):n===3?new pe(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?vt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?vt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Ml.exec(e))?new pe(t[1],t[2],t[3],1):(t=Il.exec(e))?new pe(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=$l.exec(e))?vt(t[1],t[2],t[3],t[4]):(t=Tl.exec(e))?vt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Pl.exec(e))?ro(t[1],t[2]/100,t[3]/100,1):(t=Bl.exec(e))?ro(t[1],t[2]/100,t[3]/100,t[4]):Qn.hasOwnProperty(e)?no(Qn[e]):e==="transparent"?new pe(NaN,NaN,NaN,0):null}function no(e){return new pe(e>>16&255,e>>8&255,e&255,1)}function vt(e,t,n,o){return o<=0&&(e=t=n=NaN),new pe(e,t,n,o)}function Ol(e){return e instanceof je||(e=tt(e)),e?(e=e.rgb(),new pe(e.r,e.g,e.b,e.opacity)):new pe}function qt(e,t,n,o){return arguments.length===1?Ol(e):new pe(e,t,n,o??1)}function pe(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Kt(pe,qt,jn(je,{brighter(e){return e=e==null?yt:Math.pow(yt,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Qe:Math.pow(Qe,e),new pe(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new pe(Pe(this.r),Pe(this.g),Pe(this.b),wt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oo,formatHex:oo,formatHex8:Al,formatRgb:io,toString:io}));function oo(){return`#${Be(this.r)}${Be(this.g)}${Be(this.b)}`}function Al(){return`#${Be(this.r)}${Be(this.g)}${Be(this.b)}${Be((isNaN(this.opacity)?1:this.opacity)*255)}`}function io(){const e=wt(this.opacity);return`${e===1?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${e===1?")":`, ${e})`}`}function wt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Be(e){return e=Pe(e),(e<16?"0":"")+e.toString(16)}function ro(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ve(e,t,n,o)}function lo(e){if(e instanceof ve)return new ve(e.h,e.s,e.l,e.opacity);if(e instanceof je||(e=tt(e)),!e)return new ve;if(e instanceof ve)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),a=NaN,s=r-i,u=(r+i)/2;return s?(t===r?a=(n-o)/s+(n<o)*6:n===r?a=(o-t)/s+2:a=(t-n)/s+4,s/=u<.5?r+i:2-r-i,a*=60):s=u>0&&u<1?0:a,new ve(a,s,u,e.opacity)}function zl(e,t,n,o){return arguments.length===1?lo(e):new ve(e,t,n,o??1)}function ve(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Kt(ve,zl,jn(je,{brighter(e){return e=e==null?yt:Math.pow(yt,e),new ve(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Qe:Math.pow(Qe,e),new ve(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new pe(Jt(e>=240?e-240:e+120,i,o),Jt(e,i,o),Jt(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ve(ao(this.h),_t(this.s),_t(this.l),wt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=wt(this.opacity);return`${e===1?"hsl(":"hsla("}${ao(this.h)}, ${_t(this.s)*100}%, ${_t(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ao(e){return e=(e||0)%360,e<0?e+360:e}function _t(e){return Math.max(0,Math.min(1,e||0))}function Jt(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const so=e=>()=>e;function Rl(e,t){return function(n){return e+n*t}}function Hl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function Ll(e){return(e=+e)==1?uo:function(t,n){return n-t?Hl(t,n,e):so(isNaN(t)?n:t)}}function uo(e,t){var n=t-e;return n?Rl(e,n):so(isNaN(e)?t:e)}const co=function e(t){var n=Ll(t);function o(i,r){var a=n((i=qt(i)).r,(r=qt(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),c=uo(i.opacity,r.opacity);return function(d){return i.r=a(d),i.g=s(d),i.b=u(d),i.opacity=c(d),i+""}}return o.gamma=e,o}(1);function Ie(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var jt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qt=new RegExp(jt.source,"g");function Fl(e){return function(){return e}}function Yl(e){return function(t){return e(t)+""}}function Gl(e,t){var n=jt.lastIndex=Qt.lastIndex=0,o,i,r,a=-1,s=[],u=[];for(e=e+"",t=t+"";(o=jt.exec(e))&&(i=Qt.exec(t));)(r=i.index)>n&&(r=t.slice(n,r),s[a]?s[a]+=r:s[++a]=r),(o=o[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,u.push({i:a,x:Ie(o,i)})),n=Qt.lastIndex;return n<t.length&&(r=t.slice(n),s[a]?s[a]+=r:s[++a]=r),s.length<2?u[0]?Yl(u[0].x):Fl(t):(t=u.length,function(c){for(var d=0,h;d<t;++d)s[(h=u[d]).i]=h.x(c);return s.join("")})}var fo=180/Math.PI,en={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ho(e,t,n,o,i,r){var a,s,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*fo,skewX:Math.atan(u)*fo,scaleX:a,scaleY:s}}var bt;function Xl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?en:ho(t.a,t.b,t.c,t.d,t.e,t.f)}function Ul(e){return e==null||(bt||(bt=document.createElementNS("http://www.w3.org/2000/svg","g")),bt.setAttribute("transform",e),!(e=bt.transform.baseVal.consolidate()))?en:(e=e.matrix,ho(e.a,e.b,e.c,e.d,e.e,e.f))}function go(e,t,n,o){function i(c){return c.length?c.pop()+" ":""}function r(c,d,h,g,m,b){if(c!==h||d!==g){var _=m.push("translate(",null,t,null,n);b.push({i:_-4,x:Ie(c,h)},{i:_-2,x:Ie(d,g)})}else(h||g)&&m.push("translate("+h+t+g+n)}function a(c,d,h,g){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),g.push({i:h.push(i(h)+"rotate(",null,o)-2,x:Ie(c,d)})):d&&h.push(i(h)+"rotate("+d+o)}function s(c,d,h,g){c!==d?g.push({i:h.push(i(h)+"skewX(",null,o)-2,x:Ie(c,d)}):d&&h.push(i(h)+"skewX("+d+o)}function u(c,d,h,g,m,b){if(c!==h||d!==g){var _=m.push(i(m)+"scale(",null,",",null,")");b.push({i:_-4,x:Ie(c,h)},{i:_-2,x:Ie(d,g)})}else(h!==1||g!==1)&&m.push(i(m)+"scale("+h+","+g+")")}return function(c,d){var h=[],g=[];return c=e(c),d=e(d),r(c.translateX,c.translateY,d.translateX,d.translateY,h,g),a(c.rotate,d.rotate,h,g),s(c.skewX,d.skewX,h,g),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,h,g),c=d=null,function(m){for(var b=-1,_=g.length,x;++b<_;)h[(x=g[b]).i]=x.x(m);return h.join("")}}}var Zl=go(Xl,"px, ","px)","deg)"),Wl=go(Ul,", ",")",")"),Kl=1e-12;function po(e){return((e=Math.exp(e))+1/e)/2}function ql(e){return((e=Math.exp(e))-1/e)/2}function Jl(e){return((e=Math.exp(2*e))-1)/(e+1)}const jl=function e(t,n,o){function i(r,a){var s=r[0],u=r[1],c=r[2],d=a[0],h=a[1],g=a[2],m=d-s,b=h-u,_=m*m+b*b,x,N;if(_<Kl)N=Math.log(g/c)/t,x=function(D){return[s+D*m,u+D*b,c*Math.exp(t*D*N)]};else{var p=Math.sqrt(_),C=(g*g-c*c+o*_)/(2*c*n*p),E=(g*g-c*c-o*_)/(2*g*n*p),$=Math.log(Math.sqrt(C*C+1)-C),A=Math.log(Math.sqrt(E*E+1)-E);N=(A-$)/t,x=function(D){var U=D*N,Z=po($),V=c/(n*p)*(Z*Jl(t*U+$)-ql($));return[s+V*m,u+V*b,c*Z/po(t*U+$)]}}return x.duration=N*1e3*t/Math.SQRT2,x}return i.rho=function(r){var a=Math.max(.001,+r),s=a*a,u=s*s;return e(a,s,u)},i}(Math.SQRT2,2,4);var Xe=0,nt=0,ot=0,mo=1e3,Et,it,xt=0,De=0,St=0,rt=typeof performance=="object"&&performance.now?performance:Date,yo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tn(){return De||(yo(Ql),De=rt.now()+St)}function Ql(){De=0}function Nt(){this._call=this._time=this._next=null}Nt.prototype=vo.prototype={constructor:Nt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?tn():+n)+(t==null?0:+t),!this._next&&it!==this&&(it?it._next=this:Et=this,it=this),this._call=e,this._time=n,nn()},stop:function(){this._call&&(this._call=null,this._time=1/0,nn())}};function vo(e,t,n){var o=new Nt;return o.restart(e,t,n),o}function ea(){tn(),++Xe;for(var e=Et,t;e;)(t=De-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xe}function wo(){De=(xt=rt.now())+St,Xe=nt=0;try{ea()}finally{Xe=0,na(),De=0}}function ta(){var e=rt.now(),t=e-xt;t>mo&&(St-=t,xt=e)}function na(){for(var e,t=Et,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Et=n);it=e,nn(o)}function nn(e){if(!Xe){nt&&(nt=clearTimeout(nt));var t=e-De;t>24?(e<1/0&&(nt=setTimeout(wo,e-rt.now()-St)),ot&&(ot=clearInterval(ot))):(ot||(xt=rt.now(),ot=setInterval(ta,mo)),Xe=1,yo(wo))}}function _o(e,t,n){var o=new Nt;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var oa=ft("start","end","cancel","interrupt"),ia=[],bo=0,Eo=1,on=2,Ct=3,xo=4,rn=5,kt=6;function Mt(e,t,n,o,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;ra(e,n,{name:t,index:o,group:i,on:oa,tween:ia,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:bo})}function ln(e,t){var n=we(e,t);if(n.state>bo)throw new Error("too late; already scheduled");return n}function Ee(e,t){var n=we(e,t);if(n.state>Ct)throw new Error("too late; already running");return n}function we(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function ra(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=vo(r,0,n.time);function r(c){n.state=Eo,n.timer.restart(a,n.delay,n.time),n.delay<=c&&a(c-n.delay)}function a(c){var d,h,g,m;if(n.state!==Eo)return u();for(d in o)if(m=o[d],m.name===n.name){if(m.state===Ct)return _o(a);m.state===xo?(m.state=kt,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete o[d]):+d<t&&(m.state=kt,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete o[d])}if(_o(function(){n.state===Ct&&(n.state=xo,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=on,n.on.call("start",e,e.__data__,n.index,n.group),n.state===on){for(n.state=Ct,i=new Array(g=n.tween.length),d=0,h=-1;d<g;++d)(m=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(i[++h]=m);i.length=h+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=rn,1),h=-1,g=i.length;++h<g;)i[h].call(e,d);n.state===rn&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=kt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function It(e,t){var n=e.__transition,o,i,r=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((o=n[a]).name!==t){r=!1;continue}i=o.state>on&&o.state<rn,o.state=kt,o.timer.stop(),o.on.call(i?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[a]}r&&delete e.__transition}}function la(e){return this.each(function(){It(this,e)})}function aa(e,t){var n,o;return function(){var i=Ee(this,e),r=i.tween;if(r!==n){o=n=r;for(var a=0,s=o.length;a<s;++a)if(o[a].name===t){o=o.slice(),o.splice(a,1);break}}i.tween=o}}function sa(e,t,n){var o,i;if(typeof n!="function")throw new Error;return function(){var r=Ee(this,e),a=r.tween;if(a!==o){i=(o=a).slice();for(var s={name:t,value:n},u=0,c=i.length;u<c;++u)if(i[u].name===t){i[u]=s;break}u===c&&i.push(s)}r.tween=i}}function ua(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=we(this.node(),n).tween,i=0,r=o.length,a;i<r;++i)if((a=o[i]).name===e)return a.value;return null}return this.each((t==null?aa:sa)(n,e,t))}function an(e,t,n){var o=e._id;return e.each(function(){var i=Ee(this,o);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return we(i,o).value[t]}}function So(e,t){var n;return(typeof t=="number"?Ie:t instanceof tt?co:(n=tt(t))?(t=n,co):Gl)(e,t)}function ca(e){return function(){this.removeAttribute(e)}}function da(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fa(e,t,n){var o,i=n+"",r;return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function ha(e,t,n){var o,i=n+"",r;return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function ga(e,t,n){var o,i,r;return function(){var a,s=n(this),u;return s==null?void this.removeAttribute(e):(a=this.getAttribute(e),u=s+"",a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s)))}}function pa(e,t,n){var o,i,r;return function(){var a,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),u=s+"",a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s)))}}function ma(e,t){var n=gt(e),o=n==="transform"?Wl:So;return this.attrTween(e,typeof t=="function"?(n.local?pa:ga)(n,o,an(this,"attr."+e,t)):t==null?(n.local?da:ca)(n):(n.local?ha:fa)(n,o,t))}function ya(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function va(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function wa(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&va(e,r)),n}return i._value=t,i}function _a(e,t){var n,o;function i(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&ya(e,r)),n}return i._value=t,i}function ba(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=gt(e);return this.tween(n,(o.local?wa:_a)(o,t))}function Ea(e,t){return function(){ln(this,e).delay=+t.apply(this,arguments)}}function xa(e,t){return t=+t,function(){ln(this,e).delay=t}}function Sa(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ea:xa)(t,e)):we(this.node(),t).delay}function Na(e,t){return function(){Ee(this,e).duration=+t.apply(this,arguments)}}function Ca(e,t){return t=+t,function(){Ee(this,e).duration=t}}function ka(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Na:Ca)(t,e)):we(this.node(),t).duration}function Ma(e,t){if(typeof t!="function")throw new Error;return function(){Ee(this,e).ease=t}}function Ia(e){var t=this._id;return arguments.length?this.each(Ma(t,e)):we(this.node(),t).ease}function $a(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ee(this,e).ease=n}}function Ta(e){if(typeof e!="function")throw new Error;return this.each($a(this._id,e))}function Pa(e){typeof e!="function"&&(e=Hn(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r=t[i],a=r.length,s=o[i]=[],u,c=0;c<a;++c)(u=r[c])&&e.call(u,u.__data__,c,r)&&s.push(u);return new Ne(o,this._parents,this._name,this._id)}function Ba(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),a=new Array(o),s=0;s<r;++s)for(var u=t[s],c=n[s],d=u.length,h=a[s]=new Array(d),g,m=0;m<d;++m)(g=u[m]||c[m])&&(h[m]=g);for(;s<o;++s)a[s]=t[s];return new Ne(a,this._parents,this._name,this._id)}function Da(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Va(e,t,n){var o,i,r=Da(t)?ln:Ee;return function(){var a=r(this,e),s=a.on;s!==o&&(i=(o=s).copy()).on(t,n),a.on=i}}function Oa(e,t){var n=this._id;return arguments.length<2?we(this.node(),n).on.on(e):this.each(Va(n,e,t))}function Aa(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function za(){return this.on("end.remove",Aa(this._id))}function Ra(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Xt(e));for(var o=this._groups,i=o.length,r=new Array(i),a=0;a<i;++a)for(var s=o[a],u=s.length,c=r[a]=new Array(u),d,h,g=0;g<u;++g)(d=s[g])&&(h=e.call(d,d.__data__,g,s))&&("__data__"in d&&(h.__data__=d.__data__),c[g]=h,Mt(c[g],t,n,g,c,we(d,n)));return new Ne(r,this._parents,t,n)}function Ha(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Rn(e));for(var o=this._groups,i=o.length,r=[],a=[],s=0;s<i;++s)for(var u=o[s],c=u.length,d,h=0;h<c;++h)if(d=u[h]){for(var g=e.call(d,d.__data__,h,u),m,b=we(d,n),_=0,x=g.length;_<x;++_)(m=g[_])&&Mt(m,t,n,_,g,b);r.push(g),a.push(d)}return new Ne(r,a,t,n)}var La=qe.prototype.constructor;function Fa(){return new La(this._groups,this._parents)}function Ya(e,t){var n,o,i;return function(){var r=Fe(this,e),a=(this.style.removeProperty(e),Fe(this,e));return r===a?null:r===n&&a===o?i:i=t(n=r,o=a)}}function No(e){return function(){this.style.removeProperty(e)}}function Ga(e,t,n){var o,i=n+"",r;return function(){var a=Fe(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}function Xa(e,t,n){var o,i,r;return function(){var a=Fe(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Fe(this,e))),a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,s))}}function Ua(e,t){var n,o,i,r="style."+t,a="end."+r,s;return function(){var u=Ee(this,e),c=u.on,d=u.value[r]==null?s||(s=No(t)):void 0;(c!==n||i!==d)&&(o=(n=c).copy()).on(a,i=d),u.on=o}}function Za(e,t,n){var o=(e+="")=="transform"?Zl:So;return t==null?this.styleTween(e,Ya(e,o)).on("end.style."+e,No(e)):typeof t=="function"?this.styleTween(e,Xa(e,o,an(this,"style."+e,t))).each(Ua(this._id,e)):this.styleTween(e,Ga(e,o,t),n).on("end.style."+e,null)}function Wa(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Ka(e,t,n){var o,i;function r(){var a=t.apply(this,arguments);return a!==i&&(o=(i=a)&&Wa(e,a,n)),o}return r._value=t,r}function qa(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Ka(e,t,n??""))}function Ja(e){return function(){this.textContent=e}}function ja(e){return function(){var t=e(this);this.textContent=t??""}}function Qa(e){return this.tween("text",typeof e=="function"?ja(an(this,"text",e)):Ja(e==null?"":e+""))}function es(e){return function(t){this.textContent=e.call(this,t)}}function ts(e){var t,n;function o(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&es(i)),t}return o._value=e,o}function ns(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,ts(e))}function os(){for(var e=this._name,t=this._id,n=Co(),o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],s=a.length,u,c=0;c<s;++c)if(u=a[c]){var d=we(u,t);Mt(u,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ne(o,this._parents,e,n)}function is(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,a){var s={value:a},u={value:function(){--i===0&&r()}};n.each(function(){var c=Ee(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),i===0&&r()})}var rs=0;function Ne(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Co(){return++rs}var Ce=qe.prototype;Ne.prototype={constructor:Ne,select:Ra,selectAll:Ha,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:Pa,merge:Ba,selection:Fa,transition:os,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.each,on:Oa,attr:ma,attrTween:ba,style:Za,styleTween:qa,text:Qa,textTween:ns,remove:za,tween:ua,delay:Sa,duration:ka,ease:Ia,easeVarying:Ta,end:is,[Symbol.iterator]:Ce[Symbol.iterator]};function ls(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var as={time:null,delay:0,duration:250,ease:ls};function ss(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function us(e){var t,n;e instanceof Ne?(t=e._id,e=e._name):(t=Co(),(n=as).time=tn(),e=e==null?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var a=o[r],s=a.length,u,c=0;c<s;++c)(u=a[c])&&Mt(u,e,t,c,a,n||ss(u,t));return new Ne(o,this._parents,e,t)}qe.prototype.interrupt=la,qe.prototype.transition=us;const $t=e=>()=>e;function cs(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:i}})}function ke(e,t,n){this.k=e,this.x=t,this.y=n}ke.prototype={constructor:ke,scale:function(e){return e===1?this:new ke(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new ke(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ue=new ke(1,0,0);ke.prototype;function sn(e){e.stopImmediatePropagation()}function lt(e){e.preventDefault(),e.stopImmediatePropagation()}function ds(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function fs(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function ko(){return this.__zoom||Ue}function hs(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gs(){return navigator.maxTouchPoints||"ontouchstart"in this}function ps(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function ms(){var e=ds,t=fs,n=ps,o=hs,i=gs,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=jl,c=ft("start","zoom","end"),d,h,g,m=500,b=150,_=0,x=10;function N(v){v.property("__zoom",ko).on("wheel.zoom",U,{passive:!1}).on("mousedown.zoom",Z).on("dblclick.zoom",V).filter(i).on("touchstart.zoom",S).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}N.transform=function(v,P,k,T){var z=v.selection?v.selection():v;z.property("__zoom",ko),v!==z?$(v,P,k,T):z.interrupt().each(function(){A(this,arguments).event(T).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},N.scaleBy=function(v,P,k,T){N.scaleTo(v,function(){var z=this.__zoom.k,M=typeof P=="function"?P.apply(this,arguments):P;return z*M},k,T)},N.scaleTo=function(v,P,k,T){N.transform(v,function(){var z=t.apply(this,arguments),M=this.__zoom,B=k==null?E(z):typeof k=="function"?k.apply(this,arguments):k,L=M.invert(B),K=typeof P=="function"?P.apply(this,arguments):P;return n(C(p(M,K),B,L),z,a)},k,T)},N.translateBy=function(v,P,k,T){N.transform(v,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),a)},null,T)},N.translateTo=function(v,P,k,T,z){N.transform(v,function(){var M=t.apply(this,arguments),B=this.__zoom,L=T==null?E(M):typeof T=="function"?T.apply(this,arguments):T;return n(Ue.translate(L[0],L[1]).scale(B.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof k=="function"?-k.apply(this,arguments):-k),M,a)},T,z)};function p(v,P){return P=Math.max(r[0],Math.min(r[1],P)),P===v.k?v:new ke(P,v.x,v.y)}function C(v,P,k){var T=P[0]-k[0]*v.k,z=P[1]-k[1]*v.k;return T===v.x&&z===v.y?v:new ke(v.k,T,z)}function E(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function $(v,P,k,T){v.on("start.zoom",function(){A(this,arguments).event(T).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(T).end()}).tween("zoom",function(){var z=this,M=arguments,B=A(z,M).event(T),L=t.apply(z,M),K=k==null?E(L):typeof k=="function"?k.apply(z,M):k,re=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),te=z.__zoom,oe=typeof P=="function"?P.apply(z,M):P,ue=u(te.invert(K).concat(re/te.k),oe.invert(K).concat(re/oe.k));return function(le){if(le===1)le=oe;else{var q=ue(le),W=re/q[2];le=new ke(W,K[0]-q[0]*W,K[1]-q[1]*W)}B.zoom(null,le)}})}function A(v,P,k){return!k&&v.__zooming||new D(v,P)}function D(v,P){this.that=v,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,P),this.taps=0}D.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,P){return this.mouse&&v!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var P=ye(this.that).datum();c.call(v,this.that,new cs(v,{sourceEvent:this.sourceEvent,target:N,type:v,transform:this.that.__zoom,dispatch:c}),P)}};function U(v,...P){if(!e.apply(this,arguments))return;var k=A(this,P).event(v),T=this.__zoom,z=Math.max(r[0],Math.min(r[1],T.k*Math.pow(2,o.apply(this,arguments)))),M=_e(v);if(k.wheel)(k.mouse[0][0]!==M[0]||k.mouse[0][1]!==M[1])&&(k.mouse[1]=T.invert(k.mouse[0]=M)),clearTimeout(k.wheel);else{if(T.k===z)return;k.mouse=[M,T.invert(M)],It(this),k.start()}lt(v),k.wheel=setTimeout(B,b),k.zoom("mouse",n(C(p(T,z),k.mouse[0],k.mouse[1]),k.extent,a));function B(){k.wheel=null,k.end()}}function Z(v,...P){if(g||!e.apply(this,arguments))return;var k=v.currentTarget,T=A(this,P,!0).event(v),z=ye(v.view).on("mousemove.zoom",K,!0).on("mouseup.zoom",re,!0),M=_e(v,k),B=v.clientX,L=v.clientY;qn(v.view),sn(v),T.mouse=[M,this.__zoom.invert(M)],It(this),T.start();function K(te){if(lt(te),!T.moved){var oe=te.clientX-B,ue=te.clientY-L;T.moved=oe*oe+ue*ue>_}T.event(te).zoom("mouse",n(C(T.that.__zoom,T.mouse[0]=_e(te,k),T.mouse[1]),T.extent,a))}function re(te){z.on("mousemove.zoom mouseup.zoom",null),Jn(te.view,T.moved),lt(te),T.event(te).end()}}function V(v,...P){if(e.apply(this,arguments)){var k=this.__zoom,T=_e(v.changedTouches?v.changedTouches[0]:v,this),z=k.invert(T),M=k.k*(v.shiftKey?.5:2),B=n(C(p(k,M),T,z),t.apply(this,P),a);lt(v),s>0?ye(this).transition().duration(s).call($,B,T,v):ye(this).call(N.transform,B,T,v)}}function S(v,...P){if(e.apply(this,arguments)){var k=v.touches,T=k.length,z=A(this,P,v.changedTouches.length===T).event(v),M,B,L,K;for(sn(v),B=0;B<T;++B)L=k[B],K=_e(L,this),K=[K,this.__zoom.invert(K),L.identifier],z.touch0?!z.touch1&&z.touch0[2]!==K[2]&&(z.touch1=K,z.taps=0):(z.touch0=K,M=!0,z.taps=1+!!d);d&&(d=clearTimeout(d)),M&&(z.taps<2&&(h=K[0],d=setTimeout(function(){d=null},m)),It(this),z.start())}}function j(v,...P){if(this.__zooming){var k=A(this,P).event(v),T=v.changedTouches,z=T.length,M,B,L,K;for(lt(v),M=0;M<z;++M)B=T[M],L=_e(B,this),k.touch0&&k.touch0[2]===B.identifier?k.touch0[0]=L:k.touch1&&k.touch1[2]===B.identifier&&(k.touch1[0]=L);if(B=k.that.__zoom,k.touch1){var re=k.touch0[0],te=k.touch0[1],oe=k.touch1[0],ue=k.touch1[1],le=(le=oe[0]-re[0])*le+(le=oe[1]-re[1])*le,q=(q=ue[0]-te[0])*q+(q=ue[1]-te[1])*q;B=p(B,Math.sqrt(le/q)),L=[(re[0]+oe[0])/2,(re[1]+oe[1])/2],K=[(te[0]+ue[0])/2,(te[1]+ue[1])/2]}else if(k.touch0)L=k.touch0[0],K=k.touch0[1];else return;k.zoom("touch",n(C(B,L,K),k.extent,a))}}function H(v,...P){if(this.__zooming){var k=A(this,P).event(v),T=v.changedTouches,z=T.length,M,B;for(sn(v),g&&clearTimeout(g),g=setTimeout(function(){g=null},m),M=0;M<z;++M)B=T[M],k.touch0&&k.touch0[2]===B.identifier?delete k.touch0:k.touch1&&k.touch1[2]===B.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(B=_e(B,this),Math.hypot(h[0]-B[0],h[1]-B[1])<x)){var L=ye(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return N.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:$t(+v),N):o},N.filter=function(v){return arguments.length?(e=typeof v=="function"?v:$t(!!v),N):e},N.touchable=function(v){return arguments.length?(i=typeof v=="function"?v:$t(!!v),N):i},N.extent=function(v){return arguments.length?(t=typeof v=="function"?v:$t([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),N):t},N.scaleExtent=function(v){return arguments.length?(r[0]=+v[0],r[1]=+v[1],N):[r[0],r[1]]},N.translateExtent=function(v){return arguments.length?(a[0][0]=+v[0][0],a[1][0]=+v[1][0],a[0][1]=+v[0][1],a[1][1]=+v[1][1],N):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},N.constrain=function(v){return arguments.length?(n=v,N):n},N.duration=function(v){return arguments.length?(s=+v,N):s},N.interpolate=function(v){return arguments.length?(u=v,N):u},N.on=function(){var v=c.on.apply(c,arguments);return v===c?N:v},N.clickDistance=function(v){return arguments.length?(_=(v=+v)*v,N):Math.sqrt(_)},N.tapDistance=function(v){return arguments.length?(x=+v,N):x},N}var F=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(F||{}),un=(e=>(e.Partial="partial",e.Full="full",e))(un||{}),Ve=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Ve||{}),Oe=(e=>(e.Strict="strict",e.Loose="loose",e))(Oe||{}),cn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(cn||{}),at=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(at||{});function dn(){return typeof window<"u"?window:{chrome:!1,addEventListener(...e){}}}function fn(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,i=typeof(o==null?void 0:o.hasAttribute)=="function"?o.hasAttribute("contenteditable"):!1,r=typeof(o==null?void 0:o.closest)=="function"?o.closest(".nokey"):null;return["INPUT","SELECT","TEXTAREA"].includes(o==null?void 0:o.nodeName)||i||!!r}function ys(e){return e.ctrlKey||e.metaKey||e.shiftKey}function Mo(e,t,n,o){const i=t.split("+").map(r=>r.trim().toLowerCase());return i.length===1?e.toLowerCase()===t.toLowerCase():(o?n.delete(e.toLowerCase()):n.add(e.toLowerCase()),i.every((r,a)=>n.has(r)&&Array.from(n.values())[a]===i[a]))}function vs(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=ws(n.code,e);return Array.isArray(e)?e.some(i=>Mo(n[o],i,t,n.type==="keyup")):Mo(n[o],e,t,n.type==="keyup")}}function ws(e,t){return typeof t=="string"?e===t?"code":"key":t.includes(e)?"code":"key"}function st(e,t,n={actInsideInputWithModifier:!0}){const o=dn(),i=l.ref(l.toValue(e)===!0);let r=!1;const a=new Set;let s=c(l.toValue(e));return l.watch(i,(d,h)=>{d!==h&&(t==null||t(d))}),l.watch(()=>l.toValue(e),(d,h)=>{typeof h=="boolean"&&typeof d!="boolean"&&u(),s=c(d)},{immediate:!0}),Dn(o,"blur",()=>{l.toValue(e)!==!0&&(i.value=!1)}),Vn((...d)=>s(...d),d=>{r=ys(d),!((!r||r&&!n.actInsideInputWithModifier)&&fn(d))&&(d.preventDefault(),i.value=!0)},{eventName:"keydown"}),Vn((...d)=>s(...d),d=>{if(i.value){if((!r||r&&!n.actInsideInputWithModifier)&&fn(d))return;u()}},{eventName:"keyup"}),i;function u(){r=!1,a.clear(),i.value=!1}function c(d){return d===null?(u(),()=>!1):typeof d=="boolean"?(u(),i.value=d,()=>!1):Array.isArray(d)||typeof d=="string"?vs(d,a):d}}const Io="vue-flow__node-desc",$o="vue-flow__edge-desc",_s="vue-flow__aria-live",To=["Enter"," ","Escape"],Ze={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function Po(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:a,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:c,nodesDraggable:d,panBy:h,findNode:g,multiSelectionActive:m,nodesSelectionActive:b,selectNodesOnDrag:_,removeSelectedElements:x,addSelectedNodes:N,updateNodePositions:p,emits:C}=de(),{onStart:E,onDrag:$,onStop:A,el:D,disabled:U,id:Z,selectable:V,dragHandle:S}=e,j=l.ref(!1);let H=[],v,P=null,k={x:void 0,y:void 0},T={x:0,y:0},z=null,M=!1,B=0,L=!1;const K=Ns(),re=({x:W,y:J})=>{k={x:W,y:J};let Q=!1;if(H=H.map(ie=>{const Y={x:W-ie.distance.x,y:J-ie.distance.y};n.value&&(Y.x=o.value[0]*Math.round(Y.x/o.value[0]),Y.y=o.value[1]*Math.round(Y.y/o.value[1]));const{computedPosition:f}=bn(ie,Y,C.error,a.value,ie.parentNode?g(ie.parentNode):void 0);return Q=Q||ie.position.x!==f.x||ie.position.y!==f.y,ie.position=f,ie}),!!Q&&(p(H,!0,!0),j.value=!0,z)){const[ie,Y]=_n({id:Z,dragItems:H,findNode:g});$({event:z,node:ie,nodes:Y})}},te=()=>{if(!P)return;const[W,J]=jo(T,P);if(W!==0||J!==0){const Q={x:(k.x??0)-W/u.value.zoom,y:(k.y??0)-J/u.value.zoom};h({x:W,y:J})&&re(Q)}B=requestAnimationFrame(te)},oe=(W,J)=>{M=!0;const Q=g(Z);!_.value&&!m.value&&Q&&(Q.selected||x()),Q&&l.toValue(V)&&_.value&&Cn(Q,m.value,N,x,b,!1,J);const ie=K(W);if(k=ie,H=Hs(r.value,d.value,ie,g,Z),H.length){const[Y,f]=_n({id:Z,dragItems:H,findNode:g});E({event:W.sourceEvent,node:Y,nodes:f})}},ue=(W,J)=>{var Q;W.sourceEvent.type==="touchmove"&&W.sourceEvent.touches.length>1||(s.value===0&&oe(W,J),k=K(W),P=((Q=t.value)==null?void 0:Q.getBoundingClientRect())||null,T=Re(W.sourceEvent,P))},le=(W,J)=>{const Q=K(W);if(!L&&M&&c.value&&(L=!0,te()),!M){const ie=Q.xSnapped-(k.x??0),Y=Q.ySnapped-(k.y??0);Math.sqrt(ie*ie+Y*Y)>s.value&&oe(W,J)}(k.x!==Q.xSnapped||k.y!==Q.ySnapped)&&H.length&&M&&(z=W.sourceEvent,T=Re(W.sourceEvent,P),re(Q))},q=W=>{if(M&&(j.value=!1,L=!1,M=!1,cancelAnimationFrame(B),H.length)){p(H,!1,!1);const[J,Q]=_n({id:Z,dragItems:H,findNode:g});A({event:W.sourceEvent,node:J,nodes:Q})}};return l.watch([()=>l.toValue(U),D],([W,J],Q,ie)=>{if(J){const Y=ye(J);W||(v=Cl().on("start",f=>ue(f,J)).on("drag",f=>le(f,J)).on("end",f=>q(f)).filter(f=>{const y=f.target,w=l.toValue(S);return!f.button&&(!i.value||!oi(y,`.${i.value}`,J)&&(!w||oi(y,w,J)))}),Y.call(v)),ie(()=>{Y.on(".drag",null),v&&(v.on("start",null),v.on("drag",null),v.on("end",null))})}}),j}const Bo=Symbol("vueFlow"),Do=Symbol("nodeId"),Vo=Symbol("nodeRef"),bs=Symbol("edgeId"),Es=Symbol("edgeRef"),Tt=Symbol("slots");function xs(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),updateStart:R(),update:R(),updateEnd:R()}}function Ss(e,t){const n=xs();return n.doubleClick.on(o=>{var i,r;t.edgeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.edgeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.edgeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.edgeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.edgeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.edgeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.updateStart.on(o=>{var i,r;t.edgeUpdateStart(o),(r=(i=e.events)==null?void 0:i.updateStart)==null||r.call(i,o)}),n.update.on(o=>{var i,r;t.edgeUpdate(o),(r=(i=e.events)==null?void 0:i.update)==null||r.call(i,o)}),n.updateEnd.on(o=>{var i,r;t.edgeUpdateEnd(o),(r=(i=e.events)==null?void 0:i.updateEnd)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function Ns(){const{viewport:e,snapGrid:t,snapToGrid:n}=de();return({sourceEvent:o})=>{const i=o.touches?o.touches[0].clientX:o.clientX,r=o.touches?o.touches[0].clientY:o.clientY,a={x:(i-e.value.x)/e.value.zoom,y:(r-e.value.y)/e.value.zoom};return{xSnapped:n.value?t.value[0]*Math.round(a.x/t.value[0]):a.x,ySnapped:n.value?t.value[1]*Math.round(a.y/t.value[1]):a.y,...a}}}function Pt(){return!0}function Oo({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:a}){const{vueFlowRef:s,connectionMode:u,connectionRadius:c,connectOnClick:d,connectionClickStartHandle:h,nodesConnectable:g,autoPanOnConnect:m,findNode:b,panBy:_,startConnection:x,updateConnection:N,endConnection:p,emits:C,viewport:E,edges:$,nodes:A,isValidConnection:D}=de();let U=null,Z=!1,V=null;function S(H){var v;const P=l.toValue(n)==="target",k=xn(H),T=Lo(H.target);if(k&&H.button===0||!k){let z=function(f){J=Re(f,q);const{handle:y,validHandleResult:w}=Zs(f,T,mn(J,E.value,!1,[1,1]),c.value,ie,I=>ui(f,I,u.value,l.toValue(t),l.toValue(e),P?"target":"source",L,T,$.value,A.value,b));if(K=y,Q||(Y(),Q=!0),U=w.connection,Z=w.isValid,V=w.handleDomNode,N(K&&Z?Xo({x:K.x,y:K.y},E.value):J,w.endHandle,Ks(!!K,Z)),!K&&!Z&&!V)return Sn(W);U&&U.source!==U.target&&V&&(Sn(W),W=V,V.classList.add("connecting","vue-flow__handle-connecting"),V.classList.toggle("valid",Z),V.classList.toggle("vue-flow__handle-valid",Z))},M=function(f){(K||V)&&U&&Z&&(r?r(f,U):C.connect(U)),C.connectEnd(f),i&&(a==null||a(f)),Sn(W),cancelAnimationFrame(re),p(f),Q=!1,Z=!1,U=null,V=null,T.removeEventListener("mousemove",z),T.removeEventListener("mouseup",M),T.removeEventListener("touchmove",z),T.removeEventListener("touchend",M)};const B=b(l.toValue(t));let L=l.toValue(o)||D.value||Pt;!L&&B&&(L=(P?B.isValidSourcePos:B.isValidTargetPos)||Pt);let K,re=0;const{x:te,y:oe}=Re(H),ue=T==null?void 0:T.elementFromPoint(te,oe),le=Nn(l.toValue(i),ue),q=(v=s.value)==null?void 0:v.getBoundingClientRect();if(!q||!le)return;let W,J=Re(H,q),Q=!1;const ie=Ws({nodes:A.value,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:le}),Y=()=>{if(!m.value)return;const[f,y]=jo(J,q);_({x:f,y}),re=requestAnimationFrame(Y)};x({nodeId:l.toValue(t),handleId:l.toValue(e),type:le},{x:te-q.left,y:oe-q.top}),C.connectStart({event:H,nodeId:l.toValue(t),handleId:l.toValue(e),handleType:le}),T.addEventListener("mousemove",z),T.addEventListener("mouseup",M),T.addEventListener("touchmove",z),T.addEventListener("touchend",M)}}function j(H){if(!d.value)return;const v=l.toValue(n)==="target";if(!h.value)C.clickConnectStart({event:H,nodeId:l.toValue(t),handleId:l.toValue(e)}),x({nodeId:l.toValue(t),type:l.toValue(n),handleId:l.toValue(e)},void 0,!0);else{let P=l.toValue(o)||D.value||Pt;const k=b(l.toValue(t));if(!P&&k&&(P=(v?k.isValidSourcePos:k.isValidTargetPos)||Pt),k&&(typeof k.connectable>"u"?g.value:k.connectable)===!1)return;const T=Lo(H.target),{connection:z,isValid:M}=ui(H,{nodeId:l.toValue(t),id:l.toValue(e),type:l.toValue(n)},u.value,h.value.nodeId,h.value.handleId||null,h.value.type,P,T,$.value,A.value,b),B=z.source===z.target;M&&!B&&C.connect(z),C.clickConnectEnd(H),p(H,!0)}}return{handlePointerDown:S,handleClick:j}}function Cs(){return l.inject(Do,"")}function Ao(e){const t=e??Cs()??"",n=l.inject(Vo,l.ref(null)),{findNode:o,edges:i,emits:r}=de(),a=o(t);return a||r.error(new ge(he.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:a,parentNode:l.computed(()=>o(a.parentNode)),connectedEdges:l.computed(()=>yn([a],i.value))}}function ks(){return{doubleClick:R(),click:R(),mouseEnter:R(),mouseMove:R(),mouseLeave:R(),contextMenu:R(),dragStart:R(),drag:R(),dragStop:R()}}function Ms(e,t){const n=ks();return n.doubleClick.on(o=>{var i,r;t.nodeDoubleClick(o),(r=(i=e.events)==null?void 0:i.doubleClick)==null||r.call(i,o)}),n.click.on(o=>{var i,r;t.nodeClick(o),(r=(i=e.events)==null?void 0:i.click)==null||r.call(i,o)}),n.mouseEnter.on(o=>{var i,r;t.nodeMouseEnter(o),(r=(i=e.events)==null?void 0:i.mouseEnter)==null||r.call(i,o)}),n.mouseMove.on(o=>{var i,r;t.nodeMouseMove(o),(r=(i=e.events)==null?void 0:i.mouseMove)==null||r.call(i,o)}),n.mouseLeave.on(o=>{var i,r;t.nodeMouseLeave(o),(r=(i=e.events)==null?void 0:i.mouseLeave)==null||r.call(i,o)}),n.contextMenu.on(o=>{var i,r;t.nodeContextMenu(o),(r=(i=e.events)==null?void 0:i.contextMenu)==null||r.call(i,o)}),n.dragStart.on(o=>{var i,r;t.nodeDragStart(o),(r=(i=e.events)==null?void 0:i.dragStart)==null||r.call(i,o)}),n.drag.on(o=>{var i,r;t.nodeDrag(o),(r=(i=e.events)==null?void 0:i.drag)==null||r.call(i,o)}),n.dragStop.on(o=>{var i,r;t.nodeDragStop(o),(r=(i=e.events)==null?void 0:i.dragStop)==null||r.call(i,o)}),Object.entries(n).reduce((o,[i,r])=>(o.emit[i]=r.trigger,o.on[i]=r.on,o),{emit:{},on:{}})}function zo(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:a,emits:s}=de();return(u,c=!1)=>{const d=r.value?i.value[0]:5,h=r.value?i.value[1]:5,g=c?4:1,m=u.x*d*g,b=u.y*h*g,_=[];for(const x of e.value)if(x.draggable||a&&typeof x.draggable>"u"){const N={x:x.computedPosition.x+m,y:x.computedPosition.y+b},{computedPosition:p}=bn(x,N,s.error,t.value,x.parentNode?o(x.parentNode):void 0);_.push({id:x.id,position:p,from:x.position,distance:{x:u.x,y:u.y},dimensions:x.dimensions})}n(_,!0,!1)}}const hn=.1;function $e(){return Ot("Viewport not initialized yet."),Promise.resolve(!1)}const Is={zoomIn:$e,zoomOut:$e,zoomTo:$e,fitView:$e,setCenter:$e,fitBounds:$e,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:$e,setTransform:$e,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function $s(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(gn(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,a){return new Promise(s=>{const{x:u,y:c}=Ho({x:-o,y:-i},e.translateExtent),d=Ue.translate(-u,-c).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(gn(e.d3Selection,a,()=>{s(!0)}),d):s(!1)})}return l.computed(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i==null?void 0:i.duration),zoomOut:i=>t(1/1.2,i==null?void 0:i.duration),zoomTo:(i,r)=>new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(gn(e.d3Selection,r==null?void 0:r.duration,()=>{a(!0)}),i):a(!1)}),setViewport:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),setTransform:(i,r)=>n(i.x,i.y,i.zoom,r==null?void 0:r.duration),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(i={padding:hn,includeHiddenNodes:!1,duration:0})=>{var r,a;const s=[];for(const g of e.nodes)g.dimensions.width&&g.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!g.hidden)&&(!((r=i.nodes)!=null&&r.length)||(a=i.nodes)!=null&&a.length&&i.nodes.includes(g.id))&&s.push(g);if(!s.length)return Promise.resolve(!1);const u=Zo(s),{x:c,y:d,zoom:h}=Ko(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??hn,i.offset);return n(c,d,h,i==null?void 0:i.duration)},setCenter:(i,r,a)=>{const s=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:e.maxZoom,u=e.dimensions.width/2-i*s,c=e.dimensions.height/2-r*s;return n(u,c,s,a==null?void 0:a.duration)},fitBounds:(i,r={padding:hn})=>{const{x:a,y:s,zoom:u}=Ko(i,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,r.padding);return n(a,s,u,r==null?void 0:r.duration)},project:i=>mn(i,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x-r,y:i.y-a};return mn(s,e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:i=>{if(e.vueFlowRef){const{x:r,y:a}=e.vueFlowRef.getBoundingClientRect(),s={x:i.x+r,y:i.y+a};return Xo(s,e.viewport)}return{x:0,y:0}}}:Is)}function gn(e,t=0,n){return e.transition().duration(t).on("end",n)}function Ts(e,t,n){const o=l.effectScope(!0);return o.run(()=>{const i=()=>{o.run(()=>{let _,x,N=!!(n.nodes.value.length||n.edges.value.length);_=Le([e.modelValue,()=>{var p,C;return(C=(p=e.modelValue)==null?void 0:p.value)==null?void 0:C.length}],([p])=>{p&&Array.isArray(p)&&(x==null||x.pause(),n.setElements(p),!x&&!N&&p.length?N=!0:x==null||x.resume())}),x=Le([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([p,C])=>{var E;(E=e.modelValue)!=null&&E.value&&Array.isArray(e.modelValue.value)&&(_==null||_.pause(),e.modelValue.value=[...p,...C],l.nextTick(()=>{_==null||_.resume()}))},{immediate:N}),l.onScopeDispose(()=>{_==null||_.stop(),x==null||x.stop()})})},r=()=>{o.run(()=>{let _,x,N=!!n.nodes.value.length;_=Le([e.nodes,()=>{var p,C;return(C=(p=e.nodes)==null?void 0:p.value)==null?void 0:C.length}],([p])=>{p&&Array.isArray(p)&&(x==null||x.pause(),n.setNodes(p),!x&&!N&&p.length?N=!0:x==null||x.resume())}),x=Le([n.nodes,()=>n.nodes.value.length],([p])=>{var C;(C=e.nodes)!=null&&C.value&&Array.isArray(e.nodes.value)&&(_==null||_.pause(),e.nodes.value=[...p],l.nextTick(()=>{_==null||_.resume()}))},{immediate:N}),l.onScopeDispose(()=>{_==null||_.stop(),x==null||x.stop()})})},a=()=>{o.run(()=>{let _,x,N=!!n.edges.value.length;_=Le([e.edges,()=>{var p,C;return(C=(p=e.edges)==null?void 0:p.value)==null?void 0:C.length}],([p])=>{p&&Array.isArray(p)&&(x==null||x.pause(),n.setEdges(p),!x&&!N&&p.length?N=!0:x==null||x.resume())}),x=Le([n.edges,()=>n.edges.value.length],([p])=>{var C;(C=e.edges)!=null&&C.value&&Array.isArray(e.edges.value)&&(_==null||_.pause(),e.edges.value=[...p],l.nextTick(()=>{_==null||_.resume()}))},{immediate:N}),l.onScopeDispose(()=>{_==null||_.stop(),x==null||x.stop()})})},s=()=>{o.run(()=>{l.watch(()=>t.maxZoom,()=>{t.maxZoom&&fe(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{l.watch(()=>t.minZoom,()=>{t.minZoom&&fe(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},c=()=>{o.run(()=>{l.watch(()=>t.translateExtent,()=>{t.translateExtent&&fe(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},d=()=>{o.run(()=>{l.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&fe(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},h=()=>{o.run(()=>{l.watch(()=>t.applyDefault,()=>{fe(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},g=()=>{o.run(()=>{const _=async x=>{let N=x;typeof t.autoConnect=="function"&&(N=await t.autoConnect(x)),N!==!1&&n.addEdges([N])};l.watch(()=>t.autoConnect,()=>{fe(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),l.watch(n.autoConnect,(x,N,p)=>{x?n.onConnect(_):n.hooks.value.connect.off(_),p(()=>{n.hooks.value.connect.off(_)})},{immediate:!0})})},m=()=>{const _=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const x of Object.keys(t)){const N=x;if(!_.includes(N)){const p=l.toRef(()=>t[N]),C=n[N];l.isRef(C)&&o.run(()=>{l.watch(p,E=>{fe(E)&&(C.value=E)},{immediate:!0})})}}};(()=>{i(),r(),a(),u(),s(),c(),d(),h(),g(),m()})()}),()=>o.stop()}function Ro(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function pn(e,t){const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)}function Bt(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Ae(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function Ho(e,t){return{x:Ae(e.x,t[0][0],t[1][0]),y:Ae(e.y,t[0][1],t[1][1])}}function Lo(e){const t=e.getRootNode();return"elementFromPoint"in t?t:dn().document}function Te(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function ze(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!Te(e)}function We(e){return ze(e)&&"computedPosition"in e}function Dt(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ps(e){return Dt(e.width)&&Dt(e.height)&&Dt(e.x)&&Dt(e.y)}function Bs(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:l.markRaw({width:0,height:0}),computedPosition:l.markRaw({z:0,...e.position}),handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:fe(e.data)?e.data:{},events:l.markRaw(fe(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Fo(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??(t==null?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:(o=e.sourceHandle)==null?void 0:o.toString(),targetHandle:(i=e.targetHandle)==null?void 0:i.toString(),updatable:e.updatable??(n==null?void 0:n.updatable),selectable:e.selectable??(n==null?void 0:n.selectable),focusable:e.focusable??(n==null?void 0:n.focusable),data:fe(e.data)?e.data:{},events:l.markRaw(fe(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(n==null?void 0:n.interactionWidth),...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Yo(e,t,n,o){const i=typeof e=="string"?e:e.id,r=new Set,a=o==="source"?"target":"source";for(const s of n)s[a]===i&&r.add(s[o]);return t.filter(s=>r.has(s.id))}function Ds(...e){if(e.length===3){const[r,a,s]=e;return Yo(r,a,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Te(r)&&r.source===o).map(r=>n.find(a=>ze(a)&&a.id===r.target))}function Vs(...e){if(e.length===3){const[r,a,s]=e;return Yo(r,a,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>Te(r)&&r.target===o).map(r=>n.find(a=>ze(a)&&a.id===r.source))}function Go({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Os(e,t){return t.some(n=>Te(n)&&n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle))}function Xo({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function mn({x:e,y:t},{x:n,y:o,zoom:i},r,[a,s]){const u={x:(e-n)/i,y:(t-o)/i};return r?{x:a*Math.round(u.x/a),y:s*Math.round(u.y/s)}:u}function As(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}}function Uo({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function zs({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Zo(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<e.length;n++){const o=e[n];t=As(t,Uo({...o.computedPosition,...o.dimensions}))}return zs(t)}function Wo(e,t,{x:n,y:o,zoom:i}={x:0,y:0,zoom:1},r=!1,a=!1){const s={x:(t.x-n)/i,y:(t.y-o)/i,width:t.width/i,height:t.height/i};return e.filter(u=>{const{computedPosition:c={x:0,y:0},dimensions:d={width:0,height:0},selectable:h}=u;if(a&&!h)return!1;const g={...c,width:d.width||0,height:d.height||0},m=pn(s,g),b=typeof d.width>"u"||typeof d.height>"u"||d.width===0||d.height===0,_=r&&m>0,x=d.width*d.height;return b||_||m>=x})}function yn(e,t){const n=new Set;if(typeof e=="string")n.add(e);else if(e.length>=1)for(const o of e)n.add(o.id);return t.filter(o=>n.has(o.source)||n.has(o.target))}function Ko(e,t,n,o,i,r=.1,a={x:0,y:0}){const s=t/(e.width*(1+r)),u=n/(e.height*(1+r)),c=Math.min(s,u),d=Ae(c,o,i),h=e.x+e.width/2,g=e.y+e.height/2,m=t/2-h*d+(a.x??0),b=n/2-g*d+(a.y??0);return{x:m,y:b,zoom:d}}function Rs(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function qo(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:qo(n,t):!1}function ut(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function Jo(e,t,n){return e<t?Ae(Math.abs(e-t),1,50)/50:e>n?-Ae(Math.abs(e-n),1,50)/50:0}function jo(e,t){const n=Jo(e.x,35,t.width-35)*20,o=Jo(e.y,35,t.height-35)*20;return[n,o]}function vn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if(typeof t.style=="function"?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if(typeof i.width=="string"){const r=Number(i.width.replace("px",""));i.width=`${r+n}px`}else i.width+=n;if(o>0)if(typeof i.height=="string"){const r=Number(i.height.replace("px",""));i.height=`${r+o}px`}else i.height+=o;if(e.position.x<0){const r=Math.abs(e.position.x);if(t.position.x=t.position.x-r,typeof i.width=="string"){const a=Number(i.width.replace("px",""));i.width=`${a+r}px`}else i.width+=r;e.position.x=0}if(e.position.y<0){const r=Math.abs(e.position.y);if(t.position.y=t.position.y-r,typeof i.height=="string"){const a=Number(i.height.replace("px",""));i.height=`${a+r}px`}else i.height+=r;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),typeof t.style=="function"?t.style=r=>{const a=t.style;return{...a(r),...i}}:t.style={...t.style,...i}}}}function Qo(e,t){var n,o;const i=e.filter(a=>a.type==="add"||a.type==="remove");for(const a of i)if(a.type==="add")t.findIndex(u=>u.id===a.item.id)===-1&&t.push(a.item);else if(a.type==="remove"){const s=t.findIndex(u=>u.id===a.id);s!==-1&&t.splice(s,1)}const r=t.map(a=>a.id);for(const a of t)for(const s of e)if(s.id===a.id)switch(s.type){case"select":a.selected=s.selected;break;case"position":if(We(a)&&(typeof s.position<"u"&&(a.position=s.position),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&a.parentNode)){const u=t[r.indexOf(a.parentNode)];u&&We(u)&&vn(a,u)}break;case"dimensions":if(We(a)&&(typeof s.dimensions<"u"&&(a.dimensions=s.dimensions),typeof s.updateStyle<"u"&&(a.style={...a.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(a.resizing=s.resizing),a.expandParent&&a.parentNode)){const u=t[r.indexOf(a.parentNode)];u&&We(u)&&(!!u.dimensions.width&&!!u.dimensions.height?vn(a,u):l.nextTick(()=>{vn(a,u)}))}break}return t}function Me(e,t){return{id:e,type:"select",selected:t}}function ei(e){return{item:e,type:"add"}}function ti(e){return{id:e,type:"remove"}}function ni(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function wn(e,t){return e.reduce((n,o)=>{let i=t.includes(o.id);fe(o.selectable)&&!o.selectable&&(i=!1);const r=We(o)?"changedNodes":"changedEdges";return!o.selected&&i?n[r].push(Me(o.id,!0)):o.selected&&!i&&n[r].push(Me(o.id,!1)),n},{changedNodes:[],changedEdges:[]})}function R(e){const t=new Set;let n=!1;const o=()=>t.size>0;e&&(n=!0,t.add(e));const i=s=>{t.delete(s)};return{on:s=>{e&&n&&t.delete(e),t.add(s);const u=()=>{i(s),e&&n&&t.add(e)};return ct(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function oi(e,t,n){let o=e;do{if(o&&o.matches(t))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function Hs(e,t,n,o,i){var r,a;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!qo(u,o))&&(u.draggable||t&&typeof u.draggable>"u")&&s.push(l.markRaw({id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-((r=u.computedPosition)==null?void 0:r.x)||0,y:n.y-((a=u.computedPosition)==null?void 0:a.y)||0},from:u.computedPosition,extent:u.extent,parentNode:u.parentNode,dimensions:u.dimensions,expandParent:u.expandParent}));return s}function _n({id:e,dragItems:t,findNode:n}){const o=[];for(const i of t){const r=n(i.id);r&&o.push(r)}return[e?o.find(i=>i.id===e):o[0],o]}function ii(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function Ls(e,t,n){const[o,i,r,a]=typeof e!="string"?ii(e.padding):[0,0,0,0];return n&&typeof n.computedPosition.x<"u"&&typeof n.computedPosition.y<"u"&&typeof n.dimensions.width<"u"&&typeof n.dimensions.height<"u"?[[n.computedPosition.x+a,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]:!1}function Fs(e,t,n,o){let i=e.extent||n;if((i==="parent"||!Array.isArray(i)&&(i==null?void 0:i.range)==="parent")&&!e.expandParent)if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const r=Ls(i,e,o);r&&(i=r)}else t(new ge(he.NODE_EXTENT_INVALID,e.id)),i=n;else if(Array.isArray(i)){const r=(o==null?void 0:o.computedPosition.x)||0,a=(o==null?void 0:o.computedPosition.y)||0;i=[[i[0][0]+r,i[0][1]+a],[i[1][0]+r,i[1][1]+a]]}else if(i!=="parent"&&(i!=null&&i.range)&&Array.isArray(i.range)){const[r,a,s,u]=ii(i.padding),c=(o==null?void 0:o.computedPosition.x)||0,d=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+c+u,i.range[0][1]+d+r],[i.range[1][0]+c-a,i.range[1][1]+d-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function Ys({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function bn(e,t,n,o,i){const r=Ys(e.dimensions,Fs(e,n,o,i)),a=Ho(t,r);return{position:{x:a.x-((i==null?void 0:i.computedPosition.x)||0),y:a.y-((i==null?void 0:i.computedPosition.y)||0)},computedPosition:a}}function En(e,t,n){const o=((n==null?void 0:n.x)??0)+t.x,i=((n==null?void 0:n.y)??0)+t.y,r=(n==null?void 0:n.width)??t.width,a=(n==null?void 0:n.height)??t.height;switch(e){case F.Top:return{x:o+r/2,y:i};case F.Right:return{x:o+r,y:i+a/2};case F.Bottom:return{x:o+r/2,y:i+a};case F.Left:return{x:o,y:i+a/2}}}function ri(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function Gs(e,t,n,o,i,r){const a=En(n,{...e.dimensions,...e.computedPosition},t),s=En(r,{...o.dimensions,...o.computedPosition},i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}}function Xs({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:a,height:s,viewport:u}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=Uo({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:a/u.zoom,height:s/u.zoom}),h=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),g=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(h*g)>0}function Us(e,t,n=!1){const o=typeof e.zIndex=="number";let i=o?e.zIndex:0;const r=t(e.source),a=t(e.target);return!r||!a?0:(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,a.computedPosition.z||0)),i)}var he=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(he||{});const li={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid
2
+ Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found
2
3
  Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent
3
4
  Node: ${e}
4
5
  Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing
@@ -17,5 +18,5 @@ Edge: ${e}
17
18
  Source: ${t}
18
19
  Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed
19
20
  Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found
20
- Edge: ${e}`};class le extends Error{constructor(t,...n){var o;super((o=Qn[t])==null?void 0:o.call(Qn,...n)),this.code=t}}const Qt=()=>typeof window<"u"?window:{chrome:!1};function Jn(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function Jt(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 st(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Ce(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function eo(e,t){return{x:Ce(e.x,t[0][0],t[1][0]),y:Ce(e.y,t[0][1],t[1][1])}}function to(e){const t=e.getRootNode(),n=Qt();return"elementFromPoint"in t?t:n.document}function De(e){return e&&"id"in e&&"source"in e&&"target"in e}function pa(e){return De(e)&&"sourceNode"in e&&"targetNode"in e}function ut(e){return e&&"id"in e&&!De(e)}function ze(e){return ut(e)&&"computedPosition"in e}function ga(e){return!!e.width&&!!e.height&&!!e.x&&!!e.y}function ma(e,t={}){let n=t;return ze(e)||(n={type:e.type??t.type??"default",dimensions:a.markRaw({width:0,height:0}),handleBounds:{source:[],target:[]},computedPosition:a.markRaw({z:0,...e.position}),draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,...t,data:oe(e.data)?e.data:{},events:a.markRaw(oe(e.events)?e.events:{})}),Object.assign({},n,e,{id:e.id.toString()})}function no(e,t={}){const n=oe(e.events)?e.events:t.events&&oe(t.events)?t.events:{},o=oe(e.data)?e.data:t.data&&oe(t.data)?t.data:{};return t=pa(e)?t:{...t,sourceHandle:(e.sourceHandle?e.sourceHandle.toString():void 0)||t.sourceHandle,targetHandle:(e.targetHandle?e.targetHandle.toString():void 0)||t.targetHandle,type:e.type??t.type??"default",source:e.source.toString()||t.source,target:e.target.toString()||t.target,updatable:e.updatable??t.updatable,selectable:e.selectable??t.selectable,focusable:e.focusable??t.focusable,data:o,events:a.markRaw(n),label:(e.label&&!be(e.label)?a.markRaw(e.label):e.label)||t.label,interactionWidth:e.interactionWidth||t.interactionWidth},Object.assign({},t,e,{id:e.id.toString()})}function oo({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function ya(e,t){return t.some(n=>De(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 va({x:e,y:t},{x:n,y:o,zoom:r}){return{x:e*r+n,y:t*r+o}}function ro({x:e,y:t},{x:n,y:o,zoom:r},i,[l,s]){const u={x:(e-n)/r,y:(t-o)/r};return i?{x:l*Math.round(u.x/l),y:s*Math.round(u.y/s)}:u}function wa(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 ao({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function ba({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function io(e){const t=e.reduce((n,{computedPosition:o={x:0,y:0},dimensions:r={width:0,height:0}}={})=>wa(n,ao({...o,...r})),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ba(t)}function lo(e,t,{x:n,y:o,zoom:r}={x:0,y:0,zoom:1},i=!1,l=!1){const s={x:(t.x-n)/r,y:(t.y-o)/r,width:t.width/r,height:t.height/r};return e.filter(u=>{const{computedPosition:c={x:0,y:0},dimensions:d={width:0,height:0},selectable:f}=u;if(l&&!f)return!1;const p={...c,width:d.width||0,height:d.height||0},b=Jt(s,p),v=typeof d.width>"u"||typeof d.height>"u"||d.width===0||d.height===0,x=i&&b>0,k=d.width*d.height;return v||x||b>=k})}function ct(e,t){const n=e.map(o=>be(o)?o:o.id);return t.filter(o=>n.includes(o.source)||n.includes(o.target))}function so(e,t,n,o,r,i=.1,l={x:0,y:0}){const s=t/(e.width*(1+i)),u=n/(e.height*(1+i)),c=Math.min(s,u),d=Ce(c,o,r),f=e.x+e.width/2,p=e.y+e.height/2,b=t/2-f*d+(l.x??0),v=n/2-p*d+(l.y??0);return{x:b,y:v,zoom:d}}function xa(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function uo(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:uo(n,t):!1}function Me(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`}function oe(e){return typeof a.unref(e)<"u"}function _a(e,t,n){if(!e.source||!e.target)return n(new le(ie.EDGE_INVALID,e.id)),!1;let o;return De(e)?o=e:o={...e,id:oo(e)},o=no(o),ya(o,t)?!1:o}function Ea(e,t,n,o,r,i){if(!t.source||!t.target)return i(new le(ie.EDGE_INVALID,e.id)),!1;const l=o(e.id);if(!l)return i(new le(ie.EDGE_NOT_FOUND,e.id)),!1;const{id:s,...u}=e,c={...u,id:r?oo(t):s,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.splice(n.indexOf(l),1,c),c}function co(e,t,n,o){const r={},i=e.map(s=>{const u=ma(s,{...n(s.id),parentNode:s.parentNode});return s.parentNode&&(r[s.parentNode]=!0),u}),l=[...i,...t];return i.forEach(s=>{const u=l.find(c=>c.id===s.parentNode);s.parentNode&&!u&&o(new le(ie.NODE_MISSING_PARENT,s.id,s.parentNode)),(s.parentNode||r[s.id])&&(r[s.id]&&(s.isParent=!0),u&&(u.isParent=!0))}),i}var j=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(j||{}),en=(e=>(e.Partial="partial",e.Full="full",e))(en||{}),Be=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(Be||{}),Pe=(e=>(e.Strict="strict",e.Loose="loose",e))(Pe||{}),tn=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(tn||{}),dt=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(dt||{});const fo=Symbol("vueFlow"),ho=Symbol("nodeId"),po=Symbol("nodeRef"),ka=Symbol("edgeId"),Sa=Symbol("edgeRef"),ft=Symbol("slots");function Na(e){const t=e??a.inject(ho,""),n=a.inject(po,null),{findNode:o,edges:r,emits:i}=re(),l=o(t);return l||i.error(new le(ie.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:l,parentNode:a.computed(()=>o(l.parentNode)),connectedEdges:a.computed(()=>ct([l],r.value))}}function nn(e){return"clientX"in e}function Ae(e,t){var n,o;const r=nn(e),i=r?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,l=r?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:i-((t==null?void 0:t.left)??0),y:l-((t==null?void 0:t.top)??0)}}function ht(e,t,n){const o=((n==null?void 0:n.x)??0)+t.x,r=((n==null?void 0:n.y)??0)+t.y,i=(n==null?void 0:n.width)??t.width,l=(n==null?void 0:n.height)??t.height;switch(e){case j.Top:return{x:o+i/2,y:r};case j.Right:return{x:o+i,y:r+l/2};case j.Bottom:return{x:o+i/2,y:r+l};case j.Left:return{x:o,y:r+l/2}}}function go(e=[],t){return e.length?!t||e.length===1?e[0]:t&&e.find(n=>n.id===t)||null:null}function Ca(e,t,n,o,r,i){const l=ht(n,{...e.dimensions,...e.computedPosition},t),s=ht(i,{...o.dimensions,...o.computedPosition},r);return{sourceX:l.x,sourceY:l.y,targetX:s.x,targetY:s.y}}function Ma({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:r,targetHeight:i,width:l,height:s,viewport:u}){const c={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+r),y2:Math.max(e.y+o,t.y+i)};c.x===c.x2&&(c.x2+=1),c.y===c.y2&&(c.y2+=1);const d=ao({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:l/u.zoom,height:s/u.zoom}),f=Math.max(0,Math.min(d.x2,c.x2)-Math.max(d.x,c.x)),p=Math.max(0,Math.min(d.y2,c.y2)-Math.max(d.y,c.y));return Math.ceil(f*p)>0}function Ba(e,t,n=!1){let o=-1;const r=e.reduce((i,l)=>{const s=we(l.zIndex);let u=s?l.zIndex:0;const c=t(l.source),d=t(l.target);return!c||!d||(n&&(u=s?l.zIndex:Math.max(c.computedPosition.z||0,d.computedPosition.z||0)),i[u]?i[u].push(l):i[u]=[l],o=u>o?u:o),i},{});return Object.entries(Object.keys(r).length?r:{0:[]}).map(([i,l])=>{const s=+i;return{edges:l,level:s,isMaxLevel:s===o}})}function on(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function mo(e,t,n,o){return(t[n]||[]).reduce((r,i)=>(`${e.id}-${i.id}-${n}`!==o&&r.push({id:i.id||null,type:n,nodeId:e.id,...ht(i.position,{...e.dimensions,...e.computedPosition},i)}),r),[])}function Pa(e,t,n){let o=null,r=1/0;return n.forEach(i=>{const l=Math.sqrt((i.x-e.x)**2+(i.y-e.y)**2);l<=t&&l<r&&(r=l,o=i)}),o}function yo(e,t,n,o,r,i,l,s,u,c){const d=i==="target",f=s.querySelector(`.vue-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),{x:p,y:b}=Ae(e),v=s.elementFromPoint(p,b),x=v!=null&&v.classList.contains("vue-flow__handle")?v:f,k={handleDomNode:x,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null};if(x){const E=vo(void 0,x),B=x.getAttribute("data-nodeid"),G=x.getAttribute("data-handleid"),w=x.classList.contains("connectable"),P=x.classList.contains("connectableend"),D={source:d?B:o,sourceHandle:d?G:r,target:d?o:B,targetHandle:d?r:G};k.connection=D,w&&P&&(n===Pe.Strict?d&&E==="source"||!d&&E==="target":B!==o||G!==r)&&(k.endHandle={nodeId:B,handleId:G,type:E},k.isValid=l(D,{edges:u,sourceNode:c(D.source),targetNode:c(D.target)}))}return k}function Ia({nodes:e,nodeId:t,handleId:n,handleType:o}){return e.reduce((r,i)=>{const{handleBounds:l}=i;let s=[],u=[];return l&&(s=mo(i,l,"source",`${t}-${n}-${o}`),u=mo(i,l,"target",`${t}-${n}-${o}`)),r.push(...s,...u),r},[])}function vo(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function $a(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function wo(e,t,n){return e<t?Ce(Math.abs(e-t),1,50)/50:e>n?-Ce(Math.abs(e-n),1,50)/50:0}function bo(e,t){const n=wo(e.x,35,t.width-35)*20,o=wo(e.y,35,t.height-35)*20;return[n,o]}function pt(){return!0}function xo({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:r,onEdgeUpdate:i,onEdgeUpdateEnd:l}){const s=a.computed(()=>ne(n)==="target"),{vueFlowRef:u,connectionMode:c,connectionRadius:d,connectOnClick:f,connectionClickStartHandle:p,nodesConnectable:b,autoPanOnConnect:v,findNode:x,panBy:k,getNodes:E,startConnection:B,updateConnection:G,endConnection:w,emits:P,viewport:D,edges:g,isValidConnection:_}=re();let N=null,C=!1,$=null;function q(y){var z;const S=nn(y),R=to(y.target);if(S&&y.button===0||!S){let F=function(W){T=Ae(W,m),A=Pa(ro(T,D.value,!1,[1,1]),d.value,L),V||(K(),V=!0);const J=yo(W,A,c.value,ne(t),ne(e),s.value?"target":"source",H,R,g.value,x);if(N=J.connection,C=J.isValid,$=J.handleDomNode,G(A&&C?va({x:A.x,y:A.y},D.value):T,J.endHandle,$a(!!A,C)),!A&&!C&&!$)return on(I);N&&N.source!==N.target&&$&&(on(I),I=$,$.classList.add("connecting","vue-flow__handle-connecting"),$.classList.toggle("valid",C),$.classList.toggle("vue-flow__handle-valid",C))},U=function(W){(A||$)&&N&&C&&(i?i(W,N):P.connect(N)),P.connectEnd(W),r&&(l==null||l(W)),on(I),cancelAnimationFrame(Z),w(W),V=!1,C=!1,N=null,$=null,R.removeEventListener("mousemove",F),R.removeEventListener("mouseup",U),R.removeEventListener("touchmove",F),R.removeEventListener("touchend",U)};const O=x(ne(t));let H=o||_.value||pt;!H&&O&&(H=(s?O.isValidSourcePos:O.isValidTargetPos)||pt);let A,Z=0;const{x:Q,y:te}=Ae(y),M=R==null?void 0:R.elementFromPoint(Q,te),h=vo(ne(r),M),m=(z=u.value)==null?void 0:z.getBoundingClientRect();if(!m||!h)return;let I,T=Ae(y,m),V=!1;const L=Ia({nodes:E.value,nodeId:ne(t),handleId:ne(e),handleType:h}),K=()=>{if(!v)return;const[W,J]=bo(T,m);k({x:W,y:J}),Z=requestAnimationFrame(K)};B({nodeId:ne(t),handleId:ne(e),type:h},{x:Q-m.left,y:te-m.top},y),P.connectStart({event:y,nodeId:ne(t),handleId:ne(e),handleType:h}),R.addEventListener("mousemove",F),R.addEventListener("mouseup",U),R.addEventListener("touchmove",F),R.addEventListener("touchend",U)}}function ee(y){if(f.value)if(!p.value)P.clickConnectStart({event:y,nodeId:ne(t),handleId:ne(e)}),B({nodeId:ne(t),type:ne(n),handleId:ne(e)},void 0,y,!0);else{let z=o||_.value||pt;const S=x(ne(t));if(!z&&S&&(z=(s?S.isValidSourcePos:S.isValidTargetPos)||pt),S&&(typeof S.connectable>"u"?b.value:S.connectable)===!1)return;const R=to(y.target),{connection:F,isValid:U}=yo(y,{nodeId:ne(t),id:ne(e),type:ne(n)},c.value,p.value.nodeId,p.value.handleId||null,p.value.type,z,R,g.value,x),O=F.source===F.target;U&&!O&&P.connect(F),P.clickConnectEnd(y),w(y,!0)}}return{handlePointerDown:q,handleClick:ee}}function Ta(e,t){const n={};for(const o in e)t.includes(o)||Object.defineProperty(n,o,{enumerable:!0,get:()=>e[o]});return n}const Ra=["data-id","data-handleid","data-nodeid","data-handlepos"],Oa={name:"Handle",compatConfig:{MODE:3}},Ve=a.defineComponent({...Oa,props:{id:null,type:null,position:{default:j.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e){const t=Ta(e,["position","connectable","connectableStart","connectableEnd","id","isValidConnection"]),n=a.toRef(t,"type","source"),{connectionStartHandle:o,connectionClickStartHandle:r,connectionEndHandle:i,vueFlowRef:l,nodesConnectable:s,noDragClassName:u,noPanClassName:c}=re(),{id:d,node:f,nodeEl:p,connectedEdges:b}=Na(),v=a.ref(),x=a.computed(()=>e.id??`${d}__handle-${e.position}`),k=a.computed(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),E=a.computed(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),{handlePointerDown:B,handleClick:G}=xo({nodeId:d,handleId:x,isValidConnection:e.isValidConnection,type:n}),w=a.computed(()=>be(e.connectable)&&e.connectable==="single"?!b.value.some(N=>{const C=N[`${n.value}Handle`];return N[n.value]!==d?!1:C?C===x.value:!0}):ve(e.connectable)?e.connectable(f,b.value):oe(e.connectable)?e.connectable:s.value),P=a.computed(()=>{var N,C,$,q,ee,y;return((N=o.value)==null?void 0:N.nodeId)===d&&((C=o.value)==null?void 0:C.handleId)===x.value&&(($=o.value)==null?void 0:$.type)===n.value||((q=i.value)==null?void 0:q.nodeId)===d&&((ee=i.value)==null?void 0:ee.handleId)===x.value&&((y=i.value)==null?void 0:y.type)===n.value}),D=a.computed(()=>{var N,C,$;return((N=r.value)==null?void 0:N.nodeId)===d&&((C=r.value)==null?void 0:C.handleId)===x.value&&(($=r.value)==null?void 0:$.type)===n.value});ue(()=>f.initialized).toBe(!0,{flush:"post"}).then(()=>{var N;const C=(N=f.handleBounds[n.value])==null?void 0:N.find(R=>R.id===x.value);if(!l.value||C)return;const $=l.value.querySelector(".vue-flow__transformationpane");if(!p||!v.value||!$||!x.value)return;const q=p.value.getBoundingClientRect(),ee=v.value.getBoundingClientRect(),y=window.getComputedStyle($),{m22:z}=new window.DOMMatrixReadOnly(y.transform),S={id:x.value,position:e.position,x:(ee.left-q.left)/z,y:(ee.top-q.top)/z,...st(v.value)};f.handleBounds[n.value]=[...f.handleBounds[n.value]??[],S]});function g(N){const C=nn(N);w.value&&k.value&&(C&&N.button===0||!C)&&B(N)}function _(N){!d||!r.value&&!k.value||w.value&&G(N)}return(N,C)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"handle",ref:v,"data-id":`${a.unref(d)}-${a.unref(x)}-${a.unref(n)}`,"data-handleid":a.unref(x),"data-nodeid":a.unref(d),"data-handlepos":e.position,class:a.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${e.position}`,`vue-flow__handle-${a.unref(x)}`,a.unref(u),a.unref(c),a.unref(n),{connectable:a.unref(w),connecting:a.unref(D),connectablestart:a.unref(k),connectableend:a.unref(E),connectionindicator:a.unref(w)&&(a.unref(k)&&!a.unref(P)||a.unref(E)&&a.unref(P))}]]),onMousedown:g,onTouchstartPassive:g,onClick:_},[a.renderSlot(N.$slots,"default",{id:e.id})],42,Ra))}}),gt=function({sourcePosition:e=j.Bottom,targetPosition:t=j.Top,label:n,connectable:o=!0,isValidTargetPos:r,isValidSourcePos:i}){return[a.h(Ve,{type:"target",position:t,connectable:o,isValidConnection:r}),typeof n!="string"&&n?a.h(n):a.h("div",{innerHTML:n}),a.h(Ve,{type:"source",position:e,connectable:o,isValidConnection:i})]};gt.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable"],gt.inheritAttrs=!1,gt.compatConfig={MODE:3};const Da=gt,mt=function({sourcePosition:e=j.Bottom,label:t,connectable:n=!0,isValidSourcePos:o}){return[typeof t!="string"&&t?a.h(t):a.h("div",{innerHTML:t}),a.h(Ve,{type:"source",position:e,connectable:n,isValidConnection:o})]};mt.props=["sourcePosition","label","isValidSourcePos","connectable"],mt.inheritAttrs=!1,mt.compatConfig={MODE:3};const za=mt,yt=function({targetPosition:e=j.Top,label:t,connectable:n=!0,isValidTargetPos:o}){return[a.h(Ve,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof t!="string"&&t?a.h(t):a.h("div",{innerHTML:t})]};yt.props=["targetPosition","label","isValidTargetPos","connectable"],yt.inheritAttrs=!1,yt.compatConfig={MODE:3};const Aa=yt;function _o(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 Va(e,t,n,o,r){return e.filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!uo(i,o))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var l,s;return a.markRaw({id:i.id,position:i.position||{x:0,y:0},distance:{x:n.x-((l=i.computedPosition)==null?void 0:l.x)||0,y:n.y-((s=i.computedPosition)==null?void 0:s.y)||0},from:i.computedPosition,extent:i.extent,parentNode:i.parentNode,dimensions:i.dimensions})})}function rn({id:e,dragItems:t,findNode:n}){const o=t.reduce((r,i)=>{const l=n(i.id);return l&&r.push(l),r},[]);return[e?o.find(r=>r.id===e):o[0],o]}function Eo(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 La(e,t,n){const[o,r,i,l]=typeof e!="string"?Eo(e.padding):[0,0,0,0];return n&&we(n.computedPosition.x)&&we(n.computedPosition.y)&&we(n.dimensions.width)&&we(n.dimensions.height)?[[n.computedPosition.x+l,n.computedPosition.y+o],[n.computedPosition.x+(n.dimensions.width-t.dimensions.width)-r,n.computedPosition.y+(n.dimensions.height-t.dimensions.height)-i]]:!1}function Ya(e,t,n,o){let r=e.extent||n;if(r==="parent"||!Array.isArray(r)&&(r==null?void 0:r.range)==="parent")if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const i=La(r,e,o);i&&(r=i)}else t(new le(ie.NODE_EXTENT_INVALID,e.id)),r=n;else if(Array.isArray(r)){const i=(o==null?void 0:o.computedPosition.x)||0,l=(o==null?void 0:o.computedPosition.y)||0;r=[[r[0][0]+i,r[0][1]+l],[r[1][0]+i,r[1][1]+l]]}else if(r!=null&&r.range&&Array.isArray(r.range)){const[i,l,s,u]=Eo(r.padding),c=(o==null?void 0:o.computedPosition.x)||0,d=(o==null?void 0:o.computedPosition.y)||0;r=[[r.range[0][0]+c+u,r.range[0][1]+d+i],[r.range[1][0]+c-l,r.range[1][1]+d-s]]}return r}function an(e,t,n,o,r){const i=Ya(e,n,o,r),l=eo(t,i);return{position:{x:l.x-((r==null?void 0:r.computedPosition.x)||0),y:l.y-((r==null?void 0:r.computedPosition.y)||0)},computedPosition:l}}function ko(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:r,snapToGrid:i,nodesDraggable:l,emits:s}=re();return(u,c=!1)=>{const d=i.value?r.value[0]:5,f=i.value?r.value[1]:5,p=c?4:1,b=u.x*d*p,v=u.y*f*p,x=e.value.filter(k=>k.draggable||l&&typeof k.draggable>"u").map(k=>{const E={x:k.computedPosition.x+b,y:k.computedPosition.y+v},{computedPosition:B}=an(k,E,s.error,t.value,k.parentNode?o(k.parentNode):void 0);return{id:k.id,position:B,from:k.position,distance:{x:u.x,y:u.y},dimensions:k.dimensions}});n(x,!0,!1)}}function Xa(){return{doubleClick:X(),click:X(),mouseEnter:X(),mouseMove:X(),mouseLeave:X(),contextMenu:X(),dragStart:X(),drag:X(),dragStop:X()}}function Ga(e,t){const n=Xa();return n.doubleClick.on(o=>{var r,i;t.nodeDoubleClick(o),(i=(r=e.events)==null?void 0:r.doubleClick)==null||i.call(r,o)}),n.click.on(o=>{var r,i;t.nodeClick(o),(i=(r=e.events)==null?void 0:r.click)==null||i.call(r,o)}),n.mouseEnter.on(o=>{var r,i;t.nodeMouseEnter(o),(i=(r=e.events)==null?void 0:r.mouseEnter)==null||i.call(r,o)}),n.mouseMove.on(o=>{var r,i;t.nodeMouseMove(o),(i=(r=e.events)==null?void 0:r.mouseMove)==null||i.call(r,o)}),n.mouseLeave.on(o=>{var r,i;t.nodeMouseLeave(o),(i=(r=e.events)==null?void 0:r.mouseLeave)==null||i.call(r,o)}),n.contextMenu.on(o=>{var r,i;t.nodeContextMenu(o),(i=(r=e.events)==null?void 0:r.contextMenu)==null||i.call(r,o)}),n.dragStart.on(o=>{var r,i;t.nodeDragStart(o),(i=(r=e.events)==null?void 0:r.dragStart)==null||i.call(r,o)}),n.drag.on(o=>{var r,i;t.nodeDrag(o),(i=(r=e.events)==null?void 0:r.drag)==null||i.call(r,o)}),n.dragStop.on(o=>{var r,i;t.nodeDragStop(o),(i=(r=e.events)==null?void 0:r.dragStop)==null||i.call(r,o)}),Object.entries(n).reduce((o,[r,i])=>(o.emit[r]=i.trigger,o.on[r]=i.on,o),{emit:{},on:{}})}function Fa(){const{viewport:e,snapGrid:t,snapToGrid:n}=re();return({sourceEvent:o})=>{const r=o.touches?o.touches[0].clientX:o.clientX,i=o.touches?o.touches[0].clientY:o.clientY,l={x:(r-e.value.x)/e.value.zoom,y:(i-e.value.y)/e.value.zoom};return{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 So(e,t,n){const o=t.querySelectorAll(`.vue-flow__handle${e}`);if(!o||!o.length)return;const r=Array.from(o),i=t.getBoundingClientRect();return r.map(l=>{const s=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(s.left-i.left)/n,y:(s.top-i.top)/n,...st(l)}})}function ln(e,t,n,o,r,i=!1,l){r.value=!1,e.selected?(i||e.selected&&t)&&(o([e]),a.nextTick(l.blur)):n([e])}var Ha={value:()=>{}};function vt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new wt(n)}function wt(e){this._=e}function Ua(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}wt.prototype=vt.prototype={constructor:wt,on:function(e,t){var n=this._,o=Ua(e+"",n),r,i=-1,l=o.length;if(arguments.length<2){for(;++i<l;)if((r=(e=o[i]).type)&&(r=ja(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<l;)if(r=(e=o[i]).type)n[r]=No(n[r],e.name,t);else if(t==null)for(r in n)n[r]=No(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new wt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function ja(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function No(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=Ha,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var sn="http://www.w3.org/1999/xhtml";const Co={svg:"http://www.w3.org/2000/svg",xhtml:sn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function bt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Co.hasOwnProperty(t)?{space:Co[t],local:e}:e}function Za(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===sn&&t.documentElement.namespaceURI===sn?t.createElement(e):t.createElementNS(n,e)}}function Ka(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Mo(e){var t=bt(e);return(t.local?Ka:Za)(t)}function Wa(){}function un(e){return e==null?Wa:function(){return this.querySelector(e)}}function qa(e){typeof e!="function"&&(e=un(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],l=i.length,s=o[r]=new Array(l),u,c,d=0;d<l;++d)(u=i[d])&&(c=e.call(u,u.__data__,d,i))&&("__data__"in u&&(c.__data__=u.__data__),s[d]=c);return new ce(o,this._parents)}function Qa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Ja(){return[]}function Bo(e){return e==null?Ja:function(){return this.querySelectorAll(e)}}function ei(e){return function(){return Qa(e.apply(this,arguments))}}function ti(e){typeof e=="function"?e=ei(e):e=Bo(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var l=t[i],s=l.length,u,c=0;c<s;++c)(u=l[c])&&(o.push(e.call(u,u.__data__,c,l)),r.push(u));return new ce(o,r)}function Po(e){return function(){return this.matches(e)}}function Io(e){return function(t){return t.matches(e)}}var ni=Array.prototype.find;function oi(e){return function(){return ni.call(this.children,e)}}function ri(){return this.firstElementChild}function ai(e){return this.select(e==null?ri:oi(typeof e=="function"?e:Io(e)))}var ii=Array.prototype.filter;function li(){return Array.from(this.children)}function si(e){return function(){return ii.call(this.children,e)}}function ui(e){return this.selectAll(e==null?li:si(typeof e=="function"?e:Io(e)))}function ci(e){typeof e!="function"&&(e=Po(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],l=i.length,s=o[r]=[],u,c=0;c<l;++c)(u=i[c])&&e.call(u,u.__data__,c,i)&&s.push(u);return new ce(o,this._parents)}function $o(e){return new Array(e.length)}function di(){return new ce(this._enter||this._groups.map($o),this._parents)}function xt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}xt.prototype={constructor:xt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function fi(e){return function(){return e}}function hi(e,t,n,o,r,i){for(var l=0,s,u=t.length,c=i.length;l<c;++l)(s=t[l])?(s.__data__=i[l],o[l]=s):n[l]=new xt(e,i[l]);for(;l<u;++l)(s=t[l])&&(r[l]=s)}function pi(e,t,n,o,r,i,l){var s,u,c=new Map,d=t.length,f=i.length,p=new Array(d),b;for(s=0;s<d;++s)(u=t[s])&&(p[s]=b=l.call(u,u.__data__,s,t)+"",c.has(b)?r[s]=u:c.set(b,u));for(s=0;s<f;++s)b=l.call(e,i[s],s,i)+"",(u=c.get(b))?(o[s]=u,u.__data__=i[s],c.delete(b)):n[s]=new xt(e,i[s]);for(s=0;s<d;++s)(u=t[s])&&c.get(p[s])===u&&(r[s]=u)}function gi(e){return e.__data__}function mi(e,t){if(!arguments.length)return Array.from(this,gi);var n=t?pi:hi,o=this._parents,r=this._groups;typeof e!="function"&&(e=fi(e));for(var i=r.length,l=new Array(i),s=new Array(i),u=new Array(i),c=0;c<i;++c){var d=o[c],f=r[c],p=f.length,b=yi(e.call(d,d&&d.__data__,c,o)),v=b.length,x=s[c]=new Array(v),k=l[c]=new Array(v),E=u[c]=new Array(p);n(d,f,x,k,E,b,t);for(var B=0,G=0,w,P;B<v;++B)if(w=x[B]){for(B>=G&&(G=B+1);!(P=k[G])&&++G<v;);w._next=P||null}}return l=new ce(l,o),l._enter=s,l._exit=u,l}function yi(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function vi(){return new ce(this._exit||this._groups.map($o),this._parents)}function wi(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function bi(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,l=Math.min(r,i),s=new Array(r),u=0;u<l;++u)for(var c=n[u],d=o[u],f=c.length,p=s[u]=new Array(f),b,v=0;v<f;++v)(b=c[v]||d[v])&&(p[v]=b);for(;u<r;++u)s[u]=n[u];return new ce(s,this._parents)}function xi(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],l;--r>=0;)(l=o[r])&&(i&&l.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(l,i),i=l);return this}function _i(e){e||(e=Ei);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var l=n[i],s=l.length,u=r[i]=new Array(s),c,d=0;d<s;++d)(c=l[d])&&(u[d]=c);u.sort(t)}return new ce(r,this._parents).order()}function Ei(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ki(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Si(){return Array.from(this)}function Ni(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var l=o[r];if(l)return l}return null}function Ci(){let e=0;for(const t of this)++e;return e}function Mi(){return!this.node()}function Bi(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,l=r.length,s;i<l;++i)(s=r[i])&&e.call(s,s.__data__,i,r);return this}function Pi(e){return function(){this.removeAttribute(e)}}function Ii(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $i(e,t){return function(){this.setAttribute(e,t)}}function Ti(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ri(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Oi(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Di(e,t){var n=bt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?Ii:Pi:typeof t=="function"?n.local?Oi:Ri:n.local?Ti:$i)(n,t))}function To(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function zi(e){return function(){this.style.removeProperty(e)}}function Ai(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Vi(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Li(e,t,n){return arguments.length>1?this.each((t==null?zi:typeof t=="function"?Vi:Ai)(e,t,n??"")):Le(this.node(),e)}function Le(e,t){return e.style.getPropertyValue(t)||To(e).getComputedStyle(e,null).getPropertyValue(t)}function Yi(e){return function(){delete this[e]}}function Xi(e,t){return function(){this[e]=t}}function Gi(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Fi(e,t){return arguments.length>1?this.each((t==null?Yi:typeof t=="function"?Gi:Xi)(e,t)):this.node()[e]}function Ro(e){return e.trim().split(/^|\s+/)}function cn(e){return e.classList||new Oo(e)}function Oo(e){this._node=e,this._names=Ro(e.getAttribute("class")||"")}Oo.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 Do(e,t){for(var n=cn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function zo(e,t){for(var n=cn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Hi(e){return function(){Do(this,e)}}function Ui(e){return function(){zo(this,e)}}function ji(e,t){return function(){(t.apply(this,arguments)?Do:zo)(this,e)}}function Zi(e,t){var n=Ro(e+"");if(arguments.length<2){for(var o=cn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?ji:t?Hi:Ui)(n,t))}function Ki(){this.textContent=""}function Wi(e){return function(){this.textContent=e}}function qi(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Qi(e){return arguments.length?this.each(e==null?Ki:(typeof e=="function"?qi:Wi)(e)):this.node().textContent}function Ji(){this.innerHTML=""}function el(e){return function(){this.innerHTML=e}}function tl(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nl(e){return arguments.length?this.each(e==null?Ji:(typeof e=="function"?tl:el)(e)):this.node().innerHTML}function ol(){this.nextSibling&&this.parentNode.appendChild(this)}function rl(){return this.each(ol)}function al(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function il(){return this.each(al)}function ll(e){var t=typeof e=="function"?e:Mo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function sl(){return null}function ul(e,t){var n=typeof e=="function"?e:Mo(e),o=t==null?sl:typeof t=="function"?t:un(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function cl(){var e=this.parentNode;e&&e.removeChild(this)}function dl(){return this.each(cl)}function fl(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hl(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function pl(e){return this.select(e?hl:fl)}function gl(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ml(e){return function(t){e.call(this,t,this.__data__)}}function yl(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function vl(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function wl(e,t,n){return function(){var o=this.__on,r,i=ml(t);if(o){for(var l=0,s=o.length;l<s;++l)if((r=o[l]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function bl(e,t,n){var o=yl(e+""),r,i=o.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,d;u<c;++u)for(r=0,d=s[u];r<i;++r)if((l=o[r]).type===d.type&&l.name===d.name)return d.value}return}for(s=t?wl:vl,r=0;r<i;++r)this.each(s(o[r],t,n));return this}function Ao(e,t,n){var o=To(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function xl(e,t){return function(){return Ao(this,e,t)}}function _l(e,t){return function(){return Ao(this,e,t.apply(this,arguments))}}function El(e,t){return this.each((typeof t=="function"?_l:xl)(e,t))}function*kl(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,l;r<i;++r)(l=o[r])&&(yield l)}var Vo=[null];function ce(e,t){this._groups=e,this._parents=t}function Ke(){return new ce([[document.documentElement]],Vo)}function Sl(){return this}ce.prototype=Ke.prototype={constructor:ce,select:qa,selectAll:ti,selectChild:ai,selectChildren:ui,filter:ci,data:mi,enter:di,exit:vi,join:wi,merge:bi,selection:Sl,order:xi,sort:_i,call:ki,nodes:Si,node:Ni,size:Ci,empty:Mi,each:Bi,attr:Di,style:Li,property:Fi,classed:Zi,text:Qi,html:nl,raise:rl,lower:il,append:ll,insert:ul,remove:dl,clone:pl,datum:gl,on:bl,dispatch:El,[Symbol.iterator]:kl};function de(e){return typeof e=="string"?new ce([[document.querySelector(e)]],[document.documentElement]):new ce([[e]],Vo)}function Nl(e){let t;for(;t=e.sourceEvent;)e=t;return e}function pe(e,t){if(e=Nl(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Cl={passive:!1},We={capture:!0,passive:!1};function dn(e){e.stopImmediatePropagation()}function Ye(e){e.preventDefault(),e.stopImmediatePropagation()}function Lo(e){var t=e.document.documentElement,n=de(e).on("dragstart.drag",Ye,We);"onselectstart"in t?n.on("selectstart.drag",Ye,We):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Yo(e,t){var n=e.document.documentElement,o=de(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ye,We),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const _t=e=>()=>e;function fn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:l,y:s,dx:u,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}fn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ml(e){return!e.ctrlKey&&!e.button}function Bl(){return this.parentNode}function Pl(e,t){return t??{x:e.x,y:e.y}}function Il(){return navigator.maxTouchPoints||"ontouchstart"in this}function $l(){var e=Ml,t=Bl,n=Pl,o=Il,r={},i=vt("start","drag","end"),l=0,s,u,c,d,f=0;function p(w){w.on("mousedown.drag",b).filter(o).on("touchstart.drag",k).on("touchmove.drag",E,Cl).on("touchend.drag touchcancel.drag",B).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(w,P){if(!(d||!e.call(this,w,P))){var D=G(this,t.call(this,w,P),w,P,"mouse");D&&(de(w.view).on("mousemove.drag",v,We).on("mouseup.drag",x,We),Lo(w.view),dn(w),c=!1,s=w.clientX,u=w.clientY,D("start",w))}}function v(w){if(Ye(w),!c){var P=w.clientX-s,D=w.clientY-u;c=P*P+D*D>f}r.mouse("drag",w)}function x(w){de(w.view).on("mousemove.drag mouseup.drag",null),Yo(w.view,c),Ye(w),r.mouse("end",w)}function k(w,P){if(e.call(this,w,P)){var D=w.changedTouches,g=t.call(this,w,P),_=D.length,N,C;for(N=0;N<_;++N)(C=G(this,g,w,P,D[N].identifier,D[N]))&&(dn(w),C("start",w,D[N]))}}function E(w){var P=w.changedTouches,D=P.length,g,_;for(g=0;g<D;++g)(_=r[P[g].identifier])&&(Ye(w),_("drag",w,P[g]))}function B(w){var P=w.changedTouches,D=P.length,g,_;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),g=0;g<D;++g)(_=r[P[g].identifier])&&(dn(w),_("end",w,P[g]))}function G(w,P,D,g,_,N){var C=i.copy(),$=pe(N||D,P),q,ee,y;if((y=n.call(w,new fn("beforestart",{sourceEvent:D,target:p,identifier:_,active:l,x:$[0],y:$[1],dx:0,dy:0,dispatch:C}),g))!=null)return q=y.x-$[0]||0,ee=y.y-$[1]||0,function z(S,R,F){var U=$,O;switch(S){case"start":r[_]=z,O=l++;break;case"end":delete r[_],--l;case"drag":$=pe(F||R,P),O=l;break}C.call(S,w,new fn(S,{sourceEvent:R,subject:y,target:p,identifier:_,active:O,x:$[0]+q,y:$[1]+ee,dx:$[0]-U[0],dy:$[1]-U[1],dispatch:C}),g)}}return p.filter=function(w){return arguments.length?(e=typeof w=="function"?w:_t(!!w),p):e},p.container=function(w){return arguments.length?(t=typeof w=="function"?w:_t(w),p):t},p.subject=function(w){return arguments.length?(n=typeof w=="function"?w:_t(w),p):n},p.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:_t(!!w),p):o},p.on=function(){var w=i.on.apply(i,arguments);return w===i?p:w},p.clickDistance=function(w){return arguments.length?(f=(w=+w)*w,p):Math.sqrt(f)},p}function Xo(e){const t=re(),n=a.toRef(t,"vueFlowRef"),o=a.toRef(t,"snapToGrid"),r=a.toRef(t,"snapGrid"),i=a.toRef(t,"noDragClassName"),l=a.toRef(t,"nodes"),s=a.toRef(t,"nodeExtent"),u=a.toRef(t,"viewport"),c=a.toRef(t,"autoPanOnNodeDrag"),d=a.toRef(t,"nodesDraggable"),f=a.toRef(t,"panBy"),p=a.toRef(t,"findNode"),b=a.toRef(t,"multiSelectionActive"),v=a.toRef(t,"nodesSelectionActive"),x=a.toRef(t,"selectNodesOnDrag"),k=a.toRef(t,"removeSelectedElements"),E=a.toRef(t,"addSelectedNodes"),B=a.toRef(t,"updateNodePositions"),G=a.toRef(t,"emits"),{onStart:w,onDrag:P,onStop:D,el:g,disabled:_,id:N,selectable:C}=e,$=a.ref(!1);let q=a.ref([]),ee=a.ref(),y=a.ref(null),z=a.ref({x:void 0,y:void 0}),S=a.ref({x:0,y:0}),R=a.ref(null),F=a.ref(0),U=a.ref(!1);const O=Fa(),H=({x:Z,y:Q})=>{z.value={x:Z,y:Q};let te=!1;if(q.value=q.value.map(M=>{const h={x:Z-M.distance.x,y:Q-M.distance.y};o.value&&(h.x=r.value[0]*Math.round(h.x/r.value[0]),h.y=r.value[1]*Math.round(h.y/r.value[1]));const{computedPosition:m}=an(M,h,G.value.error,s.value,M.parentNode?p.value(M.parentNode):void 0);return te=te||M.position.x!==m.x||M.position.y!==m.y,M.position=m,M}),!!te&&(B.value(q.value,!0,!0),$.value=!0,R.value)){const[M,h]=rn({id:N,dragItems:q.value,findNode:p.value});P({event:R.value,node:M,nodes:h})}},A=()=>{if(!y.value)return;const[Z,Q]=bo(S.value,y.value);if(Z!==0||Q!==0){const te={x:(z.value.x??0)-Z/u.value.zoom,y:(z.value.y??0)-Q/u.value.zoom};f.value({x:Z,y:Q})&&H(te)}F.value=requestAnimationFrame(A)};return a.watch([()=>ne(_),g],([Z,Q])=>{if(Q){const te=de(Q);if(Z)te.on(".drag",null);else{const M=p.value(N);ee.value=$l().on("start",h=>{var m;!x.value&&!b.value&&M&&(M.selected||k.value()),M&&ne(C)&&x.value&&ln(M,b.value,E.value,k.value,v,!1,Q);const I=O(h);if(z.value=I,q.value=Va(l.value,d.value,I,p.value,N),q.value.length){const[T,V]=rn({id:N,dragItems:q.value,findNode:p.value});w({event:h.sourceEvent,node:T,nodes:V})}y.value=((m=n.value)==null?void 0:m.getBoundingClientRect())||null,S.value=Ae(h.sourceEvent,y.value)}).on("drag",h=>{const m=O(h);!U.value&&c.value&&(U.value=!0,A()),(z.value.x!==m.xSnapped||z.value.y!==m.ySnapped)&&q.value.length&&(R.value=h.sourceEvent,S.value=Ae(h.sourceEvent,y.value),H(m))}).on("end",h=>{if($.value=!1,U.value=!1,cancelAnimationFrame(F.value),q.value.length){B.value(q.value,!1,!1);const[m,I]=rn({id:N,dragItems:q.value,findNode:p.value});D({event:h.sourceEvent,node:m,nodes:I})}}).filter(h=>{const m=h.target;return!h.button&&(!i.value||!_o(m,`.${i.value}`,Q)&&(!(M!=null&&M.dragHandle)||_o(m,M.dragHandle,Q)))}),te.call(ee.value)}}}),$}const Go="vue-flow__node-desc",Fo="vue-flow__edge-desc",Tl="vue-flow__aria-live",Ho=["Enter"," ","Escape"],Xe={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function hn(e){var t,n;const o=((n=(t=e.composedPath)==null?void 0:t.call(e))==null?void 0:n[0])||e.target,r=ve(o.hasAttribute)?o.hasAttribute("contenteditable"):!1,i=ve(o.closest)?o.closest(".nokey"):null;return["INPUT","SELECT","TEXTAREA"].includes(o==null?void 0:o.nodeName)||r||!!i}function Rl(e){return e.ctrlKey||e.metaKey||e.shiftKey}function Ol(e,t){return n=>e.some(o=>{const r=o.split("+").map(i=>i.trim().toLowerCase());return r.length===1?n.key===o:(t.add(n.key.toLowerCase()),r.every(i=>t.has(i)))})}const qe=(e,t)=>{const n=Qt(),o=a.ref(ne(e)===!0),r=a.ref(!1),i=a.ref(new Set);return a.watch(o,()=>{t==null||t(o.value)}),a.watch(()=>ne(e),l=>{if(n&&typeof n.addEventListener<"u"&&qt(n,"blur",()=>{o.value=!1}),Ar(l)){o.value=l;return}Array.isArray(l)&&(l=Ol(l,i.value)),l&&(Fn(l,s=>{r.value=Rl(s),!(!r.value&&hn(s))&&(s.preventDefault(),o.value=!0)},{eventName:"keydown"}),Fn(l,s=>{if(o.value){if(!r.value&&hn(s))return;r.value=!1,i.value.clear(),o.value=!1}},{eventName:"keyup"}))},{immediate:!0}),o},Dl=a.defineComponent({name:"Node",compatConfig:{MODE:3},props:["name","type","id","draggable","selectable","focusable","connectable","node","resizeObserver"],setup(e){a.provide(ho,e.id);const t=re(),n=a.toRef(t,"id"),o=a.toRef(t,"edges"),r=a.toRef(t,"noPanClassName"),i=a.toRef(t,"selectNodesOnDrag"),l=a.toRef(t,"nodesSelectionActive"),s=a.toRef(t,"multiSelectionActive"),u=a.toRef(t,"emits"),c=a.toRef(t,"findNode"),d=a.toRef(t,"removeSelectedNodes"),f=a.toRef(t,"addSelectedNodes"),p=a.toRef(t,"updateNodeDimensions"),b=a.toRef(t,"onUpdateNodeInternals"),v=a.toRef(t,"getIntersectingNodes"),x=a.toRef(t,"getNodeTypes"),k=a.toRef(t,"nodeExtent"),E=a.toRef(t,"elevateNodesOnSelect"),B=a.toRef(t,"disableKeyboardA11y"),G=a.toRef(t,"ariaLiveMessage"),w=a.toRef(t,"snapToGrid"),P=a.toRef(t,"snapGrid"),D=ko(),g=Ze(e,"node"),_=a.computed(()=>c.value(g.value.parentNode)),N=a.computed(()=>ct([g.value],o.value)),C=a.ref();a.provide(po,C);const{emit:$,on:q}=Ga(g.value,u.value),ee=Xo({id:e.id,el:C,disabled:()=>!e.draggable,selectable:()=>e.selectable,onStart(M){$.dragStart({...M,intersections:v.value(g.value)})},onDrag(M){$.drag({...M,intersections:v.value(g.value)})},onStop(M){$.dragStop({...M,intersections:v.value(g.value)})}}),y=a.computed(()=>g.value.class instanceof Function?g.value.class(g.value):g.value.class),z=a.computed(()=>{const M=(g.value.style instanceof Function?g.value.style(g.value):g.value.style)||{},h=g.value.width instanceof Function?g.value.width(g.value):g.value.width,m=g.value.height instanceof Function?g.value.height(g.value):g.value.height;return h&&(M.width=typeof h=="string"?h:`${h}px`),m&&(M.height=typeof m=="string"?m:`${m}px`),M}),S=()=>Number(g.value.zIndex??z.value.zIndex??0);return b.value(M=>{M.includes(e.id)&&F()}),a.onMounted(()=>{e.resizeObserver.observe(C.value)}),a.onBeforeUnmount(()=>{e.resizeObserver.unobserve(C.value)}),a.watch([()=>g.value.type,()=>g.value.sourcePosition,()=>g.value.targetPosition],()=>{p.value([{id:e.id,nodeElement:C.value,forceUpdate:!0}])},{flush:"pre"}),a.watch([()=>g.value.position.x,()=>g.value.position.y,()=>{var M;return(M=_.value)==null?void 0:M.computedPosition.x},()=>{var M;return(M=_.value)==null?void 0:M.computedPosition.y},()=>{var M;return(M=_.value)==null?void 0:M.computedPosition.z},()=>S(),()=>g.value.selected,()=>g.value.dimensions.height,()=>g.value.dimensions.width,()=>{var M;return(M=_.value)==null?void 0:M.dimensions.height},()=>{var M;return(M=_.value)==null?void 0:M.dimensions.width}],([M,h,m,I,T,V])=>{const L={x:M,y:h,z:V+(E.value&&g.value.selected?1e3:0)};we(m)&&we(I)?g.value.computedPosition=xa({x:m,y:I,z:T},L):g.value.computedPosition=L},{flush:"pre",immediate:!0}),a.watch([()=>g.value.extent,()=>k.value],([M,h],[m,I])=>{(M!==m||h!==I)&&R()}),g.value.extent==="parent"||typeof g.value.extent=="object"&&"range"in g.value.extent&&g.value.extent.range==="parent"?ue(()=>g.value.initialized).toBe(!0).then(R):R(),()=>a.h("div",{ref:C,"data-id":g.value.id,class:["vue-flow__node",`vue-flow__node-${e.type===!1?"default":e.name}`,{[r.value]:e.draggable,dragging:ee==null?void 0:ee.value,selected:g.value.selected,selectable:e.selectable},y.value],style:{zIndex:g.value.computedPosition.z??S(),transform:`translate(${g.value.computedPosition.x}px,${g.value.computedPosition.y}px)`,pointerEvents:e.selectable||e.draggable?"all":"none",visibility:g.value.initialized?"visible":"hidden",...z.value},tabIndex:e.focusable?0:void 0,role:e.focusable?"button":void 0,"aria-describedby":B.value?void 0:`${Go}-${n.value}`,"aria-label":g.value.ariaLabel,onMouseenter:U,onMousemove:O,onMouseleave:H,onContextmenu:A,onClick:Q,onDblclick:Z,onKeydown:te},[a.h(e.type===!1?x.value.default:e.type,{id:g.value.id,type:g.value.type,data:g.value.data,events:{...g.value.events,...q},selected:!!g.value.selected,resizing:!!g.value.resizing,dragging:ee.value,connectable:e.connectable,position:g.value.position,dimensions:g.value.dimensions,isValidTargetPos:g.value.isValidTargetPos,isValidSourcePos:g.value.isValidSourcePos,parent:g.value.parentNode,zIndex:g.value.computedPosition.z,targetPosition:g.value.targetPosition,sourcePosition:g.value.sourcePosition,label:g.value.label,dragHandle:g.value.dragHandle,onUpdateNodeInternals:F})]);function R(){const M=g.value.computedPosition;w.value&&(M.x=P.value[0]*Math.round(M.x/P.value[0]),M.y=P.value[1]*Math.round(M.y/P.value[1]));const{computedPosition:h,position:m}=an(g.value,M,u.value.error,k.value,_.value);(g.value.computedPosition.x!==h.x||g.value.computedPosition.y!==h.y)&&(g.value.computedPosition={...g.value.computedPosition,...h}),(g.value.position.x!==m.x||g.value.position.y!==m.y)&&(g.value.position=m)}function F(){C.value&&p.value([{id:e.id,nodeElement:C.value,forceUpdate:!0}])}function U(M){ee!=null&&ee.value||$.mouseEnter({event:M,node:g.value,connectedEdges:N.value})}function O(M){ee!=null&&ee.value||$.mouseMove({event:M,node:g.value,connectedEdges:N.value})}function H(M){ee!=null&&ee.value||$.mouseLeave({event:M,node:g.value,connectedEdges:N.value})}function A(M){return $.contextMenu({event:M,node:g.value,connectedEdges:N.value})}function Z(M){return $.doubleClick({event:M,node:g.value,connectedEdges:N.value})}function Q(M){e.selectable&&(!i.value||!e.draggable)&&ln(g.value,s.value,f.value,d.value,l,!1,C.value),$.click({event:M,node:g.value,connectedEdges:N.value})}function te(M){var h;if(!hn(M))if(Ho.includes(M.key)&&e.selectable){const m=M.key==="Escape";m&&((h=C.value)==null||h.blur()),ln(g.value,s.value,f.value,d.value,l,m,C.value)}else!B.value&&e.draggable&&g.value.selected&&Xe[M.key]&&(G.value=`Moved selected node ${M.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~g.value.position.x}, y: ${~~g.value.position.y}`,D({x:Xe[M.key].x,y:Xe[M.key].y},M.shiftKey))}}}),zl=Dl,Al=["transform"],Vl=["width","height","x","y","rx","ry"],Ll=["y"],Yl={name:"EdgeText",compatConfig:{MODE:3}},Xl=a.defineComponent({...Yl,props:{x:null,y:null,label:null,labelStyle:{default:{}},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:{}},labelBgPadding:{default:[2,4]},labelBgBorderRadius:{default:2}},setup(e){let t=a.ref({x:0,y:0,width:0,height:0});const n=a.ref(null),o=a.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);a.onMounted(r),a.watch([()=>e.x,()=>e.y,n,()=>e.label],r);function r(){if(!n.value)return;const i=n.value.getBBox();(i.width!==t.value.width||i.height!==t.value.height)&&(t.value=i)}return(i,l)=>(a.openBlock(),a.createElementBlock("g",{transform:a.unref(o),class:"vue-flow__edge-textwrapper"},[e.labelShowBg?(a.openBlock(),a.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${a.unref(t).width+2*e.labelBgPadding[0]}px`,height:`${a.unref(t).height+2*e.labelBgPadding[1]}px`,x:-e.labelBgPadding[0],y:-e.labelBgPadding[1],style:a.normalizeStyle(e.labelBgStyle),rx:e.labelBgBorderRadius,ry:e.labelBgBorderRadius},null,12,Vl)):a.createCommentVNode("",!0),a.createElementVNode("text",a.mergeProps(i.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:a.unref(t).height/2,dy:"0.3em",style:e.labelStyle}),[a.renderSlot(i.$slots,"default",{},()=>[a.unref(be)(e.label)?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(e.label),1)],64)):(a.openBlock(),a.createBlock(a.resolveDynamicComponent(e.label),{key:0}))])],16,Ll)],8,Al))}}),Et=function({path:e,label:t,labelX:n,labelY:o,labelBgBorderRadius:r,labelBgPadding:i,labelBgStyle:l,labelShowBg:s=!0,labelStyle:u,markerStart:c,markerEnd:d,interactionWidth:f=20},{attrs:p}){return[a.h("path",{style:p.style,class:["vue-flow__edge-path",p.class].join(" "),d:e,"marker-end":d,"marker-start":c}),f?a.h("path",{d:e,fill:"none","stroke-opacity":0,"stroke-width":f}):null,t&&we(n)&&we(o)?a.h(Xl,{x:n,y:o,label:t,labelStyle:u,labelShowBg:s,labelBgStyle:l,labelBgPadding:i,labelBgBorderRadius:r}):null]};Et.props=["path","labelX","labelY","label","labelBgBorderRadius","labelBgPadding","labelBgStyle","labelShowBg","labelStyle","markerStart","markerEnd","interactionWidth"],Et.inheritAttrs=!1,Et.compatConfig={MODE:3};const kt=Et;function Uo({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,l=Math.abs(o-t)/2,s=o<t?o+l:o-l;return[i,s,r,l]}function jo({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:l,targetControlY:s}){const u=e*.125+r*.375+l*.375+n*.125,c=t*.125+i*.375+s*.375+o*.125,d=Math.abs(u-e),f=Math.abs(c-t);return[u,c,d,f]}function St(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Zo({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){let l,s;switch(e){case j.Left:l=t-St(t-o,i),s=n;break;case j.Right:l=t+St(o-t,i),s=n;break;case j.Top:l=t,s=n-St(n-r,i);break;case j.Bottom:l=t,s=n+St(r-n,i);break}return[l,s]}function Nt({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:o,targetY:r,targetPosition:i=j.Top,curvature:l=.25}){const[s,u]=Zo({pos:n,x1:e,y1:t,x2:o,y2:r,c:l}),[c,d]=Zo({pos:i,x1:o,y1:r,x2:e,y2:t,c:l}),[f,p,b,v]=jo({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${e},${t} C${s},${u} ${c},${d} ${o},${r}`,f,p,b,v]}const Ct=function({sourcePosition:e=j.Bottom,targetPosition:t=j.Top,...n},{attrs:o}){const[r,i,l]=Nt({sourcePosition:e,targetPosition:t,...n});return a.h(kt,{path:r,labelX:i,labelY:l,...n,...o})};Ct.props=["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],Ct.inheritAttrs=!1,Ct.compatConfig={MODE:3};const Gl=Ct;function Ko({pos:e,x1:t,y1:n,x2:o,y2:r}){let i,l;switch(e){case j.Left:case j.Right:i=.5*(t+o),l=n;break;case j.Top:case j.Bottom:i=t,l=.5*(n+r);break}return[i,l]}function Wo({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:o,targetY:r,targetPosition:i=j.Top}){const[l,s]=Ko({pos:n,x1:e,y1:t,x2:o,y2:r}),[u,c]=Ko({pos:i,x1:o,y1:r,x2:e,y2:t}),[d,f,p,b]=jo({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:l,sourceControlY:s,targetControlX:u,targetControlY:c});return[`M${e},${t} C${l},${s} ${u},${c} ${o},${r}`,d,f,p,b]}const Mt=function({sourcePosition:e=j.Bottom,targetPosition:t=j.Top,...n},{attrs:o}){const[r,i,l]=Wo({sourcePosition:e,targetPosition:t,...n});return a.h(kt,{path:r,labelX:i,labelY:l,...n,...o})};Mt.props=["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],Mt.inheritAttrs=!1,Mt.compatConfig={MODE:3};const Fl=Mt,qo={[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 Hl({source:e,sourcePosition:t=j.Bottom,target:n}){return t===j.Left||t===j.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function Qo(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Ul({source:e,sourcePosition:t=j.Bottom,target:n,targetPosition:o=j.Top,center:r,offset:i}){const l=qo[t],s=qo[o],u={x:e.x+l.x*i,y:e.y+l.y*i},c={x:n.x+s.x*i,y:n.y+s.y*i},d=Hl({source:u,sourcePosition:t,target:c}),f=d.x!==0?"x":"y",p=d[f];let b,v,x;const[k,E,B,G]=Uo({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*s[f]===-1){v=r.x||k,x=r.y||E;const w=[{x:v,y:u.y},{x:v,y:c.y}],P=[{x:u.x,y:x},{x:c.x,y:x}];l[f]===p?b=f==="x"?w:P:b=f==="x"?P:w}else{const w=[{x:u.x,y:c.y}],P=[{x:c.x,y:u.y}];if(f==="x"?b=l.x===p?P:w:b=l.y===p?w:P,t!==o){const D=f==="x"?"y":"x",g=l[f]===s[D],_=u[D]>c[D],N=u[D]<c[D];(l[f]===1&&(!g&&_||g&&N)||l[f]!==1&&(!g&&N||g&&_))&&(b=f==="x"?w:P)}v=b[0].x,x=b[0].y}return[[e,u,...b,c,n],v,x,B,G]}function jl(e,t,n,o){const r=Math.min(Qo(e,t)/2,Qo(t,n)/2,o),{x:i,y:l}=t;if(e.x===i&&i===n.x||e.y===l&&l===n.y)return`L${i} ${l}`;if(e.y===l){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+r*c},${l}Q ${i},${l} ${i},${l+r*d}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${i},${l+r*u}Q ${i},${l} ${i+r*s},${l}`}function pn({sourceX:e,sourceY:t,sourcePosition:n=j.Bottom,targetX:o,targetY:r,targetPosition:i=j.Top,borderRadius:l=5,centerX:s,centerY:u,offset:c=20}){const[d,f,p,b,v]=Ul({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:s,y:u},offset:c});return[d.reduce((x,k,E)=>{let B;return E>0&&E<d.length-1?B=jl(d[E-1],k,d[E+1],l):B=`${E===0?"M":"L"}${k.x} ${k.y}`,x+=B,x},""),f,p,b,v]}const Bt=function({sourcePosition:e=j.Bottom,targetPosition:t=j.Top,...n},{attrs:o}){const[r,i,l]=pn({sourcePosition:e,targetPosition:t,...n});return a.h(kt,{path:r,labelX:i,labelY:l,...n,...o})};Bt.props=["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],Bt.inheritAttrs=!1,Bt.compatConfig={MODE:3};const Jo=Bt,Pt=function(e,{attrs:t}){return a.h(Jo,{...e,...t,borderRadius:0})};Pt.props=["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],Pt.inheritAttrs=!1,Pt.compatConfig={MODE:3};const Zl=Pt;function er({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,l,s]=Uo({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,l,s]}const It=function(e,{attrs:t}){const[n,o,r]=er(e);return a.h(kt,{path:n,labelX:o,labelY:r,...e,...t})};It.props=["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],It.inheritAttrs=!1,It.compatConfig={MODE:3};const Kl=It;function Wl(e,t,n){return n===j.Left?e-t:n===j.Right?e+t:e}function ql(e,t,n){return n===j.Top?e-t:n===j.Bottom?e+t:e}const gn=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=j.Top,type:r}){return a.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${r}`,cx:Wl(t,e,o),cy:ql(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};gn.props=["radius","centerX","centerY","position","type"],gn.compatConfig={MODE:3};const tr=gn;function Ql(){return{doubleClick:X(),click:X(),mouseEnter:X(),mouseMove:X(),mouseLeave:X(),contextMenu:X(),updateStart:X(),update:X(),updateEnd:X()}}function Jl(e,t){const n=Ql();return n.doubleClick.on(o=>{var r,i;t.edgeDoubleClick(o),(i=(r=e.events)==null?void 0:r.doubleClick)==null||i.call(r,o)}),n.click.on(o=>{var r,i;t.edgeClick(o),(i=(r=e.events)==null?void 0:r.click)==null||i.call(r,o)}),n.mouseEnter.on(o=>{var r,i;t.edgeMouseEnter(o),(i=(r=e.events)==null?void 0:r.mouseEnter)==null||i.call(r,o)}),n.mouseMove.on(o=>{var r,i;t.edgeMouseMove(o),(i=(r=e.events)==null?void 0:r.mouseMove)==null||i.call(r,o)}),n.mouseLeave.on(o=>{var r,i;t.edgeMouseLeave(o),(i=(r=e.events)==null?void 0:r.mouseLeave)==null||i.call(r,o)}),n.contextMenu.on(o=>{var r,i;t.edgeContextMenu(o),(i=(r=e.events)==null?void 0:r.contextMenu)==null||i.call(r,o)}),n.updateStart.on(o=>{var r,i;t.edgeUpdateStart(o),(i=(r=e.events)==null?void 0:r.updateStart)==null||i.call(r,o)}),n.update.on(o=>{var r,i;t.edgeUpdate(o),(i=(r=e.events)==null?void 0:r.update)==null||i.call(r,o)}),n.updateEnd.on(o=>{var r,i;t.edgeUpdateEnd(o),(i=(r=e.events)==null?void 0:r.updateEnd)==null||i.call(r,o)}),Object.entries(n).reduce((o,[r,i])=>(o.emit[r]=i.trigger,o.on[r]=i.on,o),{emit:{},on:{}})}const es=a.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["name","type","id","updatable","selectable","focusable","edge"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:r,emits:i,nodesSelectionActive:l,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:f,isValidConnection:p}=re(),b=Jl(e.edge,i),v=Ze(e,"edge");let x=a.ref(!1),k=a.ref(!1);const E=a.ref(""),B=a.ref(null),G=a.ref("source"),w=a.ref();a.provide(ka,e.id),a.provide(Sa,w);const P=a.computed(()=>v.value.class instanceof Function?v.value.class(v.value):v.value.class),D=a.computed(()=>v.value.style instanceof Function?v.value.style(v.value):v.value.style),{handlePointerDown:g}=xo({nodeId:E,handleId:B,type:G,isValidConnection:p.value,edgeUpdaterType:G,onEdgeUpdate:C,onEdgeUpdateEnd:$});return()=>{const A=f(v.value.source),Z=f(v.value.target);if(!A||!Z||!v.value)return null;let Q;o.value===Pe.Strict?Q=A.handleBounds.source:Q=[...A.handleBounds.source||[],...A.handleBounds.target||[]];const te=go(Q,v.value.sourceHandle);let M;o.value===Pe.Strict?M=Z.handleBounds.target:M=[...Z.handleBounds.target||[],...Z.handleBounds.source||[]];const h=go(M,v.value.targetHandle),m=te?te.position:j.Bottom,I=h?h.position:j.Top,{sourceX:T,sourceY:V,targetY:L,targetX:K}=Ca(A,te,m,Z,h,I);return v.value.sourceX=T,v.value.sourceY=V,v.value.targetX=K,v.value.targetY=L,a.h("g",{ref:w,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${e.type===!1?"default":e.name}`,s.value,P.value,{updating:x.value,selected:v.value.selected,animated:v.value.animated,inactive:!e.selectable}],onClick:ee,onContextmenu:y,onDblclick:z,onMouseenter:S,onMousemove:R,onMouseleave:F,onKeyDown:e.focusable?H:void 0,tabIndex:e.focusable?0:void 0,"aria-label":v.value.ariaLabel===null?void 0:v.value.ariaLabel||`Edge from ${v.value.source} to ${v.value.target}`,"aria-describedby":e.focusable?`${Fo}-${t}`:void 0,role:e.focusable?"button":void 0},[k.value?null:a.h(e.type===!1?u.value.default:e.type,{id:e.id,sourceNode:A,targetNode:Z,source:v.value.source,target:v.value.target,type:v.value.type,updatable:e.updatable,selected:v.value.selected,animated:v.value.animated,label:v.value.label,labelStyle:v.value.labelStyle,labelShowBg:v.value.labelShowBg,labelBgStyle:v.value.labelBgStyle,labelBgPadding:v.value.labelBgPadding,labelBgBorderRadius:v.value.labelBgBorderRadius,data:v.value.data,events:{...v.value.events,...b.on},style:D.value,markerStart:`url(#${Me(v.value.markerStart,t)})`,markerEnd:`url(#${Me(v.value.markerEnd,t)})`,sourcePosition:m,targetPosition:I,sourceX:T,sourceY:V,targetX:K,targetY:L,sourceHandleId:v.value.sourceHandle,targetHandleId:v.value.targetHandle,interactionWidth:v.value.interactionWidth}),[e.updatable==="source"||e.updatable===!0?[a.h("g",{onMousedown:U,onMouseenter:_,onMouseout:N},a.h(tr,{position:m,centerX:T,centerY:V,radius:r.value,type:"source","data-type":"source"}))]:null,e.updatable==="target"||e.updatable===!0?[a.h("g",{onMousedown:O,onMouseenter:_,onMouseout:N},a.h(tr,{position:I,centerX:K,centerY:L,radius:r.value,type:"target","data-type":"target"}))]:null]])};function _(){x.value=!0}function N(){x.value=!1}function C(A,Z){b.emit.update({event:A,edge:v.value,connection:Z})}function $(A){b.emit.updateEnd({event:A,edge:v.value}),k.value=!1}function q(A,Z){A.button===0&&(k.value=!0,E.value=Z?v.value.target:v.value.source,B.value=(Z?v.value.targetHandle:v.value.sourceHandle)??"",G.value=Z?"target":"source",b.emit.updateStart({event:A,edge:v.value}),g(A))}function ee(A){const Z={event:A,edge:v.value};e.selectable&&(l.value=!1,n([v.value])),b.emit.click(Z)}function y(A){b.emit.contextMenu({event:A,edge:v.value})}function z(A){b.emit.doubleClick({event:A,edge:v.value})}function S(A){b.emit.mouseEnter({event:A,edge:v.value})}function R(A){b.emit.mouseMove({event:A,edge:v.value})}function F(A){b.emit.mouseLeave({event:A,edge:v.value})}function U(A){q(A,!0)}function O(A){q(A,!1)}function H(A){var Z;Ho.includes(A.key)&&e.selectable&&(A.key==="Escape"?((Z=w.value)==null||Z.blur(),c([d(e.id)])):n([d(e.id)]))}}}),ts=es,ns={height:"0",width:"0"},os={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},rs=a.defineComponent({...os,setup(e){const{viewportRef:t}=re(),n=a.computed(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,r)=>(a.openBlock(),a.createElementBlock("svg",null,[(a.openBlock(),a.createElementBlock("foreignObject",ns,[(a.openBlock(),a.createBlock(a.Teleport,{to:a.unref(n),disabled:!a.unref(n)},[a.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}}),as={class:"vue-flow__connection"},is=["d","marker-end","marker-start"],ls={name:"ConnectionLine",compatConfig:{MODE:3}},ss=a.defineComponent({...ls,props:{sourceNode:null},setup(e){var t;const n=re(),o=a.toRef(n,"connectionMode"),r=a.toRef(n,"connectionStartHandle"),i=a.toRef(n,"connectionEndHandle"),l=a.toRef(n,"connectionPosition"),s=a.toRef(n,"connectionLineType"),u=a.toRef(n,"connectionLineStyle"),c=a.toRef(n,"connectionLineOptions"),d=a.toRef(n,"connectionStatus"),f=a.toRef(n,"viewport"),p=a.toRef(n,"findNode"),b={[j.Left]:j.Right,[j.Right]:j.Left,[j.Top]:j.Bottom,[j.Bottom]:j.Top},v=(t=a.inject(ft))==null?void 0:t["connection-line"],x=a.computed(()=>r.value.handleId),k=a.computed(()=>r.value.type),E=a.computed(()=>{var C;return((C=i.value)==null?void 0:C.handleId)&&p.value(i.value.nodeId)||null}),B=a.computed(()=>{var C,$;return(o.value===Pe.Strict?(C=e.sourceNode.handleBounds[k.value])==null?void 0:C.find(q=>q.id===x.value):[...e.sourceNode.handleBounds.source||[],...e.sourceNode.handleBounds.target||[]].find(q=>q.id===x.value))||(($=e.sourceNode.handleBounds[k.value??"source"])==null?void 0:$[0])}),G=a.computed(()=>{var C,$,q;return E.value&&((C=i.value)==null?void 0:C.handleId)&&((o.value===Pe.Strict?($=E.value.handleBounds[k.value==="source"?"target":"source"])==null?void 0:$.find(ee=>{var y;return ee.id===((y=i.value)==null?void 0:y.handleId)}):[...E.value.handleBounds.source||[],...E.value.handleBounds.target||[]].find(ee=>{var y;return ee.id===((y=i.value)==null?void 0:y.handleId)}))||((q=E.value.handleBounds[k.value??"target"])==null?void 0:q[0]))||null}),w=a.computed(()=>{var C;return(C=B.value)==null?void 0:C.position}),P=a.computed(()=>B.value?ht(w.value||j.Top,{...e.sourceNode.dimensions,...e.sourceNode.computedPosition},B.value):{x:e.sourceNode.dimensions.width/2,y:e.sourceNode.dimensions.height/2}),D=a.computed(()=>w.value?b[w.value]:void 0),g=a.computed(()=>(l.value.x-f.value.x)/f.value.zoom),_=a.computed(()=>(l.value.y-f.value.y)/f.value.zoom),N=a.computed(()=>{let C;const $={sourceX:P.value.x,sourceY:P.value.y,sourcePosition:w.value,targetX:g.value,targetY:_.value,targetPosition:D.value};switch(s.value??c.value.type){case Be.Bezier:[C]=Nt($);break;case Be.Step:[C]=pn({...$,borderRadius:0});break;case Be.SmoothStep:[C]=pn($);break;case Be.SimpleBezier:[C]=Wo($);break;case Be.Straight:[C]=er($);break;default:[C]=Nt($);break}return C});return(C,$)=>{var q;return a.openBlock(),a.createElementBlock("g",as,[a.unref(v)?(a.openBlock(),a.createBlock(a.resolveDynamicComponent(a.unref(v)),a.normalizeProps(a.mergeProps({key:0},{sourceX:a.unref(P).x,sourceY:a.unref(P).y,sourcePosition:(q=a.unref(B))==null?void 0:q.position,targetX:a.unref(g),targetY:a.unref(_),targetPosition:a.unref(D),sourceNode:e.sourceNode,sourceHandle:a.unref(B),targetNode:a.unref(E),targetHandle:a.unref(G),markerEnd:`url(#${a.unref(Me)(a.unref(c).markerEnd)})`,markerStart:`url(#${a.unref(Me)(a.unref(c).markerStart)})`,connectionStatus:a.unref(d)})),null,16)):(a.openBlock(),a.createElementBlock("path",{key:1,d:a.unref(N),class:a.normalizeClass(["vue-flow__connection-path",[a.unref(c).class,a.unref(d)]]),style:a.normalizeStyle(a.unref(u)||a.unref(c).style||{}),"marker-end":`url(#${a.unref(Me)(a.unref(c).markerEnd)})`,"marker-start":`url(#${a.unref(Me)(a.unref(c).markerStart)})`},null,14,is))])}}}),us=["tabIndex"],cs={name:"NodesSelection",compatConfig:{MODE:3}},ds=a.defineComponent({...cs,setup(e){const t=re(),n=a.toRef(t,"emits"),o=a.toRef(t,"viewport"),r=a.toRef(t,"getSelectedNodes"),i=a.toRef(t,"noPanClassName"),l=a.toRef(t,"disableKeyboardA11y"),s=a.toRef(t,"userSelectionActive"),u=ko(),c=a.ref(),d=Xo({el:c,onStart(x){n.value.selectionDragStart(x)},onDrag(x){n.value.selectionDrag(x)},onStop(x){n.value.selectionDragStop(x)}});a.onMounted(()=>{var x;l.value||(x=c.value)==null||x.focus({preventScroll:!0})});const f=a.computed(()=>io(r.value)),p=a.computed(()=>({width:`${f.value.width}px`,height:`${f.value.height}px`,top:`${f.value.y}px`,left:`${f.value.x}px`}));function b(x){n.value.selectionContextMenu({event:x,nodes:r.value})}function v(x){l.value||Xe[x.key]&&u({x:Xe[x.key].x,y:Xe[x.key].y},x.shiftKey)}return(x,k)=>!a.unref(s)&&a.unref(f).width&&a.unref(f).height?(a.openBlock(),a.createElementBlock("div",{key:0,class:a.normalizeClass(["vue-flow__nodesselection vue-flow__container",a.unref(i)]),style:a.normalizeStyle({transform:`translate(${a.unref(o).x}px,${a.unref(o).y}px) scale(${a.unref(o).zoom})`})},[a.createElementVNode("div",{ref_key:"el",ref:c,class:a.normalizeClass([{dragging:a.unref(d)},"vue-flow__nodesselection-rect"]),style:a.normalizeStyle(a.unref(p)),tabIndex:a.unref(l)?void 0:-1,onContextmenu:b,onKeydown:v},null,46,us)],6)):a.createCommentVNode("",!0)}}),fs={name:"UserSelection",compatConfig:{MODE:3}},hs=a.defineComponent({...fs,setup(e){const{userSelectionRect:t}=re();return(n,o)=>{var r,i,l,s;return a.openBlock(),a.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:a.normalizeStyle({width:`${(r=a.unref(t))==null?void 0:r.width}px`,height:`${(i=a.unref(t))==null?void 0:i.height}px`,transform:`translate(${(l=a.unref(t))==null?void 0:l.x}px, ${(s=a.unref(t))==null?void 0:s.y}px)`})},null,4)}}}),ps={input:za,default:Da,output:Aa},gs={default:Gl,straight:Kl,step:Zl,smoothstep:Jo,simplebezier:Fl};function ms(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],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:en.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:dt.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:Be.Bezier,style:{}},connectionMode:Pe.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:NaN,y:NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:"Meta",zoomActivationKeyCode:"Meta",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:fa(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,disableKeyboardA11y:!1,ariaLiveMessage:"",__experimentalFeatures:{nestedFlow:!1}}}function nr(e){const t=ms();return e&&Object.keys(e).forEach(n=>{const o=e[n];oe(o)&&(t[n]=o)}),t}function ys(e,t,n){const o=a.computed(()=>x=>e.nodes&&!t.value.length?e.nodes.find(k=>k.id===x):e.nodes[t.value.indexOf(x)]),r=a.computed(()=>x=>e.edges&&!n.value.length?e.edges.find(k=>k.id===x):e.edges[n.value.indexOf(x)]),i=a.computed(()=>{var x;const k={...gs,...e.edgeTypes},E=Object.keys(k);return(x=e.edges)==null||x.forEach(B=>B.type&&!E.includes(B.type)&&(k[B.type]=B.type)),k}),l=a.computed(()=>{var x;const k={...ps,...e.nodeTypes},E=Object.keys(k);return(x=e.nodes)==null||x.forEach(B=>B.type&&!E.includes(B.type)&&(k[B.type]=B.type)),k}),s=a.computed(()=>{const x=e.nodes.filter(k=>!k.hidden);return e.onlyRenderVisibleElements?x&&lo(x,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):x??[]}),u=(x,k,E)=>{if(k=k??o.value(x.source),E=E??o.value(x.target),!k||!E){e.hooks.error.trigger(new le(ie.EDGE_ORPHANED,x.id));return}return!x.hidden&&!E.hidden&&!k.hidden},c=a.computed(()=>e.onlyRenderVisibleElements?e.edges.filter(x=>{const k=o.value(x.source),E=o.value(x.target);return u(x,k,E)&&Ma({sourcePos:k.computedPosition||{x:0,y:0},targetPos:E.computedPosition||{x:0,y:0},sourceWidth:k.dimensions.width,sourceHeight:k.dimensions.height,targetWidth:E.dimensions.width,targetHeight:E.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})}):e.edges.filter(x=>u(x))),d=a.computed(()=>[...s.value,...c.value]),f=a.computed(()=>e.nodes.filter(x=>x.selected)),p=a.computed(()=>e.edges.filter(x=>x.selected)),b=a.computed(()=>[...f.value??[],...p.value??[]]),v=a.computed(()=>s.value.filter(x=>x.initialized&&x.handleBounds!==void 0));return{getNode:o,getEdge:r,getElements:d,getEdgeTypes:i,getNodeTypes:l,getEdges:c,getNodes:s,getSelectedElements:b,getSelectedNodes:f,getSelectedEdges:p,getNodesInitialized:v}}function mn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function or(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Qe(){}var Je=.7,$t=1/Je,Ge="\\s*([+-]?\\d+)\\s*",et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ge="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vs=/^#([0-9a-f]{3,8})$/,ws=new RegExp(`^rgb\\(${Ge},${Ge},${Ge}\\)$`),bs=new RegExp(`^rgb\\(${ge},${ge},${ge}\\)$`),xs=new RegExp(`^rgba\\(${Ge},${Ge},${Ge},${et}\\)$`),_s=new RegExp(`^rgba\\(${ge},${ge},${ge},${et}\\)$`),Es=new RegExp(`^hsl\\(${et},${ge},${ge}\\)$`),ks=new RegExp(`^hsla\\(${et},${ge},${ge},${et}\\)$`),rr={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};mn(Qe,tt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:ar,formatHex:ar,formatHex8:Ss,formatHsl:Ns,formatRgb:ir,toString:ir});function ar(){return this.rgb().formatHex()}function Ss(){return this.rgb().formatHex8()}function Ns(){return dr(this).formatHsl()}function ir(){return this.rgb().formatRgb()}function tt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=vs.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?lr(t):n===3?new se(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Tt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Tt(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=ws.exec(e))?new se(t[1],t[2],t[3],1):(t=bs.exec(e))?new se(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xs.exec(e))?Tt(t[1],t[2],t[3],t[4]):(t=_s.exec(e))?Tt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Es.exec(e))?cr(t[1],t[2]/100,t[3]/100,1):(t=ks.exec(e))?cr(t[1],t[2]/100,t[3]/100,t[4]):rr.hasOwnProperty(e)?lr(rr[e]):e==="transparent"?new se(NaN,NaN,NaN,0):null}function lr(e){return new se(e>>16&255,e>>8&255,e&255,1)}function Tt(e,t,n,o){return o<=0&&(e=t=n=NaN),new se(e,t,n,o)}function Cs(e){return e instanceof Qe||(e=tt(e)),e?(e=e.rgb(),new se(e.r,e.g,e.b,e.opacity)):new se}function yn(e,t,n,o){return arguments.length===1?Cs(e):new se(e,t,n,o??1)}function se(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}mn(se,yn,or(Qe,{brighter(e){return e=e==null?$t:Math.pow($t,e),new se(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Je:Math.pow(Je,e),new se(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new se(Ie(this.r),Ie(this.g),Ie(this.b),Rt(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:sr,formatHex:sr,formatHex8:Ms,formatRgb:ur,toString:ur}));function sr(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}`}function Ms(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}${$e((isNaN(this.opacity)?1:this.opacity)*255)}`}function ur(){const e=Rt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ie(this.r)}, ${Ie(this.g)}, ${Ie(this.b)}${e===1?")":`, ${e})`}`}function Rt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ie(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $e(e){return e=Ie(e),(e<16?"0":"")+e.toString(16)}function cr(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,o)}function dr(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof Qe||(e=tt(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),l=NaN,s=i-r,u=(i+r)/2;return s?(t===i?l=(n-o)/s+(n<o)*6:n===i?l=(o-t)/s+2:l=(t-n)/s+4,s/=u<.5?i+r:2-i-r,l*=60):s=u>0&&u<1?0:l,new fe(l,s,u,e.opacity)}function Bs(e,t,n,o){return arguments.length===1?dr(e):new fe(e,t,n,o??1)}function fe(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}mn(fe,Bs,or(Qe,{brighter(e){return e=e==null?$t:Math.pow($t,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Je:Math.pow(Je,e),new fe(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,r=2*n-o;return new se(vn(e>=240?e-240:e+120,r,o),vn(e,r,o),vn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new fe(fr(this.h),Ot(this.s),Ot(this.l),Rt(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=Rt(this.opacity);return`${e===1?"hsl(":"hsla("}${fr(this.h)}, ${Ot(this.s)*100}%, ${Ot(this.l)*100}%${e===1?")":`, ${e})`}`}}));function fr(e){return e=(e||0)%360,e<0?e+360:e}function Ot(e){return Math.max(0,Math.min(1,e||0))}function vn(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 hr=e=>()=>e;function Ps(e,t){return function(n){return e+n*t}}function Is(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 $s(e){return(e=+e)==1?pr:function(t,n){return n-t?Is(t,n,e):hr(isNaN(t)?n:t)}}function pr(e,t){var n=t-e;return n?Ps(e,n):hr(isNaN(e)?t:e)}const gr=function e(t){var n=$s(t);function o(r,i){var l=n((r=yn(r)).r,(i=yn(i)).r),s=n(r.g,i.g),u=n(r.b,i.b),c=pr(r.opacity,i.opacity);return function(d){return r.r=l(d),r.g=s(d),r.b=u(d),r.opacity=c(d),r+""}}return o.gamma=e,o}(1);function Ne(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var wn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,bn=new RegExp(wn.source,"g");function Ts(e){return function(){return e}}function Rs(e){return function(t){return e(t)+""}}function Os(e,t){var n=wn.lastIndex=bn.lastIndex=0,o,r,i,l=-1,s=[],u=[];for(e=e+"",t=t+"";(o=wn.exec(e))&&(r=bn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),s[l]?s[l]+=i:s[++l]=i),(o=o[0])===(r=r[0])?s[l]?s[l]+=r:s[++l]=r:(s[++l]=null,u.push({i:l,x:Ne(o,r)})),n=bn.lastIndex;return n<t.length&&(i=t.slice(n),s[l]?s[l]+=i:s[++l]=i),s.length<2?u[0]?Rs(u[0].x):Ts(t):(t=u.length,function(c){for(var d=0,f;d<t;++d)s[(f=u[d]).i]=f.x(c);return s.join("")})}var mr=180/Math.PI,yr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vr(e,t,n,o,r,i){var l,s,u;return(l=Math.sqrt(e*e+t*t))&&(e/=l,t/=l),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),e*o<t*n&&(e=-e,t=-t,u=-u,l=-l),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*mr,skewX:Math.atan(u)*mr,scaleX:l,scaleY:s}}var Dt;function Ds(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?yr:vr(t.a,t.b,t.c,t.d,t.e,t.f)}function zs(e){return e==null||(Dt||(Dt=document.createElementNS("http://www.w3.org/2000/svg","g")),Dt.setAttribute("transform",e),!(e=Dt.transform.baseVal.consolidate()))?yr:(e=e.matrix,vr(e.a,e.b,e.c,e.d,e.e,e.f))}function wr(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,d,f,p,b,v){if(c!==f||d!==p){var x=b.push("translate(",null,t,null,n);v.push({i:x-4,x:Ne(c,f)},{i:x-2,x:Ne(d,p)})}else(f||p)&&b.push("translate("+f+t+p+n)}function l(c,d,f,p){c!==d?(c-d>180?d+=360:d-c>180&&(c+=360),p.push({i:f.push(r(f)+"rotate(",null,o)-2,x:Ne(c,d)})):d&&f.push(r(f)+"rotate("+d+o)}function s(c,d,f,p){c!==d?p.push({i:f.push(r(f)+"skewX(",null,o)-2,x:Ne(c,d)}):d&&f.push(r(f)+"skewX("+d+o)}function u(c,d,f,p,b,v){if(c!==f||d!==p){var x=b.push(r(b)+"scale(",null,",",null,")");v.push({i:x-4,x:Ne(c,f)},{i:x-2,x:Ne(d,p)})}else(f!==1||p!==1)&&b.push(r(b)+"scale("+f+","+p+")")}return function(c,d){var f=[],p=[];return c=e(c),d=e(d),i(c.translateX,c.translateY,d.translateX,d.translateY,f,p),l(c.rotate,d.rotate,f,p),s(c.skewX,d.skewX,f,p),u(c.scaleX,c.scaleY,d.scaleX,d.scaleY,f,p),c=d=null,function(b){for(var v=-1,x=p.length,k;++v<x;)f[(k=p[v]).i]=k.x(b);return f.join("")}}}var As=wr(Ds,"px, ","px)","deg)"),Vs=wr(zs,", ",")",")"),Ls=1e-12;function br(e){return((e=Math.exp(e))+1/e)/2}function Ys(e){return((e=Math.exp(e))-1/e)/2}function Xs(e){return((e=Math.exp(2*e))-1)/(e+1)}const Gs=function e(t,n,o){function r(i,l){var s=i[0],u=i[1],c=i[2],d=l[0],f=l[1],p=l[2],b=d-s,v=f-u,x=b*b+v*v,k,E;if(x<Ls)E=Math.log(p/c)/t,k=function(g){return[s+g*b,u+g*v,c*Math.exp(t*g*E)]};else{var B=Math.sqrt(x),G=(p*p-c*c+o*x)/(2*c*n*B),w=(p*p-c*c-o*x)/(2*p*n*B),P=Math.log(Math.sqrt(G*G+1)-G),D=Math.log(Math.sqrt(w*w+1)-w);E=(D-P)/t,k=function(g){var _=g*E,N=br(P),C=c/(n*B)*(N*Xs(t*_+P)-Ys(P));return[s+C*b,u+C*v,c*N/br(t*_+P)]}}return k.duration=E*1e3*t/Math.SQRT2,k}return r.rho=function(i){var l=Math.max(.001,+i),s=l*l,u=s*s;return e(l,s,u)},r}(Math.SQRT2,2,4);var Fe=0,nt=0,ot=0,xr=1e3,zt,rt,At=0,Te=0,Vt=0,at=typeof performance=="object"&&performance.now?performance:Date,_r=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xn(){return Te||(_r(Fs),Te=at.now()+Vt)}function Fs(){Te=0}function Lt(){this._call=this._time=this._next=null}Lt.prototype=Er.prototype={constructor:Lt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?xn():+n)+(t==null?0:+t),!this._next&&rt!==this&&(rt?rt._next=this:zt=this,rt=this),this._call=e,this._time=n,_n()},stop:function(){this._call&&(this._call=null,this._time=1/0,_n())}};function Er(e,t,n){var o=new Lt;return o.restart(e,t,n),o}function Hs(){xn(),++Fe;for(var e=zt,t;e;)(t=Te-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Fe}function kr(){Te=(At=at.now())+Vt,Fe=nt=0;try{Hs()}finally{Fe=0,js(),Te=0}}function Us(){var e=at.now(),t=e-At;t>xr&&(Vt-=t,At=e)}function js(){for(var e,t=zt,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:zt=n);rt=e,_n(o)}function _n(e){if(!Fe){nt&&(nt=clearTimeout(nt));var t=e-Te;t>24?(e<1/0&&(nt=setTimeout(kr,e-at.now()-Vt)),ot&&(ot=clearInterval(ot))):(ot||(At=at.now(),ot=setInterval(Us,xr)),Fe=1,_r(kr))}}function Sr(e,t,n){var o=new Lt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Zs=vt("start","end","cancel","interrupt"),Ks=[],Nr=0,Cr=1,En=2,Yt=3,Mr=4,kn=5,Xt=6;function Gt(e,t,n,o,r,i){var l=e.__transition;if(!l)e.__transition={};else if(n in l)return;Ws(e,n,{name:t,index:o,group:r,on:Zs,tween:Ks,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Nr})}function Sn(e,t){var n=he(e,t);if(n.state>Nr)throw new Error("too late; already scheduled");return n}function me(e,t){var n=he(e,t);if(n.state>Yt)throw new Error("too late; already running");return n}function he(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Ws(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Er(i,0,n.time);function i(c){n.state=Cr,n.timer.restart(l,n.delay,n.time),n.delay<=c&&l(c-n.delay)}function l(c){var d,f,p,b;if(n.state!==Cr)return u();for(d in o)if(b=o[d],b.name===n.name){if(b.state===Yt)return Sr(l);b.state===Mr?(b.state=Xt,b.timer.stop(),b.on.call("interrupt",e,e.__data__,b.index,b.group),delete o[d]):+d<t&&(b.state=Xt,b.timer.stop(),b.on.call("cancel",e,e.__data__,b.index,b.group),delete o[d])}if(Sr(function(){n.state===Yt&&(n.state=Mr,n.timer.restart(s,n.delay,n.time),s(c))}),n.state=En,n.on.call("start",e,e.__data__,n.index,n.group),n.state===En){for(n.state=Yt,r=new Array(p=n.tween.length),d=0,f=-1;d<p;++d)(b=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=b);r.length=f+1}}function s(c){for(var d=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(u),n.state=kn,1),f=-1,p=r.length;++f<p;)r[f].call(e,d);n.state===kn&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){n.state=Xt,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Ft(e,t){var n=e.__transition,o,r,i=!0,l;if(n){t=t==null?null:t+"";for(l in n){if((o=n[l]).name!==t){i=!1;continue}r=o.state>En&&o.state<kn,o.state=Xt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[l]}i&&delete e.__transition}}function qs(e){return this.each(function(){Ft(this,e)})}function Qs(e,t){var n,o;return function(){var r=me(this,e),i=r.tween;if(i!==n){o=n=i;for(var l=0,s=o.length;l<s;++l)if(o[l].name===t){o=o.slice(),o.splice(l,1);break}}r.tween=o}}function Js(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=me(this,e),l=i.tween;if(l!==o){r=(o=l).slice();for(var s={name:t,value:n},u=0,c=r.length;u<c;++u)if(r[u].name===t){r[u]=s;break}u===c&&r.push(s)}i.tween=r}}function eu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=he(this.node(),n).tween,r=0,i=o.length,l;r<i;++r)if((l=o[r]).name===e)return l.value;return null}return this.each((t==null?Qs:Js)(n,e,t))}function Nn(e,t,n){var o=e._id;return e.each(function(){var r=me(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return he(r,o).value[t]}}function Br(e,t){var n;return(typeof t=="number"?Ne:t instanceof tt?gr:(n=tt(t))?(t=n,gr):Os)(e,t)}function tu(e){return function(){this.removeAttribute(e)}}function nu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ou(e,t,n){var o,r=n+"",i;return function(){var l=this.getAttribute(e);return l===r?null:l===o?i:i=t(o=l,n)}}function ru(e,t,n){var o,r=n+"",i;return function(){var l=this.getAttributeNS(e.space,e.local);return l===r?null:l===o?i:i=t(o=l,n)}}function au(e,t,n){var o,r,i;return function(){var l,s=n(this),u;return s==null?void this.removeAttribute(e):(l=this.getAttribute(e),u=s+"",l===u?null:l===o&&u===r?i:(r=u,i=t(o=l,s)))}}function iu(e,t,n){var o,r,i;return function(){var l,s=n(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(l=this.getAttributeNS(e.space,e.local),u=s+"",l===u?null:l===o&&u===r?i:(r=u,i=t(o=l,s)))}}function lu(e,t){var n=bt(e),o=n==="transform"?Vs:Br;return this.attrTween(e,typeof t=="function"?(n.local?iu:au)(n,o,Nn(this,"attr."+e,t)):t==null?(n.local?nu:tu)(n):(n.local?ru:ou)(n,o,t))}function su(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function uu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function cu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&uu(e,i)),n}return r._value=t,r}function du(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&su(e,i)),n}return r._value=t,r}function fu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=bt(e);return this.tween(n,(o.local?cu:du)(o,t))}function hu(e,t){return function(){Sn(this,e).delay=+t.apply(this,arguments)}}function pu(e,t){return t=+t,function(){Sn(this,e).delay=t}}function gu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hu:pu)(t,e)):he(this.node(),t).delay}function mu(e,t){return function(){me(this,e).duration=+t.apply(this,arguments)}}function yu(e,t){return t=+t,function(){me(this,e).duration=t}}function vu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mu:yu)(t,e)):he(this.node(),t).duration}function wu(e,t){if(typeof t!="function")throw new Error;return function(){me(this,e).ease=t}}function bu(e){var t=this._id;return arguments.length?this.each(wu(t,e)):he(this.node(),t).ease}function xu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;me(this,e).ease=n}}function _u(e){if(typeof e!="function")throw new Error;return this.each(xu(this._id,e))}function Eu(e){typeof e!="function"&&(e=Po(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],l=i.length,s=o[r]=[],u,c=0;c<l;++c)(u=i[c])&&e.call(u,u.__data__,c,i)&&s.push(u);return new xe(o,this._parents,this._name,this._id)}function ku(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),l=new Array(o),s=0;s<i;++s)for(var u=t[s],c=n[s],d=u.length,f=l[s]=new Array(d),p,b=0;b<d;++b)(p=u[b]||c[b])&&(f[b]=p);for(;s<o;++s)l[s]=t[s];return new xe(l,this._parents,this._name,this._id)}function Su(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Nu(e,t,n){var o,r,i=Su(t)?Sn:me;return function(){var l=i(this,e),s=l.on;s!==o&&(r=(o=s).copy()).on(t,n),l.on=r}}function Cu(e,t){var n=this._id;return arguments.length<2?he(this.node(),n).on.on(e):this.each(Nu(n,e,t))}function Mu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Bu(){return this.on("end.remove",Mu(this._id))}function Pu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=un(e));for(var o=this._groups,r=o.length,i=new Array(r),l=0;l<r;++l)for(var s=o[l],u=s.length,c=i[l]=new Array(u),d,f,p=0;p<u;++p)(d=s[p])&&(f=e.call(d,d.__data__,p,s))&&("__data__"in d&&(f.__data__=d.__data__),c[p]=f,Gt(c[p],t,n,p,c,he(d,n)));return new xe(i,this._parents,t,n)}function Iu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Bo(e));for(var o=this._groups,r=o.length,i=[],l=[],s=0;s<r;++s)for(var u=o[s],c=u.length,d,f=0;f<c;++f)if(d=u[f]){for(var p=e.call(d,d.__data__,f,u),b,v=he(d,n),x=0,k=p.length;x<k;++x)(b=p[x])&&Gt(b,t,n,x,p,v);i.push(p),l.push(d)}return new xe(i,l,t,n)}var $u=Ke.prototype.constructor;function Tu(){return new $u(this._groups,this._parents)}function Ru(e,t){var n,o,r;return function(){var i=Le(this,e),l=(this.style.removeProperty(e),Le(this,e));return i===l?null:i===n&&l===o?r:r=t(n=i,o=l)}}function Pr(e){return function(){this.style.removeProperty(e)}}function Ou(e,t,n){var o,r=n+"",i;return function(){var l=Le(this,e);return l===r?null:l===o?i:i=t(o=l,n)}}function Du(e,t,n){var o,r,i;return function(){var l=Le(this,e),s=n(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),Le(this,e))),l===u?null:l===o&&u===r?i:(r=u,i=t(o=l,s))}}function zu(e,t){var n,o,r,i="style."+t,l="end."+i,s;return function(){var u=me(this,e),c=u.on,d=u.value[i]==null?s||(s=Pr(t)):void 0;(c!==n||r!==d)&&(o=(n=c).copy()).on(l,r=d),u.on=o}}function Au(e,t,n){var o=(e+="")=="transform"?As:Br;return t==null?this.styleTween(e,Ru(e,o)).on("end.style."+e,Pr(e)):typeof t=="function"?this.styleTween(e,Du(e,o,Nn(this,"style."+e,t))).each(zu(this._id,e)):this.styleTween(e,Ou(e,o,t),n).on("end.style."+e,null)}function Vu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Lu(e,t,n){var o,r;function i(){var l=t.apply(this,arguments);return l!==r&&(o=(r=l)&&Vu(e,l,n)),o}return i._value=t,i}function Yu(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,Lu(e,t,n??""))}function Xu(e){return function(){this.textContent=e}}function Gu(e){return function(){var t=e(this);this.textContent=t??""}}function Fu(e){return this.tween("text",typeof e=="function"?Gu(Nn(this,"text",e)):Xu(e==null?"":e+""))}function Hu(e){return function(t){this.textContent=e.call(this,t)}}function Uu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Hu(r)),t}return o._value=e,o}function ju(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Uu(e))}function Zu(){for(var e=this._name,t=this._id,n=Ir(),o=this._groups,r=o.length,i=0;i<r;++i)for(var l=o[i],s=l.length,u,c=0;c<s;++c)if(u=l[c]){var d=he(u,t);Gt(u,e,n,c,l,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new xe(o,this._parents,e,n)}function Ku(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,l){var s={value:l},u={value:function(){--r===0&&i()}};n.each(function(){var c=me(this,o),d=c.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),c.on=t}),r===0&&i()})}var Wu=0;function xe(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ir(){return++Wu}var _e=Ke.prototype;xe.prototype={constructor:xe,select:Pu,selectAll:Iu,selectChild:_e.selectChild,selectChildren:_e.selectChildren,filter:Eu,merge:ku,selection:Tu,transition:Zu,call:_e.call,nodes:_e.nodes,node:_e.node,size:_e.size,empty:_e.empty,each:_e.each,on:Cu,attr:lu,attrTween:fu,style:Au,styleTween:Yu,text:Fu,textTween:ju,remove:Bu,tween:eu,delay:gu,duration:vu,ease:bu,easeVarying:_u,end:Ku,[Symbol.iterator]:_e[Symbol.iterator]};function qu(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Qu={time:null,delay:0,duration:250,ease:qu};function Ju(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function ec(e){var t,n;e instanceof xe?(t=e._id,e=e._name):(t=Ir(),(n=Qu).time=xn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var l=o[i],s=l.length,u,c=0;c<s;++c)(u=l[c])&&Gt(u,e,t,c,l,n||Ju(u,t));return new xe(o,this._parents,e,t)}Ke.prototype.interrupt=qs,Ke.prototype.transition=ec;const Ht=e=>()=>e;function tc(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){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:r}})}function Ee(e,t,n){this.k=e,this.x=t,this.y=n}Ee.prototype={constructor:Ee,scale:function(e){return e===1?this:new Ee(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ee(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 He=new Ee(1,0,0);Ee.prototype;function Cn(e){e.stopImmediatePropagation()}function it(e){e.preventDefault(),e.stopImmediatePropagation()}function nc(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function oc(){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 $r(){return this.__zoom||He}function rc(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function ac(){return navigator.maxTouchPoints||"ontouchstart"in this}function ic(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],l=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),l>i?(i+l)/2:Math.min(0,i)||Math.max(0,l))}function lc(){var e=nc,t=oc,n=ic,o=rc,r=ac,i=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Gs,c=vt("start","zoom","end"),d,f,p,b=500,v=150,x=0,k=10;function E(y){y.property("__zoom",$r).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",C).filter(r).on("touchstart.zoom",$).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(y,z,S,R){var F=y.selection?y.selection():y;F.property("__zoom",$r),y!==F?P(y,z,S,R):F.interrupt().each(function(){D(this,arguments).event(R).start().zoom(null,typeof z=="function"?z.apply(this,arguments):z).end()})},E.scaleBy=function(y,z,S,R){E.scaleTo(y,function(){var F=this.__zoom.k,U=typeof z=="function"?z.apply(this,arguments):z;return F*U},S,R)},E.scaleTo=function(y,z,S,R){E.transform(y,function(){var F=t.apply(this,arguments),U=this.__zoom,O=S==null?w(F):typeof S=="function"?S.apply(this,arguments):S,H=U.invert(O),A=typeof z=="function"?z.apply(this,arguments):z;return n(G(B(U,A),O,H),F,l)},S,R)},E.translateBy=function(y,z,S,R){E.transform(y,function(){return n(this.__zoom.translate(typeof z=="function"?z.apply(this,arguments):z,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),l)},null,R)},E.translateTo=function(y,z,S,R,F){E.transform(y,function(){var U=t.apply(this,arguments),O=this.__zoom,H=R==null?w(U):typeof R=="function"?R.apply(this,arguments):R;return n(He.translate(H[0],H[1]).scale(O.k).translate(typeof z=="function"?-z.apply(this,arguments):-z,typeof S=="function"?-S.apply(this,arguments):-S),U,l)},R,F)};function B(y,z){return z=Math.max(i[0],Math.min(i[1],z)),z===y.k?y:new Ee(z,y.x,y.y)}function G(y,z,S){var R=z[0]-S[0]*y.k,F=z[1]-S[1]*y.k;return R===y.x&&F===y.y?y:new Ee(y.k,R,F)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function P(y,z,S,R){y.on("start.zoom",function(){D(this,arguments).event(R).start()}).on("interrupt.zoom end.zoom",function(){D(this,arguments).event(R).end()}).tween("zoom",function(){var F=this,U=arguments,O=D(F,U).event(R),H=t.apply(F,U),A=S==null?w(H):typeof S=="function"?S.apply(F,U):S,Z=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),Q=F.__zoom,te=typeof z=="function"?z.apply(F,U):z,M=u(Q.invert(A).concat(Z/Q.k),te.invert(A).concat(Z/te.k));return function(h){if(h===1)h=te;else{var m=M(h),I=Z/m[2];h=new Ee(I,A[0]-m[0]*I,A[1]-m[1]*I)}O.zoom(null,h)}})}function D(y,z,S){return!S&&y.__zooming||new g(y,z)}function g(y,z){this.that=y,this.args=z,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,z),this.taps=0}g.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,z){return this.mouse&&y!=="mouse"&&(this.mouse[1]=z.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=z.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=z.invert(this.touch1[0])),this.that.__zoom=z,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var z=de(this.that).datum();c.call(y,this.that,new tc(y,{sourceEvent:this.sourceEvent,target:E,type:y,transform:this.that.__zoom,dispatch:c}),z)}};function _(y,...z){if(!e.apply(this,arguments))return;var S=D(this,z).event(y),R=this.__zoom,F=Math.max(i[0],Math.min(i[1],R.k*Math.pow(2,o.apply(this,arguments)))),U=pe(y);if(S.wheel)(S.mouse[0][0]!==U[0]||S.mouse[0][1]!==U[1])&&(S.mouse[1]=R.invert(S.mouse[0]=U)),clearTimeout(S.wheel);else{if(R.k===F)return;S.mouse=[U,R.invert(U)],Ft(this),S.start()}it(y),S.wheel=setTimeout(O,v),S.zoom("mouse",n(G(B(R,F),S.mouse[0],S.mouse[1]),S.extent,l));function O(){S.wheel=null,S.end()}}function N(y,...z){if(p||!e.apply(this,arguments))return;var S=y.currentTarget,R=D(this,z,!0).event(y),F=de(y.view).on("mousemove.zoom",A,!0).on("mouseup.zoom",Z,!0),U=pe(y,S),O=y.clientX,H=y.clientY;Lo(y.view),Cn(y),R.mouse=[U,this.__zoom.invert(U)],Ft(this),R.start();function A(Q){if(it(Q),!R.moved){var te=Q.clientX-O,M=Q.clientY-H;R.moved=te*te+M*M>x}R.event(Q).zoom("mouse",n(G(R.that.__zoom,R.mouse[0]=pe(Q,S),R.mouse[1]),R.extent,l))}function Z(Q){F.on("mousemove.zoom mouseup.zoom",null),Yo(Q.view,R.moved),it(Q),R.event(Q).end()}}function C(y,...z){if(e.apply(this,arguments)){var S=this.__zoom,R=pe(y.changedTouches?y.changedTouches[0]:y,this),F=S.invert(R),U=S.k*(y.shiftKey?.5:2),O=n(G(B(S,U),R,F),t.apply(this,z),l);it(y),s>0?de(this).transition().duration(s).call(P,O,R,y):de(this).call(E.transform,O,R,y)}}function $(y,...z){if(e.apply(this,arguments)){var S=y.touches,R=S.length,F=D(this,z,y.changedTouches.length===R).event(y),U,O,H,A;for(Cn(y),O=0;O<R;++O)H=S[O],A=pe(H,this),A=[A,this.__zoom.invert(A),H.identifier],F.touch0?!F.touch1&&F.touch0[2]!==A[2]&&(F.touch1=A,F.taps=0):(F.touch0=A,U=!0,F.taps=1+!!d);d&&(d=clearTimeout(d)),U&&(F.taps<2&&(f=A[0],d=setTimeout(function(){d=null},b)),Ft(this),F.start())}}function q(y,...z){if(this.__zooming){var S=D(this,z).event(y),R=y.changedTouches,F=R.length,U,O,H,A;for(it(y),U=0;U<F;++U)O=R[U],H=pe(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=H:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=H);if(O=S.that.__zoom,S.touch1){var Z=S.touch0[0],Q=S.touch0[1],te=S.touch1[0],M=S.touch1[1],h=(h=te[0]-Z[0])*h+(h=te[1]-Z[1])*h,m=(m=M[0]-Q[0])*m+(m=M[1]-Q[1])*m;O=B(O,Math.sqrt(h/m)),H=[(Z[0]+te[0])/2,(Z[1]+te[1])/2],A=[(Q[0]+M[0])/2,(Q[1]+M[1])/2]}else if(S.touch0)H=S.touch0[0],A=S.touch0[1];else return;S.zoom("touch",n(G(O,H,A),S.extent,l))}}function ee(y,...z){if(this.__zooming){var S=D(this,z).event(y),R=y.changedTouches,F=R.length,U,O;for(Cn(y),p&&clearTimeout(p),p=setTimeout(function(){p=null},b),U=0;U<F;++U)O=R[U],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=pe(O,this),Math.hypot(f[0]-O[0],f[1]-O[1])<k)){var H=de(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return E.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:Ht(+y),E):o},E.filter=function(y){return arguments.length?(e=typeof y=="function"?y:Ht(!!y),E):e},E.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Ht(!!y),E):r},E.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Ht([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),E):t},E.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],E):[i[0],i[1]]},E.translateExtent=function(y){return arguments.length?(l[0][0]=+y[0][0],l[1][0]=+y[1][0],l[0][1]=+y[0][1],l[1][1]=+y[1][1],E):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},E.constrain=function(y){return arguments.length?(n=y,E):n},E.duration=function(y){return arguments.length?(s=+y,E):s},E.interpolate=function(y){return arguments.length?(u=y,E):u},E.on=function(){var y=c.on.apply(c,arguments);return y===c?E:y},E.clickDistance=function(y){return arguments.length?(x=(y=+y)*y,E):Math.sqrt(x)},E.tapDistance=function(y){return arguments.length?(k=+y,E):k},E}const Mn=.1;function Re(){}const sc={zoomIn:Re,zoomOut:Re,zoomTo:Re,fitView:Re,setCenter:Re,fitBounds:Re,project:e=>e,setTransform:Re,getTransform:()=>({x:0,y:0,zoom:1}),initialized:!1},uc=(e,t)=>{const n=e,o=a.toRef(n,"nodes"),r=a.toRef(n,"d3Zoom"),i=a.toRef(n,"d3Selection"),l=a.toRef(n,"dimensions"),s=a.toRef(n,"translateExtent"),u=a.toRef(n,"minZoom"),c=a.toRef(n,"maxZoom"),d=a.toRef(n,"viewport"),f=a.toRef(n,"snapToGrid"),p=a.toRef(n,"snapGrid"),b=a.toRef(n,"hooks"),v=t,x=a.toRef(v,"getNodes"),k=a.ref(!1);b.value.nodesInitialized.on(()=>{k.value=!0});const E=a.computed(()=>!!r.value&&!!i.value&&!!l.value.width&&!!l.value.height&&k.value);function B(w,P){i.value&&r.value&&r.value.scaleBy(Bn(i.value,P),w)}function G(w,P,D,g){const{x:_,y:N}=eo({x:-w,y:-P},s.value),C=He.translate(-_,-N).scale(D);i.value&&r.value&&r.value.transform(Bn(i.value,g),C)}return a.computed(()=>E.value?{initialized:!0,zoomIn:w=>{B(1.2,w==null?void 0:w.duration)},zoomOut:w=>{B(1/1.2,w==null?void 0:w.duration)},zoomTo:(w,P)=>{i.value&&r.value&&r.value.scaleTo(Bn(i.value,P==null?void 0:P.duration),w)},setTransform:(w,P)=>{G(w.x,w.y,w.zoom,P==null?void 0:P.duration)},getTransform:()=>({x:d.value.x,y:d.value.y,zoom:d.value.zoom}),fitView:(w={padding:Mn,includeHiddenNodes:!1,duration:0})=>{if(!o.value.length)return;const P=(w.includeHiddenNodes?o.value:x.value).filter(C=>{var $;const q=C.initialized&&C.dimensions.width&&C.dimensions.height;let ee=!0;return($=w.nodes)!=null&&$.length&&(ee=w.nodes.includes(C.id)),q&&ee}),D=io(P),{x:g,y:_,zoom:N}=so(D,l.value.width,l.value.height,w.minZoom??u.value,w.maxZoom??c.value,w.padding??Mn,w.offset);G(g,_,N,w==null?void 0:w.duration)},setCenter:(w,P,D)=>{const g=typeof(D==null?void 0:D.zoom)<"u"?D.zoom:c.value,_=l.value.width/2-w*g,N=l.value.height/2-P*g;G(_,N,g,D==null?void 0:D.duration)},fitBounds:(w,P={padding:Mn})=>{const{x:D,y:g,zoom:_}=so(w,l.value.width,l.value.height,u.value,c.value,P.padding);G(D,g,_,P==null?void 0:P.duration)},project:w=>ro(w,d.value,f.value,p.value)}:sc)};function Bn(e,t=0){return e.transition().duration(t)}function Pn(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let r={};if(ve(t.style)?r={...t.style(t)}:t.style&&(r={...t.style}),r.width=r.width??`${t.dimensions.width}px`,r.height=r.height??`${t.dimensions.height}px`,n>0)if(be(r.width)){const i=Number(r.width.replace("px",""));r.width=`${i+n}px`}else r.width+=n;if(o>0)if(be(r.height)){const i=Number(r.height.replace("px",""));r.height=`${i+o}px`}else r.height+=o;if(e.position.x<0){const i=Math.abs(e.position.x);if(t.position.x=t.position.x-i,be(r.width)){const l=Number(r.width.replace("px",""));r.width=`${l+i}px`}else r.width+=i;e.position.x=0}if(e.position.y<0){const i=Math.abs(e.position.y);if(t.position.y=t.position.y-i,be(r.height)){const l=Number(r.height.replace("px",""));r.height=`${l+i}px`}else r.height+=i;e.position.y=0}t.dimensions.width=Number(r.width.toString().replace("px","")),t.dimensions.height=Number(r.height.toString().replace("px","")),ve(t.style)?t.style=i=>{const l=t.style;return{...l(i),...r}}:t.style={...t.style,...r}}}}function Tr(e,t){e.filter(o=>o.type==="add"||o.type==="remove").forEach(o=>{if(o.type==="add")t.findIndex(r=>r.id===o.item.id)===-1&&t.push(o.item);else if(o.type==="remove"){const r=t.findIndex(i=>i.id===o.id);r!==-1&&t.splice(r,1)}});const n=t.map(o=>o.id);return t.forEach(o=>{var r,i;const l=e.filter(s=>s.id===o.id);for(const s of l)switch(s.type){case"select":o.selected=s.selected;break;case"position":if(ze(o)&&(typeof s.position<"u"&&(o.position=s.position),typeof s.dragging<"u"&&(o.dragging=s.dragging),o.expandParent&&o.parentNode)){const u=t[n.indexOf(o.parentNode)];u&&ze(u)&&Pn(o,u)}break;case"dimensions":if(ze(o)){if(typeof s.dimensions<"u"&&(o.dimensions=s.dimensions),typeof s.updateStyle<"u"&&(o.style={...o.style||{},width:`${(r=s.dimensions)==null?void 0:r.width}px`,height:`${(i=s.dimensions)==null?void 0:i.height}px`}),typeof s.resizing<"u"&&(o.resizing=s.resizing),o.expandParent&&o.parentNode){const u=t[n.indexOf(o.parentNode)];u&&ze(u)&&(u.initialized?Pn(o,u):a.nextTick(()=>{Pn(o,u)}))}o.initialized||(o.initialized=!0)}break}}),t}function ke(e,t){return{id:e,type:"select",selected:t}}function Rr(e){return{item:e,type:"add"}}function In(e){return{id:e,type:"remove"}}function $n(e,t){return e.reduce((n,o)=>{let r=t.includes(o.id);oe(o.selectable)&&!o.selectable&&(r=!1);const i=ze(o)?"changedNodes":"changedEdges";return!o.selected&&r?n[i].push(ke(o.id,!0)):o.selected&&!r&&n[i].push(ke(o.id,!1)),n},{changedNodes:[],changedEdges:[]})}function cc(e,t,n,o){let r=!1;const i=uc(e,t),l=h=>{const m=h??n.value??[];e.hooks.updateNodeInternals.trigger(m)},s=h=>{if(h)return e.nodes&&!n.value.length?e.nodes.find(m=>m.id===h):e.nodes[n.value.indexOf(h)]},u=h=>{if(h)return e.edges&&!o.value.length?e.edges.find(m=>m.id===h):e.edges[o.value.indexOf(h)]},c=(h,m,I)=>{const T=[];h.forEach(V=>{var L,K;const W={id:V.id,type:"position",dragging:I,from:V.from};if(m&&(W.position=V.position,V.parentNode)){const J=s(V.parentNode);W.position={x:W.position.x-(((L=J==null?void 0:J.computedPosition)==null?void 0:L.x)??0),y:W.position.y-(((K=J==null?void 0:J.computedPosition)==null?void 0:K.y)??0)}}T.push(W)}),T!=null&&T.length&&e.hooks.nodesChange.trigger(T)},d=h=>{var m;if(!e.vueFlowRef)return;const I=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!I)return;let T;if((m=e.__experimentalFeatures)!=null&&m.nestedFlow){let L=[I],K=I,W;for(;!W&&K;)K=K.parentElement,W=K==null?void 0:K.classList.contains("vue-flow__transformationpane"),W&&(L=[K,...L]);L.forEach(J=>{const Y=window.getComputedStyle(J),{m22:ae}=new window.DOMMatrixReadOnly(Y.transform);T?T*=ae:T=ae})}else{const L=window.getComputedStyle(I),{m22:K}=new window.DOMMatrixReadOnly(L.transform);T=K}const V=h.reduce((L,K)=>{const W=s(K.id);if(W){const J=st(K.nodeElement);J.width&&J.height&&(W.dimensions.width!==J.width||W.dimensions.height!==J.height||K.forceUpdate)&&(W.handleBounds.source=So(".source",K.nodeElement,T),W.handleBounds.target=So(".target",K.nodeElement,T),W.dimensions=J,W.initialized=!0,L.push({id:W.id,type:"dimensions",dimensions:J}))}return L},[]);e.fitViewOnInit&&!r&&(ue(()=>i.value.initialized).toBe(!0).then(()=>{i.value.fitView()}),r=!0),V.length&&e.hooks.nodesChange.trigger(V)},f=(h,m)=>{const I=h.map(L=>L.id);let T,V=[];if(e.multiSelectionActive)T=I.map(L=>ke(L,m));else{const L=$n([...e.nodes,...e.edges],I);T=L.changedNodes,V=L.changedEdges}T.length&&e.hooks.nodesChange.trigger(T),V.length&&e.hooks.edgesChange.trigger(V)},p=(h,m)=>{const I=h.map(L=>L.id);let T=[],V;if(e.multiSelectionActive)V=I.map(L=>ke(L,m));else{const L=$n([...e.nodes,...e.edges],I);T=L.changedNodes,V=L.changedEdges}T.length&&e.hooks.nodesChange.trigger(T),V.length&&e.hooks.edgesChange.trigger(V)},b=(h,m)=>{const I=h.filter(ut).map(K=>K.id),T=h.filter(De).map(K=>K.id);let{changedNodes:V,changedEdges:L}=$n([...e.nodes,...e.edges],[...I,...T]);e.multiSelectionActive&&(V=I.map(K=>ke(K,m)),L=T.map(K=>ke(K,m))),V.length&&e.hooks.nodesChange.trigger(V),L.length&&e.hooks.edgesChange.trigger(L)},v=h=>{f(h,!0)},x=h=>{p(h,!0)},k=h=>{b(h,!0)},E=h=>{if(!h.length)return f(h,!1);const m=h.map(I=>I.id).map(I=>ke(I,!1));m.length&&e.hooks.nodesChange.trigger(m)},B=h=>{if(!h.length)return p(h,!1);const m=h.map(I=>I.id).map(I=>ke(I,!1));m.length&&e.hooks.edgesChange.trigger(m)},G=h=>{if(!h||!h.length)return b([],!1);const{changedNodes:m,changedEdges:I}=h.reduce((T,V)=>{const L=ke(V.id,!1);return ut(V)?T.changedNodes.push(L):T.changedEdges.push(L),T},{changedNodes:[],changedEdges:[]});m.length&&e.hooks.nodesChange.trigger(m),I.length&&e.hooks.edgesChange.trigger(I)},w=h=>{var m;(m=e.d3Zoom)==null||m.scaleExtent([h,e.maxZoom]),e.minZoom=h},P=h=>{var m;(m=e.d3Zoom)==null||m.scaleExtent([e.minZoom,h]),e.maxZoom=h},D=h=>{var m;(m=e.d3Zoom)==null||m.translateExtent(h),e.translateExtent=h},g=h=>{e.nodeExtent=h,l(n.value)},_=h=>{e.nodesDraggable=h,e.nodesConnectable=h,e.elementsSelectable=h},N=h=>{const m=h instanceof Function?h(e.nodes):h;!e.initialized&&!m.length||(e.nodes=co(m,e.nodes,s,e.hooks.error.trigger))},C=h=>{const m=h instanceof Function?h(e.edges):h;if(!e.initialized&&!m.length)return;const I=e.isValidConnection?m.filter(T=>e.isValidConnection(T,{edges:e.edges,sourceNode:s(T.source),targetNode:s(T.target)})):m;e.edges=I.reduce((T,V)=>{const L=s(V.source),K=s(V.target),W=!L||typeof L>"u",J=!K||typeof K>"u";if(W&&J?e.hooks.error.trigger(new le(ie.EDGE_SOURCE_TARGET_MISSING,V.id,V.source,V.target)):(W&&e.hooks.error.trigger(new le(ie.EDGE_SOURCE_MISSING,V.id,V.source)),J&&e.hooks.error.trigger(new le(ie.EDGE_TARGET_MISSING,V.id,V.target))),W||J)return T;const Y=u(V.id);return T.push({...no(V,Object.assign({},Y,e.defaultEdgeOptions)),sourceNode:L,targetNode:K}),T},[])},$=h=>{const m=h instanceof Function?h([...e.nodes,...e.edges]):h;!e.initialized&&!m.length||(N(m.filter(ut)),C(m.filter(De)))},q=h=>{const m=h instanceof Function?h(e.nodes):h,I=co(m,e.nodes,s,e.hooks.error.trigger).map(Rr);I.length&&e.hooks.nodesChange.trigger(I)},ee=h=>{const m=h instanceof Function?h(e.edges):h,I=(e.isValidConnection?m.filter(T=>e.isValidConnection(T,{edges:e.edges,sourceNode:s(T.source),targetNode:s(T.target)})):m).reduce((T,V)=>{const L=_a({...V,...e.defaultEdgeOptions},e.edges,e.hooks.error.trigger);if(L){const K=s(L.source),W=s(L.target),J=!K||typeof K>"u",Y=!W||typeof W>"u";if(J&&Y?e.hooks.error.trigger(new le(ie.EDGE_SOURCE_TARGET_MISSING,L.id,L.source,L.target)):(J&&e.hooks.error.trigger(new le(ie.EDGE_SOURCE_MISSING,L.id,L.source)),Y&&e.hooks.error.trigger(new le(ie.EDGE_TARGET_MISSING,L.id,L.target))),J||Y)return T;T.push(Rr({...L,sourceNode:K,targetNode:W}))}return T},[]);I.length&&e.hooks.edgesChange.trigger(I)},y=(h,m=!0)=>{const I=h instanceof Function?h(e.nodes):h,T=[],V=[];I.forEach(L=>{const K=typeof L=="string"?s(L):L;if(!(oe(K.deletable)&&!K.deletable)&&(T.push(In(K.id)),m)){const W=ct([K],e.edges).filter(J=>oe(J.deletable)?J.deletable:!0);V.push(...W.map(J=>In(J.id)))}}),V.length&&e.hooks.edgesChange.trigger(V),T.length&&e.hooks.nodesChange.trigger(T)},z=h=>{const m=h instanceof Function?h(e.edges):h,I=[];m.forEach(T=>{const V=typeof T=="string"?u(T):T;oe(V.deletable)&&!V.deletable||I.push(In(typeof T=="string"?T:T.id))}),e.hooks.edgesChange.trigger(I)},S=(h,m,I=!0)=>Ea(h,m,e.edges,u,I,e.hooks.error.trigger),R=h=>Tr(h,e.nodes),F=h=>Tr(h,e.edges),U=(h,m,I,T=!1)=>{T?e.connectionClickStartHandle=h:e.connectionStartHandle=h,e.connectionEndHandle=null,e.connectionStatus=null,m&&(e.connectionPosition=m)},O=(h,m=null,I=null)=>{e.connectionStartHandle&&(e.connectionPosition=h,e.connectionEndHandle=m,e.connectionStatus=I)},H=(h,m)=>{e.connectionPosition={x:NaN,y:NaN},e.connectionStatus=null,m?e.connectionClickStartHandle=null:e.connectionStartHandle=null},A=h=>{const m=ga(h),I=m?null:s(h.id);return!m&&!I?[null,null,m]:[m?h:Jn(I),I,m]},Z=(h,m=!0,I)=>{const[T,V,L]=A(h);return T?(I||e.nodes).filter(K=>{if(!L&&(K.id===V.id||!K.computedPosition))return!1;const W=Jn(K),J=Jt(W,T);return m&&J>0||J>=Number(h.width)*Number(h.height)}):[]},Q=(h,m,I=!0)=>{const[T]=A(h);if(!T)return!1;const V=Jt(T,m);return I&&V>0||V>=Number(h.width)*Number(h.height)},te=h=>{const{viewport:m,dimensions:I,d3Zoom:T,d3Selection:V,translateExtent:L}=e;if(!T||!V||!h.x&&!h.y)return!1;const K=He.translate(m.x+h.x,m.y+h.y).scale(m.zoom),W=[[0,0],[I.width,I.height]],J=T.constrain()(K,W,L),Y=e.viewport.x!==J.x||e.viewport.y!==J.y||e.viewport.zoom!==J.k;return T.transform(V,J),Y},M=h=>{const m=h instanceof Function?h(e):h,I=["modelValue","nodes","edges","maxZoom","minZoom","translateExtent","nodeExtent","hooks","defaultEdgeOptions"],T=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];oe(m.defaultEdgeOptions)&&(e.defaultEdgeOptions=m.defaultEdgeOptions);const V=m.modelValue||m.nodes||m.edges?[]:void 0;V&&(m.modelValue&&V.push(...m.modelValue),m.nodes&&V.push(...m.nodes),m.edges&&V.push(...m.edges),$(V));const L=()=>{oe(m.maxZoom)&&P(m.maxZoom),oe(m.minZoom)&&w(m.minZoom),oe(m.translateExtent)&&D(m.translateExtent),oe(m.nodeExtent)&&g(m.nodeExtent)};Object.keys(m).forEach(K=>{const W=K,J=m[W];![...I,...T].includes(W)&&oe(J)&&(e[W]=J)}),e.d3Zoom?L():ue(()=>e.d3Zoom).not.toBeUndefined().then(L),e.initialized||(e.initialized=!0)};return{updateNodePositions:c,updateNodeDimensions:d,setElements:$,setNodes:N,setEdges:C,addNodes:q,addEdges:ee,removeNodes:y,removeEdges:z,findNode:s,findEdge:u,updateEdge:S,applyEdgeChanges:F,applyNodeChanges:R,addSelectedElements:k,addSelectedNodes:v,addSelectedEdges:x,setMinZoom:w,setMaxZoom:P,setTranslateExtent:D,setNodeExtent:g,removeSelectedElements:G,removeSelectedNodes:E,removeSelectedEdges:B,startConnection:U,updateConnection:O,endConnection:H,setInteractive:_,setState:M,getIntersectingNodes:Z,isNodeIntersecting:Q,panBy:te,fitView:async(h={padding:.1})=>{await ue(()=>i.value.initialized).toBe(!0),i.value.fitView(h)},zoomIn:async h=>{await ue(()=>i.value.initialized).toBe(!0),i.value.zoomIn(h)},zoomOut:async h=>{await ue(()=>i.value.initialized).toBe(!0),i.value.zoomOut(h)},zoomTo:async(h,m)=>{await ue(()=>i.value.initialized).toBe(!0),i.value.zoomTo(h,m)},setTransform:async(h,m)=>{await ue(()=>i.value.initialized).toBe(!0),i.value.setTransform(h,m)},getTransform:()=>i.value.getTransform(),setCenter:async(h,m,I)=>{await ue(()=>i.value.initialized).toBe(!0),i.value.setCenter(h,m,I)},fitBounds:async(h,m)=>{await ue(()=>i.value.initialized).toBe(!0),i.value.fitBounds(h,m)},project:h=>i.value.project(h),toObject:()=>JSON.parse(JSON.stringify({nodes:e.nodes.map(h=>{const{computedPosition:m,handleBounds:I,selected:T,dimensions:V,isParent:L,resizing:K,dragging:W,initialized:J,...Y}=h;return Y}),edges:e.edges.map(h=>{const{selected:m,sourceNode:I,targetNode:T,...V}=h;return V}),position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom})),updateNodeInternals:l,$reset:()=>{const h=nr();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const m=He.translate(h.defaultViewport.x??0,h.defaultViewport.y??0).scale(Ce(h.defaultViewport.zoom??1,h.minZoom,h.maxZoom)),I=e.viewportRef.getBoundingClientRect(),T=[[0,0],[I.width,I.height]],V=e.d3Zoom.constrain()(m,T,h.translateExtent);e.d3Zoom.transform(e.d3Selection,V)}M(h)},$destroy:()=>{}}}class Ue{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){return Ue.instance||(Ue.instance=new Ue),Ue.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=nr(n),r=a.reactive(o),i=a.computed(()=>r.nodes.map(p=>p.id)),l=a.computed(()=>r.edges.map(p=>p.id)),s=ys(r,i,l),u=cc(r,s,i,l),c={};Object.entries(r.hooks).forEach(([p,b])=>{const v=`on${p.charAt(0).toUpperCase()+p.slice(1)}`;c[v]=b.on});const d={};Object.entries(r.hooks).forEach(([p,b])=>{d[p]=b.trigger}),u.setState(r);const f={...c,...s,...u,...a.toRefs(r),emits:d,id:t,vueFlowVersion:"1.19.4",$destroy:()=>{this.remove(t)}};return this.set(t,f),f}getId(){return`vue-flow-${this.currentId++}`}}const re=e=>{const t=Ue.getInstance(),n=a.getCurrentScope(),o=e==null?void 0:e.id,r=(n==null?void 0:n.vueFlowId)||o;let i,l=!1;if(n){const s=a.inject(fo,null);typeof s<"u"&&s!==null&&(i=s)}if(i||r&&(i=t.get(r)),!i||i&&o&&o!==i.id){const s=o??t.getId();i=t.create(s,e),n&&(l=!0)}else e&&i.setState(e);return n&&(a.provide(fo,i),n.vueFlowId=i.id,l&&je(()=>{if(i){const s=t.get(i.id);s?s.$destroy():qn(`No store instance found for id ${i.id} in storage.`)}})),i};function dc(e,t,n){const o=a.effectScope();return o.run(()=>{[()=>{o.run(()=>{let r,i,l=!!(n.nodes.value.length||n.edges.value.length);r=Oe([e.modelValue,()=>{var s,u;return(u=(s=e.modelValue)==null?void 0:s.value)==null?void 0:u.length}],([s])=>{s&&Array.isArray(s)&&(i==null||i.pause(),n.setElements(s),!i&&!l&&s.length?l=!0:i==null||i.resume())}),i=Oe([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([s,u])=>{var c;(c=e.modelValue)!=null&&c.value&&Array.isArray(e.modelValue.value)&&(r==null||r.pause(),e.modelValue.value=[...s,...u],a.nextTick(()=>{r==null||r.resume()}))},{immediate:l}),a.onScopeDispose(()=>{r==null||r.stop(),i==null||i.stop()})})},()=>{o.run(()=>{let r,i,l=!!n.nodes.value.length;r=Oe([e.nodes,()=>{var s,u;return(u=(s=e.nodes)==null?void 0:s.value)==null?void 0:u.length}],([s])=>{s&&Array.isArray(s)&&(i==null||i.pause(),n.setNodes(s),!i&&!l&&s.length?l=!0:i==null||i.resume())}),i=Oe([n.nodes,()=>n.nodes.value.length],([s])=>{var u;(u=e.nodes)!=null&&u.value&&Array.isArray(e.nodes.value)&&(r==null||r.pause(),e.nodes.value=[...s],a.nextTick(()=>{r==null||r.resume()}))},{immediate:l}),a.onScopeDispose(()=>{r==null||r.stop(),i==null||i.stop()})})},()=>{o.run(()=>{let r,i,l=!!n.edges.value.length;r=Oe([e.edges,()=>{var s,u;return(u=(s=e.edges)==null?void 0:s.value)==null?void 0:u.length}],([s])=>{s&&Array.isArray(s)&&(i==null||i.pause(),n.setEdges(s),!i&&!l&&s.length?l=!0:i==null||i.resume())}),i=Oe([n.edges,()=>n.edges.value.length],([s])=>{var u;(u=e.edges)!=null&&u.value&&Array.isArray(e.edges.value)&&(r==null||r.pause(),e.edges.value=[...s],a.nextTick(()=>{r==null||r.resume()}))},{immediate:l}),a.onScopeDispose(()=>{r==null||r.stop(),i==null||i.stop()})})},()=>{o.run(()=>{a.watch(()=>t.minZoom,()=>{t.minZoom&&oe(t.minZoom)&&n.setMinZoom(t.minZoom)})})},()=>{o.run(()=>{a.watch(()=>t.maxZoom,()=>{t.maxZoom&&oe(t.maxZoom)&&n.setMaxZoom(t.maxZoom)})})},()=>{o.run(()=>{a.watch(()=>t.translateExtent,()=>{t.translateExtent&&oe(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)})})},()=>{o.run(()=>{a.watch(()=>t.nodeExtent,()=>{t.nodeExtent&&oe(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)})})},()=>{o.run(()=>{a.watch(()=>t.applyDefault,()=>{oe(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)}),a.watch(n.applyDefault,(r,i,l)=>{n.applyDefault.value?(n.onNodesChange(n.applyNodeChanges),n.onEdgesChange(n.applyEdgeChanges)):(n.hooks.value.nodesChange.off(n.applyNodeChanges),n.hooks.value.edgesChange.off(n.applyEdgeChanges)),l(()=>{n.hooks.value.nodesChange.off(n.applyNodeChanges),n.hooks.value.edgesChange.off(n.applyEdgeChanges)})},{immediate:!0})})},()=>{o.run(()=>{const r=async i=>{let l=i;ve(t.autoConnect)&&(l=await t.autoConnect(i)),l!==!1&&n.addEdges([l])};a.watch(()=>t.autoConnect,()=>{oe(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)}),a.watch(n.autoConnect,(i,l,s)=>{i?n.onConnect(r):n.hooks.value.connect.off(r),s(()=>{n.hooks.value.connect.off(r)})},{immediate:!0})})},()=>{const r=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];Object.keys(t).forEach(i=>{if(!r.includes(i)){const l=a.toRef(t,i),s=n[i];o.run(()=>{a.watch(l,u=>{oe(u)&&(s.value=u)},{flush:"pre"})})}})}].forEach(r=>r())}),()=>o.stop()}function Or(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const fc={name:"Pane",compatConfig:{MODE:3}},hc=a.defineComponent({...fc,props:{isSelecting:{type:Boolean}},setup(e){const{id:t,vueFlowRef:n,getNodes:o,getEdges:r,viewport:i,emits:l,userSelectionActive:s,removeSelectedElements:u,panOnDrag:c,userSelectionRect:d,elementsSelectable:f,nodesSelectionActive:p,addSelectedElements:b,getSelectedEdges:v,getSelectedNodes:x,removeNodes:k,removeEdges:E,selectionMode:B,deleteKeyCode:G,multiSelectionKeyCode:w,multiSelectionActive:P}=re(),D=a.ref(null),g=a.ref(0),_=a.ref(0),N=a.ref(),C=a.computed(()=>f.value&&(e.isSelecting||s.value));qe(G,O=>{if(!O)return;const H=o.value.reduce((A,Z)=>((!Z.selected&&Z.parentNode&&A.find(Q=>Q.id===Z.parentNode)||Z.selected)&&A.push(Z),A),[]);(H||v.value)&&(v.value.length>0&&E(v.value),H.length>0&&k(H),p.value=!1,u())}),qe(w,O=>{P.value=O});function $(){s.value=!1,d.value=null,g.value=0,_.value=0}function q(O){O.target!==D.value||C.value||(l.paneClick(O),u(),p.value=!1)}function ee(O){var H;if(O.target===D.value){if(Array.isArray(c.value)&&(H=c.value)!=null&&H.includes(2)){O.preventDefault();return}l.paneContextMenu(O)}}function y(O){O.target===D.value&&l.paneScroll(O)}function z(O){if(N.value=n.value.getBoundingClientRect(),!C.value||!f||!e.isSelecting||O.button!==0||O.target!==D.value||!N.value)return;const{x:H,y:A}=Or(O,N.value);u(),d.value={width:0,height:0,startX:H,startY:A,x:H,y:A},s.value=!0,l.selectionStart(O)}function S(O){if(!C.value)return l.paneMouseMove(O);if(!e.isSelecting||!N.value||!d.value)return;s.value||(s.value=!0),p.value&&(p.value=!1);const H=Or(O,N.value),A=d.value.startX??0,Z=d.value.startY??0,Q={...d.value,x:H.x<A?H.x:A,y:H.y<Z?H.y:Z,width:Math.abs(H.x-A),height:Math.abs(H.y-Z)},te=lo(o.value,d.value,i.value,B.value===en.Partial),M=ct(te,r.value);g.value=te.length,_.value=M.length,d.value=Q,b([...te,...M])}function R(O){C.value&&O.button===0&&(!s.value&&d.value&&O.target===D.value&&q(O),p.value=g.value>0,$(),l.selectionEnd(O))}function F(O){var H;if(!C.value)return l.paneMouseLeave(O);s.value&&(p.value=g.value>0,(H=l.selectionEnd)==null||H.call(l,O)),$()}function U(O){C.value||l.paneMouseEnter(O)}return(O,H)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"container",ref:D,key:`pane-${a.unref(t)}`,class:a.normalizeClass(["vue-flow__pane vue-flow__container",{selection:e.isSelecting}]),onClick:q,onContextmenu:ee,onWheelPassive:y,onMouseenter:U,onMousedown:z,onMousemove:S,onMouseup:R,onMouseleave:F},[a.renderSlot(O.$slots,"default"),a.unref(s)&&a.unref(d)?(a.openBlock(),a.createBlock(hs,{key:0})):a.createCommentVNode("",!0),a.unref(p)&&a.unref(x).length?(a.openBlock(),a.createBlock(ds,{key:1})):a.createCommentVNode("",!0)],34))}}),pc={class:"vue-flow__nodes vue-flow__container"},gc={name:"Nodes",compatConfig:{MODE:3}},mc=a.defineComponent({...gc,setup(e){const t=a.inject(ft),n=re(),o=a.toRef(n,"nodesDraggable"),r=a.toRef(n,"nodesFocusable"),i=a.toRef(n,"elementsSelectable"),l=a.toRef(n,"nodesConnectable"),s=a.toRef(n,"getNodes"),u=a.toRef(n,"getNodesInitialized"),c=a.toRef(n,"getNodeTypes"),d=a.toRef(n,"updateNodeDimensions"),f=a.toRef(n,"emits");let p=a.ref();ue(()=>s.value.length>0&&u.value.length===s.value.length).toBe(!0).then(()=>{a.nextTick(()=>{f.value.nodesInitialized(u.value)})}),a.onMounted(()=>{p.value=new ResizeObserver(B=>{const G=B.map(w=>({id:w.target.getAttribute("data-id"),nodeElement:w.target,forceUpdate:!0}));d.value(G)})}),a.onBeforeUnmount(()=>{var B;return(B=p.value)==null?void 0:B.disconnect()});function b(B){return typeof B>"u"?o.value:B}function v(B){return typeof B>"u"?i.value:B}function x(B){return typeof B>"u"?l.value:B}function k(B){return typeof B>"u"?r.value:B}function E(B,G){const w=B||"default";let P=G??c.value[w];const D=a.getCurrentInstance();if(typeof P=="string"&&D){const _=Object.keys(D.appContext.components);_&&_.includes(w)&&(P=a.resolveComponent(w,!1))}return typeof P!="string"?P:(t==null?void 0:t[`node-${w}`])||(f.value.error(new le(ie.NODE_TYPE_MISSING,P)),!1)}return(B,G)=>(a.openBlock(),a.createElementBlock("div",pc,[a.unref(p)?(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:0},a.renderList(a.unref(s),w=>(a.openBlock(),a.createBlock(a.unref(zl),{id:w.id,key:w.id,"resize-observer":a.unref(p),type:E(w.type,w.template),name:w.type||"default",draggable:b(w.draggable),selectable:v(w.selectable),connectable:x(w.connectable),focusable:k(w.focusable),node:w},null,8,["id","resize-observer","type","name","draggable","selectable","connectable","focusable","node"]))),128)):a.createCommentVNode("",!0)]))}}),yc=["id","markerWidth","markerHeight","markerUnits","orient"],vc=["stroke","stroke-width","fill"],wc=["stroke","stroke-width"],bc={name:"MarkerType",compatConfig:{MODE:3}},xc=a.defineComponent({...bc,props:{id:null,type:null,color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(a.openBlock(),a.createElementBlock("marker",{id:e.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===a.unref(tn).ArrowClosed?(a.openBlock(),a.createElementBlock("polyline",{key:0,stroke:e.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":e.strokeWidth,fill:e.color,points:"-5,-4 0,0 -5,4 -5,-4"},null,8,vc)):a.createCommentVNode("",!0),e.type===a.unref(tn).Arrow?(a.openBlock(),a.createElementBlock("polyline",{key:1,stroke:e.color,"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":e.strokeWidth,fill:"none",points:"-5,-4 0,0 -5,4"},null,8,wc)):a.createCommentVNode("",!0)],8,yc))}}),_c={name:"MarkerDefinitions",compatConfig:{MODE:3}},Ec=a.defineComponent({..._c,setup(e){const t=re(),n=a.toRef(t,"id"),o=a.toRef(t,"edges"),r=a.toRef(t,"connectionLineOptions"),i=a.toRef(t,"defaultMarkerColor"),l=a.computed(()=>{const s=[],u=[],c=d=>{if(d){const f=Me(d,n.value);s.includes(f)||(typeof d=="object"?u.push({...d,id:f,color:d.color||i.value}):u.push({id:f,color:i.value,type:d}),s.push(f))}};return[r.value.markerEnd,r.value.markerStart].forEach(c),o.value.reduce((d,f)=>([f.markerStart,f.markerEnd].forEach(c),d.sort((p,b)=>p.id.localeCompare(b.id))),u),u});return(s,u)=>(a.openBlock(),a.createElementBlock("defs",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(l),c=>(a.openBlock(),a.createBlock(xc,{id:c.id,key:c.id,type:c.type,color:c.color,width:c.width,height:c.height,markerUnits:c.markerUnits,"stroke-width":c.strokeWidth,orient:c.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))]))}}),kc={key:0,class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},Sc={name:"Edges",compatConfig:{MODE:3}},Nc=a.defineComponent({...Sc,setup(e){const t=a.inject(ft),n=re(),o=a.toRef(n,"connectionStartHandle"),r=a.toRef(n,"nodesConnectable"),i=a.toRef(n,"edgesUpdatable"),l=a.toRef(n,"edgesFocusable"),s=a.toRef(n,"elementsSelectable"),u=a.toRef(n,"getSelectedNodes"),c=a.toRef(n,"findNode"),d=a.toRef(n,"edges"),f=a.toRef(n,"getEdges"),p=a.toRef(n,"getNodesInitialized"),b=a.toRef(n,"getEdgeTypes"),v=a.toRef(n,"elevateEdgesOnSelect"),x=a.toRef(n,"dimensions"),k=a.toRef(n,"emits"),E=Zt(()=>{var _;return(_=o.value)==null?void 0:_.nodeId},()=>{var _;return(_=o.value)!=null&&_.nodeId?c.value(o.value.nodeId):!1}),B=Zt(()=>{var _;return(_=o.value)==null?void 0:_.nodeId},()=>{var _,N;return!!(E.value&&(typeof E.value.connectable>"u"?r.value:E.value.connectable)&&(_=o.value)!=null&&_.nodeId&&(N=o.value)!=null&&N.type)}),G=Zt([()=>d.value.map(_=>_.zIndex),()=>v.value?[u.value.length]:[0],()=>v.value?p.value.map(_=>_.computedPosition.z):[]],()=>Ba(f.value,c.value,v.value));function w(_){return typeof _>"u"?s.value:_}function P(_){return typeof _>"u"?i.value:_}function D(_){return typeof _>"u"?l.value:_}function g(_,N){const C=_||"default";let $=N??b.value[C];const q=a.getCurrentInstance();if(typeof $=="string"&&q){const y=Object.keys(q.appContext.components);y&&y.includes(C)&&($=a.resolveComponent(C,!1))}return $&&typeof $!="string"?$:(t==null?void 0:t[`edge-${C}`])||(k.value.error(new le(ie.EDGE_TYPE_MISSING,$)),!1)}return(_,N)=>a.unref(x).width&&a.unref(x).height?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(G),C=>(a.openBlock(),a.createElementBlock("svg",{key:C.level,class:"vue-flow__edges vue-flow__container",style:a.normalizeStyle(`z-index: ${C.level}`)},[C.isMaxLevel?(a.openBlock(),a.createBlock(Ec,{key:0})):a.createCommentVNode("",!0),a.createElementVNode("g",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(C.edges,$=>(a.openBlock(),a.createBlock(a.unref(ts),{id:$.id,key:$.id,edge:$,type:g($.type,$.template),name:$.type||"default",selectable:w($.selectable),updatable:P($.updatable),focusable:D($.focusable)},null,8,["id","edge","type","name","selectable","updatable","focusable"]))),128))])],4))),128)),a.unref(B)&&a.unref(E)?(a.openBlock(),a.createElementBlock("svg",kc,[a.createVNode(ss,{"source-node":a.unref(E)},null,8,["source-node"])])):a.createCommentVNode("",!0)],64)):a.createCommentVNode("",!0)}}),Cc=a.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),Mc={name:"Transform",compatConfig:{MODE:3}},Bc=a.defineComponent({...Mc,setup(e){const{id:t,viewport:n,emits:o,d3Zoom:r,d3Selection:i,dimensions:l,...s}=re(),u=a.ref(!jt);return ue(()=>r.value&&i.value&&l.value.width>0&&l.value.height>0).toBeTruthy().then(()=>{o.paneReady({id:t,viewport:n,emits:o,d3Zoom:r,d3Selection:i,dimensions:l,...s}),setTimeout(()=>{u.value=!0},0)}),(c,d)=>(a.openBlock(),a.createElementBlock("div",{key:`transform-${a.unref(t)}`,class:"vue-flow__transformationpane vue-flow__container",style:a.normalizeStyle({transform:`translate(${a.unref(n).x}px,${a.unref(n).y}px) scale(${a.unref(n).zoom})`,opacity:a.unref(u)?void 0:0})},[a.createVNode(Nc),Cc,a.createVNode(mc),a.renderSlot(c.$slots,"default")],4))}}),Pc={name:"Viewport",compatConfig:{MODE:3}},Ic=a.defineComponent({...Pc,setup(e){const{id:t,minZoom:n,maxZoom:o,defaultViewport:r,translateExtent:i,dimensions:l,zoomActivationKeyCode:s,selectionKeyCode:u,panActivationKeyCode:c,panOnScroll:d,panOnScrollMode:f,panOnScrollSpeed:p,panOnDrag:b,zoomOnDoubleClick:v,zoomOnPinch:x,zoomOnScroll:k,preventScrolling:E,noWheelClassName:B,noPanClassName:G,emits:w,connectionStartHandle:P,userSelectionActive:D,paneDragging:g,d3Zoom:_,d3Selection:N,d3ZoomHandler:C,viewport:$,viewportRef:q}=re(),ee=a.ref(),y=a.ref(!1),z=a.ref(!1);let S=!1,R=0,F={x:0,y:0,zoom:0};const U=qe(c),O=a.computed(()=>!y.value&&b.value&&U.value),H=a.computed(()=>u.value!==!0&&y.value||u.value===!0&&!O.value);a.onMounted(()=>{ia(ee,te);const h=Qt();qt(h,"resize",te)}),a.onMounted(()=>{const h=ee.value,m=h.getBoundingClientRect(),I=lc().scaleExtent([n.value,o.value]).translateExtent(i.value),T=de(h).call(I),V=T.on("wheel.zoom"),L=He.translate(r.value.x??0,r.value.y??0).scale(Ce(r.value.zoom??1,n.value,o.value)),K=[[0,0],[m.width,m.height]],W=I.constrain()(L,K,i.value);I.transform(T,W),_.value=I,N.value=T,C.value=V,$.value={x:W.x,y:W.y,zoom:W.k},q.value=h,qe(u,Y=>{y.value=Y});const J=qe(s);a.watchEffect(()=>{y.value&&D.value&&!z.value?I.on("zoom",null):!y.value&&!D.value&&I.on("zoom",Y=>{$.value={x:Y.transform.x,y:Y.transform.y,zoom:Y.transform.k};const ae=Q(Y.transform);S=A(b.value,R??0),w.viewportChange(ae),w.move({event:Y,flowTransform:ae})})}),I.on("start",Y=>{var ae;if(!Y.sourceEvent)return null;R=Y.sourceEvent.button,z.value=!0;const Se=Q(Y.transform);((ae=Y.sourceEvent)==null?void 0:ae.type)==="mousedown"&&(g.value=!0),F=Se,w.viewportChangeStart(Se),w.moveStart({event:Y,flowTransform:Se})}),I.on("end",Y=>{if(!Y.sourceEvent)return null;if(z.value=!1,g.value=!1,A(b.value,R??0)&&!S&&w.paneContextMenu(Y.sourceEvent),S=!1,Z(F,Y.transform)){const ae=Q(Y.transform);F=ae,w.viewportChangeEnd(ae),w.moveEnd({event:Y,flowTransform:ae})}}),a.watchEffect(()=>{d.value&&!J.value&&!D.value?T.on("wheel.zoom",Y=>{if(M(Y,B.value))return!1;Y.preventDefault(),Y.stopImmediatePropagation();const ae=T.property("__zoom").k||1;if(Y.ctrlKey&&x.value){const On=pe(Y),Jc=-Y.deltaY*(Y.deltaMode===1?.05:Y.deltaMode?1:.002)*10,ed=ae*2**Jc;I.scaleTo(T,ed,On);return}const Se=Y.deltaMode===1?20:1,Ut=f.value===dt.Vertical?0:Y.deltaX*Se,Rn=f.value===dt.Horizontal?0:Y.deltaY*Se;I.translateBy(T,-(Ut/ae)*p.value,-(Rn/ae)*p.value)},{passive:!1}):typeof V<"u"&&T.on("wheel.zoom",function(Y,ae){if(!E.value||M(Y,B.value))return null;Y.preventDefault(),V.call(this,Y,ae)},{passive:!1})}),I.filter(Y=>{var ae,Se;const Ut=J.value||k.value,Rn=x.value&&Y.ctrlKey;if(Y.button===1&&Y.type==="mousedown"&&((ae=Y.target)!=null&&ae.closest(".vue-flow__node")||(Se=Y.target)!=null&&Se.closest(".vue-flow__edge")))return!0;if(!b.value&&!Ut&&!d.value&&!v.value&&!x.value||D.value||!v.value&&Y.type==="dblclick"||M(Y,B.value)&&Y.type==="wheel"||M(Y,G.value)&&Y.type!=="wheel"||!x.value&&Y.ctrlKey&&Y.type==="wheel"||!Ut&&!d.value&&!Rn&&Y.type==="wheel"||!b.value&&(Y.type==="mousedown"||Y.type==="touchstart")||Array.isArray(b.value)&&!b.value.includes(Y.button)&&(Y.type==="mousedown"||Y.type==="touchstart"))return!1;const On=Array.isArray(b.value)&&b.value.includes(Y.button)||!Y.button||Y.button<=1;return(!Y.ctrlKey||Y.type==="wheel")&&On})});function A(h,m){return m===2&&Array.isArray(h)&&h.includes(2)}function Z(h,m){return h.x!==m.x&&!isNaN(m.x)||h.y!==m.y&&!isNaN(m.y)||h.zoom!==m.k&&!isNaN(m.k)}function Q(h){return{x:h.x,y:h.y,zoom:h.k}}function te(){if(!ee.value)return;const{width:h,height:m}=st(ee.value);(h===0||m===0)&&w.error(new le(ie.MISSING_VIEWPORT_DIMENSIONS)),l.value.width=h||500,l.value.height=m||500}function M(h,m){return h.target.closest(`.${m}`)}return(h,m)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[(a.openBlock(),a.createElementBlock("div",{ref_key:"viewportEl",ref:ee,key:`viewport-${a.unref(t)}`,class:"vue-flow__viewport vue-flow__container"},[a.createVNode(hc,{"is-selecting":a.unref(H),class:a.normalizeClass({connecting:!!a.unref(P),dragging:a.unref(g),draggable:!!a.unref(b)})},{default:a.withCtx(()=>[a.createVNode(Bc,null,{default:a.withCtx(()=>[a.renderSlot(h.$slots,"zoom-pane")]),_:3})]),_:3},8,["is-selecting","class"])])),a.renderSlot(h.$slots,"default")],64))}}),$c=["id"],Tc=["id"],Rc=["id"],Oc={name:"A11yDescriptions",compatConfig:{MODE:3}},Dc=a.defineComponent({...Oc,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=re(),r={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"};return(i,l)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("div",{id:`${a.unref(Go)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+a.toDisplayString(a.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,$c),a.createElementVNode("div",{id:`${a.unref(Fo)}-${a.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,Tc),a.unref(n)?a.createCommentVNode("",!0):(a.openBlock(),a.createElementBlock("div",{key:0,id:`${a.unref(Tl)}-${a.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:r},a.toDisplayString(a.unref(o)),9,Rc))],64))}}),zc={name:"VueFlow",compatConfig:{MODE:3}},Ac=a.defineComponent({...zc,props:{id:null,modelValue:null,nodes:null,edges:null,edgeTypes:null,nodeTypes:null,connectionMode:null,connectionLineType:null,connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:null,isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:null,selectionKeyCode:null,multiSelectionKeyCode:null,zoomActivationKeyCode:null,panActivationKeyCode:null,snapToGrid:{type:Boolean,default:void 0},snapGrid:null,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},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:null,maxZoom:null,defaultViewport:null,translateExtent:null,nodeExtent:null,defaultMarkerColor:null,zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:null,panOnScrollMode:null,zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:null,edgeUpdaterRadius:null,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:null,noWheelClassName:null,noPanClassName:null,defaultEdgeOptions:null,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},__experimentalFeatures:null},emits:["nodesChange","edgesChange","nodeDoubleClick","nodeClick","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeContextMenu","nodeDragStart","nodeDrag","nodeDragStop","nodesInitialized","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneReady","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdate","edgeUpdateEnd","updateNodeInternals","error","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,r=Ze(o,"modelValue",n),i=Ze(o,"nodes",n),l=Ze(o,"edges",n),{vueFlowRef:s,hooks:u,getNodeTypes:c,getEdgeTypes:d,...f}=re(o),p=dc({modelValue:r,nodes:i,edges:l},o,{vueFlowRef:s,hooks:u,getNodeTypes:c,getEdgeTypes:d,...f});ha(n,u);const b=a.ref();return a.provide(ft,a.useSlots()),a.onUnmounted(()=>{p()}),a.onMounted(()=>{s.value=b.value}),t({vueFlowRef:s,hooks:u,getNodeTypes:c,getEdgeTypes:d,...f}),(v,x)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"el",ref:b,class:"vue-flow"},[a.createVNode(Ic,null,{nodes:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Object.keys(a.unref(c)),k=>a.renderSlot(v.$slots,`node-${k}`)),256))]),edges:a.withCtx(()=>[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Object.keys(a.unref(d)),k=>a.renderSlot(v.$slots,`edge-${k}`)),256))]),"connection-name":a.withCtx(()=>[a.renderSlot(v.$slots,"connection-line")]),"zoom-pane":a.withCtx(()=>[a.renderSlot(v.$slots,"zoom-pane")]),default:a.withCtx(()=>[a.renderSlot(v.$slots,"default")]),_:3}),a.createVNode(Dc)],512))}}),Vc={key:0,class:"label-input-wrapper"},Lc=a.defineComponent({__name:"EditableNode",props:{id:{},label:{},sourcePosition:{},targetPosition:{},data:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,String,Function]},position:{},dimensions:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},dragHandle:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,r={top:j.Top,right:j.Right,bottom:j.Bottom,left:j.Left},i=a.computed(()=>r[n.sourcePosition]),l=a.computed(()=>r[n.targetPosition]),s=a.ref(),u=a.ref(""),c=a.ref(!1);let d=0;const f=()=>{let v=Date.now();v-d<500&&!c.value&&p(),d=v},p=async()=>{u.value=n.label,c.value=!0,await a.nextTick(),s.value.focus()},b=()=>{c.value=!1,o("change",u.value)};return(v,x)=>(a.openBlock(),a.createElementBlock("div",{onClick:x[2]||(x[2]=k=>f())},[a.createElementVNode("div",null,a.toDisplayString(n.label),1),c.value?(a.openBlock(),a.createElementBlock("div",Vc,[a.withDirectives(a.createElementVNode("input",{ref_key:"labelInput",ref:s,class:"label-input","onUpdate:modelValue":x[0]||(x[0]=k=>u.value=k),onBlur:x[1]||(x[1]=k=>c.value=!1),onKeypress:a.withKeys(b,["enter"])},null,544),[[a.vModelText,u.value]])])):a.createCommentVNode("",!0),n.data.hasInput?(a.openBlock(),a.createBlock(a.unref(Ve),{key:1,id:"a",type:"target",position:l.value},null,8,["position"])):a.createCommentVNode("",!0),n.data.hasOutput?(a.openBlock(),a.createBlock(a.unref(Ve),{key:2,id:"b",type:"source",position:i.value},null,8,["position"])):a.createCommentVNode("",!0)]))}}),Yc=["id","d","marker-end"],Xc={class:"vue-flow__edge-label"},Gc={key:0,class:"label-input-wrapper"},Fc={inheritAttrs:!1},Hc=a.defineComponent({...Fc,__name:"EditableEdge",props:{id:{},sourceX:{},sourceY:{},targetX:{},targetY:{},sourcePosition:{},targetPosition:{},data:{},markerEnd:{},style:{},label:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},selected:{type:Boolean},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},curvature:{},interactionWidth:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},emits:["change"],setup(e,{emit:t}){const n=e;re();const o=t,r=a.ref(),i=a.ref(""),l=a.ref(!1);let s=0;const u=()=>{let p=Date.now();p-s<500&&!l.value&&c(),s=p},c=async()=>{i.value=n.label,l.value=!0,await a.nextTick(),r.value.focus()},d=()=>{l.value=!1,o("change",i.value)},f=a.computed(()=>Nt(n));return(p,b)=>(a.openBlock(),a.createElementBlock(a.Fragment,null,[a.createElementVNode("path",{id:p.id,style:a.normalizeStyle(p.style),class:"vue-flow__edge-path",d:f.value[0],"marker-end":p.markerEnd},null,12,Yc),a.createVNode(a.unref(rs),null,{default:a.withCtx(()=>[a.createElementVNode("div",{style:a.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${f.value[1]}px,${f.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:b[2]||(b[2]=v=>u())},[a.createElementVNode("div",Xc,a.toDisplayString(n.label),1),l.value?(a.openBlock(),a.createElementBlock("div",Gc,[a.withDirectives(a.createElementVNode("input",{ref_key:"labelInput",ref:r,class:"label-input","onUpdate:modelValue":b[0]||(b[0]=v=>i.value=v),onBlur:b[1]||(b[1]=v=>l.value=!1),onKeypress:a.withKeys(d,["enter"])},null,544),[[a.vModelText,i.value]])])):a.createCommentVNode("",!0)],4)]),_:1})],64))}}),Uc={class:"chart-controls"},jc={class:"chart-controls-left"},Zc=a.createElementVNode("b",null,"Selected Node:",-1),Kc={class:"chart-controls-right"},Wc={key:0},qc={key:1},Tn=a.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=a.ref(""),i=a.ref({}),l=a.ref(!1);a.ref({x:0,y:0});const s=a.ref(""),u=a.ref([]),c=a.computed(()=>{for(let g=0;g<u.value.length;g++)if(u.value[g].id==s.value)return g;return-1}),d=a.computed({get:()=>{let g=n.modelValue;n.nodeContainerClass?r.value=n.nodeContainerClass:r.value="defaultContainerClass";for(let _=0;_<g.length;_++)g[_].data={},g[_].type=="input"?(g[_].data.hasInput=!1,g[_].data.hasOutput=!0):g[_].type=="output"?(g[_].data.hasInput=!0,g[_].data.hasOutput=!1):(g[_].data.hasInput=!0,g[_].data.hasOutput=!0),g[_].class="vue-flow__node-default",g[_].type="editable";for(let _=0;_<g.length;_++){let N=g[_].id;g[_],g[_].events={click:()=>{s.value=N}}}return g},set:g=>{o("update:modelValue",JSON.parse(JSON.stringify(g)))}}),{getNodes:f,onPaneReady:p}=re({});p(g=>{i.value=g}),u.value=d.value,a.onMounted(()=>{document.removeEventListener("keypress",E),document.addEventListener("keypress",E)}),a.onBeforeUnmount(()=>{document.removeEventListener("keypress",E)});const b=g=>({top:"right",right:"bottom",bottom:"left",left:"top"})[g],v=()=>{c.value>-1&&(u.value[c.value].sourcePosition=b(u.value[c.value].sourcePosition))},x=()=>{c.value>-1&&(u.value[c.value].targetPosition=b(u.value[c.value].targetPosition))},k=g=>{window.scrollBy(0,g.deltaY)},E=g=>{l.value&&g.ctrlKey==!0&&((g.key=="+"||g.key=="=")&&i.value.zoomIn(),g.key=="-"&&i.value.zoomOut())},B=()=>{i.value.fitView()},G=()=>{let g={x:Math.random()*200,y:Math.random()*200},_=!1;if(c.value>-1){const $=u.value[c.value];$.data.hasOutput&&(g={x:$.position.x+200,y:$.position.y+50},_=!0)}let N=u.value.length,C=`node-${N}`;if(u.value.push({id:C,label:"Node "+N,sourcePosition:"right",targetPosition:"left",class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{s.value=C}},position:g}),_){let $=`edge-${N+1}`;u.value.push({id:$,source:s.value,target:C,type:"editable",label:`EDGE ${N+1}`,animated:!0,events:{click:()=>{s.value=$}}})}},w=g=>{console.log("edge connect",g)},P=g=>{console.log("edge double click",g)},D=(g,_)=>{for(let N=0;N<u.value.length;N++)if(u.value[N].id==_){u.value[N].label=g;break}};return(g,_)=>(a.openBlock(),a.createElementBlock("div",{class:a.normalizeClass(["node-editor-wrapper",r.value]),onMouseover:_[8]||(_[8]=N=>l.value=!0),onMouseleave:_[9]||(_[9]=N=>l.value=!1)},[a.createElementVNode("div",Uc,[a.createElementVNode("div",jc,[a.createElementVNode("div",null,[Zc,a.createTextVNode(" "+a.toDisplayString(s.value?s.value:"none"),1)])]),a.createElementVNode("div",Kc,[a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:_[0]||(_[0]=N=>G())},"Add Node")]),a.createElementVNode("div",null,[a.createElementVNode("button",{class:"button-default",onClick:_[1]||(_[1]=N=>B())},"Center")]),c.value>-1?(a.openBlock(),a.createElementBlock("div",Wc,[a.createElementVNode("button",{class:"button-default",onClick:_[2]||(_[2]=N=>x())},"Shift Input Position")])):a.createCommentVNode("",!0),c.value>-1?(a.openBlock(),a.createElementBlock("div",qc,[a.createElementVNode("button",{class:"button-default",onClick:_[3]||(_[3]=N=>v())},"Shift Output Position")])):a.createCommentVNode("",!0)])]),u.value&&u.value.length?(a.openBlock(),a.createBlock(a.unref(Ac),{key:0,onWheel:_[4]||(_[4]=a.withModifiers(N=>k(N),["prevent"])),class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,modelValue:u.value,"onUpdate:modelValue":_[5]||(_[5]=N=>u.value=N),onConnect:_[6]||(_[6]=N=>w(N)),onEdgeDoubleClick:_[7]||(_[7]=N=>P(N))},{"node-editable":a.withCtx(N=>[a.createVNode(Lc,a.mergeProps(N,{onChange:C=>D(C,N.id)}),null,16,["onChange"])]),"edge-editable":a.withCtx(N=>[a.createVNode(Hc,a.mergeProps(N,{onChange:C=>D(C,N.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):a.createCommentVNode("",!0)],34))}}),Dr=a.defineComponent({__name:"StateEditor",props:["layout","nodeContainerClass","modelValue"],emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,r=a.computed({get:()=>{let l=n.modelValue,s={},u={},c=0,d=[];for(let f in l){d.length;let p={id:f,label:f,position:n.layout[f]&&n.layout[f].position?n.layout[f].position:{x:200*c,y:100},targetPosition:n.layout[f]&&n.layout[f].targetPosition?n.layout[f].targetPosition:"left",sourcePosition:n.layout[f]&&n.layout[f].sourcePosition?n.layout[f].sourcePosition:"right"};l[f].type&&l[f].type=="final"&&(p.type="output",p.class="default-output-node"),s[f]=p;let b=l[f].on;for(let v in l[f].on){let x=b[v];typeof x=="object"&&x.constructor===Object&&(x=x.target),d.push({id:`${f}-${b[v]}-${v}`,target:x,source:f,label:v,animated:!0}),u[x]=!0}c++}for(let f in s)u[f]||(s[f].type="input",s[f].class="default-input-node"),d.push(s[f]);return d},set:l=>{i(l)}}),i=l=>{let s={},u={},c={};for(let d=0;d<l.length;d++){let f=l[d];f.type=="input"?s[f.label]={on:{}}:f.type=="output"?s[f.label]={type:"final"}:f.source&&f.target?(u[f.source]=u[f.source]||{},u[f.source][f.label]={target:f.target}):s[f.label]={on:{}},c[f.id]=f.label}for(let d in u){let f=c[d];for(let p in u[d])s[f].on[p]=u[d][p]}o("update:modelValue",s)};return(l,s)=>(a.openBlock(),a.createElementBlock("div",null,[a.createVNode(Tn,{modelValue:r.value,"onUpdate:modelValue":s[0]||(s[0]=u=>r.value=u),"node-container-class":e.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function Qc(e){e.component("NodeEditor",Tn),e.component("StateEditor",Dr)}ye.NodeEditor=Tn,ye.StateEditor=Dr,ye.install=Qc,Object.defineProperty(ye,Symbol.toStringTag,{value:"Module"})});
21
+ Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class ge extends Error{constructor(t,...n){var o;super((o=li[t])==null?void 0:o.call(li,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function xn(e){return"clientX"in e}function Re(e,t){var n,o;const i=xn(e),r=i?e.clientX:(n=e.touches)==null?void 0:n[0].clientX,a=i?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:a-((t==null?void 0:t.top)??0)}}const Vt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function ai(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function Sn(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function si(e,t,n,o){return(t[n]||[]).reduce((i,r)=>{var a,s;return`${e.id}-${r.id}-${n}`!==o&&i.push({id:r.id||null,type:n,nodeId:e.id,x:(((a=e.computedPosition)==null?void 0:a.x)??0)+r.x+r.width/2,y:(((s=e.computedPosition)==null?void 0:s.y)??0)+r.y+r.height/2,width:r.width,height:r.height}),i},[])}function Zs(e,t,n,o,i,r){const{x:a,y:s}=Re(e),c=t.elementsFromPoint(a,s).find(b=>b.classList.contains("vue-flow__handle"));if(c){const b=c.getAttribute("data-nodeid");if(b){const _=Nn(void 0,c),x=c.getAttribute("data-handleid"),N=r({nodeId:b,id:x,type:_});if(N){const p=i.find(C=>C.nodeId===b&&C.type===_&&C.id===x);return{handle:{id:x,type:_,nodeId:b,x:(p==null?void 0:p.x)||n.x,y:(p==null?void 0:p.y)||n.y},validHandleResult:N}}}}let d=[],h=Number.POSITIVE_INFINITY;for(const b of i){const _=Math.sqrt((b.x-n.x)**2+(b.y-n.y)**2);if(_<=o){const x=r(b);_<=h&&(_<h?d=[{handle:b,validHandleResult:x}]:_===h&&d.push({handle:b,validHandleResult:x}),h=_)}}if(!d.length)return{handle:null,validHandleResult:ai()};if(d.length===1)return d[0];const g=d.some(({validHandleResult:b})=>b.isValid),m=d.some(({handle:b})=>b.type==="target");return d.find(({handle:b,validHandleResult:_})=>m?b.type==="target":g?_.isValid:!0)||d[0]}function ui(e,t,n,o,i,r,a,s,u,c,d){const h=r==="target",g=s.querySelector(`.vue-flow__handle[data-id="${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`),{x:m,y:b}=Re(e),_=s.elementFromPoint(m,b),x=_!=null&&_.classList.contains("vue-flow__handle")?_:g,N=ai();if(x){N.handleDomNode=x;const p=Nn(void 0,x),C=x.getAttribute("data-nodeid"),E=x.getAttribute("data-handleid"),$=x.classList.contains("connectable"),A=x.classList.contains("connectableend"),D={source:h?C:o,sourceHandle:h?E:i,target:h?o:C,targetHandle:h?i:E};N.connection=D;const Z=$&&A&&(n===Oe.Strict?h&&p==="source"||!h&&p==="target":C!==o||E!==i);N.endHandle={nodeId:C,handleId:E,type:p},Z&&(N.isValid=a(D,{edges:u,nodes:c,sourceNode:d(D.source),targetNode:d(D.target)}))}return N}function Ws({nodes:e,nodeId:t,handleId:n,handleType:o}){const i=[];for(let r=0;r<e.length;r++){const a=e[r],{handleBounds:s}=a;let u=[],c=[];s&&(u=si(a,s,"source",`${t}-${n}-${o}`),c=si(a,s,"target",`${t}-${n}-${o}`)),i.push(...u,...c)}return i}function Nn(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Ks(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}const qs=["production","prod"];function Ot(e,...t){ci()&&console.warn(`[Vue Flow]: ${e}`,...t)}function ci(){return!qs.includes(process.env.NODE_ENV||"")}function di(e,t,n,o){const i=t.querySelectorAll(`.vue-flow__handle${e}`);return Array.from(i).map(a=>{const s=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),position:a.getAttribute("data-handlepos"),x:(s.left-n.left)/o,y:(s.top-n.top)/o,...Bt(a)}})}function Cn(e,t,n,o,i,r=!1,a){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),l.nextTick(()=>{a.blur()})):n([e])}function fe(e){return typeof l.unref(e)<"u"}function Js(e,t,n,o){if(!e||!e.source||!e.target)return n(new ge(he.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return Te(e)?i=e:i={...e,id:Go(e)},i=Fo(i,void 0,o),Os(i,t)?!1:i}function js(e,t,n,o,i,r){if(!t.source||!t.target)return r(new ge(he.EDGE_INVALID,e.id)),!1;const a=o(e.id);if(!a)return r(new ge(he.EDGE_NOT_FOUND,e.id)),!1;const{id:s,...u}=e,c={...u,id:i?Go(t):s,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.splice(n.indexOf(a),1,c),c}function fi(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const a=e[r];if(!ze(a)){n(new ge(he.NODE_INVALID,a==null?void 0:a.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const s=Bs(a,t(a.id),a.parentNode);a.parentNode&&(o[a.parentNode]=!0),i[r]=s}for(const r of i){const a=t(r.parentNode)||i.find(s=>s.id===r.parentNode);r.parentNode&&!a&&n(new ge(he.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),a&&(a.isParent=!0))}return i}function hi(e,t){e.clear();for(const n of t){const{id:o,source:i,target:r,sourceHandle:a=null,targetHandle:s=null}=n,u=`${i}-source-${a}`,c=`${r}-target-${s}`,d=e.get(u)||new Map,h=e.get(c)||new Map,g=l.markRaw({edgeId:o,source:i,target:r,sourceHandle:a,targetHandle:s});e.set(u,d.set(`${r}-${s}`,g)),e.set(c,h.set(`${i}-${a}`,g))}}function gi(e,t,n,o,i,r,a,s){const u=[];for(const c of e){const d=Te(c)?c:Js(c,s,i,r);if(!d)continue;const h=n(d.source),g=n(d.target);if(!h||!g){i(new ge(he.EDGE_SOURCE_TARGET_MISSING,d.id,d.source,d.target));continue}if(!h){i(new ge(he.EDGE_SOURCE_MISSING,d.id,d.source));continue}if(!g){i(new ge(he.EDGE_TARGET_MISSING,d.id,d.target));continue}if(t&&!t(d,{edges:s,nodes:a,sourceNode:h,targetNode:g})){i(new ge(he.EDGE_INVALID,d.id));continue}const m=o(d.id);u.push({...Fo(d,m,r),sourceNode:h,targetNode:g})}return u}function Qs(){return{edgesChange:R(),nodesChange:R(),nodeDoubleClick:R(),nodeClick:R(),nodeMouseEnter:R(),nodeMouseMove:R(),nodeMouseLeave:R(),nodeContextMenu:R(),nodeDragStart:R(),nodeDrag:R(),nodeDragStop:R(),nodesInitialized:R(),miniMapNodeClick:R(),miniMapNodeDoubleClick:R(),miniMapNodeMouseEnter:R(),miniMapNodeMouseMove:R(),miniMapNodeMouseLeave:R(),connect:R(),connectStart:R(),connectEnd:R(),clickConnectStart:R(),clickConnectEnd:R(),paneReady:R(),init:R(),move:R(),moveStart:R(),moveEnd:R(),selectionDragStart:R(),selectionDrag:R(),selectionDragStop:R(),selectionContextMenu:R(),selectionStart:R(),selectionEnd:R(),viewportChangeStart:R(),viewportChange:R(),viewportChangeEnd:R(),paneScroll:R(),paneClick:R(),paneContextMenu:R(),paneMouseEnter:R(),paneMouseMove:R(),paneMouseLeave:R(),edgeContextMenu:R(),edgeMouseEnter:R(),edgeMouseMove:R(),edgeMouseLeave:R(),edgeDoubleClick:R(),edgeClick:R(),edgeUpdateStart:R(),edgeUpdate:R(),edgeUpdateEnd:R(),updateNodeInternals:R(),error:R(e=>Ot(e.message))}}function eu(e,t){l.onBeforeMount(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),ct(()=>{o.off(i)})}})}function pi(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:un.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:at.Free,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:Ve.Bezier,style:{}},connectionMode:Oe.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:Vt()?"Meta":"Control",zoomActivationKeyCode:Vt()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:Qs(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,disableKeyboardA11y:!1,ariaLiveMessage:""}}const tu=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function nu(e,t,n){const o=$s(e),i=f=>{const y=f??[];e.hooks.updateNodeInternals.trigger(y)},r=f=>Vs(f,e.nodes,e.edges),a=f=>Ds(f,e.nodes,e.edges),s=f=>yn(f,e.edges),u=f=>{if(f)return t.value.get(f)},c=f=>{if(f)return n.value.get(f)},d=(f,y,w)=>{var I,O;const G=[];for(const X of f){const ee={id:X.id,type:"position",dragging:w,from:X.from};if(y&&(ee.position=X.position,X.parentNode)){const ne=u(X.parentNode);ee.position={x:ee.position.x-(((I=ne==null?void 0:ne.computedPosition)==null?void 0:I.x)??0),y:ee.position.y-(((O=ne==null?void 0:ne.computedPosition)==null?void 0:O.y)??0)}}G.push(ee)}G!=null&&G.length&&e.hooks.nodesChange.trigger(G)},h=f=>{if(!e.vueFlowRef)return;const y=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!y)return;const w=window.getComputedStyle(y),{m22:I}=new window.DOMMatrixReadOnly(w.transform),O=[];for(let G=0;G<f.length;++G){const X=f[G],ee=u(X.id);if(ee){const ne=Bt(X.nodeElement);if(!!(ne.width&&ne.height&&(ee.dimensions.width!==ne.width||ee.dimensions.height!==ne.height||X.forceUpdate))){const ae=X.nodeElement.getBoundingClientRect();ee.dimensions=ne,ee.handleBounds.source=di(".source",X.nodeElement,ae,I),ee.handleBounds.target=di(".target",X.nodeElement,ae,I),O[G]={id:ee.id,type:"dimensions",dimensions:ne}}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),O.length&&e.hooks.nodesChange.trigger(O)},g=(f,y)=>{const w=[];for(const G of f)w.push(G.id);let I=[],O=[];if(e.multiSelectionActive)for(const G of w)I.push(Me(G,y));else{const G=wn([...e.nodes,...e.edges],w);I=G.changedNodes,O=G.changedEdges}I.length&&e.hooks.nodesChange.trigger(I),O.length&&e.hooks.edgesChange.trigger(O)},m=(f,y)=>{const w=[];for(const G of f)w.push(G.id);let I=[],O=[];if(e.multiSelectionActive)for(const G of w)O.push(Me(G,y));else{const G=wn([...e.nodes,...e.edges],w);I=G.changedNodes,O=G.changedEdges}I.length&&e.hooks.nodesChange.trigger(I),O.length&&e.hooks.edgesChange.trigger(O)},b=(f,y)=>{const w=[],I=[];for(const X of f)ze(X)?w.push(X.id):Te(X)&&I.push(X.id);const{changedNodes:O,changedEdges:G}=wn([...e.nodes,...e.edges],[...w,...I]);if(e.multiSelectionActive){for(const X of w)O.push(Me(X,y));for(const X of I)G.push(Me(X,y))}O.length&&e.hooks.nodesChange.trigger(O),G.length&&e.hooks.edgesChange.trigger(G)},_=f=>{g(f,!0)},x=f=>{m(f,!0)},N=f=>{b(f,!0)},p=f=>{if(!f.length)return g(f,!1);const y=[];for(const w of f)y.push(Me(w.id,!1));y.length&&e.hooks.nodesChange.trigger(y)},C=f=>{if(!f.length)return m(f,!1);const y=[];for(const w of f)y.push(Me(w.id,!1));y.length&&e.hooks.edgesChange.trigger(y)},E=f=>{if(!f||!f.length)return b([],!1);const y=f.reduce((w,I)=>{const O=Me(I.id,!1);return ze(I)?w.nodes.push(O):w.edges.push(O),w},{nodes:[],edges:[]});y.nodes.length&&e.hooks.nodesChange.trigger(y.nodes),y.edges.length&&e.hooks.edgesChange.trigger(y.edges)},$=f=>{var y;(y=e.d3Zoom)==null||y.scaleExtent([f,e.maxZoom]),e.minZoom=f},A=f=>{var y;(y=e.d3Zoom)==null||y.scaleExtent([e.minZoom,f]),e.maxZoom=f},D=f=>{var y;(y=e.d3Zoom)==null||y.translateExtent(f),e.translateExtent=f},U=f=>{e.nodeExtent=f,i()},Z=f=>{e.nodesDraggable=f,e.nodesConnectable=f,e.elementsSelectable=f},V=f=>{const y=f instanceof Function?f(e.nodes):f;!e.initialized&&!y.length||(e.nodes=fi(y,u,e.hooks.error.trigger))},S=f=>{const y=f instanceof Function?f(e.edges):f;if(!e.initialized&&!y.length)return;const w=gi(y,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);hi(e.connectionLookup,w),e.edges=w},j=f=>{const y=f instanceof Function?f([...e.nodes,...e.edges]):f;!e.initialized&&!y.length||(V(y.filter(ze)),S(y.filter(Te)))},H=f=>{let y=f instanceof Function?f(e.nodes):f;y=Array.isArray(y)?y:[y];const w=fi(y,u,e.hooks.error.trigger),I=[];for(const O of w)I.push(ei(O));I.length&&e.hooks.nodesChange.trigger(I)},v=f=>{let y=f instanceof Function?f(e.edges):f;y=Array.isArray(y)?y:[y];const w=gi(y,e.isValidConnection,u,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),I=[];for(const O of w)I.push(ei(O));I.length&&e.hooks.edgesChange.trigger(I)},P=(f,y=!0,w=!1)=>{const I=f instanceof Function?f(e.nodes):f,O=Array.isArray(I)?I:[I],G=[],X=[];function ee(ce){const ae=s(ce);for(const se of ae)(!fe(se.deletable)||se.deletable)&&X.push(ni(se.id,se.source,se.target,se.sourceHandle,se.targetHandle))}function ne(ce){const ae=[];for(const se of e.nodes)se.parentNode===ce&&ae.push(se);if(ae.length){for(const se of ae)G.push(ti(se.id));y&&ee(ae);for(const se of ae)ne(se.id)}}for(const ce of O){const ae=typeof ce=="string"?u(ce):ce;ae&&(fe(ae.deletable)&&!ae.deletable||(G.push(ti(ae.id)),y&&ee([ae]),w&&ne(ae.id)))}X.length&&e.hooks.edgesChange.trigger(X),G.length&&e.hooks.nodesChange.trigger(G)},k=f=>{const y=f instanceof Function?f(e.edges):f,w=Array.isArray(y)?y:[y],I=[];for(const O of w){const G=typeof O=="string"?c(O):O;G&&(fe(G.deletable)&&!G.deletable||I.push(ni(typeof O=="string"?O:O.id,G.source,G.target,G.sourceHandle,G.targetHandle)))}e.hooks.edgesChange.trigger(I)},T=(f,y,w=!0)=>js(f,y,e.edges,c,w,e.hooks.error.trigger),z=(f,y,w={replace:!1})=>{const I=c(f);if(!I)return;const O=typeof y=="function"?y(I):y;I.data=w.replace?O:{...I.data,...O}},M=f=>Qo(f,e.nodes),B=f=>{const y=Qo(f,e.edges);return hi(e.connectionLookup,y),y},L=(f,y,w={replace:!1})=>{const I=u(f);if(!I)return;const O=typeof y=="function"?y(I):y;w.replace?e.nodes.splice(e.nodes.indexOf(I),1,O):Object.assign(I,O)},K=(f,y,w={replace:!1})=>{const I=u(f);if(!I)return;const O=typeof y=="function"?y(I):y;I.data=w.replace?O:{...I.data,...O}},re=(f,y,w=!1)=>{w?e.connectionClickStartHandle=f:e.connectionStartHandle=f,e.connectionEndHandle=null,e.connectionStatus=null,y&&(e.connectionPosition=y)},te=(f,y=null,w=null)=>{e.connectionStartHandle&&(e.connectionPosition=f,e.connectionEndHandle=y,e.connectionStatus=w)},oe=(f,y)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,y?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ue=f=>{const y=Ps(f),w=y?null:We(f)?f:u(f.id);return!y&&!w?[null,null,y]:[y?f:Ro(w),w,y]},le=(f,y=!0,w=e.nodes)=>{const[I,O,G]=ue(f);if(!I)return[];const X=[];for(const ee of w||e.nodes){if(!G&&(ee.id===O.id||!ee.computedPosition))continue;const ne=Ro(ee),ce=pn(ne,I);(y&&ce>0||ce>=Number(I.width)*Number(I.height))&&X.push(ee)}return X},q=(f,y,w=!0)=>{const[I]=ue(f);if(!I)return!1;const O=pn(I,y);return w&&O>0||O>=Number(I.width)*Number(I.height)},W=f=>{const{viewport:y,dimensions:w,d3Zoom:I,d3Selection:O,translateExtent:G}=e;if(!I||!O||!f.x&&!f.y)return!1;const X=Ue.translate(y.x+f.x,y.y+f.y).scale(y.zoom),ee=[[0,0],[w.width,w.height]],ne=I.constrain()(X,ee,G),ce=e.viewport.x!==ne.x||e.viewport.y!==ne.y||e.viewport.zoom!==ne.k;return I.transform(O,ne),ce},J=f=>{const y=f instanceof Function?f(e):f,w=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];fe(y.defaultEdgeOptions)&&(e.defaultEdgeOptions=y.defaultEdgeOptions);const I=y.modelValue||y.nodes||y.edges?[]:void 0;I&&(y.modelValue&&I.push(...y.modelValue),y.nodes&&I.push(...y.nodes),y.edges&&I.push(...y.edges),j(I));const O=()=>{fe(y.maxZoom)&&A(y.maxZoom),fe(y.minZoom)&&$(y.minZoom),fe(y.translateExtent)&&D(y.translateExtent)};for(const G of Object.keys(y)){const X=G,ee=y[X];![...tu,...w].includes(X)&&fe(ee)&&(e[X]=ee)}dt(()=>e.d3Zoom).not.toBeNull().then(O),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:h,setElements:j,setNodes:V,setEdges:S,addNodes:H,addEdges:v,removeNodes:P,removeEdges:k,findNode:u,findEdge:c,updateEdge:T,updateEdgeData:z,updateNode:L,updateNodeData:K,applyEdgeChanges:B,applyNodeChanges:M,addSelectedElements:N,addSelectedNodes:_,addSelectedEdges:x,setMinZoom:$,setMaxZoom:A,setTranslateExtent:D,setNodeExtent:U,removeSelectedElements:E,removeSelectedNodes:p,removeSelectedEdges:C,startConnection:re,updateConnection:te,endConnection:oe,setInteractive:Z,setState:J,getIntersectingNodes:le,getIncomers:r,getOutgoers:a,getConnectedEdges:s,isNodeIntersecting:q,panBy:W,fitView:f=>o.value.fitView(f),zoomIn:f=>o.value.zoomIn(f),zoomOut:f=>o.value.zoomOut(f),zoomTo:(f,y)=>o.value.zoomTo(f,y),setViewport:(f,y)=>o.value.setViewport(f,y),setTransform:(f,y)=>o.value.setTransform(f,y),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(f,y,w)=>o.value.setCenter(f,y,w),fitBounds:(f,y)=>o.value.fitBounds(f,y),project:f=>o.value.project(f),screenToFlowCoordinate:f=>o.value.screenToFlowCoordinate(f),flowToScreenCoordinate:f=>o.value.flowToScreenCoordinate(f),toObject:()=>{const f=[],y=[];for(const w of e.nodes){const{computedPosition:I,handleBounds:O,selected:G,dimensions:X,isParent:ee,resizing:ne,dragging:ce,events:ae,...se}=w;f.push(se)}for(const w of e.edges){const{selected:I,sourceNode:O,targetNode:G,events:X,...ee}=w;y.push(ee)}return JSON.parse(JSON.stringify({nodes:f,edges:y,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:f=>new Promise(y=>{const{nodes:w,edges:I,position:O,zoom:G,viewport:X}=f;if(w&&V(w),I&&S(I),X!=null&&X.x&&(X!=null&&X.y)||O){const ee=(X==null?void 0:X.x)||O[0],ne=(X==null?void 0:X.y)||O[1],ce=(X==null?void 0:X.zoom)||G||e.viewport.zoom;return dt(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:ee,y:ne,zoom:ce}).then(()=>{y(!0)})})}else y(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const f=pi();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const y=Ue.translate(f.defaultViewport.x??0,f.defaultViewport.y??0).scale(Ae(f.defaultViewport.zoom??1,f.minZoom,f.maxZoom)),w=e.viewportRef.getBoundingClientRect(),I=[[0,0],[w.width,w.height]],O=e.d3Zoom.constrain()(y,I,f.translateExtent);e.d3Zoom.transform(e.d3Selection,O)}J(f)},$destroy:()=>{}}}const ou=["data-id","data-handleid","data-nodeid","data-handlepos"],iu={name:"Handle",compatConfig:{MODE:3}},Ke=l.defineComponent({...iu,props:{id:{default:null},type:{},position:{default:()=>F.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=l.createPropsRestProxy(e,["position","connectable","connectableStart","connectableEnd","id"]),o=l.toRef(()=>n.type??"source"),i=l.toRef(()=>n.isValidConnection??null),{connectionStartHandle:r,connectionClickStartHandle:a,connectionEndHandle:s,vueFlowRef:u,nodesConnectable:c,noDragClassName:d,noPanClassName:h}=de(),{id:g,node:m,nodeEl:b,connectedEdges:_}=Ao(),x=l.ref(),N=l.toRef(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),p=l.toRef(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),C=l.toRef(()=>{var V,S,j,H,v,P;return((V=r.value)==null?void 0:V.nodeId)===g&&((S=r.value)==null?void 0:S.handleId)===e.id&&((j=r.value)==null?void 0:j.type)===o.value||((H=s.value)==null?void 0:H.nodeId)===g&&((v=s.value)==null?void 0:v.handleId)===e.id&&((P=s.value)==null?void 0:P.type)===o.value}),E=l.toRef(()=>{var V,S,j;return((V=a.value)==null?void 0:V.nodeId)===g&&((S=a.value)==null?void 0:S.handleId)===e.id&&((j=a.value)==null?void 0:j.type)===o.value}),{handlePointerDown:$,handleClick:A}=Oo({nodeId:g,handleId:e.id,isValidConnection:i,type:o}),D=l.computed(()=>typeof e.connectable=="string"&&e.connectable==="single"?!_.value.some(V=>{const S=V[`${o.value}Handle`];return V[o.value]!==g?!1:S?S===e.id:!0}):typeof e.connectable=="number"?_.value.filter(V=>{const S=V[`${o.value}Handle`];return V[o.value]!==g?!1:S?S===e.id:!0}).length<e.connectable:typeof e.connectable=="function"?e.connectable(m,_.value):fe(e.connectable)?e.connectable:c.value);dt(()=>!!m.dimensions.width&&!!m.dimensions.height).toBe(!0,{flush:"post"}).then(()=>{var V;const S=(V=m.handleBounds[o.value])==null?void 0:V.find(z=>z.id===e.id);if(!u.value||S)return;const j=u.value.querySelector(".vue-flow__transformationpane");if(!b.value||!x.value||!j||!e.id)return;const H=b.value.getBoundingClientRect(),v=x.value.getBoundingClientRect(),P=window.getComputedStyle(j),{m22:k}=new window.DOMMatrixReadOnly(P.transform),T={id:e.id,position:e.position,x:(v.left-H.left)/k,y:(v.top-H.top)/k,...Bt(x.value)};m.handleBounds[o.value]=[...m.handleBounds[o.value]??[],T]}),l.onUnmounted(()=>{const V=m.handleBounds[o.value];V&&(m.handleBounds[o.value]=V.filter(S=>S.id!==e.id))});function U(V){const S=xn(V);D.value&&N.value&&(S&&V.button===0||!S)&&$(V)}function Z(V){!g||!a.value&&!N.value||D.value&&A(V)}return t({handleClick:A,handlePointerDown:$,onClick:Z,onPointerDown:U}),(V,S)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"handle",ref:x,"data-id":`${l.unref(g)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":l.unref(g),"data-handlepos":V.position,class:l.normalizeClass(["vue-flow__handle",[`vue-flow__handle-${V.position}`,`vue-flow__handle-${e.id}`,l.unref(d),l.unref(h),o.value,{connectable:D.value,connecting:E.value,connectablestart:N.value,connectableend:p.value,connectionindicator:D.value&&(N.value&&!C.value||p.value&&C.value)}]]),onMousedown:U,onTouchstartPassive:U,onClick:Z},[l.renderSlot(V.$slots,"default",{id:V.id})],42,ou))}}),At=function({sourcePosition:e=F.Bottom,targetPosition:t=F.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:a}){const s=a.label||n;return[l.h(Ke,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?l.h(s):l.h("div",{innerHTML:s}),l.h(Ke,{type:"source",position:e,connectable:o,isValidConnection:r})]};At.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],At.inheritAttrs=!1,At.compatConfig={MODE:3};const ru=At,zt=function({targetPosition:e=F.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[l.h(Ke,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?l.h(r):l.h("div",{innerHTML:r})]};zt.props=["targetPosition","label","isValidTargetPos","connectable","data"],zt.inheritAttrs=!1,zt.compatConfig={MODE:3};const lu=zt,Rt=function({sourcePosition:e=F.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?l.h(r):l.h("div",{innerHTML:r}),l.h(Ke,{type:"source",position:e,connectable:n,isValidConnection:o})]};Rt.props=["sourcePosition","label","isValidSourcePos","connectable","data"],Rt.inheritAttrs=!1,Rt.compatConfig={MODE:3};const au=Rt,su=["transform"],uu=["width","height","x","y","rx","ry"],cu=["y"],du={name:"EdgeText",compatConfig:{MODE:3}},fu=l.defineComponent({...du,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=l.ref({x:0,y:0,width:0,height:0}),n=l.ref(null),o=l.computed(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);l.onMounted(i),l.watch([()=>e.x,()=>e.y,n,()=>e.label],i);function i(){if(!n.value)return;const r=n.value.getBBox();(r.width!==t.value.width||r.height!==t.value.height)&&(t.value=r)}return(r,a)=>(l.openBlock(),l.createElementBlock("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(l.openBlock(),l.createElementBlock("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*r.labelBgPadding[0]}px`,height:`${t.value.height+2*r.labelBgPadding[1]}px`,x:-r.labelBgPadding[0],y:-r.labelBgPadding[1],style:l.normalizeStyle(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,uu)):l.createCommentVNode("",!0),l.createElementVNode("text",l.mergeProps(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[l.renderSlot(r.$slots,"default",{},()=>[typeof r.label!="string"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(r.label),{key:0})):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(r.label),1)],64))])],16,cu)],8,su))}}),hu=["id","d","marker-end","marker-start"],gu=["d","stroke-width"],pu={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Ht=l.defineComponent({...pu,props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},style:{},labelStyle:{},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=l.createPropsRestProxy(e,["interactionWidth","labelShowBg"]),o=l.ref(null),i=l.ref(null),r=l.ref(null),a=l.useAttrs();return t({pathEl:o,interactionEl:i,labelEl:r}),(s,u)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("path",{id:s.id,ref_key:"pathEl",ref:o,d:s.path,style:l.normalizeStyle(n.style),class:l.normalizeClass(["vue-flow__edge-path",l.unref(a).class]),"marker-end":s.markerEnd,"marker-start":s.markerStart},null,14,hu),s.interactionWidth?(l.openBlock(),l.createElementBlock("path",{key:0,ref_key:"interactionEl",ref:i,fill:"none",d:s.path,"stroke-width":s.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,gu)):l.createCommentVNode("",!0),s.label&&s.labelX&&s.labelY?(l.openBlock(),l.createBlock(fu,{key:1,ref_key:"labelEl",ref:r,x:s.labelX,y:s.labelY,label:s.label,"label-show-bg":s.labelShowBg,"label-bg-style":s.labelBgStyle,"label-bg-padding":s.labelBgPadding,"label-bg-border-radius":s.labelBgBorderRadius,"label-style":s.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):l.createCommentVNode("",!0)],64))}});function mi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,a=Math.abs(o-t)/2,s=o<t?o+a:o-a;return[r,s,i,a]}function yi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:s}){const u=e*.125+i*.375+a*.375+n*.125,c=t*.125+r*.375+s*.375+o*.125,d=Math.abs(u-e),h=Math.abs(c-t);return[u,c,d,h]}function Lt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function vi({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let a,s;switch(e){case F.Left:a=t-Lt(t-o,r),s=n;break;case F.Right:a=t+Lt(o-t,r),s=n;break;case F.Top:a=t,s=n-Lt(n-i,r);break;case F.Bottom:a=t,s=n+Lt(i-n,r);break}return[a,s]}function kn(e){const{sourceX:t,sourceY:n,sourcePosition:o=F.Bottom,targetX:i,targetY:r,targetPosition:a=F.Top,curvature:s=.25}=e,[u,c]=vi({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[d,h]=vi({pos:a,x1:i,y1:r,x2:t,y2:n,c:s}),[g,m,b,_]=yi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:c,targetControlX:d,targetControlY:h});return[`M${t},${n} C${u},${c} ${d},${h} ${i},${r}`,g,m,b,_]}function wi({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,a;switch(e){case F.Left:case F.Right:r=.5*(t+o),a=n;break;case F.Top:case F.Bottom:r=t,a=.5*(n+i);break}return[r,a]}function _i(e){const{sourceX:t,sourceY:n,sourcePosition:o=F.Bottom,targetX:i,targetY:r,targetPosition:a=F.Top}=e,[s,u]=wi({pos:o,x1:t,y1:n,x2:i,y2:r}),[c,d]=wi({pos:a,x1:i,y1:r,x2:t,y2:n}),[h,g,m,b]=yi({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:c,targetControlY:d});return[`M${t},${n} C${s},${u} ${c},${d} ${i},${r}`,h,g,m,b]}const bi={[F.Left]:{x:-1,y:0},[F.Right]:{x:1,y:0},[F.Top]:{x:0,y:-1},[F.Bottom]:{x:0,y:1}};function mu({source:e,sourcePosition:t=F.Bottom,target:n}){return t===F.Left||t===F.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1}}function Ei(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function yu({source:e,sourcePosition:t=F.Bottom,target:n,targetPosition:o=F.Top,center:i,offset:r}){const a=bi[t],s=bi[o],u={x:e.x+a.x*r,y:e.y+a.y*r},c={x:n.x+s.x*r,y:n.y+s.y*r},d=mu({source:u,sourcePosition:t,target:c}),h=d.x!==0?"x":"y",g=d[h];let m,b,_;const x={x:0,y:0},N={x:0,y:0},[p,C,E,$]=mi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[h]*s[h]===-1){b=i.x??p,_=i.y??C;const D=[{x:b,y:u.y},{x:b,y:c.y}],U=[{x:u.x,y:_},{x:c.x,y:_}];a[h]===g?m=h==="x"?D:U:m=h==="x"?U:D}else{const D=[{x:u.x,y:c.y}],U=[{x:c.x,y:u.y}];if(h==="x"?m=a.x===g?U:D:m=a.y===g?D:U,t===o){const H=Math.abs(e[h]-n[h]);if(H<=r){const v=Math.min(r-1,r-H);a[h]===g?x[h]=(u[h]>e[h]?-1:1)*v:N[h]=(c[h]>n[h]?-1:1)*v}}if(t!==o){const H=h==="x"?"y":"x",v=a[h]===s[H],P=u[H]>c[H],k=u[H]<c[H];(a[h]===1&&(!v&&P||v&&k)||a[h]!==1&&(!v&&k||v&&P))&&(m=h==="x"?D:U)}const Z={x:u.x+x.x,y:u.y+x.y},V={x:c.x+N.x,y:c.y+N.y},S=Math.max(Math.abs(Z.x-m[0].x),Math.abs(V.x-m[0].x)),j=Math.max(Math.abs(Z.y-m[0].y),Math.abs(V.y-m[0].y));S>=j?(b=(Z.x+V.x)/2,_=m[0].y):(b=m[0].x,_=(Z.y+V.y)/2)}return[[e,{x:u.x+x.x,y:u.y+x.y},...m,{x:c.x+N.x,y:c.y+N.y},n],b,_,E,$]}function vu(e,t,n,o){const i=Math.min(Ei(e,t)/2,Ei(t,n)/2,o),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a){const c=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${r+i*c},${a}Q ${r},${a} ${r},${a+i*d}`}const s=e.x<n.x?1:-1,u=e.y<n.y?-1:1;return`L ${r},${a+i*u}Q ${r},${a} ${r+i*s},${a}`}function Mn(e){const{sourceX:t,sourceY:n,sourcePosition:o=F.Bottom,targetX:i,targetY:r,targetPosition:a=F.Top,borderRadius:s=5,centerX:u,centerY:c,offset:d=20}=e,[h,g,m,b,_]=yu({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:a,center:{x:u,y:c},offset:d});return[h.reduce((N,p,C)=>{let E;return C>0&&C<h.length-1?E=vu(h[C-1],p,h[C+1],s):E=`${C===0?"M":"L"}${p.x} ${p.y}`,N+=E,N},""),g,m,b,_]}function wu(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,a,s,u]=mi({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,a,s,u]}const _u=l.defineComponent({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=wu(e);return l.h(Ht,{path:n,labelX:o,labelY:i,...t,...e})}}}),xi=l.defineComponent({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=Mn({...e,sourcePosition:e.sourcePosition??F.Bottom,targetPosition:e.targetPosition??F.Top});return l.h(Ht,{path:n,labelX:o,labelY:i,...t,...e})}}}),bu=l.defineComponent({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>l.h(xi,{...e,...t,borderRadius:0})}}),Eu=l.defineComponent({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=kn({...e,sourcePosition:e.sourcePosition??F.Bottom,targetPosition:e.targetPosition??F.Top});return l.h(Ht,{path:n,labelX:o,labelY:i,...t,...e})}}}),xu=l.defineComponent({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup(e,{attrs:t}){return()=>{const[n,o,i]=_i({...e,sourcePosition:e.sourcePosition??F.Bottom,targetPosition:e.targetPosition??F.Top});return l.h(Ht,{path:n,labelX:o,labelY:i,...t,...e})}}}),Su={input:au,default:ru,output:lu},Nu={default:Eu,straight:_u,step:bu,smoothstep:xi,simplebezier:xu};function Cu(e,t,n){const o=l.computed(()=>_=>t.value.get(_)),i=l.computed(()=>_=>n.value.get(_)),r=l.computed(()=>{const _={...Nu,...e.edgeTypes},x=Object.keys(_);for(const N of e.edges)N.type&&!x.includes(N.type)&&(_[N.type]=N.type);return _}),a=l.computed(()=>{const _={...Su,...e.nodeTypes},x=Object.keys(_);for(const N of e.nodes)N.type&&!x.includes(N.type)&&(_[N.type]=N.type);return _}),s=l.computed(()=>e.onlyRenderVisibleElements?Wo(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=l.computed(()=>{if(e.onlyRenderVisibleElements){const _=[];for(const x of e.edges){const N=t.value.get(x.source),p=t.value.get(x.target);Xs({sourcePos:N.computedPosition||{x:0,y:0},targetPos:p.computedPosition||{x:0,y:0},sourceWidth:N.dimensions.width,sourceHeight:N.dimensions.height,targetWidth:p.dimensions.width,targetHeight:p.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&_.push(x)}return _}return e.edges}),c=l.computed(()=>[...s.value,...u.value]),d=l.computed(()=>{const _=[];for(const x of e.nodes)x.selected&&_.push(x);return _}),h=l.computed(()=>{const _=[];for(const x of e.edges)x.selected&&_.push(x);return _}),g=l.computed(()=>[...d.value,...h.value]),m=l.computed(()=>{const _=[];for(const x of e.nodes)x.dimensions.width&&x.dimensions.height&&x.handleBounds!==void 0&&_.push(x);return _}),b=l.computed(()=>s.value.length>0&&m.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:c,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:s,getSelectedElements:g,getSelectedNodes:d,getSelectedEdges:h,getNodesInitialized:m,areNodesInitialized:b}}class He{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=l.getCurrentInstance())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??He.instance;return He.instance=o??new He,n&&(n.config.globalProperties.$vueFlowStorage=He.instance),He.instance}set(t,n){return this.flows.set(t,n)}get(t){return this.flows.get(t)}remove(t){return this.flows.delete(t)}create(t,n){const o=pi(),i=l.reactive(o),r={};for(const[g,m]of Object.entries(i.hooks)){const b=`on${g.charAt(0).toUpperCase()+g.slice(1)}`;r[b]=m.on}const a={};for(const[g,m]of Object.entries(i.hooks))a[g]=m.trigger;const s=l.computed(()=>{const g=new Map;for(const m of i.nodes)g.set(m.id,m);return g}),u=l.computed(()=>{const g=new Map;for(const m of i.edges)g.set(m.id,m);return g}),c=Cu(i,s,u),d=nu(i,s,u);d.setState({...i,...n});const h={...r,...c,...d,...Vi(i),emits:a,id:t,vueFlowVersion:"1.37.1",$destroy:()=>{this.remove(t)}};return this.set(t,h),h}getId(){return`vue-flow-${this.currentId++}`}}function de(e){const t=He.getInstance(),n=l.getCurrentScope(),o=typeof e=="object",i=o?e:{id:e},r=i.id,a=(n==null?void 0:n.vueFlowId)||r;let s;if(n){const u=l.inject(Bo,null);typeof u<"u"&&u!==null&&(s=u)}if(s||a&&(s=t.get(a)),!s||s&&r&&r!==s.id){const u=r??t.getId(),c=t.create(u,i);s=c,(n??l.effectScope(!0)).run(()=>{l.watch(c.applyDefault,(h,g,m)=>{const b=x=>{c.applyNodeChanges(x)},_=x=>{c.applyEdgeChanges(x)};h?(c.onNodesChange(b),c.onEdgesChange(_)):(c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(_)),m(()=>{c.hooks.value.nodesChange.off(b),c.hooks.value.edgesChange.off(_)})},{immediate:!0}),ct(()=>{if(s){const h=t.get(s.id);h?h.$destroy():Ot(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(l.provide(Bo,s),n.vueFlowId=s.id),o){const u=l.getCurrentInstance();(u==null?void 0:u.type.name)!=="VueFlow"&&s.emits.error(new ge(he.USEVUEFLOW_OPTIONS))}return s}function ku(e){const t=dn(),{emits:n,dimensions:o}=de();let i;l.onMounted(()=>{const r=e.value,a=()=>{if(!r)return;const s=Bt(r);(s.width===0||s.height===0)&&n.error(new ge(he.MISSING_VIEWPORT_DIMENSIONS)),o.value={width:s.width||500,height:s.height||500}};a(),t.addEventListener("resize",a),r&&(i=new ResizeObserver(()=>a()),i.observe(r)),l.onBeforeUnmount(()=>{t.removeEventListener("resize",a),i&&r&&i.unobserve(r)})})}const Mu={name:"UserSelection",compatConfig:{MODE:3}},Iu=l.defineComponent({...Mu,props:{userSelectionRect:{}},setup(e){return(t,n)=>(l.openBlock(),l.createElementBlock("div",{class:"vue-flow__selection vue-flow__container",style:l.normalizeStyle({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),$u=["tabIndex"],Tu={name:"NodesSelection",compatConfig:{MODE:3}},Pu=l.defineComponent({...Tu,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:a}=de(),s=zo(),u=l.ref(null),c=Po({el:u,onStart(b){t.selectionDragStart(b)},onDrag(b){t.selectionDrag(b)},onStop(b){t.selectionDragStop(b)}});l.onMounted(()=>{var b;r.value||(b=u.value)==null||b.focus({preventScroll:!0})});const d=l.computed(()=>Zo(o.value)),h=l.computed(()=>({width:`${d.value.width}px`,height:`${d.value.height}px`,top:`${d.value.y}px`,left:`${d.value.x}px`}));function g(b){t.selectionContextMenu({event:b,nodes:o.value})}function m(b){r||Ze[b.key]&&s({x:Ze[b.key].x,y:Ze[b.key].y},b.shiftKey)}return(b,_)=>!l.unref(a)&&d.value.width&&d.value.height?(l.openBlock(),l.createElementBlock("div",{key:0,class:l.normalizeClass(["vue-flow__nodesselection vue-flow__container",l.unref(i)]),style:l.normalizeStyle({transform:`translate(${l.unref(n).x}px,${l.unref(n).y}px) scale(${l.unref(n).zoom})`})},[l.createElementVNode("div",{ref_key:"el",ref:u,class:l.normalizeClass([{dragging:l.unref(c)},"vue-flow__nodesselection-rect"]),style:l.normalizeStyle(h.value),tabIndex:l.unref(r)?void 0:-1,onContextmenu:g,onKeydown:m},null,46,$u)],6)):l.createCommentVNode("",!0)}});function Si(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const Bu={name:"Pane",compatConfig:{MODE:3}},Du=l.defineComponent({...Bu,props:{isSelecting:{type:Boolean}},setup(e){const{vueFlowRef:t,getNodes:n,getEdges:o,viewport:i,emits:r,userSelectionActive:a,removeSelectedElements:s,panOnDrag:u,userSelectionRect:c,elementsSelectable:d,nodesSelectionActive:h,addSelectedElements:g,getSelectedEdges:m,getSelectedNodes:b,removeNodes:_,removeEdges:x,selectionMode:N,deleteKeyCode:p,multiSelectionKeyCode:C,multiSelectionActive:E}=de(),$=l.ref(null),A=l.ref(0),D=l.ref(0),U=l.ref(),Z=l.toRef(()=>d.value&&(e.isSelecting||a.value));st(p,M=>{if(!M)return;const B=[];for(const L of n.value)(!L.selected&&L.parentNode&&B.some(K=>K.id===L.parentNode)||L.selected)&&B.push(L);(B||m.value)&&(m.value.length>0&&x(m.value),B.length>0&&_(B),h.value=!1,s())},{actInsideInputWithModifier:!1}),st(C,M=>{E.value=M});function V(){a.value=!1,c.value=null,A.value=0,D.value=0}function S(M){M.target!==$.value||Z.value||(r.paneClick(M),s(),h.value=!1)}function j(M){var B;if(M.target===$.value){if(Array.isArray(u.value)&&((B=u.value)!=null&&B.includes(2))){M.preventDefault();return}r.paneContextMenu(M)}}function H(M){M.target===$.value&&r.paneScroll(M)}function v(M){if(U.value=t.value.getBoundingClientRect(),!Z.value||!d||!e.isSelecting||M.button!==0||M.target!==$.value||!U.value)return;const{x:B,y:L}=Si(M,U.value);s(),c.value={width:0,height:0,startX:B,startY:L,x:B,y:L},a.value=!0,r.selectionStart(M)}function P(M){if(!Z.value)return r.paneMouseMove(M);if(!e.isSelecting||!U.value||!c.value)return;a.value||(a.value=!0),h.value&&(h.value=!1);const B=Si(M,U.value),L=c.value.startX??0,K=c.value.startY??0,re={...c.value,x:B.x<L?B.x:L,y:B.y<K?B.y:K,width:Math.abs(B.x-L),height:Math.abs(B.y-K)},te=Wo(n.value,c.value,i.value,N.value===un.Partial),oe=yn(te,o.value);A.value=te.length,D.value=oe.length,c.value=re,g([...te,...oe])}function k(M){Z.value&&M.button===0&&(!a.value&&c.value&&M.target===$.value&&S(M),h.value=A.value>0,V(),r.selectionEnd(M))}function T(M){var B;if(!Z.value)return r.paneMouseLeave(M);a.value&&(h.value=A.value>0,(B=r.selectionEnd)==null||B.call(r,M)),V()}function z(M){Z.value||r.paneMouseEnter(M)}return(M,B)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"container",ref:$,class:l.normalizeClass(["vue-flow__pane vue-flow__container",{selection:M.isSelecting}]),onClick:S,onContextmenu:j,onWheelPassive:H,onMouseenter:z,onMousedown:v,onMousemove:P,onMouseup:k,onMouseleave:T},[l.renderSlot(M.$slots,"default"),l.unref(a)&&l.unref(c)?(l.openBlock(),l.createBlock(Iu,{key:0,"user-selection-rect":l.unref(c)},null,8,["user-selection-rect"])):l.createCommentVNode("",!0),l.unref(h)&&l.unref(b).length?(l.openBlock(),l.createBlock(Pu,{key:1})):l.createCommentVNode("",!0)],34))}}),Vu={name:"Transform",compatConfig:{MODE:3}},Ou=l.defineComponent({...Vu,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=de(),i=l.computed(()=>n.value?!o.value:!1),r=l.computed(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(a,s)=>(l.openBlock(),l.createElementBlock("div",{class:"vue-flow__transformationpane vue-flow__container",style:l.normalizeStyle({transform:r.value,opacity:i.value?0:void 0})},[l.renderSlot(a.$slots,"default")],4))}}),Au={name:"Viewport",compatConfig:{MODE:3}},zu=l.defineComponent({...Au,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:a,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:c,panOnScrollSpeed:d,panOnDrag:h,zoomOnDoubleClick:g,zoomOnPinch:m,zoomOnScroll:b,preventScrolling:_,noWheelClassName:x,noPanClassName:N,emits:p,connectionStartHandle:C,userSelectionActive:E,paneDragging:$,d3Zoom:A,d3Selection:D,d3ZoomHandler:U,viewport:Z,viewportRef:V}=de();ku(V);const S=l.ref(!1),j=l.ref(!1);let H=null,v=!1,P=0,k={x:0,y:0,zoom:0};const T=st(s),z=st(a),M=st(r),B=l.toRef(()=>T.value||h.value),L=l.toRef(()=>T.value||u.value),K=l.toRef(()=>z.value||a.value===!0&&B.value!==!0);l.onMounted(()=>{if(!V.value){Ot("Viewport element is missing");return}const q=V.value,W=q.getBoundingClientRect(),J=ms().scaleExtent([t.value,n.value]).translateExtent(i.value),Q=ye(q).call(J),ie=Q.on("wheel.zoom"),Y=Ue.translate(o.value.x??0,o.value.y??0).scale(Ae(o.value.zoom??1,t.value,n.value)),f=[[0,0],[W.width,W.height]],y=J.constrain()(Y,f,i.value);J.transform(Q,y),J.wheelDelta(te),A.value=J,D.value=Q,U.value=ie,Z.value={x:y.x,y:y.y,zoom:y.k},J.on("start",w=>{var I;if(!w.sourceEvent)return null;P=w.sourceEvent.button,S.value=!0;const O=ue(w.transform);((I=w.sourceEvent)==null?void 0:I.type)==="mousedown"&&($.value=!0),k=O,p.viewportChangeStart(O),p.moveStart({event:w,flowTransform:O})}),J.on("end",w=>{if(!w.sourceEvent)return null;if(S.value=!1,$.value=!1,re(B.value,P??0)&&!v&&p.paneContextMenu(w.sourceEvent),v=!1,oe(k,w.transform)){const I=ue(w.transform);k=I,p.viewportChangeEnd(I),p.moveEnd({event:w,flowTransform:I})}}),J.filter(w=>{var I,O,G;const X=M.value||b.value,ee=m.value&&w.ctrlKey,ne=w.button;if((B.value===!0||Array.isArray(B.value)&&B.value.includes(1))&&ne===1&&w.type==="mousedown"&&((I=w.target)!=null&&I.closest(".vue-flow__node")||(O=w.target)!=null&&O.closest(".vue-flow__edge")))return!0;if(!B.value&&!X&&!L.value&&!g.value&&!m.value||E.value||!g.value&&w.type==="dblclick"||le(w,x.value)&&w.type==="wheel"||le(w,N.value)&&(w.type!=="wheel"||L.value&&w.type==="wheel"&&!M.value)||!m.value&&w.ctrlKey&&w.type==="wheel"||!X&&!L.value&&!ee&&w.type==="wheel")return!1;if(!m&&w.type==="touchstart"&&((G=w.touches)==null?void 0:G.length)>1)return w.preventDefault(),!1;if(!B.value&&(w.type==="mousedown"||w.type==="touchstart")||Array.isArray(B.value)&&!B.value.includes(ne)&&(w.type==="mousedown"||w.type==="touchstart"))return!1;const ce=Array.isArray(B.value)&&B.value.includes(ne)||!ne||ne<=1;return(!w.ctrlKey||w.type==="wheel")&&ce}),l.watch([E,B],()=>{E.value&&!S.value?J.on("zoom",null):E.value||J.on("zoom",w=>{Z.value={x:w.transform.x,y:w.transform.y,zoom:w.transform.k};const I=ue(w.transform);v=re(B.value,P??0),p.viewportChange(I),p.move({event:w,flowTransform:I})})},{immediate:!0}),l.watch([E,L,c,M,m,_,x],()=>{L.value&&!M.value&&!E.value?Q.on("wheel.zoom",w=>{if(le(w,x.value))return!1;const I=M.value||b.value,O=m.value&&w.ctrlKey;if(!(!_.value||L.value||I||O))return!1;w.preventDefault(),w.stopImmediatePropagation();const X=Q.property("__zoom").k||1,ee=Vt();if(w.ctrlKey&&m.value&&ee){const $c=_e(w),Tc=te(w),Pc=X*2**Tc;J.scaleTo(Q,Pc,$c,w);return}const ne=w.deltaMode===1?20:1;let ce=c.value===at.Vertical?0:w.deltaX*ne,ae=c.value===at.Horizontal?0:w.deltaY*ne;!ee&&w.shiftKey&&c.value!==at.Vertical&&!ce&&ae&&(ce=ae,ae=0),J.translateBy(Q,-(ce/X)*d.value,-(ae/X)*d.value);const se=ue(Q.property("__zoom"));H&&clearTimeout(H),j.value?(p.move({event:w,flowTransform:se}),p.viewportChange(se),H=setTimeout(()=>{p.moveEnd({event:w,flowTransform:se}),p.viewportChangeEnd(se),j.value=!1},150)):(j.value=!0,p.moveStart({event:w,flowTransform:se}),p.viewportChangeStart(se))},{passive:!1}):typeof ie<"u"&&Q.on("wheel.zoom",function(w,I){const O=!_.value&&w.type==="wheel"&&!w.ctrlKey,G=M.value||b.value,X=m.value&&w.ctrlKey;if(!G&&!u.value&&!X&&w.type==="wheel"||O||le(w,x.value))return null;w.preventDefault(),ie.call(this,w,I)},{passive:!1})},{immediate:!0})});function re(q,W){return W===2&&Array.isArray(q)&&q.includes(2)}function te(q){const W=q.ctrlKey&&Vt()?10:1;return-q.deltaY*(q.deltaMode===1?.05:q.deltaMode?1:.002)*W}function oe(q,W){return q.x!==W.x&&!Number.isNaN(W.x)||q.y!==W.y&&!Number.isNaN(W.y)||q.zoom!==W.k&&!Number.isNaN(W.k)}function ue(q){return{x:q.x,y:q.y,zoom:q.k}}function le(q,W){return q.target.closest(`.${W}`)}return(q,W)=>(l.openBlock(),l.createElementBlock("div",{ref_key:"viewportRef",ref:V,class:"vue-flow__viewport vue-flow__container"},[l.createVNode(Du,{"is-selecting":K.value,class:l.normalizeClass({connecting:!!l.unref(C),dragging:l.unref($),draggable:B.value})},{default:l.withCtx(()=>[l.createVNode(Ou,null,{default:l.withCtx(()=>[l.renderSlot(q.$slots,"default")]),_:3})]),_:3},8,["is-selecting","class"])],512))}}),Ru=["id"],Hu=["id"],Lu=["id"],Fu={name:"A11yDescriptions",compatConfig:{MODE:3}},Yu=l.defineComponent({...Fu,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=de();return(i,r)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("div",{id:`${l.unref(Io)}-${l.unref(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+l.toDisplayString(l.unref(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,Ru),l.createElementVNode("div",{id:`${l.unref($o)}-${l.unref(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,Hu),l.unref(n)?l.createCommentVNode("",!0):(l.openBlock(),l.createElementBlock("div",{key:0,id:`${l.unref(_s)}-${l.unref(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},l.toDisplayString(l.unref(o)),9,Lu))],64))}});function Gu(){const e=de();l.watch(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function Xu(e,t,n){return n===F.Left?e-t:n===F.Right?e+t:e}function Uu(e,t,n){return n===F.Top?e-t:n===F.Bottom?e+t:e}const In=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=F.Top,type:i}){return l.h("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Xu(t,e,o),cy:Uu(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};In.props=["radius","centerX","centerY","position","type"],In.compatConfig={MODE:3};const Ni=In,Zu=l.defineComponent({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(e){const{id:t,addSelectedEdges:n,connectionMode:o,edgeUpdaterRadius:i,emits:r,nodesSelectionActive:a,noPanClassName:s,getEdgeTypes:u,removeSelectedEdges:c,findEdge:d,findNode:h,isValidConnection:g,multiSelectionActive:m,disableKeyboardA11y:b,elementsSelectable:_,edgesUpdatable:x,edgesFocusable:N}=de(),p=l.computed(()=>d(e.id)),C=Ss(p.value,r),E=l.inject(Tt),$=l.getCurrentInstance(),A=l.ref(!1),D=l.ref(!1),U=l.ref(""),Z=l.ref(null),V=l.ref("source"),S=l.ref(null),j=l.toRef(()=>typeof p.value.selectable>"u"?_.value:p.value.selectable),H=l.toRef(()=>typeof p.value.updatable>"u"?x.value:p.value.updatable),v=l.toRef(()=>typeof p.value.focusable>"u"?N.value:p.value.focusable);l.provide(bs,e.id),l.provide(Es,S);const P=l.computed(()=>p.value.class instanceof Function?p.value.class(p.value):p.value.class),k=l.computed(()=>p.value.style instanceof Function?p.value.style(p.value):p.value.style),T=l.computed(()=>{const Y=p.value.type||"default",f=E==null?void 0:E[`edge-${Y}`];if(f)return f;let y=p.value.template??u.value[Y];if(typeof y=="string"&&$){const w=Object.keys($.appContext.components);w&&w.includes(Y)&&(y=l.resolveComponent(Y,!1))}return y&&typeof y!="string"?y:(r.error(new ge(he.EDGE_TYPE_MISSING,y)),!1)}),{handlePointerDown:z}=Oo({nodeId:U,handleId:Z,type:V,isValidConnection:g,edgeUpdaterType:V,onEdgeUpdate:L,onEdgeUpdateEnd:K});return()=>{const Y=h(p.value.source),f=h(p.value.target),y="pathOptions"in p.value?p.value.pathOptions:{};if(!Y&&!f)return r.error(new ge(he.EDGE_SOURCE_TARGET_MISSING,p.value.id,p.value.source,p.value.target)),null;if(!Y)return r.error(new ge(he.EDGE_SOURCE_MISSING,p.value.id,p.value.source)),null;if(!f)return r.error(new ge(he.EDGE_TARGET_MISSING,p.value.id,p.value.target)),null;if(!p.value||p.value.hidden||Y.hidden||f.hidden)return null;let w;o.value===Oe.Strict?w=Y.handleBounds.source:w=[...Y.handleBounds.source||[],...Y.handleBounds.target||[]];const I=ri(w,p.value.sourceHandle);let O;o.value===Oe.Strict?O=f.handleBounds.target:O=[...f.handleBounds.target||[],...f.handleBounds.source||[]];const G=ri(O,p.value.targetHandle),X=I?I.position:F.Bottom,ee=G?G.position:F.Top,{sourceX:ne,sourceY:ce,targetY:ae,targetX:se}=Gs(Y,I,X,f,G,ee);return p.value.sourceX=ne,p.value.sourceY=ce,p.value.targetX=se,p.value.targetY=ae,l.h("g",{ref:S,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${T.value===!1?"default":p.value.type||"default"}`,s.value,P.value,{updating:A.value,selected:p.value.selected,animated:p.value.animated,inactive:!j.value}],onClick:te,onContextmenu:oe,onDblclick:ue,onMouseenter:le,onMousemove:q,onMouseleave:W,onKeyDown:v.value?ie:void 0,tabIndex:v.value?0:void 0,"aria-label":p.value.ariaLabel===null?void 0:p.value.ariaLabel||`Edge from ${p.value.source} to ${p.value.target}`,"aria-describedby":v.value?`${$o}-${t}`:void 0,role:v.value?"button":"img"},[D.value?null:l.h(T.value===!1?u.value.default:T.value,{id:e.id,sourceNode:Y,targetNode:f,source:p.value.source,target:p.value.target,type:p.value.type,updatable:H.value,selected:p.value.selected,animated:p.value.animated,label:p.value.label,labelStyle:p.value.labelStyle,labelShowBg:p.value.labelShowBg,labelBgStyle:p.value.labelBgStyle,labelBgPadding:p.value.labelBgPadding,labelBgBorderRadius:p.value.labelBgBorderRadius,data:p.value.data,events:{...p.value.events,...C.on},style:k.value,markerStart:`url('#${ut(p.value.markerStart,t)}')`,markerEnd:`url('#${ut(p.value.markerEnd,t)}')`,sourcePosition:X,targetPosition:ee,sourceX:ne,sourceY:ce,targetX:se,targetY:ae,sourceHandleId:p.value.sourceHandle,targetHandleId:p.value.targetHandle,interactionWidth:p.value.interactionWidth,...y}),[H.value==="source"||H.value===!0?[l.h("g",{onMousedown:J,onMouseenter:M,onMouseout:B},l.h(Ni,{position:X,centerX:ne,centerY:ce,radius:i.value,type:"source","data-type":"source"}))]:null,H.value==="target"||H.value===!0?[l.h("g",{onMousedown:Q,onMouseenter:M,onMouseout:B},l.h(Ni,{position:ee,centerX:se,centerY:ae,radius:i.value,type:"target","data-type":"target"}))]:null]])};function M(){A.value=!0}function B(){A.value=!1}function L(Y,f){C.emit.update({event:Y,edge:p.value,connection:f})}function K(Y){C.emit.updateEnd({event:Y,edge:p.value}),D.value=!1}function re(Y,f){Y.button===0&&(D.value=!0,U.value=f?p.value.target:p.value.source,Z.value=(f?p.value.targetHandle:p.value.sourceHandle)??"",V.value=f?"target":"source",C.emit.updateStart({event:Y,edge:p.value}),z(Y))}function te(Y){var f;const y={event:Y,edge:p.value};j.value&&(a.value=!1,p.value.selected&&m.value?(c([p.value]),(f=S.value)==null||f.blur()):n([p.value])),C.emit.click(y)}function oe(Y){C.emit.contextMenu({event:Y,edge:p.value})}function ue(Y){C.emit.doubleClick({event:Y,edge:p.value})}function le(Y){C.emit.mouseEnter({event:Y,edge:p.value})}function q(Y){C.emit.mouseMove({event:Y,edge:p.value})}function W(Y){C.emit.mouseLeave({event:Y,edge:p.value})}function J(Y){re(Y,!0)}function Q(Y){re(Y,!1)}function ie(Y){var f;!b.value&&To.includes(Y.key)&&j.value&&(Y.key==="Escape"?((f=S.value)==null||f.blur(),c([d(e.id)])):n([d(e.id)]))}}}),Wu={[F.Left]:F.Right,[F.Right]:F.Left,[F.Top]:F.Bottom,[F.Bottom]:F.Top},Ku=l.defineComponent({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var e;const{id:t,connectionMode:n,connectionStartHandle:o,connectionEndHandle:i,connectionPosition:r,connectionLineType:a,connectionLineStyle:s,connectionLineOptions:u,connectionStatus:c,viewport:d,findNode:h}=de(),g=(e=l.inject(Tt))==null?void 0:e["connection-line"],m=l.computed(()=>{var p;return h((p=o.value)==null?void 0:p.nodeId)}),b=l.computed(()=>{var p;return h((p=i.value)==null?void 0:p.nodeId)??null}),_=l.computed(()=>({x:(r.value.x-d.value.x)/d.value.zoom,y:(r.value.y-d.value.y)/d.value.zoom})),x=l.computed(()=>u.value.markerStart?`url(#${ut(u.value.markerStart,t)})`:""),N=l.computed(()=>u.value.markerEnd?`url(#${ut(u.value.markerEnd,t)})`:"");return()=>{var p,C,E;if(!m.value||!o.value)return null;const $=o.value.handleId,A=o.value.type,D=m.value.handleBounds;let U=D==null?void 0:D[A];if(n.value===Oe.Loose&&(U=U||(D==null?void 0:D[A==="source"?"target":"source"])),!U)return null;const Z=($?U.find(z=>z.id===$):U[0])??null,V=(Z==null?void 0:Z.position)||F.Top,{x:S,y:j}=En(V,{...m.value.dimensions,...m.value.computedPosition},Z);let H=null;b.value&&((p=i.value)!=null&&p.handleId)&&(n.value===Oe.Strict?H=((C=b.value.handleBounds[A==="source"?"target":"source"])==null?void 0:C.find(z=>{var M;return z.id===((M=i.value)==null?void 0:M.handleId)}))||null:H=((E=[...b.value.handleBounds.source||[],...b.value.handleBounds.target||[]])==null?void 0:E.find(z=>{var M;return z.id===((M=i.value)==null?void 0:M.handleId)}))||null);const v=V?Wu[V]:null;if(!V||!v)return null;const P=a.value??u.value.type??Ve.Bezier;let k="";const T={sourceX:S,sourceY:j,sourcePosition:V,targetX:_.value.x,targetY:_.value.y,targetPosition:v};return P===Ve.Bezier?[k]=kn(T):P===Ve.Step?[k]=Mn({...T,borderRadius:0}):P===Ve.SmoothStep?[k]=Mn(T):P===Ve.SimpleBezier?[k]=_i(T):k=`M${S},${j} ${_.value.x},${_.value.y}`,l.h("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},l.h("g",{class:"vue-flow__connection"},g?l.h(g,{sourceX:S,sourceY:j,sourcePosition:V,targetX:_.value.x,targetY:_.value.y,targetPosition:v,sourceNode:m.value,sourceHandle:Z,targetNode:b.value,targetHandle:H,markerEnd:N.value,markerStart:x.value,connectionStatus:c.value}):l.h("path",{d:k,class:[u.value.class,c,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":N.value,"marker-start":x.value})))}}}),qu=["id","markerWidth","markerHeight","markerUnits","orient"],Ju={name:"MarkerType",compatConfig:{MODE:3}},ju=l.defineComponent({...Ju,props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup(e){return(t,n)=>(l.openBlock(),l.createElementBlock("marker",{id:t.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${t.width}`,markerHeight:`${t.height}`,markerUnits:t.markerUnits,orient:t.orient},[t.type===l.unref(cn).ArrowClosed?(l.openBlock(),l.createElementBlock("polyline",{key:0,style:l.normalizeStyle({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):l.createCommentVNode("",!0),t.type===l.unref(cn).Arrow?(l.openBlock(),l.createElementBlock("polyline",{key:1,style:l.normalizeStyle({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):l.createCommentVNode("",!0)],8,qu))}}),Qu={class:"vue-flow__marker vue-flow__container"},ec={name:"MarkerDefinitions",compatConfig:{MODE:3}},tc=l.defineComponent({...ec,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=de(),r=l.computed(()=>{const a=new Set,s=[],u=c=>{if(c){const d=ut(c,t);a.has(d)||(typeof c=="object"?s.push({...c,id:d,color:c.color||i.value}):s.push({id:d,color:i.value,type:c}),a.add(d))}};for(const c of[o.value.markerEnd,o.value.markerStart])u(c);for(const c of n.value)for(const d of[c.markerStart,c.markerEnd])u(d);return s.sort((c,d)=>c.id.localeCompare(d.id))});return(a,s)=>(l.openBlock(),l.createElementBlock("svg",Qu,[l.createElementVNode("defs",null,[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(r.value,u=>(l.openBlock(),l.createBlock(ju,{id:u.id,key:u.id,type:u.type,color:u.color,width:u.width,height:u.height,markerUnits:u.markerUnits,"stroke-width":u.strokeWidth,orient:u.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),nc={name:"Edges",compatConfig:{MODE:3}},oc=l.defineComponent({...nc,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=de();return(i,r)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createVNode(tc),(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n),(a,s,u,c)=>{const d=[a.id];if(c&&c.key===a.id&&l.isMemoSame(c,d))return c;const h=(l.openBlock(),l.createElementBlock("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:l.normalizeStyle({zIndex:l.unref(Us)(a,l.unref(t),l.unref(o))})},[l.createVNode(l.unref(Zu),{id:a.id},null,8,["id"])],4));return h.memo=d,h},r,0),128)),l.createVNode(l.unref(Ku))],64))}}),ic=l.defineComponent({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(e){const{id:t,noPanClassName:n,selectNodesOnDrag:o,nodesSelectionActive:i,multiSelectionActive:r,emits:a,removeSelectedNodes:s,addSelectedNodes:u,updateNodeDimensions:c,onUpdateNodeInternals:d,getNodeTypes:h,nodeExtent:g,elevateNodesOnSelect:m,disableKeyboardA11y:b,ariaLiveMessage:_,snapToGrid:x,snapGrid:N,nodeDragThreshold:p,nodesDraggable:C,elementsSelectable:E,nodesConnectable:$,nodesFocusable:A}=de(),D=l.ref(null);l.provide(Vo,D),l.provide(Do,e.id);const U=l.inject(Tt),Z=l.getCurrentInstance(),V=zo(),{node:S,parentNode:j}=Ao(e.id),H=l.toRef(()=>typeof S.draggable>"u"?C.value:S.draggable),v=l.toRef(()=>typeof S.selectable>"u"?E.value:S.selectable),P=l.toRef(()=>typeof S.connectable>"u"?$.value:S.connectable),k=l.toRef(()=>typeof S.focusable>"u"?A.value:S.focusable),T=l.toRef(()=>!!S.dimensions.width&&!!S.dimensions.height),z=l.computed(()=>{const f=S.type||"default",y=U==null?void 0:U[`node-${f}`];if(y)return y;let w=S.template||h.value[f];if(typeof w=="string"&&Z){const I=Object.keys(Z.appContext.components);I&&I.includes(f)&&(w=l.resolveComponent(f,!1))}return w&&typeof w!="string"?w:(a.error(new ge(he.NODE_TYPE_MISSING,w)),!1)}),{emit:M,on:B}=Ms(S,a),L=Po({id:e.id,el:D,disabled:()=>!H.value,selectable:v,dragHandle:()=>S.dragHandle,onStart(f){M.dragStart(f)},onDrag(f){M.drag(f)},onStop(f){M.dragStop(f)}}),K=l.computed(()=>S.class instanceof Function?S.class(S):S.class),re=l.computed(()=>{const f=(S.style instanceof Function?S.style(S):S.style)||{},y=S.width instanceof Function?S.width(S):S.width,w=S.height instanceof Function?S.height(S):S.height;return y&&(f.width=typeof y=="string"?y:`${y}px`),w&&(f.height=typeof w=="string"?w:`${w}px`),f}),te=l.toRef(()=>Number(S.zIndex??re.value.zIndex??0));return d(f=>{(f.includes(e.id)||!f.length)&&ue()}),l.onMounted(()=>{l.watch(()=>S.hidden,(f=!1,y,w)=>{!f&&D.value&&(e.resizeObserver.observe(D.value),w(()=>{D.value&&e.resizeObserver.unobserve(D.value)}))},{immediate:!0,flush:"pre"})}),l.watch([()=>S.type,()=>S.sourcePosition,()=>S.targetPosition],()=>{l.nextTick(()=>{c([{id:e.id,nodeElement:D.value,forceUpdate:!0}])})}),l.watch([()=>S.position.x,()=>S.position.y,()=>{var f;return(f=j.value)==null?void 0:f.computedPosition.x},()=>{var f;return(f=j.value)==null?void 0:f.computedPosition.y},()=>{var f;return(f=j.value)==null?void 0:f.computedPosition.z},te,()=>S.selected,()=>S.dimensions.height,()=>S.dimensions.width,()=>{var f;return(f=j.value)==null?void 0:f.dimensions.height},()=>{var f;return(f=j.value)==null?void 0:f.dimensions.width}],([f,y,w,I,O,G])=>{const X={x:f,y,z:G+(m.value&&S.selected?1e3:0)};typeof w<"u"&&typeof I<"u"?S.computedPosition=Rs({x:w,y:I,z:O},X):S.computedPosition=X},{flush:"post",immediate:!0}),l.watch([()=>S.extent,g],([f,y],[w,I])=>{(f!==w||y!==I)&&oe()}),S.extent==="parent"||typeof S.extent=="object"&&"range"in S.extent&&S.extent.range==="parent"?dt(()=>T).toBe(!0).then(oe):oe(),()=>S.hidden?null:l.h("div",{ref:D,"data-id":S.id,class:["vue-flow__node",`vue-flow__node-${z.value===!1?"default":S.type||"default"}`,{[n.value]:H.value,dragging:L==null?void 0:L.value,draggable:H.value,selected:S.selected,selectable:v.value,parent:S.isParent},K.value],style:{visibility:T.value?"visible":"hidden",zIndex:S.computedPosition.z??te.value,transform:`translate(${S.computedPosition.x}px,${S.computedPosition.y}px)`,pointerEvents:v.value||H.value?"all":"none",...re.value},tabIndex:k.value?0:void 0,role:k.value?"button":void 0,"aria-describedby":b.value?void 0:`${Io}-${t}`,"aria-label":S.ariaLabel,onMouseenter:le,onMousemove:q,onMouseleave:W,onContextmenu:J,onClick:ie,onDblclick:Q,onKeydown:Y},[l.h(z.value===!1?h.value.default:z.value,{id:S.id,type:S.type,data:S.data,events:{...S.events,...B},selected:S.selected,resizing:S.resizing,dragging:L.value,connectable:P.value,position:S.computedPosition,dimensions:S.dimensions,isValidTargetPos:S.isValidTargetPos,isValidSourcePos:S.isValidSourcePos,parent:S.parentNode,parentNodeId:S.parentNode,zIndex:S.computedPosition.z??te.value,targetPosition:S.targetPosition,sourcePosition:S.sourcePosition,label:S.label,dragHandle:S.dragHandle,onUpdateNodeInternals:ue})]);function oe(){const f=S.computedPosition;x.value&&(f.x=N.value[0]*Math.round(f.x/N.value[0]),f.y=N.value[1]*Math.round(f.y/N.value[1]));const{computedPosition:y,position:w}=bn(S,f,a.error,g.value,j.value);(S.computedPosition.x!==y.x||S.computedPosition.y!==y.y)&&(S.computedPosition={...S.computedPosition,...y}),(S.position.x!==w.x||S.position.y!==w.y)&&(S.position=w)}function ue(){D.value&&c([{id:e.id,nodeElement:D.value,forceUpdate:!0}])}function le(f){L!=null&&L.value||M.mouseEnter({event:f,node:S})}function q(f){L!=null&&L.value||M.mouseMove({event:f,node:S})}function W(f){L!=null&&L.value||M.mouseLeave({event:f,node:S})}function J(f){return M.contextMenu({event:f,node:S})}function Q(f){return M.doubleClick({event:f,node:S})}function ie(f){v.value&&(!o.value||!H.value||p.value>0)&&Cn(S,r.value,u,s,i,!1,D.value),M.click({event:f,node:S})}function Y(f){if(!(fn(f)||b.value))if(To.includes(f.key)&&v.value){const y=f.key==="Escape";Cn(S,r.value,u,s,i,y,D.value)}else H.value&&S.selected&&Ze[f.key]&&(_.value=`Moved selected node ${f.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~S.position.x}, y: ${~~S.position.y}`,V({x:Ze[f.key].x,y:Ze[f.key].y},f.shiftKey))}}}),rc={height:"0",width:"0"},lc={name:"EdgeLabelRenderer",compatConfig:{MODE:3}},ac=l.defineComponent({...lc,setup(e){const{viewportRef:t}=de(),n=l.toRef(()=>{var o;return(o=t.value)==null?void 0:o.getElementsByClassName("vue-flow__edge-labels")[0]});return(o,i)=>(l.openBlock(),l.createElementBlock("svg",null,[(l.openBlock(),l.createElementBlock("foreignObject",rc,[(l.openBlock(),l.createBlock(l.Teleport,{to:n.value,disabled:!n.value},[l.renderSlot(o.$slots,"default")],8,["to","disabled"]))]))]))}});function sc(e={includeHiddenNodes:!1}){const{nodes:t}=de();return l.computed(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&((n==null?void 0:n.handleBounds)===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const uc={class:"vue-flow__nodes vue-flow__container"},cc={name:"Nodes",compatConfig:{MODE:3}},dc=l.defineComponent({...cc,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=de(),i=sc(),r=l.ref();return l.watch(i,a=>{a&&l.nextTick(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),l.onMounted(()=>{r.value=new ResizeObserver(a=>{const s=a.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));l.nextTick(()=>n(s))})}),l.onBeforeUnmount(()=>{var a;return(a=r.value)==null?void 0:a.disconnect()}),(a,s)=>(l.openBlock(),l.createElementBlock("div",uc,[r.value?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(t),(u,c,d,h)=>{const g=[u.id];if(h&&h.key===u.id&&l.isMemoSame(h,g))return h;const m=(l.openBlock(),l.createBlock(l.unref(ic),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return m.memo=g,m},s,0),128)):l.createCommentVNode("",!0)]))}});function fc(){const{emits:e}=de();l.onMounted(()=>{if(ci()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new ge(he.MISSING_STYLES))}})}const hc=l.createElementVNode("div",{class:"vue-flow__edge-labels"},null,-1),gc={name:"VueFlow",compatConfig:{MODE:3}},pc=l.defineComponent({...gc,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0}},emits:["nodesChange","edgesChange","nodesInitialized","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneReady","init","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","updateNodeInternals","error","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdate","edgeUpdateEnd","nodeDoubleClick","nodeClick","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeContextMenu","nodeDragStart","nodeDrag","nodeDragStop","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=l.useSlots(),r=Yt(o,"modelValue",n),a=Yt(o,"nodes",n),s=Yt(o,"edges",n),u=de(o),c=Ts({modelValue:r,nodes:a,edges:s},o,u);return eu(n,u.hooks),Gu(),fc(),l.provide(Tt,i),l.onUnmounted(()=>{c()}),t(u),(d,h)=>(l.openBlock(),l.createElementBlock("div",{ref:l.unref(u).vueFlowRef,class:"vue-flow"},[l.createVNode(zu,null,{default:l.withCtx(()=>[l.createVNode(oc),hc,l.createVNode(dc),l.renderSlot(d.$slots,"zoom-pane")]),_:3}),l.renderSlot(d.$slots,"default"),l.createVNode(Yu)],512))}}),mc=["id","d","marker-end"],yc={class:"vue-flow__edge-label"},vc={key:0,class:"label-input-wrapper"},wc={inheritAttrs:!1},_c=l.defineComponent({...wc,__name:"EditableEdge",props:{id:{},sourceNode:{},targetNode:{},source:{},target:{},type:{},label:{},style:{},selected:{type:Boolean},sourcePosition:{},targetPosition:{},sourceHandleId:{},targetHandleId:{},animated:{type:Boolean},updatable:{type:Boolean},markerStart:{},markerEnd:{},curvature:{},interactionWidth:{},data:{},events:{},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{},sourceX:{},sourceY:{},targetX:{},targetY:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=l.ref(),r=l.ref(""),a=l.ref(!1);let s=0;const u=async()=>{let g=Date.now();g-s<500&&!a.value&&await c(),s=g},c=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},d=()=>{a.value=!1,o("change",r.value)},h=l.computed(()=>kn(n));return(g,m)=>(l.openBlock(),l.createElementBlock(l.Fragment,null,[l.createElementVNode("path",{id:g.id,style:l.normalizeStyle(g.style),class:"vue-flow__edge-path",d:h.value[0],"marker-end":g.markerEnd},null,12,mc),l.createVNode(l.unref(ac),null,{default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({pointerEvents:"all",position:"absolute",transform:`translate(-50%, -50%) translate(${h.value[1]}px,${h.value[2]}px)`}),class:"nodrag nopan editable-edge-label",onClick:m[2]||(m[2]=b=>u())},[l.createElementVNode("div",yc,l.toDisplayString(n.label),1),a.value?(l.openBlock(),l.createElementBlock("div",vc,[l.withDirectives(l.createElementVNode("input",{ref_key:"labelInput",ref:i,class:"label-input","onUpdate:modelValue":m[0]||(m[0]=b=>r.value=b),onBlur:m[1]||(m[1]=b=>a.value=!1),onKeypress:l.withKeys(d,["enter"])},null,544),[[l.vModelText,r.value]])])):l.createCommentVNode("",!0)],4)]),_:1})],64))}}),bc={key:0,class:"label-input-wrapper"},Ec=l.defineComponent({__name:"EditableNode",props:{id:{},type:{},selected:{type:Boolean},connectable:{type:[Boolean,Number,String,Function]},position:{},dimensions:{},label:{},isValidTargetPos:{type:Function},isValidSourcePos:{type:Function},parent:{},parentNodeId:{},dragging:{type:Boolean},resizing:{type:Boolean},zIndex:{},targetPosition:{},sourcePosition:{},dragHandle:{},data:{},events:{}},emits:["change"],setup(e,{emit:t}){const n=e,o=t,i=l.ref(),r=l.ref(""),a=l.ref(!1);let s=0;const u=async()=>{let h=Date.now();h-s<500&&!a.value&&await c(),s=h},c=async()=>{r.value=n.label,a.value=!0,await l.nextTick(),i.value.focus()},d=()=>{a.value=!1,o("change",r.value)};return(h,g)=>(l.openBlock(),l.createElementBlock("div",{onClick:g[2]||(g[2]=m=>u())},[l.createElementVNode("div",null,l.toDisplayString(n.label),1),a.value?(l.openBlock(),l.createElementBlock("div",bc,[l.withDirectives(l.createElementVNode("input",{ref_key:"labelInput",ref:i,class:"label-input","onUpdate:modelValue":g[0]||(g[0]=m=>r.value=m),onBlur:g[1]||(g[1]=m=>a.value=!1),onKeypress:l.withKeys(d,["enter"])},null,544),[[l.vModelText,r.value]])])):l.createCommentVNode("",!0),n.data.hasInput?(l.openBlock(),l.createBlock(l.unref(Ke),{key:1,id:"a",type:"target",position:n.targetPosition},null,8,["position"])):l.createCommentVNode("",!0),n.data.hasOutput?(l.openBlock(),l.createBlock(l.unref(Ke),{key:2,id:"b",type:"source",position:n.sourcePosition},null,8,["position"])):l.createCommentVNode("",!0)]))}}),xc={class:"chart-controls"},Sc={class:"chart-controls-left"},Nc=l.createElementVNode("b",null,"Selected Node:",-1),Cc={class:"chart-controls-right"},kc={key:0},Mc={key:1},$n=l.defineComponent({__name:"NodeEditor",props:{modelValue:{},nodeContainerClass:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,i=l.ref(!1),r=l.ref([]),a=l.ref(),s=l.ref(""),u=l.computed(()=>(r.value.forEach((C,E)=>{if(C.id===s.value)return E}),-1)),c=l.computed({get:()=>{const C=n.modelValue;for(const E of C)E.data={},E.type==="input"?(E.data.hasInput=!1,E.data.hasOutput=!0):E.type==="output"?(E.data.hasInput=!0,E.data.hasOutput=!1):(E.data.hasInput=!0,E.data.hasOutput=!0),E.class="vue-flow__node-default",E.type="editable";for(const E of C)E.events={click:()=>{s.value=E.id}};return C},set:C=>{o("update:modelValue",JSON.parse(JSON.stringify(C)))}});l.onMounted(()=>{document.removeEventListener("keypress",_),document.addEventListener("keypress",_)}),l.onBeforeUnmount(()=>{document.removeEventListener("keypress",_)});const{onPaneReady:d}=de();d(C=>{a.value=C}),r.value=c.value;const h=C=>({[F.Top]:F.Right,[F.Right]:F.Bottom,[F.Bottom]:F.Left,[F.Left]:F.Top})[C],g=()=>{if(u.value>-1){const C=r.value[u.value];C.sourcePosition=h(C.sourcePosition)}},m=()=>{if(u.value>-1){const C=r.value[u.value];C.targetPosition=h(C.targetPosition)}},b=C=>{window.scrollBy(0,C.deltaY)},_=C=>{i.value&&C.ctrlKey==!0&&((C.key=="+"||C.key=="=")&&a.value.zoomIn(),C.key=="-"&&a.value.zoomOut())},x=async()=>{await a.value.fitView()},N=()=>{let C=!1,E={x:Math.random()*200,y:Math.random()*200};if(u.value>-1){const D=r.value[u.value];D.data.hasOutput&&(E={x:D.position.x+200,y:D.position.y+50},C=!0)}const $=r.value.length,A=`node-${$}`;if(r.value.push({id:A,label:"Node "+$,sourcePosition:F.Right,targetPosition:F.Left,class:"vue-flow__node-default",type:"editable",data:{hasInput:!0,hasOutput:!0},events:{click:()=>{s.value=A}},position:E}),C){let D=`edge-${$+1}`;r.value.push({id:D,source:s.value,target:A,type:"editable",label:`EDGE ${$+1}`,animated:!0,events:{click:()=>{s.value=D}}})}},p=(C,E)=>{for(let $=0;$<r.value.length;$++)if(r.value[$].id==E){r.value[$].label=C;break}};return(C,E)=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(["node-editor-wrapper",C.nodeContainerClass]),onMouseover:E[1]||(E[1]=$=>i.value=!0),onMouseleave:E[2]||(E[2]=$=>i.value=!1)},[l.createElementVNode("div",xc,[l.createElementVNode("div",Sc,[l.createElementVNode("div",null,[Nc,l.createTextVNode(" "+l.toDisplayString(s.value?s.value:"none"),1)])]),l.createElementVNode("div",Cc,[l.createElementVNode("div",null,[l.createElementVNode("button",{class:"button-default",onClick:N},"Add Node")]),l.createElementVNode("div",null,[l.createElementVNode("button",{class:"button-default",onClick:x},"Center")]),u.value>-1?(l.openBlock(),l.createElementBlock("div",kc,[l.createElementVNode("button",{class:"button-default",onClick:m},"Shift Input Position")])):l.createCommentVNode("",!0),u.value>-1?(l.openBlock(),l.createElementBlock("div",Mc,[l.createElementVNode("button",{class:"button-default",onClick:g},"Shift Output Position")])):l.createCommentVNode("",!0)])]),r.value&&r.value.length?(l.openBlock(),l.createBlock(l.unref(pc),{key:0,class:"nowheel","prevent-scrolling":!0,"zoom-on-scroll":!1,"fit-view-on-init":!0,modelValue:r.value,"onUpdate:modelValue":E[0]||(E[0]=$=>r.value=$),onWheel:l.withModifiers(b,["prevent"])},{"node-editable":l.withCtx($=>[l.createVNode(Ec,l.mergeProps($,{onChange:A=>p(A,$.id)}),null,16,["onChange"])]),"edge-editable":l.withCtx($=>[l.createVNode(_c,l.mergeProps($,{onChange:A=>p(A,$.id)}),null,16,["onChange"])]),_:1},8,["modelValue"])):l.createCommentVNode("",!0)],34))}}),Ci=l.defineComponent({__name:"StateEditor",props:l.mergeModels({layout:{},nodeContainerClass:{}},{modelValue:{},modelModifiers:{}}),emits:l.mergeModels(["update:modelValue"],["update:modelValue"]),setup(e,{emit:t}){const n=l.useModel(e,"modelValue"),o=e,i=t,r=l.computed({get:()=>{var h,g,m;const s={},u=[],c={};let d=0;for(const[b,_]of Object.entries(n.value)){const x={id:b,label:b,position:((h=o.layout[b])==null?void 0:h.position)||{x:200*d,y:100},targetPosition:((g=o.layout[b])==null?void 0:g.targetPosition)||F.Left,sourcePosition:((m=o.layout[b])==null?void 0:m.sourcePosition)||F.Right};if(_.type==="final"&&(x.type="output",x.class="default-output-node"),c[b]=x,_.on){for(const[N,p]of Object.entries(_.on))if(Array.isArray(p))for(const C of p){const $=C.toJSON().target.toString();u.push({id:`${b}-${N}`,target:$,source:b,label:N,animated:!0}),s[$]=!0}}d++}for(const[b,_]of Object.entries(c))s[b]||(_.type="input",_.class="default-input-node"),u.push(_);return u},set:s=>{a(s)}}),a=s=>{const u={},c={},d={};for(const h of s){const g=h.label;h.type==="input"?d[g]={on:{}}:h.type==="output"?d[g]={type:"final"}:d[g]={on:{}},c[h.id]=g}for(const[h,g]of Object.entries(u)){const m=c[h];for(const[b,_]of Object.entries(g))d[m].on[b]=_}i("update:modelValue",d)};return(s,u)=>(l.openBlock(),l.createElementBlock("div",null,[l.createVNode($n,{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=c=>r.value=c),"node-container-class":s.nodeContainerClass},null,8,["modelValue","node-container-class"])]))}});function Ic(e){e.component("NodeEditor",$n),e.component("StateEditor",Ci)}xe.NodeEditor=$n,xe.StateEditor=Ci,xe.install=Ic,Object.defineProperty(xe,Symbol.toStringTag,{value:"Module"})});
21
22
  //# sourceMappingURL=node-editor.umd.cjs.map