diff --git a/cmd/client/main.go b/cmd/client/main.go index 14ce38c..f698dfa 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -4,7 +4,7 @@ import ( "flag" "log" - "github.com/gotunnel/pkg/tunnel" + "github.com/gotunnel/internal/client/tunnel" ) func main() { diff --git a/cmd/server/main.go b/cmd/server/main.go index 33a3c28..063065e 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -5,25 +5,42 @@ import ( "fmt" "log" - "github.com/gotunnel/pkg/config" - "github.com/gotunnel/pkg/tunnel" - "github.com/gotunnel/pkg/webserver" + "github.com/gotunnel/internal/server/app" + "github.com/gotunnel/internal/server/config" + "github.com/gotunnel/internal/server/db" + "github.com/gotunnel/internal/server/tunnel" ) func main() { configPath := flag.String("c", "server.yaml", "config file path") flag.Parse() + // 加载 YAML 配置 cfg, err := config.LoadServerConfig(*configPath) if err != nil { log.Fatalf("Load config error: %v", err) } - server := tunnel.NewServer(cfg) + // 初始化数据库 + clientStore, err := db.NewSQLiteStore(cfg.Server.DBPath) + if err != nil { + log.Fatalf("Init database error: %v", err) + } + defer clientStore.Close() + + // 创建隧道服务 + server := tunnel.NewServer( + clientStore, + cfg.Server.BindAddr, + cfg.Server.BindPort, + cfg.Server.Token, + cfg.Server.HeartbeatSec, + cfg.Server.HeartbeatTimeout, + ) // 启动 Web 控制台 if cfg.Web.Enabled { - ws := webserver.NewWebServer(cfg, *configPath, server) + ws := app.NewWebServer(clientStore, server) addr := fmt.Sprintf("%s:%d", cfg.Web.BindAddr, cfg.Web.BindPort) go func() { diff --git a/go.mod b/go.mod index debc9b4..9a3207f 100644 --- a/go.mod +++ b/go.mod @@ -7,3 +7,5 @@ require ( github.com/hashicorp/yamux v0.1.1 gopkg.in/yaml.v3 v3.0.1 ) + +require github.com/mattn/go-sqlite3 v1.14.32 // indirect diff --git a/go.sum b/go.sum index 16fe76f..980f813 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= +github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/pkg/tunnel/client.go b/internal/client/tunnel/client.go similarity index 96% rename from pkg/tunnel/client.go rename to internal/client/tunnel/client.go index acea78d..f68f694 100644 --- a/pkg/tunnel/client.go +++ b/internal/client/tunnel/client.go @@ -8,6 +8,7 @@ import ( "time" "github.com/gotunnel/pkg/protocol" + "github.com/gotunnel/pkg/relay" "github.com/google/uuid" "github.com/hashicorp/yamux" ) @@ -57,7 +58,6 @@ func (c *Client) connect() error { return err } - // 发送认证 authReq := protocol.AuthRequest{ClientID: c.ID, Token: c.Token} msg, _ := protocol.NewMessage(protocol.MsgTypeAuth, authReq) if err := protocol.WriteMessage(conn, msg); err != nil { @@ -65,7 +65,6 @@ func (c *Client) connect() error { return err } - // 读取响应 resp, err := protocol.ReadMessage(conn) if err != nil { conn.Close() @@ -81,7 +80,6 @@ func (c *Client) connect() error { log.Printf("[Client] Authenticated as %s", c.ID) - // 建立 Yamux 会话 session, err := yamux.Client(conn, nil) if err != nil { conn.Close() @@ -147,7 +145,6 @@ func (c *Client) handleNewProxy(stream net.Conn, msg *protocol.Message) { var req protocol.NewProxyRequest msg.ParsePayload(&req) - // 查找对应规则 var rule *protocol.ProxyRule c.mu.RLock() for _, r := range c.rules { @@ -163,7 +160,6 @@ func (c *Client) handleNewProxy(stream net.Conn, msg *protocol.Message) { return } - // 连接本地服务 localAddr := fmt.Sprintf("%s:%d", rule.LocalIP, rule.LocalPort) localConn, err := net.DialTimeout("tcp", localAddr, 5*time.Second) if err != nil { @@ -171,8 +167,7 @@ func (c *Client) handleNewProxy(stream net.Conn, msg *protocol.Message) { return } - // 双向转发 - relay(stream, localConn) + relay.Relay(stream, localConn) } // handleHeartbeat 处理心跳 diff --git a/internal/server/app/app.go b/internal/server/app/app.go new file mode 100644 index 0000000..7e3e23b --- /dev/null +++ b/internal/server/app/app.go @@ -0,0 +1,112 @@ +package app + +import ( + "embed" + "io" + "io/fs" + "log" + "net/http" + + "github.com/gotunnel/internal/server/db" + "github.com/gotunnel/internal/server/router" +) + +//go:embed dist/* +var staticFiles embed.FS + +// spaHandler SPA路由处理器 +type spaHandler struct { + fs http.FileSystem +} + +func (h spaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { + path := r.URL.Path + f, err := h.fs.Open(path) + if err != nil { + f, err = h.fs.Open("index.html") + if err != nil { + http.Error(w, "Not Found", http.StatusNotFound) + return + } + } + defer f.Close() + + stat, _ := f.Stat() + if stat.IsDir() { + f, err = h.fs.Open(path + "/index.html") + if err != nil { + f, _ = h.fs.Open("index.html") + } + } + http.ServeContent(w, r, path, stat.ModTime(), f.(io.ReadSeeker)) +} + +// WebServer Web控制台服务 +type WebServer struct { + ClientStore db.ClientStore + Server router.ServerInterface +} + +// NewWebServer 创建Web服务 +func NewWebServer(cs db.ClientStore, srv router.ServerInterface) *WebServer { + return &WebServer{ + ClientStore: cs, + Server: srv, + } +} + +// Run 启动Web服务 +func (w *WebServer) Run(addr string) error { + r := router.New() + router.RegisterRoutes(r, w) + + staticFS, err := fs.Sub(staticFiles, "dist") + if err != nil { + return err + } + r.Handle("/", spaHandler{fs: http.FS(staticFS)}) + + log.Printf("[Web] Console listening on %s", addr) + return http.ListenAndServe(addr, r.Handler()) +} + +// RunWithAuth 启动带认证的Web服务 +func (w *WebServer) RunWithAuth(addr, username, password string) error { + r := router.New() + router.RegisterRoutes(r, w) + + staticFS, err := fs.Sub(staticFiles, "dist") + if err != nil { + return err + } + r.Handle("/", spaHandler{fs: http.FS(staticFS)}) + + handler := &authMiddleware{username, password, r.Handler()} + log.Printf("[Web] Console listening on %s (auth enabled)", addr) + return http.ListenAndServe(addr, handler) +} + +type authMiddleware struct { + username, password string + handler http.Handler +} + +func (a *authMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) { + user, pass, ok := r.BasicAuth() + if !ok || user != a.username || pass != a.password { + w.Header().Set("WWW-Authenticate", `Basic realm="GoTunnel"`) + http.Error(w, "Unauthorized", http.StatusUnauthorized) + return + } + a.handler.ServeHTTP(w, r) +} + +// GetClientStore 获取客户端存储 +func (w *WebServer) GetClientStore() db.ClientStore { + return w.ClientStore +} + +// GetServer 获取服务端接口 +func (w *WebServer) GetServer() router.ServerInterface { + return w.Server +} diff --git a/internal/server/app/dist/assets/ClientView-Dim5xo2q.js b/internal/server/app/dist/assets/ClientView-Dim5xo2q.js new file mode 100644 index 0000000..75017cd --- /dev/null +++ b/internal/server/app/dist/assets/ClientView-Dim5xo2q.js @@ -0,0 +1 @@ +import{d as D,j as F,r,o as I,c as n,a as e,b as p,k as C,u as S,t as s,n as J,F as V,e as g,l as M,m as O,p as P,f as _,v,i as o,_ as $}from"./index-BvqIwKwu.js";const j={class:"client-view"},z={class:"header"},L={key:0,class:"ping-info"},T={class:"rules-section"},q={class:"section-header"},A={key:0},G={key:0,class:"rules-table"},H={key:1,class:"edit-form"},K=["onUpdate:modelValue"],Q=["onUpdate:modelValue"],W=["onUpdate:modelValue"],X=["onUpdate:modelValue"],Y=["onClick"],Z=D({__name:"ClientView",setup(ee){const w=F(),f=S(),u=w.params.id,m=r(!1),h=r(""),b=r([]),i=r(!1),d=r([]),y=async()=>{try{const{data:l}=await M(u);m.value=l.online,h.value=l.last_ping||"",b.value=l.rules||[]}catch(l){console.error("Failed to load client",l)}};I(y);const U=()=>{d.value=JSON.parse(JSON.stringify(b.value)),i.value=!0},R=()=>{i.value=!1},x=()=>{d.value.push({name:"",local_ip:"127.0.0.1",local_port:80,remote_port:8080})},E=l=>{d.value.splice(l,1)},N=async()=>{try{await O(u,{id:u,rules:d.value}),i.value=!1,y()}catch{alert("保存失败")}},B=async()=>{if(confirm("确定删除此客户端?"))try{await P(u),f.push("/")}catch{alert("删除失败")}};return(l,c)=>(o(),n("div",j,[e("div",z,[e("button",{class:"btn",onClick:c[0]||(c[0]=t=>C(f).push("/"))},"← 返回"),e("h2",null,s(C(u)),1),e("span",{class:J(["status-badge",m.value?"online":"offline"])},s(m.value?"在线":"离线"),3)]),h.value?(o(),n("div",L,"最后心跳: "+s(h.value),1)):p("",!0),e("div",T,[e("div",q,[c[1]||(c[1]=e("h3",null,"代理规则",-1)),i.value?p("",!0):(o(),n("div",A,[e("button",{class:"btn primary",onClick:U},"编辑"),e("button",{class:"btn danger",onClick:B},"删除")]))]),i.value?p("",!0):(o(),n("table",G,[c[2]||(c[2]=e("thead",null,[e("tr",null,[e("th",null,"名称"),e("th",null,"本地地址"),e("th",null,"远程端口")])],-1)),e("tbody",null,[(o(!0),n(V,null,g(b.value,t=>(o(),n("tr",{key:t.name},[e("td",null,s(t.name),1),e("td",null,s(t.local_ip)+":"+s(t.local_port),1),e("td",null,s(t.remote_port),1)]))),128))])])),i.value?(o(),n("div",H,[(o(!0),n(V,null,g(d.value,(t,k)=>(o(),n("div",{key:k,class:"rule-row"},[_(e("input",{"onUpdate:modelValue":a=>t.name=a,placeholder:"名称"},null,8,K),[[v,t.name]]),_(e("input",{"onUpdate:modelValue":a=>t.local_ip=a,placeholder:"本地IP"},null,8,Q),[[v,t.local_ip]]),_(e("input",{"onUpdate:modelValue":a=>t.local_port=a,type:"number",placeholder:"本地端口"},null,8,W),[[v,t.local_port,void 0,{number:!0}]]),_(e("input",{"onUpdate:modelValue":a=>t.remote_port=a,type:"number",placeholder:"远程端口"},null,8,X),[[v,t.remote_port,void 0,{number:!0}]]),e("button",{class:"btn-icon",onClick:a=>E(k)},"×",8,Y)]))),128)),e("button",{class:"btn secondary",onClick:x},"+ 添加规则"),e("div",{class:"edit-actions"},[e("button",{class:"btn",onClick:R},"取消"),e("button",{class:"btn primary",onClick:N},"保存")])])):p("",!0)])]))}}),le=$(Z,[["__scopeId","data-v-01b16887"]]);export{le as default}; diff --git a/internal/server/app/dist/assets/ClientView-kscuBolA.css b/internal/server/app/dist/assets/ClientView-kscuBolA.css new file mode 100644 index 0000000..04fbb9f --- /dev/null +++ b/internal/server/app/dist/assets/ClientView-kscuBolA.css @@ -0,0 +1 @@ +.header[data-v-01b16887]{display:flex;align-items:center;gap:16px;margin-bottom:20px}.header h2[data-v-01b16887]{margin:0}.status-badge[data-v-01b16887]{padding:4px 12px;border-radius:12px;font-size:12px}.status-badge.online[data-v-01b16887]{background:#d4edda;color:#155724}.status-badge.offline[data-v-01b16887]{background:#f8d7da;color:#721c24}.ping-info[data-v-01b16887]{color:#666;margin-bottom:20px}.rules-section[data-v-01b16887]{background:#fff;border-radius:8px;padding:20px;box-shadow:0 2px 4px #0000001a}.section-header[data-v-01b16887]{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.section-header h3[data-v-01b16887]{margin:0}.section-header .btn[data-v-01b16887]{margin-left:8px}.btn[data-v-01b16887]{padding:8px 16px;border:none;border-radius:4px;cursor:pointer;font-size:14px}.btn.primary[data-v-01b16887]{background:#3498db;color:#fff}.btn.secondary[data-v-01b16887]{background:#95a5a6;color:#fff}.btn.danger[data-v-01b16887]{background:#e74c3c;color:#fff}.rules-table[data-v-01b16887]{width:100%;border-collapse:collapse}.rules-table th[data-v-01b16887],.rules-table td[data-v-01b16887]{padding:12px;text-align:left;border-bottom:1px solid #eee}.rules-table th[data-v-01b16887]{font-weight:600}.rule-row[data-v-01b16887]{display:flex;gap:8px;margin-bottom:8px}.rule-row input[data-v-01b16887]{flex:1;padding:8px;border:1px solid #ddd;border-radius:4px}.btn-icon[data-v-01b16887]{background:#e74c3c;color:#fff;border:none;border-radius:4px;width:32px;cursor:pointer}.edit-actions[data-v-01b16887]{display:flex;justify-content:flex-end;gap:8px;margin-top:16px} diff --git a/internal/server/app/dist/assets/HomeView-DGCTeR78.js b/internal/server/app/dist/assets/HomeView-DGCTeR78.js new file mode 100644 index 0000000..7bb6dda --- /dev/null +++ b/internal/server/app/dist/assets/HomeView-DGCTeR78.js @@ -0,0 +1 @@ +import{d as M,r as p,o as $,c as n,a as e,b as f,F as h,e as b,w as x,f as u,v as c,g as I,h as R,u as B,i as a,t as C,n as D,_ as F}from"./index-BvqIwKwu.js";const H={class:"home"},N={class:"client-grid"},z=["onClick"],A={class:"card-header"},E={class:"client-id"},L={class:"card-info"},P={key:0,class:"empty"},S={class:"modal"},T={class:"form-group"},j={class:"form-group"},q=["onUpdate:modelValue"],G=["onUpdate:modelValue"],J=["onUpdate:modelValue"],K=["onUpdate:modelValue"],O=["onClick"],Q={class:"modal-actions"},W=M({__name:"HomeView",setup(X){const y=B(),v=p([]),d=p(!1),i=p(""),r=p([]),m=async()=>{try{const{data:t}=await I();v.value=t||[]}catch(t){console.error("Failed to load clients",t)}};$(m);const k=()=>{i.value="",r.value=[{name:"",local_ip:"127.0.0.1",local_port:80,remote_port:8080}],d.value=!0},V=()=>{r.value.push({name:"",local_ip:"127.0.0.1",local_port:80,remote_port:8080})},w=t=>{r.value.splice(t,1)},U=async()=>{if(i.value)try{await R({id:i.value,rules:r.value}),d.value=!1,m()}catch{alert("添加失败")}},g=t=>{y.push(`/client/${t}`)};return(t,l)=>(a(),n("div",H,[e("div",{class:"toolbar"},[l[3]||(l[3]=e("h2",null,"客户端列表",-1)),e("button",{class:"btn primary",onClick:k},"添加客户端")]),e("div",N,[(a(!0),n(h,null,b(v.value,o=>(a(),n("div",{key:o.id,class:"client-card",onClick:_=>g(o.id)},[e("div",A,[e("span",E,C(o.id),1),e("span",{class:D(["status",o.online?"online":"offline"])},null,2)]),e("div",L,[e("span",null,C(o.rule_count)+" 条规则",1)])],8,z))),128))]),v.value.length===0?(a(),n("div",P,"暂无客户端配置")):f("",!0),d.value?(a(),n("div",{key:1,class:"modal-overlay",onClick:l[2]||(l[2]=x(o=>d.value=!1,["self"]))},[e("div",S,[l[6]||(l[6]=e("h3",null,"添加客户端",-1)),e("div",T,[l[4]||(l[4]=e("label",null,"客户端 ID",-1)),u(e("input",{"onUpdate:modelValue":l[0]||(l[0]=o=>i.value=o),placeholder:"例如: client-a"},null,512),[[c,i.value]])]),e("div",j,[l[5]||(l[5]=e("label",null,"代理规则",-1)),(a(!0),n(h,null,b(r.value,(o,_)=>(a(),n("div",{key:_,class:"rule-row"},[u(e("input",{"onUpdate:modelValue":s=>o.name=s,placeholder:"名称"},null,8,q),[[c,o.name]]),u(e("input",{"onUpdate:modelValue":s=>o.local_ip=s,placeholder:"本地IP"},null,8,G),[[c,o.local_ip]]),u(e("input",{"onUpdate:modelValue":s=>o.local_port=s,type:"number",placeholder:"本地端口"},null,8,J),[[c,o.local_port,void 0,{number:!0}]]),u(e("input",{"onUpdate:modelValue":s=>o.remote_port=s,type:"number",placeholder:"远程端口"},null,8,K),[[c,o.remote_port,void 0,{number:!0}]]),e("button",{class:"btn-icon",onClick:s=>w(_)},"×",8,O)]))),128)),e("button",{class:"btn secondary",onClick:V},"+ 添加规则")]),e("div",Q,[e("button",{class:"btn",onClick:l[1]||(l[1]=o=>d.value=!1)},"取消"),e("button",{class:"btn primary",onClick:U},"保存")])])])):f("",!0)]))}}),Z=F(W,[["__scopeId","data-v-fd6e4f1d"]]);export{Z as default}; diff --git a/internal/server/app/dist/assets/HomeView-fC0dyEJ8.css b/internal/server/app/dist/assets/HomeView-fC0dyEJ8.css new file mode 100644 index 0000000..9258f01 --- /dev/null +++ b/internal/server/app/dist/assets/HomeView-fC0dyEJ8.css @@ -0,0 +1 @@ +.toolbar[data-v-fd6e4f1d]{display:flex;justify-content:space-between;align-items:center;margin-bottom:20px}.toolbar h2[data-v-fd6e4f1d]{font-size:18px;color:#2c3e50}.btn[data-v-fd6e4f1d]{padding:8px 16px;border:none;border-radius:4px;cursor:pointer;font-size:14px}.btn.primary[data-v-fd6e4f1d]{background:#3498db;color:#fff}.btn.secondary[data-v-fd6e4f1d]{background:#95a5a6;color:#fff}.client-grid[data-v-fd6e4f1d]{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.client-card[data-v-fd6e4f1d]{background:#fff;border-radius:8px;padding:16px;cursor:pointer;box-shadow:0 2px 4px #0000001a;transition:transform .2s}.client-card[data-v-fd6e4f1d]:hover{transform:translateY(-2px)}.card-header[data-v-fd6e4f1d]{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.client-id[data-v-fd6e4f1d]{font-weight:600}.status[data-v-fd6e4f1d]{width:10px;height:10px;border-radius:50%}.status.online[data-v-fd6e4f1d]{background:#27ae60}.status.offline[data-v-fd6e4f1d]{background:#95a5a6}.card-info[data-v-fd6e4f1d]{font-size:14px;color:#666}.empty[data-v-fd6e4f1d]{text-align:center;color:#999;padding:40px}.modal-overlay[data-v-fd6e4f1d]{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center}.modal[data-v-fd6e4f1d]{background:#fff;border-radius:8px;padding:24px;width:500px;max-width:90%}.modal h3[data-v-fd6e4f1d],.form-group[data-v-fd6e4f1d]{margin-bottom:16px}.form-group label[data-v-fd6e4f1d]{display:block;margin-bottom:8px;font-weight:500}.form-group input[data-v-fd6e4f1d]{width:100%;padding:8px;border:1px solid #ddd;border-radius:4px;box-sizing:border-box}.rule-row[data-v-fd6e4f1d]{display:flex;gap:8px;margin-bottom:8px}.rule-row input[data-v-fd6e4f1d]{flex:1;width:auto}.btn-icon[data-v-fd6e4f1d]{background:#e74c3c;color:#fff;border:none;border-radius:4px;width:32px;cursor:pointer}.modal-actions[data-v-fd6e4f1d]{display:flex;justify-content:flex-end;gap:8px;margin-top:16px} diff --git a/internal/server/app/dist/assets/index-BvqIwKwu.js b/internal/server/app/dist/assets/index-BvqIwKwu.js new file mode 100644 index 0000000..3d95e5b --- /dev/null +++ b/internal/server/app/dist/assets/index-BvqIwKwu.js @@ -0,0 +1,7 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomeView-DGCTeR78.js","assets/HomeView-fC0dyEJ8.css","assets/ClientView-Dim5xo2q.js","assets/ClientView-kscuBolA.css"])))=>i.map(i=>d[i]); +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))s(r);new MutationObserver(r=>{for(const i of r)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&s(o)}).observe(document,{childList:!0,subtree:!0});function n(r){const i={};return r.integrity&&(i.integrity=r.integrity),r.referrerPolicy&&(i.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?i.credentials="include":r.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(r){if(r.ep)return;r.ep=!0;const i=n(r);fetch(r.href,i)}})();function Js(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const ee={},Ht=[],st=()=>{},Fi=()=>!1,Gn=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Xs=e=>e.startsWith("onUpdate:"),me=Object.assign,Qs=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Ol=Object.prototype.hasOwnProperty,Q=(e,t)=>Ol.call(e,t),H=Array.isArray,Vt=e=>zn(e)==="[object Map]",Li=e=>zn(e)==="[object Set]",k=e=>typeof e=="function",ce=e=>typeof e=="string",vt=e=>typeof e=="symbol",re=e=>e!==null&&typeof e=="object",Mi=e=>(re(e)||k(e))&&k(e.then)&&k(e.catch),Ui=Object.prototype.toString,zn=e=>Ui.call(e),Cl=e=>zn(e).slice(8,-1),Bi=e=>zn(e)==="[object Object]",Ys=e=>ce(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,rn=Js(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Jn=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Tl=/-\w/g,Rt=Jn(e=>e.replace(Tl,t=>t.slice(1).toUpperCase())),Pl=/\B([A-Z])/g,Lt=Jn(e=>e.replace(Pl,"-$1").toLowerCase()),ji=Jn(e=>e.charAt(0).toUpperCase()+e.slice(1)),fs=Jn(e=>e?`on${ji(e)}`:""),wt=(e,t)=>!Object.is(e,t),Tn=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},Zs=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let vr;const Xn=()=>vr||(vr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function er(e){if(H(e)){const t={};for(let n=0;n{if(n){const s=n.split(Il);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function tr(e){let t="";if(ce(e))t=e;else if(H(e))for(let n=0;n!!(e&&e.__v_isRef===!0),Pn=e=>ce(e)?e:e==null?"":H(e)||re(e)&&(e.toString===Ui||!k(e.toString))?ki(e)?Pn(e.value):JSON.stringify(e,qi,2):String(e),qi=(e,t)=>ki(t)?qi(e,t.value):Vt(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,r],i)=>(n[ds(s,i)+" =>"]=r,n),{})}:Li(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ds(n))}:vt(t)?ds(t):re(t)&&!H(t)&&!Bi(t)?String(t):t,ds=(e,t="")=>{var n;return vt(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};let Se;class Ul{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Se,!t&&Se&&(this.index=(Se.scopes||(Se.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t0&&--this._on===0&&(Se=this.prevScope,this.prevScope=void 0)}stop(t){if(this._active){this._active=!1;let n,s;for(n=0,s=this.effects.length;n0)return;if(ln){let t=ln;for(ln=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;on;){let t=on;for(on=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function Gi(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function zi(e){let t,n=e.depsTail,s=n;for(;s;){const r=s.prevDep;s.version===-1?(s===n&&(n=r),rr(s),jl(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=r}e.deps=t,e.depsTail=n}function Ts(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ji(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ji(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===hn)||(e.globalVersion=hn,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ts(e))))return;e.flags|=2;const t=e.dep,n=ne,s=Ve;ne=e,Ve=!0;try{Gi(e);const r=e.fn(e._value);(t.version===0||wt(r,e._value))&&(e.flags|=128,e._value=r,t.version++)}catch(r){throw t.version++,r}finally{ne=n,Ve=s,zi(e),e.flags&=-3}}function rr(e,t=!1){const{dep:n,prevSub:s,nextSub:r}=e;if(s&&(s.nextSub=r,e.prevSub=void 0),r&&(r.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)rr(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function jl(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Ve=!0;const Xi=[];function ft(){Xi.push(Ve),Ve=!1}function dt(){const e=Xi.pop();Ve=e===void 0?!0:e}function Ar(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=ne;ne=void 0;try{t()}finally{ne=n}}}let hn=0;class Hl{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ir{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!ne||!Ve||ne===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==ne)n=this.activeLink=new Hl(ne,this),ne.deps?(n.prevDep=ne.depsTail,ne.depsTail.nextDep=n,ne.depsTail=n):ne.deps=ne.depsTail=n,Qi(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=ne.depsTail,n.nextDep=void 0,ne.depsTail.nextDep=n,ne.depsTail=n,ne.deps===n&&(ne.deps=s)}return n}trigger(t){this.version++,hn++,this.notify(t)}notify(t){nr();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{sr()}}}function Qi(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)Qi(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Ps=new WeakMap,Pt=Symbol(""),Ns=Symbol(""),pn=Symbol("");function de(e,t,n){if(Ve&&ne){let s=Ps.get(e);s||Ps.set(e,s=new Map);let r=s.get(n);r||(s.set(n,r=new ir),r.map=s,r.key=n),r.track()}}function at(e,t,n,s,r,i){const o=Ps.get(e);if(!o){hn++;return}const l=c=>{c&&c.trigger()};if(nr(),t==="clear")o.forEach(l);else{const c=H(e),u=c&&Ys(n);if(c&&n==="length"){const a=Number(s);o.forEach((f,p)=>{(p==="length"||p===pn||!vt(p)&&p>=a)&&l(f)})}else switch((n!==void 0||o.has(void 0))&&l(o.get(n)),u&&l(o.get(pn)),t){case"add":c?u&&l(o.get("length")):(l(o.get(Pt)),Vt(e)&&l(o.get(Ns)));break;case"delete":c||(l(o.get(Pt)),Vt(e)&&l(o.get(Ns)));break;case"set":Vt(e)&&l(o.get(Pt));break}}sr()}function Mt(e){const t=X(e);return t===e?t:(de(t,"iterate",pn),Ue(e)?t:t.map(qe))}function Qn(e){return de(e=X(e),"iterate",pn),e}function gt(e,t){return ht(e)?Nt(e)?$t(qe(t)):$t(t):qe(t)}const Vl={__proto__:null,[Symbol.iterator](){return ps(this,Symbol.iterator,e=>gt(this,e))},concat(...e){return Mt(this).concat(...e.map(t=>H(t)?Mt(t):t))},entries(){return ps(this,"entries",e=>(e[1]=gt(this,e[1]),e))},every(e,t){return ot(this,"every",e,t,void 0,arguments)},filter(e,t){return ot(this,"filter",e,t,n=>n.map(s=>gt(this,s)),arguments)},find(e,t){return ot(this,"find",e,t,n=>gt(this,n),arguments)},findIndex(e,t){return ot(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ot(this,"findLast",e,t,n=>gt(this,n),arguments)},findLastIndex(e,t){return ot(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ot(this,"forEach",e,t,void 0,arguments)},includes(...e){return ms(this,"includes",e)},indexOf(...e){return ms(this,"indexOf",e)},join(e){return Mt(this).join(e)},lastIndexOf(...e){return ms(this,"lastIndexOf",e)},map(e,t){return ot(this,"map",e,t,void 0,arguments)},pop(){return Zt(this,"pop")},push(...e){return Zt(this,"push",e)},reduce(e,...t){return xr(this,"reduce",e,t)},reduceRight(e,...t){return xr(this,"reduceRight",e,t)},shift(){return Zt(this,"shift")},some(e,t){return ot(this,"some",e,t,void 0,arguments)},splice(...e){return Zt(this,"splice",e)},toReversed(){return Mt(this).toReversed()},toSorted(e){return Mt(this).toSorted(e)},toSpliced(...e){return Mt(this).toSpliced(...e)},unshift(...e){return Zt(this,"unshift",e)},values(){return ps(this,"values",e=>gt(this,e))}};function ps(e,t,n){const s=Qn(e),r=s[t]();return s!==e&&!Ue(e)&&(r._next=r.next,r.next=()=>{const i=r._next();return i.done||(i.value=n(i.value)),i}),r}const kl=Array.prototype;function ot(e,t,n,s,r,i){const o=Qn(e),l=o!==e&&!Ue(e),c=o[t];if(c!==kl[t]){const f=c.apply(e,i);return l?qe(f):f}let u=n;o!==e&&(l?u=function(f,p){return n.call(this,gt(e,f),p,e)}:n.length>2&&(u=function(f,p){return n.call(this,f,p,e)}));const a=c.call(o,u,s);return l&&r?r(a):a}function xr(e,t,n,s){const r=Qn(e);let i=n;return r!==e&&(Ue(e)?n.length>3&&(i=function(o,l,c){return n.call(this,o,l,c,e)}):i=function(o,l,c){return n.call(this,o,gt(e,l),c,e)}),r[t](i,...s)}function ms(e,t,n){const s=X(e);de(s,"iterate",pn);const r=s[t](...n);return(r===-1||r===!1)&&cr(n[0])?(n[0]=X(n[0]),s[t](...n)):r}function Zt(e,t,n=[]){ft(),nr();const s=X(e)[t].apply(e,n);return sr(),dt(),s}const ql=Js("__proto__,__v_isRef,__isVue"),Yi=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(vt));function $l(e){vt(e)||(e=String(e));const t=X(this);return de(t,"has",e),t.hasOwnProperty(e)}class Zi{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const r=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!r;if(n==="__v_isReadonly")return r;if(n==="__v_isShallow")return i;if(n==="__v_raw")return s===(r?i?ec:so:i?no:to).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const o=H(t);if(!r){let c;if(o&&(c=Vl[n]))return c;if(n==="hasOwnProperty")return $l}const l=Reflect.get(t,n,pe(t)?t:s);if((vt(n)?Yi.has(n):ql(n))||(r||de(t,"get",n),i))return l;if(pe(l)){const c=o&&Ys(n)?l:l.value;return r&&re(c)?Ds(c):c}return re(l)?r?Ds(l):Yn(l):l}}class eo extends Zi{constructor(t=!1){super(!1,t)}set(t,n,s,r){let i=t[n];const o=H(t)&&Ys(n);if(!this._isShallow){const u=ht(i);if(!Ue(s)&&!ht(s)&&(i=X(i),s=X(s)),!o&&pe(i)&&!pe(s))return u||(i.value=s),!0}const l=o?Number(n)e,An=e=>Reflect.getPrototypeOf(e);function Jl(e,t,n){return function(...s){const r=this.__v_raw,i=X(r),o=Vt(i),l=e==="entries"||e===Symbol.iterator&&o,c=e==="keys"&&o,u=r[e](...s),a=n?Is:t?$t:qe;return!t&&de(i,"iterate",c?Ns:Pt),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:l?[a(f[0]),a(f[1])]:a(f),done:p}},[Symbol.iterator](){return this}}}}function xn(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Xl(e,t){const n={get(r){const i=this.__v_raw,o=X(i),l=X(r);e||(wt(r,l)&&de(o,"get",r),de(o,"get",l));const{has:c}=An(o),u=t?Is:e?$t:qe;if(c.call(o,r))return u(i.get(r));if(c.call(o,l))return u(i.get(l));i!==o&&i.get(r)},get size(){const r=this.__v_raw;return!e&&de(X(r),"iterate",Pt),r.size},has(r){const i=this.__v_raw,o=X(i),l=X(r);return e||(wt(r,l)&&de(o,"has",r),de(o,"has",l)),r===l?i.has(r):i.has(r)||i.has(l)},forEach(r,i){const o=this,l=o.__v_raw,c=X(l),u=t?Is:e?$t:qe;return!e&&de(c,"iterate",Pt),l.forEach((a,f)=>r.call(i,u(a),u(f),o))}};return me(n,e?{add:xn("add"),set:xn("set"),delete:xn("delete"),clear:xn("clear")}:{add(r){!t&&!Ue(r)&&!ht(r)&&(r=X(r));const i=X(this);return An(i).has.call(i,r)||(i.add(r),at(i,"add",r,r)),this},set(r,i){!t&&!Ue(i)&&!ht(i)&&(i=X(i));const o=X(this),{has:l,get:c}=An(o);let u=l.call(o,r);u||(r=X(r),u=l.call(o,r));const a=c.call(o,r);return o.set(r,i),u?wt(i,a)&&at(o,"set",r,i):at(o,"add",r,i),this},delete(r){const i=X(this),{has:o,get:l}=An(i);let c=o.call(i,r);c||(r=X(r),c=o.call(i,r)),l&&l.call(i,r);const u=i.delete(r);return c&&at(i,"delete",r,void 0),u},clear(){const r=X(this),i=r.size!==0,o=r.clear();return i&&at(r,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=Jl(r,e,t)}),n}function or(e,t){const n=Xl(e,t);return(s,r,i)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?s:Reflect.get(Q(n,r)&&r in s?n:s,r,i)}const Ql={get:or(!1,!1)},Yl={get:or(!1,!0)},Zl={get:or(!0,!1)};const to=new WeakMap,no=new WeakMap,so=new WeakMap,ec=new WeakMap;function tc(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function nc(e){return e.__v_skip||!Object.isExtensible(e)?0:tc(Cl(e))}function Yn(e){return ht(e)?e:lr(e,!1,Wl,Ql,to)}function ro(e){return lr(e,!1,zl,Yl,no)}function Ds(e){return lr(e,!0,Gl,Zl,so)}function lr(e,t,n,s,r){if(!re(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=nc(e);if(i===0)return e;const o=r.get(e);if(o)return o;const l=new Proxy(e,i===2?s:n);return r.set(e,l),l}function Nt(e){return ht(e)?Nt(e.__v_raw):!!(e&&e.__v_isReactive)}function ht(e){return!!(e&&e.__v_isReadonly)}function Ue(e){return!!(e&&e.__v_isShallow)}function cr(e){return e?!!e.__v_raw:!1}function X(e){const t=e&&e.__v_raw;return t?X(t):e}function sc(e){return!Q(e,"__v_skip")&&Object.isExtensible(e)&&Hi(e,"__v_skip",!0),e}const qe=e=>re(e)?Yn(e):e,$t=e=>re(e)?Ds(e):e;function pe(e){return e?e.__v_isRef===!0:!1}function Fs(e){return io(e,!1)}function rc(e){return io(e,!0)}function io(e,t){return pe(e)?e:new ic(e,t)}class ic{constructor(t,n){this.dep=new ir,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:X(t),this._value=n?t:qe(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||Ue(t)||ht(t);t=s?t:X(t),wt(t,n)&&(this._rawValue=t,this._value=s?t:qe(t),this.dep.trigger())}}function It(e){return pe(e)?e.value:e}const oc={get:(e,t,n)=>t==="__v_raw"?e:It(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const r=e[t];return pe(r)&&!pe(n)?(r.value=n,!0):Reflect.set(e,t,n,s)}};function oo(e){return Nt(e)?e:new Proxy(e,oc)}class lc{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new ir(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=hn-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&ne!==this)return Wi(this,!0),!0}get value(){const t=this.dep.track();return Ji(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function cc(e,t,n=!1){let s,r;return k(e)?s=e:(s=e.get,r=e.set),new lc(s,r,n)}const On={},Bn=new WeakMap;let Ot;function ac(e,t=!1,n=Ot){if(n){let s=Bn.get(n);s||Bn.set(n,s=[]),s.push(e)}}function uc(e,t,n=ee){const{immediate:s,deep:r,once:i,scheduler:o,augmentJob:l,call:c}=n,u=P=>r?P:Ue(P)||r===!1||r===0?ut(P,1):ut(P);let a,f,p,y,g=!1,R=!1;if(pe(e)?(f=()=>e.value,g=Ue(e)):Nt(e)?(f=()=>u(e),g=!0):H(e)?(R=!0,g=e.some(P=>Nt(P)||Ue(P)),f=()=>e.map(P=>{if(pe(P))return P.value;if(Nt(P))return u(P);if(k(P))return c?c(P,2):P()})):k(e)?t?f=c?()=>c(e,2):e:f=()=>{if(p){ft();try{p()}finally{dt()}}const P=Ot;Ot=a;try{return c?c(e,3,[y]):e(y)}finally{Ot=P}}:f=st,t&&r){const P=f,q=r===!0?1/0:r;f=()=>ut(P(),q)}const v=Bl(),C=()=>{a.stop(),v&&v.active&&Qs(v.effects,a)};if(i&&t){const P=t;t=(...q)=>{P(...q),C()}}let N=R?new Array(e.length).fill(On):On;const D=P=>{if(!(!(a.flags&1)||!a.dirty&&!P))if(t){const q=a.run();if(r||g||(R?q.some((se,K)=>wt(se,N[K])):wt(q,N))){p&&p();const se=Ot;Ot=a;try{const K=[q,N===On?void 0:R&&N[0]===On?[]:N,y];N=q,c?c(t,3,K):t(...K)}finally{Ot=se}}}else a.run()};return l&&l(D),a=new $i(f),a.scheduler=o?()=>o(D,!1):D,y=P=>ac(P,!1,a),p=a.onStop=()=>{const P=Bn.get(a);if(P){if(c)c(P,4);else for(const q of P)q();Bn.delete(a)}},t?s?D(!0):N=a.run():o?o(D.bind(null,!0),!0):a.run(),C.pause=a.pause.bind(a),C.resume=a.resume.bind(a),C.stop=C,C}function ut(e,t=1/0,n){if(t<=0||!re(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,pe(e))ut(e.value,t,n);else if(H(e))for(let s=0;s{ut(s,t,n)});else if(Bi(e)){for(const s in e)ut(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&ut(e[s],t,n)}return e}function _n(e,t,n,s){try{return s?e(...s):e()}catch(r){Zn(r,t,n)}}function rt(e,t,n,s){if(k(e)){const r=_n(e,t,n,s);return r&&Mi(r)&&r.catch(i=>{Zn(i,t,n)}),r}if(H(e)){const r=[];for(let i=0;i>>1,r=be[s],i=mn(r);i=mn(n)?be.push(e):be.splice(dc(t),0,e),e.flags|=1,ao()}}function ao(){jn||(jn=lo.then(fo))}function hc(e){H(e)?kt.push(...e):yt&&e.id===-1?yt.splice(Ut+1,0,e):e.flags&1||(kt.push(e),e.flags|=1),ao()}function Or(e,t,n=et+1){for(;nmn(n)-mn(s));if(kt.length=0,yt){yt.push(...t);return}for(yt=t,Ut=0;Ute.id==null?e.flags&2?-1:1/0:e.id;function fo(e){try{for(et=0;et{s._d&&qn(-1);const i=Hn(t);let o;try{o=e(...r)}finally{Hn(i),s._d&&qn(1)}return o};return s._n=!0,s._c=!0,s._d=!0,s}function kd(e,t){if(Me===null)return e;const n=ss(Me),s=e.dirs||(e.dirs=[]);for(let r=0;r1)return n&&k(t)?t.call(s&&s.proxy):t}}const mc=Symbol.for("v-scx"),gc=()=>ke(mc);function In(e,t,n){return po(e,t,n)}function po(e,t,n=ee){const{immediate:s,deep:r,flush:i,once:o}=n,l=me({},n),c=t&&s||!t&&i!=="post";let u;if(yn){if(i==="sync"){const y=gc();u=y.__watcherHandles||(y.__watcherHandles=[])}else if(!c){const y=()=>{};return y.stop=st,y.resume=st,y.pause=st,y}}const a=_e;l.call=(y,g,R)=>rt(y,a,g,R);let f=!1;i==="post"?l.scheduler=y=>{Ne(y,a&&a.suspense)}:i!=="sync"&&(f=!0,l.scheduler=(y,g)=>{g?y():ar(y)}),l.augmentJob=y=>{t&&(y.flags|=4),f&&(y.flags|=2,a&&(y.id=a.uid,y.i=a))};const p=uc(e,t,l);return yn&&(u?u.push(p):c&&p()),p}function yc(e,t,n){const s=this.proxy,r=ce(e)?e.includes(".")?mo(s,e):()=>s[e]:e.bind(s,s);let i;k(t)?i=t:(i=t.handler,n=t);const o=En(this),l=po(r,i.bind(s),n);return o(),l}function mo(e,t){const n=t.split(".");return()=>{let s=e;for(let r=0;re.__isTeleport,Ec=Symbol("_leaveCb");function ur(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ur(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function fr(e,t){return k(e)?me({name:e.name},t,{setup:e}):e}function go(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}const Vn=new WeakMap;function cn(e,t,n,s,r=!1){if(H(e)){e.forEach((g,R)=>cn(g,t&&(H(t)?t[R]:t),n,s,r));return}if(an(s)&&!r){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&cn(e,t,n,s.component.subTree);return}const i=s.shapeFlag&4?ss(s.component):s.el,o=r?null:i,{i:l,r:c}=e,u=t&&t.r,a=l.refs===ee?l.refs={}:l.refs,f=l.setupState,p=X(f),y=f===ee?Fi:g=>Q(p,g);if(u!=null&&u!==c){if(Cr(t),ce(u))a[u]=null,y(u)&&(f[u]=null);else if(pe(u)){u.value=null;const g=t;g.k&&(a[g.k]=null)}}if(k(c))_n(c,l,12,[o,a]);else{const g=ce(c),R=pe(c);if(g||R){const v=()=>{if(e.f){const C=g?y(c)?f[c]:a[c]:c.value;if(r)H(C)&&Qs(C,i);else if(H(C))C.includes(i)||C.push(i);else if(g)a[c]=[i],y(c)&&(f[c]=a[c]);else{const N=[i];c.value=N,e.k&&(a[e.k]=N)}}else g?(a[c]=o,y(c)&&(f[c]=o)):R&&(c.value=o,e.k&&(a[e.k]=o))};if(o){const C=()=>{v(),Vn.delete(e)};C.id=-1,Vn.set(e,C),Ne(C,n)}else Cr(e),v()}}}function Cr(e){const t=Vn.get(e);t&&(t.flags|=8,Vn.delete(e))}Xn().requestIdleCallback;Xn().cancelIdleCallback;const an=e=>!!e.type.__asyncLoader,yo=e=>e.type.__isKeepAlive;function wc(e,t){bo(e,"a",t)}function Rc(e,t){bo(e,"da",t)}function bo(e,t,n=_e){const s=e.__wdc||(e.__wdc=()=>{let r=n;for(;r;){if(r.isDeactivated)return;r=r.parent}return e()});if(es(t,s,n),n){let r=n.parent;for(;r&&r.parent;)yo(r.parent.vnode)&&Sc(s,t,n,r),r=r.parent}}function Sc(e,t,n,s){const r=es(t,e,s,!0);Eo(()=>{Qs(s[t],r)},n)}function es(e,t,n=_e,s=!1){if(n){const r=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...o)=>{ft();const l=En(n),c=rt(t,n,e,o);return l(),dt(),c});return s?r.unshift(i):r.push(i),i}}const pt=e=>(t,n=_e)=>{(!yn||e==="sp")&&es(e,(...s)=>t(...s),n)},vc=pt("bm"),_o=pt("m"),Ac=pt("bu"),xc=pt("u"),Oc=pt("bum"),Eo=pt("um"),Cc=pt("sp"),Tc=pt("rtg"),Pc=pt("rtc");function Nc(e,t=_e){es("ec",e,t)}const Ic=Symbol.for("v-ndc");function qd(e,t,n,s){let r;const i=n,o=H(e);if(o||ce(e)){const l=o&&Nt(e);let c=!1,u=!1;l&&(c=!Ue(e),u=ht(e),e=Qn(e)),r=new Array(e.length);for(let a=0,f=e.length;at(l,c,void 0,i));else{const l=Object.keys(e);r=new Array(l.length);for(let c=0,u=l.length;ce?Ho(e)?ss(e):Ls(e.parent):null,un=me(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ls(e.parent),$root:e=>Ls(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Ro(e),$forceUpdate:e=>e.f||(e.f=()=>{ar(e.update)}),$nextTick:e=>e.n||(e.n=co.bind(e.proxy)),$watch:e=>yc.bind(e)}),gs=(e,t)=>e!==ee&&!e.__isScriptSetup&&Q(e,t),Dc={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:r,props:i,accessCache:o,type:l,appContext:c}=e;if(t[0]!=="$"){const p=o[t];if(p!==void 0)switch(p){case 1:return s[t];case 2:return r[t];case 4:return n[t];case 3:return i[t]}else{if(gs(s,t))return o[t]=1,s[t];if(r!==ee&&Q(r,t))return o[t]=2,r[t];if(Q(i,t))return o[t]=3,i[t];if(n!==ee&&Q(n,t))return o[t]=4,n[t];Ms&&(o[t]=0)}}const u=un[t];let a,f;if(u)return t==="$attrs"&&de(e.attrs,"get",""),u(e);if((a=l.__cssModules)&&(a=a[t]))return a;if(n!==ee&&Q(n,t))return o[t]=4,n[t];if(f=c.config.globalProperties,Q(f,t))return f[t]},set({_:e},t,n){const{data:s,setupState:r,ctx:i}=e;return gs(r,t)?(r[t]=n,!0):s!==ee&&Q(s,t)?(s[t]=n,!0):Q(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:r,props:i,type:o}},l){let c;return!!(n[l]||e!==ee&&l[0]!=="$"&&Q(e,l)||gs(t,l)||Q(i,l)||Q(s,l)||Q(un,l)||Q(r.config.globalProperties,l)||(c=o.__cssModules)&&c[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Q(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Tr(e){return H(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ms=!0;function Fc(e){const t=Ro(e),n=e.proxy,s=e.ctx;Ms=!1,t.beforeCreate&&Pr(t.beforeCreate,e,"bc");const{data:r,computed:i,methods:o,watch:l,provide:c,inject:u,created:a,beforeMount:f,mounted:p,beforeUpdate:y,updated:g,activated:R,deactivated:v,beforeDestroy:C,beforeUnmount:N,destroyed:D,unmounted:P,render:q,renderTracked:se,renderTriggered:K,errorCaptured:Ee,serverPrefetch:Oe,expose:Ce,inheritAttrs:Be,components:De,directives:fe,filters:Te}=t;if(u&&Lc(u,s,null),o)for(const z in o){const $=o[z];k($)&&(s[z]=$.bind(n))}if(r){const z=r.call(n,n);re(z)&&(e.data=Yn(z))}if(Ms=!0,i)for(const z in i){const $=i[z],Fe=k($)?$.bind(n,n):k($.get)?$.get.bind(n,n):st,We=!k($)&&k($.set)?$.set.bind(n):st,ae=He({get:Fe,set:We});Object.defineProperty(s,z,{enumerable:!0,configurable:!0,get:()=>ae.value,set:oe=>ae.value=oe})}if(l)for(const z in l)wo(l[z],s,n,z);if(c){const z=k(c)?c.call(n):c;Reflect.ownKeys(z).forEach($=>{Nn($,z[$])})}a&&Pr(a,e,"c");function Y(z,$){H($)?$.forEach(Fe=>z(Fe.bind(n))):$&&z($.bind(n))}if(Y(vc,f),Y(_o,p),Y(Ac,y),Y(xc,g),Y(wc,R),Y(Rc,v),Y(Nc,Ee),Y(Pc,se),Y(Tc,K),Y(Oc,N),Y(Eo,P),Y(Cc,Oe),H(Ce))if(Ce.length){const z=e.exposed||(e.exposed={});Ce.forEach($=>{Object.defineProperty(z,$,{get:()=>n[$],set:Fe=>n[$]=Fe,enumerable:!0})})}else e.exposed||(e.exposed={});q&&e.render===st&&(e.render=q),Be!=null&&(e.inheritAttrs=Be),De&&(e.components=De),fe&&(e.directives=fe),Oe&&go(e)}function Lc(e,t,n=st){H(e)&&(e=Us(e));for(const s in e){const r=e[s];let i;re(r)?"default"in r?i=ke(r.from||s,r.default,!0):i=ke(r.from||s):i=ke(r),pe(i)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):t[s]=i}}function Pr(e,t,n){rt(H(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function wo(e,t,n,s){let r=s.includes(".")?mo(n,s):()=>n[s];if(ce(e)){const i=t[e];k(i)&&In(r,i)}else if(k(e))In(r,e.bind(n));else if(re(e))if(H(e))e.forEach(i=>wo(i,t,n,s));else{const i=k(e.handler)?e.handler.bind(n):t[e.handler];k(i)&&In(r,i,e)}}function Ro(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:r,optionsCache:i,config:{optionMergeStrategies:o}}=e.appContext,l=i.get(t);let c;return l?c=l:!r.length&&!n&&!s?c=t:(c={},r.length&&r.forEach(u=>kn(c,u,o,!0)),kn(c,t,o)),re(t)&&i.set(t,c),c}function kn(e,t,n,s=!1){const{mixins:r,extends:i}=t;i&&kn(e,i,n,!0),r&&r.forEach(o=>kn(e,o,n,!0));for(const o in t)if(!(s&&o==="expose")){const l=Mc[o]||n&&n[o];e[o]=l?l(e[o],t[o]):t[o]}return e}const Mc={data:Nr,props:Ir,emits:Ir,methods:sn,computed:sn,beforeCreate:ge,created:ge,beforeMount:ge,mounted:ge,beforeUpdate:ge,updated:ge,beforeDestroy:ge,beforeUnmount:ge,destroyed:ge,unmounted:ge,activated:ge,deactivated:ge,errorCaptured:ge,serverPrefetch:ge,components:sn,directives:sn,watch:Bc,provide:Nr,inject:Uc};function Nr(e,t){return t?e?function(){return me(k(e)?e.call(this,this):e,k(t)?t.call(this,this):t)}:t:e}function Uc(e,t){return sn(Us(e),Us(t))}function Us(e){if(H(e)){const t={};for(let n=0;nt==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Rt(t)}Modifiers`]||e[`${Lt(t)}Modifiers`];function kc(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||ee;let r=n;const i=t.startsWith("update:"),o=i&&Vc(s,t.slice(7));o&&(o.trim&&(r=n.map(a=>ce(a)?a.trim():a)),o.number&&(r=n.map(Zs)));let l,c=s[l=fs(t)]||s[l=fs(Rt(t))];!c&&i&&(c=s[l=fs(Lt(t))]),c&&rt(c,e,6,r);const u=s[l+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,rt(u,e,6,r)}}const qc=new WeakMap;function vo(e,t,n=!1){const s=n?qc:t.emitsCache,r=s.get(e);if(r!==void 0)return r;const i=e.emits;let o={},l=!1;if(!k(e)){const c=u=>{const a=vo(u,t,!0);a&&(l=!0,me(o,a))};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}return!i&&!l?(re(e)&&s.set(e,null),null):(H(i)?i.forEach(c=>o[c]=null):me(o,i),re(e)&&s.set(e,o),o)}function ts(e,t){return!e||!Gn(t)?!1:(t=t.slice(2).replace(/Once$/,""),Q(e,t[0].toLowerCase()+t.slice(1))||Q(e,Lt(t))||Q(e,t))}function Dr(e){const{type:t,vnode:n,proxy:s,withProxy:r,propsOptions:[i],slots:o,attrs:l,emit:c,render:u,renderCache:a,props:f,data:p,setupState:y,ctx:g,inheritAttrs:R}=e,v=Hn(e);let C,N;try{if(n.shapeFlag&4){const P=r||s,q=P;C=nt(u.call(q,P,a,f,y,p,g)),N=l}else{const P=t;C=nt(P.length>1?P(f,{attrs:l,slots:o,emit:c}):P(f,null)),N=t.props?l:$c(l)}}catch(P){fn.length=0,Zn(P,e,1),C=ve(St)}let D=C;if(N&&R!==!1){const P=Object.keys(N),{shapeFlag:q}=D;P.length&&q&7&&(i&&P.some(Xs)&&(N=Kc(N,i)),D=Kt(D,N,!1,!0))}return n.dirs&&(D=Kt(D,null,!1,!0),D.dirs=D.dirs?D.dirs.concat(n.dirs):n.dirs),n.transition&&ur(D,n.transition),C=D,Hn(v),C}const $c=e=>{let t;for(const n in e)(n==="class"||n==="style"||Gn(n))&&((t||(t={}))[n]=e[n]);return t},Kc=(e,t)=>{const n={};for(const s in e)(!Xs(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function Wc(e,t,n){const{props:s,children:r,component:i}=e,{props:o,children:l,patchFlag:c}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return s?Fr(s,o,u):!!o;if(c&8){const a=t.dynamicProps;for(let f=0;fObject.create(Ao),Oo=e=>Object.getPrototypeOf(e)===Ao;function zc(e,t,n,s=!1){const r={},i=xo();e.propsDefaults=Object.create(null),Co(e,t,r,i);for(const o in e.propsOptions[0])o in r||(r[o]=void 0);n?e.props=s?r:ro(r):e.type.props?e.props=r:e.props=i,e.attrs=i}function Jc(e,t,n,s){const{props:r,attrs:i,vnode:{patchFlag:o}}=e,l=X(r),[c]=e.propsOptions;let u=!1;if((s||o>0)&&!(o&16)){if(o&8){const a=e.vnode.dynamicProps;for(let f=0;f{c=!0;const[p,y]=To(f,t,!0);me(o,p),y&&l.push(...y)};!n&&t.mixins.length&&t.mixins.forEach(a),e.extends&&a(e.extends),e.mixins&&e.mixins.forEach(a)}if(!i&&!c)return re(e)&&s.set(e,Ht),Ht;if(H(i))for(let a=0;ae==="_"||e==="_ctx"||e==="$stable",hr=e=>H(e)?e.map(nt):[nt(e)],Qc=(e,t,n)=>{if(t._n)return t;const s=pc((...r)=>hr(t(...r)),n);return s._c=!1,s},Po=(e,t,n)=>{const s=e._ctx;for(const r in e){if(dr(r))continue;const i=e[r];if(k(i))t[r]=Qc(r,i,s);else if(i!=null){const o=hr(i);t[r]=()=>o}}},No=(e,t)=>{const n=hr(t);e.slots.default=()=>n},Io=(e,t,n)=>{for(const s in t)(n||!dr(s))&&(e[s]=t[s])},Yc=(e,t,n)=>{const s=e.slots=xo();if(e.vnode.shapeFlag&32){const r=t._;r?(Io(s,t,n),n&&Hi(s,"_",r,!0)):Po(t,s)}else t&&No(e,t)},Zc=(e,t,n)=>{const{vnode:s,slots:r}=e;let i=!0,o=ee;if(s.shapeFlag&32){const l=t._;l?n&&l===1?i=!1:Io(r,t,n):(i=!t.$stable,Po(t,r)),o=t}else t&&(No(e,t),o={default:1});if(i)for(const l in r)!dr(l)&&o[l]==null&&delete r[l]},Ne=ra;function ea(e){return ta(e)}function ta(e,t){const n=Xn();n.__VUE__=!0;const{insert:s,remove:r,patchProp:i,createElement:o,createText:l,createComment:c,setText:u,setElementText:a,parentNode:f,nextSibling:p,setScopeId:y=st,insertStaticContent:g}=e,R=(d,h,m,_=null,S=null,E=null,T=void 0,O=null,x=!!h.dynamicChildren)=>{if(d===h)return;d&&!en(d,h)&&(_=w(d),oe(d,S,E,!0),d=null),h.patchFlag===-2&&(x=!1,h.dynamicChildren=null);const{type:A,ref:B,shapeFlag:F}=h;switch(A){case ns:v(d,h,m,_);break;case St:C(d,h,m,_);break;case bs:d==null&&N(h,m,_,T);break;case tt:De(d,h,m,_,S,E,T,O,x);break;default:F&1?q(d,h,m,_,S,E,T,O,x):F&6?fe(d,h,m,_,S,E,T,O,x):(F&64||F&128)&&A.process(d,h,m,_,S,E,T,O,x,M)}B!=null&&S?cn(B,d&&d.ref,E,h||d,!h):B==null&&d&&d.ref!=null&&cn(d.ref,null,E,d,!0)},v=(d,h,m,_)=>{if(d==null)s(h.el=l(h.children),m,_);else{const S=h.el=d.el;h.children!==d.children&&u(S,h.children)}},C=(d,h,m,_)=>{d==null?s(h.el=c(h.children||""),m,_):h.el=d.el},N=(d,h,m,_)=>{[d.el,d.anchor]=g(d.children,h,m,_,d.el,d.anchor)},D=({el:d,anchor:h},m,_)=>{let S;for(;d&&d!==h;)S=p(d),s(d,m,_),d=S;s(h,m,_)},P=({el:d,anchor:h})=>{let m;for(;d&&d!==h;)m=p(d),r(d),d=m;r(h)},q=(d,h,m,_,S,E,T,O,x)=>{if(h.type==="svg"?T="svg":h.type==="math"&&(T="mathml"),d==null)se(h,m,_,S,E,T,O,x);else{const A=d.el&&d.el._isVueCE?d.el:null;try{A&&A._beginPatch(),Oe(d,h,S,E,T,O,x)}finally{A&&A._endPatch()}}},se=(d,h,m,_,S,E,T,O)=>{let x,A;const{props:B,shapeFlag:F,transition:U,dirs:j}=d;if(x=d.el=o(d.type,E,B&&B.is,B),F&8?a(x,d.children):F&16&&Ee(d.children,x,null,_,S,ys(d,E),T,O),j&&At(d,null,_,"created"),K(x,d,d.scopeId,T,_),B){for(const te in B)te!=="value"&&!rn(te)&&i(x,te,null,B[te],E,_);"value"in B&&i(x,"value",null,B.value,E),(A=B.onVnodeBeforeMount)&&Ye(A,_,d)}j&&At(d,null,_,"beforeMount");const G=na(S,U);G&&U.beforeEnter(x),s(x,h,m),((A=B&&B.onVnodeMounted)||G||j)&&Ne(()=>{A&&Ye(A,_,d),G&&U.enter(x),j&&At(d,null,_,"mounted")},S)},K=(d,h,m,_,S)=>{if(m&&y(d,m),_)for(let E=0;E<_.length;E++)y(d,_[E]);if(S){let E=S.subTree;if(h===E||Mo(E.type)&&(E.ssContent===h||E.ssFallback===h)){const T=S.vnode;K(d,T,T.scopeId,T.slotScopeIds,S.parent)}}},Ee=(d,h,m,_,S,E,T,O,x=0)=>{for(let A=x;A{const O=h.el=d.el;let{patchFlag:x,dynamicChildren:A,dirs:B}=h;x|=d.patchFlag&16;const F=d.props||ee,U=h.props||ee;let j;if(m&&xt(m,!1),(j=U.onVnodeBeforeUpdate)&&Ye(j,m,h,d),B&&At(h,d,m,"beforeUpdate"),m&&xt(m,!0),(F.innerHTML&&U.innerHTML==null||F.textContent&&U.textContent==null)&&a(O,""),A?Ce(d.dynamicChildren,A,O,m,_,ys(h,S),E):T||$(d,h,O,null,m,_,ys(h,S),E,!1),x>0){if(x&16)Be(O,F,U,m,S);else if(x&2&&F.class!==U.class&&i(O,"class",null,U.class,S),x&4&&i(O,"style",F.style,U.style,S),x&8){const G=h.dynamicProps;for(let te=0;te{j&&Ye(j,m,h,d),B&&At(h,d,m,"updated")},_)},Ce=(d,h,m,_,S,E,T)=>{for(let O=0;O{if(h!==m){if(h!==ee)for(const E in h)!rn(E)&&!(E in m)&&i(d,E,h[E],null,S,_);for(const E in m){if(rn(E))continue;const T=m[E],O=h[E];T!==O&&E!=="value"&&i(d,E,O,T,S,_)}"value"in m&&i(d,"value",h.value,m.value,S)}},De=(d,h,m,_,S,E,T,O,x)=>{const A=h.el=d?d.el:l(""),B=h.anchor=d?d.anchor:l("");let{patchFlag:F,dynamicChildren:U,slotScopeIds:j}=h;j&&(O=O?O.concat(j):j),d==null?(s(A,m,_),s(B,m,_),Ee(h.children||[],m,B,S,E,T,O,x)):F>0&&F&64&&U&&d.dynamicChildren&&d.dynamicChildren.length===U.length?(Ce(d.dynamicChildren,U,m,S,E,T,O),(h.key!=null||S&&h===S.subTree)&&Do(d,h,!0)):$(d,h,m,B,S,E,T,O,x)},fe=(d,h,m,_,S,E,T,O,x)=>{h.slotScopeIds=O,d==null?h.shapeFlag&512?S.ctx.activate(h,m,_,T,x):Te(h,m,_,S,E,T,x):it(d,h,x)},Te=(d,h,m,_,S,E,T)=>{const O=d.component=pa(d,_,S);if(yo(d)&&(O.ctx.renderer=M),ga(O,!1,T),O.asyncDep){if(S&&S.registerDep(O,Y,T),!d.el){const x=O.subTree=ve(St);C(null,x,h,m),d.placeholder=x.el}}else Y(O,d,h,m,S,E,T)},it=(d,h,m)=>{const _=h.component=d.component;if(Wc(d,h,m))if(_.asyncDep&&!_.asyncResolved){z(_,h,m);return}else _.next=h,_.update();else h.el=d.el,_.vnode=h},Y=(d,h,m,_,S,E,T)=>{const O=()=>{if(d.isMounted){let{next:F,bu:U,u:j,parent:G,vnode:te}=d;{const Xe=Fo(d);if(Xe){F&&(F.el=te.el,z(d,F,T)),Xe.asyncDep.then(()=>{d.isUnmounted||O()});return}}let Z=F,we;xt(d,!1),F?(F.el=te.el,z(d,F,T)):F=te,U&&Tn(U),(we=F.props&&F.props.onVnodeBeforeUpdate)&&Ye(we,G,F,te),xt(d,!0);const Re=Dr(d),Je=d.subTree;d.subTree=Re,R(Je,Re,f(Je.el),w(Je),d,S,E),F.el=Re.el,Z===null&&Gc(d,Re.el),j&&Ne(j,S),(we=F.props&&F.props.onVnodeUpdated)&&Ne(()=>Ye(we,G,F,te),S)}else{let F;const{el:U,props:j}=h,{bm:G,m:te,parent:Z,root:we,type:Re}=d,Je=an(h);xt(d,!1),G&&Tn(G),!Je&&(F=j&&j.onVnodeBeforeMount)&&Ye(F,Z,h),xt(d,!0);{we.ce&&we.ce._def.shadowRoot!==!1&&we.ce._injectChildStyle(Re);const Xe=d.subTree=Dr(d);R(null,Xe,m,_,d,S,E),h.el=Xe.el}if(te&&Ne(te,S),!Je&&(F=j&&j.onVnodeMounted)){const Xe=h;Ne(()=>Ye(F,Z,Xe),S)}(h.shapeFlag&256||Z&&an(Z.vnode)&&Z.vnode.shapeFlag&256)&&d.a&&Ne(d.a,S),d.isMounted=!0,h=m=_=null}};d.scope.on();const x=d.effect=new $i(O);d.scope.off();const A=d.update=x.run.bind(x),B=d.job=x.runIfDirty.bind(x);B.i=d,B.id=d.uid,x.scheduler=()=>ar(B),xt(d,!0),A()},z=(d,h,m)=>{h.component=d;const _=d.vnode.props;d.vnode=h,d.next=null,Jc(d,h.props,_,m),Zc(d,h.children,m),ft(),Or(d),dt()},$=(d,h,m,_,S,E,T,O,x=!1)=>{const A=d&&d.children,B=d?d.shapeFlag:0,F=h.children,{patchFlag:U,shapeFlag:j}=h;if(U>0){if(U&128){We(A,F,m,_,S,E,T,O,x);return}else if(U&256){Fe(A,F,m,_,S,E,T,O,x);return}}j&8?(B&16&&Le(A,S,E),F!==A&&a(m,F)):B&16?j&16?We(A,F,m,_,S,E,T,O,x):Le(A,S,E,!0):(B&8&&a(m,""),j&16&&Ee(F,m,_,S,E,T,O,x))},Fe=(d,h,m,_,S,E,T,O,x)=>{d=d||Ht,h=h||Ht;const A=d.length,B=h.length,F=Math.min(A,B);let U;for(U=0;UB?Le(d,S,E,!0,!1,F):Ee(h,m,_,S,E,T,O,x,F)},We=(d,h,m,_,S,E,T,O,x)=>{let A=0;const B=h.length;let F=d.length-1,U=B-1;for(;A<=F&&A<=U;){const j=d[A],G=h[A]=x?_t(h[A]):nt(h[A]);if(en(j,G))R(j,G,m,null,S,E,T,O,x);else break;A++}for(;A<=F&&A<=U;){const j=d[F],G=h[U]=x?_t(h[U]):nt(h[U]);if(en(j,G))R(j,G,m,null,S,E,T,O,x);else break;F--,U--}if(A>F){if(A<=U){const j=U+1,G=jU)for(;A<=F;)oe(d[A],S,E,!0),A++;else{const j=A,G=A,te=new Map;for(A=G;A<=U;A++){const Pe=h[A]=x?_t(h[A]):nt(h[A]);Pe.key!=null&&te.set(Pe.key,A)}let Z,we=0;const Re=U-G+1;let Je=!1,Xe=0;const Yt=new Array(Re);for(A=0;A=Re){oe(Pe,S,E,!0);continue}let Qe;if(Pe.key!=null)Qe=te.get(Pe.key);else for(Z=G;Z<=U;Z++)if(Yt[Z-G]===0&&en(Pe,h[Z])){Qe=Z;break}Qe===void 0?oe(Pe,S,E,!0):(Yt[Qe-G]=A+1,Qe>=Xe?Xe=Qe:Je=!0,R(Pe,h[Qe],m,null,S,E,T,O,x),we++)}const wr=Je?sa(Yt):Ht;for(Z=wr.length-1,A=Re-1;A>=0;A--){const Pe=G+A,Qe=h[Pe],Rr=h[Pe+1],Sr=Pe+1{const{el:E,type:T,transition:O,children:x,shapeFlag:A}=d;if(A&6){ae(d.component.subTree,h,m,_);return}if(A&128){d.suspense.move(h,m,_);return}if(A&64){T.move(d,h,m,M);return}if(T===tt){s(E,h,m);for(let F=0;FO.enter(E),S);else{const{leave:F,delayLeave:U,afterLeave:j}=O,G=()=>{d.ctx.isUnmounted?r(E):s(E,h,m)},te=()=>{E._isLeaving&&E[Ec](!0),F(E,()=>{G(),j&&j()})};U?U(E,G,te):te()}else s(E,h,m)},oe=(d,h,m,_=!1,S=!1)=>{const{type:E,props:T,ref:O,children:x,dynamicChildren:A,shapeFlag:B,patchFlag:F,dirs:U,cacheIndex:j}=d;if(F===-2&&(S=!1),O!=null&&(ft(),cn(O,null,m,d,!0),dt()),j!=null&&(h.renderCache[j]=void 0),B&256){h.ctx.deactivate(d);return}const G=B&1&&U,te=!an(d);let Z;if(te&&(Z=T&&T.onVnodeBeforeUnmount)&&Ye(Z,h,d),B&6)ze(d.component,m,_);else{if(B&128){d.suspense.unmount(m,_);return}G&&At(d,null,h,"beforeUnmount"),B&64?d.type.remove(d,h,m,M,_):A&&!A.hasOnce&&(E!==tt||F>0&&F&64)?Le(A,h,m,!1,!0):(E===tt&&F&384||!S&&B&16)&&Le(x,h,m),_&&Ge(d)}(te&&(Z=T&&T.onVnodeUnmounted)||G)&&Ne(()=>{Z&&Ye(Z,h,d),G&&At(d,null,h,"unmounted")},m)},Ge=d=>{const{type:h,el:m,anchor:_,transition:S}=d;if(h===tt){je(m,_);return}if(h===bs){P(d);return}const E=()=>{r(m),S&&!S.persisted&&S.afterLeave&&S.afterLeave()};if(d.shapeFlag&1&&S&&!S.persisted){const{leave:T,delayLeave:O}=S,x=()=>T(m,E);O?O(d.el,E,x):x()}else E()},je=(d,h)=>{let m;for(;d!==h;)m=p(d),r(d),d=m;r(h)},ze=(d,h,m)=>{const{bum:_,scope:S,job:E,subTree:T,um:O,m:x,a:A}=d;Mr(x),Mr(A),_&&Tn(_),S.stop(),E&&(E.flags|=8,oe(T,d,h,m)),O&&Ne(O,h),Ne(()=>{d.isUnmounted=!0},h)},Le=(d,h,m,_=!1,S=!1,E=0)=>{for(let T=E;T{if(d.shapeFlag&6)return w(d.component.subTree);if(d.shapeFlag&128)return d.suspense.next();const h=p(d.anchor||d.el),m=h&&h[bc];return m?p(m):h};let L=!1;const I=(d,h,m)=>{let _;d==null?h._vnode&&(oe(h._vnode,null,null,!0),_=h._vnode.component):R(h._vnode||null,d,h,null,null,null,m),h._vnode=d,L||(L=!0,Or(_),uo(),L=!1)},M={p:R,um:oe,m:ae,r:Ge,mt:Te,mc:Ee,pc:$,pbc:Ce,n:w,o:e};return{render:I,hydrate:void 0,createApp:Hc(I)}}function ys({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function xt({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function na(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Do(e,t,n=!1){const s=e.children,r=t.children;if(H(s)&&H(r))for(let i=0;i>1,e[n[l]]0&&(t[s]=n[i-1]),n[i]=s)}}for(i=n.length,o=n[i-1];i-- >0;)n[i]=o,o=t[o];return n}function Fo(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Fo(t)}function Mr(e){if(e)for(let t=0;te.__isSuspense;function ra(e,t){t&&t.pendingBranch?H(e)?t.effects.push(...e):t.effects.push(e):hc(e)}const tt=Symbol.for("v-fgt"),ns=Symbol.for("v-txt"),St=Symbol.for("v-cmt"),bs=Symbol.for("v-stc"),fn=[];let Ie=null;function Uo(e=!1){fn.push(Ie=e?null:[])}function ia(){fn.pop(),Ie=fn[fn.length-1]||null}let gn=1;function qn(e,t=!1){gn+=e,e<0&&Ie&&t&&(Ie.hasOnce=!0)}function Bo(e){return e.dynamicChildren=gn>0?Ie||Ht:null,ia(),gn>0&&Ie&&Ie.push(e),e}function oa(e,t,n,s,r,i){return Bo(bt(e,t,n,s,r,i,!0))}function la(e,t,n,s,r){return Bo(ve(e,t,n,s,r,!0))}function $n(e){return e?e.__v_isVNode===!0:!1}function en(e,t){return e.type===t.type&&e.key===t.key}const jo=({key:e})=>e??null,Dn=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?ce(e)||pe(e)||k(e)?{i:Me,r:e,k:t,f:!!n}:e:null);function bt(e,t=null,n=null,s=0,r=null,i=e===tt?0:1,o=!1,l=!1){const c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&jo(t),ref:t&&Dn(t),scopeId:ho,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:r,dynamicChildren:null,appContext:null,ctx:Me};return l?(pr(c,n),i&128&&e.normalize(c)):n&&(c.shapeFlag|=ce(n)?8:16),gn>0&&!o&&Ie&&(c.patchFlag>0||i&6)&&c.patchFlag!==32&&Ie.push(c),c}const ve=ca;function ca(e,t=null,n=null,s=0,r=null,i=!1){if((!e||e===Ic)&&(e=St),$n(e)){const l=Kt(e,t,!0);return n&&pr(l,n),gn>0&&!i&&Ie&&(l.shapeFlag&6?Ie[Ie.indexOf(e)]=l:Ie.push(l)),l.patchFlag=-2,l}if(Ea(e)&&(e=e.__vccOpts),t){t=aa(t);let{class:l,style:c}=t;l&&!ce(l)&&(t.class=tr(l)),re(c)&&(cr(c)&&!H(c)&&(c=me({},c)),t.style=er(c))}const o=ce(e)?1:Mo(e)?128:_c(e)?64:re(e)?4:k(e)?2:0;return bt(e,t,n,s,r,o,i,!0)}function aa(e){return e?cr(e)||Oo(e)?me({},e):e:null}function Kt(e,t,n=!1,s=!1){const{props:r,ref:i,patchFlag:o,children:l,transition:c}=e,u=t?fa(r||{},t):r,a={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&jo(u),ref:t&&t.ref?n&&i?H(i)?i.concat(Dn(t)):[i,Dn(t)]:Dn(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==tt?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Kt(e.ssContent),ssFallback:e.ssFallback&&Kt(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return c&&s&&ur(a,c.clone(a)),a}function ua(e=" ",t=0){return ve(ns,null,e,t)}function $d(e="",t=!1){return t?(Uo(),la(St,null,e)):ve(St,null,e)}function nt(e){return e==null||typeof e=="boolean"?ve(St):H(e)?ve(tt,null,e.slice()):$n(e)?_t(e):ve(ns,null,String(e))}function _t(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Kt(e)}function pr(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(H(t))n=16;else if(typeof t=="object")if(s&65){const r=t.default;r&&(r._c&&(r._d=!1),pr(e,r()),r._c&&(r._d=!0));return}else{n=32;const r=t._;!r&&!Oo(t)?t._ctx=Me:r===3&&Me&&(Me.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else k(t)?(t={default:t,_ctx:Me},n=32):(t=String(t),s&64?(n=16,t=[ua(t)]):n=8);e.children=t,e.shapeFlag|=n}function fa(...e){const t={};for(let n=0;n_e||Me;let Kn,js;{const e=Xn(),t=(n,s)=>{let r;return(r=e[n])||(r=e[n]=[]),r.push(s),i=>{r.length>1?r.forEach(o=>o(i)):r[0](i)}};Kn=t("__VUE_INSTANCE_SETTERS__",n=>_e=n),js=t("__VUE_SSR_SETTERS__",n=>yn=n)}const En=e=>{const t=_e;return Kn(e),e.scope.on(),()=>{e.scope.off(),Kn(t)}},Ur=()=>{_e&&_e.scope.off(),Kn(null)};function Ho(e){return e.vnode.shapeFlag&4}let yn=!1;function ga(e,t=!1,n=!1){t&&js(t);const{props:s,children:r}=e.vnode,i=Ho(e);zc(e,s,i,t),Yc(e,r,n||t);const o=i?ya(e,t):void 0;return t&&js(!1),o}function ya(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Dc);const{setup:s}=n;if(s){ft();const r=e.setupContext=s.length>1?_a(e):null,i=En(e),o=_n(s,e,0,[e.props,r]),l=Mi(o);if(dt(),i(),(l||e.sp)&&!an(e)&&go(e),l){if(o.then(Ur,Ur),t)return o.then(c=>{Br(e,c)}).catch(c=>{Zn(c,e,0)});e.asyncDep=o}else Br(e,o)}else Vo(e)}function Br(e,t,n){k(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:re(t)&&(e.setupState=oo(t)),Vo(e)}function Vo(e,t,n){const s=e.type;e.render||(e.render=s.render||st);{const r=En(e);ft();try{Fc(e)}finally{dt(),r()}}}const ba={get(e,t){return de(e,"get",""),e[t]}};function _a(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,ba),slots:e.slots,emit:e.emit,expose:t}}function ss(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(oo(sc(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in un)return un[n](e)},has(t,n){return n in t||n in un}})):e.proxy}function Ea(e){return k(e)&&"__vccOpts"in e}const He=(e,t)=>cc(e,t,yn);function ko(e,t,n){try{qn(-1);const s=arguments.length;return s===2?re(t)&&!H(t)?$n(t)?ve(e,null,[t]):ve(e,t):ve(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&$n(n)&&(n=[n]),ve(e,t,n))}finally{qn(1)}}const wa="3.5.26";let Hs;const jr=typeof window<"u"&&window.trustedTypes;if(jr)try{Hs=jr.createPolicy("vue",{createHTML:e=>e})}catch{}const qo=Hs?e=>Hs.createHTML(e):e=>e,Ra="http://www.w3.org/2000/svg",Sa="http://www.w3.org/1998/Math/MathML",ct=typeof document<"u"?document:null,Hr=ct&&ct.createElement("template"),va={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const r=t==="svg"?ct.createElementNS(Ra,e):t==="mathml"?ct.createElementNS(Sa,e):n?ct.createElement(e,{is:n}):ct.createElement(e);return e==="select"&&s&&s.multiple!=null&&r.setAttribute("multiple",s.multiple),r},createText:e=>ct.createTextNode(e),createComment:e=>ct.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>ct.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,r,i){const o=n?n.previousSibling:t.lastChild;if(r&&(r===i||r.nextSibling))for(;t.insertBefore(r.cloneNode(!0),n),!(r===i||!(r=r.nextSibling)););else{Hr.innerHTML=qo(s==="svg"?`${e}`:s==="mathml"?`${e}`:e);const l=Hr.content;if(s==="svg"||s==="mathml"){const c=l.firstChild;for(;c.firstChild;)l.appendChild(c.firstChild);l.removeChild(c)}t.insertBefore(l,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Aa=Symbol("_vtc");function xa(e,t,n){const s=e[Aa];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Vr=Symbol("_vod"),Oa=Symbol("_vsh"),Ca=Symbol(""),Ta=/(?:^|;)\s*display\s*:/;function Pa(e,t,n){const s=e.style,r=ce(n);let i=!1;if(n&&!r){if(t)if(ce(t))for(const o of t.split(";")){const l=o.slice(0,o.indexOf(":")).trim();n[l]==null&&Fn(s,l,"")}else for(const o in t)n[o]==null&&Fn(s,o,"");for(const o in n)o==="display"&&(i=!0),Fn(s,o,n[o])}else if(r){if(t!==n){const o=s[Ca];o&&(n+=";"+o),s.cssText=n,i=Ta.test(n)}}else t&&e.removeAttribute("style");Vr in e&&(e[Vr]=i?s.display:"",e[Oa]&&(s.display="none"))}const kr=/\s*!important$/;function Fn(e,t,n){if(H(n))n.forEach(s=>Fn(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=Na(e,t);kr.test(n)?e.setProperty(Lt(s),n.replace(kr,""),"important"):e[s]=n}}const qr=["Webkit","Moz","ms"],_s={};function Na(e,t){const n=_s[t];if(n)return n;let s=Rt(t);if(s!=="filter"&&s in e)return _s[t]=s;s=ji(s);for(let r=0;rEs||(La.then(()=>Es=0),Es=Date.now());function Ua(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;rt(Ba(s,n.value),t,5,[s])};return n.value=e,n.attached=Ma(),n}function Ba(e,t){if(H(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(s=>r=>!r._stopped&&s&&s(r))}else return t}const Jr=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,ja=(e,t,n,s,r,i)=>{const o=r==="svg";t==="class"?xa(e,s,o):t==="style"?Pa(e,n,s):Gn(t)?Xs(t)||Da(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Ha(e,t,s,o))?(Wr(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Kr(e,t,s,o,i,t!=="value")):e._isVueCE&&(/[A-Z]/.test(t)||!ce(s))?Wr(e,Rt(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Kr(e,t,s,o))};function Ha(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Jr(t)&&k(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const r=e.tagName;if(r==="IMG"||r==="VIDEO"||r==="CANVAS"||r==="SOURCE")return!1}return Jr(t)&&ce(n)?!1:t in e}const Xr=e=>{const t=e.props["onUpdate:modelValue"]||!1;return H(t)?n=>Tn(t,n):t};function Va(e){e.target.composing=!0}function Qr(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const ws=Symbol("_assign");function Yr(e,t,n){return t&&(e=e.trim()),n&&(e=Zs(e)),e}const Kd={created(e,{modifiers:{lazy:t,trim:n,number:s}},r){e[ws]=Xr(r);const i=s||r.props&&r.props.type==="number";Bt(e,t?"change":"input",o=>{o.target.composing||e[ws](Yr(e.value,n,i))}),(n||i)&&Bt(e,"change",()=>{e.value=Yr(e.value,n,i)}),t||(Bt(e,"compositionstart",Va),Bt(e,"compositionend",Qr),Bt(e,"change",Qr))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:r,number:i}},o){if(e[ws]=Xr(o),e.composing)return;const l=(i||e.type==="number")&&!/^0\d/.test(e.value)?Zs(e.value):e.value,c=t??"";l!==c&&(document.activeElement===e&&e.type!=="range"&&(s&&t===n||r&&e.value.trim()===c)||(e.value=c))}},ka=["ctrl","shift","alt","meta"],qa={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>ka.some(n=>e[`${n}Key`]&&!t.includes(n))},Wd=(e,t)=>{const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((r,...i)=>{for(let o=0;o{const t=Ka().createApp(...e),{mount:n}=t;return t.mount=s=>{const r=za(s);if(!r)return;const i=t._component;!k(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent="");const o=n(r,!1,Ga(r));return r instanceof Element&&(r.removeAttribute("v-cloak"),r.setAttribute("data-v-app","")),o},t});function Ga(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function za(e){return ce(e)?document.querySelector(e):e}const jt=typeof document<"u";function $o(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Ja(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&$o(e.default)}const J=Object.assign;function Rs(e,t){const n={};for(const s in t){const r=t[s];n[s]=$e(r)?r.map(e):e(r)}return n}const dn=()=>{},$e=Array.isArray;function ei(e,t){const n={};for(const s in e)n[s]=s in t?t[s]:e[s];return n}const Ko=/#/g,Xa=/&/g,Qa=/\//g,Ya=/=/g,Za=/\?/g,Wo=/\+/g,eu=/%5B/g,tu=/%5D/g,Go=/%5E/g,nu=/%60/g,zo=/%7B/g,su=/%7C/g,Jo=/%7D/g,ru=/%20/g;function mr(e){return e==null?"":encodeURI(""+e).replace(su,"|").replace(eu,"[").replace(tu,"]")}function iu(e){return mr(e).replace(zo,"{").replace(Jo,"}").replace(Go,"^")}function Vs(e){return mr(e).replace(Wo,"%2B").replace(ru,"+").replace(Ko,"%23").replace(Xa,"%26").replace(nu,"`").replace(zo,"{").replace(Jo,"}").replace(Go,"^")}function ou(e){return Vs(e).replace(Ya,"%3D")}function lu(e){return mr(e).replace(Ko,"%23").replace(Za,"%3F")}function cu(e){return lu(e).replace(Qa,"%2F")}function bn(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const au=/\/$/,uu=e=>e.replace(au,"");function Ss(e,t,n="/"){let s,r={},i="",o="";const l=t.indexOf("#");let c=t.indexOf("?");return c=l>=0&&c>l?-1:c,c>=0&&(s=t.slice(0,c),i=t.slice(c,l>0?l:t.length),r=e(i.slice(1))),l>=0&&(s=s||t.slice(0,l),o=t.slice(l,t.length)),s=pu(s??t,n),{fullPath:s+i+o,path:s,query:r,hash:bn(o)}}function fu(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function ti(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function du(e,t,n){const s=t.matched.length-1,r=n.matched.length-1;return s>-1&&s===r&&Wt(t.matched[s],n.matched[r])&&Xo(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Wt(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Xo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!hu(e[n],t[n]))return!1;return!0}function hu(e,t){return $e(e)?ni(e,t):$e(t)?ni(t,e):e?.valueOf()===t?.valueOf()}function ni(e,t){return $e(t)?e.length===t.length&&e.every((n,s)=>n===t[s]):e.length===1&&e[0]===t}function pu(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),s=e.split("/"),r=s[s.length-1];(r===".."||r===".")&&s.push("");let i=n.length-1,o,l;for(o=0;o1&&i--;else break;return n.slice(0,i).join("/")+"/"+s.slice(o).join("/")}const mt={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let ks=(function(e){return e.pop="pop",e.push="push",e})({}),vs=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function mu(e){if(!e)if(jt){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),uu(e)}const gu=/^[^#]+#/;function yu(e,t){return e.replace(gu,"#")+t}function bu(e,t){const n=document.documentElement.getBoundingClientRect(),s=e.getBoundingClientRect();return{behavior:t.behavior,left:s.left-n.left-(t.left||0),top:s.top-n.top-(t.top||0)}}const rs=()=>({left:window.scrollX,top:window.scrollY});function _u(e){let t;if("el"in e){const n=e.el,s=typeof n=="string"&&n.startsWith("#"),r=typeof n=="string"?s?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!r)return;t=bu(r,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function si(e,t){return(history.state?history.state.position-t:-1)+e}const qs=new Map;function Eu(e,t){qs.set(e,t)}function wu(e){const t=qs.get(e);return qs.delete(e),t}function Ru(e){return typeof e=="string"||e&&typeof e=="object"}function Qo(e){return typeof e=="string"||typeof e=="symbol"}let ie=(function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e})({});const Yo=Symbol("");ie.MATCHER_NOT_FOUND+"",ie.NAVIGATION_GUARD_REDIRECT+"",ie.NAVIGATION_ABORTED+"",ie.NAVIGATION_CANCELLED+"",ie.NAVIGATION_DUPLICATED+"";function Gt(e,t){return J(new Error,{type:e,[Yo]:!0},t)}function lt(e,t){return e instanceof Error&&Yo in e&&(t==null||!!(e.type&t))}const Su=["params","query","hash"];function vu(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Su)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Au(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;sr&&Vs(r)):[s&&Vs(s)]).forEach(r=>{r!==void 0&&(t+=(t.length?"&":"")+n,r!=null&&(t+="="+r))})}return t}function xu(e){const t={};for(const n in e){const s=e[n];s!==void 0&&(t[n]=$e(s)?s.map(r=>r==null?null:""+r):s==null?s:""+s)}return t}const Ou=Symbol(""),ii=Symbol(""),is=Symbol(""),gr=Symbol(""),$s=Symbol("");function tn(){let e=[];function t(s){return e.push(s),()=>{const r=e.indexOf(s);r>-1&&e.splice(r,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Et(e,t,n,s,r,i=o=>o()){const o=s&&(s.enterCallbacks[r]=s.enterCallbacks[r]||[]);return()=>new Promise((l,c)=>{const u=p=>{p===!1?c(Gt(ie.NAVIGATION_ABORTED,{from:n,to:t})):p instanceof Error?c(p):Ru(p)?c(Gt(ie.NAVIGATION_GUARD_REDIRECT,{from:t,to:p})):(o&&s.enterCallbacks[r]===o&&typeof p=="function"&&o.push(p),l())},a=i(()=>e.call(s&&s.instances[r],t,n,u));let f=Promise.resolve(a);e.length<3&&(f=f.then(u)),f.catch(p=>c(p))})}function As(e,t,n,s,r=i=>i()){const i=[];for(const o of e)for(const l in o.components){let c=o.components[l];if(!(t!=="beforeRouteEnter"&&!o.instances[l]))if($o(c)){const u=(c.__vccOpts||c)[t];u&&i.push(Et(u,n,s,o,l,r))}else{let u=c();i.push(()=>u.then(a=>{if(!a)throw new Error(`Couldn't resolve component "${l}" at "${o.path}"`);const f=Ja(a)?a.default:a;o.mods[l]=a,o.components[l]=f;const p=(f.__vccOpts||f)[t];return p&&Et(p,n,s,o,l,r)()}))}}return i}function Cu(e,t){const n=[],s=[],r=[],i=Math.max(t.matched.length,e.matched.length);for(let o=0;oWt(u,l))?s.push(l):n.push(l));const c=e.matched[o];c&&(t.matched.find(u=>Wt(u,c))||r.push(c))}return[n,s,r]}let Tu=()=>location.protocol+"//"+location.host;function Zo(e,t){const{pathname:n,search:s,hash:r}=t,i=e.indexOf("#");if(i>-1){let o=r.includes(e.slice(i))?e.slice(i).length:1,l=r.slice(o);return l[0]!=="/"&&(l="/"+l),ti(l,"")}return ti(n,e)+s+r}function Pu(e,t,n,s){let r=[],i=[],o=null;const l=({state:p})=>{const y=Zo(e,location),g=n.value,R=t.value;let v=0;if(p){if(n.value=y,t.value=p,o&&o===g){o=null;return}v=R?p.position-R.position:0}else s(y);r.forEach(C=>{C(n.value,g,{delta:v,type:ks.pop,direction:v?v>0?vs.forward:vs.back:vs.unknown})})};function c(){o=n.value}function u(p){r.push(p);const y=()=>{const g=r.indexOf(p);g>-1&&r.splice(g,1)};return i.push(y),y}function a(){if(document.visibilityState==="hidden"){const{history:p}=window;if(!p.state)return;p.replaceState(J({},p.state,{scroll:rs()}),"")}}function f(){for(const p of i)p();i=[],window.removeEventListener("popstate",l),window.removeEventListener("pagehide",a),document.removeEventListener("visibilitychange",a)}return window.addEventListener("popstate",l),window.addEventListener("pagehide",a),document.addEventListener("visibilitychange",a),{pauseListeners:c,listen:u,destroy:f}}function oi(e,t,n,s=!1,r=!1){return{back:e,current:t,forward:n,replaced:s,position:window.history.length,scroll:r?rs():null}}function Nu(e){const{history:t,location:n}=window,s={value:Zo(e,n)},r={value:t.state};r.value||i(s.value,{back:null,current:s.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function i(c,u,a){const f=e.indexOf("#"),p=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+c:Tu()+e+c;try{t[a?"replaceState":"pushState"](u,"",p),r.value=u}catch(y){console.error(y),n[a?"replace":"assign"](p)}}function o(c,u){i(c,J({},t.state,oi(r.value.back,c,r.value.forward,!0),u,{position:r.value.position}),!0),s.value=c}function l(c,u){const a=J({},r.value,t.state,{forward:c,scroll:rs()});i(a.current,a,!0),i(c,J({},oi(s.value,c,null),{position:a.position+1},u),!1),s.value=c}return{location:s,state:r,push:l,replace:o}}function Iu(e){e=mu(e);const t=Nu(e),n=Pu(e,t.state,t.location,t.replace);function s(i,o=!0){o||n.pauseListeners(),history.go(i)}const r=J({location:"",base:e,go:s,createHref:yu.bind(null,e)},t,n);return Object.defineProperty(r,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(r,"state",{enumerable:!0,get:()=>t.state.value}),r}let Ct=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var ue=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(ue||{});const Du={type:Ct.Static,value:""},Fu=/[a-zA-Z0-9_]/;function Lu(e){if(!e)return[[]];if(e==="/")return[[Du]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(y){throw new Error(`ERR (${n})/"${u}": ${y}`)}let n=ue.Static,s=n;const r=[];let i;function o(){i&&r.push(i),i=[]}let l=0,c,u="",a="";function f(){u&&(n===ue.Static?i.push({type:Ct.Static,value:u}):n===ue.Param||n===ue.ParamRegExp||n===ue.ParamRegExpEnd?(i.length>1&&(c==="*"||c==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),i.push({type:Ct.Param,value:u,regexp:a,repeatable:c==="*"||c==="+",optional:c==="*"||c==="?"})):t("Invalid state to consume buffer"),u="")}function p(){u+=c}for(;lt.length?t.length===1&&t[0]===ye.Static+ye.Segment?1:-1:0}function el(e,t){let n=0;const s=e.score,r=t.score;for(;n0&&t[t.length-1]<0}const Hu={strict:!1,end:!0,sensitive:!1};function Vu(e,t,n){const s=Bu(Lu(e.path),n),r=J(s,{record:e,parent:t,children:[],alias:[]});return t&&!r.record.aliasOf==!t.record.aliasOf&&t.children.push(r),r}function ku(e,t){const n=[],s=new Map;t=ei(Hu,t);function r(f){return s.get(f)}function i(f,p,y){const g=!y,R=ui(f);R.aliasOf=y&&y.record;const v=ei(t,f),C=[R];if("alias"in f){const P=typeof f.alias=="string"?[f.alias]:f.alias;for(const q of P)C.push(ui(J({},R,{components:y?y.record.components:R.components,path:q,aliasOf:y?y.record:R})))}let N,D;for(const P of C){const{path:q}=P;if(p&&q[0]!=="/"){const se=p.record.path,K=se[se.length-1]==="/"?"":"/";P.path=p.record.path+(q&&K+q)}if(N=Vu(P,p,v),y?y.alias.push(N):(D=D||N,D!==N&&D.alias.push(N),g&&f.name&&!fi(N)&&o(f.name)),tl(N)&&c(N),R.children){const se=R.children;for(let K=0;K{o(D)}:dn}function o(f){if(Qo(f)){const p=s.get(f);p&&(s.delete(f),n.splice(n.indexOf(p),1),p.children.forEach(o),p.alias.forEach(o))}else{const p=n.indexOf(f);p>-1&&(n.splice(p,1),f.record.name&&s.delete(f.record.name),f.children.forEach(o),f.alias.forEach(o))}}function l(){return n}function c(f){const p=Ku(f,n);n.splice(p,0,f),f.record.name&&!fi(f)&&s.set(f.record.name,f)}function u(f,p){let y,g={},R,v;if("name"in f&&f.name){if(y=s.get(f.name),!y)throw Gt(ie.MATCHER_NOT_FOUND,{location:f});v=y.record.name,g=J(ai(p.params,y.keys.filter(D=>!D.optional).concat(y.parent?y.parent.keys.filter(D=>D.optional):[]).map(D=>D.name)),f.params&&ai(f.params,y.keys.map(D=>D.name))),R=y.stringify(g)}else if(f.path!=null)R=f.path,y=n.find(D=>D.re.test(R)),y&&(g=y.parse(R),v=y.record.name);else{if(y=p.name?s.get(p.name):n.find(D=>D.re.test(p.path)),!y)throw Gt(ie.MATCHER_NOT_FOUND,{location:f,currentLocation:p});v=y.record.name,g=J({},p.params,f.params),R=y.stringify(g)}const C=[];let N=y;for(;N;)C.unshift(N.record),N=N.parent;return{name:v,path:R,params:g,matched:C,meta:$u(C)}}e.forEach(f=>i(f));function a(){n.length=0,s.clear()}return{addRoute:i,resolve:u,removeRoute:o,clearRoutes:a,getRoutes:l,getRecordMatcher:r}}function ai(e,t){const n={};for(const s of t)s in e&&(n[s]=e[s]);return n}function ui(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:qu(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function qu(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const s in e.components)t[s]=typeof n=="object"?n[s]:n;return t}function fi(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function $u(e){return e.reduce((t,n)=>J(t,n.meta),{})}function Ku(e,t){let n=0,s=t.length;for(;n!==s;){const i=n+s>>1;el(e,t[i])<0?s=i:n=i+1}const r=Wu(e);return r&&(s=t.lastIndexOf(r,s-1)),s}function Wu(e){let t=e;for(;t=t.parent;)if(tl(t)&&el(e,t)===0)return t}function tl({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function di(e){const t=ke(is),n=ke(gr),s=He(()=>{const c=It(e.to);return t.resolve(c)}),r=He(()=>{const{matched:c}=s.value,{length:u}=c,a=c[u-1],f=n.matched;if(!a||!f.length)return-1;const p=f.findIndex(Wt.bind(null,a));if(p>-1)return p;const y=hi(c[u-2]);return u>1&&hi(a)===y&&f[f.length-1].path!==y?f.findIndex(Wt.bind(null,c[u-2])):p}),i=He(()=>r.value>-1&&Qu(n.params,s.value.params)),o=He(()=>r.value>-1&&r.value===n.matched.length-1&&Xo(n.params,s.value.params));function l(c={}){if(Xu(c)){const u=t[It(e.replace)?"replace":"push"](It(e.to)).catch(dn);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:s,href:He(()=>s.value.href),isActive:i,isExactActive:o,navigate:l}}function Gu(e){return e.length===1?e[0]:e}const zu=fr({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:di,setup(e,{slots:t}){const n=Yn(di(e)),{options:s}=ke(is),r=He(()=>({[pi(e.activeClass,s.linkActiveClass,"router-link-active")]:n.isActive,[pi(e.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const i=t.default&&Gu(t.default(n));return e.custom?i:ko("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:r.value},i)}}}),Ju=zu;function Xu(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Qu(e,t){for(const n in t){const s=t[n],r=e[n];if(typeof s=="string"){if(s!==r)return!1}else if(!$e(r)||r.length!==s.length||s.some((i,o)=>i.valueOf()!==r[o].valueOf()))return!1}return!0}function hi(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const pi=(e,t,n)=>e??t??n,Yu=fr({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const s=ke($s),r=He(()=>e.route||s.value),i=ke(ii,0),o=He(()=>{let u=It(i);const{matched:a}=r.value;let f;for(;(f=a[u])&&!f.components;)u++;return u}),l=He(()=>r.value.matched[o.value]);Nn(ii,He(()=>o.value+1)),Nn(Ou,l),Nn($s,r);const c=Fs();return In(()=>[c.value,l.value,e.name],([u,a,f],[p,y,g])=>{a&&(a.instances[f]=u,y&&y!==a&&u&&u===p&&(a.leaveGuards.size||(a.leaveGuards=y.leaveGuards),a.updateGuards.size||(a.updateGuards=y.updateGuards))),u&&a&&(!y||!Wt(a,y)||!p)&&(a.enterCallbacks[f]||[]).forEach(R=>R(u))},{flush:"post"}),()=>{const u=r.value,a=e.name,f=l.value,p=f&&f.components[a];if(!p)return mi(n.default,{Component:p,route:u});const y=f.props[a],g=y?y===!0?u.params:typeof y=="function"?y(u):y:null,v=ko(p,J({},g,t,{onVnodeUnmounted:C=>{C.component.isUnmounted&&(f.instances[a]=null)},ref:c}));return mi(n.default,{Component:v,route:u})||v}}});function mi(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const nl=Yu;function Zu(e){const t=ku(e.routes,e),n=e.parseQuery||Au,s=e.stringifyQuery||ri,r=e.history,i=tn(),o=tn(),l=tn(),c=rc(mt);let u=mt;jt&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const a=Rs.bind(null,w=>""+w),f=Rs.bind(null,cu),p=Rs.bind(null,bn);function y(w,L){let I,M;return Qo(w)?(I=t.getRecordMatcher(w),M=L):M=w,t.addRoute(M,I)}function g(w){const L=t.getRecordMatcher(w);L&&t.removeRoute(L)}function R(){return t.getRoutes().map(w=>w.record)}function v(w){return!!t.getRecordMatcher(w)}function C(w,L){if(L=J({},L||c.value),typeof w=="string"){const m=Ss(n,w,L.path),_=t.resolve({path:m.path},L),S=r.createHref(m.fullPath);return J(m,_,{params:p(_.params),hash:bn(m.hash),redirectedFrom:void 0,href:S})}let I;if(w.path!=null)I=J({},w,{path:Ss(n,w.path,L.path).path});else{const m=J({},w.params);for(const _ in m)m[_]==null&&delete m[_];I=J({},w,{params:f(m)}),L.params=f(L.params)}const M=t.resolve(I,L),W=w.hash||"";M.params=a(p(M.params));const d=fu(s,J({},w,{hash:iu(W),path:M.path})),h=r.createHref(d);return J({fullPath:d,hash:W,query:s===ri?xu(w.query):w.query||{}},M,{redirectedFrom:void 0,href:h})}function N(w){return typeof w=="string"?Ss(n,w,c.value.path):J({},w)}function D(w,L){if(u!==w)return Gt(ie.NAVIGATION_CANCELLED,{from:L,to:w})}function P(w){return K(w)}function q(w){return P(J(N(w),{replace:!0}))}function se(w,L){const I=w.matched[w.matched.length-1];if(I&&I.redirect){const{redirect:M}=I;let W=typeof M=="function"?M(w,L):M;return typeof W=="string"&&(W=W.includes("?")||W.includes("#")?W=N(W):{path:W},W.params={}),J({query:w.query,hash:w.hash,params:W.path!=null?{}:w.params},W)}}function K(w,L){const I=u=C(w),M=c.value,W=w.state,d=w.force,h=w.replace===!0,m=se(I,M);if(m)return K(J(N(m),{state:typeof m=="object"?J({},W,m.state):W,force:d,replace:h}),L||I);const _=I;_.redirectedFrom=L;let S;return!d&&du(s,M,I)&&(S=Gt(ie.NAVIGATION_DUPLICATED,{to:_,from:M}),ae(M,M,!0,!1)),(S?Promise.resolve(S):Ce(_,M)).catch(E=>lt(E)?lt(E,ie.NAVIGATION_GUARD_REDIRECT)?E:We(E):$(E,_,M)).then(E=>{if(E){if(lt(E,ie.NAVIGATION_GUARD_REDIRECT))return K(J({replace:h},N(E.to),{state:typeof E.to=="object"?J({},W,E.to.state):W,force:d}),L||_)}else E=De(_,M,!0,h,W);return Be(_,M,E),E})}function Ee(w,L){const I=D(w,L);return I?Promise.reject(I):Promise.resolve()}function Oe(w){const L=je.values().next().value;return L&&typeof L.runWithContext=="function"?L.runWithContext(w):w()}function Ce(w,L){let I;const[M,W,d]=Cu(w,L);I=As(M.reverse(),"beforeRouteLeave",w,L);for(const m of M)m.leaveGuards.forEach(_=>{I.push(Et(_,w,L))});const h=Ee.bind(null,w,L);return I.push(h),Le(I).then(()=>{I=[];for(const m of i.list())I.push(Et(m,w,L));return I.push(h),Le(I)}).then(()=>{I=As(W,"beforeRouteUpdate",w,L);for(const m of W)m.updateGuards.forEach(_=>{I.push(Et(_,w,L))});return I.push(h),Le(I)}).then(()=>{I=[];for(const m of d)if(m.beforeEnter)if($e(m.beforeEnter))for(const _ of m.beforeEnter)I.push(Et(_,w,L));else I.push(Et(m.beforeEnter,w,L));return I.push(h),Le(I)}).then(()=>(w.matched.forEach(m=>m.enterCallbacks={}),I=As(d,"beforeRouteEnter",w,L,Oe),I.push(h),Le(I))).then(()=>{I=[];for(const m of o.list())I.push(Et(m,w,L));return I.push(h),Le(I)}).catch(m=>lt(m,ie.NAVIGATION_CANCELLED)?m:Promise.reject(m))}function Be(w,L,I){l.list().forEach(M=>Oe(()=>M(w,L,I)))}function De(w,L,I,M,W){const d=D(w,L);if(d)return d;const h=L===mt,m=jt?history.state:{};I&&(M||h?r.replace(w.fullPath,J({scroll:h&&m&&m.scroll},W)):r.push(w.fullPath,W)),c.value=w,ae(w,L,I,h),We()}let fe;function Te(){fe||(fe=r.listen((w,L,I)=>{if(!ze.listening)return;const M=C(w),W=se(M,ze.currentRoute.value);if(W){K(J(W,{replace:!0,force:!0}),M).catch(dn);return}u=M;const d=c.value;jt&&Eu(si(d.fullPath,I.delta),rs()),Ce(M,d).catch(h=>lt(h,ie.NAVIGATION_ABORTED|ie.NAVIGATION_CANCELLED)?h:lt(h,ie.NAVIGATION_GUARD_REDIRECT)?(K(J(N(h.to),{force:!0}),M).then(m=>{lt(m,ie.NAVIGATION_ABORTED|ie.NAVIGATION_DUPLICATED)&&!I.delta&&I.type===ks.pop&&r.go(-1,!1)}).catch(dn),Promise.reject()):(I.delta&&r.go(-I.delta,!1),$(h,M,d))).then(h=>{h=h||De(M,d,!1),h&&(I.delta&&!lt(h,ie.NAVIGATION_CANCELLED)?r.go(-I.delta,!1):I.type===ks.pop&<(h,ie.NAVIGATION_ABORTED|ie.NAVIGATION_DUPLICATED)&&r.go(-1,!1)),Be(M,d,h)}).catch(dn)}))}let it=tn(),Y=tn(),z;function $(w,L,I){We(w);const M=Y.list();return M.length?M.forEach(W=>W(w,L,I)):console.error(w),Promise.reject(w)}function Fe(){return z&&c.value!==mt?Promise.resolve():new Promise((w,L)=>{it.add([w,L])})}function We(w){return z||(z=!w,Te(),it.list().forEach(([L,I])=>w?I(w):L()),it.reset()),w}function ae(w,L,I,M){const{scrollBehavior:W}=e;if(!jt||!W)return Promise.resolve();const d=!I&&wu(si(w.fullPath,0))||(M||!I)&&history.state&&history.state.scroll||null;return co().then(()=>W(w,L,d)).then(h=>h&&_u(h)).catch(h=>$(h,w,L))}const oe=w=>r.go(w);let Ge;const je=new Set,ze={currentRoute:c,listening:!0,addRoute:y,removeRoute:g,clearRoutes:t.clearRoutes,hasRoute:v,getRoutes:R,resolve:C,options:e,push:P,replace:q,go:oe,back:()=>oe(-1),forward:()=>oe(1),beforeEach:i.add,beforeResolve:o.add,afterEach:l.add,onError:Y.add,isReady:Fe,install(w){w.component("RouterLink",Ju),w.component("RouterView",nl),w.config.globalProperties.$router=ze,Object.defineProperty(w.config.globalProperties,"$route",{enumerable:!0,get:()=>It(c)}),jt&&!Ge&&c.value===mt&&(Ge=!0,P(r.location).catch(M=>{}));const L={};for(const M in mt)Object.defineProperty(L,M,{get:()=>c.value[M],enumerable:!0});w.provide(is,ze),w.provide(gr,ro(L)),w.provide($s,c);const I=w.unmount;je.add(w),w.unmount=function(){je.delete(w),je.size<1&&(u=mt,fe&&fe(),fe=null,c.value=mt,Ge=!1,z=!1),I()}}};function Le(w){return w.reduce((L,I)=>L.then(()=>Oe(I)),Promise.resolve())}return ze}function Gd(){return ke(is)}function zd(e){return ke(gr)}function sl(e,t){return function(){return e.apply(t,arguments)}}const{toString:ef}=Object.prototype,{getPrototypeOf:yr}=Object,{iterator:os,toStringTag:rl}=Symbol,ls=(e=>t=>{const n=ef.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ke=e=>(e=e.toLowerCase(),t=>ls(t)===e),cs=e=>t=>typeof t===e,{isArray:Jt}=Array,zt=cs("undefined");function wn(e){return e!==null&&!zt(e)&&e.constructor!==null&&!zt(e.constructor)&&Ae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const il=Ke("ArrayBuffer");function tf(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&il(e.buffer),t}const nf=cs("string"),Ae=cs("function"),ol=cs("number"),Rn=e=>e!==null&&typeof e=="object",sf=e=>e===!0||e===!1,Ln=e=>{if(ls(e)!=="object")return!1;const t=yr(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(rl in e)&&!(os in e)},rf=e=>{if(!Rn(e)||wn(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},of=Ke("Date"),lf=Ke("File"),cf=Ke("Blob"),af=Ke("FileList"),uf=e=>Rn(e)&&Ae(e.pipe),ff=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Ae(e.append)&&((t=ls(e))==="formdata"||t==="object"&&Ae(e.toString)&&e.toString()==="[object FormData]"))},df=Ke("URLSearchParams"),[hf,pf,mf,gf]=["ReadableStream","Request","Response","Headers"].map(Ke),yf=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Sn(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let s,r;if(typeof e!="object"&&(e=[e]),Jt(e))for(s=0,r=e.length;s0;)if(r=n[s],t===r.toLowerCase())return r;return null}const Tt=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,cl=e=>!zt(e)&&e!==Tt;function Ks(){const{caseless:e,skipUndefined:t}=cl(this)&&this||{},n={},s=(r,i)=>{const o=e&&ll(n,i)||i;Ln(n[o])&&Ln(r)?n[o]=Ks(n[o],r):Ln(r)?n[o]=Ks({},r):Jt(r)?n[o]=r.slice():(!t||!zt(r))&&(n[o]=r)};for(let r=0,i=arguments.length;r(Sn(t,(r,i)=>{n&&Ae(r)?e[i]=sl(r,n):e[i]=r},{allOwnKeys:s}),e),_f=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),Ef=(e,t,n,s)=>{e.prototype=Object.create(t.prototype,s),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},wf=(e,t,n,s)=>{let r,i,o;const l={};if(t=t||{},e==null)return t;do{for(r=Object.getOwnPropertyNames(e),i=r.length;i-- >0;)o=r[i],(!s||s(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&yr(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Rf=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const s=e.indexOf(t,n);return s!==-1&&s===n},Sf=e=>{if(!e)return null;if(Jt(e))return e;let t=e.length;if(!ol(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},vf=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&yr(Uint8Array)),Af=(e,t)=>{const s=(e&&e[os]).call(e);let r;for(;(r=s.next())&&!r.done;){const i=r.value;t.call(e,i[0],i[1])}},xf=(e,t)=>{let n;const s=[];for(;(n=e.exec(t))!==null;)s.push(n);return s},Of=Ke("HTMLFormElement"),Cf=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,s,r){return s.toUpperCase()+r}),gi=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Tf=Ke("RegExp"),al=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),s={};Sn(n,(r,i)=>{let o;(o=t(r,i,e))!==!1&&(s[i]=o||r)}),Object.defineProperties(e,s)},Pf=e=>{al(e,(t,n)=>{if(Ae(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const s=e[n];if(Ae(s)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Nf=(e,t)=>{const n={},s=r=>{r.forEach(i=>{n[i]=!0})};return Jt(e)?s(e):s(String(e).split(t)),n},If=()=>{},Df=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function Ff(e){return!!(e&&Ae(e.append)&&e[rl]==="FormData"&&e[os])}const Lf=e=>{const t=new Array(10),n=(s,r)=>{if(Rn(s)){if(t.indexOf(s)>=0)return;if(wn(s))return s;if(!("toJSON"in s)){t[r]=s;const i=Jt(s)?[]:{};return Sn(s,(o,l)=>{const c=n(o,r+1);!zt(c)&&(i[l]=c)}),t[r]=void 0,i}}return s};return n(e,0)},Mf=Ke("AsyncFunction"),Uf=e=>e&&(Rn(e)||Ae(e))&&Ae(e.then)&&Ae(e.catch),ul=((e,t)=>e?setImmediate:t?((n,s)=>(Tt.addEventListener("message",({source:r,data:i})=>{r===Tt&&i===n&&s.length&&s.shift()()},!1),r=>{s.push(r),Tt.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Ae(Tt.postMessage)),Bf=typeof queueMicrotask<"u"?queueMicrotask.bind(Tt):typeof process<"u"&&process.nextTick||ul,jf=e=>e!=null&&Ae(e[os]),b={isArray:Jt,isArrayBuffer:il,isBuffer:wn,isFormData:ff,isArrayBufferView:tf,isString:nf,isNumber:ol,isBoolean:sf,isObject:Rn,isPlainObject:Ln,isEmptyObject:rf,isReadableStream:hf,isRequest:pf,isResponse:mf,isHeaders:gf,isUndefined:zt,isDate:of,isFile:lf,isBlob:cf,isRegExp:Tf,isFunction:Ae,isStream:uf,isURLSearchParams:df,isTypedArray:vf,isFileList:af,forEach:Sn,merge:Ks,extend:bf,trim:yf,stripBOM:_f,inherits:Ef,toFlatObject:wf,kindOf:ls,kindOfTest:Ke,endsWith:Rf,toArray:Sf,forEachEntry:Af,matchAll:xf,isHTMLForm:Of,hasOwnProperty:gi,hasOwnProp:gi,reduceDescriptors:al,freezeMethods:Pf,toObjectSet:Nf,toCamelCase:Cf,noop:If,toFiniteNumber:Df,findKey:ll,global:Tt,isContextDefined:cl,isSpecCompliantForm:Ff,toJSONObject:Lf,isAsyncFn:Mf,isThenable:Uf,setImmediate:ul,asap:Bf,isIterable:jf};function V(e,t,n,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),s&&(this.request=s),r&&(this.response=r,this.status=r.status?r.status:null)}b.inherits(V,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:b.toJSONObject(this.config),code:this.code,status:this.status}}});const fl=V.prototype,dl={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{dl[e]={value:e}});Object.defineProperties(V,dl);Object.defineProperty(fl,"isAxiosError",{value:!0});V.from=(e,t,n,s,r,i)=>{const o=Object.create(fl);b.toFlatObject(e,o,function(a){return a!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",c=t==null&&e?e.code:t;return V.call(o,l,c,n,s,r),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const Hf=null;function Ws(e){return b.isPlainObject(e)||b.isArray(e)}function hl(e){return b.endsWith(e,"[]")?e.slice(0,-2):e}function yi(e,t,n){return e?e.concat(t).map(function(r,i){return r=hl(r),!n&&i?"["+r+"]":r}).join(n?".":""):t}function Vf(e){return b.isArray(e)&&!e.some(Ws)}const kf=b.toFlatObject(b,{},null,function(t){return/^is[A-Z]/.test(t)});function as(e,t,n){if(!b.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=b.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(R,v){return!b.isUndefined(v[R])});const s=n.metaTokens,r=n.visitor||a,i=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&b.isSpecCompliantForm(t);if(!b.isFunction(r))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(b.isDate(g))return g.toISOString();if(b.isBoolean(g))return g.toString();if(!c&&b.isBlob(g))throw new V("Blob is not supported. Use a Buffer instead.");return b.isArrayBuffer(g)||b.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function a(g,R,v){let C=g;if(g&&!v&&typeof g=="object"){if(b.endsWith(R,"{}"))R=s?R:R.slice(0,-2),g=JSON.stringify(g);else if(b.isArray(g)&&Vf(g)||(b.isFileList(g)||b.endsWith(R,"[]"))&&(C=b.toArray(g)))return R=hl(R),C.forEach(function(D,P){!(b.isUndefined(D)||D===null)&&t.append(o===!0?yi([R],P,i):o===null?R:R+"[]",u(D))}),!1}return Ws(g)?!0:(t.append(yi(v,R,i),u(g)),!1)}const f=[],p=Object.assign(kf,{defaultVisitor:a,convertValue:u,isVisitable:Ws});function y(g,R){if(!b.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+R.join("."));f.push(g),b.forEach(g,function(C,N){(!(b.isUndefined(C)||C===null)&&r.call(t,C,b.isString(N)?N.trim():N,R,p))===!0&&y(C,R?R.concat(N):[N])}),f.pop()}}if(!b.isObject(e))throw new TypeError("data must be an object");return y(e),t}function bi(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(s){return t[s]})}function br(e,t){this._pairs=[],e&&as(e,this,t)}const pl=br.prototype;pl.append=function(t,n){this._pairs.push([t,n])};pl.toString=function(t){const n=t?function(s){return t.call(this,s,bi)}:bi;return this._pairs.map(function(r){return n(r[0])+"="+n(r[1])},"").join("&")};function qf(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ml(e,t,n){if(!t)return e;const s=n&&n.encode||qf;b.isFunction(n)&&(n={serialize:n});const r=n&&n.serialize;let i;if(r?i=r(t,n):i=b.isURLSearchParams(t)?t.toString():new br(t,n).toString(s),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class _i{constructor(){this.handlers=[]}use(t,n,s){return this.handlers.push({fulfilled:t,rejected:n,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){b.forEach(this.handlers,function(s){s!==null&&t(s)})}}const gl={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},$f=typeof URLSearchParams<"u"?URLSearchParams:br,Kf=typeof FormData<"u"?FormData:null,Wf=typeof Blob<"u"?Blob:null,Gf={isBrowser:!0,classes:{URLSearchParams:$f,FormData:Kf,Blob:Wf},protocols:["http","https","file","blob","url","data"]},_r=typeof window<"u"&&typeof document<"u",Gs=typeof navigator=="object"&&navigator||void 0,zf=_r&&(!Gs||["ReactNative","NativeScript","NS"].indexOf(Gs.product)<0),Jf=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Xf=_r&&window.location.href||"http://localhost",Qf=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:_r,hasStandardBrowserEnv:zf,hasStandardBrowserWebWorkerEnv:Jf,navigator:Gs,origin:Xf},Symbol.toStringTag,{value:"Module"})),he={...Qf,...Gf};function Yf(e,t){return as(e,new he.classes.URLSearchParams,{visitor:function(n,s,r,i){return he.isNode&&b.isBuffer(n)?(this.append(s,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Zf(e){return b.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function ed(e){const t={},n=Object.keys(e);let s;const r=n.length;let i;for(s=0;s=n.length;return o=!o&&b.isArray(r)?r.length:o,c?(b.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!l):((!r[o]||!b.isObject(r[o]))&&(r[o]=[]),t(n,s,r[o],i)&&b.isArray(r[o])&&(r[o]=ed(r[o])),!l)}if(b.isFormData(e)&&b.isFunction(e.entries)){const n={};return b.forEachEntry(e,(s,r)=>{t(Zf(s),r,n,0)}),n}return null}function td(e,t,n){if(b.isString(e))try{return(t||JSON.parse)(e),b.trim(e)}catch(s){if(s.name!=="SyntaxError")throw s}return(n||JSON.stringify)(e)}const vn={transitional:gl,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const s=n.getContentType()||"",r=s.indexOf("application/json")>-1,i=b.isObject(t);if(i&&b.isHTMLForm(t)&&(t=new FormData(t)),b.isFormData(t))return r?JSON.stringify(yl(t)):t;if(b.isArrayBuffer(t)||b.isBuffer(t)||b.isStream(t)||b.isFile(t)||b.isBlob(t)||b.isReadableStream(t))return t;if(b.isArrayBufferView(t))return t.buffer;if(b.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return Yf(t,this.formSerializer).toString();if((l=b.isFileList(t))||s.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return as(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||r?(n.setContentType("application/json",!1),td(t)):t}],transformResponse:[function(t){const n=this.transitional||vn.transitional,s=n&&n.forcedJSONParsing,r=this.responseType==="json";if(b.isResponse(t)||b.isReadableStream(t))return t;if(t&&b.isString(t)&&(s&&!this.responseType||r)){const o=!(n&&n.silentJSONParsing)&&r;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?V.from(l,V.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:he.classes.FormData,Blob:he.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};b.forEach(["delete","get","head","post","put","patch"],e=>{vn.headers[e]={}});const nd=b.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sd=e=>{const t={};let n,s,r;return e&&e.split(` +`).forEach(function(o){r=o.indexOf(":"),n=o.substring(0,r).trim().toLowerCase(),s=o.substring(r+1).trim(),!(!n||t[n]&&nd[n])&&(n==="set-cookie"?t[n]?t[n].push(s):t[n]=[s]:t[n]=t[n]?t[n]+", "+s:s)}),t},Ei=Symbol("internals");function nn(e){return e&&String(e).trim().toLowerCase()}function Mn(e){return e===!1||e==null?e:b.isArray(e)?e.map(Mn):String(e)}function rd(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=n.exec(e);)t[s[1]]=s[2];return t}const id=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function xs(e,t,n,s,r){if(b.isFunction(s))return s.call(this,t,n);if(r&&(t=n),!!b.isString(t)){if(b.isString(s))return t.indexOf(s)!==-1;if(b.isRegExp(s))return s.test(t)}}function od(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,s)=>n.toUpperCase()+s)}function ld(e,t){const n=b.toCamelCase(" "+t);["get","set","has"].forEach(s=>{Object.defineProperty(e,s+n,{value:function(r,i,o){return this[s].call(this,t,r,i,o)},configurable:!0})})}let xe=class{constructor(t){t&&this.set(t)}set(t,n,s){const r=this;function i(l,c,u){const a=nn(c);if(!a)throw new Error("header name must be a non-empty string");const f=b.findKey(r,a);(!f||r[f]===void 0||u===!0||u===void 0&&r[f]!==!1)&&(r[f||c]=Mn(l))}const o=(l,c)=>b.forEach(l,(u,a)=>i(u,a,c));if(b.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(b.isString(t)&&(t=t.trim())&&!id(t))o(sd(t),n);else if(b.isObject(t)&&b.isIterable(t)){let l={},c,u;for(const a of t){if(!b.isArray(a))throw TypeError("Object iterator must return a key-value pair");l[u=a[0]]=(c=l[u])?b.isArray(c)?[...c,a[1]]:[c,a[1]]:a[1]}o(l,n)}else t!=null&&i(n,t,s);return this}get(t,n){if(t=nn(t),t){const s=b.findKey(this,t);if(s){const r=this[s];if(!n)return r;if(n===!0)return rd(r);if(b.isFunction(n))return n.call(this,r,s);if(b.isRegExp(n))return n.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=nn(t),t){const s=b.findKey(this,t);return!!(s&&this[s]!==void 0&&(!n||xs(this,this[s],s,n)))}return!1}delete(t,n){const s=this;let r=!1;function i(o){if(o=nn(o),o){const l=b.findKey(s,o);l&&(!n||xs(s,s[l],l,n))&&(delete s[l],r=!0)}}return b.isArray(t)?t.forEach(i):i(t),r}clear(t){const n=Object.keys(this);let s=n.length,r=!1;for(;s--;){const i=n[s];(!t||xs(this,this[i],i,t,!0))&&(delete this[i],r=!0)}return r}normalize(t){const n=this,s={};return b.forEach(this,(r,i)=>{const o=b.findKey(s,i);if(o){n[o]=Mn(r),delete n[i];return}const l=t?od(i):String(i).trim();l!==i&&delete n[i],n[l]=Mn(r),s[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return b.forEach(this,(s,r)=>{s!=null&&s!==!1&&(n[r]=t&&b.isArray(s)?s.join(", "):s)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const s=new this(t);return n.forEach(r=>s.set(r)),s}static accessor(t){const s=(this[Ei]=this[Ei]={accessors:{}}).accessors,r=this.prototype;function i(o){const l=nn(o);s[l]||(ld(r,o),s[l]=!0)}return b.isArray(t)?t.forEach(i):i(t),this}};xe.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);b.reduceDescriptors(xe.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(s){this[n]=s}}});b.freezeMethods(xe);function Os(e,t){const n=this||vn,s=t||n,r=xe.from(s.headers);let i=s.data;return b.forEach(e,function(l){i=l.call(n,i,r.normalize(),t?t.status:void 0)}),r.normalize(),i}function bl(e){return!!(e&&e.__CANCEL__)}function Xt(e,t,n){V.call(this,e??"canceled",V.ERR_CANCELED,t,n),this.name="CanceledError"}b.inherits(Xt,V,{__CANCEL__:!0});function _l(e,t,n){const s=n.config.validateStatus;!n.status||!s||s(n.status)?e(n):t(new V("Request failed with status code "+n.status,[V.ERR_BAD_REQUEST,V.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function cd(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function ad(e,t){e=e||10;const n=new Array(e),s=new Array(e);let r=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),a=s[i];o||(o=u),n[r]=c,s[r]=u;let f=i,p=0;for(;f!==r;)p+=n[f++],f=f%e;if(r=(r+1)%e,r===i&&(i=(i+1)%e),u-o{n=a,r=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const a=Date.now(),f=a-n;f>=s?o(u,a):(r=u,i||(i=setTimeout(()=>{i=null,o(r)},s-f)))},()=>r&&o(r)]}const Wn=(e,t,n=3)=>{let s=0;const r=ad(50,250);return ud(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,c=o-s,u=r(c),a=o<=l;s=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&a?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},wi=(e,t)=>{const n=e!=null;return[s=>t[0]({lengthComputable:n,total:e,loaded:s}),t[1]]},Ri=e=>(...t)=>b.asap(()=>e(...t)),fd=he.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,he.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(he.origin),he.navigator&&/(msie|trident)/i.test(he.navigator.userAgent)):()=>!0,dd=he.hasStandardBrowserEnv?{write(e,t,n,s,r,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];b.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),b.isString(s)&&l.push(`path=${s}`),b.isString(r)&&l.push(`domain=${r}`),i===!0&&l.push("secure"),b.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function hd(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function pd(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function El(e,t,n){let s=!hd(t);return e&&(s||n==!1)?pd(e,t):t}const Si=e=>e instanceof xe?{...e}:e;function Ft(e,t){t=t||{};const n={};function s(u,a,f,p){return b.isPlainObject(u)&&b.isPlainObject(a)?b.merge.call({caseless:p},u,a):b.isPlainObject(a)?b.merge({},a):b.isArray(a)?a.slice():a}function r(u,a,f,p){if(b.isUndefined(a)){if(!b.isUndefined(u))return s(void 0,u,f,p)}else return s(u,a,f,p)}function i(u,a){if(!b.isUndefined(a))return s(void 0,a)}function o(u,a){if(b.isUndefined(a)){if(!b.isUndefined(u))return s(void 0,u)}else return s(void 0,a)}function l(u,a,f){if(f in t)return s(u,a);if(f in e)return s(void 0,u)}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,a,f)=>r(Si(u),Si(a),f,!0)};return b.forEach(Object.keys({...e,...t}),function(a){const f=c[a]||r,p=f(e[a],t[a],a);b.isUndefined(p)&&f!==l||(n[a]=p)}),n}const wl=e=>{const t=Ft({},e);let{data:n,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=xe.from(o),t.url=ml(El(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),b.isFormData(n)){if(he.hasStandardBrowserEnv||he.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(b.isFunction(n.getHeaders)){const c=n.getHeaders(),u=["content-type","content-length"];Object.entries(c).forEach(([a,f])=>{u.includes(a.toLowerCase())&&o.set(a,f)})}}if(he.hasStandardBrowserEnv&&(s&&b.isFunction(s)&&(s=s(t)),s||s!==!1&&fd(t.url))){const c=r&&i&&dd.read(i);c&&o.set(r,c)}return t},md=typeof XMLHttpRequest<"u",gd=md&&function(e){return new Promise(function(n,s){const r=wl(e);let i=r.data;const o=xe.from(r.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=r,a,f,p,y,g;function R(){y&&y(),g&&g(),r.cancelToken&&r.cancelToken.unsubscribe(a),r.signal&&r.signal.removeEventListener("abort",a)}let v=new XMLHttpRequest;v.open(r.method.toUpperCase(),r.url,!0),v.timeout=r.timeout;function C(){if(!v)return;const D=xe.from("getAllResponseHeaders"in v&&v.getAllResponseHeaders()),q={data:!l||l==="text"||l==="json"?v.responseText:v.response,status:v.status,statusText:v.statusText,headers:D,config:e,request:v};_l(function(K){n(K),R()},function(K){s(K),R()},q),v=null}"onloadend"in v?v.onloadend=C:v.onreadystatechange=function(){!v||v.readyState!==4||v.status===0&&!(v.responseURL&&v.responseURL.indexOf("file:")===0)||setTimeout(C)},v.onabort=function(){v&&(s(new V("Request aborted",V.ECONNABORTED,e,v)),v=null)},v.onerror=function(P){const q=P&&P.message?P.message:"Network Error",se=new V(q,V.ERR_NETWORK,e,v);se.event=P||null,s(se),v=null},v.ontimeout=function(){let P=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const q=r.transitional||gl;r.timeoutErrorMessage&&(P=r.timeoutErrorMessage),s(new V(P,q.clarifyTimeoutError?V.ETIMEDOUT:V.ECONNABORTED,e,v)),v=null},i===void 0&&o.setContentType(null),"setRequestHeader"in v&&b.forEach(o.toJSON(),function(P,q){v.setRequestHeader(q,P)}),b.isUndefined(r.withCredentials)||(v.withCredentials=!!r.withCredentials),l&&l!=="json"&&(v.responseType=r.responseType),u&&([p,g]=Wn(u,!0),v.addEventListener("progress",p)),c&&v.upload&&([f,y]=Wn(c),v.upload.addEventListener("progress",f),v.upload.addEventListener("loadend",y)),(r.cancelToken||r.signal)&&(a=D=>{v&&(s(!D||D.type?new Xt(null,e,v):D),v.abort(),v=null)},r.cancelToken&&r.cancelToken.subscribe(a),r.signal&&(r.signal.aborted?a():r.signal.addEventListener("abort",a)));const N=cd(r.url);if(N&&he.protocols.indexOf(N)===-1){s(new V("Unsupported protocol "+N+":",V.ERR_BAD_REQUEST,e));return}v.send(i||null)})},yd=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let s=new AbortController,r;const i=function(u){if(!r){r=!0,l();const a=u instanceof Error?u:this.reason;s.abort(a instanceof V?a:new Xt(a instanceof Error?a.message:a))}};let o=t&&setTimeout(()=>{o=null,i(new V(`timeout ${t} of ms exceeded`,V.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=s;return c.unsubscribe=()=>b.asap(l),c}},bd=function*(e,t){let n=e.byteLength;if(n{const r=_d(e,t);let i=0,o,l=c=>{o||(o=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:u,value:a}=await r.next();if(u){l(),c.close();return}let f=a.byteLength;if(n){let p=i+=f;n(p)}c.enqueue(new Uint8Array(a))}catch(u){throw l(u),u}},cancel(c){return l(c),r.return()}},{highWaterMark:2})},Ai=64*1024,{isFunction:Cn}=b,wd=(({Request:e,Response:t})=>({Request:e,Response:t}))(b.global),{ReadableStream:xi,TextEncoder:Oi}=b.global,Ci=(e,...t)=>{try{return!!e(...t)}catch{return!1}},Rd=e=>{e=b.merge.call({skipUndefined:!0},wd,e);const{fetch:t,Request:n,Response:s}=e,r=t?Cn(t):typeof fetch=="function",i=Cn(n),o=Cn(s);if(!r)return!1;const l=r&&Cn(xi),c=r&&(typeof Oi=="function"?(g=>R=>g.encode(R))(new Oi):async g=>new Uint8Array(await new n(g).arrayBuffer())),u=i&&l&&Ci(()=>{let g=!1;const R=new n(he.origin,{body:new xi,method:"POST",get duplex(){return g=!0,"half"}}).headers.has("Content-Type");return g&&!R}),a=o&&l&&Ci(()=>b.isReadableStream(new s("").body)),f={stream:a&&(g=>g.body)};r&&["text","arrayBuffer","blob","formData","stream"].forEach(g=>{!f[g]&&(f[g]=(R,v)=>{let C=R&&R[g];if(C)return C.call(R);throw new V(`Response type '${g}' is not supported`,V.ERR_NOT_SUPPORT,v)})});const p=async g=>{if(g==null)return 0;if(b.isBlob(g))return g.size;if(b.isSpecCompliantForm(g))return(await new n(he.origin,{method:"POST",body:g}).arrayBuffer()).byteLength;if(b.isArrayBufferView(g)||b.isArrayBuffer(g))return g.byteLength;if(b.isURLSearchParams(g)&&(g=g+""),b.isString(g))return(await c(g)).byteLength},y=async(g,R)=>{const v=b.toFiniteNumber(g.getContentLength());return v??p(R)};return async g=>{let{url:R,method:v,data:C,signal:N,cancelToken:D,timeout:P,onDownloadProgress:q,onUploadProgress:se,responseType:K,headers:Ee,withCredentials:Oe="same-origin",fetchOptions:Ce}=wl(g),Be=t||fetch;K=K?(K+"").toLowerCase():"text";let De=yd([N,D&&D.toAbortSignal()],P),fe=null;const Te=De&&De.unsubscribe&&(()=>{De.unsubscribe()});let it;try{if(se&&u&&v!=="get"&&v!=="head"&&(it=await y(Ee,C))!==0){let ae=new n(R,{method:"POST",body:C,duplex:"half"}),oe;if(b.isFormData(C)&&(oe=ae.headers.get("content-type"))&&Ee.setContentType(oe),ae.body){const[Ge,je]=wi(it,Wn(Ri(se)));C=vi(ae.body,Ai,Ge,je)}}b.isString(Oe)||(Oe=Oe?"include":"omit");const Y=i&&"credentials"in n.prototype,z={...Ce,signal:De,method:v.toUpperCase(),headers:Ee.normalize().toJSON(),body:C,duplex:"half",credentials:Y?Oe:void 0};fe=i&&new n(R,z);let $=await(i?Be(fe,Ce):Be(R,z));const Fe=a&&(K==="stream"||K==="response");if(a&&(q||Fe&&Te)){const ae={};["status","statusText","headers"].forEach(ze=>{ae[ze]=$[ze]});const oe=b.toFiniteNumber($.headers.get("content-length")),[Ge,je]=q&&wi(oe,Wn(Ri(q),!0))||[];$=new s(vi($.body,Ai,Ge,()=>{je&&je(),Te&&Te()}),ae)}K=K||"text";let We=await f[b.findKey(f,K)||"text"]($,g);return!Fe&&Te&&Te(),await new Promise((ae,oe)=>{_l(ae,oe,{data:We,headers:xe.from($.headers),status:$.status,statusText:$.statusText,config:g,request:fe})})}catch(Y){throw Te&&Te(),Y&&Y.name==="TypeError"&&/Load failed|fetch/i.test(Y.message)?Object.assign(new V("Network Error",V.ERR_NETWORK,g,fe),{cause:Y.cause||Y}):V.from(Y,Y&&Y.code,g,fe)}}},Sd=new Map,Rl=e=>{let t=e&&e.env||{};const{fetch:n,Request:s,Response:r}=t,i=[s,r,n];let o=i.length,l=o,c,u,a=Sd;for(;l--;)c=i[l],u=a.get(c),u===void 0&&a.set(c,u=l?new Map:Rd(t)),a=u;return u};Rl();const Er={http:Hf,xhr:gd,fetch:{get:Rl}};b.forEach(Er,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ti=e=>`- ${e}`,vd=e=>b.isFunction(e)||e===null||e===!1;function Ad(e,t){e=b.isArray(e)?e:[e];const{length:n}=e;let s,r;const i={};for(let o=0;o`adapter ${c} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since : +`+o.map(Ti).join(` +`):" "+Ti(o[0]):"as no adapter specified";throw new V("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return r}const Sl={getAdapter:Ad,adapters:Er};function Cs(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Xt(null,e)}function Pi(e){return Cs(e),e.headers=xe.from(e.headers),e.data=Os.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Sl.getAdapter(e.adapter||vn.adapter,e)(e).then(function(s){return Cs(e),s.data=Os.call(e,e.transformResponse,s),s.headers=xe.from(s.headers),s},function(s){return bl(s)||(Cs(e),s&&s.response&&(s.response.data=Os.call(e,e.transformResponse,s.response),s.response.headers=xe.from(s.response.headers))),Promise.reject(s)})}const vl="1.13.2",us={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{us[e]=function(s){return typeof s===e||"a"+(t<1?"n ":" ")+e}});const Ni={};us.transitional=function(t,n,s){function r(i,o){return"[Axios v"+vl+"] Transitional option '"+i+"'"+o+(s?". "+s:"")}return(i,o,l)=>{if(t===!1)throw new V(r(o," has been removed"+(n?" in "+n:"")),V.ERR_DEPRECATED);return n&&!Ni[o]&&(Ni[o]=!0,console.warn(r(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};us.spelling=function(t){return(n,s)=>(console.warn(`${s} is likely a misspelling of ${t}`),!0)};function xd(e,t,n){if(typeof e!="object")throw new V("options must be an object",V.ERR_BAD_OPTION_VALUE);const s=Object.keys(e);let r=s.length;for(;r-- >0;){const i=s[r],o=t[i];if(o){const l=e[i],c=l===void 0||o(l,i,e);if(c!==!0)throw new V("option "+i+" must be "+c,V.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new V("Unknown option "+i,V.ERR_BAD_OPTION)}}const Un={assertOptions:xd,validators:us},Ze=Un.validators;let Dt=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _i,response:new _i}}async request(t,n){try{return await this._request(t,n)}catch(s){if(s instanceof Error){let r={};Error.captureStackTrace?Error.captureStackTrace(r):r=new Error;const i=r.stack?r.stack.replace(/^.+\n/,""):"";try{s.stack?i&&!String(s.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(s.stack+=` +`+i):s.stack=i}catch{}}throw s}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ft(this.defaults,n);const{transitional:s,paramsSerializer:r,headers:i}=n;s!==void 0&&Un.assertOptions(s,{silentJSONParsing:Ze.transitional(Ze.boolean),forcedJSONParsing:Ze.transitional(Ze.boolean),clarifyTimeoutError:Ze.transitional(Ze.boolean)},!1),r!=null&&(b.isFunction(r)?n.paramsSerializer={serialize:r}:Un.assertOptions(r,{encode:Ze.function,serialize:Ze.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Un.assertOptions(n,{baseUrl:Ze.spelling("baseURL"),withXsrfToken:Ze.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&b.merge(i.common,i[n.method]);i&&b.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=xe.concat(o,i);const l=[];let c=!0;this.interceptors.request.forEach(function(R){typeof R.runWhen=="function"&&R.runWhen(n)===!1||(c=c&&R.synchronous,l.unshift(R.fulfilled,R.rejected))});const u=[];this.interceptors.response.forEach(function(R){u.push(R.fulfilled,R.rejected)});let a,f=0,p;if(!c){const g=[Pi.bind(this),void 0];for(g.unshift(...l),g.push(...u),p=g.length,a=Promise.resolve(n);f{if(!s._listeners)return;let i=s._listeners.length;for(;i-- >0;)s._listeners[i](r);s._listeners=null}),this.promise.then=r=>{let i;const o=new Promise(l=>{s.subscribe(l),i=l}).then(r);return o.cancel=function(){s.unsubscribe(i)},o},t(function(i,o,l){s.reason||(s.reason=new Xt(i,o,l),n(s.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=s=>{t.abort(s)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new Al(function(r){t=r}),cancel:t}}};function Cd(e){return function(n){return e.apply(null,n)}}function Td(e){return b.isObject(e)&&e.isAxiosError===!0}const zs={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(zs).forEach(([e,t])=>{zs[t]=e});function xl(e){const t=new Dt(e),n=sl(Dt.prototype.request,t);return b.extend(n,Dt.prototype,t,{allOwnKeys:!0}),b.extend(n,t,null,{allOwnKeys:!0}),n.create=function(r){return xl(Ft(e,r))},n}const le=xl(vn);le.Axios=Dt;le.CanceledError=Xt;le.CancelToken=Od;le.isCancel=bl;le.VERSION=vl;le.toFormData=as;le.AxiosError=V;le.Cancel=le.CanceledError;le.all=function(t){return Promise.all(t)};le.spread=Cd;le.isAxiosError=Td;le.mergeConfig=Ft;le.AxiosHeaders=xe;le.formToJSON=e=>yl(b.isHTMLForm(e)?new FormData(e):e);le.getAdapter=Sl.getAdapter;le.HttpStatusCode=zs;le.default=le;const{Axios:Qd,AxiosError:Yd,CanceledError:Zd,isCancel:eh,CancelToken:th,VERSION:nh,all:sh,Cancel:rh,isAxiosError:ih,spread:oh,toFormData:lh,AxiosHeaders:ch,HttpStatusCode:ah,formToJSON:uh,getAdapter:fh,mergeConfig:dh}=le,Qt=le.create({baseURL:"/api",timeout:1e4}),Pd=()=>Qt.get("/status"),hh=()=>Qt.get("/clients"),ph=e=>Qt.get(`/client/${e}`),mh=e=>Qt.post("/clients",e),gh=(e,t)=>Qt.put(`/client/${e}`,t),yh=e=>Qt.delete(`/client/${e}`),Nd={class:"app"},Id={class:"header"},Dd={class:"server-info"},Fd={class:"badge"},Ld={class:"main"},Md=fr({__name:"App",setup(e){const t=Fs({bind_addr:"",bind_port:0}),n=Fs(0);return _o(async()=>{try{const{data:s}=await Pd();t.value=s.server,n.value=s.client_count}catch(s){console.error("Failed to get server status",s)}}),(s,r)=>(Uo(),oa("div",Nd,[bt("header",Id,[r[0]||(r[0]=bt("h1",null,"GoTunnel 控制台",-1)),bt("div",Dd,[bt("span",null,Pn(t.value.bind_addr)+":"+Pn(t.value.bind_port),1),bt("span",Fd,Pn(n.value)+" 客户端",1)])]),bt("main",Ld,[ve(It(nl))])]))}}),Ud=(e,t)=>{const n=e.__vccOpts||e;for(const[s,r]of t)n[s]=r;return n},Bd=Ud(Md,[["__scopeId","data-v-dc56de06"]]),jd="modulepreload",Hd=function(e){return"/"+e},Ii={},Di=function(t,n,s){let r=Promise.resolve();if(n&&n.length>0){let c=function(u){return Promise.all(u.map(a=>Promise.resolve(a).then(f=>({status:"fulfilled",value:f}),f=>({status:"rejected",reason:f}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");r=c(n.map(u=>{if(u=Hd(u),u in Ii)return;Ii[u]=!0;const a=u.endsWith(".css"),f=a?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${f}`))return;const p=document.createElement("link");if(p.rel=a?"stylesheet":jd,a||(p.as="script"),p.crossOrigin="",p.href=u,l&&p.setAttribute("nonce",l),document.head.appendChild(p),a)return new Promise((y,g)=>{p.addEventListener("load",y),p.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return r.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Vd=Zu({history:Iu(),routes:[{path:"/",name:"home",component:()=>Di(()=>import("./HomeView-DGCTeR78.js"),__vite__mapDeps([0,1]))},{path:"/client/:id",name:"client",component:()=>Di(()=>import("./ClientView-Dim5xo2q.js"),__vite__mapDeps([2,3]))}]});Wa(Bd).use(Vd).mount("#app");export{tt as F,Ud as _,bt as a,$d as b,oa as c,fr as d,qd as e,kd as f,hh as g,mh as h,Uo as i,zd as j,It as k,ph as l,gh as m,tr as n,_o as o,yh as p,Fs as r,Pn as t,Gd as u,Kd as v,Wd as w}; diff --git a/internal/server/app/dist/assets/index-fTDfeMRP.css b/internal/server/app/dist/assets/index-fTDfeMRP.css new file mode 100644 index 0000000..dcdc7f4 --- /dev/null +++ b/internal/server/app/dist/assets/index-fTDfeMRP.css @@ -0,0 +1 @@ +:root{font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}h1{font-size:3.2em;line-height:1.1}button{border-radius:8px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:#1a1a1a;cursor:pointer;transition:border-color .25s}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}.card{padding:2em}#app{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}@media(prefers-color-scheme:light){:root{color:#213547;background-color:#fff}a:hover{color:#747bff}button{background-color:#f9f9f9}}.app[data-v-dc56de06]{min-height:100vh;background:#f5f7fa}.header[data-v-dc56de06]{background:#fff;padding:16px 24px;display:flex;justify-content:space-between;align-items:center;box-shadow:0 2px 4px #0000001a}.header h1[data-v-dc56de06]{font-size:20px;color:#2c3e50}.server-info[data-v-dc56de06]{display:flex;align-items:center;gap:12px;color:#666}.badge[data-v-dc56de06]{background:#3498db;color:#fff;padding:4px 12px;border-radius:12px;font-size:12px}.main[data-v-dc56de06]{padding:24px;max-width:1200px;margin:0 auto} diff --git a/internal/server/app/dist/index.html b/internal/server/app/dist/index.html new file mode 100644 index 0000000..ffd14f5 --- /dev/null +++ b/internal/server/app/dist/index.html @@ -0,0 +1,14 @@ + + + + + + + webui + + + + +
+ + diff --git a/internal/server/app/dist/vite.svg b/internal/server/app/dist/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/internal/server/app/dist/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pkg/config/config.go b/internal/server/config/config.go similarity index 61% rename from pkg/config/config.go rename to internal/server/config/config.go index bd7f958..a572aff 100644 --- a/pkg/config/config.go +++ b/internal/server/config/config.go @@ -3,15 +3,13 @@ package config import ( "os" - "github.com/gotunnel/pkg/protocol" "gopkg.in/yaml.v3" ) // ServerConfig 服务端配置 type ServerConfig struct { - Server ServerSettings `yaml:"server"` - Web WebSettings `yaml:"web"` - Clients []ClientConfig `yaml:"clients"` + Server ServerSettings `yaml:"server"` + Web WebSettings `yaml:"web"` } // ServerSettings 服务端设置 @@ -21,6 +19,7 @@ type ServerSettings struct { Token string `yaml:"token"` HeartbeatSec int `yaml:"heartbeat_sec"` HeartbeatTimeout int `yaml:"heartbeat_timeout"` + DBPath string `yaml:"db_path"` } // WebSettings Web控制台设置 @@ -32,12 +31,6 @@ type WebSettings struct { Password string `yaml:"password"` } -// ClientConfig 客户端配置(服务端维护) -type ClientConfig struct { - ID string `yaml:"id"` - Rules []protocol.ProxyRule `yaml:"rules"` -} - // LoadServerConfig 加载服务端配置 func LoadServerConfig(path string) (*ServerConfig, error) { data, err := os.ReadFile(path) @@ -51,12 +44,21 @@ func LoadServerConfig(path string) (*ServerConfig, error) { } // 设置默认值 + if cfg.Server.BindAddr == "" { + cfg.Server.BindAddr = "0.0.0.0" + } + if cfg.Server.BindPort == 0 { + cfg.Server.BindPort = 7000 + } if cfg.Server.HeartbeatSec == 0 { cfg.Server.HeartbeatSec = 30 } if cfg.Server.HeartbeatTimeout == 0 { cfg.Server.HeartbeatTimeout = 90 } + if cfg.Server.DBPath == "" { + cfg.Server.DBPath = "gotunnel.db" + } // Web 默认值 if cfg.Web.BindAddr == "" { @@ -68,22 +70,3 @@ func LoadServerConfig(path string) (*ServerConfig, error) { return &cfg, nil } - -// GetClientRules 获取指定客户端的代理规则 -func (c *ServerConfig) GetClientRules(clientID string) []protocol.ProxyRule { - for _, client := range c.Clients { - if client.ID == clientID { - return client.Rules - } - } - return nil -} - -// SaveServerConfig 保存服务端配置 -func SaveServerConfig(path string, cfg *ServerConfig) error { - data, err := yaml.Marshal(cfg) - if err != nil { - return err - } - return os.WriteFile(path, data, 0644) -} diff --git a/internal/server/db/interface.go b/internal/server/db/interface.go new file mode 100644 index 0000000..1073f98 --- /dev/null +++ b/internal/server/db/interface.go @@ -0,0 +1,36 @@ +package db + +import "github.com/gotunnel/pkg/protocol" + +// Client 客户端数据 +type Client struct { + ID string `json:"id"` + Rules []protocol.ProxyRule `json:"rules"` +} + +// ClientStore 客户端存储接口 +type ClientStore interface { + // GetAllClients 获取所有客户端 + GetAllClients() ([]Client, error) + + // GetClient 获取单个客户端 + GetClient(id string) (*Client, error) + + // CreateClient 创建客户端 + CreateClient(c *Client) error + + // UpdateClient 更新客户端 + UpdateClient(c *Client) error + + // DeleteClient 删除客户端 + DeleteClient(id string) error + + // ClientExists 检查客户端是否存在 + ClientExists(id string) (bool, error) + + // GetClientRules 获取客户端规则 + GetClientRules(id string) ([]protocol.ProxyRule, error) + + // Close 关闭连接 + Close() error +} diff --git a/internal/server/db/sqlite.go b/internal/server/db/sqlite.go new file mode 100644 index 0000000..2e4367e --- /dev/null +++ b/internal/server/db/sqlite.go @@ -0,0 +1,146 @@ +package db + +import ( + "database/sql" + "encoding/json" + "sync" + + _ "github.com/mattn/go-sqlite3" + + "github.com/gotunnel/pkg/protocol" +) + +// SQLiteStore SQLite 存储实现 +type SQLiteStore struct { + db *sql.DB + mu sync.RWMutex +} + +// NewSQLiteStore 创建 SQLite 存储 +func NewSQLiteStore(dbPath string) (*SQLiteStore, error) { + db, err := sql.Open("sqlite3", dbPath) + if err != nil { + return nil, err + } + + s := &SQLiteStore{db: db} + if err := s.init(); err != nil { + db.Close() + return nil, err + } + + return s, nil +} + +// init 初始化数据库表 +func (s *SQLiteStore) init() error { + _, err := s.db.Exec(` + CREATE TABLE IF NOT EXISTS clients ( + id TEXT PRIMARY KEY, + rules TEXT NOT NULL DEFAULT '[]' + ); + `) + return err +} + +// Close 关闭数据库连接 +func (s *SQLiteStore) Close() error { + return s.db.Close() +} + +// GetAllClients 获取所有客户端 +func (s *SQLiteStore) GetAllClients() ([]Client, error) { + s.mu.RLock() + defer s.mu.RUnlock() + + rows, err := s.db.Query(`SELECT id, rules FROM clients`) + if err != nil { + return nil, err + } + defer rows.Close() + + var clients []Client + for rows.Next() { + var c Client + var rulesJSON string + if err := rows.Scan(&c.ID, &rulesJSON); err != nil { + return nil, err + } + if err := json.Unmarshal([]byte(rulesJSON), &c.Rules); err != nil { + c.Rules = []protocol.ProxyRule{} + } + clients = append(clients, c) + } + return clients, nil +} + +// GetClient 获取单个客户端 +func (s *SQLiteStore) GetClient(id string) (*Client, error) { + s.mu.RLock() + defer s.mu.RUnlock() + + var c Client + var rulesJSON string + err := s.db.QueryRow(`SELECT id, rules FROM clients WHERE id = ?`, id).Scan(&c.ID, &rulesJSON) + if err != nil { + return nil, err + } + if err := json.Unmarshal([]byte(rulesJSON), &c.Rules); err != nil { + c.Rules = []protocol.ProxyRule{} + } + return &c, nil +} + +// CreateClient 创建客户端 +func (s *SQLiteStore) CreateClient(c *Client) error { + s.mu.Lock() + defer s.mu.Unlock() + + rulesJSON, err := json.Marshal(c.Rules) + if err != nil { + return err + } + _, err = s.db.Exec(`INSERT INTO clients (id, rules) VALUES (?, ?)`, c.ID, string(rulesJSON)) + return err +} + +// UpdateClient 更新客户端 +func (s *SQLiteStore) UpdateClient(c *Client) error { + s.mu.Lock() + defer s.mu.Unlock() + + rulesJSON, err := json.Marshal(c.Rules) + if err != nil { + return err + } + _, err = s.db.Exec(`UPDATE clients SET rules = ? WHERE id = ?`, string(rulesJSON), c.ID) + return err +} + +// DeleteClient 删除客户端 +func (s *SQLiteStore) DeleteClient(id string) error { + s.mu.Lock() + defer s.mu.Unlock() + + _, err := s.db.Exec(`DELETE FROM clients WHERE id = ?`, id) + return err +} + +// ClientExists 检查客户端是否存在 +func (s *SQLiteStore) ClientExists(id string) (bool, error) { + s.mu.RLock() + defer s.mu.RUnlock() + + var count int + err := s.db.QueryRow(`SELECT COUNT(*) FROM clients WHERE id = ?`, id).Scan(&count) + return count > 0, err +} + +// GetClientRules 获取客户端规则 +func (s *SQLiteStore) GetClientRules(id string) ([]protocol.ProxyRule, error) { + c, err := s.GetClient(id) + if err != nil { + return nil, err + } + return c.Rules, nil +} diff --git a/internal/server/router/api.go b/internal/server/router/api.go new file mode 100644 index 0000000..4bcc54b --- /dev/null +++ b/internal/server/router/api.go @@ -0,0 +1,216 @@ +package router + +import ( + "encoding/json" + "net/http" + + "github.com/gotunnel/internal/server/db" + "github.com/gotunnel/pkg/protocol" +) + +// ClientStatus 客户端状态 +type ClientStatus struct { + ID string `json:"id"` + Online bool `json:"online"` + LastPing string `json:"last_ping,omitempty"` + RuleCount int `json:"rule_count"` +} + +// ServerInterface 服务端接口 +type ServerInterface interface { + GetClientStatus(clientID string) (online bool, lastPing string) + GetAllClientStatus() map[string]struct { + Online bool + LastPing string + } + ReloadConfig() error + GetBindAddr() string + GetBindPort() int +} + +// AppInterface 应用接口 +type AppInterface interface { + GetClientStore() db.ClientStore + GetServer() ServerInterface +} + +// APIHandler API处理器 +type APIHandler struct { + clientStore db.ClientStore + server ServerInterface +} + +// RegisterRoutes 注册所有 API 路由 +func RegisterRoutes(r *Router, app AppInterface) { + h := &APIHandler{ + clientStore: app.GetClientStore(), + server: app.GetServer(), + } + + api := r.Group("/api") + api.HandleFunc("/status", h.handleStatus) + api.HandleFunc("/clients", h.handleClients) + api.HandleFunc("/client/", h.handleClient) + api.HandleFunc("/config/reload", h.handleReload) +} + +func (h *APIHandler) handleStatus(rw http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodGet { + http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) + return + } + + clients, _ := h.clientStore.GetAllClients() + status := map[string]interface{}{ + "server": map[string]interface{}{ + "bind_addr": h.server.GetBindAddr(), + "bind_port": h.server.GetBindPort(), + }, + "client_count": len(clients), + } + h.jsonResponse(rw, status) +} + +func (h *APIHandler) handleClients(rw http.ResponseWriter, r *http.Request) { + switch r.Method { + case http.MethodGet: + h.getClients(rw) + case http.MethodPost: + h.addClient(rw, r) + default: + http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) + } +} + +func (h *APIHandler) getClients(rw http.ResponseWriter) { + clients, err := h.clientStore.GetAllClients() + if err != nil { + http.Error(rw, err.Error(), http.StatusInternalServerError) + return + } + + statusMap := h.server.GetAllClientStatus() + var result []ClientStatus + for _, c := range clients { + cs := ClientStatus{ID: c.ID, RuleCount: len(c.Rules)} + if s, ok := statusMap[c.ID]; ok { + cs.Online = s.Online + cs.LastPing = s.LastPing + } + result = append(result, cs) + } + h.jsonResponse(rw, result) +} + +func (h *APIHandler) addClient(rw http.ResponseWriter, r *http.Request) { + var req struct { + ID string `json:"id"` + Rules []protocol.ProxyRule `json:"rules"` + } + if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + if req.ID == "" { + http.Error(rw, "client id required", http.StatusBadRequest) + return + } + + exists, _ := h.clientStore.ClientExists(req.ID) + if exists { + http.Error(rw, "client already exists", http.StatusConflict) + return + } + + client := &db.Client{ID: req.ID, Rules: req.Rules} + if err := h.clientStore.CreateClient(client); err != nil { + http.Error(rw, err.Error(), http.StatusInternalServerError) + return + } + h.jsonResponse(rw, map[string]string{"status": "ok"}) +} + +func (h *APIHandler) handleClient(rw http.ResponseWriter, r *http.Request) { + clientID := r.URL.Path[len("/api/client/"):] + if clientID == "" { + http.Error(rw, "client id required", http.StatusBadRequest) + return + } + switch r.Method { + case http.MethodGet: + h.getClient(rw, clientID) + case http.MethodPut: + h.updateClient(rw, r, clientID) + case http.MethodDelete: + h.deleteClient(rw, clientID) + default: + http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) + } +} + +func (h *APIHandler) getClient(rw http.ResponseWriter, clientID string) { + client, err := h.clientStore.GetClient(clientID) + if err != nil { + http.Error(rw, "client not found", http.StatusNotFound) + return + } + online, lastPing := h.server.GetClientStatus(clientID) + h.jsonResponse(rw, map[string]interface{}{ + "id": client.ID, "rules": client.Rules, + "online": online, "last_ping": lastPing, + }) +} + +func (h *APIHandler) updateClient(rw http.ResponseWriter, r *http.Request, clientID string) { + var req struct { + Rules []protocol.ProxyRule `json:"rules"` + } + if err := json.NewDecoder(r.Body).Decode(&req); err != nil { + http.Error(rw, err.Error(), http.StatusBadRequest) + return + } + + exists, _ := h.clientStore.ClientExists(clientID) + if !exists { + http.Error(rw, "client not found", http.StatusNotFound) + return + } + + client := &db.Client{ID: clientID, Rules: req.Rules} + if err := h.clientStore.UpdateClient(client); err != nil { + http.Error(rw, err.Error(), http.StatusInternalServerError) + return + } + h.jsonResponse(rw, map[string]string{"status": "ok"}) +} + +func (h *APIHandler) deleteClient(rw http.ResponseWriter, clientID string) { + exists, _ := h.clientStore.ClientExists(clientID) + if !exists { + http.Error(rw, "client not found", http.StatusNotFound) + return + } + + if err := h.clientStore.DeleteClient(clientID); err != nil { + http.Error(rw, err.Error(), http.StatusInternalServerError) + return + } + h.jsonResponse(rw, map[string]string{"status": "ok"}) +} + +func (h *APIHandler) handleReload(rw http.ResponseWriter, r *http.Request) { + if r.Method != http.MethodPost { + http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) + return + } + if err := h.server.ReloadConfig(); err != nil { + http.Error(rw, err.Error(), http.StatusInternalServerError) + return + } + h.jsonResponse(rw, map[string]string{"status": "ok"}) +} + +func (h *APIHandler) jsonResponse(rw http.ResponseWriter, data interface{}) { + rw.Header().Set("Content-Type", "application/json") + json.NewEncoder(rw).Encode(data) +} diff --git a/internal/server/router/router.go b/internal/server/router/router.go new file mode 100644 index 0000000..2ac30d6 --- /dev/null +++ b/internal/server/router/router.go @@ -0,0 +1,51 @@ +package router + +import ( + "net/http" +) + +// Router 路由管理器 +type Router struct { + mux *http.ServeMux +} + +// New 创建路由管理器 +func New() *Router { + return &Router{ + mux: http.NewServeMux(), + } +} + +// Handle 注册路由处理器 +func (r *Router) Handle(pattern string, handler http.Handler) { + r.mux.Handle(pattern, handler) +} + +// HandleFunc 注册路由处理函数 +func (r *Router) HandleFunc(pattern string, handler http.HandlerFunc) { + r.mux.HandleFunc(pattern, handler) +} + +// Group 创建路由组 +func (r *Router) Group(prefix string) *RouteGroup { + return &RouteGroup{ + router: r, + prefix: prefix, + } +} + +// RouteGroup 路由组 +type RouteGroup struct { + router *Router + prefix string +} + +// HandleFunc 注册路由组处理函数 +func (g *RouteGroup) HandleFunc(pattern string, handler http.HandlerFunc) { + g.router.mux.HandleFunc(g.prefix+pattern, handler) +} + +// Handler 返回 http.Handler +func (r *Router) Handler() http.Handler { + return r.mux +} diff --git a/pkg/tunnel/server.go b/internal/server/tunnel/server.go similarity index 82% rename from pkg/tunnel/server.go rename to internal/server/tunnel/server.go index 44c34d2..a43a5cb 100644 --- a/pkg/tunnel/server.go +++ b/internal/server/tunnel/server.go @@ -7,15 +7,21 @@ import ( "sync" "time" - "github.com/gotunnel/pkg/config" + "github.com/gotunnel/internal/server/db" "github.com/gotunnel/pkg/protocol" + "github.com/gotunnel/pkg/relay" "github.com/gotunnel/pkg/utils" "github.com/hashicorp/yamux" ) // Server 隧道服务端 type Server struct { - config *config.ServerConfig + clientStore db.ClientStore + bindAddr string + bindPort int + token string + heartbeat int + hbTimeout int portManager *utils.PortManager clients map[string]*ClientSession mu sync.RWMutex @@ -32,9 +38,14 @@ type ClientSession struct { } // NewServer 创建服务端 -func NewServer(cfg *config.ServerConfig) *Server { +func NewServer(cs db.ClientStore, bindAddr string, bindPort int, token string, heartbeat, hbTimeout int) *Server { return &Server{ - config: cfg, + clientStore: cs, + bindAddr: bindAddr, + bindPort: bindPort, + token: token, + heartbeat: heartbeat, + hbTimeout: hbTimeout, portManager: utils.NewPortManager(), clients: make(map[string]*ClientSession), } @@ -42,7 +53,7 @@ func NewServer(cfg *config.ServerConfig) *Server { // Run 启动服务端 func (s *Server) Run() error { - addr := fmt.Sprintf("%s:%d", s.config.Server.BindAddr, s.config.Server.BindPort) + addr := fmt.Sprintf("%s:%d", s.bindAddr, s.bindPort) ln, err := net.Listen("tcp", addr) if err != nil { return fmt.Errorf("failed to listen on %s: %v", addr, err) @@ -65,10 +76,8 @@ func (s *Server) Run() error { func (s *Server) handleConnection(conn net.Conn) { defer conn.Close() - // 设置认证超时 conn.SetReadDeadline(time.Now().Add(10 * time.Second)) - // 读取认证消息 msg, err := protocol.ReadMessage(conn) if err != nil { log.Printf("[Server] Read auth error: %v", err) @@ -86,15 +95,13 @@ func (s *Server) handleConnection(conn net.Conn) { return } - // 验证 Token - if authReq.Token != s.config.Server.Token { + if authReq.Token != s.token { s.sendAuthResponse(conn, false, "invalid token") return } - // 获取客户端配置 - rules := s.config.GetClientRules(authReq.ClientID) - if rules == nil { + rules, err := s.clientStore.GetClientRules(authReq.ClientID) + if err != nil || rules == nil { s.sendAuthResponse(conn, false, "client not configured") return } @@ -172,7 +179,6 @@ func (s *Server) unregisterClient(cs *ClientSession) { s.mu.Lock() defer s.mu.Unlock() - // 关闭所有监听器 cs.mu.Lock() for port, ln := range cs.Listeners { ln.Close() @@ -224,7 +230,6 @@ func (s *Server) acceptProxyConns(cs *ClientSession, ln net.Listener, rule proto func (s *Server) handleProxyConn(cs *ClientSession, conn net.Conn, rule protocol.ProxyRule) { defer conn.Close() - // 打开到客户端的流 stream, err := cs.Session.Open() if err != nil { log.Printf("[Server] Open stream error: %v", err) @@ -232,47 +237,21 @@ func (s *Server) handleProxyConn(cs *ClientSession, conn net.Conn, rule protocol } defer stream.Close() - // 发送新代理请求 req := protocol.NewProxyRequest{RemotePort: rule.RemotePort} msg, _ := protocol.NewMessage(protocol.MsgTypeNewProxy, req) if err := protocol.WriteMessage(stream, msg); err != nil { return } - // 双向转发 - relay(conn, stream) -} - -// relay 双向数据转发 -func relay(c1, c2 net.Conn) { - var wg sync.WaitGroup - wg.Add(2) - - copy := func(dst, src net.Conn) { - defer wg.Done() - buf := make([]byte, 32*1024) - for { - n, err := src.Read(buf) - if n > 0 { - dst.Write(buf[:n]) - } - if err != nil { - return - } - } - } - - go copy(c1, c2) - go copy(c2, c1) - wg.Wait() + relay.Relay(conn, stream) } // heartbeatLoop 心跳检测循环 func (s *Server) heartbeatLoop(cs *ClientSession) { - ticker := time.NewTicker(time.Duration(s.config.Server.HeartbeatSec) * time.Second) + ticker := time.NewTicker(time.Duration(s.heartbeat) * time.Second) defer ticker.Stop() - timeout := time.Duration(s.config.Server.HeartbeatTimeout) * time.Second + timeout := time.Duration(s.hbTimeout) * time.Second for { select { @@ -286,7 +265,6 @@ func (s *Server) heartbeatLoop(cs *ClientSession) { } cs.mu.Unlock() - // 发送心跳 stream, err := cs.Session.Open() if err != nil { return @@ -343,20 +321,15 @@ func (s *Server) GetAllClientStatus() map[string]struct { // ReloadConfig 重新加载配置 func (s *Server) ReloadConfig() error { - // 目前仅返回nil,后续可实现热重载 return nil } -// SetConfig 设置配置 -func (s *Server) SetConfig(cfg *config.ServerConfig) { - s.mu.Lock() - defer s.mu.Unlock() - s.config = cfg +// GetBindAddr 获取绑定地址 +func (s *Server) GetBindAddr() string { + return s.bindAddr } -// GetConfig 获取配置 -func (s *Server) GetConfig() *config.ServerConfig { - s.mu.RLock() - defer s.mu.RUnlock() - return s.config +// GetBindPort 获取绑定端口 +func (s *Server) GetBindPort() int { + return s.bindPort } diff --git a/pkg/protocol/message.go b/pkg/protocol/message.go index 15885aa..6865db3 100644 --- a/pkg/protocol/message.go +++ b/pkg/protocol/message.go @@ -63,7 +63,6 @@ type ErrorMessage struct { // WriteMessage 写入消息到 writer func WriteMessage(w io.Writer, msg *Message) error { - // 消息格式: [1字节类型][4字节长度][payload] header := make([]byte, 5) header[0] = msg.Type binary.BigEndian.PutUint32(header[1:], uint32(len(msg.Payload))) @@ -89,7 +88,7 @@ func ReadMessage(r io.Reader) (*Message, error) { msgType := header[0] length := binary.BigEndian.Uint32(header[1:]) - if length > 1024*1024 { // 最大 1MB + if length > 1024*1024 { return nil, errors.New("message too large") } diff --git a/pkg/relay/relay.go b/pkg/relay/relay.go new file mode 100644 index 0000000..40ca8a7 --- /dev/null +++ b/pkg/relay/relay.go @@ -0,0 +1,30 @@ +package relay + +import ( + "net" + "sync" +) + +// Relay 双向数据转发 +func Relay(c1, c2 net.Conn) { + var wg sync.WaitGroup + wg.Add(2) + + copy := func(dst, src net.Conn) { + defer wg.Done() + buf := make([]byte, 32*1024) + for { + n, err := src.Read(buf) + if n > 0 { + dst.Write(buf[:n]) + } + if err != nil { + return + } + } + } + + go copy(c1, c2) + go copy(c2, c1) + wg.Wait() +} diff --git a/pkg/webserver/server.go b/pkg/webserver/server.go deleted file mode 100644 index d43c8f8..0000000 --- a/pkg/webserver/server.go +++ /dev/null @@ -1,322 +0,0 @@ -package webserver - -import ( - "embed" - "encoding/json" - "fmt" - "io" - "io/fs" - "log" - "net/http" - "sync" - - "github.com/gotunnel/pkg/config" -) - -//go:embed dist/* -var staticFiles embed.FS - -// spaHandler SPA路由处理器 -type spaHandler struct { - fs http.FileSystem -} - -func (h spaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { - path := r.URL.Path - f, err := h.fs.Open(path) - if err != nil { - f, err = h.fs.Open("index.html") - if err != nil { - http.Error(w, "Not Found", http.StatusNotFound) - return - } - } - defer f.Close() - - stat, _ := f.Stat() - if stat.IsDir() { - f, err = h.fs.Open(path + "/index.html") - if err != nil { - f, _ = h.fs.Open("index.html") - } - } - http.ServeContent(w, r, path, stat.ModTime(), f.(io.ReadSeeker)) -} - -// ClientStatus 客户端状态 -type ClientStatus struct { - ID string `json:"id"` - Online bool `json:"online"` - LastPing string `json:"last_ping,omitempty"` - RuleCount int `json:"rule_count"` -} - -// ServerInterface 服务端接口 -type ServerInterface interface { - GetClientStatus(clientID string) (online bool, lastPing string) - GetAllClientStatus() map[string]struct { - Online bool - LastPing string - } - ReloadConfig() error -} - -// WebServer Web控制台服务 -type WebServer struct { - config *config.ServerConfig - configPath string - server ServerInterface - mu sync.RWMutex -} - -// NewWebServer 创建Web服务 -func NewWebServer(cfg *config.ServerConfig, configPath string, srv ServerInterface) *WebServer { - return &WebServer{ - config: cfg, - configPath: configPath, - server: srv, - } -} - -// Run 启动Web服务 -func (w *WebServer) Run(addr string) error { - mux := http.NewServeMux() - - mux.HandleFunc("/api/status", w.handleStatus) - mux.HandleFunc("/api/clients", w.handleClients) - mux.HandleFunc("/api/client/", w.handleClient) - mux.HandleFunc("/api/config/reload", w.handleReload) - - staticFS, err := fs.Sub(staticFiles, "dist") - if err != nil { - return err - } - mux.Handle("/", spaHandler{fs: http.FS(staticFS)}) - - log.Printf("[Web] Console listening on %s", addr) - return http.ListenAndServe(addr, mux) -} - -// handleStatus 获取服务状态 -func (w *WebServer) handleStatus(rw http.ResponseWriter, r *http.Request) { - if r.Method != http.MethodGet { - http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) - return - } - w.mu.RLock() - defer w.mu.RUnlock() - - status := map[string]interface{}{ - "server": map[string]interface{}{ - "bind_addr": w.config.Server.BindAddr, - "bind_port": w.config.Server.BindPort, - }, - "client_count": len(w.config.Clients), - } - w.jsonResponse(rw, status) -} - -// handleClients 获取所有客户端 -func (w *WebServer) handleClients(rw http.ResponseWriter, r *http.Request) { - switch r.Method { - case http.MethodGet: - w.getClients(rw) - case http.MethodPost: - w.addClient(rw, r) - default: - http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) - } -} - -func (w *WebServer) getClients(rw http.ResponseWriter) { - w.mu.RLock() - defer w.mu.RUnlock() - - var clients []ClientStatus - statusMap := w.server.GetAllClientStatus() - - for _, c := range w.config.Clients { - cs := ClientStatus{ID: c.ID, RuleCount: len(c.Rules)} - if s, ok := statusMap[c.ID]; ok { - cs.Online = s.Online - cs.LastPing = s.LastPing - } - clients = append(clients, cs) - } - w.jsonResponse(rw, clients) -} - -func (w *WebServer) addClient(rw http.ResponseWriter, r *http.Request) { - var client config.ClientConfig - if err := json.NewDecoder(r.Body).Decode(&client); err != nil { - http.Error(rw, err.Error(), http.StatusBadRequest) - return - } - if client.ID == "" { - http.Error(rw, "client id required", http.StatusBadRequest) - return - } - - w.mu.Lock() - for _, c := range w.config.Clients { - if c.ID == client.ID { - w.mu.Unlock() - http.Error(rw, "client already exists", http.StatusConflict) - return - } - } - w.config.Clients = append(w.config.Clients, client) - w.mu.Unlock() - - if err := w.saveConfig(); err != nil { - http.Error(rw, err.Error(), http.StatusInternalServerError) - return - } - w.jsonResponse(rw, map[string]string{"status": "ok"}) -} - -func (w *WebServer) handleClient(rw http.ResponseWriter, r *http.Request) { - clientID := r.URL.Path[len("/api/client/"):] - if clientID == "" { - http.Error(rw, "client id required", http.StatusBadRequest) - return - } - switch r.Method { - case http.MethodGet: - w.getClient(rw, clientID) - case http.MethodPut: - w.updateClient(rw, r, clientID) - case http.MethodDelete: - w.deleteClient(rw, clientID) - default: - http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) - } -} - -func (w *WebServer) getClient(rw http.ResponseWriter, clientID string) { - w.mu.RLock() - defer w.mu.RUnlock() - - for _, c := range w.config.Clients { - if c.ID == clientID { - online, lastPing := w.server.GetClientStatus(clientID) - w.jsonResponse(rw, map[string]interface{}{ - "id": c.ID, "rules": c.Rules, - "online": online, "last_ping": lastPing, - }) - return - } - } - http.Error(rw, "client not found", http.StatusNotFound) -} - -func (w *WebServer) updateClient(rw http.ResponseWriter, r *http.Request, clientID string) { - var client config.ClientConfig - if err := json.NewDecoder(r.Body).Decode(&client); err != nil { - http.Error(rw, err.Error(), http.StatusBadRequest) - return - } - - w.mu.Lock() - found := false - for i, c := range w.config.Clients { - if c.ID == clientID { - client.ID = clientID - w.config.Clients[i] = client - found = true - break - } - } - w.mu.Unlock() - - if !found { - http.Error(rw, "client not found", http.StatusNotFound) - return - } - if err := w.saveConfig(); err != nil { - http.Error(rw, err.Error(), http.StatusInternalServerError) - return - } - w.jsonResponse(rw, map[string]string{"status": "ok"}) -} - -func (w *WebServer) deleteClient(rw http.ResponseWriter, clientID string) { - w.mu.Lock() - found := false - for i, c := range w.config.Clients { - if c.ID == clientID { - w.config.Clients = append(w.config.Clients[:i], w.config.Clients[i+1:]...) - found = true - break - } - } - w.mu.Unlock() - - if !found { - http.Error(rw, "client not found", http.StatusNotFound) - return - } - if err := w.saveConfig(); err != nil { - http.Error(rw, err.Error(), http.StatusInternalServerError) - return - } - w.jsonResponse(rw, map[string]string{"status": "ok"}) -} - -func (w *WebServer) handleReload(rw http.ResponseWriter, r *http.Request) { - if r.Method != http.MethodPost { - http.Error(rw, "Method not allowed", http.StatusMethodNotAllowed) - return - } - if err := w.server.ReloadConfig(); err != nil { - http.Error(rw, err.Error(), http.StatusInternalServerError) - return - } - w.jsonResponse(rw, map[string]string{"status": "ok"}) -} - -func (w *WebServer) saveConfig() error { - w.mu.RLock() - defer w.mu.RUnlock() - return config.SaveServerConfig(w.configPath, w.config) -} - -func (w *WebServer) jsonResponse(rw http.ResponseWriter, data interface{}) { - rw.Header().Set("Content-Type", "application/json") - json.NewEncoder(rw).Encode(data) -} - -// RunWithAuth 启动带认证的Web服务 -func (w *WebServer) RunWithAuth(addr, username, password string) error { - mux := http.NewServeMux() - - mux.HandleFunc("/api/status", w.handleStatus) - mux.HandleFunc("/api/clients", w.handleClients) - mux.HandleFunc("/api/client/", w.handleClient) - mux.HandleFunc("/api/config/reload", w.handleReload) - - staticFS, err := fs.Sub(staticFiles, "dist") - if err != nil { - return fmt.Errorf("failed to load static files: %v", err) - } - mux.Handle("/", spaHandler{fs: http.FS(staticFS)}) - - handler := &authMiddleware{username, password, mux} - log.Printf("[Web] Console listening on %s (auth enabled)", addr) - return http.ListenAndServe(addr, handler) -} - -type authMiddleware struct { - username, password string - handler http.Handler -} - -func (a *authMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request) { - user, pass, ok := r.BasicAuth() - if !ok || user != a.username || pass != a.password { - w.Header().Set("WWW-Authenticate", `Basic realm="GoTunnel"`) - http.Error(w, "Unauthorized", http.StatusUnauthorized) - return - } - a.handler.ServeHTTP(w, r) -}