import{d as le,aj as Mi,z as Ce,k as K,e as ce,o as Xe,b as Ti,X as Z,a6 as ae,P as qe,u as x,a7 as Pt,c as Bt,S as Di,w as we,p as Mt,g as on,ah as ea,f as C,Z as R,M as Ai,N as vn,q as je,D as ta,r as na,a9 as re,_ as ke,aa as Te,F as He,a2 as Mn,a8 as Qe,x as Tn,ak as oa,Y as ge,G as No,H as ia,al as ra,am as ye,ac as Wt,n as xe,U as Ae,R as aa,K as sa,a1 as la,E as Q,$ as ua,s as ko,an as ca}from"./vue-bbe2430e.js";import{b3 as Re,b4 as Rt,b5 as De,M as Fe,U as Se,b6 as zi,s as Tt,L as Oi,aI as da,aH as vt,a0 as ut,aV as Le,G as Ye,V as fa,b7 as Ct,b8 as st,c as Ht,a8 as Dt,b9 as _n,a6 as Io,ba as Yt,e as ze,bb as Zn,a_ as ro,bc as Oe,a3 as Bi,bd as Ri,be as Fi,aZ as Lo,bf as ha,bg as pa,bh as va,aY as Li,bi as ga,aG as ma,aa as ya,ab as wa,u as _a}from"./radical-e232c97c.js";import{g as ao}from"./utils-b9cc3945.js";import{u as nt,c as so,g as xa,d as ba,e as Sa,r as Ea,b as Ca,a as Na}from"./global-4ea86c7d.js";import{g as ka,a as Ia}from"./logrotate-abb47571.js";import{S as $a}from"./state-9b5090be.js";import{s as Pa}from"./schema-05c573c2.js";import{s as Ma}from"./tree-title-f41e6561.js";import{M as Ta,Y as Da}from"./index-d5466eaf.js";import{u as Dn}from"./system-33441fb9.js";import{g as Aa,a as za}from"./schema-eeecb4c0.js";import{d as Oa,u as Ba}from"./pullOnStart-11b18a32.js";import{m as Ra,o as xt,p as Fa,j as La}from"./index-f7554cb7.js";import{V as Va}from"./jb4-b4fce361.js";import{u as Ha}from"./useAddPushForm-60e6de8d.js";import{d as Ya,g as Vi,a as xn}from"./mp4-97e8dba1.js";import{V as Ga}from"./VideoPlayer-2caf11ba.js";import"./monaco-956d6172.js";import"./canvas-220fadcb.js";function An(e){return Ai()?(vn(e),!0):!1}function ot(e){return typeof e=="function"?e():x(e)}const Ua=typeof window<"u"&&typeof document<"u",Xa=e=>typeof e<"u",Wa=Object.prototype.toString,Za=e=>Wa.call(e)==="[object Object]",Ka=()=>{};function qa(e,t){function n(...o){return new Promise((i,r)=>{Promise.resolve(e(()=>t.apply(this,o),{fn:t,thisArg:this,args:o})).then(i).catch(r)})}return n}const Hi=e=>e();function ja(e=Hi){const t=K(!0);function n(){t.value=!1}function o(){t.value=!0}const i=(...r)=>{t.value&&e(...r)};return{isActive:aa(t),pause:n,resume:o,eventFilter:i}}function Vo(e,t=!1,n="Timeout"){return new Promise((o,i)=>{setTimeout(t?()=>i(n):o,e)})}function Ja(e,t,n={}){const{eventFilter:o=Hi,...i}=n;return we(e,qa(o,t),i)}function Nt(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:a,resume:s,isActive:u}=ja(o);return{stop:Ja(e,t,{...i,eventFilter:r}),pause:a,resume:s,isActive:u}}function Qa(e,t={}){if(!No(e))return ia(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=ra(()=>({get(){return e.value[o]},set(i){var r;if((r=ot(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 lo(e,t=!1){function n(d,{flush:f="sync",deep:_=!1,timeout:y,throwOnTimeout:g}={}){let v=null;const m=[new Promise(h=>{v=we(e,b=>{d(b)!==t&&(v==null||v(),h(b))},{flush:f,deep:_,immediate:!0})})];return y!=null&&m.push(Vo(y,g).then(()=>ot(e)).finally(()=>v==null?void 0:v())),Promise.race(m)}function o(d,f){if(!No(d))return n(b=>b===d,f);const{flush:_="sync",deep:y=!1,timeout:g,throwOnTimeout:v}=f??{};let w=null;const h=[new Promise(b=>{w=we([e,d],([A,O])=>{t!==(A===O)&&(w==null||w(),b(A))},{flush:_,deep:y,immediate:!0})})];return g!=null&&h.push(Vo(g,v).then(()=>ot(e)).finally(()=>(w==null||w(),ot(e)))),Promise.race(h)}function i(d){return n(f=>!!f,d)}function r(d){return o(null,d)}function a(d){return o(void 0,d)}function s(d){return n(Number.isNaN,d)}function u(d,f){return n(_=>{const y=Array.from(_);return y.includes(d)||y.includes(ot(d))},f)}function l(d){return c(1,d)}function c(d=1,f){let _=-1;return n(()=>(_+=1,_>=d),f)}return Array.isArray(ot(e))?{toMatch:n,toContains:u,changed:l,changedTimes:c,get not(){return lo(e,!t)}}:{toMatch:n,toBe:o,toBeTruthy:i,toBeNull:r,toBeNaN:s,toBeUndefined:a,changed:l,changedTimes:c,get not(){return lo(e,!t)}}}function uo(e){return lo(e)}function es(e){var t;const n=ot(e);return(t=n==null?void 0:n.$el)!=null?t:n}const Yi=Ua?window:void 0;function Gi(...e){let t,n,o,i;if(typeof e[0]=="string"||Array.isArray(e[0])?([n,o,i]=e,t=Yi):[t,n,o,i]=e,!t)return Ka;Array.isArray(n)||(n=[n]),Array.isArray(o)||(o=[o]);const r=[],a=()=>{r.forEach(c=>c()),r.length=0},s=(c,d,f,_)=>(c.addEventListener(d,f,_),()=>c.removeEventListener(d,f,_)),u=we(()=>[es(t),ot(i)],([c,d])=>{if(a(),!c)return;const f=Za(d)?{...d}:d;r.push(...n.flatMap(_=>o.map(y=>s(c,_,y,f))))},{immediate:!0,flush:"post"}),l=()=>{u(),a()};return An(l),l}function ts(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Ho(...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=Yi,eventName:r="keydown",passive:a=!1,dedupe:s=!1}=o,u=ts(t);return Gi(i,r,c=>{c.repeat&&ot(s)||u(c)&&n(c)},a)}function ns(e){return JSON.parse(JSON.stringify(e))}function Kn(e,t,n,o={}){var i,r,a;const{clone:s=!1,passive:u=!1,eventName:l,deep:c=!1,defaultValue:d,shouldEmit:f}=o,_=on(),y=n||(_==null?void 0:_.emit)||((i=_==null?void 0:_.$emit)==null?void 0:i.bind(_))||((a=(r=_==null?void 0:_.proxy)==null?void 0:r.$emit)==null?void 0:a.bind(_==null?void 0:_.proxy));let g=l;t||(t="modelValue"),g=g||`update:${t.toString()}`;const v=h=>s?typeof s=="function"?s(h):ns(h):h,w=()=>Xa(e[t])?v(e[t]):d,m=h=>{f?f(h)&&y(g,h):y(g,h)};if(u){const h=w(),b=K(h);let A=!1;return we(()=>e[t],O=>{A||(A=!0,b.value=v(O),je(()=>A=!1))}),we(b,O=>{!A&&(O!==e[t]||c)&&m(O)},{deep:c}),b}else return ce({get(){return w()},set(h){m(h)}})}var os={value:()=>{}};function zn(){for(var e=0,t=arguments.length,n={},o;e=0&&(o=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}gn.prototype=zn.prototype={constructor:gn,on:function(e,t){var n=this._,o=is(e+"",n),i,r=-1,a=o.length;if(arguments.length<2){for(;++r0)for(var n=new Array(i),o=0,i,r;o=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Go.hasOwnProperty(t)?{space:Go[t],local:e}:e}function as(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===co&&t.documentElement.namespaceURI===co?t.createElement(e):t.createElementNS(n,e)}}function ss(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ui(e){var t=On(e);return(t.local?ss:as)(t)}function ls(){}function $o(e){return e==null?ls:function(){return this.querySelector(e)}}function us(e){typeof e!="function"&&(e=$o(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i=h&&(h=m+1);!(A=v[h])&&++h=0;)(a=o[i])&&(r&&a.compareDocumentPosition(r)^4&&r.parentNode.insertBefore(a,r),r=a);return this}function As(e){e||(e=zs);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,i=new Array(o),r=0;rt?1:e>=t?0:NaN}function Os(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Bs(){return Array.from(this)}function Rs(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Ks:typeof t=="function"?js:qs)(e,t,n??"")):At(this.node(),e)}function At(e,t){return e.style.getPropertyValue(t)||qi(e).getComputedStyle(e,null).getPropertyValue(t)}function Qs(e){return function(){delete this[e]}}function el(e,t){return function(){this[e]=t}}function tl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nl(e,t){return arguments.length>1?this.each((t==null?Qs:typeof t=="function"?tl:el)(e,t)):this.node()[e]}function ji(e){return e.trim().split(/^|\s+/)}function Po(e){return e.classList||new Ji(e)}function Ji(e){this._node=e,this._names=ji(e.getAttribute("class")||"")}Ji.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 Qi(e,t){for(var n=Po(e),o=-1,i=t.length;++o=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Pl(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,i=t.length,r;n()=>e;function fo(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:a,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}fo.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Ll(e){return!e.ctrlKey&&!e.button}function Vl(){return this.parentNode}function Hl(e,t){return t??{x:e.x,y:e.y}}function Yl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gl(){var e=Ll,t=Vl,n=Hl,o=Yl,i={},r=zn("start","drag","end"),a=0,s,u,l,c,d=0;function f(b){b.on("mousedown.drag",_).filter(o).on("touchstart.drag",v).on("touchmove.drag",w,Fl).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(b,A){if(!(c||!e.call(this,b,A))){var O=h(this,t.call(this,b,A),b,A,"mouse");O&&(Ge(b.view).on("mousemove.drag",y,qt).on("mouseup.drag",g,qt),or(b.view),qn(b),l=!1,s=b.clientX,u=b.clientY,O("start",b))}}function y(b){if(kt(b),!l){var A=b.clientX-s,O=b.clientY-u;l=A*A+O*O>d}i.mouse("drag",b)}function g(b){Ge(b.view).on("mousemove.drag mouseup.drag",null),ir(b.view,l),kt(b),i.mouse("end",b)}function v(b,A){if(e.call(this,b,A)){var O=b.changedTouches,L=t.call(this,b,A),X=O.length,j,V;for(j=0;j>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ln(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ln(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=Xl.exec(e))?new Be(t[1],t[2],t[3],1):(t=Wl.exec(e))?new Be(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Zl.exec(e))?ln(t[1],t[2],t[3],t[4]):(t=Kl.exec(e))?ln(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ql.exec(e))?jo(t[1],t[2]/100,t[3]/100,1):(t=jl.exec(e))?jo(t[1],t[2]/100,t[3]/100,t[4]):Uo.hasOwnProperty(e)?Zo(Uo[e]):e==="transparent"?new Be(NaN,NaN,NaN,0):null}function Zo(e){return new Be(e>>16&255,e>>8&255,e&255,1)}function ln(e,t,n,o){return o<=0&&(e=t=n=NaN),new Be(e,t,n,o)}function eu(e){return e instanceof an||(e=Qt(e)),e?(e=e.rgb(),new Be(e.r,e.g,e.b,e.opacity)):new Be}function ho(e,t,n,o){return arguments.length===1?eu(e):new Be(e,t,n,o??1)}function Be(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Mo(Be,ho,rr(an,{brighter(e){return e=e==null?Sn:Math.pow(Sn,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?jt:Math.pow(jt,e),new Be(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Be(wt(this.r),wt(this.g),wt(this.b),En(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:Ko,formatHex:Ko,formatHex8:tu,formatRgb:qo,toString:qo}));function Ko(){return`#${yt(this.r)}${yt(this.g)}${yt(this.b)}`}function tu(){return`#${yt(this.r)}${yt(this.g)}${yt(this.b)}${yt((isNaN(this.opacity)?1:this.opacity)*255)}`}function qo(){const e=En(this.opacity);return`${e===1?"rgb(":"rgba("}${wt(this.r)}, ${wt(this.g)}, ${wt(this.b)}${e===1?")":`, ${e})`}`}function En(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function yt(e){return e=wt(e),(e<16?"0":"")+e.toString(16)}function jo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ue(e,t,n,o)}function ar(e){if(e instanceof Ue)return new Ue(e.h,e.s,e.l,e.opacity);if(e instanceof an||(e=Qt(e)),!e)return new Ue;if(e instanceof Ue)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+(n0&&u<1?0:a,new Ue(a,s,u,e.opacity)}function nu(e,t,n,o){return arguments.length===1?ar(e):new Ue(e,t,n,o??1)}function Ue(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Mo(Ue,nu,rr(an,{brighter(e){return e=e==null?Sn:Math.pow(Sn,e),new Ue(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?jt:Math.pow(jt,e),new Ue(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 Be(jn(e>=240?e-240:e+120,i,o),jn(e,i,o),jn(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new Ue(Jo(this.h),un(this.s),un(this.l),En(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=En(this.opacity);return`${e===1?"hsl(":"hsla("}${Jo(this.h)}, ${un(this.s)*100}%, ${un(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Jo(e){return e=(e||0)%360,e<0?e+360:e}function un(e){return Math.max(0,Math.min(1,e||0))}function jn(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 sr=e=>()=>e;function ou(e,t){return function(n){return e+n*t}}function iu(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 ru(e){return(e=+e)==1?lr:function(t,n){return n-t?iu(t,n,e):sr(isNaN(t)?n:t)}}function lr(e,t){var n=t-e;return n?ou(e,n):sr(isNaN(e)?t:e)}const Qo=function e(t){var n=ru(t);function o(i,r){var a=n((i=ho(i)).r,(r=ho(r)).r),s=n(i.g,r.g),u=n(i.b,r.b),l=lr(i.opacity,r.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=u(c),i.opacity=l(c),i+""}}return o.gamma=e,o}(1);function ft(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var po=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jn=new RegExp(po.source,"g");function au(e){return function(){return e}}function su(e){return function(t){return e(t)+""}}function lu(e,t){var n=po.lastIndex=Jn.lastIndex=0,o,i,r,a=-1,s=[],u=[];for(e=e+"",t=t+"";(o=po.exec(e))&&(i=Jn.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:ft(o,i)})),n=Jn.lastIndex;return n180?c+=360:c-l>180&&(l+=360),f.push({i:d.push(i(d)+"rotate(",null,o)-2,x:ft(l,c)})):c&&d.push(i(d)+"rotate("+c+o)}function s(l,c,d,f){l!==c?f.push({i:d.push(i(d)+"skewX(",null,o)-2,x:ft(l,c)}):c&&d.push(i(d)+"skewX("+c+o)}function u(l,c,d,f,_,y){if(l!==d||c!==f){var g=_.push(i(_)+"scale(",null,",",null,")");y.push({i:g-4,x:ft(l,d)},{i:g-2,x:ft(c,f)})}else(d!==1||f!==1)&&_.push(i(_)+"scale("+d+","+f+")")}return function(l,c){var d=[],f=[];return l=e(l),c=e(c),r(l.translateX,l.translateY,c.translateX,c.translateY,d,f),a(l.rotate,c.rotate,d,f),s(l.skewX,c.skewX,d,f),u(l.scaleX,l.scaleY,c.scaleX,c.scaleY,d,f),l=c=null,function(_){for(var y=-1,g=f.length,v;++y=0&&e._call.call(void 0,t),e=e._next;--zt}function ni(){bt=(Nn=en.now())+Bn,zt=Gt=0;try{yu()}finally{zt=0,_u(),bt=0}}function wu(){var e=en.now(),t=e-Nn;t>dr&&(Bn-=t,Nn=e)}function _u(){for(var e,t=Cn,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:Cn=n);Ut=e,go(o)}function go(e){if(!zt){Gt&&(Gt=clearTimeout(Gt));var t=e-bt;t>24?(e<1/0&&(Gt=setTimeout(ni,e-en.now()-Bn)),Lt&&(Lt=clearInterval(Lt))):(Lt||(Nn=en.now(),Lt=setInterval(wu,dr)),zt=1,fr(ni))}}function oi(e,t,n){var o=new kn;return t=t==null?0:+t,o.restart(i=>{o.stop(),e(i+t)},t,n),o}var xu=zn("start","end","cancel","interrupt"),bu=[],pr=0,ii=1,mo=2,mn=3,ri=4,yo=5,yn=6;function Rn(e,t,n,o,i,r){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;Su(e,n,{name:t,index:o,group:i,on:xu,tween:bu,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:pr})}function Do(e,t){var n=We(e,t);if(n.state>pr)throw new Error("too late; already scheduled");return n}function et(e,t){var n=We(e,t);if(n.state>mn)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 Su(e,t,n){var o=e.__transition,i;o[t]=n,n.timer=hr(r,0,n.time);function r(l){n.state=ii,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var c,d,f,_;if(n.state!==ii)return u();for(c in o)if(_=o[c],_.name===n.name){if(_.state===mn)return oi(a);_.state===ri?(_.state=yn,_.timer.stop(),_.on.call("interrupt",e,e.__data__,_.index,_.group),delete o[c]):+cmo&&o.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function Qu(e,t,n){var o,i,r=Ju(t)?Do:et;return function(){var a=r(this,e),s=a.on;s!==o&&(i=(o=s).copy()).on(t,n),a.on=i}}function ec(e,t){var n=this._id;return arguments.length<2?We(this.node(),n).on.on(e):this.each(Qu(n,e,t))}function tc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function nc(){return this.on("end.remove",tc(this._id))}function oc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$o(e));for(var o=this._groups,i=o.length,r=new Array(i),a=0;a()=>e;function Ic(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 it(e,t,n){this.k=e,this.x=t,this.y=n}it.prototype={constructor:it,scale:function(e){return e===1?this:new it(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new it(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 Ot=new it(1,0,0);it.prototype;function Qn(e){e.stopImmediatePropagation()}function Vt(e){e.preventDefault(),e.stopImmediatePropagation()}function $c(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Pc(){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 ai(){return this.__zoom||Ot}function Mc(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Tc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dc(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 Ac(){var e=$c,t=Pc,n=Dc,o=Mc,i=Tc,r=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,u=gu,l=zn("start","zoom","end"),c,d,f,_=500,y=150,g=0,v=10;function w(p){p.property("__zoom",ai).on("wheel.zoom",X,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",V).filter(i).on("touchstart.zoom",U).on("touchmove.zoom",P).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}w.transform=function(p,I,T,F){var H=p.selection?p.selection():p;H.property("__zoom",ai),p!==H?A(p,I,T,F):H.interrupt().each(function(){O(this,arguments).event(F).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},w.scaleBy=function(p,I,T,F){w.scaleTo(p,function(){var H=this.__zoom.k,Y=typeof I=="function"?I.apply(this,arguments):I;return H*Y},T,F)},w.scaleTo=function(p,I,T,F){w.transform(p,function(){var H=t.apply(this,arguments),Y=this.__zoom,W=T==null?b(H):typeof T=="function"?T.apply(this,arguments):T,D=Y.invert(W),z=typeof I=="function"?I.apply(this,arguments):I;return n(h(m(Y,z),W,D),H,a)},T,F)},w.translateBy=function(p,I,T,F){w.transform(p,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof T=="function"?T.apply(this,arguments):T),t.apply(this,arguments),a)},null,F)},w.translateTo=function(p,I,T,F,H){w.transform(p,function(){var Y=t.apply(this,arguments),W=this.__zoom,D=F==null?b(Y):typeof F=="function"?F.apply(this,arguments):F;return n(Ot.translate(D[0],D[1]).scale(W.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof T=="function"?-T.apply(this,arguments):-T),Y,a)},F,H)};function m(p,I){return I=Math.max(r[0],Math.min(r[1],I)),I===p.k?p:new it(I,p.x,p.y)}function h(p,I,T){var F=I[0]-T[0]*p.k,H=I[1]-T[1]*p.k;return F===p.x&&H===p.y?p:new it(p.k,F,H)}function b(p){return[(+p[0][0]+ +p[1][0])/2,(+p[0][1]+ +p[1][1])/2]}function A(p,I,T,F){p.on("start.zoom",function(){O(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){O(this,arguments).event(F).end()}).tween("zoom",function(){var H=this,Y=arguments,W=O(H,Y).event(F),D=t.apply(H,Y),z=T==null?b(D):typeof T=="function"?T.apply(H,Y):T,M=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),$=H.__zoom,oe=typeof I=="function"?I.apply(H,Y):I,ve=u($.invert(z).concat(M/$.k),oe.invert(z).concat(M/oe.k));return function(he){if(he===1)he=oe;else{var me=ve(he),ue=M/me[2];he=new it(ue,z[0]-me[0]*ue,z[1]-me[1]*ue)}W.zoom(null,he)}})}function O(p,I,T){return!T&&p.__zooming||new L(p,I)}function L(p,I){this.that=p,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(p,I),this.taps=0}L.prototype={event:function(p){return p&&(this.sourceEvent=p),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(p,I){return this.mouse&&p!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&p!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&p!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(p){var I=Ge(this.that).datum();l.call(p,this.that,new Ic(p,{sourceEvent:this.sourceEvent,target:w,type:p,transform:this.that.__zoom,dispatch:l}),I)}};function X(p,...I){if(!e.apply(this,arguments))return;var T=O(this,I).event(p),F=this.__zoom,H=Math.max(r[0],Math.min(r[1],F.k*Math.pow(2,o.apply(this,arguments)))),Y=Ke(p);if(T.wheel)(T.mouse[0][0]!==Y[0]||T.mouse[0][1]!==Y[1])&&(T.mouse[1]=F.invert(T.mouse[0]=Y)),clearTimeout(T.wheel);else{if(F.k===H)return;T.mouse=[Y,F.invert(Y)],wn(this),T.start()}Vt(p),T.wheel=setTimeout(W,y),T.zoom("mouse",n(h(m(F,H),T.mouse[0],T.mouse[1]),T.extent,a));function W(){T.wheel=null,T.end()}}function j(p,...I){if(f||!e.apply(this,arguments))return;var T=p.currentTarget,F=O(this,I,!0).event(p),H=Ge(p.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",M,!0),Y=Ke(p,T),W=p.clientX,D=p.clientY;or(p.view),Qn(p),F.mouse=[Y,this.__zoom.invert(Y)],wn(this),F.start();function z($){if(Vt($),!F.moved){var oe=$.clientX-W,ve=$.clientY-D;F.moved=oe*oe+ve*ve>g}F.event($).zoom("mouse",n(h(F.that.__zoom,F.mouse[0]=Ke($,T),F.mouse[1]),F.extent,a))}function M($){H.on("mousemove.zoom mouseup.zoom",null),ir($.view,F.moved),Vt($),F.event($).end()}}function V(p,...I){if(e.apply(this,arguments)){var T=this.__zoom,F=Ke(p.changedTouches?p.changedTouches[0]:p,this),H=T.invert(F),Y=T.k*(p.shiftKey?.5:2),W=n(h(m(T,Y),F,H),t.apply(this,I),a);Vt(p),s>0?Ge(this).transition().duration(s).call(A,W,F,p):Ge(this).call(w.transform,W,F,p)}}function U(p,...I){if(e.apply(this,arguments)){var T=p.touches,F=T.length,H=O(this,I,p.changedTouches.length===F).event(p),Y,W,D,z;for(Qn(p),W=0;W(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(q||{}),zo=(e=>(e.Partial="partial",e.Full="full",e))(zo||{}),gt=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(gt||{}),St=(e=>(e.Strict="strict",e.Loose="loose",e))(St||{}),wo=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(wo||{}),Zt=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(Zt||{});function _o(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 zc(e){return e.ctrlKey||e.metaKey||e.shiftKey}function si(e,t,n,o){const i=t.replace("+",` `).replace(` `,` +`).split(` `).map(a=>a.trim().toLowerCase());if(i.length===1)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((a,s)=>n.has(a)&&Array.from(n.values())[s]===i[s]);return o&&n.delete(e.toLowerCase()),r}function Oc(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=Bc(n.code,e);return Array.isArray(e)?e.some(i=>si(n[o],i,t,n.type==="keyup")):si(n[o],e,t,n.type==="keyup")}}function Bc(e,t){return t.includes(e)?"code":"key"}function Kt(e,t){const n=Ce(()=>ye(t==null?void 0:t.actInsideInputWithModifier)??!1),o=Ce(()=>ye(t==null?void 0:t.target)??window),i=K(ye(e)===!0);let r=!1;const a=new Set;let s=l(ye(e));we(()=>ye(e),(c,d)=>{typeof d=="boolean"&&typeof c!="boolean"&&u(),s=l(c)},{immediate:!0}),Xe(()=>{Gi(window,["blur","contextmenu"],u)}),Ho((...c)=>s(...c),c=>{r=zc(c),!((!r||r&&!n.value)&&_o(c))&&(c.preventDefault(),i.value=!0)},{eventName:"keydown",target:o}),Ho((...c)=>s(...c),c=>{if(i.value){if((!r||r&&!n.value)&&_o(c))return;r=!1,i.value=!1}},{eventName:"keyup",target:o});function u(){r=!1,a.clear(),i.value=ye(e)===!0}function l(c){return c===null?(u(),()=>!1):typeof c=="boolean"?(u(),i.value=c,()=>!1):Array.isArray(c)||typeof c=="string"?Oc(c,a):c}return i}const yr="vue-flow__node-desc",wr="vue-flow__edge-desc",Rc="vue-flow__aria-live",_r=["Enter"," ","Escape"],$t={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function xo(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function bo(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 Fn(e){return{width:e.offsetWidth,height:e.offsetHeight}}function Et(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function xr(e,t){return{x:Et(e.x,t[0][0],t[1][0]),y:Et(e.y,t[0][1],t[1][1])}}function li(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function pt(e){return e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e}function _t(e){return e&&typeof e=="object"&&"id"in e&&"position"in e&&!pt(e)}function Xt(e){return _t(e)&&"computedPosition"in e}function fn(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Fc(e){return fn(e.width)&&fn(e.height)&&fn(e.x)&&fn(e.y)}function Lc(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:Ae({width:0,height:0}),computedPosition:Ae({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:Ie(e.data)?e.data:{},events:Ae(Ie(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function br(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:Ie(e.data)?e.data:{},events:Ae(Ie(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 Sr(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 Vc(...e){if(e.length===3){const[r,a,s]=e;return Sr(r,a,s,"target")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>pt(r)&&r.source===o).map(r=>n.find(a=>_t(a)&&a.id===r.target))}function Hc(...e){if(e.length===3){const[r,a,s]=e;return Sr(r,a,s,"source")}const[t,n]=e,o=typeof t=="string"?t:t.id;return n.filter(r=>pt(r)&&r.target===o).map(r=>n.find(a=>_t(a)&&a.id===r.source))}function Er({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function Yc(e,t){return t.some(n=>pt(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 Cr({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function tn({x:e,y:t},{x:n,y:o,zoom:i},r=!1,a=[1,1]){const s={x:(e-n)/i,y:(t-o)/i};return r?Ln(s,a):s}function Gc(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 Nr({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function Uc({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function kr(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n0,v=(d??0)*(f??0);(y||g||_>=v||s.dragging)&&a.push(s)}return a}function $r(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 ui(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)),l=Math.min(s,u),c=Et(l,o,i),d=e.x+e.width/2,f=e.y+e.height/2,_=t/2-d*c+(a.x??0),y=n/2-f*c+(a.y??0);return{x:_,y,zoom:c}}function Xc(e,t){return{x:t.x+e.x,y:t.y+e.y,z:(e.z>t.z?e.z:t.z)+1}}function Pr(e,t){if(!e.parentNode)return!1;const n=t(e.parentNode);return n?n.selected?!0:Pr(n,t):!1}function nn(e,t){return typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`}function ci(e,t,n){return en?-Et(Math.abs(e-n),1,t)/t:0}function Mr(e,t,n=15,o=40){const i=ci(e.x,o,t.width-o)*n,r=ci(e.y,o,t.height-o)*n;return[i,r]}function eo(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 di(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(Xt(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&&Xt(u)&&eo(a,u)}break;case"dimensions":if(Xt(a)&&(typeof s.dimensions<"u"&&(a.dimensions=s.dimensions),typeof s.updateStyle<"u"&&s.updateStyle&&(a.style={...a.style||{},width:`${(n=s.dimensions)==null?void 0:n.width}px`,height:`${(o=s.dimensions)==null?void 0:o.height}px`}),typeof s.resizing<"u"&&(a.resizing=s.resizing),a.expandParent&&a.parentNode)){const u=t[r.indexOf(a.parentNode)];u&&Xt(u)&&(!!u.dimensions.width&&!!u.dimensions.height?eo(a,u):je(()=>{eo(a,u)}))}break}return t}function dt(e,t){return{id:e,type:"select",selected:t}}function fi(e){return{item:e,type:"add"}}function hi(e){return{id:e,type:"remove"}}function pi(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function ht(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const a=t.has(i);!(r.selected===void 0&&!a)&&r.selected!==a&&(n&&(r.selected=a),o.push(dt(r.id,a)))}return o}function J(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 An(u),{off:u}},off:i,trigger:s=>Promise.all(Array.from(t).map(u=>u(s))),hasListeners:o,fns:t}}function vi(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 Wc(e,t,n,o,i){var r,a;const s=[];for(const u of e)(u.selected||u.id===i)&&(!u.parentNode||!Pr(u,o))&&(u.draggable||t&&typeof u.draggable>"u")&&s.push(Ae({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 to({id:e,dragItems:t,findNode:n}){const o=[];for(const i of t){const r=n(i.id);r&&o.push(r)}return[e?o.find(i=>i.id===e):o[0],o]}function Tr(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function Zc(e,t,n){const[o,i,r,a]=typeof e!="string"?Tr(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 Kc(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=Zc(i,e,o);r&&(i=r)}else t(new Me(Pe.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]=Tr(i.padding),l=(o==null?void 0:o.computedPosition.x)||0,c=(o==null?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+l+u,i.range[0][1]+c+r],[i.range[1][0]+l-a,i.range[1][1]+c-s]]}return i==="parent"?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function qc({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}function Oo(e,t,n,o,i){const r=qc(e.dimensions,Kc(e,n,o,i)),a=xr(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 In(e,t,n=q.Left){const o=((t==null?void 0:t.x)??0)+e.computedPosition.x,i=((t==null?void 0:t.y)??0)+e.computedPosition.y,{width:r,height:a}=t??Qc(e);switch((t==null?void 0:t.position)??n){case q.Top:return{x:o+r/2,y:i};case q.Right:return{x:o+r,y:i+a/2};case q.Bottom:return{x:o+r/2,y:i+a};case q.Left:return{x:o,y:i+a/2}}}function gi(e=[],t){return e.length&&(t?e.find(n=>n.id===t):e[0])||null}function jc({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:a,height:s,viewport:u}){const l={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)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c=Nr({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:a/u.zoom,height:s/u.zoom}),d=Math.max(0,Math.min(c.x2,l.x2)-Math.max(c.x,l.x)),f=Math.max(0,Math.min(c.y2,l.y2)-Math.max(c.y,l.y));return Math.ceil(d*f)>0}function Jc(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 Pe=(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))(Pe||{});const mi={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid Node: ${e}`,NODE_NOT_FOUND:e=>`Node not found Node: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent Node: ${e} Parent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing Type: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent Node: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target Edge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing Edge: ${e} Source: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing Edge: ${e} Target: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing Type: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same Edge: ${e} Source: ${t} Target: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing Edge: ${e} Source: ${t} Target: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed Edge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found Edge: ${e}`,USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class Me extends Error{constructor(t,...n){var o;super((o=mi[t])==null?void 0:o.call(mi,...n)),this.name="VueFlowError",this.code=t,this.args=n}}function Bo(e){return"clientX"in e}function Dr(e){return"sourceEvent"in e}function at(e,t){var n,o;const i=Bo(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 $n=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Qc(e){var t,n;return{width:((t=e.dimensions)==null?void 0:t.width)??e.width??0,height:((n=e.dimensions)==null?void 0:n.height)??e.height??0}}function Ln(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}function Ar(){return{handleDomNode:null,isValid:!1,connection:{source:"",target:"",sourceHandle:null,targetHandle:null},endHandle:null}}function no(e){e==null||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function yi(e,t,n,o){const i=[];for(const r of t[n]||[])if(`${e.id}-${r.id}-${n}`!==o){const{x:a,y:s}=In(e,r);i.push({id:r.id||null,type:n,nodeId:e.id,x:a,y:s})}return i}function ed(e,t,n,o,i,r){const{x:a,y:s}=at(e),l=t.elementsFromPoint(a,s).find(y=>y.classList.contains("vue-flow__handle"));if(l){const y=l.getAttribute("data-nodeid");if(y){const g=Ro(void 0,l),v=l.getAttribute("data-handleid"),w=r({nodeId:y,id:v,type:g});if(w){const m=i.find(h=>h.nodeId===y&&h.type===g&&h.id===v);return{handle:{id:v,type:g,nodeId:y,x:(m==null?void 0:m.x)||n.x,y:(m==null?void 0:m.y)||n.y},validHandleResult:w}}}}let c=[],d=Number.POSITIVE_INFINITY;for(const y of i){const g=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(g<=o){const v=r(y);g<=d&&(gy.isValid),_=c.some(({handle:y})=>y.type==="target");return c.find(({handle:y,validHandleResult:g})=>_?y.type==="target":f?g.isValid:!0)||c[0]}function wi(e,t,n,o,i,r,a,s,u,l,c){const d=r==="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:_,y}=at(e),g=s.elementFromPoint(_,y),v=g!=null&&g.classList.contains("vue-flow__handle")?g:f,w=Ar();if(v){w.handleDomNode=v;const m=Ro(void 0,v),h=v.getAttribute("data-nodeid"),b=v.getAttribute("data-handleid"),A=v.classList.contains("connectable"),O=v.classList.contains("connectableend"),L={source:d?h:o,sourceHandle:d?b:i,target:d?o:h,targetHandle:d?i:b};w.connection=L,A&&O&&(n===St.Strict?d&&m==="source"||!d&&m==="target":h!==o||b!==i)&&(w.isValid=a(L,{edges:u,nodes:l,sourceNode:c(L.source),targetNode:c(L.target)}),w.endHandle={nodeId:h,handleId:b,type:m,position:w.isValid?v.getAttribute("data-handlepos"):null})}return w}function td({nodes:e,nodeId:t,handleId:n,handleType:o}){const i=[];for(let r=0;r{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,...Fn(a)}})}function So(e,t,n,o,i,r=!1,a){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),je(()=>{a.blur()})):n([e])}function Ie(e){return typeof x(e)<"u"}function id(e,t,n,o){if(!e||!e.source||!e.target)return n(new Me(Pe.EDGE_INVALID,(e==null?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return pt(e)?i=e:i={...e,id:Er(e)},i=br(i,void 0,o),Yc(i,t)?!1:i}function rd(e,t,n,o,i,r){if(!t.source||!t.target)return r(new Me(Pe.EDGE_INVALID,e.id)),!1;const a=o(e.id);if(!a)return r(new Me(Pe.EDGE_NOT_FOUND,e.id)),!1;const{id:s,...u}=e,l={...u,id:i?Er(t):s,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.splice(n.indexOf(a),1,l),l}function xi(e,t,n){const o={},i=[];for(let r=0;rs.id===r.parentNode);r.parentNode&&!a&&n(new Me(Pe.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 bi(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}`,l=`${r}-target-${s}`,c=e.get(u)||new Map,d=e.get(l)||new Map,f=Ae({edgeId:o,source:i,target:r,sourceHandle:a,targetHandle:s});e.set(u,c.set(`${r}-${s}`,f)),e.set(l,d.set(`${i}-${a}`,f))}}function Si(e,t,n,o,i,r,a,s){const u=[];for(const l of e){const c=pt(l)?l:id(l,s,i,r);if(!c)continue;const d=n(c.source),f=n(c.target);if(!d||!f){i(new Me(Pe.EDGE_SOURCE_TARGET_MISSING,c.id,c.source,c.target));continue}if(!d){i(new Me(Pe.EDGE_SOURCE_MISSING,c.id,c.source));continue}if(!f){i(new Me(Pe.EDGE_TARGET_MISSING,c.id,c.target));continue}if(t&&!t(c,{edges:s,nodes:a,sourceNode:d,targetNode:f})){i(new Me(Pe.EDGE_INVALID,c.id));continue}const _=o(c.id);u.push({...br(c,_,r),sourceNode:d,targetNode:f})}return u}const Ei=Symbol("vueFlow"),Or=Symbol("nodeId"),Br=Symbol("nodeRef"),ad=Symbol("edgeId"),sd=Symbol("edgeRef"),Hn=Symbol("slots");function Rr(e){const{vueFlowRef:t,snapToGrid:n,snapGrid:o,noDragClassName:i,nodes:r,nodeExtent:a,nodeDragThreshold:s,viewport:u,autoPanOnNodeDrag:l,autoPanSpeed:c,nodesDraggable:d,panBy:f,findNode:_,multiSelectionActive:y,nodesSelectionActive:g,selectNodesOnDrag:v,removeSelectedElements:w,addSelectedNodes:m,updateNodePositions:h,emits:b}=Ne(),{onStart:A,onDrag:O,onStop:L,onClick:X,el:j,disabled:V,id:U,selectable:P,dragHandle:G}=e,p=K(!1);let I=[],T,F=null,H={x:void 0,y:void 0},Y={x:0,y:0},W=null,D=!1,z=0,M=!1;const $=cd(),oe=({x:te,y:ie})=>{H={x:te,y:ie};let de=!1;if(I=I.map(N=>{const S={x:te-N.distance.x,y:ie-N.distance.y},{computedPosition:E}=Oo(N,n.value?Ln(S,o.value):S,b.error,a.value,N.parentNode?_(N.parentNode):void 0);return de=de||N.position.x!==E.x||N.position.y!==E.y,N.position=E,N}),!!de&&(h(I,!0,!0),p.value=!0,W)){const[N,S]=to({id:U,dragItems:I,findNode:_});O({event:W,node:N,nodes:S})}},ve=()=>{if(!F)return;const[te,ie]=Mr(Y,F,c.value);if(te!==0||ie!==0){const de={x:(H.x??0)-te/u.value.zoom,y:(H.y??0)-ie/u.value.zoom};f({x:te,y:ie})&&oe(de)}z=requestAnimationFrame(ve)},he=(te,ie)=>{D=!0;const de=_(U);!v.value&&!y.value&&de&&(de.selected||w()),de&&ye(P)&&v.value&&So(de,y.value,m,w,g,!1,ie);const N=$(te.sourceEvent);if(H=N,I=Wc(r.value,d.value,N,_,U),I.length){const[S,E]=to({id:U,dragItems:I,findNode:_});A({event:te.sourceEvent,node:S,nodes:E})}},me=(te,ie)=>{var de;te.sourceEvent.type==="touchmove"&&te.sourceEvent.touches.length>1||(s.value===0&&he(te,ie),H=$(te.sourceEvent),F=((de=t.value)==null?void 0:de.getBoundingClientRect())||null,Y=at(te.sourceEvent,F))},ue=(te,ie)=>{const de=$(te.sourceEvent);if(!M&&D&&l.value&&(M=!0,ve()),!D){const N=de.xSnapped-(H.x??0),S=de.ySnapped-(H.y??0);Math.sqrt(N*N+S*S)>s.value&&he(te,ie)}(H.x!==de.xSnapped||H.y!==de.ySnapped)&&I.length&&D&&(W=te.sourceEvent,Y=at(te.sourceEvent,F),oe(de))},fe=te=>{if(!Dr(te)&&!D&&!p.value&&!y.value){const ie=te,de=$(ie),N=de.xSnapped-(H.x??0),S=de.ySnapped-(H.y??0),E=Math.sqrt(N*N+S*S);E!==0&&E<=s.value&&(X==null||X(ie));return}if(p.value=!1,M=!1,D=!1,H={x:void 0,y:void 0},cancelAnimationFrame(z),I.length){h(I,!1,!1);const[ie,de]=to({id:U,dragItems:I,findNode:_});L({event:te.sourceEvent,node:ie,nodes:de})}};return we([()=>ye(V),j],([te,ie],de,N)=>{if(ie){const S=Ge(ie);te||(T=Gl().on("start",E=>me(E,ie)).on("drag",E=>ue(E,ie)).on("end",E=>fe(E)).filter(E=>{const k=E.target,B=ye(G);return!E.button&&(!i.value||!vi(k,`.${i.value}`,ie)&&(!B||vi(k,B,ie)))}),S.call(T)),N(()=>{S.on(".drag",null),T&&(T.on("start",null),T.on("drag",null),T.on("end",null))})}}),p}function ld(){return{doubleClick:J(),click:J(),mouseEnter:J(),mouseMove:J(),mouseLeave:J(),contextMenu:J(),updateStart:J(),update:J(),updateEnd:J()}}function ud(e,t){const n=ld();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 cd(){const{viewport:e,snapGrid:t,snapToGrid:n}=Ne();return o=>{const i=Dr(o)?o.sourceEvent:o,{x:r,y:a}=at(i),s=tn({x:r,y:a},e.value),{x:u,y:l}=n.value?Ln(s,t.value):s;return{xSnapped:u,ySnapped:l,...s}}}function hn(){return!0}function Fr({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:a}){const{vueFlowRef:s,connectionMode:u,connectionRadius:l,connectOnClick:c,connectionClickStartHandle:d,nodesConnectable:f,autoPanOnConnect:_,autoPanSpeed:y,findNode:g,panBy:v,startConnection:w,updateConnection:m,endConnection:h,emits:b,viewport:A,edges:O,nodes:L,isValidConnection:X}=Ne();let j=null,V=!1,U=null,P=null;function G(I){var T;const F=ye(n)==="target",H=Bo(I),Y=li(I.target);if(H&&I.button===0||!H){let W=function(E){ie=at(E,fe);const{handle:k,validHandleResult:B}=ed(E,Y,tn(ie,A.value,!1,[1,1]),l.value,N,ee=>wi(E,ee,u.value,ye(t),ye(e),F?"target":"source",M,Y,O.value,L.value,g));if($=k,de||(S(),de=!0),j=B.connection,V=B.isValid,U=B.handleDomNode,!(V&&$&&(P!=null&&P.endHandle)&&B.endHandle&&P.endHandle.type===B.endHandle.type&&P.endHandle.nodeId===B.endHandle.nodeId&&P.endHandle.handleId===B.endHandle.handleId)){if(m($&&V?Cr({x:$.x,y:$.y},A.value):ie,B.endHandle,nd(!!$,V)),P=B,!$&&!V&&!U)return no(te);j&&j.source!==j.target&&U&&(no(te),te=U,U.classList.add("connecting","vue-flow__handle-connecting"),U.classList.toggle("valid",V),U.classList.toggle("vue-flow__handle-valid",V))}},D=function(E){($||U)&&j&&V&&(r?r(E,j):b.connect(j)),b.connectEnd(E),i&&(a==null||a(E)),no(te),cancelAnimationFrame(oe),h(E),de=!1,V=!1,j=null,U=null,Y.removeEventListener("mousemove",W),Y.removeEventListener("mouseup",D),Y.removeEventListener("touchmove",W),Y.removeEventListener("touchend",D)};const z=g(ye(t));let M=ye(o)||X.value||hn;!M&&z&&(M=(F?z.isValidSourcePos:z.isValidTargetPos)||hn);let $,oe=0;const{x:ve,y:he}=at(I),me=Y==null?void 0:Y.elementFromPoint(ve,he),ue=Ro(ye(i),me),fe=(T=s.value)==null?void 0:T.getBoundingClientRect();if(!fe||!ue)return;let te,ie=at(I,fe),de=!1;const N=td({nodes:L.value,nodeId:ye(t),handleId:ye(e),handleType:ue}),S=()=>{if(!_.value)return;const[E,k]=Mr(ie,fe,y.value);v({x:E,y:k}),oe=requestAnimationFrame(S)};w({nodeId:ye(t),handleId:ye(e),type:ue,position:(me==null?void 0:me.getAttribute("data-handlepos"))||q.Top},{x:ve-fe.left,y:he-fe.top}),b.connectStart({event:I,nodeId:ye(t),handleId:ye(e),handleType:ue}),Y.addEventListener("mousemove",W),Y.addEventListener("mouseup",D),Y.addEventListener("touchmove",W),Y.addEventListener("touchend",D)}}function p(I){if(!c.value)return;const T=ye(n)==="target";if(!d.value)b.clickConnectStart({event:I,nodeId:ye(t),handleId:ye(e)}),w({nodeId:ye(t),type:ye(n),handleId:ye(e)},void 0,!0);else{let F=ye(o)||X.value||hn;const H=g(ye(t));if(!F&&H&&(F=(T?H.isValidSourcePos:H.isValidTargetPos)||hn),H&&(typeof H.connectable>"u"?f.value:H.connectable)===!1)return;const Y=li(I.target),{connection:W,isValid:D}=wi(I,{nodeId:ye(t),id:ye(e),type:ye(n)},u.value,d.value.nodeId,d.value.handleId||null,d.value.type,F,Y,O.value,L.value,g),z=W.source===W.target;D&&!z&&b.connect(W),b.clickConnectEnd(I),h(I,!0)}}return{handlePointerDown:G,handleClick:p}}function dd(){return Bt(Or,"")}function Lr(e){const t=e??dd()??"",n=Bt(Br,K(null)),{findNode:o,edges:i,emits:r}=Ne(),a=o(t);return a||r.error(new Me(Pe.NODE_NOT_FOUND,t)),{id:t,nodeEl:n,node:a,parentNode:ce(()=>o(a.parentNode)),connectedEdges:ce(()=>$r([a],i.value))}}function fd(){return{doubleClick:J(),click:J(),mouseEnter:J(),mouseMove:J(),mouseLeave:J(),contextMenu:J(),dragStart:J(),drag:J(),dragStop:J()}}function hd(e,t){const n=fd();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 Vr(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:a,emits:s}=Ne();return(u,l=!1)=>{const c=r.value?i.value[0]:5,d=r.value?i.value[1]:5,f=l?4:1,_=u.x*c*f,y=u.y*d*f,g=[];for(const v of e.value)if(v.draggable||a&&typeof v.draggable>"u"){const w={x:v.computedPosition.x+_,y:v.computedPosition.y+y},{computedPosition:m}=Oo(v,w,s.error,t.value,v.parentNode?o(v.parentNode):void 0);g.push({id:v.id,position:m,from:v.position,distance:{x:u.x,y:u.y},dimensions:v.dimensions})}n(g,!0,!1)}}const oo=.1;function ct(){return Vn("Viewport not initialized yet."),Promise.resolve(!1)}const pd={zoomIn:ct,zoomOut:ct,zoomTo:ct,fitView:ct,setCenter:ct,fitBounds:ct,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:ct,setTransform:ct,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function vd(e){function t(o,i){return new Promise(r=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleBy(io(e.d3Selection,i,()=>{r(!0)}),o):r(!1)})}function n(o,i,r,a){return new Promise(s=>{const{x:u,y:l}=xr({x:-o,y:-i},e.translateExtent),c=Ot.translate(-u,-l).scale(r);e.d3Selection&&e.d3Zoom?e.d3Zoom.transform(io(e.d3Selection,a,()=>{s(!0)}),c):s(!1)})}return ce(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,zoomIn:i=>t(1.2,i==null?void 0:i.duration),zoomOut:i=>t(1/1.2,i==null?void 0:i.duration),zoomTo:(i,r)=>new Promise(a=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.scaleTo(io(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:oo,includeHiddenNodes:!1,duration:0})=>{var r,a;const s=[];for(const f of e.nodes)f.dimensions.width&&f.dimensions.height&&((i==null?void 0:i.includeHiddenNodes)||!f.hidden)&&(!((r=i.nodes)!=null&&r.length)||(a=i.nodes)!=null&&a.length&&i.nodes.includes(f.id))&&s.push(f);if(!s.length)return Promise.resolve(!1);const u=kr(s),{x:l,y:c,zoom:d}=ui(u,e.dimensions.width,e.dimensions.height,i.minZoom??e.minZoom,i.maxZoom??e.maxZoom,i.padding??oo,i.offset);return n(l,c,d,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,l=e.dimensions.height/2-r*s;return n(u,l,s,a==null?void 0:a.duration)},fitBounds:(i,r={padding:oo})=>{const{x:a,y:s,zoom:u}=ui(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=>tn(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 tn(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 Cr(s,e.viewport)}return{x:0,y:0}}}:pd)}function io(e,t=0,n){return e.transition().duration(t).on("end",n)}function gd(e,t,n){const o=Di(!0);return o.run(()=>{const i=()=>{o.run(()=>{let g,v,w=!!(n.nodes.value.length||n.edges.value.length);g=Nt([e.modelValue,()=>{var m,h;return(h=(m=e.modelValue)==null?void 0:m.value)==null?void 0:h.length}],([m])=>{m&&Array.isArray(m)&&(v==null||v.pause(),n.setElements(m),!v&&!w&&m.length?w=!0:v==null||v.resume())}),v=Nt([n.nodes,n.edges,()=>n.edges.value.length,()=>n.nodes.value.length],([m,h])=>{var b;(b=e.modelValue)!=null&&b.value&&Array.isArray(e.modelValue.value)&&(g==null||g.pause(),e.modelValue.value=[...m,...h],je(()=>{g==null||g.resume()}))},{immediate:w}),vn(()=>{g==null||g.stop(),v==null||v.stop()})})},r=()=>{o.run(()=>{let g,v,w=!!n.nodes.value.length;g=Nt([e.nodes,()=>{var m,h;return(h=(m=e.nodes)==null?void 0:m.value)==null?void 0:h.length}],([m])=>{m&&Array.isArray(m)&&(v==null||v.pause(),n.setNodes(m),!v&&!w&&m.length?w=!0:v==null||v.resume())}),v=Nt([n.nodes,()=>n.nodes.value.length],([m])=>{var h;(h=e.nodes)!=null&&h.value&&Array.isArray(e.nodes.value)&&(g==null||g.pause(),e.nodes.value=[...m],je(()=>{g==null||g.resume()}))},{immediate:w}),vn(()=>{g==null||g.stop(),v==null||v.stop()})})},a=()=>{o.run(()=>{let g,v,w=!!n.edges.value.length;g=Nt([e.edges,()=>{var m,h;return(h=(m=e.edges)==null?void 0:m.value)==null?void 0:h.length}],([m])=>{m&&Array.isArray(m)&&(v==null||v.pause(),n.setEdges(m),!v&&!w&&m.length?w=!0:v==null||v.resume())}),v=Nt([n.edges,()=>n.edges.value.length],([m])=>{var h;(h=e.edges)!=null&&h.value&&Array.isArray(e.edges.value)&&(g==null||g.pause(),e.edges.value=[...m],je(()=>{g==null||g.resume()}))},{immediate:w}),vn(()=>{g==null||g.stop(),v==null||v.stop()})})},s=()=>{o.run(()=>{we(()=>t.maxZoom,()=>{t.maxZoom&&Ie(t.maxZoom)&&n.setMaxZoom(t.maxZoom)},{immediate:!0})})},u=()=>{o.run(()=>{we(()=>t.minZoom,()=>{t.minZoom&&Ie(t.minZoom)&&n.setMinZoom(t.minZoom)},{immediate:!0})})},l=()=>{o.run(()=>{we(()=>t.translateExtent,()=>{t.translateExtent&&Ie(t.translateExtent)&&n.setTranslateExtent(t.translateExtent)},{immediate:!0})})},c=()=>{o.run(()=>{we(()=>t.nodeExtent,()=>{t.nodeExtent&&Ie(t.nodeExtent)&&n.setNodeExtent(t.nodeExtent)},{immediate:!0})})},d=()=>{o.run(()=>{we(()=>t.applyDefault,()=>{Ie(t.applyDefault)&&(n.applyDefault.value=t.applyDefault)},{immediate:!0})})},f=()=>{o.run(()=>{const g=async v=>{let w=v;typeof t.autoConnect=="function"&&(w=await t.autoConnect(v)),w!==!1&&n.addEdges([w])};we(()=>t.autoConnect,()=>{Ie(t.autoConnect)&&(n.autoConnect.value=t.autoConnect)},{immediate:!0}),we(n.autoConnect,(v,w,m)=>{v?n.onConnect(g):n.hooks.value.connect.off(g),m(()=>{n.hooks.value.connect.off(g)})},{immediate:!0})})},_=()=>{const g=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const v of Object.keys(t)){const w=v;if(!g.includes(w)){const m=Ce(()=>t[w]),h=n[w];No(h)&&o.run(()=>{we(m,b=>{Ie(b)&&(h.value=b)},{immediate:!0})})}}};(()=>{i(),r(),a(),u(),s(),l(),c(),d(),f(),_()})()}),()=>o.stop()}function md(){return{edgesChange:J(),nodesChange:J(),nodeDoubleClick:J(),nodeClick:J(),nodeMouseEnter:J(),nodeMouseMove:J(),nodeMouseLeave:J(),nodeContextMenu:J(),nodeDragStart:J(),nodeDrag:J(),nodeDragStop:J(),nodesInitialized:J(),miniMapNodeClick:J(),miniMapNodeDoubleClick:J(),miniMapNodeMouseEnter:J(),miniMapNodeMouseMove:J(),miniMapNodeMouseLeave:J(),connect:J(),connectStart:J(),connectEnd:J(),clickConnectStart:J(),clickConnectEnd:J(),paneReady:J(),init:J(),move:J(),moveStart:J(),moveEnd:J(),selectionDragStart:J(),selectionDrag:J(),selectionDragStop:J(),selectionContextMenu:J(),selectionStart:J(),selectionEnd:J(),viewportChangeStart:J(),viewportChange:J(),viewportChangeEnd:J(),paneScroll:J(),paneClick:J(),paneContextMenu:J(),paneMouseEnter:J(),paneMouseMove:J(),paneMouseLeave:J(),edgeContextMenu:J(),edgeMouseEnter:J(),edgeMouseMove:J(),edgeMouseLeave:J(),edgeDoubleClick:J(),edgeClick:J(),edgeUpdateStart:J(),edgeUpdate:J(),edgeUpdateEnd:J(),updateNodeInternals:J(),error:J(e=>Vn(e.message))}}function yd(e,t){ta(()=>{for(const[n,o]of Object.entries(t.value)){const i=r=>{e(n,r)};o.fns.add(i),An(()=>{o.off(i)})}})}function Hr(){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:zo.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:Zt.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:gt.Bezier,style:{}},connectionMode:St.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:$n()?"Meta":"Control",zoomActivationKeyCode:$n()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:md(),applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const wd=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function _d(e,t,n){const o=vd(e),i=N=>{const S=N??[];e.hooks.updateNodeInternals.trigger(S)},r=N=>Hc(N,e.nodes,e.edges),a=N=>Vc(N,e.nodes,e.edges),s=N=>$r(N,e.edges),u=({id:N,type:S,nodeId:E})=>{var k;return Array.from(((k=e.connectionLookup.get(`${E}-${S}-${N??null}`))==null?void 0:k.values())??[])},l=N=>{if(N)return t.value.get(N)},c=N=>{if(N)return n.value.get(N)},d=(N,S,E)=>{var k,B;const ee=[];for(const ne of N){const se={id:ne.id,type:"position",dragging:E,from:ne.from};if(S&&(se.position=ne.position,ne.parentNode)){const pe=l(ne.parentNode);se.position={x:se.position.x-(((k=pe==null?void 0:pe.computedPosition)==null?void 0:k.x)??0),y:se.position.y-(((B=pe==null?void 0:pe.computedPosition)==null?void 0:B.y)??0)}}ee.push(se)}ee!=null&&ee.length&&e.hooks.nodesChange.trigger(ee)},f=N=>{if(!e.vueFlowRef)return;const S=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!S)return;const E=window.getComputedStyle(S),{m22:k}=new window.DOMMatrixReadOnly(E.transform),B=[];for(let ee=0;ee{e.fitViewOnInitDone=!0}),B.length&&e.hooks.nodesChange.trigger(B)},_=(N,S)=>{const E=new Set,k=new Set;for(const ne of N)_t(ne)?E.add(ne.id):pt(ne)&&k.add(ne.id);const B=ht(t.value,E,!0),ee=ht(n.value,k);if(e.multiSelectionActive){for(const ne of E)B.push(dt(ne,S));for(const ne of k)ee.push(dt(ne,S))}B.length&&e.hooks.nodesChange.trigger(B),ee.length&&e.hooks.edgesChange.trigger(ee)},y=N=>{if(e.multiSelectionActive){const S=N.map(E=>dt(E.id,!0));e.hooks.nodesChange.trigger(S);return}e.hooks.nodesChange.trigger(ht(t.value,new Set(N.map(S=>S.id)),!0)),e.hooks.edgesChange.trigger(ht(n.value))},g=N=>{if(e.multiSelectionActive){const S=N.map(E=>dt(E.id,!0));e.hooks.edgesChange.trigger(S);return}e.hooks.edgesChange.trigger(ht(n.value,new Set(N.map(S=>S.id)))),e.hooks.nodesChange.trigger(ht(t.value,new Set,!0))},v=N=>{_(N,!0)},w=N=>{const E=(N||e.nodes).map(k=>(k.selected=!1,dt(k.id,!1)));e.hooks.nodesChange.trigger(E)},m=N=>{const E=(N||e.edges).map(k=>(k.selected=!1,dt(k.id,!1)));e.hooks.edgesChange.trigger(E)},h=N=>{if(!N||!N.length)return _([],!1);const S=N.reduce((E,k)=>{const B=dt(k.id,!1);return _t(k)?E.nodes.push(B):E.edges.push(B),E},{nodes:[],edges:[]});S.nodes.length&&e.hooks.nodesChange.trigger(S.nodes),S.edges.length&&e.hooks.edgesChange.trigger(S.edges)},b=N=>{var S;(S=e.d3Zoom)==null||S.scaleExtent([N,e.maxZoom]),e.minZoom=N},A=N=>{var S;(S=e.d3Zoom)==null||S.scaleExtent([e.minZoom,N]),e.maxZoom=N},O=N=>{var S;(S=e.d3Zoom)==null||S.translateExtent(N),e.translateExtent=N},L=N=>{e.nodeExtent=N,i()},X=N=>{var S;(S=e.d3Zoom)==null||S.clickDistance(N)},j=N=>{e.nodesDraggable=N,e.nodesConnectable=N,e.elementsSelectable=N},V=N=>{const S=N instanceof Function?N(e.nodes):N;!e.initialized&&!S.length||(e.nodes=xi(S,l,e.hooks.error.trigger))},U=N=>{const S=N instanceof Function?N(e.edges):N;if(!e.initialized&&!S.length)return;const E=Si(S,e.isValidConnection,l,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);bi(e.connectionLookup,E),e.edges=E},P=N=>{const S=N instanceof Function?N([...e.nodes,...e.edges]):N;!e.initialized&&!S.length||(V(S.filter(_t)),U(S.filter(pt)))},G=N=>{let S=N instanceof Function?N(e.nodes):N;S=Array.isArray(S)?S:[S];const E=xi(S,l,e.hooks.error.trigger),k=[];for(const B of E)k.push(fi(B));k.length&&e.hooks.nodesChange.trigger(k)},p=N=>{let S=N instanceof Function?N(e.edges):N;S=Array.isArray(S)?S:[S];const E=Si(S,e.isValidConnection,l,c,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),k=[];for(const B of E)k.push(fi(B));k.length&&e.hooks.edgesChange.trigger(k)},I=(N,S=!0,E=!1)=>{const k=N instanceof Function?N(e.nodes):N,B=Array.isArray(k)?k:[k],ee=[],ne=[];function se(_e){const be=s(_e);for(const Ee of be)(!Ie(Ee.deletable)||Ee.deletable)&&ne.push(pi(Ee.id,Ee.source,Ee.target,Ee.sourceHandle,Ee.targetHandle))}function pe(_e){const be=[];for(const Ee of e.nodes)Ee.parentNode===_e&&be.push(Ee);if(be.length){for(const Ee of be)ee.push(hi(Ee.id));S&&se(be);for(const Ee of be)pe(Ee.id)}}for(const _e of B){const be=typeof _e=="string"?l(_e):_e;be&&(Ie(be.deletable)&&!be.deletable||(ee.push(hi(be.id)),S&&se([be]),E&&pe(be.id)))}ne.length&&e.hooks.edgesChange.trigger(ne),ee.length&&e.hooks.nodesChange.trigger(ee)},T=N=>{const S=N instanceof Function?N(e.edges):N,E=Array.isArray(S)?S:[S],k=[];for(const B of E){const ee=typeof B=="string"?c(B):B;ee&&(Ie(ee.deletable)&&!ee.deletable||k.push(pi(typeof B=="string"?B:B.id,ee.source,ee.target,ee.sourceHandle,ee.targetHandle)))}e.hooks.edgesChange.trigger(k)},F=(N,S,E=!0)=>rd(N,S,e.edges,c,E,e.hooks.error.trigger),H=(N,S,E={replace:!1})=>{const k=c(N);if(!k)return;const B=typeof S=="function"?S(k):S;k.data=E.replace?B:{...k.data,...B}},Y=N=>di(N,e.nodes),W=N=>{const S=di(N,e.edges);return bi(e.connectionLookup,S),S},D=(N,S,E={replace:!1})=>{const k=l(N);if(!k)return;const B=typeof S=="function"?S(k):S;E.replace?e.nodes.splice(e.nodes.indexOf(k),1,B):Object.assign(k,B)},z=(N,S,E={replace:!1})=>{const k=l(N);if(!k)return;const B=typeof S=="function"?S(k):S;k.data=E.replace?B:{...k.data,...B}},M=(N,S,E=!1)=>{E?e.connectionClickStartHandle=N:e.connectionStartHandle=N,e.connectionEndHandle=null,e.connectionStatus=null,S&&(e.connectionPosition=S)},$=(N,S=null,E=null)=>{e.connectionStartHandle&&(e.connectionPosition=N,e.connectionEndHandle=S,e.connectionStatus=E)},oe=(N,S)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,S?e.connectionClickStartHandle=null:e.connectionStartHandle=null},ve=N=>{const S=Fc(N),E=S?null:Xt(N)?N:l(N.id);return!S&&!E?[null,null,S]:[S?N:xo(E),E,S]},he=(N,S=!0,E=e.nodes)=>{const[k,B,ee]=ve(N);if(!k)return[];const ne=[];for(const se of E||e.nodes){if(!ee&&(se.id===B.id||!se.computedPosition))continue;const pe=xo(se),_e=bo(pe,k);(S&&_e>0||_e>=Number(k.width)*Number(k.height))&&ne.push(se)}return ne},me=(N,S,E=!0)=>{const[k]=ve(N);if(!k)return!1;const B=bo(k,S);return E&&B>0||B>=Number(k.width)*Number(k.height)},ue=N=>{const{viewport:S,dimensions:E,d3Zoom:k,d3Selection:B,translateExtent:ee}=e;if(!k||!B||!N.x&&!N.y)return!1;const ne=Ot.translate(S.x+N.x,S.y+N.y).scale(S.zoom),se=[[0,0],[E.width,E.height]],pe=k.constrain()(ne,se,ee),_e=e.viewport.x!==pe.x||e.viewport.y!==pe.y||e.viewport.zoom!==pe.k;return k.transform(B,pe),_e},fe=N=>{const S=N instanceof Function?N(e):N,E=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Ie(S.defaultEdgeOptions)&&(e.defaultEdgeOptions=S.defaultEdgeOptions);const k=S.modelValue||S.nodes||S.edges?[]:void 0;k&&(S.modelValue&&k.push(...S.modelValue),S.nodes&&k.push(...S.nodes),S.edges&&k.push(...S.edges),P(k));const B=()=>{Ie(S.maxZoom)&&A(S.maxZoom),Ie(S.minZoom)&&b(S.minZoom),Ie(S.translateExtent)&&O(S.translateExtent)};for(const ee of Object.keys(S)){const ne=ee,se=S[ne];![...wd,...E].includes(ne)&&Ie(se)&&(e[ne]=se)}uo(()=>e.d3Zoom).not.toBeNull().then(B),e.initialized||(e.initialized=!0)};return{updateNodePositions:d,updateNodeDimensions:f,setElements:P,setNodes:V,setEdges:U,addNodes:G,addEdges:p,removeNodes:I,removeEdges:T,findNode:l,findEdge:c,updateEdge:F,updateEdgeData:H,updateNode:D,updateNodeData:z,applyEdgeChanges:W,applyNodeChanges:Y,addSelectedElements:v,addSelectedNodes:y,addSelectedEdges:g,setMinZoom:b,setMaxZoom:A,setTranslateExtent:O,setNodeExtent:L,setPaneClickDistance:X,removeSelectedElements:h,removeSelectedNodes:w,removeSelectedEdges:m,startConnection:M,updateConnection:$,endConnection:oe,setInteractive:j,setState:fe,getIntersectingNodes:he,getIncomers:r,getOutgoers:a,getConnectedEdges:s,getHandleConnections:u,isNodeIntersecting:me,panBy:ue,fitView:N=>o.value.fitView(N),zoomIn:N=>o.value.zoomIn(N),zoomOut:N=>o.value.zoomOut(N),zoomTo:(N,S)=>o.value.zoomTo(N,S),setViewport:(N,S)=>o.value.setViewport(N,S),setTransform:(N,S)=>o.value.setTransform(N,S),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(N,S,E)=>o.value.setCenter(N,S,E),fitBounds:(N,S)=>o.value.fitBounds(N,S),project:N=>o.value.project(N),screenToFlowCoordinate:N=>o.value.screenToFlowCoordinate(N),flowToScreenCoordinate:N=>o.value.flowToScreenCoordinate(N),toObject:()=>{const N=[],S=[];for(const E of e.nodes){const{computedPosition:k,handleBounds:B,selected:ee,dimensions:ne,isParent:se,resizing:pe,dragging:_e,events:be,...Ee}=E;N.push(Ee)}for(const E of e.edges){const{selected:k,sourceNode:B,targetNode:ee,events:ne,...se}=E;S.push(se)}return JSON.parse(JSON.stringify({nodes:N,edges:S,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:N=>new Promise(S=>{const{nodes:E,edges:k,position:B,zoom:ee,viewport:ne}=N;if(E&&V(E),k&&U(k),ne!=null&&ne.x&&(ne!=null&&ne.y)||B){const se=(ne==null?void 0:ne.x)||B[0],pe=(ne==null?void 0:ne.y)||B[1],_e=(ne==null?void 0:ne.zoom)||ee||e.viewport.zoom;return uo(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:se,y:pe,zoom:_e}).then(()=>{S(!0)})})}else S(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const N=Hr();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const S=Ot.translate(N.defaultViewport.x??0,N.defaultViewport.y??0).scale(Et(N.defaultViewport.zoom??1,N.minZoom,N.maxZoom)),E=e.viewportRef.getBoundingClientRect(),k=[[0,0],[E.width,E.height]],B=e.d3Zoom.constrain()(S,k,N.translateExtent);e.d3Zoom.transform(e.d3Selection,B)}fe(N)},$destroy:()=>{}}}const xd=["data-id","data-handleid","data-nodeid","data-handlepos"],bd={name:"Handle",compatConfig:{MODE:3}},$e=le({...bd,props:{id:{default:null},type:{},position:{default:()=>q.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=Mi(e,["position","connectable","connectableStart","connectableEnd","id"]),o=Ce(()=>n.type??"source"),i=Ce(()=>n.isValidConnection??null),{connectionStartHandle:r,connectionClickStartHandle:a,connectionEndHandle:s,vueFlowRef:u,nodesConnectable:l,noDragClassName:c,noPanClassName:d}=Ne(),{id:f,node:_,nodeEl:y,connectedEdges:g}=Lr(),v=K(),w=Ce(()=>typeof e.connectableStart<"u"?e.connectableStart:!0),m=Ce(()=>typeof e.connectableEnd<"u"?e.connectableEnd:!0),h=Ce(()=>{var V,U,P,G,p,I;return((V=r.value)==null?void 0:V.nodeId)===f&&((U=r.value)==null?void 0:U.handleId)===e.id&&((P=r.value)==null?void 0:P.type)===o.value||((G=s.value)==null?void 0:G.nodeId)===f&&((p=s.value)==null?void 0:p.handleId)===e.id&&((I=s.value)==null?void 0:I.type)===o.value}),b=Ce(()=>{var V,U,P;return((V=a.value)==null?void 0:V.nodeId)===f&&((U=a.value)==null?void 0:U.handleId)===e.id&&((P=a.value)==null?void 0:P.type)===o.value}),{handlePointerDown:A,handleClick:O}=Fr({nodeId:f,handleId:e.id,isValidConnection:i,type:o}),L=ce(()=>typeof e.connectable=="string"&&e.connectable==="single"?!g.value.some(V=>{const U=V[`${o.value}Handle`];return V[o.value]!==f?!1:U?U===e.id:!0}):typeof e.connectable=="number"?g.value.filter(V=>{const U=V[`${o.value}Handle`];return V[o.value]!==f?!1:U?U===e.id:!0}).length{var V;if(!_.dimensions.width||!_.dimensions.height)return;const U=(V=_.handleBounds[o.value])==null?void 0:V.find(H=>H.id===e.id);if(!u.value||U)return;const P=u.value.querySelector(".vue-flow__transformationpane");if(!y.value||!v.value||!P||!e.id)return;const G=y.value.getBoundingClientRect(),p=v.value.getBoundingClientRect(),I=window.getComputedStyle(P),{m22:T}=new window.DOMMatrixReadOnly(I.transform),F={id:e.id,position:e.position,x:(p.left-G.left)/T,y:(p.top-G.top)/T,...Fn(v.value)};_.handleBounds[o.value]=[..._.handleBounds[o.value]??[],F]}),Ti(()=>{const V=_.handleBounds[o.value];V&&(_.handleBounds[o.value]=V.filter(U=>U.id!==e.id))});function X(V){const U=Bo(V);L.value&&w.value&&(U&&V.button===0||!U)&&A(V)}function j(V){!f||!a.value&&!w.value||L.value&&O(V)}return t({handleClick:O,handlePointerDown:A,onClick:j,onPointerDown:X}),(V,U)=>(Z(),ae("div",{ref_key:"handle",ref:v,"data-id":`${x(f)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":x(f),"data-handlepos":V.position,class:Pt(["vue-flow__handle",[`vue-flow__handle-${V.position}`,`vue-flow__handle-${e.id}`,x(c),x(d),o.value,{connectable:L.value,connecting:b.value,connectablestart:w.value,connectableend:m.value,connectionindicator:L.value&&(w.value&&!h.value||m.value&&h.value)}]]),onMousedown:X,onTouchstartPassive:X,onClick:j},[qe(V.$slots,"default",{id:V.id})],42,xd))}}),Yn=function({sourcePosition:e=q.Bottom,targetPosition:t=q.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:a}){const s=a.label||n;return[xe($e,{type:"target",position:t,connectable:o,isValidConnection:i}),typeof s!="string"&&s?xe(s):xe(He,[s]),xe($e,{type:"source",position:e,connectable:o,isValidConnection:r})]};Yn.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"];Yn.inheritAttrs=!1;Yn.compatConfig={MODE:3};const Sd=Yn,Gn=function({targetPosition:e=q.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label||t;return[xe($e,{type:"target",position:e,connectable:n,isValidConnection:o}),typeof r!="string"&&r?xe(r):xe(He,[r])]};Gn.props=["targetPosition","label","isValidTargetPos","connectable","data"];Gn.inheritAttrs=!1;Gn.compatConfig={MODE:3};const Ed=Gn,Un=function({sourcePosition:e=q.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label||t;return[typeof r!="string"&&r?xe(r):xe(He,[r]),xe($e,{type:"source",position:e,connectable:n,isValidConnection:o})]};Un.props=["sourcePosition","label","isValidSourcePos","connectable","data"];Un.inheritAttrs=!1;Un.compatConfig={MODE:3};const Cd=Un,Nd=["transform"],kd=["width","height","x","y","rx","ry"],Id=["y"],$d={name:"EdgeText",compatConfig:{MODE:3}},Pd=le({...$d,props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=K({x:0,y:0,width:0,height:0}),n=K(null),o=ce(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);Xe(i),we([()=>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)=>(Z(),ae("g",{transform:o.value,class:"vue-flow__edge-textwrapper"},[r.labelShowBg?(Z(),ae("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:Qe(r.labelBgStyle),rx:r.labelBgBorderRadius,ry:r.labelBgBorderRadius},null,12,kd)):Te("",!0),re("text",ua(r.$attrs,{ref_key:"el",ref:n,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:r.labelStyle}),[qe(r.$slots,"default",{},()=>[typeof r.label!="string"?(Z(),ge(la(r.label),{key:0})):(Z(),ae(He,{key:1},[Q(ke(r.label),1)],64))])],16,Id)],8,Nd))}}),Md=["id","d","marker-end","marker-start"],Td=["d","stroke-width"],Dd={name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3}},Xn=le({...Dd,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=Mi(e,["interactionWidth","labelShowBg"]),o=K(null),i=K(null),r=K(null),a=sa();return t({pathEl:o,interactionEl:i,labelEl:r}),(s,u)=>(Z(),ae(He,null,[re("path",{id:s.id,ref_key:"pathEl",ref:o,d:s.path,style:Qe(n.style),class:Pt(["vue-flow__edge-path",x(a).class]),"marker-end":s.markerEnd,"marker-start":s.markerStart},null,14,Md),s.interactionWidth?(Z(),ae("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,Td)):Te("",!0),s.label&&s.labelX&&s.labelY?(Z(),ge(Pd,{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"])):Te("",!0)],64))}});function Yr({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n=0?.5*e:t*25*Math.sqrt(-e)}function Ci({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let a,s;switch(e){case q.Left:a=t-pn(t-o,r),s=n;break;case q.Right:a=t+pn(o-t,r),s=n;break;case q.Top:a=t,s=n-pn(n-i,r);break;case q.Bottom:a=t,s=n+pn(i-n,r);break}return[a,s]}function Ur(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:a=q.Top,curvature:s=.25}=e,[u,l]=Ci({pos:o,x1:t,y1:n,x2:i,y2:r,c:s}),[c,d]=Ci({pos:a,x1:i,y1:r,x2:t,y2:n,c:s}),[f,_,y,g]=Gr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${n} C${u},${l} ${c},${d} ${i},${r}`,f,_,y,g]}function Ni({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,a;switch(e){case q.Left:case q.Right:r=.5*(t+o),a=n;break;case q.Top:case q.Bottom:r=t,a=.5*(n+i);break}return[r,a]}function Xr(e){const{sourceX:t,sourceY:n,sourcePosition:o=q.Bottom,targetX:i,targetY:r,targetPosition:a=q.Top}=e,[s,u]=Ni({pos:o,x1:t,y1:n,x2:i,y2:r}),[l,c]=Ni({pos:a,x1:i,y1:r,x2:t,y2:n}),[d,f,_,y]=Gr({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${t},${n} C${s},${u} ${l},${c} ${i},${r}`,d,f,_,y]}const ki={[q.Left]:{x:-1,y:0},[q.Right]:{x:1,y:0},[q.Top]:{x:0,y:-1},[q.Bottom]:{x:0,y:1}};function Ad({source:e,sourcePosition:t=q.Bottom,target:n}){return t===q.Left||t===q.Right?e.xe[d]?-1:1)*p:w[d]=(l[d]>n[d]?-1:1)*p}}if(t!==o){const G=d==="x"?"y":"x",p=a[d]===s[G],I=u[G]>l[G],T=u[G]=P?(y=(j.x+V.x)/2,g=_[0].y):(y=_[0].x,g=(j.y+V.y)/2)}return[[e,{x:u.x+v.x,y:u.y+v.y},..._,{x:l.x+w.x,y:l.y+w.y},n],y,g,b,A]}function Od(e,t,n,o){const i=Math.min(Ii(e,t)/2,Ii(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 l=e.x{let b;return h>0&&h{const[n,o,i]=Bd(e);return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Fd=Rd,Ld=le({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]=Eo({...e,sourcePosition:e.sourcePosition??q.Bottom,targetPosition:e.targetPosition??q.Top});return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Wr=Ld,Vd=le({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup(e,{attrs:t}){return()=>xe(Wr,{...e,...t,borderRadius:0})}}),Hd=Vd,Yd=le({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]=Ur({...e,sourcePosition:e.sourcePosition??q.Bottom,targetPosition:e.targetPosition??q.Top});return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Gd=Yd,Ud=le({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]=Xr({...e,sourcePosition:e.sourcePosition??q.Bottom,targetPosition:e.targetPosition??q.Top});return xe(Xn,{path:n,labelX:o,labelY:i,...t,...e})}}}),Xd=Ud,Wd={input:Cd,default:Sd,output:Ed},Zd={default:Gd,straight:Fd,step:Hd,smoothstep:Wr,simplebezier:Xd};function Kd(e,t,n){const o=ce(()=>g=>t.value.get(g)),i=ce(()=>g=>n.value.get(g)),r=ce(()=>{const g={...Zd,...e.edgeTypes},v=Object.keys(g);for(const w of e.edges)w.type&&!v.includes(w.type)&&(g[w.type]=w.type);return g}),a=ce(()=>{const g={...Wd,...e.nodeTypes},v=Object.keys(g);for(const w of e.nodes)w.type&&!v.includes(w.type)&&(g[w.type]=w.type);return g}),s=ce(()=>e.onlyRenderVisibleElements?Ir(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=ce(()=>{if(e.onlyRenderVisibleElements){const g=[];for(const v of e.edges){const w=t.value.get(v.source),m=t.value.get(v.target);jc({sourcePos:w.computedPosition||{x:0,y:0},targetPos:m.computedPosition||{x:0,y:0},sourceWidth:w.dimensions.width,sourceHeight:w.dimensions.height,targetWidth:m.dimensions.width,targetHeight:m.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&g.push(v)}return g}return e.edges}),l=ce(()=>[...s.value,...u.value]),c=ce(()=>{const g=[];for(const v of e.nodes)v.selected&&g.push(v);return g}),d=ce(()=>{const g=[];for(const v of e.edges)v.selected&&g.push(v);return g}),f=ce(()=>[...c.value,...d.value]),_=ce(()=>{const g=[];for(const v of e.nodes)v.dimensions.width&&v.dimensions.height&&v.handleBounds!==void 0&&g.push(v);return g}),y=ce(()=>s.value.length>0&&_.value.length===s.value.length);return{getNode:o,getEdge:i,getElements:l,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:s,getSelectedElements:f,getSelectedNodes:c,getSelectedEdges:d,getNodesInitialized:_,areNodesInitialized:y}}class mt{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var t;const n=(t=on())==null?void 0:t.appContext.app,o=(n==null?void 0:n.config.globalProperties.$vueFlowStorage)??mt.instance;return mt.instance=o??new mt,n&&(n.config.globalProperties.$vueFlowStorage=mt.instance),mt.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=Hr(),i=na(o),r={};for(const[f,_]of Object.entries(i.hooks)){const y=`on${f.charAt(0).toUpperCase()+f.slice(1)}`;r[y]=_.on}const a={};for(const[f,_]of Object.entries(i.hooks))a[f]=_.trigger;const s=ce(()=>{const f=new Map;for(const _ of i.nodes)f.set(_.id,_);return f}),u=ce(()=>{const f=new Map;for(const _ of i.edges)f.set(_.id,_);return f}),l=Kd(i,s,u),c=_d(i,s,u);c.setState({...i,...n});const d={...r,...l,...c,...Qa(i),nodeLookup:s,edgeLookup:u,emits:a,id:t,vueFlowVersion:"1.41.5",$destroy:()=>{this.remove(t)}};return this.set(t,d),d}getId(){return`vue-flow-${this.currentId++}`}}function Ne(e){const t=mt.getInstance(),n=Ai(),o=typeof e=="object",i=o?e:{id:e},r=i.id,a=r??(n==null?void 0:n.vueFlowId);let s;if(n){const u=Bt(Ei,null);typeof u<"u"&&u!==null&&(!a||u.id===a)&&(s=u)}if(s||a&&(s=t.get(a)),!s||a&&s.id!==a){const u=r??t.getId(),l=t.create(u,i);s=l,(n??Di(!0)).run(()=>{we(l.applyDefault,(d,f,_)=>{const y=v=>{l.applyNodeChanges(v)},g=v=>{l.applyEdgeChanges(v)};d?(l.onNodesChange(y),l.onEdgesChange(g)):(l.hooks.value.nodesChange.off(y),l.hooks.value.edgesChange.off(g)),_(()=>{l.hooks.value.nodesChange.off(y),l.hooks.value.edgesChange.off(g)})},{immediate:!0}),An(()=>{if(s){const d=t.get(s.id);d?d.$destroy():Vn(`No store instance found for id ${s.id} in storage.`)}})})}else o&&s.setState(i);if(n&&(Mt(Ei,s),n.vueFlowId=s.id),o){const u=on();(u==null?void 0:u.type.name)!=="VueFlow"&&s.emits.error(new Me(Pe.USEVUEFLOW_OPTIONS))}return s}function qd(e){const{emits:t,dimensions:n}=Ne();let o;Xe(()=>{const i=e.value,r=()=>{if(!i)return;const a=Fn(i);(a.width===0||a.height===0)&&t.error(new Me(Pe.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:a.width||500,height:a.height||500}};r(),window.addEventListener("resize",r),i&&(o=new ResizeObserver(()=>r()),o.observe(i)),Tn(()=>{window.removeEventListener("resize",r),o&&i&&o.unobserve(i)})})}const jd={name:"UserSelection",compatConfig:{MODE:3}},Jd=le({...jd,props:{userSelectionRect:{}},setup(e){return(t,n)=>(Z(),ae("div",{class:"vue-flow__selection vue-flow__container",style:Qe({width:`${t.userSelectionRect.width}px`,height:`${t.userSelectionRect.height}px`,transform:`translate(${t.userSelectionRect.x}px, ${t.userSelectionRect.y}px)`})},null,4))}}),Qd=["tabIndex"],ef={name:"NodesSelection",compatConfig:{MODE:3}},tf=le({...ef,setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:a}=Ne(),s=Vr(),u=K(null),l=Rr({el:u,onStart(y){t.selectionDragStart(y)},onDrag(y){t.selectionDrag(y)},onStop(y){t.selectionDragStop(y)}});Xe(()=>{var y;r.value||(y=u.value)==null||y.focus({preventScroll:!0})});const c=ce(()=>kr(o.value)),d=ce(()=>({width:`${c.value.width}px`,height:`${c.value.height}px`,top:`${c.value.y}px`,left:`${c.value.x}px`}));function f(y){t.selectionContextMenu({event:y,nodes:o.value})}function _(y){r||$t[y.key]&&s({x:$t[y.key].x,y:$t[y.key].y},y.shiftKey)}return(y,g)=>!x(a)&&c.value.width&&c.value.height?(Z(),ae("div",{key:0,class:Pt(["vue-flow__nodesselection vue-flow__container",x(i)]),style:Qe({transform:`translate(${x(n).x}px,${x(n).y}px) scale(${x(n).zoom})`})},[re("div",{ref_key:"el",ref:u,class:Pt([{dragging:x(l)},"vue-flow__nodesselection-rect"]),style:Qe(d.value),tabIndex:x(r)?void 0:-1,onContextmenu:f,onKeydown:_},null,46,Qd)],6)):Te("",!0)}});function nf(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}const of={name:"Pane",compatConfig:{MODE:3}},rf=le({...of,props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:n,viewport:o,emits:i,userSelectionActive:r,removeSelectedElements:a,panOnDrag:s,userSelectionRect:u,elementsSelectable:l,nodesSelectionActive:c,getSelectedEdges:d,getSelectedNodes:f,removeNodes:_,removeEdges:y,selectionMode:g,deleteKeyCode:v,multiSelectionKeyCode:w,multiSelectionActive:m,edgeLookup:h,nodeLookup:b}=Ne(),A=K(null),O=K(0),L=K(0),X=K(),j=K(new Map),V=Ce(()=>l.value&&(e.isSelecting||r.value));let U=!1,P=!1;const G=Kt(v,{actInsideInputWithModifier:!1}),p=Kt(w);we(G,M=>{M&&(_(f.value),y(d.value),c.value=!1)}),we(p,M=>{m.value=M});function I(M,$){return oe=>{oe.target===$&&(M==null||M(oe))}}function T(){r.value=!1,u.value=null,O.value=0,L.value=0}function F(M){if(U){U=!1;return}i.paneClick(M),a(),c.value=!1}function H(M){var $;if(Array.isArray(s.value)&&(($=s.value)!=null&&$.includes(2))){M.preventDefault();return}i.paneContextMenu(M)}function Y(M){i.paneScroll(M)}function W(M){var $,oe,ve,he,me;if(X.value=($=t.value)==null?void 0:$.getBoundingClientRect(),!l.value||!e.isSelecting||M.button!==0||M.target!==A.value||!X.value)return;(ve=(oe=M.target)==null?void 0:oe.setPointerCapture)==null||ve.call(oe,M.pointerId);const{x:ue,y:fe}=nf(M,X.value);P=!0,U=!1,j.value=new Map;for(const[te,ie]of h.value)j.value.set(ie.source,((he=j.value.get(ie.source))==null?void 0:he.add(te))||new Set([te])),j.value.set(ie.target,((me=j.value.get(ie.target))==null?void 0:me.add(te))||new Set([te]));a(),u.value={width:0,height:0,startX:ue,startY:fe,x:ue,y:fe},i.selectionStart(M)}function D(M){if(!X.value||!u.value)return;U=!0;const{x:$,y:oe}=at(M,X.value),{startX:ve=0,startY:he=0}=u.value,me={startX:ve,startY:he,x:$0&&(c.value=!0),T(),i.selectionEnd(M),e.selectionKeyPressed&&(U=!1),P=!1)}return(M,$)=>(Z(),ae("div",{ref_key:"container",ref:A,class:Pt(["vue-flow__pane vue-flow__container",{selection:M.isSelecting}]),onClick:$[0]||($[0]=oe=>V.value?void 0:I(F,A.value)(oe)),onContextmenu:$[1]||($[1]=oe=>I(H,A.value)(oe)),onWheelPassive:$[2]||($[2]=oe=>I(Y,A.value)(oe)),onPointerenter:$[3]||($[3]=oe=>V.value?void 0:x(i).paneMouseEnter(oe)),onPointerdown:$[4]||($[4]=oe=>V.value?W(oe):x(i).paneMouseMove(oe)),onPointermove:$[5]||($[5]=oe=>V.value?D(oe):x(i).paneMouseMove(oe)),onPointerup:$[6]||($[6]=oe=>V.value?z(oe):void 0),onPointerleave:$[7]||($[7]=oe=>x(i).paneMouseLeave(oe))},[qe(M.$slots,"default"),x(r)&&x(u)?(Z(),ge(Jd,{key:0,"user-selection-rect":x(u)},null,8,["user-selection-rect"])):Te("",!0),x(c)&&x(f).length?(Z(),ge(tf,{key:1})):Te("",!0)],34))}}),af={name:"Transform",compatConfig:{MODE:3}},sf=le({...af,setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=Ne(),i=ce(()=>n.value?!o.value:!1),r=ce(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(a,s)=>(Z(),ae("div",{class:"vue-flow__transformationpane vue-flow__container",style:Qe({transform:r.value,opacity:i.value?0:void 0})},[qe(a.$slots,"default")],4))}}),lf={name:"Viewport",compatConfig:{MODE:3}},uf=le({...lf,setup(e){const{minZoom:t,maxZoom:n,defaultViewport:o,translateExtent:i,zoomActivationKeyCode:r,selectionKeyCode:a,panActivationKeyCode:s,panOnScroll:u,panOnScrollMode:l,panOnScrollSpeed:c,panOnDrag:d,zoomOnDoubleClick:f,zoomOnPinch:_,zoomOnScroll:y,preventScrolling:g,noWheelClassName:v,noPanClassName:w,emits:m,connectionStartHandle:h,userSelectionActive:b,paneDragging:A,d3Zoom:O,d3Selection:L,d3ZoomHandler:X,viewport:j,viewportRef:V,paneClickDistance:U}=Ne();qd(V);const P=K(!1),G=K(!1);let p=null,I=!1,T=0,F={x:0,y:0,zoom:0};const H=Kt(s),Y=Kt(a),W=Kt(r),D=Ce(()=>(!Y.value||Y.value&&a.value===!0)&&(H.value||d.value)),z=Ce(()=>H.value||u.value),M=Ce(()=>Y.value||a.value===!0&&D.value!==!0);Xe(()=>{if(!V.value){Vn("Viewport element is missing");return}const ue=V.value,fe=ue.getBoundingClientRect(),te=Ac().clickDistance(U.value).scaleExtent([t.value,n.value]).translateExtent(i.value),ie=Ge(ue).call(te),de=ie.on("wheel.zoom"),N=Ot.translate(o.value.x??0,o.value.y??0).scale(Et(o.value.zoom??1,t.value,n.value)),S=[[0,0],[fe.width,fe.height]],E=te.constrain()(N,S,i.value);te.transform(ie,E),te.wheelDelta(oe),O.value=te,L.value=ie,X.value=de,j.value={x:E.x,y:E.y,zoom:E.k},te.on("start",k=>{var B;if(!k.sourceEvent)return null;T=k.sourceEvent.button,P.value=!0;const ee=he(k.transform);((B=k.sourceEvent)==null?void 0:B.type)==="mousedown"&&(A.value=!0),F=ee,m.viewportChangeStart(ee),m.moveStart({event:k,flowTransform:ee})}),te.on("end",k=>{if(!k.sourceEvent)return null;if(P.value=!1,A.value=!1,$(D.value,T??0)&&!I&&m.paneContextMenu(k.sourceEvent),I=!1,ve(F,k.transform)){const B=he(k.transform);F=B,m.viewportChangeEnd(B),m.moveEnd({event:k,flowTransform:B})}}),te.filter(k=>{var B,ee,ne;const se=W.value||y.value,pe=_.value&&k.ctrlKey,_e=k.button;if((D.value===!0||Array.isArray(D.value)&&D.value.includes(1))&&_e===1&&k.type==="mousedown"&&((B=k.target)!=null&&B.closest(".vue-flow__node")||(ee=k.target)!=null&&ee.closest(".vue-flow__edge")))return!0;if(!D.value&&!se&&!z.value&&!f.value&&!_.value||b.value||!f.value&&k.type==="dblclick"||me(k,v.value)&&k.type==="wheel"||me(k,w.value)&&(k.type!=="wheel"||z.value&&k.type==="wheel"&&!W.value)||!_.value&&k.ctrlKey&&k.type==="wheel"||!se&&!z.value&&!pe&&k.type==="wheel")return!1;if(!_&&k.type==="touchstart"&&((ne=k.touches)==null?void 0:ne.length)>1)return k.preventDefault(),!1;if(!D.value&&(k.type==="mousedown"||k.type==="touchstart")||a.value===!0&&Array.isArray(d.value)&&d.value.includes(0)&&_e===0||Array.isArray(D.value)&&!D.value.includes(_e)&&(k.type==="mousedown"||k.type==="touchstart"))return!1;const be=Array.isArray(D.value)&&D.value.includes(_e)||a.value===!0&&Array.isArray(D.value)&&!D.value.includes(0)||!_e||_e<=1;return(!k.ctrlKey||k.type==="wheel")&&be}),we([b,D],()=>{b.value&&!P.value?te.on("zoom",null):b.value||te.on("zoom",k=>{j.value={x:k.transform.x,y:k.transform.y,zoom:k.transform.k};const B=he(k.transform);I=$(D.value,T??0),m.viewportChange(B),m.move({event:k,flowTransform:B})})},{immediate:!0}),we([b,z,l,W,_,g,v],()=>{z.value&&!W.value&&!b.value?ie.on("wheel.zoom",k=>{if(me(k,v.value))return!1;const B=W.value||y.value,ee=_.value&&k.ctrlKey;if(!(!g.value||z.value||B||ee))return!1;k.preventDefault(),k.stopImmediatePropagation();const se=ie.property("__zoom").k||1,pe=$n();if(k.ctrlKey&&_.value&&pe){const Ft=Ke(k),Jr=oe(k),Qr=se*2**Jr;te.scaleTo(ie,Qr,Ft,k);return}const _e=k.deltaMode===1?20:1;let be=l.value===Zt.Vertical?0:k.deltaX*_e,Ee=l.value===Zt.Horizontal?0:k.deltaY*_e;!pe&&k.shiftKey&&l.value!==Zt.Vertical&&!be&&Ee&&(be=Ee,Ee=0),te.translateBy(ie,-(be/se)*c.value,-(Ee/se)*c.value);const Ze=he(ie.property("__zoom"));p&&clearTimeout(p),G.value?(m.move({event:k,flowTransform:Ze}),m.viewportChange(Ze),p=setTimeout(()=>{m.moveEnd({event:k,flowTransform:Ze}),m.viewportChangeEnd(Ze),G.value=!1},150)):(G.value=!0,m.moveStart({event:k,flowTransform:Ze}),m.viewportChangeStart(Ze))},{passive:!1}):typeof de<"u"&&ie.on("wheel.zoom",function(k,B){const ee=!g.value&&k.type==="wheel"&&!k.ctrlKey,ne=W.value||y.value,se=_.value&&k.ctrlKey;if(!ne&&!u.value&&!se&&k.type==="wheel"||ee||me(k,v.value))return null;k.preventDefault(),de.call(this,k,B)},{passive:!1})},{immediate:!0})});function $(ue,fe){return fe===2&&Array.isArray(ue)&&ue.includes(2)}function oe(ue){const fe=ue.ctrlKey&&$n()?10:1;return-ue.deltaY*(ue.deltaMode===1?.05:ue.deltaMode?1:.002)*fe}function ve(ue,fe){return ue.x!==fe.x&&!Number.isNaN(fe.x)||ue.y!==fe.y&&!Number.isNaN(fe.y)||ue.zoom!==fe.k&&!Number.isNaN(fe.k)}function he(ue){return{x:ue.x,y:ue.y,zoom:ue.k}}function me(ue,fe){return ue.target.closest(`.${fe}`)}return(ue,fe)=>(Z(),ae("div",{ref_key:"viewportRef",ref:V,class:"vue-flow__viewport vue-flow__container"},[C(rf,{"is-selecting":M.value,"selection-key-pressed":x(Y),class:Pt({connecting:!!x(h),dragging:x(A),draggable:x(d)===!0||Array.isArray(x(d))&&x(d).includes(0)})},{default:R(()=>[C(sf,null,{default:R(()=>[qe(ue.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),cf=["id"],df=["id"],ff=["id"],hf={name:"A11yDescriptions",compatConfig:{MODE:3}},pf=le({...hf,setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=Ne();return(i,r)=>(Z(),ae(He,null,[re("div",{id:`${x(yr)}-${x(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+ke(x(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,cf),re("div",{id:`${x(wr)}-${x(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,df),x(n)?Te("",!0):(Z(),ae("div",{key:0,id:`${x(Rc)}-${x(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%)"}},ke(x(o)),9,ff))],64))}});function vf(){const e=Ne();we(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}function gf(e,t,n){return n===q.Left?e-t:n===q.Right?e+t:e}function mf(e,t,n){return n===q.Top?e-t:n===q.Bottom?e+t:e}const Fo=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=q.Top,type:i}){return xe("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:gf(t,e,o),cy:mf(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Fo.props=["radius","centerX","centerY","position","type"];Fo.compatConfig={MODE:3};const $i=Fo,yf=le({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:l,findEdge:c,findNode:d,isValidConnection:f,multiSelectionActive:_,disableKeyboardA11y:y,elementsSelectable:g,edgesUpdatable:v,edgesFocusable:w,hooks:m}=Ne(),h=ce(()=>c(e.id)),{emit:b,on:A}=ud(h.value,r),O=Bt(Hn),L=on(),X=K(!1),j=K(!1),V=K(""),U=K(null),P=K("source"),G=K(null),p=Ce(()=>typeof h.value.selectable>"u"?g.value:h.value.selectable),I=Ce(()=>typeof h.value.updatable>"u"?v.value:h.value.updatable),T=Ce(()=>typeof h.value.focusable>"u"?w.value:h.value.focusable);Mt(ad,e.id),Mt(sd,G);const F=ce(()=>h.value.class instanceof Function?h.value.class(h.value):h.value.class),H=ce(()=>h.value.style instanceof Function?h.value.style(h.value):h.value.style),Y=ce(()=>{const S=h.value.type||"default",E=O==null?void 0:O[`edge-${S}`];if(E)return E;let k=h.value.template??u.value[S];if(typeof k=="string"&&L){const B=Object.keys(L.appContext.components);B&&B.includes(S)&&(k=Wt(S,!1))}return k&&typeof k!="string"?k:(r.error(new Me(Pe.EDGE_TYPE_MISSING,k)),!1)}),{handlePointerDown:W}=Fr({nodeId:V,handleId:U,type:P,isValidConnection:f,edgeUpdaterType:P,onEdgeUpdate:M,onEdgeUpdateEnd:$});return()=>{const S=d(h.value.source),E=d(h.value.target),k="pathOptions"in h.value?h.value.pathOptions:{};if(!S&&!E)return r.error(new Me(Pe.EDGE_SOURCE_TARGET_MISSING,h.value.id,h.value.source,h.value.target)),null;if(!S)return r.error(new Me(Pe.EDGE_SOURCE_MISSING,h.value.id,h.value.source)),null;if(!E)return r.error(new Me(Pe.EDGE_TARGET_MISSING,h.value.id,h.value.target)),null;if(!h.value||h.value.hidden||S.hidden||E.hidden)return null;let B;o.value===St.Strict?B=S.handleBounds.source:B=[...S.handleBounds.source||[],...S.handleBounds.target||[]];const ee=gi(B,h.value.sourceHandle);let ne;o.value===St.Strict?ne=E.handleBounds.target:ne=[...E.handleBounds.target||[],...E.handleBounds.source||[]];const se=gi(ne,h.value.targetHandle),pe=(ee==null?void 0:ee.position)||q.Bottom,_e=(se==null?void 0:se.position)||q.Top,{x:be,y:Ee}=In(S,ee,pe),{x:Ze,y:Ft}=In(E,se,_e);return h.value.sourceX=be,h.value.sourceY=Ee,h.value.targetX=Ze,h.value.targetY=Ft,xe("g",{ref:G,key:e.id,"data-id":e.id,class:["vue-flow__edge",`vue-flow__edge-${Y.value===!1?"default":h.value.type||"default"}`,s.value,F.value,{updating:X.value,selected:h.value.selected,animated:h.value.animated,inactive:!p.value&&!m.value.edgeClick.hasListeners()}],onClick:ve,onContextmenu:he,onDblclick:me,onMouseenter:ue,onMousemove:fe,onMouseleave:te,onKeyDown:T.value?N:void 0,tabIndex:T.value?0:void 0,"aria-label":h.value.ariaLabel===null?void 0:h.value.ariaLabel||`Edge from ${h.value.source} to ${h.value.target}`,"aria-describedby":T.value?`${wr}-${t}`:void 0,role:T.value?"button":"img"},[j.value?null:xe(Y.value===!1?u.value.default:Y.value,{id:e.id,sourceNode:S,targetNode:E,source:h.value.source,target:h.value.target,type:h.value.type,updatable:I.value,selected:h.value.selected,animated:h.value.animated,label:h.value.label,labelStyle:h.value.labelStyle,labelShowBg:h.value.labelShowBg,labelBgStyle:h.value.labelBgStyle,labelBgPadding:h.value.labelBgPadding,labelBgBorderRadius:h.value.labelBgBorderRadius,data:h.value.data,events:{...h.value.events,...A},style:H.value,markerStart:`url('#${nn(h.value.markerStart,t)}')`,markerEnd:`url('#${nn(h.value.markerEnd,t)}')`,sourcePosition:pe,targetPosition:_e,sourceX:be,sourceY:Ee,targetX:Ze,targetY:Ft,sourceHandleId:h.value.sourceHandle,targetHandleId:h.value.targetHandle,interactionWidth:h.value.interactionWidth,...k}),[I.value==="source"||I.value===!0?[xe("g",{onMousedown:ie,onMouseenter:D,onMouseout:z},xe($i,{position:pe,centerX:be,centerY:Ee,radius:i.value,type:"source","data-type":"source"}))]:null,I.value==="target"||I.value===!0?[xe("g",{onMousedown:de,onMouseenter:D,onMouseout:z},xe($i,{position:_e,centerX:Ze,centerY:Ft,radius:i.value,type:"target","data-type":"target"}))]:null]])};function D(){X.value=!0}function z(){X.value=!1}function M(S,E){b.update({event:S,edge:h.value,connection:E})}function $(S){b.updateEnd({event:S,edge:h.value}),j.value=!1}function oe(S,E){S.button===0&&(j.value=!0,V.value=E?h.value.target:h.value.source,U.value=(E?h.value.targetHandle:h.value.sourceHandle)??"",P.value=E?"target":"source",b.updateStart({event:S,edge:h.value}),W(S))}function ve(S){var E;const k={event:S,edge:h.value};p.value&&(a.value=!1,h.value.selected&&_.value?(l([h.value]),(E=G.value)==null||E.blur()):n([h.value])),b.click(k)}function he(S){b.contextMenu({event:S,edge:h.value})}function me(S){b.doubleClick({event:S,edge:h.value})}function ue(S){b.mouseEnter({event:S,edge:h.value})}function fe(S){b.mouseMove({event:S,edge:h.value})}function te(S){b.mouseLeave({event:S,edge:h.value})}function ie(S){oe(S,!0)}function de(S){oe(S,!1)}function N(S){var E;!y.value&&_r.includes(S.key)&&p.value&&(S.key==="Escape"?((E=G.value)==null||E.blur(),l([c(e.id)])):n([c(e.id)]))}}}),wf=yf,_f={[q.Left]:q.Right,[q.Right]:q.Left,[q.Top]:q.Bottom,[q.Bottom]:q.Top},xf=le({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:l,viewport:c,findNode:d}=Ne(),f=(e=Bt(Hn))==null?void 0:e["connection-line"],_=ce(()=>{var m;return d((m=o.value)==null?void 0:m.nodeId)}),y=ce(()=>{var m;return d((m=i.value)==null?void 0:m.nodeId)??null}),g=ce(()=>({x:(r.value.x-c.value.x)/c.value.zoom,y:(r.value.y-c.value.y)/c.value.zoom})),v=ce(()=>u.value.markerStart?`url(#${nn(u.value.markerStart,t)})`:""),w=ce(()=>u.value.markerEnd?`url(#${nn(u.value.markerEnd,t)})`:"");return()=>{var m,h,b,A;if(!_.value||!o.value)return null;const O=o.value.handleId,L=o.value.type,X=_.value.handleBounds;let j=(X==null?void 0:X[L])||[];if(n.value===St.Loose){const Y=(X==null?void 0:X[L==="source"?"target":"source"])||[];j=[...j,...Y]}if(!j)return null;const V=(O?j.find(Y=>Y.id===O):j[0])??null,U=(V==null?void 0:V.position)||q.Top,{x:P,y:G}=In(_.value,V,U);let p=null;y.value&&((m=i.value)!=null&&m.handleId)&&(n.value===St.Strict?p=((h=y.value.handleBounds[L==="source"?"target":"source"])==null?void 0:h.find(Y=>{var W;return Y.id===((W=i.value)==null?void 0:W.handleId)}))||null:p=((b=[...y.value.handleBounds.source||[],...y.value.handleBounds.target||[]])==null?void 0:b.find(Y=>{var W;return Y.id===((W=i.value)==null?void 0:W.handleId)}))||null);const I=((A=i.value)==null?void 0:A.position)??(U?_f[U]:null);if(!U||!I)return null;const T=a.value??u.value.type??gt.Bezier;let F="";const H={sourceX:P,sourceY:G,sourcePosition:U,targetX:g.value.x,targetY:g.value.y,targetPosition:I};return T===gt.Bezier?[F]=Ur(H):T===gt.Step?[F]=Eo({...H,borderRadius:0}):T===gt.SmoothStep?[F]=Eo(H):T===gt.SimpleBezier?[F]=Xr(H):F=`M${P},${G} ${g.value.x},${g.value.y}`,xe("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},xe("g",{class:"vue-flow__connection"},f?xe(f,{sourceX:P,sourceY:G,sourcePosition:U,targetX:g.value.x,targetY:g.value.y,targetPosition:I,sourceNode:_.value,sourceHandle:V,targetNode:y.value,targetHandle:p,markerEnd:w.value,markerStart:v.value,connectionStatus:l.value}):xe("path",{d:F,class:[u.value.class,l,"vue-flow__connection-path"],style:{...s.value,...u.value.style},"marker-end":w.value,"marker-start":v.value})))}}}),bf=xf,Sf=["id","markerWidth","markerHeight","markerUnits","orient"],Ef={name:"MarkerType",compatConfig:{MODE:3}},Cf=le({...Ef,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)=>(Z(),ae("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===x(wo).ArrowClosed?(Z(),ae("polyline",{key:0,style:Qe({stroke:t.color,fill:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):Te("",!0),t.type===x(wo).Arrow?(Z(),ae("polyline",{key:1,style:Qe({stroke:t.color,strokeWidth:t.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):Te("",!0)],8,Sf))}}),Nf={class:"vue-flow__marker vue-flow__container"},kf={name:"MarkerDefinitions",compatConfig:{MODE:3}},If=le({...kf,setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=Ne(),r=ce(()=>{const a=new Set,s=[],u=l=>{if(l){const c=nn(l,t);a.has(c)||(typeof l=="object"?s.push({...l,id:c,color:l.color||i.value}):s.push({id:c,color:i.value,type:l}),a.add(c))}};for(const l of[o.value.markerEnd,o.value.markerStart])u(l);for(const l of n.value)for(const c of[l.markerStart,l.markerEnd])u(c);return s.sort((l,c)=>l.id.localeCompare(c.id))});return(a,s)=>(Z(),ae("svg",Nf,[re("defs",null,[(Z(!0),ae(He,null,Mn(r.value,u=>(Z(),ge(Cf,{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))])]))}}),$f={name:"Edges",compatConfig:{MODE:3}},Pf=le({...$f,setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=Ne();return(i,r)=>(Z(),ae(He,null,[C(If),(Z(!0),ae(He,null,Mn(x(n),a=>(Z(),ae("svg",{key:a.id,class:"vue-flow__edges vue-flow__container",style:Qe({zIndex:x(Jc)(a,x(t),x(o))})},[C(x(wf),{id:a.id},null,8,["id"])],4))),128)),C(x(bf))],64))}}),Mf=le({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:l,onUpdateNodeInternals:c,getNodeTypes:d,nodeExtent:f,elevateNodesOnSelect:_,disableKeyboardA11y:y,ariaLiveMessage:g,snapToGrid:v,snapGrid:w,nodeDragThreshold:m,nodesDraggable:h,elementsSelectable:b,nodesConnectable:A,nodesFocusable:O,hooks:L}=Ne(),X=K(null);Mt(Br,X),Mt(Or,e.id);const j=Bt(Hn),V=on(),U=Vr(),{node:P,parentNode:G}=Lr(e.id),{emit:p,on:I}=hd(P,a),T=Ce(()=>typeof P.draggable>"u"?h.value:P.draggable),F=Ce(()=>typeof P.selectable>"u"?b.value:P.selectable),H=Ce(()=>typeof P.connectable>"u"?A.value:P.connectable),Y=Ce(()=>typeof P.focusable>"u"?O.value:P.focusable),W=Ce(()=>F.value||T.value||L.value.nodeClick.hasListeners()||L.value.nodeDoubleClick.hasListeners()||L.value.nodeMouseEnter.hasListeners()||L.value.nodeMouseMove.hasListeners()||L.value.nodeMouseLeave.hasListeners()),D=Ce(()=>!!P.dimensions.width&&!!P.dimensions.height),z=ce(()=>{const E=P.type||"default",k=j==null?void 0:j[`node-${E}`];if(k)return k;let B=P.template||d.value[E];if(typeof B=="string"&&V){const ee=Object.keys(V.appContext.components);ee&&ee.includes(E)&&(B=Wt(E,!1))}return B&&typeof B!="string"?B:(a.error(new Me(Pe.NODE_TYPE_MISSING,B)),!1)}),M=Rr({id:e.id,el:X,disabled:()=>!T.value,selectable:F,dragHandle:()=>P.dragHandle,onStart(E){p.dragStart(E)},onDrag(E){p.drag(E)},onStop(E){p.dragStop(E)},onClick(E){N(E)}}),$=ce(()=>P.class instanceof Function?P.class(P):P.class),oe=ce(()=>{const E=(P.style instanceof Function?P.style(P):P.style)||{},k=P.width instanceof Function?P.width(P):P.width,B=P.height instanceof Function?P.height(P):P.height;return!E.width&&k&&(E.width=typeof k=="string"?k:`${k}px`),!E.height&&B&&(E.height=typeof B=="string"?B:`${B}px`),E}),ve=Ce(()=>Number(P.zIndex??oe.value.zIndex??0));return c(E=>{(E.includes(e.id)||!E.length)&&me()}),Xe(()=>{we(()=>P.hidden,(E=!1,k,B)=>{!E&&X.value&&(e.resizeObserver.observe(X.value),B(()=>{X.value&&e.resizeObserver.unobserve(X.value)}))},{immediate:!0,flush:"post"})}),we([()=>P.type,()=>P.sourcePosition,()=>P.targetPosition],()=>{je(()=>{l([{id:e.id,nodeElement:X.value,forceUpdate:!0}])})}),we([()=>P.position.x,()=>P.position.y,()=>{var E;return(E=G.value)==null?void 0:E.computedPosition.x},()=>{var E;return(E=G.value)==null?void 0:E.computedPosition.y},()=>{var E;return(E=G.value)==null?void 0:E.computedPosition.z},ve,()=>P.selected,()=>P.dimensions.height,()=>P.dimensions.width,()=>{var E;return(E=G.value)==null?void 0:E.dimensions.height},()=>{var E;return(E=G.value)==null?void 0:E.dimensions.width}],([E,k,B,ee,ne,se])=>{const pe={x:E,y:k,z:se+(_.value&&P.selected?1e3:0)};typeof B<"u"&&typeof ee<"u"?P.computedPosition=Xc({x:B,y:ee,z:ne},pe):P.computedPosition=pe},{flush:"post",immediate:!0}),we([()=>P.extent,f],([E,k],[B,ee])=>{(E!==B||k!==ee)&&he()}),P.extent==="parent"||typeof P.extent=="object"&&"range"in P.extent&&P.extent.range==="parent"?uo(()=>D).toBe(!0).then(he):he(),()=>P.hidden?null:xe("div",{ref:X,"data-id":P.id,class:["vue-flow__node",`vue-flow__node-${z.value===!1?"default":P.type||"default"}`,{[n.value]:T.value,dragging:M==null?void 0:M.value,draggable:T.value,selected:P.selected,selectable:F.value,parent:P.isParent},$.value],style:{visibility:D.value?"visible":"hidden",zIndex:P.computedPosition.z??ve.value,transform:`translate(${P.computedPosition.x}px,${P.computedPosition.y}px)`,pointerEvents:W.value?"all":"none",...oe.value},tabIndex:Y.value?0:void 0,role:Y.value?"button":void 0,"aria-describedby":y.value?void 0:`${yr}-${t}`,"aria-label":P.ariaLabel,onMouseenter:ue,onMousemove:fe,onMouseleave:te,onContextmenu:ie,onClick:N,onDblclick:de,onKeydown:S},[xe(z.value===!1?d.value.default:z.value,{id:P.id,type:P.type,data:P.data,events:{...P.events,...I},selected:P.selected,resizing:P.resizing,dragging:M.value,connectable:H.value,position:P.computedPosition,dimensions:P.dimensions,isValidTargetPos:P.isValidTargetPos,isValidSourcePos:P.isValidSourcePos,parent:P.parentNode,parentNodeId:P.parentNode,zIndex:P.computedPosition.z??ve.value,targetPosition:P.targetPosition,sourcePosition:P.sourcePosition,label:P.label,dragHandle:P.dragHandle,onUpdateNodeInternals:me})]);function he(){const E=P.computedPosition,{computedPosition:k,position:B}=Oo(P,v.value?Ln(E,w.value):E,a.error,f.value,G.value);(P.computedPosition.x!==k.x||P.computedPosition.y!==k.y)&&(P.computedPosition={...P.computedPosition,...k}),(P.position.x!==B.x||P.position.y!==B.y)&&(P.position=B)}function me(){X.value&&l([{id:e.id,nodeElement:X.value,forceUpdate:!0}])}function ue(E){M!=null&&M.value||p.mouseEnter({event:E,node:P})}function fe(E){M!=null&&M.value||p.mouseMove({event:E,node:P})}function te(E){M!=null&&M.value||p.mouseLeave({event:E,node:P})}function ie(E){return p.contextMenu({event:E,node:P})}function de(E){return p.doubleClick({event:E,node:P})}function N(E){F.value&&(!o.value||!T.value||m.value>0)&&So(P,r.value,u,s,i,!1,X.value),p.click({event:E,node:P})}function S(E){if(!(_o(E)||y.value))if(_r.includes(E.key)&&F.value){const k=E.key==="Escape";So(P,r.value,u,s,i,k,X.value)}else T.value&&P.selected&&$t[E.key]&&(g.value=`Moved selected node ${E.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~P.position.x}, y: ${~~P.position.y}`,U({x:$t[E.key].x,y:$t[E.key].y},E.shiftKey))}}}),Tf=Mf;function Df(e={includeHiddenNodes:!1}){const{nodes:t}=Ne();return ce(()=>{if(t.value.length===0)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&((n==null?void 0:n.handleBounds)===void 0||n.dimensions.width===0||n.dimensions.height===0))return!1;return!0})}const Af={class:"vue-flow__nodes vue-flow__container"},zf={name:"Nodes",compatConfig:{MODE:3}},Of=le({...zf,setup(e){const{getNodes:t,updateNodeDimensions:n,emits:o}=Ne(),i=Df(),r=K();return we(i,a=>{a&&je(()=>{o.nodesInitialized(t.value)})},{immediate:!0}),Xe(()=>{r.value=new ResizeObserver(a=>{const s=a.map(u=>({id:u.target.getAttribute("data-id"),nodeElement:u.target,forceUpdate:!0}));je(()=>n(s))})}),Tn(()=>{var a;return(a=r.value)==null?void 0:a.disconnect()}),(a,s)=>(Z(),ae("div",Af,[r.value?(Z(!0),ae(He,{key:0},Mn(x(t),(u,l,c,d)=>{const f=[u.id];if(d&&d.key===u.id&&oa(d,f))return d;const _=(Z(),ge(x(Tf),{id:u.id,key:u.id,"resize-observer":r.value},null,8,["id","resize-observer"]));return _.memo=f,_},s,0),128)):Te("",!0)]))}});function Bf(){const{emits:e}=Ne();Xe(()=>{if(zr()){const t=document.querySelector(".vue-flow__pane");t&&window.getComputedStyle(t).zIndex!=="1"&&e.error(new Me(Pe.MISSING_STYLES))}})}const Rf=re("div",{class:"vue-flow__edge-labels"},null,-1),Ff={name:"VueFlow",compatConfig:{MODE:3}},Lf=le({...Ff,props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:n}){const o=e,i=ea(),r=Kn(o,"modelValue",n),a=Kn(o,"nodes",n),s=Kn(o,"edges",n),u=Ne(o),l=gd({modelValue:r,nodes:a,edges:s},o,u);return yd(n,u.hooks),vf(),Bf(),Mt(Hn,i),Ti(()=>{l()}),t(u),(c,d)=>(Z(),ae("div",{ref:x(u).vueFlowRef,class:"vue-flow"},[C(uf,null,{default:R(()=>[C(Pf),Rf,C(Of),qe(c.$slots,"zoom-pane")]),_:3}),qe(c.$slots,"default"),C(pf)],512))}});var rt=(e=>(e.Lines="lines",e.Dots="dots",e))(rt||{});const Zr=function({dimensions:e,size:t,color:n}){return xe("path",{stroke:n,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},Kr=function({radius:e,color:t}){return xe("circle",{cx:e,cy:e,r:e,fill:t})};rt.Lines+"",rt.Dots+"";const Vf={[rt.Dots]:"#81818a",[rt.Lines]:"#eee"},Hf=["id","x","y","width","height","patternTransform"],Yf={key:2,height:"100",width:"100"},Gf=["fill"],Uf=["x","y","fill"],Xf={name:"Background",compatConfig:{MODE:3}},Wf=le({...Xf,props:{id:{},variant:{default:()=>rt.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:n}=Ne(),o=ce(()=>{const a=n.value.zoom,[s,u]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],l=[s*a||1,u*a||1],c=e.size*a,[d,f]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset],_=[d*a||1+l[0]/2,f*a||1+l[1]/2];return{scaledGap:l,offset:_,size:c}}),i=Ce(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=Ce(()=>e.color||e.patternColor||Vf[e.variant||rt.Dots]);return(a,s)=>(Z(),ae("svg",{class:"vue-flow__background vue-flow__container",style:Qe({height:`${a.height>100?100:a.height}%`,width:`${a.width>100?100:a.width}%`})},[qe(a.$slots,"pattern-container",{id:i.value},()=>[re("pattern",{id:i.value,x:x(n).x%o.value.scaledGap[0],y:x(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[qe(a.$slots,"pattern",{},()=>[a.variant===x(rt).Lines?(Z(),ge(x(Zr),{key:0,size:a.lineWidth,color:r.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):a.variant===x(rt).Dots?(Z(),ge(x(Kr),{key:1,color:r.value,radius:o.value.size/2},null,8,["color","radius"])):Te("",!0),a.bgColor?(Z(),ae("svg",Yf,[re("rect",{width:"100%",height:"100%",fill:a.bgColor},null,8,Gf)])):Te("",!0)])],8,Hf)]),re("rect",{x:a.x,y:a.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,Uf),qe(a.$slots,"default",{id:i.value})],4))}}),Zf=[{title:"所属插件",dataIndex:"pluginName"},{title:"流路径",dataIndex:"path"},{title:"状态",dataIndex:"state",customRender:({record:e})=>$a({state:e.state})},{title:"订阅数",dataIndex:"subscribers",width:"70px"}];function Kf({streamList:e}){return e.length?C(Re,{dataSource:e,columns:Zf,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):C(Rt,null,null)}const qf=/^(tcp|udp|quic|http)/,jf=[{title:"名称",dataIndex:"name",width:"120px"},{title:"端口",dataIndex:"port",width:"120px",customRender:({record:e})=>{const t=[];if(e.description)for(const n in e.description)qf.test(n)&&t.push(C(De,{color:"blue"},{default:()=>[n,Q(": "),e.description[n]]}));return t}},{title:"操作",dataIndex:"action",width:"60px",align:"center",customRender:({record:e})=>C(Se,{type:"link",onClick:()=>{Fe.confirm({title:`确定重启${e.name}吗?`,content:"开发中"})}},{default:()=>[Q("重启")]})}];function Jf({pluginList:e}){return e.length?C(Re,{dataSource:e,columns:jf,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):C(Rt,null,null)}const Qf=[{title:"流",dataIndex:"streamPath"},{title:"别名",dataIndex:"alias"},{title:"自动删除",dataIndex:"autoRemove"},{title:"状态",dataIndex:"status",customRender:({record:e})=>Pa[e.status]}];function eh({aliasList:e}){return e.length?C(Re,{dataSource:e,columns:Qf,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):C(Rt,null,null)}const th=[{title:"所有者",dataIndex:"owner"},{title:"状态",dataIndex:"state",width:100,customRender:({record:e})=>Ma[e.state]},{title:"启动时间",dataIndex:"startTime",width:100,customRender:({record:e})=>C(zi,{value:e.startTime},null)}];function qr(e){return e.children&&e.children.length?(e.children=e.children.map(qr),e.blocked&&(e.children.find(t=>t.id===e.blocked.id).blocking=!0)):delete e.children,e}function nh({taskList:e}){return expandedRowKeys.length=0,e.length?C(Re,{dataSource:e,columns:th,size:"small",pagination:!1,bordered:!0,rowKey:"id",scroll:{y:200}},null):C(Rt,null,null)}const oh=[{title:"文件名",dataIndex:"name"},{title:"大小",dataIndex:"size",width:100,customRender:({record:e})=>ao(e.size)},{title:"操作",dataIndex:"action",width:70,customRender:({record:e})=>C(Se,{type:"link",onClick:()=>ih(e.name)},{default:()=>[Q("查看")]})}];function ih(e){ka(e).then(t=>{Fe.info({title:"查看日志",width:"1024px",okText:"关闭",content:C("pre",{class:"w-100% h-600px overflow-auto"},[t])})})}function rh({logList:e}){return e.length?C(Re,{columns:oh,dataSource:e,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):C(Rt,null,null)}const ah=[{title:"插件",dataIndex:"pluginName"},{title:"流",dataIndex:"streamPath"},{title:"目标",dataIndex:"target"},{title:"配置",dataIndex:"config"}];function sh({transformList:e}){return e.length?C(Re,{dataSource:e,columns:ah,size:"small",pagination:!1,bordered:!0,scroll:{y:200}},null):C(Rt,null,null)}const lh={style:{position:"relative"}},uh={class:"flex-center"},ch={class:"flex-center gap-2px"},dh={class:"flex-center gap-2px"},fh={class:"flex-center gap-2px"},hh={class:"flex-center gap-2px"},ph={class:"flex-center gap-2px"},vh={class:"flex-center gap-2px"},gh={key:1},mh=le({name:"Instance"}),yh=le({...mh,props:{data:{}},setup(e){const t=Dn(),{summary:n,online:o,sysInfo:i}=Tt(t),r=K([]),a=K([]),s=K([]),u=K([]),l=K([]),c=t.pluginActive("LogRotate");function d(){so().then(G=>{r.value=G})}function f(){xa().then(G=>{a.value=G})}function _(){ba().then(G=>{l.value=G})}function y(){Sa().then(G=>{s.value=[G].map(qr)})}function g(){Ia().then(G=>{u.value=G})}const v={3:{...nt(d),active(){o.value?(d(),this.resume()):this.pause()}},4:{...nt(_),active(){o.value?(_(),this.resume()):this.pause()}},5:{...nt(f),active(){o.value?(f(),this.resume()):this.pause()}},6:{...nt(y),active(){o.value?(y(),this.resume()):this.pause()}},7:{...nt(g),active(){c.value&&o.value?(g(),this.resume()):this.pause()}}},w=Oi(),m=e,h=K(),b=K(),A=K(0),O=K(0),L=K("1");we(L,(G,p)=>{var I,T;(I=v[p])==null||I.pause(),(T=v[G])==null||T.active()}),we(o,G=>{var p,I;if(G)(I=v[L.value])==null||I.active();else for(const T in v)(p=v[T])==null||p.pause()}),ko(()=>{var G;(!c.value||!o.value)&&((G=v[7])==null||G.pause())});function X(){Fe.confirm({title:"热重启",content:"确定要热重启吗?",okText:"确定",cancelText:"取消",onOk:()=>Ea()})}const j=t.registerSummaryCallback(G=>{var p,I,T,F,H;(I=h.value)==null||I.handleUpdate(((p=G==null?void 0:G.memory)==null?void 0:p.usage)||0),(T=b.value)==null||T.handleUpdate((G==null?void 0:G.cpuUsage)||0),A.value=((F=G==null?void 0:G.netWork)==null?void 0:F.reduce((Y,W)=>Y+Number(W.sentSpeed||0),0))||0,O.value=((H=G==null?void 0:G.netWork)==null?void 0:H.reduce((Y,W)=>Y+Number(W.receiveSpeed||0),0))||0});Tn(()=>{var G;j();for(const p in v)(G=v[p])==null||G.pause()});function V(){c.value?m.data.onShowLogTrail():Ye.error("需要启用 Logrotate 插件")}async function U(){try{let p=await Ca();Fe.confirm({title:"编辑配置文件",width:800,style:{top:"20px"},content:()=>C("div",{style:"height: 600px"},[C(Ta,{value:p,onChange:I=>p=I,language:"yaml",options:{minimap:{enabled:!1},lineNumbers:"on",automaticLayout:!0}},null)]),onOk:async()=>{try{Da.parse(p),await Na(p),Ye.success("保存成功")}catch(I){return Promise.reject("配置文件格式错误:"+I.message)}}})}catch(G){Ye.error("获取配置文件失败:"+G.message)}}function P(){m.data.onShowDebugChart()}return(G,p)=>(Z(),ae("div",lh,[C(x($e),{type:"target",position:x(q).Top,id:"upstream"},null,8,["position"]),C(x($e),{type:"source",position:x(q).Bottom,id:"downstream"},null,8,["position"]),C(x($e),{type:"target",position:x(q).Left,id:"target-pull",style:{top:"20%",bottom:"auto"}},null,8,["position"]),C(x($e),{type:"target",position:x(q).Left,id:"target-push",style:{top:"50%",bottom:"auto"}},null,8,["position"]),C(x($e),{type:"target",position:x(q).Left,id:"target-read",style:{top:"80%",bottom:"auto"}},null,8,["position"]),C(x($e),{type:"source",position:x(q).Right,id:"source-push",style:{top:"20%",bottom:"auto"}},null,8,["position"]),C(x($e),{type:"source",position:x(q).Right,id:"source-play",style:{top:"50%",bottom:"auto"}},null,8,["position"]),C(x($e),{type:"source",position:x(q).Right,id:"source-read",style:{top:"80%",bottom:"auto"}},null,8,["position"]),x(t).online?(Z(),ge(x(Le),{key:0,size:"small",class:"w-500px drop-shadow-xl","body-style":{paddingBottom:0,paddingTop:0}},{title:R(()=>[p[2]||(p[2]=re("span",null,"Monibuca ",-1)),C(x(De),{color:"green"},{default:R(()=>[Q(ke(x(i).version),1)]),_:1}),Q(ke(x(i).localIP),1)]),extra:R(()=>[C(x(Se),{type:"link",onClick:p[0]||(p[0]=I=>x(w)("Overview"))},{default:R(()=>p[3]||(p[3]=[Q("查看详情")])),_:1})]),actions:R(()=>[C(x(Se),{type:"link",onClick:P,size:"small"},{default:R(()=>p[33]||(p[33]=[Q(" 性能观测 ")])),_:1}),C(x(Se),{type:"link",onClick:U,size:"small"},{default:R(()=>p[34]||(p[34]=[Q(" 配置 ")])),_:1}),C(x(Se),{type:"link",onClick:V,size:"small"},{default:R(()=>p[35]||(p[35]=[Q(" 日志跟踪 ")])),_:1}),C(x(Se),{type:"link",onClick:X,size:"small"},{default:R(()=>p[36]||(p[36]=[Q(" 热重启 ")])),_:1})]),default:R(()=>[C(x(da),{activeKey:L.value,"onUpdate:activeKey":p[1]||(p[1]=I=>L.value=I),size:"small",animated:"","tab-bar-gutter":20,"tab-bar-style":{marginBottom:"4px"}},{default:R(()=>[C(x(vt),{key:"1"},{tab:R(()=>[re("div",uh,[C(x(ut),{icon:"dashicons:dashboard",width:"20",height:"20"}),p[4]||(p[4]=re("span",null,"概览",-1))])]),default:R(()=>[re("div",null,[p[5]||(p[5]=Q(" 启动时间: ")),C(x(zi),{value:x(i).startTime,class:"text-primary"},null,8,["value"]),p[6]||(p[6]=re("br",null,null,-1)),p[7]||(p[7]=Q(" Go版本:")),C(x(De),{color:"processing"},{default:R(()=>[Q(ke(x(i).goVersion),1)]),_:1}),p[8]||(p[8]=re("br",null,null,-1)),p[9]||(p[9]=Q(" 操作系统:")),C(x(De),{color:"processing"},{default:R(()=>[Q(ke(x(i).os),1)]),_:1}),p[10]||(p[10]=re("br",null,null,-1)),p[11]||(p[11]=Q(" CPU:")),C(x(De),{color:"processing"},{default:R(()=>{var I;return[Q(ke(((I=x(n).cpuUsage)==null?void 0:I.toFixed(2))||0)+"%",1)]}),_:1}),p[12]||(p[12]=Q(" 核心数:")),C(x(De),null,{default:R(()=>[Q(ke(x(i).cpus),1)]),_:1}),p[13]||(p[13]=Q(" 架构:")),C(x(De),null,{default:R(()=>[Q(ke(x(i).arch),1)]),_:1}),p[14]||(p[14]=re("br",null,null,-1)),p[15]||(p[15]=Q(" 存储:")),C(x(De),{color:"processing"},{default:R(()=>{var I;return[Q(ke(((I=x(n).hardDisk)==null?void 0:I.usage.toFixed(2))||0)+"%",1)]}),_:1}),p[16]||(p[16]=Q(" 总大小:")),C(x(De),null,{default:R(()=>{var I;return[Q(ke((I=x(n).hardDisk)==null?void 0:I.total)+"GB",1)]}),_:1}),p[17]||(p[17]=Q(" 已使用:")),C(x(De),{color:"error"},{default:R(()=>{var I;return[Q(ke((I=x(n).hardDisk)==null?void 0:I.used)+"GB",1)]}),_:1}),p[18]||(p[18]=Q(" 可用:")),C(x(De),{color:"success"},{default:R(()=>{var I;return[Q(ke((I=x(n).hardDisk)==null?void 0:I.free)+"GB",1)]}),_:1}),p[19]||(p[19]=re("br",null,null,-1)),p[20]||(p[20]=Q(" 内存:")),C(x(De),{color:"processing"},{default:R(()=>{var I;return[Q(ke(((I=x(n).memory)==null?void 0:I.usage.toFixed(2))||0)+"%",1)]}),_:1}),p[21]||(p[21]=Q(" 总大小:")),C(x(De),null,{default:R(()=>{var I;return[Q(ke((I=x(n).memory)==null?void 0:I.total)+"MB",1)]}),_:1}),p[22]||(p[22]=Q(" 已使用:")),C(x(De),{color:"error"},{default:R(()=>{var I;return[Q(ke((I=x(n).memory)==null?void 0:I.used)+"MB",1)]}),_:1}),p[23]||(p[23]=Q(" 可用:")),C(x(De),{color:"success"},{default:R(()=>{var I;return[Q(ke((I=x(n).memory)==null?void 0:I.free)+"MB",1)]}),_:1}),p[24]||(p[24]=re("br",null,null,-1)),p[25]||(p[25]=Q(" 发送:")),C(x(De),{color:"processing"},{default:R(()=>[Q(ke(x(ao)(A.value)),1)]),_:1}),p[26]||(p[26]=Q(" 接收:")),C(x(De),{color:"processing"},{default:R(()=>[Q(ke(x(ao)(O.value)),1)]),_:1})])]),_:1}),C(x(vt),{key:"2"},{tab:R(()=>[re("div",ch,[C(x(ut),{icon:"mingcute:plugin-line",width:"24",height:"24"}),p[27]||(p[27]=re("span",null,"插件",-1))])]),default:R(()=>[C(x(Jf),{pluginList:x(i).plugins},null,8,["pluginList"])]),_:1}),C(x(vt),{key:"3"},{tab:R(()=>[re("div",dh,[C(x(ut),{icon:"ri:live-line",width:"24",height:"24"}),p[28]||(p[28]=re("span",null,"流",-1))])]),default:R(()=>[C(x(Kf),{streamList:r.value},null,8,["streamList"])]),_:1}),C(x(vt),{key:"4"},{tab:R(()=>[re("div",fh,[C(x(ut),{icon:"carbon:transform-binary",width:"24",height:"24"}),p[29]||(p[29]=re("span",null,"转换",-1))])]),default:R(()=>[C(x(sh),{transformList:l.value},null,8,["transformList"])]),_:1}),C(x(vt),{key:"5"},{tab:R(()=>[re("div",hh,[C(x(ut),{icon:"oui:token-alias",width:"24",height:"24"}),p[30]||(p[30]=re("span",null,"别名",-1))])]),default:R(()=>[C(x(eh),{aliasList:a.value},null,8,["aliasList"])]),_:1}),C(x(vt),{key:"6"},{tab:R(()=>[re("div",ph,[C(x(ut),{icon:"iconoir:task-list",width:"24",height:"24"}),p[31]||(p[31]=re("span",null,"任务",-1))])]),default:R(()=>[C(x(nh),{taskList:s.value},null,8,["taskList"])]),_:1}),C(x(vt),{key:"7"},{tab:R(()=>[re("div",vh,[C(x(ut),{icon:"ix:log",width:"24",height:"24"}),p[32]||(p[32]=re("span",null,"日志",-1))])]),default:R(()=>[x(c)?(Z(),ge(x(rh),{key:0,logList:u.value},null,8,["logList"])):(Z(),ae("div",gh,"需要启用 Logrotate 插件"))]),_:1})]),_:1},8,["activeKey"])]),_:1})):(Z(),ge(x(Le),{key:1},{default:R(()=>[C(x(ut),{icon:"mingcute:plugin-line",width:"24",height:"24"}),p[37]||(p[37]=re("span",null,"Monibuca 离线",-1))]),_:1}))]))}});const wh=fa(yh,[["__scopeId","data-v-1489df40"]]),_h={key:1,class:"text-12px"},xh=le({name:"Device"}),bh=le({...xh,setup(e){const{pause:t,resume:n}=nt(r),o=K([]),i=K([{title:"名称",dataIndex:"name"},{title:"状态",dataIndex:"status",customRender:({record:a})=>Oa(a.status)}]);function r(){return Aa().then(a=>{o.value=a}).catch(a=>{console.error(`stream-proxy-getList-error: ${a}`)})}return r(),(a,s)=>(Z(),ge(x(Le),{size:"small",class:"w-250px drop-shadow-xl"},{title:R(()=>[s[1]||(s[1]=re("span",null,"远端服务器或设备",-1)),o.value.length?(Z(),ge(x(Ct),{key:0,title:"帮助",content:"设备节点用于配置拉流代理,可以从远程服务器或设备拉取流"},{default:R(()=>[C(x(Se),{type:"link",size:"small"},{default:R(()=>[C(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:R(()=>[C(x(Se),{type:"link",onClick:s[0]||(s[0]=u=>x(Ba)({updateList:r,pause:x(t),resume:x(n)}))},{default:R(()=>s[2]||(s[2]=[Q("添加")])),_:1})]),default:R(()=>[C(x($e),{type:"source",position:x(q).Right},null,8,["position"]),o.value.length?(Z(),ge(x(Re),{key:0,"data-source":o.value,columns:i.value,size:"small",pagination:!1,bordered:""},null,8,["data-source","columns"])):(Z(),ae("span",_h," 拉力代理功能:由 Monibuca 作为客户端主动从远端服务器或者设备拉流。 点击右上角按钮,可以添加拉流代理 "))]),_:1}))}});var Co={},Sh={get exports(){return Co},set exports(e){Co=e}};function Eh(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Pn={},Ch={get exports(){return Pn},set exports(e){Pn=e}},Pi;function Nh(){return Pi||(Pi=1,function(e,t){(function(n,o){e.exports=o()})(Ht,function(){var n=n||function(o,i){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof Ht<"u"&&Ht.crypto&&(r=Ht.crypto),!r&&typeof Eh=="function")try{r=Ra}catch{}var a=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function m(){}return function(h){var b;return m.prototype=h,b=new m,m.prototype=null,b}}(),u={},l=u.lib={},c=l.Base=function(){return{extend:function(m){var h=s(this);return m&&h.mixIn(m),(!h.hasOwnProperty("init")||this.init===h.init)&&(h.init=function(){h.$super.init.apply(this,arguments)}),h.init.prototype=h,h.$super=this,h},create:function(){var m=this.extend();return m.init.apply(m,arguments),m},init:function(){},mixIn:function(m){for(var h in m)m.hasOwnProperty(h)&&(this[h]=m[h]);m.hasOwnProperty("toString")&&(this.toString=m.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),d=l.WordArray=c.extend({init:function(m,h){m=this.words=m||[],h!=i?this.sigBytes=h:this.sigBytes=m.length*4},toString:function(m){return(m||_).stringify(this)},concat:function(m){var h=this.words,b=m.words,A=this.sigBytes,O=m.sigBytes;if(this.clamp(),A%4)for(var L=0;L>>2]>>>24-L%4*8&255;h[A+L>>>2]|=X<<24-(A+L)%4*8}else for(var j=0;j>>2]=b[j>>>2];return this.sigBytes+=O,this},clamp:function(){var m=this.words,h=this.sigBytes;m[h>>>2]&=4294967295<<32-h%4*8,m.length=o.ceil(h/4)},clone:function(){var m=c.clone.call(this);return m.words=this.words.slice(0),m},random:function(m){for(var h=[],b=0;b>>2]>>>24-O%4*8&255;A.push((L>>>4).toString(16)),A.push((L&15).toString(16))}return A.join("")},parse:function(m){for(var h=m.length,b=[],A=0;A>>3]|=parseInt(m.substr(A,2),16)<<24-A%8*4;return new d.init(b,h/2)}},y=f.Latin1={stringify:function(m){for(var h=m.words,b=m.sigBytes,A=[],O=0;O>>2]>>>24-O%4*8&255;A.push(String.fromCharCode(L))}return A.join("")},parse:function(m){for(var h=m.length,b=[],A=0;A>>2]|=(m.charCodeAt(A)&255)<<24-A%4*8;return new d.init(b,h)}},g=f.Utf8={stringify:function(m){try{return decodeURIComponent(escape(y.stringify(m)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(m){return y.parse(unescape(encodeURIComponent(m)))}},v=l.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new d.init,this._nDataBytes=0},_append:function(m){typeof m=="string"&&(m=g.parse(m)),this._data.concat(m),this._nDataBytes+=m.sigBytes},_process:function(m){var h,b=this._data,A=b.words,O=b.sigBytes,L=this.blockSize,X=L*4,j=O/X;m?j=o.ceil(j):j=o.max((j|0)-this._minBufferSize,0);var V=j*L,U=o.min(V*4,O);if(V){for(var P=0;P>>24)&16711935|(h<<24|h>>>8)&4278255360}var b=this._hash.words,A=g[v+0],O=g[v+1],L=g[v+2],X=g[v+3],j=g[v+4],V=g[v+5],U=g[v+6],P=g[v+7],G=g[v+8],p=g[v+9],I=g[v+10],T=g[v+11],F=g[v+12],H=g[v+13],Y=g[v+14],W=g[v+15],D=b[0],z=b[1],M=b[2],$=b[3];D=d(D,z,M,$,A,7,l[0]),$=d($,D,z,M,O,12,l[1]),M=d(M,$,D,z,L,17,l[2]),z=d(z,M,$,D,X,22,l[3]),D=d(D,z,M,$,j,7,l[4]),$=d($,D,z,M,V,12,l[5]),M=d(M,$,D,z,U,17,l[6]),z=d(z,M,$,D,P,22,l[7]),D=d(D,z,M,$,G,7,l[8]),$=d($,D,z,M,p,12,l[9]),M=d(M,$,D,z,I,17,l[10]),z=d(z,M,$,D,T,22,l[11]),D=d(D,z,M,$,F,7,l[12]),$=d($,D,z,M,H,12,l[13]),M=d(M,$,D,z,Y,17,l[14]),z=d(z,M,$,D,W,22,l[15]),D=f(D,z,M,$,O,5,l[16]),$=f($,D,z,M,U,9,l[17]),M=f(M,$,D,z,T,14,l[18]),z=f(z,M,$,D,A,20,l[19]),D=f(D,z,M,$,V,5,l[20]),$=f($,D,z,M,I,9,l[21]),M=f(M,$,D,z,W,14,l[22]),z=f(z,M,$,D,j,20,l[23]),D=f(D,z,M,$,p,5,l[24]),$=f($,D,z,M,Y,9,l[25]),M=f(M,$,D,z,X,14,l[26]),z=f(z,M,$,D,G,20,l[27]),D=f(D,z,M,$,H,5,l[28]),$=f($,D,z,M,L,9,l[29]),M=f(M,$,D,z,P,14,l[30]),z=f(z,M,$,D,F,20,l[31]),D=_(D,z,M,$,V,4,l[32]),$=_($,D,z,M,G,11,l[33]),M=_(M,$,D,z,T,16,l[34]),z=_(z,M,$,D,Y,23,l[35]),D=_(D,z,M,$,O,4,l[36]),$=_($,D,z,M,j,11,l[37]),M=_(M,$,D,z,P,16,l[38]),z=_(z,M,$,D,I,23,l[39]),D=_(D,z,M,$,H,4,l[40]),$=_($,D,z,M,A,11,l[41]),M=_(M,$,D,z,X,16,l[42]),z=_(z,M,$,D,U,23,l[43]),D=_(D,z,M,$,p,4,l[44]),$=_($,D,z,M,F,11,l[45]),M=_(M,$,D,z,W,16,l[46]),z=_(z,M,$,D,L,23,l[47]),D=y(D,z,M,$,A,6,l[48]),$=y($,D,z,M,P,10,l[49]),M=y(M,$,D,z,Y,15,l[50]),z=y(z,M,$,D,V,21,l[51]),D=y(D,z,M,$,F,6,l[52]),$=y($,D,z,M,X,10,l[53]),M=y(M,$,D,z,I,15,l[54]),z=y(z,M,$,D,O,21,l[55]),D=y(D,z,M,$,G,6,l[56]),$=y($,D,z,M,W,10,l[57]),M=y(M,$,D,z,U,15,l[58]),z=y(z,M,$,D,H,21,l[59]),D=y(D,z,M,$,j,6,l[60]),$=y($,D,z,M,T,10,l[61]),M=y(M,$,D,z,L,15,l[62]),z=y(z,M,$,D,p,21,l[63]),b[0]=b[0]+D|0,b[1]=b[1]+z|0,b[2]=b[2]+M|0,b[3]=b[3]+$|0},_doFinalize:function(){var g=this._data,v=g.words,w=this._nDataBytes*8,m=g.sigBytes*8;v[m>>>5]|=128<<24-m%32;var h=o.floor(w/4294967296),b=w;v[(m+64>>>9<<4)+15]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,v[(m+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,g.sigBytes=(v.length+1)*4,this._process();for(var A=this._hash,O=A.words,L=0;L<4;L++){var X=O[L];O[L]=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360}return A},clone:function(){var g=s.clone.call(this);return g._hash=this._hash.clone(),g}});function d(g,v,w,m,h,b,A){var O=g+(v&w|~v&m)+h+A;return(O<>>32-b)+v}function f(g,v,w,m,h,b,A){var O=g+(v&m|w&~m)+h+A;return(O<>>32-b)+v}function _(g,v,w,m,h,b,A){var O=g+(v^w^m)+h+A;return(O<>>32-b)+v}function y(g,v,w,m,h,b,A){var O=g+(w^(v|~m))+h+A;return(O<>>32-b)+v}i.MD5=s._createHelper(c),i.HmacMD5=s._createHmacHelper(c)}(Math),n.MD5})})(Sh);const jr=Co,kh=["srcObject"],Ih={key:1,class:"text-12px"},$h={class:"flex items-center justify-between pl-10px pr-10px"},Ph=le({name:"Pusher"}),Mh=le({...Ph,props:{data:{}},setup(e){const t=K(!1),n=K(!1),o=Dn(),i=K(""),r=K("live/test"),a=e,{plugins:s,sysInfo:u}=Tt(o),l=o.pluginActive("WebRTC");async function c(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(w=>w.kind==="videoinput").map(w=>({label:w.label||`Camera ${w.deviceId.slice(0,10)}...`,value:w.deviceId,key:w.deviceId}))}catch(v){return console.error("获取摄像头列表失败:",v),Ye.error("获取摄像头列表失败"),[]}}let d;const f=K(null);async function _(v){n.value=!0;const w=f.value=v,m=new RTCPeerConnection;d=()=>{m.close(),w==null||w.getTracks().forEach(O=>{O.stop()}),f.value=null},m.oniceconnectionstatechange=()=>{Yt.info({message:"oniceconnectionstatechange",description:JSON.stringify(m.iceConnectionState)})},m.onicecandidate=O=>{Yt.info({message:"onicecandidate",description:JSON.stringify(O.candidate)})},w.getTracks().forEach(O=>{m.addTrack(O,w)});const h=await m.createOffer();await m.setLocalDescription(h),Yt.info({message:"createOffer",description:()=>C("div",{class:"h-200px overflow-auto"},[h.sdp])});const b=await fetch(`${xt("webrtc","/push")}/${r.value}`,{method:"POST",mode:"cors",cache:"no-cache",credentials:"include",redirect:"follow",referrerPolicy:"no-referrer",headers:{"Content-Type":"application/sdp"},body:h.sdp}),A=await b.text();if(b.status>=300)throw`${b.status} ${b.statusText}: ${A}`;Yt.success({message:"推流成功",description:A||""}),await m.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:A}))}ko(()=>{t.value?l.value?g():(Ye.error("请先启用 WebRTC 插件"),t.value=!1):d==null||d(),a.data.onPush(t.value)});async function y(){const v=K({useLocalIP:"localhost",secretKey:"",expireTime:ze().add(1,"hour")});Fe.info({title:"推流地址",width:800,content:()=>{const w=h=>{if(!v.value.secretKey||!v.value.expireTime)return"";const b=Math.floor(v.value.expireTime.unix()).toString(16),A=jr(v.value.secretKey+r.value+b).toString();return(h.includes("?")?"&":"?")+`secret=${A}&expire=${b}`},m=[];for(const h of s.value){const b=h.pushAddr;if(b)for(const A of b){const O=A.replace("{hostName}",v.value.useLocalIP).replace("{streamPath}",r.value);m.push({protocol:A.startsWith("http")?h.name.toLocaleLowerCase():A.split(":")[0],path:O+w(O)})}}return m.length?[C(ro,{value:v.value.useLocalIP,onChange:h=>v.value.useLocalIP=h.target.value},{default:()=>[C(Zn,{value:"localhost"},{default:()=>[Q("使用localhost")]}),C(Zn,{value:u.value.publicIP},{default:()=>[Q("使用公网IP")]}),C(Zn,{value:u.value.localIP},{default:()=>[Q("使用内网IP")]})]}),C(Oe,{layout:"inline"},{default:()=>[C(Oe.Item,null,{default:()=>[C("span",null,[Q("秘钥"),C(Bi,{title:"需要匹配配置文件中 publish 下的 key 配置"},{default:()=>[C(st,{style:"margin-left: 4px"},null)]})]),C(_n,{type:"text",placeholder:"请输入秘钥",class:"w-250px",style:"margin-bottom: 10px",value:v.value.secretKey,onChange:h=>v.value.secretKey=h.target.value},null)]}),C(Oe.Item,{label:"过期时间"},{default:()=>[C(Ri,{placeholder:"选择过期时间",showTime:!0,class:"w-250px",style:"margin-bottom: 10px",value:v.value.expireTime,onChange:h=>v.value.expireTime=h},null)]})]}),C(Re,{dataSource:m,columns:[{title:"协议",dataIndex:"protocol"},{title:"推流地址",dataIndex:"path"}],pagination:!1,size:"small"},null)]:C("span",null,[Q("请先启用一些插件,如:rtmp、rtsp 插件")])}})}function g(){navigator.mediaDevices.getUserMedia({video:!0}).then(async v=>{var m;v.getTracks().forEach(h=>{h.stop()});const w=await c();i.value||(i.value=((m=w[0])==null?void 0:m.value)||""),i.value&&(v=await navigator.mediaDevices.getUserMedia({video:{deviceId:i.value}})),Fe.confirm({title:"选择摄像头",content:()=>C("div",null,[C(Dt,{value:i.value,onChange:async h=>{v.getTracks().forEach(b=>{b.stop()}),v=await navigator.mediaDevices.getUserMedia({video:{deviceId:h}}),i.value=h},options:w,class:"w-250px"},null),C("video",{autoplay:!0,muted:!0,srcObject:v,width:"240",height:"180"},null)]),onCancel:()=>{v.getTracks().forEach(h=>{h.stop()})},onOk:()=>_(v).then(()=>{a.data.onPush(t.value),n.value=!1}).catch(h=>{Fe.error({title:"推流失败",content:h}),t.value=!1,n.value=!1})})})}return(v,w)=>(Z(),ge(x(Le),{size:"small",class:"w-250px drop-shadow-xl"},{title:R(()=>[w[2]||(w[2]=re("span",null,"推流器",-1)),f.value?(Z(),ge(x(Ct),{key:0,title:"帮助",content:"可以通过 OBS、ffmpeg等推流器工具将本地流推送到服务器, 然后通过播放器播放"},{default:R(()=>[C(x(Se),{type:"link",size:"small"},{default:R(()=>[C(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:R(()=>[C(x(Se),{type:"link",onClick:y},{default:R(()=>w[4]||(w[4]=[Q("推流地址")])),_:1})]),actions:R(()=>[re("div",$h,[w[5]||(w[5]=re("div",null,"流标识",-1)),C(x(_n),{type:"text",class:"w-120px",value:r.value,"onUpdate:value":w[0]||(w[0]=m=>r.value=m),size:"small"},null,8,["value"]),C(x(Io),{checked:t.value,"onUpdate:checked":w[1]||(w[1]=m=>t.value=m),loading:n.value,size:"small"},null,8,["checked","loading"])])]),default:R(()=>[C(x($e),{type:"source",position:x(q).Right},null,8,["position"]),f.value?(Z(),ae("video",{key:0,id:"video",width:"224",height:"168",style:{"border-radius":"6px","object-fit":"cover"},autoplay:"",muted:"",srcObject:f.value},null,8,kh)):(Z(),ae("span",Ih,w[3]||(w[3]=[Q(" 可以通过 OBS、ffmpeg等推流器工具将本地流推送到服务器, 然后通过播放器播放 "),re("br",null,null,-1),Q(" 点击右下角开关,将采集您的摄像头使用 WebRTC 推流到服务器。 ")])))]),_:1}))}}),Th=["src"],Dh=le({__name:"debug-chart",props:{data:{}},setup(e){const t=xt("debug","/charts"),n=e,o=()=>{n.data.onClose()};return(i,r)=>(Z(),ge(x(Le),{size:"small",title:"性能观测",class:"w-800px h-600px drop-shadow-xl relative","body-style":{top:"40px",bottom:0,position:"absolute",left:0,right:0,padding:0}},{extra:R(()=>[C(x(Se),{type:"link",onClick:o},{default:R(()=>[C(x(Fi),{class:"ml-1 text-gray-400"})]),_:1})]),default:R(()=>[re("iframe",{src:x(t),class:"w-full h-full",style:{border:"none"}},null,8,Th)]),_:1}))}}),Ah={class:"flex items-center"},zh={class:"flex items-center justify-end pr-5"},Oh=le({__name:"log-trail",props:{data:{}},setup(e){const t=K(null),n=K(!0),o=K(""),i=K(null);Xe(()=>{t.value=new EventSource(xt("logrotate")+"/trail"),t.value.onmessage=u=>{a.value.push(u.data),n.value&&je(()=>{var l,c;(c=i.value)==null||c.scrollTo({top:(l=i.value)==null?void 0:l.scrollHeight,behavior:"smooth"})})}}),Tn(()=>{var u;(u=t.value)==null||u.close()});const r=e,a=K([]),s=()=>{r.data.onClose()};return(u,l)=>(Z(),ge(x(Le),{size:"small",title:"日志",class:"w-700px drop-shadow-2xl"},{extra:R(()=>[C(x(Se),{type:"link",onClick:s},{default:R(()=>[C(x(Fi),{class:"ml-1 text-gray-400"})]),_:1})]),actions:R(()=>[re("div",Ah,[l[2]||(l[2]=re("div",{class:"mr-2 ml-2 w-50px"},"过滤",-1)),C(x(_n),{value:o.value,"onUpdate:value":l[0]||(l[0]=c=>o.value=c),size:"small"},null,8,["value"])]),re("div",zh,[l[3]||(l[3]=re("div",{class:"mr-2 ml-2 w-100px"},"自动滚动",-1)),C(x(Io),{checked:n.value,"onUpdate:checked":l[1]||(l[1]=c=>n.value=c),size:"small"},null,8,["checked"])])]),default:R(()=>[re("div",{class:"h-400px w-full overflow-auto",ref_key:"logContainer",ref:i},[(Z(!0),ae(He,null,Mn(o.value?a.value.filter(c=>c.includes(o.value)):a.value,(c,d)=>(Z(),ae("div",{key:d},ke(c),1))),128))],512)]),_:1}))}}),Bh={class:"flex flex-col gap-2"},Rh={key:0,class:"flex items-center gap-2 mb-2"},Fh={key:2,class:"text-12px"},Lh={class:"flex items-center justify-between pl-10px pr-10px"},Vh=le({name:"Pusher"}),Hh=le({...Vh,props:{data:{}},setup(e){const t=K("ws-flv"),n=K("live/test"),o=K(""),i=K(!1),r=K(!1),a=K([]),s=e;so().then(d=>{a.value=[{title:"live/test",value:"live/test"}].concat(d.filter(f=>f.path!=="live/test").map(f=>({title:f.path,value:f.path})))});function u(d){r.value=!1,typeof d=="string"&&(Yt.error({message:"播放结束",description:d}),i.value=!1)}function l(d){so().then(f=>{a.value=[{title:d,value:d}].concat(f.map(_=>({title:_.path,value:_.path})))})}ko(()=>{s.data.onPlay(i.value),i.value?(r.value=!0,o.value=n.value):o.value=""});async function c(){const d=K({useLocalIP:"localhost",secretKey:"",expireTime:ze().add(1,"hour")});Fe.info({title:"播放地址",width:800,content:()=>{const f=y=>{if(!d.value.secretKey||!d.value.expireTime)return"";const g=Math.floor(d.value.expireTime.unix()).toString(16),v=jr(d.value.secretKey+n.value+g).toString();return(y.includes("?")?"&":"?")+`secret=${v}&expire=${g}`},_=[];for(const y of s.data.plugins){const g=y.playAddr;if(g)for(const v of g){const w=v.replace("{hostName}",d.value.useLocalIP).replace("{streamPath}",n.value);_.push({protocol:v.startsWith("http")?y.name.toLocaleLowerCase():v.split(":")[0],path:w+f(w)})}}return _.length?[C(ro,{value:d.value.useLocalIP,onChange:y=>d.value.useLocalIP=y.target.value},{default:()=>[C(Wt("Radio"),{value:"localhost"},{default:()=>[Q("使用localhost")]}),C(Wt("Radio"),{value:s.data.sysInfo.publicIP},{default:()=>[Q("使用公网IP")]}),C(Wt("Radio"),{value:s.data.sysInfo.localIP},{default:()=>[Q("使用内网IP")]})]}),C(Oe,{layout:"inline"},{default:()=>[C(Oe.Item,null,{default:()=>[C("span",null,[Q("秘钥"),C(Bi,{title:"需要匹配配置文件中 subscribe 下的 key 配置"},{default:()=>[C(st,{style:"margin-left: 4px"},null)]})]),C(_n,{type:"text",placeholder:"请输入秘钥",class:"w-250px",style:"margin-bottom: 10px",value:d.value.secretKey,onChange:y=>d.value.secretKey=y.target.value},null)]}),C(Oe.Item,{label:"过期时间"},{default:()=>[C(Ri,{placeholder:"选择过期时间",showTime:!0,class:"w-250px",style:"margin-bottom: 10px",value:d.value.expireTime,onChange:y=>d.value.expireTime=y},null)]})]}),C(Re,{dataSource:_,columns:[{title:"协议",dataIndex:"protocol"},{title:"播放地址",dataIndex:"path"}],pagination:!1,size:"small"},null)]:C("span",null,[Q("请先启用一些插件,如:rtmp、rtsp 插件")])}})}return(d,f)=>(Z(),ge(x(Le),{size:"small",class:"w-250px drop-shadow-xl"},{title:R(()=>[f[3]||(f[3]=re("span",null,"播放器",-1)),i.value?(Z(),ge(x(Ct),{key:0,title:"帮助",content:"播放器可以播放服务器上的流,例如使用 vlc、ffplay等播放器播放,Web 端可以使用 Jessibuca 播放器。"},{default:R(()=>[C(x(Se),{type:"link",size:"small"},{default:R(()=>[C(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:R(()=>[C(x(Se),{type:"link",onClick:c},{default:R(()=>f[7]||(f[7]=[Q("播放地址")])),_:1})]),actions:R(()=>[re("div",Lh,[f[8]||(f[8]=re("div",null,"流标识",-1)),C(x(Dt),{class:"w-120px",showSearch:"",value:n.value,"onUpdate:value":f[1]||(f[1]=_=>n.value=_),options:a.value,onSearch:l,size:"small"},null,8,["value","options"]),C(x(Io),{checked:i.value,"onUpdate:checked":f[2]||(f[2]=_=>i.value=_),loading:r.value,size:"small"},null,8,["checked","loading"])])]),default:R(()=>[C(x($e),{type:"source",position:x(q).Left},null,8,["position"]),re("div",Bh,[i.value?(Z(),ae("div",Rh,[C(x(ro),{value:t.value,"onUpdate:value":f[0]||(f[0]=_=>t.value=_),size:"small"},{default:R(()=>[C(x(Lo),{value:"ws-flv"},{default:R(()=>f[4]||(f[4]=[Q("WS-FLV")])),_:1}),C(x(Lo),{value:"webrtc"},{default:R(()=>f[5]||(f[5]=[Q("WebRTC")])),_:1})]),_:1},8,["value"])])):Te("",!0),i.value?(Z(),ge(Va,{key:1,streamPath:o.value,format:t.value,onPlay:u,class:"flex-1 m-r-10px w-224px h-168px"},null,8,["streamPath","format"])):(Z(),ae("span",Fh,f[6]||(f[6]=[Q(" 播放器可以播放服务器上的流,例如使用 vlc、ffplay等播放器播放,Web 端可以使用 Jessibuca 播放器。 "),re("br",null,null,-1),Q(" 点击右下角开关,将使用 Web 播放技术播放服务器上的流。 ")])))])]),_:1}))}}),Yh={key:1,class:"text-12px"},Gh=le({name:"Remote"}),Uh=le({...Gh,setup(e){const{pause:t,resume:n}=nt(r),o=K([]),i=K([{title:"名称",dataIndex:"name"},{title:"状态",dataIndex:"status",customRender:({record:a})=>a.status?"在线":"离线"}]);function r(){return za().then(a=>{o.value=a}).catch(a=>{console.error(`stream-proxy-getList-error: ${a}`)})}return r(),(a,s)=>(Z(),ge(x(Le),{size:"small",class:"w-250px drop-shadow-xl"},{title:R(()=>[s[1]||(s[1]=re("span",null,"远端服务器或CDN",-1)),o.value.length?(Z(),ge(x(Ct),{key:0,title:"帮助",content:"可以将流转推到远端服务器如云端服务器、CDN 等"},{default:R(()=>[C(x(Se),{type:"link",size:"small"},{default:R(()=>[C(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:R(()=>[C(x(Se),{type:"link",onClick:s[0]||(s[0]=u=>x(Ha)({updateList:r,pause:x(t),resume:x(n)}))},{default:R(()=>s[2]||(s[2]=[Q("添加")])),_:1})]),default:R(()=>[C(x($e),{type:"target",position:x(q).Left},null,8,["position"]),o.value.length?(Z(),ge(x(Re),{key:0,"data-source":o.value,columns:i.value,size:"small",pagination:!1,bordered:""},null,8,["data-source","columns"])):(Z(),ae("span",Yh," 转推功能:将流推送到远端服务器或 CDN 等。 点击右上角按钮,可以添加转推代理 "))]),_:1}))}}),Xh={key:1},Wh={key:1,class:"text-12px"},Zh=le({name:"ReadRecord"}),Kh=le({...Zh,props:{data:{}},setup(e){const t=e,n=K([]),o=ce(()=>t.data.plugins.some(y=>y.name==="MP4"||y.name==="FLV"));function i(y){const g=new Date(y.startTime),w=new Date(y.endTime).getTime()-g.getTime(),m=w/(36e5*24)>>0,h=(w/36e5>>0)%24,b=(w/6e4>>0)%60,A=(w/1e3>>0)%60;return`${m?`${m}d`:""}${h?`${h}h`:""}${b}'${A}"`}const r=K([{title:"路径",dataIndex:"filePath",customRender:({text:y,record:g})=>C("div",{class:"flex items-center justify-between"},[C("span",{class:"flex-1"},[y]),C("div",{class:"flex gap-2"},[C(ha,{class:"cursor-pointer text-blue-500 hover:text-blue-600",onClick:()=>{_(`${xt(g.type.toLowerCase(),"/download")}/${g.streamPath}?id=${g.id}`,`${g.streamPath}-${g.id}.${g.type.toLowerCase()}`)}},null),C(pa,{class:"cursor-pointer text-red-500 hover:text-red-600",onClick:()=>{Fe.confirm({title:"确认删除",content:"确定要删除这条录像记录吗?",onOk:()=>Ya({type:g.type.toLowerCase(),id:g.id}).then(()=>{const v=n.value.find(w=>w.streamPath===g.streamPath);v&&loadDetailRecords(v,pagination.value)})})}},null)])])},{title:"开始时间",dataIndex:"startTime",customRender:({text:y})=>ze(y).format("YYYY-MM-DD HH:mm:ss")},{title:"结束时间",dataIndex:"endTime",customRender:({text:y})=>ze(y).format("YYYY-MM-DD HH:mm:ss")},{title:"时长",customRender:({record:y})=>i(y)}]),a=K([{title:"流路径",dataIndex:"streamPath",customRender:({text:y,record:g})=>{const v=K([]),w=K({current:1,pageSize:10,total:0,onChange:(h,b)=>{w.value.current=h,w.value.pageSize=b,m(g,w.value)},showTotal:h=>`共 ${h} 条`});function m(h,b){return Vi({streamPath:h.streamPath,type:h.type.toLowerCase(),pageNum:b.current,pageSize:b.pageSize}).then(A=>{v.value=Array.isArray(A)?A:A.list||[],w.value.total=Array.isArray(A)?A.length:A.total||0})}return C("div",{class:"cursor-pointer",onClick:()=>{m(g,w.value),Fe.info({title:`${g.streamPath}录像文件列表`,content:()=>C(Re,{dataSource:v.value,columns:r.value,pagination:w.value,size:"small",bordered:!0},null),width:1e3})}},[y,C(va,{style:{marginLeft:"8px",cursor:"pointer"}},null)])}},{title:"时长",customRender:({record:y})=>i(y)},{title:"类型",dataIndex:"type"}]),{pause:s,resume:u}=nt(d),l=K([]),c=[0,0];function d(){return Promise.all([xn("mp4").catch(y=>(console.error(`mp4-record-catalog-error: ${y}`),[])),xn("flv").catch(y=>(console.error(`flv-record-catalog-error: ${y}`),[]))]).then(([y,g])=>{const v=[...y.map(w=>({...w,type:"MP4"})),...g.map(w=>({...w,type:"FLV"}))];n.value=v,l.value=[...new Set(v.map(w=>w.streamPath))],v.length>0&&(c[0]=Math.min(...v.map(w=>new Date(w.startTime).getTime())),c[1]=Math.max(...v.map(w=>new Date(w.endTime).getTime())))})}const f=()=>{const y=K(l.value[0]),g=K("MP4"),v=K([ze(c[0]),ze(c[1])]);Fe.confirm({title:"录像下载",width:500,content:()=>C("div",null,[C(Oe,{layout:"vertical"},{default:()=>[C(Oe.Item,{label:"流路径",required:!0},{default:()=>[C(Dt,{value:y.value,onChange:w=>y.value=w,options:l.value.map(w=>({label:w,value:w}))},null)]}),C(Oe.Item,{label:"类型",required:!0},{default:()=>[C(Dt,{value:g.value,onChange:w=>g.value=w,options:[{label:"MP4",value:"MP4"},{label:"FLV",value:"FLV"}]},null)]}),C(Oe.Item,{label:"时间范围",required:!0},{default:()=>[C(Li,{disabledDate:w=>{const m=n.value.find(h=>h.streamPath===y.value&&h.type===g.value);return w&&(wze(m==null?void 0:m.endTime))},value:v.value,onChange:w=>v.value=w,showTime:!0,format:"YYYY-MM-DD HH:mm:ss"},null)]})]})]),onOk:()=>{if(!y.value||!v.value[0]||!v.value[1])return Promise.reject("请填写完整信息");const w=`${ze(v.value[0]).valueOf()}-${ze(v.value[1]).valueOf()}`;return _(`${xt(g.value.toLowerCase(),"/download")}/${y.value}?range=${w}`,`${y.value}-${v.value[0].format("YYYYMMDDHHmmss")}-${v.value[1].format("YYYYMMDDHHmmss")}.${g.value.toLowerCase()}`),Promise.resolve()}})};function _(y,g){const v=document.createElement("a");v.href=y,v.target="_blank",v.download=g,document.body.appendChild(v),v.click(),document.body.removeChild(v)}return we(o,y=>{y?(d(),u()):(s(),n.value=[],l.value=[],c[0]=0,c[1]=0)},{immediate:!0}),(y,g)=>(Z(),ge(x(Le),{size:"small",class:"w-250px drop-shadow-xl"},{title:R(()=>[g[0]||(g[0]=re("span",null,"录像读取",-1)),n.value.length?(Z(),ge(x(Ct),{key:0,title:"帮助",content:"录像读取节点用于查询和管理录像文件,可以将录像转换为实时流"},{default:R(()=>[C(x(Se),{type:"link",size:"small"},{default:R(()=>[C(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:R(()=>[o.value?(Z(),ge(x(Se),{key:0,type:"link",onClick:f},{default:R(()=>g[1]||(g[1]=[Q(" 下载 ")])),_:1})):(Z(),ae("span",Xh," 请先启用MP4或FLV插件 "))]),default:R(()=>[C(x($e),{type:"source",position:x(q).Right},null,8,["position"]),n.value.length?(Z(),ge(x(Re),{key:0,"data-source":n.value,columns:a.value,size:"small",pagination:!1,bordered:""},null,8,["data-source","columns"])):(Z(),ae("span",Wh," 录像读取功能:查询和管理录像文件,可以将录像转换为实时流。 点击右上角按钮,可以下载录像段 "))]),_:1}))}}),qh={key:1},jh={key:1,class:"text-12px"},Jh=le({name:"PlayRecord"}),Qh=le({...Jh,props:{data:{}},setup(e){const t=K(null),n=K([]),o=K(),i=K([]),r=K("mp4"),a=e,s=ce(()=>a.data.plugins.some(l=>l.name==="MP4"||l.name==="FLV")),u=async()=>{var _;if(i.value.length){i.value=[];return}const[l,c]=await Promise.all([xn("mp4").catch(()=>[]),xn("flv").catch(()=>[])]),d=[...l.map(y=>({...y,type:"mp4"})),...c.map(y=>({...y,type:"flv"}))];if(d.length===0){Fe.warning({title:"提示",content:"没有可用的录像记录"});return}n.value=[...new Set(d.map(y=>y.streamPath))].map(y=>({label:y,value:y})),o.value=n.value[0].value,r.value=((_=d.find(y=>y.streamPath===o.value))==null?void 0:_.type)||"mp4";let f=K([ze(d[0].startTime),ze(d[0].endTime)]);Fe.confirm({title:"播放录像",width:500,content:()=>C("div",null,[C(Oe,{layout:"vertical"},{default:()=>[C(Oe.Item,{label:"流路径",required:!0},{default:()=>[C(Dt,{value:o.value,onChange:y=>{var g;o.value=y,r.value=((g=d.find(v=>v.streamPath===y))==null?void 0:g.type)||"mp4"},placeholder:"请选择流路径",options:n.value},null)]}),C(Oe.Item,{label:"类型",required:!0},{default:()=>[C(Dt,{value:r.value,onChange:y=>r.value=y,options:[{label:"MP4",value:"mp4"},{label:"FLV",value:"flv"}]},null)]}),C(Oe.Item,{label:"播放时间范围",required:!0},{default:()=>[C(Li,{value:f.value,disabledDate:y=>{const g=d.find(v=>v.streamPath===o.value&&v.type===r.value);return y&&(yze(g==null?void 0:g.endTime))},onChange:y=>f.value=y,showTime:!0,format:"YYYY-MM-DD HH:mm:ss"},null)]})]})]),onOk:async()=>{var y,g;if(!((y=f.value)!=null&&y[0])||!((g=f.value)!=null&&g[1]))return Promise.reject("请选择时间范围");i.value=await Vi({streamPath:o.value,type:r.value,range:`${f.value[0].unix()}-${f.value[1].unix()}`})}})};return(l,c)=>(Z(),ge(x(Le),{size:"small",class:"w-250px drop-shadow-xl"},{title:R(()=>[c[0]||(c[0]=re("span",null,"录像播放",-1)),t.value?(Z(),ge(x(Ct),{key:0,title:"帮助",content:"录像播放节点用于播放录像文件,可以选择时间范围进行回放"},{default:R(()=>[C(x(Se),{type:"link",size:"small"},{default:R(()=>[C(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})):Te("",!0)]),extra:R(()=>[s.value?(Z(),ge(x(Se),{key:0,type:"link",onClick:u},{default:R(()=>[Q(ke(i.value.length?"停止":"播放"),1)]),_:1})):(Z(),ae("span",qh," 请先启用MP4或FLV插件 "))]),default:R(()=>[C(x($e),{type:"target",position:x(q).Left},null,8,["position"]),i.value.length?(Z(),ge(Ga,{key:0,src:`${x(xt)("hls","/vod")}/fmp4.m3u8?start=${new Date(i.value[0].startTime).getTime()}&streamPath=${o.value}`},null,8,["src"])):(Z(),ae("span",jh," 录像播放功能:选择录像文件和时间范围进行回放。 点击右上角按钮,可以选择录像进行播放 "))]),_:1}))}}),ep={key:0,class:"p-8px"},tp={key:1,class:"text-12px"},np=le({name:"Upstream"}),op=le({...np,setup(e){const t=Dn(),{nodeHistory:n}=Tt(t),o=[{title:"M7S ID",dataIndex:"m7sId",key:"m7sId"},{title:"IP",dataIndex:"ip",key:"ip"}];return(i,r)=>(Z(),ge(x(Le),{size:"small",class:"w-500px drop-shadow-xl"},{title:R(()=>r[0]||(r[0]=[re("span",null,"上级节点",-1)])),extra:R(()=>[C(x(Se),{disabled:!x(n).length,type:"link",size:"small",onClick:x(t).removeLastNode},{default:R(()=>r[1]||(r[1]=[Q(" 返回上一级 ")])),_:1},8,["disabled","onClick"])]),default:R(()=>[C(x($e),{type:"source",position:x(q).Bottom},null,8,["position"]),x(n).length?(Z(),ae("div",ep,[C(x(Re),{columns:o,"data-source":x(n),size:"small",pagination:!1},null,8,["data-source"])])):(Z(),ae("span",tp," 点击右上角按钮,可以返回上级节点 "))]),_:1}))}}),Wn=Fa({requestOptions:{apiUrl:()=>xt("cascadeserver")}});function ip(){return Wn.get({url:"/list"})}function rp(e){return Wn.post({url:"/create",data:e})}function ap(e){return Wn.post({url:`/delete/${e.id}`})}function sp(e){return Wn.post({url:"/update",data:e})}const lp={key:0},up={key:0,class:"p-8px"},cp={key:1,class:"text-12px"},dp={key:1,class:"p-16px text-center text-gray-500"},fp=le({name:"Downstream"}),hp=le({...fp,props:{data:{default:()=>({active:!1})}},setup(e){const t=e,n=K([]);K(!1),K();const o=()=>({type:"object",properties:{name:{type:"string",title:"节点名称",required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"请输入节点名称"},"x-validator":[{required:!0,message:"请输入节点名称"},{max:50,message:"节点名称不能超过50个字符"}]},secret:{type:"string",title:"密钥","x-decorator":"FormItem","x-component":"Password","x-component-props":{placeholder:"请输入密钥"},"x-validator":[{message:"请输入密钥"}]}}}),i=async d=>{try{await ap(d),Ye.success("删除成功"),u()}catch(f){Ye.error("删除失败:"+f.message)}},r=Oi(),a=[{title:"名称",dataIndex:"name",key:"name",customRender:({record:d})=>d.online?C(Se,{type:"link",size:"small",onClick:()=>{r({name:"Home",params:{m7sId:d.id}})}},{default:()=>[d.name]}):d.name},{title:"IP",dataIndex:"ip",key:"ip"},{title:"状态",key:"status",width:100,customRender:({record:d})=>d.online?"已连接":"未连接"},{title:"操作",key:"action",width:100,customRender:({record:d})=>C(ma,null,{default:()=>[C(Se,{type:"link",size:"small",onClick:()=>s(d)},{default:()=>[Q("修改")]}),C(ga,{title:"确定要删除该节点吗?",onConfirm:()=>i(d)},{default:()=>[C(Se,{type:"link",size:"small",danger:!0},{default:()=>[Q("删除")]})]})]})}],s=d=>{const f=!!d,_=d||{id:Date.now(),name:"",ip:"",secret:"",online:!1},{FormilyForm:y,form:g,submit:v}=ya({schema:o(),formProps:{initialValues:_}});wa({content:()=>C(y,null,null),modalConfig:{title:f?"修改下级节点":"添加下级节点",maskClosable:!1,width:500,onOk:async()=>{try{const w=await v(),m={..._,...w};if(m.online)return Promise.reject("请先断开当前连接");f?(await sp(m),Ye.success("修改成功")):(await rp(m),Ye.success("添加成功")),u()}catch(w){return w===!1?Promise.reject(!1):(Ye.error((f?"修改":"添加")+"失败:"+w.message),Promise.reject(w))}},onClose:()=>{g.reset()}}})};async function u(){if(t.data.active)try{n.value=await ip()}catch(d){Ye.error("获取下级节点列表失败:"+d.message)}}const{pause:l,resume:c}=nt(u);return l(),we(()=>t.data.active,d=>{d?(u(),c()):(n.value=[],l())}),Xe(()=>{t.data.active&&(u(),c())}),(d,f)=>(Z(),ge(x(Le),{size:"small",class:"w-500px drop-shadow-xl"},{title:R(()=>[f[1]||(f[1]=re("span",null,"下级节点",-1)),C(x(Ct),{title:"帮助",content:"下级节点用于配置下级服务器地址,下级节点可以从其上级节点拉流"},{default:R(()=>[C(x(Se),{type:"link",size:"small"},{default:R(()=>[C(x(st),{class:"ml-1 text-gray-400"})]),_:1})]),_:1})]),extra:R(()=>[C(x(Se),{type:"link",size:"small",onClick:f[0]||(f[0]=_=>s()),disabled:!t.data.active},{default:R(()=>f[2]||(f[2]=[Q("添加节点")])),_:1},8,["disabled"])]),default:R(()=>[C(x($e),{type:"target",position:x(q).Top},null,8,["position"]),t.data.active?(Z(),ae("div",lp,[n.value.length?(Z(),ae("div",up,[C(x(Re),{columns:a,"data-source":n.value,size:"small",pagination:!1},null,8,["data-source"])])):(Z(),ae("span",cp," 下级节点功能:配置下级服务器地址,下级节点可以从其上级节点拉流。 点击右上角按钮,可以添加下级节点 "))])):(Z(),ae("div",dp," 服务器需要启用 CascadeServer 插件 "))]),_:1}))}}),pp={class:"text-text"},vp=le({__name:"flow",setup(e){const t={instance:Ae(wh),pullProxy:Ae(bh),pusher:Ae(Mh),debugChart:Ae(Dh),logTrail:Ae(Oh),preview:Ae(Hh),pushProxy:Ae(Uh),readRecord:Ae(Kh),playRecord:Ae(Qh),upstream:Ae(op),downstream:Ae(hp)},n=K(!1),o=K(!1),i=K(!1),r=K(!1),a=Dn(),{online:s}=Tt(a);ca((d,f,_)=>{d.params.m7sId!==f.params.m7sId&&(i.value=!1,r.value=!1,n.value=!1,o.value=!1,_())});const u=ce(()=>({id:"center",type:"instance",data:{onShowDebugChart:()=>{i.value=!0},onShowLogTrail:()=>{r.value=!0}},position:{x:400,y:300}})),l=ce(()=>s.value?[...i.value?[{id:"debugChart",position:{x:100,y:100},data:{onClose:()=>{i.value=!1}},type:"debugChart",zIndex:1e3}]:[],...r.value?[{id:"logTrail",position:{x:100,y:300},type:"logTrail",data:{onClose:()=>{r.value=!1}},zIndex:1001}]:[],{id:"pullProxy",position:{x:50,y:100},targetPosition:q.Right,data:{plugins:a.plugins},type:"pullProxy"},{id:"pushProxy",position:{x:1e3,y:100},data:{plugins:a.plugins},sourcePosition:q.Left,type:"pushProxy"},{id:"pusher",position:{x:50,y:350},data:{plugins:a.plugins,onPush:d=>{n.value=d}},targetPosition:q.Right,type:"pusher"},{id:"player",position:{x:1e3,y:350},data:{plugins:a.plugins,sysInfo:a.sysInfo,onPlay:d=>{o.value=d}},sourcePosition:q.Left,type:"preview"},{id:"upstream",type:"upstream",position:{x:400,y:100},data:{plugins:a.plugins}},{id:"downstream",type:"downstream",position:{x:400,y:700},data:{plugins:a.plugins,active:a.plugins.some(d=>d.name==="CascadeServer")||!1}},u.value,{id:"readRecord",type:"readRecord",data:{plugins:a.plugins},position:{x:50,y:700},targetPosition:q.Right},{id:"playRecord",type:"playRecord",data:{plugins:a.plugins},position:{x:1e3,y:700},sourcePosition:q.Left}]:[u.value]),c=ce(()=>s.value?[{id:"e1->center",source:"pullProxy",target:"center",targetHandle:"target-pull",animated:!0},{id:"epusher->center",source:"pusher",target:"center",targetHandle:"target-push",animated:!0,style:n.value?{stroke:"#000",border:"2px",filter:"drop-shadow(0 0 2px cyan)"}:void 0},{id:"center->pushProxy",source:"center",target:"pushProxy",sourceHandle:"source-push",animated:!0},{id:"center->player",source:"center",target:"player",sourceHandle:"source-play",animated:!0,style:o.value?{stroke:"#000",border:"2px",filter:"drop-shadow(0 0 2px cyan)"}:void 0},{id:"e2->center",source:"upstream",target:"center",targetHandle:"upstream"},{id:"e3->center",source:"center",target:"downstream",sourceHandle:"downstream"},{id:"readRecord->center",source:"readRecord",target:"center",targetHandle:"target-read",animated:!0},{id:"center->playRecord",source:"center",target:"playRecord",sourceHandle:"source-read",animated:!0}]:[]);return(d,f)=>(Z(),ae(He,null,[re("h2",pp,[f[1]||(f[1]=Q(" SagooMedia Admin 超级面板 ")),C(x(De),{color:"green",class:"text-10px v-text-bottom"},{default:R(()=>f[0]||(f[0]=[Q("For SagooIoT m7s Pro V5")])),_:1})]),C(x(Lf),{style:{position:"unset"},nodes:l.value,"node-types":t,edges:c.value,"zoom-on-scroll":!1,"pan-on-drag":!0,"zoom-on-double-click":!1,"nodes-connectable":!1,"select-nodes-on-drag":!1,"connect-on-click":!1,"elements-selectable":!1},{default:R(()=>[C(x(Wf))]),_:1},8,["nodes","edges"])],64))}});const gp={class:"h-100vh w-100vw p-10px",style:{background:"var(--layout-background)"}},mp={class:"h-full w-full flex min-w-1200px"},yp=le({name:"Instance"}),Rp=le({...yp,setup(e){Tt(_a());const t=La();return Tt(t),(n,o)=>(Z(),ae("div",gp,[re("div",mp,[C(x(Le),{class:"flex-1 rounded-r-lg",bodyStyle:{height:"100%"}},{default:R(()=>[C(vp)]),_:1})])]))}});export{Rp as default};