1 line
73 KiB
JavaScript
1 line
73 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[246],{9170:function(e,t,l){l.d(t,{Z:function(){return r}});var s=l(7437),a=l(2265);function r(e){let{snapshot:t,theme:r,tr:n}=e,i=(0,a.useRef)(null);return((0,a.useEffect)(()=>{let e=i.current;if(!e||!t)return;let s=!1,a=null,o="light"===r?"#0f172a":"#e2e8f0",c="light"===r?"#64748b":"#94a3b8",d="light"===r?"rgba(15,23,42,0.1)":"rgba(148,163,184,0.12)";l.e(614).then(l.bind(l,9614)).then(e=>{var l,r,h,x,m,u,p,b,g,f,v,w,j;if(s||!i.current)return;a=e.init(i.current,void 0,{renderer:"canvas"});let N=null!==(g=null===(l=t.cpu_load)||void 0===l?void 0:l["1m"])&&void 0!==g?g:0,y=null!==(f=null===(r=t.cpu_load)||void 0===r?void 0:r["5m"])&&void 0!==f?f:0,k=null!==(v=null===(h=t.cpu_load)||void 0===h?void 0:h["15m"])&&void 0!==v?v:0,C=(null===(x=t.memory)||void 0===x?void 0:x.total)||1,S=null!==(j=null!==(w=null===(m=t.memory)||void 0===m?void 0:m.available)&&void 0!==w?w:null===(u=t.memory)||void 0===u?void 0:u.free)&&void 0!==j?j:0,_=(null===(p=t.disk)||void 0===p?void 0:p.total)||1,D=(null===(b=t.disk)||void 0===b?void 0:b.free)||0;a.setOption({animationDurationUpdate:450,textStyle:{color:o},title:{text:n("无人直播节点 \xb7 资源","Unmanned live \xb7 resources"),left:12,top:8,textStyle:{color:o,fontSize:12,fontWeight:600}},tooltip:{trigger:"axis"},grid:{left:52,right:"48%",top:52,bottom:36},xAxis:{type:"category",data:["1m","5m","15m"],axisLabel:{color:c,fontSize:10},axisLine:{lineStyle:{color:d}}},yAxis:{type:"value",name:n("负载","Load"),nameTextStyle:{color:c,fontSize:10},axisLabel:{color:c,fontSize:10},splitLine:{lineStyle:{color:d}}},series:[{name:n("CPU","CPU"),type:"bar",data:[N,y,k],barMaxWidth:28,itemStyle:{borderRadius:[6,6,0,0],color:new e.graphic.LinearGradient(0,0,0,1,[{offset:0,color:"#22d3ee"},{offset:1,color:"#6366f1"}])}},{name:n("内存","RAM"),type:"pie",radius:["26%","40%"],center:["78%","38%"],label:{color:o,fontSize:9},data:[{value:Math.max(0,C-S),name:n("已用","Used")},{value:Math.max(0,S),name:n("可用","Free")}]},{name:n("磁盘","Disk"),type:"pie",radius:["20%","32%"],center:["78%","72%"],label:{color:o,fontSize:9},data:[{value:Math.max(0,_-D),name:n("已用","Used")},{value:Math.max(0,D),name:n("空闲","Free")}]}]})});let h=new ResizeObserver(()=>null==a?void 0:a.resize());return h.observe(e),()=>{s=!0,h.disconnect(),null==a||a.dispose()}},[t,r,n]),t)?(0,s.jsxs)("div",{className:"mt-4",children:[(0,s.jsx)("p",{className:"mb-2 text-xs opacity-70",children:n("ECharts 动态图表","ECharts live charts")}),(0,s.jsx)("div",{ref:i,className:"chart-surface h-64 w-full rounded-2xl border border-white/[0.08] bg-black/15 md:h-72"})]}):null}},2246:function(e,t,l){l.d(t,{d:function(){return S}});var s=l(7437),a=l(3145),r=l(2265),n=l(9170),i=l(2023),o=l(1817),c=l(7168),d=l(6865),h=l(5621),x=l(9076);function m(e){let{lang:t,rootId:l,filePath:a,fileContent:n,refreshKey:m,busy:u,fetchJson:p,notify:b,onChangeContent:g,onRefreshListing:f}=e,[v,w]=(0,r.useState)(null),[j,N]=(0,r.useState)(!1),[y,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(null),[_,D]=(0,r.useState)(null),E=(0,r.useCallback)((e,l)=>"zh"===t?e:l,[t]),O=(0,r.useCallback)(async()=>{if(!l||!a){w(null);return}N(!0);try{let e=new URLSearchParams({root:l,path:a}),t=await p("/config_insights?".concat(e.toString()));w(t)}catch(e){w(null),b(e.message)}finally{N(!1)}},[p,a,b,l]);(0,r.useEffect)(()=>{O()},[O,m]);let T=async()=>{if(l&&a){k(!0);try{let e=await p("/config_insights",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:l,path:a,content:n})});w(e),b(E("已分析当前编辑内容","Analyzed current editor draft"))}catch(e){b(e.message)}finally{k(!1)}}},R=async e=>{if(l&&a){S(e);try{let t=await p("/config_optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:l,path:a,content:n,action:e})});"string"==typeof t.content&&g(t.content),t.insights&&w(e=>({...e,...t.insights,backups:(null==e?void 0:e.backups)||[]})),b(t.message||E("已应用优化","Optimization applied"))}catch(e){b(e.message)}finally{S(null)}}},A=async e=>{if(l&&a){D(e);try{let t=await p("/config_restore",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:l,path:a,backup_id:e})});"string"==typeof t.content&&g(t.content),await Promise.resolve(null==f?void 0:f()),await O(),b(t.message||E("已恢复历史版本","Backup restored"))}catch(e){b(e.message)}finally{D(null)}}};if(!a)return(0,s.jsx)("div",{className:"rounded-2xl border border-white/8 bg-black/20 p-4 text-sm text-slate-400",children:E("选择文件后显示诊断、回滚和一键优化。","Pick a file to see diagnostics, rollback, and one-click optimizations.")});let P=(null==v?void 0:v.issues)||[],U=(null==v?void 0:v.actions)||[],L=(null==v?void 0:v.backups)||[],I=(null==v?void 0:v.stats)||[];return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-cyan-500/15 bg-gradient-to-br from-cyan-500/[0.08] via-black/25 to-transparent p-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,s.jsx)(i.Z,{className:"h-4 w-4 text-cyan-300"}),(0,s.jsx)("h3",{className:"text-sm font-semibold",children:E("配置治理","Config governance")}),(null==v?void 0:v.source)?(0,s.jsx)("span",{className:"rounded-full border border-white/10 bg-black/25 px-2 py-0.5 text-[10px] uppercase tracking-wider text-slate-400",children:v.source}):null]}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:(null==v?void 0:v.summary)||E("校验配置风险、查看历史快照,并将常见优化应用到编辑器。","Validate risks, inspect snapshots, and apply optimizations into the editor.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("button",{type:"button",disabled:!!u||j,onClick:()=>void O(),className:"btn-focus inline-flex items-center gap-2 rounded-xl border border-white/10 bg-black/25 px-3 py-2 text-xs text-slate-100 disabled:opacity-40",children:[j?(0,s.jsx)(o.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(c.Z,{className:"h-3.5 w-3.5"}),E("刷新已保存状态","Refresh saved state")]}),(0,s.jsxs)("button",{type:"button",disabled:!!u||y,onClick:()=>void T(),className:"btn-focus inline-flex items-center gap-2 rounded-xl border border-cyan-500/30 bg-cyan-500/15 px-3 py-2 text-xs text-cyan-100 disabled:opacity-40",children:[y?(0,s.jsx)(o.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(d.Z,{className:"h-3.5 w-3.5"}),E("分析当前编辑器","Analyze editor draft")]})]})]}),(0,s.jsx)("div",{className:"mt-4 grid gap-2 sm:grid-cols-2 xl:grid-cols-4",children:I.slice(0,8).map(e=>(0,s.jsxs)("div",{className:"rounded-xl border border-white/8 bg-black/20 px-3 py-2.5",children:[(0,s.jsx)("div",{className:"text-[10px] uppercase tracking-wider text-slate-500",children:e.label}),(0,s.jsx)("div",{className:"mt-1 truncate font-mono text-sm text-white",children:e.value})]},e.key))})]}),(0,s.jsxs)("div",{className:"grid gap-4 xl:grid-cols-2",children:[(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-black/20 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,s.jsx)(d.Z,{className:"h-4 w-4 text-amber-300"}),(0,s.jsx)("h4",{className:"text-sm font-semibold",children:E("风险与建议","Risks & guidance")})]}),P.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:P.map((e,t)=>{var l;return(0,s.jsxs)("div",{className:"rounded-xl border px-3 py-2 text-xs ".concat("error"===(l=e.level)?"border-rose-500/30 bg-rose-500/10 text-rose-100":"warning"===l?"border-amber-500/30 bg-amber-500/10 text-amber-100":"border-cyan-500/30 bg-cyan-500/10 text-cyan-100"),children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.message,e.line?" (L".concat(e.line,")"):""]}),(0,s.jsx)("div",{className:"mt-1 font-mono opacity-70",children:e.code})]},"".concat(e.code,"-").concat(t))})}):(0,s.jsx)("p",{className:"mt-3 text-xs text-emerald-300/90",children:E("当前没有发现明显配置风险。","No obvious config risks were detected.")}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:U.length?U.map(e=>(0,s.jsx)("button",{type:"button",disabled:!!u||!!C,onClick:()=>void R(e.id),className:"btn-focus rounded-xl border border-violet-500/30 bg-violet-500/15 px-3 py-2 text-xs text-violet-100 disabled:opacity-40",title:e.description,children:C===e.id?E("处理中...","Working..."):e.label},e.id)):(0,s.jsx)("span",{className:"text-xs text-slate-500",children:E("当前文件没有可自动应用的预设。","No auto-applicable presets for this file.")})})]}),(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-black/20 p-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 text-white",children:[(0,s.jsx)(h.Z,{className:"h-4 w-4 text-cyan-300"}),(0,s.jsx)("h4",{className:"text-sm font-semibold",children:E("历史快照","Backup snapshots")})]}),L.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:L.slice(0,8).map(e=>(0,s.jsx)("div",{className:"rounded-xl border border-white/8 bg-black/25 px-3 py-2.5",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-xs text-white",children:new Date(e.created_at).toLocaleString("zh"===t?"zh-CN":"en-US",{hour12:!1})}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[e.reason," \xb7 ",function(e){if(!e)return"0 B";let t=["B","KB","MB","GB"],l=e,s=0;for(;l>=1024&&s<t.length-1;)l/=1024,s+=1;return"".concat(l.toFixed(l>=10||0===s?0:1)," ").concat(t[s])}(e.size),"legacy"===e.source?" \xb7 ".concat(E("旧备份","legacy")):""]})]}),(0,s.jsxs)("button",{type:"button",disabled:!!u||!!_,onClick:()=>void A(e.id),className:"btn-focus inline-flex items-center gap-1 rounded-lg border border-white/10 bg-white/5 px-3 py-1.5 text-xs text-slate-100 disabled:opacity-40",children:[_===e.id?(0,s.jsx)(o.Z,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(x.Z,{className:"h-3.5 w-3.5"}),E("恢复","Restore")]})]})},e.id))}):(0,s.jsx)("p",{className:"mt-3 text-xs text-slate-500",children:E("当前文件还没有 Web 侧快照。保存、删除或恢复后会自动累积历史。","No Web snapshots yet. Saving, deleting, or restoring will accumulate history automatically.")})]})]})]})}var u=l(1387),p=l(90),b=l(8401),g=l(257);let f=["overview","business","modules","shellcrash","android","config"],v=new Set(["shellcrash-configs","shellcrash-yamls","shellcrash-jsons"]),w="LsRzcR3pHoA9.yaml",j="5d723acc-singbox_tuic3",N=()=>void 0!==g&&g.env.NEXT_PUBLIC_API_URL||"";function y(e){if(!e)return"0 B";let t=["B","KB","MB","GB","TB"],l=e,s=0;for(;l>=1024&&s<t.length-1;)l/=1024,s+=1;return"".concat(l.toFixed(l>=10||0===s?0:1)," ").concat(t[s])}function k(e){return"online"===e?"border-emerald-500/30 bg-emerald-500/10 text-emerald-200":"stopped"===e?"border-slate-500/30 bg-slate-500/10 text-slate-300":"configured"===e?"border-violet-500/30 bg-violet-500/10 text-violet-200":"unavailable"===e?"border-slate-700/30 bg-slate-800/50 text-slate-500":"error"===e?"border-rose-500/30 bg-rose-500/10 text-rose-200":"border-cyan-500/30 bg-cyan-500/10 text-cyan-200"}function C(e){let{children:t,className:l,disabled:a,onClick:r,title:n}=e;return(0,s.jsx)("button",{type:"button",className:"btn-focus rounded-xl px-3 py-2 text-xs font-semibold text-white disabled:cursor-not-allowed disabled:opacity-40 ".concat(l||""),disabled:a,onClick:r,title:n,children:t})}function S(e){var t,l,i,o,c,d,h,x,g,S,_,D,E,O,T,R;let{embeddedShellCrash:A=!1,portalLang:P}=e,U=N(),[L,I]=(0,r.useState)("zh"),[M,B]=(0,r.useState)("dark"),[z,F]=(0,r.useState)("overview"),W=(0,r.useCallback)((e,t)=>"zh"===L?e:t,[L]),[K,H]=(0,r.useState)(!0),[Y,J]=(0,r.useState)(null),[Z,G]=(0,r.useState)(null),[V,Q]=(0,r.useState)(null),[$,q]=(0,r.useState)(!0),X=(0,r.useRef)(null),[ee,et]=(0,r.useState)([]),[el,es]=(0,r.useState)(""),[ea,er]=(0,r.useState)("unknown"),[en,ei]=(0,r.useState)(""),[eo,ec]=(0,r.useState)(""),[ed,eh]=(0,r.useState)(null),[ex,em]=(0,r.useState)([]),[eu,ep]=(0,r.useState)(null),[eb,eg]=(0,r.useState)(null),[ef,ev]=(0,r.useState)([]),[ew,ej]=(0,r.useState)(""),[eN,ey]=(0,r.useState)([]),[ek,eC]=(0,r.useState)(""),[eS,e_]=(0,r.useState)(""),[eD,eE]=(0,r.useState)(!1),[eO,eT]=(0,r.useState)([]),[eR,eA]=(0,r.useState)(""),[eP,eU]=(0,r.useState)(null),[eL,eI]=(0,r.useState)([]),[eM,eB]=(0,r.useState)([]),[ez,eF]=(0,r.useState)(""),[eW,eK]=(0,r.useState)(""),[eH,eY]=(0,r.useState)("com.zhiliaoapp.musically"),[eJ,eZ]=(0,r.useState)("https://www.tiktok.com"),[eG,eV]=(0,r.useState)(""),[eQ,e$]=(0,r.useState)(""),[eq,eX]=(0,r.useState)(Date.now()),[e0,e2]=(0,r.useState)("tap"),[e1,e3]=(0,r.useState)(null),[e5,e4]=(0,r.useState)(0),[e6,e8]=(0,r.useState)(0),[e9,e7]=(0,r.useState)(null),[te,tt]=(0,r.useState)(null),[tl,ts]=(0,r.useState)(!1),ta=null!==(O=ef.find(e=>e.root_id===ew))&&void 0!==O?O:null,tr=ef.filter(e=>v.has(e.root_id)),tn=ef.filter(e=>!v.has(e.root_id)),ti=null!==(T=ex.find(e=>"shellcrash"===e.service_id))&&void 0!==T?T:null,to=null!==(R=ex.find(e=>"android_panel"===e.service_id))&&void 0!==R?R:null,tc=(0,r.useMemo)(()=>{var e;let t=null!==(e=null==ed?void 0:ed.quick_links)&&void 0!==e?e:{},l={};for(let[e,s]of Object.entries(t)){let t=String(s);l[e]=/^https?:\/\//i.test(t)?(0,b.p)(t):t}return l},[ed]),td=(0,r.useMemo)(()=>(0,p.O0)(tc),[tc]),th=(0,r.useMemo)(()=>(0,p.Tc)(td),[td]),tx=(0,r.useMemo)(()=>{let e=tc.ws_scrcpy||((null==to?void 0:to.host)&&to.port?"http://".concat(to.host,":").concat(to.port):(null==ed?void 0:ed.mdns_host)?"http://".concat(ed.mdns_host,":5000"):"");return e?(0,b.p)(e):""},[null==to?void 0:to.host,null==to?void 0:to.port,tc.ws_scrcpy,null==ed?void 0:ed.mdns_host]),tm=function(e){let t=null==e?void 0:e.match(/(\d+)x(\d+)/);return t?{width:Number(t[1]),height:Number(t[2])}:null}(null==eP?void 0:eP.resolution),tu=(0,r.useCallback)(e=>{G(e),null!=X.current&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{G(null),X.current=null},2500)},[]),tp=(0,r.useCallback)(async(e,t)=>(0,u.N)("".concat(U).concat(e),t),[U]),tb=(0,r.useCallback)((e,t)=>{let l=new URL(window.location.href);l.pathname="shellcrash"===e?"/shellcrash":"android"===e?"/android":"/console","/console"===l.pathname?l.searchParams.set("tab",e):l.searchParams.delete("tab"),l.searchParams.set("lang",t),window.history.replaceState(null,"",l.toString()),window.localStorage.setItem("live-console-lang",t)},[]),tg=(0,r.useCallback)(async()=>{if(!el)return;let e=await tp("/status?process=".concat(encodeURIComponent(el)));er(e.process_status||"unknown"),ei(e.recent_log||""),ec(e.recent_error||"")},[el,tp]),tf=(0,r.useCallback)(async()=>{let[e,t,l]=await Promise.all([tp("/stack/services"),tp("/system_snapshot"),tp("/hardware_profile")]);em(e.services||[]),ep(t),eg(l)},[tp]),tv=(0,r.useCallback)(async(e,t)=>{if(!e)return;let l=(await tp("/managed_files?root=".concat(encodeURIComponent(e)))).files||[];ey(l);let s=t||ek;if(s&&l.some(e=>e.path===s))eC(s);else{var a;eC((null===(a=l[0])||void 0===a?void 0:a.path)||"")}},[tp,ek]),tw=(0,r.useCallback)(async()=>{var e;let t=await tp("/android/devices"),l=t.devices||[],s=eR&&l.some(e=>e.serial===eR)?eR:(null===(e=l[0])||void 0===e?void 0:e.serial)||"";return eE(!!t.available),eT(l),eA(s),s},[eR,tp]),tj=(0,r.useCallback)(async e=>{if(!e){eU(null);return}eU(await tp("/android/overview?serial=".concat(encodeURIComponent(e))))},[tp]),tN=(0,r.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ez;if(!e){eB([]);return}eB((await tp("/android/packages?serial=".concat(encodeURIComponent(e),"&query=").concat(encodeURIComponent(t),"&limit=60"))).packages||[])},[ez,tp]),ty=(0,r.useCallback)(async e=>{if(!e){eI([]);return}eI((await tp("/android/ui?serial=".concat(encodeURIComponent(e),"&limit=80"))).nodes||[])},[tp]),tk=(0,r.useCallback)(async(e,t)=>{ej(e),eC(t),await tv(e,t)},[tv]),tC=(0,r.useCallback)((e,t)=>{F("config"),window.setTimeout(()=>{tk(e,t)},0)},[tk]),tS=(0,r.useCallback)(async()=>{Q("hardware:probe");try{let e=await tp("/hardware_profile?refresh=true");eg(e),tu(W("硬件探测已更新","Hardware profile refreshed"))}catch(e){tu(e.message)}finally{Q(null)}},[tp,tu,W]),t_=(0,r.useCallback)(async()=>{H(!0),J(null);try{var e,t,l,s;let[a,r,n]=await Promise.all([tp("/process_monitor"),tp("/server_info"),tp("/managed_roots")]);et(a.entries||[]),es((null===(t=a.entries)||void 0===t?void 0:null===(e=t[0])||void 0===e?void 0:e.pm2)||""),eh(r.stack||null),ev(n.roots||[]),ej((null===(s=n.roots)||void 0===s?void 0:null===(l=s[0])||void 0===l?void 0:l.root_id)||""),await Promise.all([tf(),tw()])}catch(e){J(e.message)}finally{H(!1)}},[tp,tw,tf]);(0,r.useEffect)(()=>{if(A){if(F("shellcrash"),"zh"===P||"en"===P)I(P);else{let e=window.localStorage.getItem("live-hub-lang");("zh"===e||"en"===e)&&I(e)}return}let e=new URLSearchParams(window.location.search),t=function(e){let t=e.replace(/\/+$/,"")||"/";return"/shellcrash"===t?"shellcrash":"/android"===t?"android":null}(window.location.pathname),l=e.get("tab"),s=e.get("lang"),a=window.localStorage.getItem("live-console-lang");t?F(t):null!==l&&f.includes(l)&&F(l),"zh"===s||"en"===s?I(s):("zh"===a||"en"===a)&&I(a);let r=window.localStorage.getItem("live-console-theme");("light"===r||"dark"===r)&&B(r)},[A,P]),(0,r.useEffect)(()=>{A||(document.documentElement.setAttribute("data-theme",M),window.localStorage.setItem("live-console-theme",M))},[M,A]),(0,r.useEffect)(()=>{let e=()=>q("visible"===document.visibilityState);return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[]),(0,r.useEffect)(()=>()=>{null!=X.current&&window.clearTimeout(X.current)},[]),(0,r.useEffect)(()=>{A&&("zh"===P||"en"===P)&&I(P)},[A,P]),(0,r.useEffect)(()=>{A||tb(z,L)},[A,L,tb,z]),(0,r.useEffect)(()=>{t_()},[t_]),(0,r.useEffect)(()=>{if(!el||!$)return;tg();let e=window.setInterval(()=>void tg(),1500);return()=>window.clearInterval(e)},[el,$,tg]),(0,r.useEffect)(()=>{if(K||Y||!$||"overview"!==z&&"modules"!==z&&"shellcrash"!==z)return;tf();let e=window.setInterval(()=>void tf(),1e4);return()=>clearInterval(e)},[K,Y,$,tf,z]),(0,r.useEffect)(()=>{let e="shellcrash"===z?tr:"config"===z?tn:ef;e.length&&!e.some(e=>e.root_id===ew)&&(ej(e[0].root_id),eC(""))},[tn,ew,ef,tr,z]),(0,r.useEffect)(()=>{ew&&tv(ew)},[tv,ew]),(0,r.useEffect)(()=>{if(!ew||!ek){e_("");return}(async()=>{try{let e=await tp("/managed_file?root=".concat(encodeURIComponent(ew),"&path=").concat(encodeURIComponent(ek)));e_(e.content||"")}catch(e){tu(e.message)}})()},[tp,ek,tu,ew]),(0,r.useEffect)(()=>{"android"===z&&(async()=>{let e=await tw();e&&(await Promise.all([tj(e),ty(e),tN(e)]),eX(Date.now()))})()},[tw,tj,tN,ty,z]),(0,r.useEffect)(()=>{if("android"!==z||!eR||!$)return;tj(eR),eX(Date.now());let e=window.setInterval(()=>{tj(eR),eX(Date.now())},5e3);return()=>window.clearInterval(e)},[eR,$,tj,z]),(0,r.useEffect)(()=>{if(!eR){e7(e=>(e&&URL.revokeObjectURL(e),null)),tt(null),ts(!1);return}let e=new AbortController,t="".concat(U,"/android/screenshot?serial=").concat(encodeURIComponent(eR),"&ts=").concat(eq);return ts(!0),tt(null),fetch(t,{signal:e.signal}).then(async e=>{if(!e.ok)throw Error(await (0,u.e)(e));return e.blob()}).then(e=>{if(!e.type.startsWith("image/"))throw Error("Not an image");let t=URL.createObjectURL(e);e7(e=>(e&&URL.revokeObjectURL(e),t))}).catch(e=>{"AbortError"!==e.name&&(tt(e.message),e7(e=>(e&&URL.revokeObjectURL(e),null)))}).finally(()=>{e.signal.aborted||ts(!1)}),()=>{e.abort()}},[eR,eq,U]);let tD=async e=>{if(el){Q("process:".concat(e));try{let t=await tp("/".concat(e),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({process:el})});tu(String(t.output||t.pm2_output||t.message||"OK")),await tg()}catch(e){tu(e.message)}finally{Q(null)}}},tE=async(e,t)=>{Q("".concat(e,":").concat(t));try{let l=await tp("/service_action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({service:e,action:t})});tu(l.message||"OK"),await tf()}catch(e){tu(e.message)}finally{Q(null)}},tO=async e=>{let t=e||("shellcrash-yamls"===ew&&ek?ek:w);Q("shellcrash:apply");try{"shellcrash-yamls"===ew&&ek===t&&await tp("/managed_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:ew,path:ek,content:eS})});let e=await tp("/shellcrash/apply_profile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t,target_node:j})}),l=e.selected?" | ".concat(e.selected):"";tu("".concat(e.message||W("ShellCrash 配置已应用","ShellCrash profile applied")).concat(l)),await Promise.all([tf(),tv("shellcrash-yamls","config.yaml")]),ej("shellcrash-yamls"),eC("config.yaml"),e8(e=>e+1)}catch(e){tu(e.message)}finally{Q(null)}},tT=async()=>{let e=window.open("about:blank","_blank");Q("shellcrash:web_panel");try{let t=await tp("/shellcrash/web_panel",{method:"POST"}),l=(0,b.p)(t.url||"http://".concat(window.location.hostname||"127.0.0.1",":").concat("9999","/ui/"));if(tu(t.message||W("ShellCrash web 面板已就绪","ShellCrash web panel is ready")),e){try{e.opener=null}catch(e){}e.location.href=l}else window.open(l,"_blank","noopener,noreferrer");await tf()}catch(t){null==e||e.close(),tu(t.message)}finally{Q(null)}},tR=async()=>{if(ew&&ek){Q("file:save");try{await tp("/managed_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:ew,path:ek,content:eS})}),tu(W("文件已保存","File saved")),await tv(ew,ek),e8(e=>e+1)}catch(e){tu(e.message)}finally{Q(null)}}},tA=async()=>{if(!(null==ta?void 0:ta.allow_create)){tu(W("当前目录不允许新建文件","The current root does not allow new files"));return}let e=window.prompt(W("请输入新的相对路径","Enter a new relative path"),ta.default_file||"");if(e){Q("file:create");try{await tp("/managed_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:ew,path:e,content:""})}),tu(W("文件已创建","File created")),await tv(ew,e),e8(e=>e+1)}catch(e){tu(e.message)}finally{Q(null)}}},tP=async()=>{if(ew&&ek){if(!(null==ta?void 0:ta.allow_delete)){tu(W("当前目录不允许删除文件","The current root does not allow deletion"));return}if(window.confirm(W("确定删除该文件?","Delete this file?"))){Q("file:delete");try{await tp("/managed_file?root=".concat(encodeURIComponent(ew),"&path=").concat(encodeURIComponent(ek)),{method:"DELETE"}),tu(W("文件已删除","File deleted")),await tv(ew),e8(e=>e+1)}catch(e){tu(e.message)}finally{Q(null)}}}},tU=async e=>{var t;let l=null===(t=e.target.files)||void 0===t?void 0:t[0];if(e.target.value="",e4(e=>e+1),l&&ew){Q("file:import");try{let e=await l.text();await tp("/managed_file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({root:ew,path:l.name,content:e})}),tu(W("导入完成,已替换同名文件","Import finished and replaced matching file")),eC(l.name),await tv(ew,l.name),e8(e=>e+1)}catch(e){tu(e.message)}finally{Q(null)}}},tL=async(e,t)=>{if(!eR){tu(W("当前没有可用的 ADB 设备","No active ADB device"));return}Q("android:".concat(e));try{let l=await tp("/android/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,serial:eR,payload:t||{}})});tu(l.message||"OK"),l.output&&e$(l.output),eX(Date.now()),await tj(eR)}catch(e){tu(e.message)}finally{Q(null)}},tI="tap"===e0?W("点击","Tap"):"double_tap"===e0?W("双击","Double Tap"):W("长按","Long Press"),tM=async e=>{if(!eR){tu(W("当前没有可用的 ADB 设备","No active ADB device"));return}let t=function(e,t,l){let s,a,r,n;let i=e.getBoundingClientRect(),o=e.naturalWidth,c=e.naturalHeight;if(!o||!c||!i.width||!i.height)return null;let d=i.width/i.height,h=o/c;h>d?(s=i.width,a=i.width/h,r=0,n=(i.height-a)/2):(a=i.height,s=i.height*h,r=(i.width-s)/2,n=0);let x=t-i.left-r,m=l-i.top-n;return x<0||m<0||x>s||m>a?null:{x:Math.max(0,Math.min(o-1,Math.round(x/s*o))),y:Math.max(0,Math.min(c-1,Math.round(m/a*c)))}}(e.currentTarget,e.clientX,e.clientY);if(!t){tu(W("请点击画面有效区域","Tap inside the visible frame"));return}let l=(null==tm?void 0:tm.width)||e.currentTarget.naturalWidth,s=(null==tm?void 0:tm.height)||e.currentTarget.naturalHeight,a=l>0?l/Math.max(1,e.currentTarget.naturalWidth):1,r=s>0?s/Math.max(1,e.currentTarget.naturalHeight):1,n=Math.max(0,Math.min(l||t.x,Math.round(t.x*a))),i=Math.max(0,Math.min(s||t.y,Math.round(t.y*r)));if(e3({x:n,y:i}),"long_press"===e0){await tL("long_press",{x:n,y:i,duration:750});return}await tL(e0,{x:n,y:i})},tB=e=>"shellcrash"===e.service_id&&(null==ed?void 0:ed.control_url)?"".concat(ed.control_url,"/shellcrash?lang=").concat(L):"android_panel"===e.service_id&&(null==ed?void 0:ed.control_url)?"".concat(ed.control_url,"/android?lang=").concat(L):e.url||"",tz=e=>({online:W("在线","Online"),stopped:W("已停止","Stopped"),configured:W("已配置","Configured"),unavailable:W("未安装","Unavailable")})[e]||e,tF="shellcrash"===z?tr:tn,tW={overview:"\uD83D\uDCCA",business:"\uD83C\uDFAC",modules:"\uD83E\uDDE9",shellcrash:"\uD83D\uDEE1️",android:"\uD83E\uDD16",config:"⚙️"};return(0,s.jsxs)(s.Fragment,{children:[A?null:(0,s.jsx)("div",{className:"border-b border-white/[0.08] bg-slate-950/80 backdrop-blur-md",children:(0,s.jsxs)("div",{className:"mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-2 px-4 py-2.5 text-xs sm:px-6 lg:px-10",children:[(0,s.jsxs)("a",{className:"font-medium text-amber-400/95 transition hover:text-amber-300",href:"/",children:["← ",W("返回门户首页","Back to portal")]}),(0,s.jsx)("span",{className:"text-slate-500",children:W("无人直播 \xb7 本页需与 API 同域(推荐 live.local:8001)","Unmanned live \xb7 same origin as API (live.local:8001)")})]})}),(0,s.jsxs)("main",{className:A?"mx-auto min-h-0 max-w-7xl px-1 pb-4 pt-1 sm:px-3":"safe-pb-nav mx-auto min-h-screen max-w-7xl px-4 pb-16 pt-6 sm:px-6 lg:px-10",children:[Z?(0,s.jsx)("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"animate-toast-in fixed bottom-24 left-1/2 z-50 max-w-[min(92vw,28rem)] -translate-x-1/2 rounded-2xl border border-cyan-500/25 bg-slate-950/95 px-5 py-3 text-center text-sm text-cyan-50 shadow-lg md:bottom-6 [html[data-theme=light]_&]:border-cyan-600/25 [html[data-theme=light]_&]:bg-white/95 [html[data-theme=light]_&]:text-cyan-950",children:Z}):null,A?(0,s.jsxs)("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-2 border-b border-white/[0.08] pb-3",children:[(0,s.jsx)("h2",{className:"text-base font-semibold text-[color:var(--text)]",children:"ShellCrash"}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",onClick:()=>void t_(),children:W("刷新","Refresh")})]}):(0,s.jsxs)("header",{className:"mb-8 flex flex-col gap-4",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-cyan-400/90",children:W("控制平面 \xb7 ARM Linux 开发板","Control plane \xb7 ARM Linux SBC")}),(0,s.jsx)("h1",{className:"mt-2 text-3xl font-bold text-[color:var(--text)] sm:text-4xl",children:W("无人直播控制中心","Unmanned live control center")}),(0,s.jsx)("p",{className:"mt-3 max-w-3xl text-sm text-slate-400",children:W("ShellCrash 负责代理上网;本机 FFmpeg 处理推流或 HDMI;Neko(Docker Chromium)或本机 Chromium 负责浏览器侧;开发板通过 USB 双头线 ADB 控制 AOSP。各模块独立,可分别启停。","ShellCrash for egress; FFmpeg for stream or HDMI; Neko (Docker Chromium) or host Chromium for browser; USB ADB to AOSP. Modules are isolated.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,s.jsx)("div",{className:"meta-chip max-w-full",children:((null==ed?void 0:ed.mdns_host)||"live.local")+" \xb7 "+((null==ed?void 0:ed.machine)||"unknown")+" \xb7 "+((null==ed?void 0:ed.kernel)||"unknown")}),(0,s.jsx)(C,{className:"zh"===L?"border border-cyan-400/50 bg-cyan-500/10":"border border-white/12 bg-black/20",onClick:()=>I("zh"),children:"中文"}),(0,s.jsx)(C,{className:"en"===L?"border border-cyan-400/50 bg-cyan-500/10":"border border-white/12 bg-black/20",onClick:()=>I("en"),children:"EN"}),(0,s.jsx)(C,{className:"light"===M?"border border-amber-400/50 bg-amber-500/15":"border border-white/12 bg-black/20",onClick:()=>B("light"),title:W("日间主题","Light theme"),children:W("☀️ 日间","☀️ Light")}),(0,s.jsx)(C,{className:"dark"===M?"border border-indigo-400/50 bg-indigo-500/15":"border border-white/12 bg-black/20",onClick:()=>B("dark"),title:W("夜间主题","Dark theme"),children:W("\uD83C\uDF19 夜间","\uD83C\uDF19 Dark")}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",onClick:()=>void t_(),children:W("刷新","Refresh")})]})]}),(0,s.jsx)("nav",{className:"tab-strip","aria-label":W("主导航","Primary navigation"),children:f.map(e=>(0,s.jsx)("button",{type:"button",className:"tab-btn ".concat(z===e?"tab-btn-active":""),onClick:()=>F(e),children:{overview:W("总览","Overview"),business:W("直播业务","Live ops"),modules:W("系统服务","Services"),shellcrash:"ShellCrash",android:W("安卓设备","Android"),config:W("配置中心","Config")}[e]},e))})]}),K?(0,s.jsx)("div",{className:"glass rounded-3xl py-24 text-center text-slate-400",children:W("正在连接控制台...","Connecting to the control plane...")}):null,!K&&Y?(0,s.jsx)("div",{className:"glass rounded-3xl border border-rose-500/25 bg-rose-950/20 p-8 text-center text-rose-200",children:Y}):null,K||Y?null:(0,s.jsxs)("div",{className:"grid gap-6",children:["overview"===z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("section",{className:"glass rounded-3xl border border-amber-500/20 bg-gradient-to-br from-amber-500/[0.07] to-transparent p-6",children:[(0,s.jsx)("h2",{className:"section-title",children:W("第一次用?按这条线理解整套板子","New here? Follow this mental model")}),(0,s.jsxs)("ol",{className:"mt-4 list-decimal space-y-2 pl-5 text-sm leading-relaxed text-slate-300",children:[(0,s.jsx)("li",{children:W("插电、接网线或连好 Wi‑Fi 后,用浏览器打开本页(验收域名一般为 http://live.local:8001/ ,门户在根路径 /,控制台在 /console)。","After power and Ethernet/Wi‑Fi, open this stack in a browser (often http://live.local:8001/ — portal at /, full console at /console).")}),(0,s.jsx)("li",{children:W("「直播业务」里启停 PM2 脚本(抖音→YouTube、HDMI 等);「系统服务」看 ShellCrash、SRS、ws-scrcpy、Neko 等是否在跑。","Use Live ops for PM2 scripts; Services for ShellCrash, SRS, ws-scrcpy, Neko, etc.")}),(0,s.jsx)("li",{children:W("「安卓设备」需要 USB 调试授权;截图预览 + ws-scrcpy 低延迟画面二选一或同用。TikTok 等场景常配合板载 AOSP。","Android tab needs USB debugging; use screenshot taps and/or ws-scrcpy. TikTok workflows often use on-board AOSP.")}),(0,s.jsx)("li",{children:W("深度指标点 Netdata;命令行点 WebTTY;代理规则与 YAML 在 ShellCrash 页。","Netdata for metrics; WebTTY for shell; ShellCrash tab for proxy rules and YAML.")})]})]}),(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:W("\uD83D\uDEF0️ 流媒体与桌面入口","Streaming & desktop")}),(0,s.jsx)("p",{className:"section-lead",children:W("ws-scrcpy:浏览器里控安卓;Chromium:本机+油猴+RemoteDebug;Neko:Docker 里跑 Chromium 桌面(非 Firefox 版)。","ws-scrcpy: browser ADB; Chromium: host+Tampermonkey+9222; Neko: Chromium desktop in Docker (not the Firefox image).")}),(0,s.jsxs)("div",{className:"mt-4 flex max-h-[28rem] flex-col gap-2 overflow-y-auto pr-1 log-scroll",children:[(null==ed?void 0:ed.dashboard_url)?(0,s.jsx)("a",{className:"link-tile",href:ed.dashboard_url,target:"_blank",rel:"noreferrer",children:"\uD83C\uDFE0 Homepage"}):null,(null==ed?void 0:ed.control_url)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("a",{className:"link-tile",href:"".concat(ed.control_url,"/console?tab=shellcrash&lang=").concat(L),target:"_blank",rel:"noreferrer",children:"\uD83D\uDEE1️ ShellCrash"}),(0,s.jsxs)("a",{className:"link-tile",href:"".concat(ed.control_url,"/console?tab=android&lang=").concat(L),target:"_blank",rel:"noreferrer",children:["\uD83E\uDD16 ",W("安卓中心 (含 ws-scrcpy)","Android hub + ws-scrcpy")]}),(0,s.jsxs)("a",{className:"link-tile",href:"".concat(ed.control_url,"/console?tab=config&lang=").concat(L),target:"_blank",rel:"noreferrer",children:["⚙️ ",W("配置中心","Config")]})]}):null,tc.ws_scrcpy?(0,s.jsxs)("a",{className:"link-tile link-tile-accent",href:tc.ws_scrcpy,target:"_blank",rel:"noreferrer",children:["\uD83D\uDCF1 ws-scrcpy (",W("原始流控制页","raw stream UI"),")"]}):null,tc.chromium_remote_debug?(0,s.jsxs)("a",{className:"link-tile",href:tc.chromium_remote_debug,target:"_blank",rel:"noreferrer",children:["\uD83E\uDDEA ",W("Chromium RemoteDebug (9222)","Chromium RemoteDebug")]}):null,td.map(e=>(0,s.jsxs)("a",{className:"link-tile link-tile-warn",href:e.url,target:"_blank",rel:"noreferrer",children:["\uD83D\uDC31 ",e.label," / ",W("Docker Chromium 桌面","Docker Chromium desktop")]},e.key)),tc.webtty?(0,s.jsx)("a",{className:"link-tile",href:tc.webtty,target:"_blank",rel:"noreferrer",children:"⌨️ WebTTY"}):null,tc.filebrowser?(0,s.jsx)("a",{className:"link-tile",href:tc.filebrowser,target:"_blank",rel:"noreferrer",children:"\uD83D\uDCC2 File Browser"}):null,tc.netdata?(0,s.jsx)("a",{className:"link-tile",href:tc.netdata,target:"_blank",rel:"noreferrer",children:"\uD83D\uDCC8 Netdata"}):null,tc.srs_http?(0,s.jsx)("a",{className:"link-tile",href:tc.srs_http,target:"_blank",rel:"noreferrer",children:"\uD83C\uDF9E️ SRS :8080"}):null,tc.srs_api?(0,s.jsx)("a",{className:"link-tile",href:tc.srs_api,target:"_blank",rel:"noreferrer",children:"\uD83C\uDF9E️ SRS API :1985"}):null]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:W("节点状态","Node Status")}),(0,s.jsxs)("div",{className:"panel-inset mt-4",children:[(0,s.jsx)("p",{children:(null==ed?void 0:ed.mdns_host)||"live.local"}),(0,s.jsxs)("p",{className:"mt-2",children:["IP: ",((null==ed?void 0:ed.ips)||[]).join(" / ")||"-"]}),(0,s.jsx)("p",{className:"mt-2",children:(null==ed?void 0:ed.machine)||"-"}),(0,s.jsx)("p",{className:"mt-2",children:(null==ed?void 0:ed.kernel)||"-"})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:W("系统快照","System Snapshot")}),(0,s.jsx)("p",{className:"section-lead",children:W("总览页每 10 秒自动刷新服务与监控数据。","Overview auto-refreshes every 10s.")}),(0,s.jsxs)("div",{className:"panel-inset mt-4",children:[(0,s.jsxs)("p",{children:["CPU:"," ",[null==eu?void 0:null===(t=eu.cpu_load)||void 0===t?void 0:t["1m"],null==eu?void 0:null===(l=eu.cpu_load)||void 0===l?void 0:l["5m"],null==eu?void 0:null===(i=eu.cpu_load)||void 0===i?void 0:i["15m"]].map(e=>"number"==typeof e?e.toFixed(2):"0.00").join(" / ")]}),(0,s.jsxs)("p",{className:"mt-2",children:["RAM: ",y(null==eu?void 0:null===(o=eu.memory)||void 0===o?void 0:o.available)," / ",y(null==eu?void 0:null===(c=eu.memory)||void 0===c?void 0:c.total)]}),(0,s.jsxs)("p",{className:"mt-2",children:["Disk: ",y(null==eu?void 0:null===(d=eu.disk)||void 0===d?void 0:d.free)," / ",y(null==eu?void 0:null===(h=eu.disk)||void 0===h?void 0:h.total)]}),(0,s.jsxs)("p",{className:"mt-2",children:["Netdata: ",(null==eu?void 0:null===(x=eu.netdata)||void 0===x?void 0:x.available)?eu.netdata.version||"online":"offline"]})]}),(0,s.jsx)(n.Z,{snapshot:eu,theme:M,tr:W})]})]}),(0,s.jsxs)("section",{className:"glass rounded-3xl p-6",children:[(0,s.jsx)("h2",{className:"section-title",children:W("模块概况","Module Summary")}),(0,s.jsx)("div",{className:"mt-4 grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:ex.map(e=>(0,s.jsxs)("div",{className:"service-card",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:e.label}),(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:e.description})]}),(0,s.jsx)("span",{className:"rounded-full border px-2.5 py-1 text-xs ".concat(k(e.status)),children:tz(e.status)})]}),(0,s.jsx)("p",{className:"mt-3 min-h-[3rem] text-xs text-slate-500",children:e.detail||"-"}),tB(e)?(0,s.jsx)("a",{className:"btn-focus mt-3 inline-flex rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-200",href:tB(e),target:"_blank",rel:"noreferrer",children:W("打开","Open")}):null]},e.service_id))})]})]}):null,"business"===z?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-12",children:[(0,s.jsx)("h2",{className:"section-title",children:W("⚡ 快捷配置","Quick config")}),(0,s.jsx)("p",{className:"section-lead",children:W("跳转配置中心编辑推流与录制相关文件。","Jump to the config editor for stream keys and URLs.")}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{className:"border border-cyan-500/30 bg-cyan-600/80",onClick:()=>tC("app-config","youtube.ini"),children:"youtube.ini"}),(0,s.jsx)(C,{className:"border border-cyan-500/30 bg-cyan-600/80",onClick:()=>tC("app-config","URL_config.ini"),children:"URL_config.ini"}),(0,s.jsx)(C,{className:"border border-white/15 bg-black/30",onClick:()=>tC("app-config","config.ini"),children:"config.ini"}),(0,s.jsx)(C,{className:"border border-white/15 bg-black/30",onClick:()=>tC("stack-config","system-stack.env"),children:"system-stack.env"})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"section-title",children:W("业务运行时","Business Runtime")}),(0,s.jsx)("p",{className:"section-lead",children:W("这里只放业务脚本本身,Hub 基座可单独运行。","Only business processes live here.")}),ee.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("select",{className:"field-select mt-4",value:el,onChange:e=>es(e.target.value),children:ee.map(e=>(0,s.jsxs)("option",{value:e.pm2,children:[e.label," | ",e.script]},e.pm2))}),(0,s.jsxs)("div",{className:"mt-4 flex items-center justify-between rounded-2xl border border-white/8 bg-black/20 px-4 py-3",children:[(0,s.jsx)("span",{className:"rounded-full border px-3 py-1 text-xs ".concat(k(ea)),children:tz(ea)}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",onClick:()=>void tg(),children:W("轮询","Poll")})]}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:[(0,s.jsx)(C,{className:"bg-emerald-600",disabled:"process:start"===V,onClick:()=>void tD("start"),children:"process:start"===V?W("启动中...","Starting..."):W("启动","Start")}),(0,s.jsx)(C,{className:"bg-amber-600",disabled:"process:restart"===V,onClick:()=>void tD("restart"),children:"process:restart"===V?W("重启中...","Restarting..."):W("重启","Restart")}),(0,s.jsx)(C,{className:"col-span-2 bg-rose-600",disabled:"process:stop"===V,onClick:()=>void tD("stop"),children:"process:stop"===V?W("停止中...","Stopping..."):W("停止","Stop")})]})]}):(0,s.jsx)("div",{className:"mt-4 rounded-2xl border border-dashed border-white/12 bg-black/20 p-4 text-sm text-slate-400",children:W("未发现业务进程。若只部署了 Hub 基座,这是正常状态。","No business process discovered.")})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsx)("h2",{className:"section-title",children:W("业务日志","Process Logs")}),(0,s.jsxs)("div",{className:"mt-4 grid gap-4 lg:grid-cols-2",children:[(0,s.jsx)("pre",{className:"log-scroll min-h-[22rem] rounded-2xl border border-emerald-500/15 bg-black/55 p-4 font-mono text-[11px] text-emerald-100/95",children:en||W("暂无输出","No stdout yet.")}),(0,s.jsx)("pre",{className:"log-scroll min-h-[22rem] rounded-2xl border border-rose-500/15 bg-black/55 p-4 font-mono text-[11px] text-rose-100/95",children:eo||W("暂无报错","No stderr yet.")})]})]})]}):null,"modules"===z?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"section-title",children:W("系统模块","System Modules")}),(0,s.jsx)("p",{className:"section-lead",children:W("每个模块都独立启停和降级,避免一个服务异常拖垮整套业务。","Each module starts and degrades independently.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",onClick:()=>void tf(),children:W("刷新服务","Refresh Services")}),(0,s.jsx)(C,{className:"border border-violet-500/35 bg-violet-600/70",disabled:"hardware:probe"===V,onClick:()=>void tS(),children:"hardware:probe"===V?W("探测中…","Probing…"):W("重探测硬件","Re-probe HW")})]})]}),(0,s.jsx)("div",{className:"mt-4 grid gap-4 md:grid-cols-2",children:ex.map(e=>(0,s.jsxs)("div",{className:"service-card",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:e.label}),(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:e.description})]}),(0,s.jsx)("span",{className:"rounded-full border px-2.5 py-1 text-xs ".concat(k(e.status)),children:tz(e.status)})]}),(0,s.jsx)("p",{className:"mt-3 min-h-[3rem] text-xs text-slate-500",children:e.detail||"-"}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{className:"bg-emerald-600",disabled:!e.available||!!V,onClick:()=>void tE(e.service_id,"start"),children:W("启动","Start")}),(0,s.jsx)(C,{className:"bg-amber-600",disabled:!e.available||!!V,onClick:()=>void tE(e.service_id,"restart"),children:W("重启","Restart")}),(0,s.jsx)(C,{className:"bg-rose-600",disabled:!e.available||!!V,onClick:()=>void tE(e.service_id,"stop"),children:W("停止","Stop")}),tB(e)?(0,s.jsx)("a",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-200",href:tB(e),target:"_blank",rel:"noreferrer",children:W("打开","Open")}):null]})]},e.service_id))})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:W("硬件与系统","Hardware and System")}),(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsxs)("p",{children:["Arch: ",(null==eb?void 0:eb.arch)||"-"]}),(0,s.jsxs)("p",{className:"mt-2",children:["FFmpeg: ",((null==eb?void 0:eb.ffmpeg_hwaccels)||[]).join(", ")||"-"]}),(0,s.jsxs)("p",{className:"mt-2",children:["GPU: ",(null==eb?void 0:null===(g=eb.gpu)||void 0===g?void 0:g.present)?eb.gpu.driver||"present":"none"]}),(0,s.jsxs)("p",{className:"mt-2",children:["NPU: ",(null==eb?void 0:null===(S=eb.npu)||void 0===S?void 0:S.present)?(eb.npu.devices||[]).join(", "):"none"]}),(0,s.jsxs)("p",{className:"mt-2",children:["Decoder: ",(null==eb?void 0:null===(_=eb.recommendation)||void 0===_?void 0:_.video_decoder)||"cpu"]}),(0,s.jsxs)("p",{className:"mt-2",children:["HDMI: ",(null==eb?void 0:null===(D=eb.recommendation)||void 0===D?void 0:D.hdmi_player)||"cpu"]}),(0,s.jsxs)("p",{className:"mt-2",children:["Mode: ",(null==eb?void 0:null===(E=eb.recommendation)||void 0===E?void 0:E.stability_mode)||"safe"]})]})]})]}):null,"shellcrash"===z?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:"ShellCrash"}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:W("这里不再依赖命令行菜单,直接做 YAML / JSON / CFG 编辑与服务控制。","Manage ShellCrash from the web instead of the shell menu.")}),ti?(0,s.jsxs)("div",{className:"mt-4 rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:ti.label}),(0,s.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:ti.description})]}),(0,s.jsx)("span",{className:"rounded-full border px-2.5 py-1 text-xs ".concat(k(ti.status)),children:tz(ti.status)})]}),(0,s.jsx)("p",{className:"mt-3 text-xs text-slate-500",children:ti.detail||"-"}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{className:"bg-emerald-600",disabled:!ti.available||!!V,onClick:()=>void tE("shellcrash","start"),children:W("启动","Start")}),(0,s.jsx)(C,{className:"bg-amber-600",disabled:!ti.available||!!V,onClick:()=>void tE("shellcrash","restart"),children:W("重启","Restart")}),(0,s.jsx)(C,{className:"bg-rose-600",disabled:!ti.available||!!V,onClick:()=>void tE("shellcrash","stop"),children:W("停止","Stop")}),(0,s.jsx)(C,{className:"bg-sky-600",disabled:!ti.available||!!V,onClick:()=>void tO(w),children:"shellcrash:apply"===V?W("应用中...","Applying..."):W("应用默认配置","Apply Default")}),(0,s.jsx)(C,{className:"bg-cyan-600",disabled:!ti.available||!!V,onClick:()=>void tT(),children:"shellcrash:web_panel"===V?W("部署中...","Deploying..."):W("web面板","Web Panel")})]})]}):null,(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-sky-400/20 bg-sky-500/10 p-4 text-xs text-sky-100",children:[(0,s.jsx)("p",{className:"font-semibold",children:W("默认代理节点","Default proxy node")}),(0,s.jsx)("p",{className:"mt-2 break-all font-mono text-[11px] text-sky-200",children:j}),(0,s.jsx)("p",{className:"mt-2 text-sky-100/80",children:W("应用后会写入 config.yaml、重启 ShellCrash,并把包含该节点的选择组切到此节点。","Applying writes config.yaml, restarts ShellCrash, and selects this node in matching groups.")})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsx)("p",{className:"text-white",children:W("快捷文件","Quick Files")}),(0,s.jsxs)("div",{className:"mt-3 grid gap-2",children:[(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tk("shellcrash-yamls",w),children:w}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tk("shellcrash-yamls","config.yaml"),children:"config.yaml"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tk("shellcrash-configs","ShellCrash.cfg"),children:"ShellCrash.cfg"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tk("shellcrash-configs","servers.list"),children:"servers.list"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-left text-slate-200",onClick:()=>void tk("shellcrash-configs","command.env"),children:"command.env"})]})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:W("ShellCrash 文件编辑器","ShellCrash Editor")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:W("支持查看、修改、新建、删除,路径被限制在 ShellCrash 托管目录内。","View, edit, create and delete files inside managed ShellCrash roots.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("label",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-100 ".concat(V?"cursor-not-allowed opacity-40":""),children:["file:import"===V?W("导入中...","Importing..."):W("导入/替换","Import/Replace"),(0,s.jsx)("input",{className:"hidden",disabled:!!V,type:"file",accept:".yaml,.yml,.json,.cfg,.env,.list,.txt",onChange:e=>void tU(e)},e5)]}),(0,s.jsx)(C,{className:"bg-sky-600",disabled:"shellcrash-yamls"!==ew||!ek||!!V,onClick:()=>void tO(ek),children:"shellcrash:apply"===V?W("应用中...","Applying..."):W("应用当前 YAML","Apply YAML")}),(0,s.jsx)(C,{className:"bg-cyan-600",disabled:!ek||!!V,onClick:()=>void tR(),children:"file:save"===V?W("保存中...","Saving..."):W("保存","Save")})]})]}),(0,s.jsxs)("div",{className:"mt-4 grid gap-6 xl:grid-cols-[18rem,1fr]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("select",{className:"w-full rounded-2xl border border-white/12 bg-slate-950/60 px-4 py-3 text-sm text-white",value:ew,onChange:e=>{ej(e.target.value),eC("")},children:tr.map(e=>(0,s.jsxs)("option",{value:e.root_id,children:[e.label," | ",e.file_count]},e.root_id))}),(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{className:"bg-cyan-600",disabled:!!V,onClick:()=>void tA(),children:W("新建","New")}),(0,s.jsx)(C,{className:"bg-rose-600",disabled:!ek||!!V,onClick:()=>void tP(),children:W("删除","Delete")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:eN.map(e=>(0,s.jsxs)("button",{className:"btn-focus w-full rounded-2xl border px-4 py-3 text-left ".concat(ek===e.path?"border-cyan-500/40 bg-cyan-500/10":"border-white/8 bg-black/20"),onClick:()=>eC(e.path),children:[(0,s.jsx)("div",{className:"truncate text-sm text-white",children:e.path}),(0,s.jsx)("div",{className:"mt-1 text-[11px] text-slate-500",children:y(e.size)})]},e.path))})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"rounded-2xl border border-white/8 bg-black/20 px-4 py-3 font-mono text-[11px] text-slate-500",children:ek?"".concat(ew," / ").concat(ek):W("请选择文件","Pick a file")}),(0,s.jsx)("textarea",{className:"log-scroll mt-4 min-h-[32rem] w-full resize-y rounded-2xl border border-white/10 bg-black/45 p-4 font-mono text-xs leading-relaxed text-slate-200",spellCheck:!1,value:eS,onChange:e=>e_(e.target.value)})]})]})]})]}):null,"android"===z?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:W("安卓设备中心","Android Device Center")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:W("把设备发现、截图预览、ADB 动作和原始 web-scrcpy 放到一个模块里。","Combine discovery, preview, ADB actions and raw web-scrcpy in one module.")})]}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",onClick:()=>void(async()=>{let e=await tw();e&&await Promise.all([tj(e),ty(e),tN(e)]),eX(Date.now())})(),children:W("刷新设备","Refresh")})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-white",children:W("已连接设备","Devices")}),eD&&0!==eO.length?(0,s.jsx)("div",{className:"mt-3 space-y-2",children:eO.map(e=>(0,s.jsxs)("button",{className:"btn-focus w-full rounded-2xl border px-4 py-3 text-left ".concat(eR===e.serial?"border-cyan-500/40 bg-cyan-500/10":"border-white/8 bg-black/20"),onClick:()=>{eA(e.serial),Promise.all([tj(e.serial),ty(e.serial),tN(e.serial)]),eX(Date.now())},children:[(0,s.jsx)("div",{className:"text-sm text-white",children:e.model||e.device||e.serial}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[e.serial," | ",e.state]})]},e.serial))}):(0,s.jsx)("p",{className:"mt-3 text-sm text-slate-400",children:W("当前没有可用的 ADB 设备。","No active ADB device.")})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsx)("p",{className:"text-white",children:W("设备状态","Device Status")}),(0,s.jsxs)("p",{className:"mt-2",children:[(null==eP?void 0:eP.brand)||"-"," ",(null==eP?void 0:eP.model)||"-"]}),(0,s.jsxs)("p",{className:"mt-2",children:["Android ",(null==eP?void 0:eP.android_version)||"-"," / SDK ",(null==eP?void 0:eP.sdk)||"-"]}),(0,s.jsx)("p",{className:"mt-2 whitespace-pre-wrap",children:(null==eP?void 0:eP.battery)||"-"}),(0,s.jsx)("p",{className:"mt-2 whitespace-pre-wrap",children:(null==eP?void 0:eP.resolution)||"-"}),(0,s.jsx)("p",{className:"mt-2 whitespace-pre-wrap",children:(null==eP?void 0:eP.focus)||"-"})]})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:W("屏幕预览与动作","Screen Preview and Actions")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:W("预览图支持直接点按/双击/长按,配合 UI 节点和包管理形成更完整的安卓控制台。","The preview supports tap, double tap and long press, backed by UI nodes and package tools.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(C,{className:"border border-white/12 ".concat("tap"===e0?"bg-cyan-600":"bg-black/20"),disabled:!eR||!!V,onClick:()=>e2("tap"),children:W("点击","Tap")}),(0,s.jsx)(C,{className:"border border-white/12 ".concat("double_tap"===e0?"bg-cyan-600":"bg-black/20"),disabled:!eR||!!V,onClick:()=>e2("double_tap"),children:W("双击","Double Tap")}),(0,s.jsx)(C,{className:"border border-white/12 ".concat("long_press"===e0?"bg-cyan-600":"bg-black/20"),disabled:!eR||!!V,onClick:()=>e2("long_press"),children:W("长按","Long Press")}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",disabled:!eR,onClick:()=>eX(Date.now()),children:W("刷新截图","Refresh Shot")})]})]}),(0,s.jsx)("div",{className:"mt-4 overflow-hidden rounded-3xl border border-white/8 bg-black/35 p-4",children:eR?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-3 flex flex-wrap items-center gap-3 text-xs text-slate-400",children:[(0,s.jsxs)("span",{children:[W("当前动作","Current action"),": ",tI]}),(0,s.jsxs)("span",{children:[W("分辨率","Resolution"),": ",(null==eP?void 0:eP.resolution)||"-"]}),(0,s.jsxs)("span",{children:[W("最近坐标","Last point"),": ",e1?"".concat(e1.x,", ").concat(e1.y):"-"]}),tl?(0,s.jsx)("span",{className:"text-cyan-400/90",children:W("截图刷新中…","Refreshing…")}):null]}),te?(0,s.jsxs)("div",{className:"mb-3 rounded-xl border border-rose-500/30 bg-rose-950/25 px-4 py-3 text-sm text-rose-100",children:[W("截图不可用:","Screenshot unavailable: "),te]}):null,e9?(0,s.jsx)(a.default,{alt:"Android preview",className:"max-h-[min(70vh,48rem)] min-h-[14rem] w-full cursor-crosshair rounded-2xl object-contain bg-black",onClick:e=>void tM(e),src:e9,unoptimized:!0,width:(null==tm?void 0:tm.width)||1080,height:(null==tm?void 0:tm.height)||1920}):te?null:(0,s.jsx)("div",{className:"flex min-h-[18rem] items-center justify-center rounded-2xl border border-dashed border-white/10 bg-black/30 text-sm text-slate-500",children:W("正在拉取截图…","Fetching screenshot…")})]}):(0,s.jsx)("div",{className:"flex min-h-[18rem] items-center justify-center rounded-2xl border border-dashed border-white/10 bg-black/20 text-sm text-slate-500",children:W("当前没有可用的 ADB 设备。","No active ADB device.")})}),(0,s.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-3",children:[(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:W("快捷控制","Quick Controls")}),(0,s.jsxs)("div",{className:"mt-4 grid grid-cols-3 gap-2",children:[[["HOME","KEYCODE_HOME"],["BACK","KEYCODE_BACK"],["RECENTS","KEYCODE_APP_SWITCH"],["POWER","KEYCODE_POWER"],["NOTIFY","KEYCODE_NOTIFICATION"],["VOL+","KEYCODE_VOLUME_UP"],["VOL-","KEYCODE_VOLUME_DOWN"]].map(e=>{let[t,l]=e;return(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eR||!!V,onClick:()=>void tL("key",{keycode:l}),children:t},t)}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eR||!!V,onClick:()=>void tL("wake"),children:"WAKE"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eR||!!V,onClick:()=>void tL("rotate",{rotation:"0"}),children:"Portrait"}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs text-slate-100",disabled:!eR||!!V,onClick:()=>void tL("rotate",{rotation:"1"}),children:"Landscape"})]}),(0,s.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-2",children:["up","down","left","right"].map(e=>(0,s.jsxs)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-3 text-xs uppercase text-slate-100",disabled:!eR||!!V,onClick:()=>void tL("swipe",{direction:e}),children:["Swipe ",e]},e))})]}),(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:W("输入与跳转","Input and Launch")}),(0,s.jsx)("textarea",{className:"mt-4 min-h-[6rem] w-full rounded-2xl border border-white/10 bg-black/45 p-4 text-sm text-slate-200",placeholder:W("输入要发送到安卓输入框的文字","Text to send to Android"),value:eW,onChange:e=>eK(e.target.value)}),(0,s.jsx)(C,{className:"mt-3 bg-cyan-600",disabled:!eW.trim()||!eR||!!V,onClick:()=>void tL("text",{text:eW}),children:W("发送文本","Send Text")}),(0,s.jsx)("input",{className:"mt-4 w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:"com.zhiliaoapp.musically",value:eH,onChange:e=>eY(e.target.value)}),(0,s.jsxs)("div",{className:"mt-3 grid grid-cols-3 gap-2",children:[(0,s.jsx)(C,{className:"bg-emerald-600",disabled:!eH.trim()||!eR||!!V,onClick:()=>void tL("launch_package",{package:eH}),children:W("启动","Launch")}),(0,s.jsx)(C,{className:"bg-amber-600",disabled:!eH.trim()||!eR||!!V,onClick:()=>void tL("force_stop",{package:eH}),children:W("停应用","Stop App")}),(0,s.jsx)(C,{className:"bg-rose-600",disabled:!eH.trim()||!eR||!!V,onClick:()=>void tL("clear_app",{package:eH}),children:W("清数据","Clear Data")})]}),(0,s.jsx)("input",{className:"mt-4 w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:"https://www.tiktok.com",value:eJ,onChange:e=>eZ(e.target.value)}),(0,s.jsx)(C,{className:"mt-3 bg-violet-600",disabled:!eJ.trim()||!eR||!!V,onClick:()=>void tL("open_url",{url:eJ}),children:W("打开链接","Open URL")})]}),(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:W("应用工作台","App Workspace")}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",disabled:!eR||!!V,onClick:()=>void ty(eR),children:W("刷新UI","Refresh UI")})]}),(0,s.jsx)("div",{className:"mt-4 flex flex-wrap gap-2",children:[["TikTok","com.zhiliaoapp.musically"],["Chrome","com.android.chrome"],["Settings","com.android.settings"],["YouTube","com.google.android.youtube"],["Play","com.android.vending"]].map(e=>{let[t,l]=e;return(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 bg-slate-950/50 px-3 py-2 text-xs text-slate-100",disabled:!eR||!!V,onClick:()=>{eY(l),tL("launch_package",{package:l})},children:t},l)})}),(0,s.jsxs)("div",{className:"mt-4 flex gap-2",children:[(0,s.jsx)("input",{className:"w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:W("搜索包名,例如 tiktok","Search package, e.g. tiktok"),value:ez,onChange:e=>eF(e.target.value)}),(0,s.jsx)(C,{className:"bg-cyan-600",disabled:!eR||!!V,onClick:()=>void tN(eR),children:W("搜索","Search")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:0===eM.length?(0,s.jsx)("div",{className:"rounded-2xl border border-dashed border-white/10 px-4 py-6 text-sm text-slate-500",children:W("还没有查询结果。","No package results yet.")}):eM.slice(0,8).map(e=>(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-slate-950/30 p-3",children:[(0,s.jsx)("div",{className:"text-sm text-white",children:e.label||e.package.split(".").pop()}),(0,s.jsx)("div",{className:"mt-1 truncate font-mono text-[11px] text-slate-500",children:e.package}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eR||!!V,onClick:()=>{eY(e.package),tL("launch_package",{package:e.package})},children:W("启动","Launch")}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eR||!!V,onClick:()=>{eY(e.package),tL("force_stop",{package:e.package})},children:W("停应用","Stop")}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eR||!!V,onClick:()=>{eY(e.package),tL("clear_app",{package:e.package})},children:W("清数据","Clear")})]})]},e.package))})]})]}),(0,s.jsxs)("div",{className:"mt-6 grid gap-6 xl:grid-cols-[0.95fr,1.05fr]",children:[(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:"ADB Shell"}),(0,s.jsxs)("div",{className:"mt-4 flex flex-col gap-3 lg:flex-row",children:[(0,s.jsx)("input",{className:"w-full rounded-2xl border border-white/10 bg-black/45 px-4 py-3 text-sm text-slate-200",placeholder:"input keyevent KEYCODE_HOME",value:eG,onChange:e=>eV(e.target.value)}),(0,s.jsx)(C,{className:"bg-amber-600",disabled:!eG.trim()||!eR||!!V,onClick:()=>void tL("shell",{command:eG}),children:W("执行命令","Run Command")})]}),(0,s.jsx)("pre",{className:"log-scroll mt-4 min-h-[14rem] rounded-2xl border border-white/10 bg-black/45 p-4 font-mono text-[11px] text-slate-200",children:eQ||W("动作结果会显示在这里。","Action output will appear here.")})]}),(0,s.jsxs)("div",{className:"rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:W("UI 节点","UI Nodes")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:W("用 uiautomator 抓当前页面结构,快速定位可点击元素。","Inspect the current UI hierarchy and act on clickable nodes.")})]}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",disabled:!eR||!!V,onClick:()=>void ty(eR),children:W("刷新节点","Refresh Nodes")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-3",children:0===eL.length?(0,s.jsx)("div",{className:"rounded-2xl border border-dashed border-white/10 px-4 py-6 text-sm text-slate-500",children:W("还没有抓到 UI 节点。","No UI nodes yet.")}):eL.slice(0,12).map((e,t)=>(0,s.jsxs)("div",{className:"rounded-2xl border border-white/8 bg-slate-950/30 p-3",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"text-sm text-white",children:e.label||e.resource_id||e.class_name||"node"}),(0,s.jsx)("div",{className:"mt-1 text-[11px] text-slate-500",children:e.resource_id||e.class_name||"-"}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[e.bounds," | ",e.center_x,",",e.center_y]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eR||!!V,onClick:()=>void tL("tap",{x:e.center_x,y:e.center_y}),children:W("点击","Tap")}),(0,s.jsx)("button",{className:"btn-focus rounded-xl border border-white/10 px-3 py-2 text-xs text-slate-200",disabled:!eR||!!V,onClick:()=>void tL("long_press",{x:e.center_x,y:e.center_y,duration:750}),children:W("长按","Long Press")})]})]}),e.text||e.content_desc?(0,s.jsx)("div",{className:"mt-2 whitespace-pre-wrap text-xs text-slate-400",children:e.text||e.content_desc}):null]},"".concat(e.resource_id||e.label,"-").concat(t)))})]})]}),tx?(0,s.jsxs)("div",{className:"mt-6 rounded-3xl border border-white/8 bg-black/20 p-5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-white",children:"ws-scrcpy"}),(0,s.jsx)("a",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-200",href:tx,target:"_blank",rel:"noreferrer",children:W("新标签全屏打开","Open full tab")})]}),(0,s.jsx)("p",{className:"mt-2 text-xs leading-relaxed text-slate-500",children:W(th?"内嵌若黑屏:多为 WebSocket 未连上或服务未启动。请先确认「系统服务」里 android_panel 在线,并尝试新标签打开;Neko(Chromium)实例通常为 ".concat(th,"。"):"内嵌若黑屏:多为 WebSocket 未连上或服务未启动。请先确认「系统服务」里 android_panel 在线,并尝试新标签打开;Neko(Chromium)在 ENABLE_NEKO=1 且容器运行后一般为 9200 端口。",th?"Black iframe: often WebSocket or service down. Check android_panel in Services, try opening in a new tab; Neko Chromium instances are usually on ".concat(th,"."):"Black iframe: often WebSocket or service down. Check android_panel in Services, try opening in a new tab; Neko Chromium is often :9200 when ENABLE_NEKO=1 and the container is up.")}),(0,s.jsx)("iframe",{className:"mt-4 h-[30rem] w-full rounded-2xl border border-white/10 bg-black",src:tx,title:"ws-scrcpy"})]}):null]})]}):null,"config"===z?(0,s.jsxs)("section",{className:"grid gap-6 xl:grid-cols-12",children:[(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:W("配置中心","Config Center")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:W("系统级与业务级配置文件分目录托管,避免大杂烩。","System and business configs are isolated by managed roots.")})]}),(0,s.jsx)(C,{className:"border border-white/12 bg-black/20",onClick:()=>void tv(ew),children:W("刷新","Refresh")})]}),(0,s.jsx)("select",{className:"mt-4 w-full rounded-2xl border border-white/12 bg-slate-950/60 px-4 py-3 text-sm text-white",value:ew,onChange:e=>{ej(e.target.value),eC("")},children:tF.map(e=>(0,s.jsxs)("option",{value:e.root_id,children:[e.label," | ",e.file_count]},e.root_id))}),ta?(0,s.jsxs)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 p-4 text-xs text-slate-400",children:[(0,s.jsx)("p",{className:"text-white",children:ta.label}),(0,s.jsx)("p",{className:"mt-2",children:ta.description}),(0,s.jsx)("p",{className:"mt-2 font-mono text-[11px] text-slate-500",children:ta.path})]}):null,(0,s.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,s.jsx)(C,{className:"bg-cyan-600",disabled:!!V,onClick:()=>void tA(),children:W("新建","New")}),(0,s.jsx)(C,{className:"bg-rose-600",disabled:!ek||!!V,onClick:()=>void tP(),children:W("删除","Delete")})]}),(0,s.jsx)("div",{className:"mt-4 space-y-2",children:eN.map(e=>(0,s.jsxs)("button",{className:"btn-focus w-full rounded-2xl border px-4 py-3 text-left ".concat(ek===e.path?"border-cyan-500/40 bg-cyan-500/10":"border-white/8 bg-black/20"),onClick:()=>eC(e.path),children:[(0,s.jsx)("div",{className:"truncate text-sm text-white",children:e.path}),(0,s.jsxs)("div",{className:"mt-1 text-[11px] text-slate-500",children:[y(e.size)," | ",new Date(1e3*e.mtime).toLocaleString("zh"===L?"zh-CN":"en-US",{hour12:!1})]})]},e.path))})]}),(0,s.jsxs)("article",{className:"glass rounded-3xl p-6 xl:col-span-8",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-white",children:W("文件编辑器","Config Editor")}),(0,s.jsx)("p",{className:"mt-2 text-xs text-slate-400",children:W("仅允许编辑受管目录中的配置文件。","Only approved config roots are editable.")})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)("label",{className:"btn-focus rounded-xl border border-white/12 px-3 py-2 text-xs text-slate-100 ".concat(V?"cursor-not-allowed opacity-40":""),children:["file:import"===V?W("导入中...","Importing..."):W("导入/替换","Import/Replace"),(0,s.jsx)("input",{className:"hidden",disabled:!!V,type:"file",accept:".yaml,.yml,.json,.cfg,.env,.list,.txt,.ini",onChange:e=>void tU(e)},"config-".concat(e5))]}),(0,s.jsx)(C,{className:"bg-cyan-600",disabled:!ek||!!V,onClick:()=>void tR(),children:"file:save"===V?W("保存中...","Saving..."):W("保存","Save")})]})]}),(0,s.jsx)("div",{className:"mt-4 rounded-2xl border border-white/8 bg-black/20 px-4 py-3 font-mono text-[11px] text-slate-500",children:ek?"".concat(ew," / ").concat(ek):W("请选择文件","Pick a file")}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(m,{lang:L,rootId:ew,filePath:ek,fileContent:eS,refreshKey:e6,busy:V,fetchJson:tp,notify:tu,onChangeContent:e_,onRefreshListing:()=>tv(ew,ek)})}),(0,s.jsx)("textarea",{className:"log-scroll mt-4 min-h-[32rem] w-full resize-y rounded-2xl border border-white/10 bg-black/45 p-4 font-mono text-xs leading-relaxed text-slate-200",spellCheck:!1,value:eS,onChange:e=>e_(e.target.value)})]})]}):null]})]}),A?null:(0,s.jsx)("nav",{className:"fixed bottom-0 left-0 right-0 z-40 flex justify-around border-t border-white/15 bg-black/75 py-1.5 backdrop-blur-lg [html[data-theme=light]_&]:border-slate-200/60 [html[data-theme=light]_&]:bg-white/90 md:hidden",style:{paddingBottom:"max(0.35rem, env(safe-area-inset-bottom))"},"aria-label":W("主导航","Main nav"),children:f.map(e=>(0,s.jsxs)("button",{type:"button",className:"btn-focus flex min-w-0 flex-1 flex-col items-center gap-0.5 rounded-xl px-1 py-1 text-[10px] font-medium ".concat(z===e?"text-cyan-300 [html[data-theme=light]_&]:text-cyan-700":"text-slate-400 [html[data-theme=light]_&]:text-slate-600"),onClick:()=>F(e),children:[(0,s.jsx)("span",{className:"text-lg leading-none","aria-hidden":!0,children:tW[e]}),(0,s.jsx)("span",{className:"truncate",children:{overview:W("总览","Home"),business:W("业务","Biz"),modules:W("模块","Mods"),shellcrash:"SC",android:W("安卓","Droid"),config:W("配置","Cfg")}[e]})]},e))})]})}},1387:function(e,t,l){function s(e,t,l){return"string"==typeof(null==l?void 0:l.error)&&l.error.trim()||"string"==typeof(null==l?void 0:l.message)&&l.message.trim()||"string"==typeof(null==l?void 0:l.detail)&&l.detail.trim()||function(e){let t=e.replace(/\s+/g," ").trim();return t?t.length<=240?t:"".concat(t.slice(0,237),"..."):""}(t)||function(e){var t;let l=(null===(t=e.statusText)||void 0===t?void 0:t.trim())?" ".concat(e.statusText.trim()):"";return"HTTP ".concat(e.status).concat(l)}(e)}async function a(e,t){let l=await fetch(e,{cache:"no-store",...t}),a=(await l.text()).trim(),r=null;if(a)try{r=JSON.parse(a)}catch(t){if(!l.ok)throw Error(s(l,a,null));throw Error("Invalid JSON response from ".concat(e))}if(!l.ok)throw Error(s(l,a,r));return null!==r?r:{}}async function r(e){let t=(await e.text()).trim(),l=null;if(t)try{l=JSON.parse(t)}catch(e){l=null}return s(e,t,l)}l.d(t,{N:function(){return a},e:function(){return r}})},90:function(e,t,l){l.d(t,{O0:function(){return r},Tc:function(){return i},U_:function(){return n}});let s=/^neko_browser(?:(?:_(lan|wireguard|nat1to1|public))?(?:_(\d+))?)?$/i,a={wireguard:80,public:70,nat1to1:60,lan:50,direct:40};function r(e){let t=new Map;for(let[n,i]of Object.entries(null!=e?e:{})){var l,r;let e=n.match(s),o=i.trim();if(!e||!o)continue;let c=(e[1]||("neko_browser"===n||/^neko_browser_\d+$/i.test(n)?"direct":"lan")).toLowerCase(),d="neko_browser"===n?1:Number(e[2]||1),h={id:d,key:n,label:"Neko ".concat(d),url:o,port:function(e){try{return new URL(e,"http://127.0.0.1").port||""}catch(e){return""}}(o),accessKind:c,accessLabel:"wireguard"===c?"WireGuard":"public"===c?"Public":"nat1to1"===c?"NAT1TO1":"lan"===c?"LAN":"Direct",host:function(e){try{return new URL(e,"http://127.0.0.1").hostname||""}catch(e){return""}}(o)},x=t.get(d),m=x?null!==(l=a[x.accessKind])&&void 0!==l?l:0:-1,u=null!==(r=a[c])&&void 0!==r?r:0,p=!x||u>m||u===m&&"neko_browser"!==n;(!x||p)&&t.set(d,h)}return Array.from(t.values()).sort((e,t)=>e.id-t.id)}function n(e,t){return e.length?!Number.isInteger(t)||t<0?{link:e[0],fallback:!1}:t<e.length?{link:e[t],fallback:!1}:{link:e[0],fallback:!0}:{link:null,fallback:!1}}function i(e){let t=Array.from(new Set(e.map(e=>e.port).filter(Boolean)));return t.length?t.map(e=>":".concat(e)).join(" / "):""}},8401:function(e,t,l){l.d(t,{p:function(){return s}});function s(e){let t=e.trim();if(!t)return t;try{let e=new URL(t,window.location.origin),l=e.hostname,s=window.location.hostname;if("0.0.0.0"===l||"::"===l||"[::]"===l)return e.hostname=s||l,e.toString();if(("127.0.0.1"===l||"localhost"===l)&&s&&"127.0.0.1"!==s&&"localhost"!==s)return e.hostname=s,e.toString();if(l.endsWith(".local")&&"8001"===e.port)return"".concat(e.pathname||"/").concat(e.search).concat(e.hash);if(l.endsWith(".local")&&s&&s!==l)return e.hostname=s,e.toString();return t}catch(e){return t}}}}]); |