metacubexd/assets/Config-9NNS9COU.js

2 lines
10 KiB
JavaScript

import{b as X,y as Z,u as R,b5 as U,D as K,d as e,i as t,ac as C,S,t as d,z as y,b6 as le,c as W,A as re,f as J,B as w,F as A,r as Y,b7 as $,g as P,b8 as ne,b9 as ae,ba as se,bb as ie,bc as ce,bd as oe,be as ue,bf as de,bg as ge,bh as he,bi as ve,bj as fe,bk as Q,bl as pe,bm as be,bn as me,b4 as xe,k as $e,bo as _e,bp as z,bq as ke,br as Ce,bs as H,bt as ye,bu as we,bv as Se,bw as j,bx as L,q as M,Z as V,K as ee,v as te,n as Ie,by as Ae,bz as De,bA as Pe,bB as Te}from"./index-Csmv4Fkv.js";import{D as Fe}from"./DocumentTitle-DG90V81t.js";var Ne=d("<input type=checkbox>"),Be=d("<input>"),Ue=d("<select>"),Ee=d('<label><span class="label-text truncate">'),Re=d("<option>A"),je=d("<option>AAAA"),Le=d("<option>MX"),Me=d('<div class="flex flex-col p-4">'),Ve=d('<div class="flex flex-col"><form class="flex gap-2 sm:flex-row"><div class="flex items-center gap-2">'),Qe=d("<div class=py-2>"),qe=d('<div class="grid grid-cols-3 gap-2"><div class=form-control></div><div class=form-control></div><div class=form-control>'),Ge=d('<form class="grid grid-cols-3 gap-2 sm:grid-cols-5">'),Oe=d('<div class="flex flex-col gap-4"><div class="grid grid-cols-3 gap-2"><div class=form-control></div><div class=form-control></div><div class=form-control></div></div><div class="grid grid-cols-2 gap-4 sm:grid-cols-3">'),N=d("<option>"),ze=d("<div class=form-control>"),He=d('<div class="flex flex-col gap-2"><div class="flex flex-col"></div><div class="flex flex-col">'),Xe=d('<div class="grid grid-cols-1 gap-4 sm:grid-cols-2"><div class="flex flex-col gap-2"><div class="flex flex-col items-center"></div><div class="flex flex-col"></div><div class="flex flex-col"></div></div><div class="flex flex-col gap-2"><div class="flex flex-col items-center">'),Ze=d('<span class="absolute -right-1 -top-1 flex h-3 w-3"><span class="absolute inline-flex h-full w-full animate-ping rounded-full bg-info opacity-75"></span><span class="inline-flex h-3 w-3 rounded-full bg-info">'),Ke=d('<div class="mx-2 grid grid-cols-2 gap-4 md:mx-0"><div class=relative><kbd class="kbd w-full"></kbd></div><div class=relative><kbd class="kbd w-full">'),We=d('<div class="mx-auto flex max-w-screen-md flex-col gap-4">');const E=a=>{const[c,r]=j(a,["class"]);return(()=>{var s=Ne();return L(s,M({get class(){return V("toggle",c.class)}},r),!1,!1),s})()},B=a=>{const[c,r]=j(a,["class"]);return(()=>{var s=Be();return L(s,M({get class(){return V("input input-bordered min-w-0",c.class)}},r),!1,!1),s})()},T=a=>{const[c,r]=j(a,["class"]);return(()=>{var s=Ue();return L(s,M({get class(){return V("select select-bordered",c.class)}},r),!1,!0),t(s,()=>ee(()=>r.children)()),s})()},I=a=>{const[c,r]=j(a,["class"]);return(()=>{var s=Ee(),f=s.firstChild;return L(s,M({get class(){return V("label",c.class)}},r),!1,!0),t(f,()=>ee(()=>r.children)()),s})()},Je=y.object({name:y.string(),type:y.string()}),Ye=()=>{const[a]=R(),c=le(),{form:r,isSubmitting:s}=W({extend:te({schema:Je}),onSubmit:n=>c.get("dns/query",{searchParams:{name:n.name,type:n.type}}).json().then(({Answer:i})=>p((i==null?void 0:i.map(({data:o})=>o))||[])).catch(i=>Ie.error(i.message))}),[f,p]=re([]);return(()=>{var n=Ve(),i=n.firstChild,o=i.firstChild;return J(r,i,()=>r),t(i,e(B,{type:"search",name:"name",class:"flex-1",placeholder:"google.com",onInput:m=>{m.target.value||p([])}}),o),t(o,e(T,{name:"type",get children(){return[Re(),je(),Le()]}}),null),t(o,e(w,{type:"submit",class:"btn-primary",get loading(){return s()},get children(){return a("dnsQuery")}}),null),t(n,e(S,{get when(){return f().length>0},get children(){var m=Me();return t(m,e(A,{get each(){return f()},children:l=>(()=>{var b=Qe();return t(b,l),b})()})),m}}),null),n})()},et=y.object({port:y.number(),"socks-port":y.number(),"redir-port":y.number(),"tproxy-port":y.number(),"mixed-port":y.number()}),tt=({isSingBox:a,fetchBackendVersion:c})=>{const[r]=R(),s=[{label:()=>r("port",{name:"Mixed"}),key:"mixed-port",onChange:l=>void $("mixed-port",Number(l.target.value),o)},{label:()=>r("port",{name:"HTTP"}),key:"port",onChange:l=>void $("port",Number(l.target.value),o)},{label:()=>r("port",{name:"Socks"}),key:"socks-port",onChange:l=>void $("socks-port",Number(l.target.value),o)},{label:()=>r("port",{name:"Redir"}),key:"redir-port",onChange:l=>void $("redir-port",Number(l.target.value),o)},{label:()=>r("port",{name:"TProxy"}),key:"tproxy-port",onChange:l=>void $("tproxy-port",Number(l.target.value),o)}],{form:f,setInitialValues:p,reset:n}=W({extend:te({schema:et})}),[i,{refetch:o}]=U(Ae);Y(()=>{const l=i();l&&(p(l),n())});const m=K(()=>{const l=i();return(l==null?void 0:l["mode-list"])||(l==null?void 0:l.modes)||["rule","direct","global"]});return(()=>{var l=Oe(),b=l.firstChild,D=b.firstChild,g=D.nextSibling,x=g.nextSibling,F=b.nextSibling;return t(D,e(I,{for:"enable-allow-lan",get children(){return r("allowLan")}}),null),t(D,e(E,{id:"enable-allow-lan",get checked(){var u;return(u=i())==null?void 0:u["allow-lan"]},onChange:u=>void $("allow-lan",u.target.checked,o)}),null),t(g,e(I,{for:"mode",get children(){return r("runningMode")}}),null),t(g,e(T,{id:"mode",onChange:u=>void $("mode",u.target.value,o),get children(){return e(A,{get each(){return m()},children:u=>(()=>{var h=N();return h.value=u,t(h,()=>r(u)??u),P(()=>{var _;return h.selected=u===((_=i())==null?void 0:_.mode)}),h})()})}}),null),t(x,e(I,{for:"interface-name",get children(){return r("outboundInterfaceName")}}),null),t(x,e(B,{id:"interface-name",get value(){var u;return(u=i())==null?void 0:u["interface-name"]},onChange:u=>void $("interface-name",u.target.value,o)}),null),t(l,e(S,{get when(){return!a()},get children(){return[(()=>{var u=qe(),h=u.firstChild,_=h.nextSibling,q=_.nextSibling;return t(h,e(I,{for:"enable-tun-device",get children(){return r("enableTunDevice")}}),null),t(h,e(E,{id:"enable-tun-device",get checked(){var v,k;return(k=(v=i())==null?void 0:v.tun)==null?void 0:k.enable},onChange:v=>void $("tun",{enable:v.target.checked},o)}),null),t(_,e(I,{for:"tun-ip-stack",get children(){return r("tunModeStack")}}),null),t(_,e(T,{id:"tun-ip-stack",onChange:v=>void $("tun",{stack:v.target.value},o),get children(){return e(A,{each:["Mixed","gVisor","System","LWIP"],children:v=>(()=>{var k=N();return k.value=v,t(k,v),P(()=>{var G,O;return k.selected=((O=(G=i())==null?void 0:G.tun)==null?void 0:O.stack)===v}),k})()})}}),null),t(q,e(I,{for:"device-name",get children(){return r("tunDeviceName")}}),null),t(q,e(B,{id:"device-name",get value(){var v,k;return(k=(v=i())==null?void 0:v.tun)==null?void 0:k.device},onChange:v=>void $("tun",{device:v.target.value},o)}),null),u})(),(()=>{var u=Ge();return J(f,u,()=>f),t(u,e(A,{each:s,children:h=>(()=>{var _=ze();return t(_,e(I,{get for(){return h.key},get children(){return h.label()}}),null),t(_,e(B,{get id(){return h.key},get name(){return h.key},type:"number",get placeholder(){return h.label()},get onChange(){return h.onChange}}),null),_})()})),u})()]}}),F),t(F,e(w,{class:"btn-primary",get loading(){return ne()},onClick:ae,get children(){return r("reloadConfig")}}),null),t(F,e(w,{class:"btn-accent",get loading(){return se()},onClick:ie,get children(){return r("flushFakeIP")}}),null),t(F,e(w,{class:"btn-warning",get loading(){return ce()},onClick:oe,get children(){return r("restartCore")}}),null),t(F,e(S,{get when(){return!a()},get children(){return[e(w,{class:"btn-secondary",get loading(){return ue()},onClick:de,get children(){return r("updateGEODatabases")}}),e(w,{class:"btn-info",get loading(){return ge()},onClick:he,get children(){return r("upgradeUI")}}),e(w,{class:"btn-error",get loading(){return ve()},onClick:async()=>{await fe(),await c()},get children(){return r("upgradeCore")}})]}}),null),l})()},lt=()=>{const[a]=R(),c=X(),r=[{label:()=>a("en"),value:Q.EN},{label:()=>a("zh"),value:Q.ZH},{label:()=>a("ru"),value:Q.RU}];return(()=>{var s=Xe(),f=s.firstChild,p=f.firstChild,n=p.nextSibling,i=n.nextSibling,o=f.nextSibling,m=o.firstChild;return t(p,e(C,{get children(){return a("useTwemoji")}}),null),t(p,e(E,{get checked(){return pe()},onChange:l=>be(l.target.checked)}),null),t(n,e(C,{get children(){return a("switchLanguage")}}),null),t(n,e(T,{onChange:l=>me(l.target.value),get children(){return e(A,{each:r,children:l=>(()=>{var b=N();return t(b,()=>l.label()),P(()=>b.selected=xe()===l.value),P(()=>b.value=l.value),b})()})}}),null),t(i,e(C,{get children(){var l;return(l=Z())==null?void 0:l.url}}),null),t(i,e(w,{class:"btn-info",onClick:()=>{$e(""),c(_e.Setup)},get children(){return a("switchEndpoint")}}),null),t(m,e(C,{get children(){return a("autoSwitchTheme")}}),null),t(m,e(E,{get checked(){return z()},onChange:l=>ke(l.target.checked)}),null),t(o,e(S,{get when(){return z()},get children(){var l=He(),b=l.firstChild,D=b.nextSibling;return t(b,e(C,{get children(){return a("favDayTheme")}}),null),t(b,e(T,{onChange:g=>Ce(g.target.value),get children(){return e(A,{each:H,children:g=>(()=>{var x=N();return x.value=g,t(x,g),P(()=>x.selected=ye()===g),x})()})}}),null),t(D,e(C,{get children(){return a("favNightTheme")}}),null),t(D,e(T,{onChange:g=>we(g.target.value),get children(){return e(A,{each:H,children:g=>(()=>{var x=N();return x.value=g,t(x,g),P(()=>x.selected=Se()===g),x})()})}}),null),l}}),null),s})()},rt=({frontendVersion:a,backendVersion:c})=>{const[r]=U(()=>De(a)),[s,{refetch:f}]=U(()=>Pe(c()));Y(()=>{f()},c());const p=()=>Ze();return(()=>{var n=Ke(),i=n.firstChild,o=i.firstChild,m=i.nextSibling,l=m.firstChild;return t(i,e(S,{get when(){return r()},get children(){return e(p,{})}}),o),t(o,()=>"1.176.0"),t(m,e(S,{get when(){return s()},get children(){return e(p,{})}}),l),t(l,c),n})()},st=()=>{const a=X();if(!Z())return a("/setup",{replace:!0}),null;const[c]=R(),r="v1.176.0",[s,{refetch:f}]=U(Te,{initialValue:""}),p=K(()=>{var n;return((n=s())==null?void 0:n.includes("sing-box"))||!1});return[e(Fe,{get children(){return c("config")}}),(()=>{var n=We();return t(n,e(S,{get when(){return!p()},get children(){return[e(C,{withDivider:!0,get children(){return c("dnsQuery")}}),e(Ye,{})]}}),null),t(n,e(C,{withDivider:!0,get children(){return c("coreConfig")}}),null),t(n,e(tt,{isSingBox:p,fetchBackendVersion:()=>f()}),null),t(n,e(C,{withDivider:!0,get children(){return c("xdConfig")}}),null),t(n,e(lt,{}),null),t(n,e(C,{withDivider:!0,get children(){return c("version")}}),null),t(n,e(S,{get when(){return!s.loading},get children(){return e(rt,{frontendVersion:r,backendVersion:s})}}),null),n})()]};export{st as default};