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